diff --git a/.cproject b/.cproject new file mode 100644 index 0000000000000000000000000000000000000000..efb1c675513d7b546108f57426d9c558c3af5dff --- /dev/null +++ b/.cproject @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000000000000000000000000000000000000..16a4b9f2a05b569980a12348b0202224259d9298 --- /dev/null +++ b/.project @@ -0,0 +1,33 @@ + + + Lab0 + + + + + + com.freescale.processorexpert.core.expertprojectbuilder + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + com.freescale.processorexpert.core.expertprojectnature + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + diff --git a/.settings/com.freescale.processorexpert.core.prefs b/.settings/com.freescale.processorexpert.core.prefs new file mode 100644 index 0000000000000000000000000000000000000000..e9beb854b96cf01add3af2d457760748de90fefa --- /dev/null +++ b/.settings/com.freescale.processorexpert.core.prefs @@ -0,0 +1,21 @@ +# +# Please do not modify or delete this file +# +eclipse.preferences.version=1 +DERIVATIVE_NAME=MK70FN1M0xxx12 +PE_FAMILY=Kinetis +PE_CPE_FILE=MCU10 +PE_MODE=CLASSIC +LANGUAGE=c +LANGUAGE_POSSIBILITIES=${com.processorexpert.wizard.language.c} ${com.processorexpert.wizard.language.asm} +COMPILER=GNU C Compiler +VARIANTS=MK70FN1M0VMJ12 +CONFIGURATIONS=RAM;FLASH +PROJECT_NAME=ProcessorExpert +INIT_ALL_PERIPHS=NO +INIT_PINSETTINGS=NO +STANDALONE=STANDALONE +SDK_PROJECT=NO +SDK_PATH=C:\Freescale\KSDK_1.2.0 +MQX_LITE=NO +BOARD_NAME=${ProcessorBoard} diff --git a/.settings/com.freescale.processorexpert.derivative.prefs b/.settings/com.freescale.processorexpert.derivative.prefs new file mode 100644 index 0000000000000000000000000000000000000000..f222c70bce769967de3309cb91ff1dbd9d068553 --- /dev/null +++ b/.settings/com.freescale.processorexpert.derivative.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +versionGenerated/versionGenerated=1.0.0.RT7_b1515-0427 diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml new file mode 100644 index 0000000000000000000000000000000000000000..31c305e8ec4fcda921260afa131299723a8a95c6 --- /dev/null +++ b/.settings/language.settings.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/.settings/org.eclipse.cdt.codan.core.prefs b/.settings/org.eclipse.cdt.codan.core.prefs new file mode 100644 index 0000000000000000000000000000000000000000..fe13b550b3b741e5926089a75e82e1ab3e470e61 --- /dev/null +++ b/.settings/org.eclipse.cdt.codan.core.prefs @@ -0,0 +1,67 @@ +eclipse.preferences.version=1 +org.eclipse.cdt.codan.checkers.errnoreturn=Warning +org.eclipse.cdt.codan.checkers.errnoreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},implicit\=>false} +org.eclipse.cdt.codan.checkers.errreturnvalue=Error +org.eclipse.cdt.codan.checkers.errreturnvalue.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} +org.eclipse.cdt.codan.checkers.noreturn=Error +org.eclipse.cdt.codan.checkers.noreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},implicit\=>false} +org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation=Error +org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} +org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem=Error +org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} +org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem=Warning +org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} +org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem=Error +org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} +org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem=Warning +org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},no_break_comment\=>"no break",last_case_param\=>false,empty_case_param\=>false} +org.eclipse.cdt.codan.internal.checkers.CatchByReference=Warning +org.eclipse.cdt.codan.internal.checkers.CatchByReference.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},unknown\=>false,exceptions\=>()} +org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem=Error +org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} +org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization=Warning +org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},skip\=>true} +org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem=Error +org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} +org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem=Error +org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} +org.eclipse.cdt.codan.internal.checkers.InvalidArguments=Error +org.eclipse.cdt.codan.internal.checkers.InvalidArguments.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} +org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem=Error +org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} +org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem=Error +org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} +org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem=Error +org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} +org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem=Error +org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} +org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker=-Info +org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},pattern\=>"^[a-z]",macro\=>true,exceptions\=>()} +org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem=Warning +org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} +org.eclipse.cdt.codan.internal.checkers.OverloadProblem=Error +org.eclipse.cdt.codan.internal.checkers.OverloadProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} +org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem=Error +org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} +org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem=Error +org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} +org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} +org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} +org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem=Warning +org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true,exceptions\=>()} +org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem=Warning +org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},paramNot\=>false} +org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem=Warning +org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},else\=>false,afterelse\=>false} +org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem=Error +org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} +org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem=Warning +org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true} +org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem=Warning +org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true} +org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem=Warning +org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true,exceptions\=>("@(\#)","$Id")} +org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem=Error +org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} diff --git a/.settings/org.eclipse.cdt.core.prefs b/.settings/org.eclipse.cdt.core.prefs new file mode 100644 index 0000000000000000000000000000000000000000..e8de000c8e79de09707e1361de89b136ee544369 --- /dev/null +++ b/.settings/org.eclipse.cdt.core.prefs @@ -0,0 +1,163 @@ +eclipse.preferences.version=1 +org.eclipse.cdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.cdt.core.formatter.alignment_for_assignment=16 +org.eclipse.cdt.core.formatter.alignment_for_base_clause_in_type_declaration=80 +org.eclipse.cdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.cdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.cdt.core.formatter.alignment_for_conditional_expression=34 +org.eclipse.cdt.core.formatter.alignment_for_conditional_expression_chain=18 +org.eclipse.cdt.core.formatter.alignment_for_constructor_initializer_list=0 +org.eclipse.cdt.core.formatter.alignment_for_declarator_list=16 +org.eclipse.cdt.core.formatter.alignment_for_enumerator_list=48 +org.eclipse.cdt.core.formatter.alignment_for_expression_list=0 +org.eclipse.cdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.cdt.core.formatter.alignment_for_member_access=0 +org.eclipse.cdt.core.formatter.alignment_for_overloaded_left_shift_chain=16 +org.eclipse.cdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.cdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.cdt.core.formatter.brace_position_for_array_initializer=next_line_shifted +org.eclipse.cdt.core.formatter.brace_position_for_block=next_line_shifted +org.eclipse.cdt.core.formatter.brace_position_for_block_in_case=next_line_shifted +org.eclipse.cdt.core.formatter.brace_position_for_method_declaration=next_line +org.eclipse.cdt.core.formatter.brace_position_for_namespace_declaration=next_line +org.eclipse.cdt.core.formatter.brace_position_for_switch=next_line_shifted +org.eclipse.cdt.core.formatter.brace_position_for_type_declaration=next_line +org.eclipse.cdt.core.formatter.comment.min_distance_between_code_and_line_comment=1 +org.eclipse.cdt.core.formatter.comment.never_indent_line_comments_on_first_column=true +org.eclipse.cdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=true +org.eclipse.cdt.core.formatter.compact_else_if=true +org.eclipse.cdt.core.formatter.continuation_indentation=2 +org.eclipse.cdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.cdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.cdt.core.formatter.indent_access_specifier_compare_to_type_header=false +org.eclipse.cdt.core.formatter.indent_access_specifier_extra_spaces=0 +org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_access_specifier=true +org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_namespace_header=true +org.eclipse.cdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.cdt.core.formatter.indent_declaration_compare_to_template_header=true +org.eclipse.cdt.core.formatter.indent_empty_lines=false +org.eclipse.cdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.cdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.cdt.core.formatter.indentation.size=2 +org.eclipse.cdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.cdt.core.formatter.insert_new_line_after_template_declaration=insert +org.eclipse.cdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.cdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert +org.eclipse.cdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.cdt.core.formatter.insert_new_line_before_colon_in_constructor_initializer_list=do not insert +org.eclipse.cdt.core.formatter.insert_new_line_before_else_in_if_statement=insert +org.eclipse.cdt.core.formatter.insert_new_line_before_identifier_in_function_declaration=insert +org.eclipse.cdt.core.formatter.insert_new_line_before_while_in_do_statement=insert +org.eclipse.cdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.cdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.cdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_arguments=insert +org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_parameters=insert +org.eclipse.cdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.cdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.cdt.core.formatter.insert_space_after_colon_in_base_clause=insert +org.eclipse.cdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.cdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.cdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.cdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.cdt.core.formatter.insert_space_after_comma_in_base_types=insert +org.eclipse.cdt.core.formatter.insert_space_after_comma_in_declarator_list=insert +org.eclipse.cdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.cdt.core.formatter.insert_space_after_comma_in_expression_list=insert +org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_arguments=insert +org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_parameters=insert +org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_arguments=do not insert +org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_parameters=do not insert +org.eclipse.cdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.cdt.core.formatter.insert_space_after_opening_bracket=do not insert +org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_exception_specification=do not insert +org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.cdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.cdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.cdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.cdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.cdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.cdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_arguments=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_parameters=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.cdt.core.formatter.insert_space_before_closing_bracket=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_exception_specification=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_colon_in_base_clause=insert +org.eclipse.cdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.cdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_comma_in_base_types=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_comma_in_declarator_list=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_comma_in_expression_list=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_arguments=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_parameters=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_arguments=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_parameters=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_namespace_declaration=insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_bracket=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_exception_specification=insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.cdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.cdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.cdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.cdt.core.formatter.insert_space_between_empty_brackets=do not insert +org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_exception_specification=do not insert +org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.cdt.core.formatter.join_wrapped_lines=true +org.eclipse.cdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.cdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.cdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.cdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.cdt.core.formatter.lineSplit=80 +org.eclipse.cdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.cdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.cdt.core.formatter.tabulation.char=mixed +org.eclipse.cdt.core.formatter.tabulation.size=8 +org.eclipse.cdt.core.formatter.use_tabs_only_for_leading_indentations=false diff --git a/.settings/org.eclipse.cdt.ui.prefs b/.settings/org.eclipse.cdt.ui.prefs new file mode 100644 index 0000000000000000000000000000000000000000..68cdc88c84c84619fdc2fa5ded2e2b6fed9b8645 --- /dev/null +++ b/.settings/org.eclipse.cdt.ui.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +formatter_profile=org.eclipse.cdt.ui.default.gnu_profile +formatter_settings_version=1 diff --git a/.settings/org.eclipse.ltk.core.refactoring.prefs b/.settings/org.eclipse.ltk.core.refactoring.prefs new file mode 100644 index 0000000000000000000000000000000000000000..cfcd1d3c22f7ad061b0ffb72377bff737ba31120 --- /dev/null +++ b/.settings/org.eclipse.ltk.core.refactoring.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false diff --git a/Debug/objects.mk b/Debug/objects.mk new file mode 100644 index 0000000000000000000000000000000000000000..bf79edcfb799ac95f3f59eb215acfa8a3bc51632 --- /dev/null +++ b/Debug/objects.mk @@ -0,0 +1,8 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +USER_OBJS := + +LIBS := -lLab0 + diff --git a/Debug/sources.mk b/Debug/sources.mk new file mode 100644 index 0000000000000000000000000000000000000000..b69fb0eee123c86d775373aaba8a720329cdc5f8 --- /dev/null +++ b/Debug/sources.mk @@ -0,0 +1,30 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +O_SRCS := +CPP_SRCS := +C_UPPER_SRCS := +C_SRCS := +S_UPPER_SRCS := +OBJ_SRCS := +ASM_SRCS := +CXX_SRCS := +C++_SRCS := +CC_SRCS := +C++_DEPS := +OBJS := +C_DEPS := +ASM_DEPS := +CC_DEPS := +CPP_DEPS := +CXX_DEPS := +C_UPPER_DEPS := +S_UPPER_DEPS := + +# Every subdirectory with source files must be described here +SUBDIRS := \ +Sources \ +Project_Settings/Startup_Code \ +Generated_Code \ + diff --git a/Documentation/Lab0_Settings.xml b/Documentation/Lab0_Settings.xml new file mode 100644 index 0000000000000000000000000000000000000000..ff6dcd5be202fb10b5d844281384700fe472c0c1 --- /dev/null +++ b/Documentation/Lab0_Settings.xml @@ -0,0 +1,220 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + +
+ + + + + + + +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + +
+ + + + + + + +
+ + + + + + + +
+ + + + + + + + + diff --git a/Generated_Code/Cpu.c b/Generated_Code/Cpu.c new file mode 100644 index 0000000000000000000000000000000000000000..8be2de4d0f7cfd0489a93569471bfb312be4991c --- /dev/null +++ b/Generated_Code/Cpu.c @@ -0,0 +1,588 @@ +/* ################################################################### +** This component module is generated by Processor Expert. Do not modify it. +** Filename : Cpu.c +** Project : Lab0 +** Processor : MK70FN1M0VMJ12 +** Component : MK70FN1M0MJ15 +** Version : Component 01.028, Driver 01.04, CPU db: 3.00.000 +** Repository : Kinetis +** Datasheet : K70P256M150SF3RM, Rev. 2, Dec 2011 +** Compiler : GNU C Compiler +** Date/Time : 2018-07-15, 23:43, # CodeGen: 0 +** Abstract : +** +** Settings : +** Component name : Cpu +** CPU type : MK70FN1M0VMJ12 +** CPU : CPU +** MemModelDev : MemModel_NoFlexMem +** Clock settings : +** Internal oscillator : +** Slow internal reference clock [kHz] : 32.768 +** Initialize slow trim value : no +** Fast internal reference clock [MHz] : 4 +** Initialize fast trim value : no +** RTC oscillator : Disabled +** System oscillator 0 : Disabled +** System oscillator 1 : Disabled +** Clock source settings : 1 +** Clock source setting 0 : +** Internal reference clock : +** MCGIRCLK clock : Enabled +** MCGIRCLK in stop : Disabled +** MCGIRCLK source : Slow +** MCGIRCLK clock [MHz] : 0.032768 +** External reference clock : +** OSC0ERCLK clock : Enabled +** OSC0ERCLK in stop : Disabled +** OSC0ERCLK clock [MHz] : 0 +** OSC1ERCLK clock : Enabled +** OSC1ERCLK in stop : Disabled +** OSC1ERCLK clock [MHz] : 0 +** ERCLK32K clock source : System oscillator 0 +** ERCLK32K. clock [kHz] : 0 +** MCG settings : +** MCG mode : FEI +** MCG output clock : FLL clock +** MCG output [MHz] : 20.97152 +** MCG external ref. clock source : System oscillator 0 +** MCG external ref. clock [MHz] : 0 +** Clock monitor : +** System oscillator 0 : Disabled +** RTC oscillator : Disabled +** System oscillator 1 : Disabled +** FLL settings : +** FLL module : Enabled +** FLL output [MHz] : 20.97152 +** MCGFFCLK clock [kHz] : 16.384 +** Reference clock source : Slow internal clock +** FLL reference clock [kHz] : 32.768 +** Multiplication factor : Auto select +** PLL 0 settings : +** PLL module : Disabled +** PLL module in Stop : Disabled +** External reference select : System oscillator 0 +** PLL output [MHz] : 0 +** Reference clock divider : Auto select +** PLL reference clock [MHz] : 1 +** Multiplication factor : Auto select +** Loss of lock interrupt : Disabled +** PLL 1 settings : +** PLL module : Disabled +** PLL module in Stop : Disabled +** PLL output [MHz] : 0 +** External reference select : System oscillator 0 +** Reference clock divider : Auto select +** PLL reference clock [MHz] : 1 +** Multiplication factor : Auto select +** Loss of lock interrupt : Disabled +** Initialization priority : minimal priority +** Watchdog disable : yes +** Internal peripherals : +** NMI pin : Disabled +** Reset control : Enabled +** Reset pin : RESET_b +** Reset pin signal : +** Filter in STOP : Disabled +** Filter in RUN/WAIT : Disabled +** Filter width : 1 +** Debug interface (JTAG) : +** JTAG Mode : JTAG +** TDI : Enabled +** TDI Pin : TSI0_CH2/PTA1/UART0_RX/FTM0_CH6/JTAG_TDI/EZP_DI +** TDI Pin signal : +** TDO : Enabled +** TDO Pin : TSI0_CH3/PTA2/UART0_TX/FTM0_CH7/JTAG_TDO/TRACE_SWO/EZP_DO +** TDO Pin signal : +** TCK : Enabled +** TCK Pin : TSI0_CH1/PTA0/UART0_CTS_b/UART0_COL_b/FTM0_CH5/JTAG_TCLK/SWD_CLK/EZP_CLK +** TCK Pin signal : +** TMS : Enabled +** TMS Pin : TSI0_CH4/PTA3/UART0_RTS_b/FTM0_CH0/JTAG_TMS/SWD_DIO +** TMS Pin signal : +** nTRST : Disabled +** Flash memory organization : +** Flash blocks : 4 +** Flash block 0 : PFlash +** Address : 0x0 +** Size : 262144 +** Write unit size : 8 +** Erase unit size : 4096 +** Protection unit size : 32768 +** Flash block 1 : PFlash +** Address : 0x40000 +** Size : 262144 +** Write unit size : 8 +** Erase unit size : 4096 +** Protection unit size : 32768 +** Flash block 2 : PFlash +** Address : 0x80000 +** Size : 262144 +** Write unit size : 8 +** Erase unit size : 4096 +** Protection unit size : 32768 +** Flash block 3 : PFlash +** Address : 0xC0000 +** Size : 262144 +** Write unit size : 8 +** Erase unit size : 4096 +** Protection unit size : 32768 +** Flexible memory controller : Disabled +** Flash configuration field : Enabled +** Security settings : +** Flash security : Disabled +** Freescale failure analysis access : Enabled +** Mass erase : Enabled +** Backdoor key security : Disabled +** Backdoor key 0 : 255 +** Backdoor key 1 : 255 +** Backdoor key 2 : 255 +** Backdoor key 3 : 255 +** Backdoor key 4 : 255 +** Backdoor key 5 : 255 +** Backdoor key 6 : 255 +** Backdoor key 7 : 255 +** Protection regions : +** P-Flash protection settings : +** Protection region size : 32768 +** P-Flash protection : 0xFFFFFFFF +** Protection regions : +** Protection region 0 : Unprotected +** Protection region 1 : Unprotected +** Protection region 2 : Unprotected +** Protection region 3 : Unprotected +** Protection region 4 : Unprotected +** Protection region 5 : Unprotected +** Protection region 6 : Unprotected +** Protection region 7 : Unprotected +** Protection region 8 : Unprotected +** Protection region 9 : Unprotected +** Protection region 10 : Unprotected +** Protection region 11 : Unprotected +** Protection region 12 : Unprotected +** Protection region 13 : Unprotected +** Protection region 14 : Unprotected +** Protection region 15 : Unprotected +** Protection region 16 : Unprotected +** Protection region 17 : Unprotected +** Protection region 18 : Unprotected +** Protection region 19 : Unprotected +** Protection region 20 : Unprotected +** Protection region 21 : Unprotected +** Protection region 22 : Unprotected +** Protection region 23 : Unprotected +** Protection region 24 : Unprotected +** Protection region 25 : Unprotected +** Protection region 26 : Unprotected +** Protection region 27 : Unprotected +** Protection region 28 : Unprotected +** Protection region 29 : Unprotected +** Protection region 30 : Unprotected +** Protection region 31 : Unprotected +** D-Flash protection settings : +** Protection region size : +** D-Flash protection : 0xFF +** Protection regions : +** Protection region 0 : Unprotected +** Protection region 1 : Unprotected +** Protection region 2 : Unprotected +** Protection region 3 : Unprotected +** Protection region 4 : Unprotected +** Protection region 5 : Unprotected +** Protection region 6 : Unprotected +** Protection region 7 : Unprotected +** Eeprom protection settings : +** Protection region size : +** Eeprom protection : 0xFF +** Protection regions : +** Protection region 0 : Unprotected +** Protection region 1 : Unprotected +** Protection region 2 : Unprotected +** Protection region 3 : Unprotected +** Protection region 4 : Unprotected +** Protection region 5 : Unprotected +** Protection region 6 : Unprotected +** Protection region 7 : Unprotected +** Peripheral settings : +** EzPort operation at boot : Enabled +** Low power boot : Disabled +** MPU settings : Enabled +** MPU module : Disabled +** AXBS settings : Disabled +** AIPS0 settings : Disabled +** AIPS1 settings : Disabled +** MCM settings : Disabled +** System control block settings : Disabled +** Power management controller : +** LVD reset : Enabled +** LVD voltage treshold : Low +** LVW voltage treshold : Low +** Bandgap buffer : Disabled +** LVD interrupt : +** Interrupt : INT_LVD_LVW +** Interrupt request : Disabled +** Interrupt priority : 0 (Highest) +** LVD interrupt : Disabled +** LVW interrupt : Disabled +** System Integration Module : +** CLKOUT pin control : Disabled +** CMT/UART pad drive strength : Single-pad drive +** Clock gating control : Disabled +** CPU interrupts/resets : +** NMI interrupt : Disabled +** Hard Fault : Disabled +** Bus Fault : Disabled +** Usage Fault : Disabled +** Supervisor Call : Disabled +** Pendable Service : Disabled +** MCG : Disabled +** DDR module : Disabled +** External Bus : Disabled +** Low power mode settings : +** Allowed power modes : +** Very low power modes : Not allowed +** Low leakage stop mode : Not allowed +** Very low leakage stop mode : Not allowed +** LLWU settings : Disabled +** Operation mode settings : +** WAIT operation mode : +** Return to wait after ISR : no +** SLEEP operation mode : +** Return to stop after ISR : no +** STOP operation mode : Disabled +** Clock configurations : 1 +** Clock configuration 0 : +** __IRC_32kHz : 0.032768 +** __IRC_4MHz : 2 +** __SYSTEM_OSC : 8 +** __OSC1 : 8 +** __RTC_OSC : 0 +** Very low power mode : Disabled +** Clock source setting : configuration 0 +** MCG mode : FEI +** MCG output [MHz] : 20.97152 +** MCGIRCLK clock [MHz] : 0.032768 +** OSCERCLK clock [MHz] : 0 +** ERCLK32K. clock [kHz] : 0 +** MCGFFCLK [kHz] : 16.384 +** System clocks : +** Core clock prescaler : Auto select +** Core clock : 20.97152 +** Bus clock prescaler : Auto select +** Bus clock : 20.97152 +** External clock prescaler : Auto select +** External bus clock : 10.48576 +** Flash clock prescaler : Auto select +** Flash clock : 10.48576 +** PLL/FLL clock selection : FLL +** Clock frequency [MHz] : 20.97152 +** Contents : +** No public methods +** +** Copyright : 1997 - 2015 Freescale Semiconductor, Inc. +** All Rights Reserved. +** +** Redistribution and use in source and binary forms, with or without modification, +** are permitted provided that the following conditions are met: +** +** o Redistributions of source code must retain the above copyright notice, this list +** of conditions and the following disclaimer. +** +** o Redistributions in binary form must reproduce the above copyright notice, this +** list of conditions and the following disclaimer in the documentation and/or +** other materials provided with the distribution. +** +** o Neither the name of Freescale Semiconductor, Inc. nor the names of its +** contributors may be used to endorse or promote products derived from this +** software without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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. +** +** http: www.freescale.com +** mail: support@freescale.com +** ###################################################################*/ +/*! +** @file Cpu.c +** @version 01.04 +** @brief +** +*/ +/*! +** @addtogroup Cpu_module Cpu module documentation +** @{ +*/ + +/* MODULE Cpu. */ + +/* {Default RTOS Adapter} No RTOS includes */ +#include "PE_Types.h" +#include "PE_Error.h" +#include "PE_Const.h" +#include "IO_Map.h" +#include "Cpu.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Global variables */ +volatile uint8_t SR_reg; /* Current value of the FAULTMASK register */ +volatile uint8_t SR_lock = 0x00U; /* Lock */ + +/* +** =================================================================== +** Method : Cpu_SetBASEPRI (component MK70FN1M0MJ15) +** +** Description : +** This method sets the BASEPRI core register. +** This method is internal. It is used by Processor Expert only. +** =================================================================== +*/ +void Cpu_SetBASEPRI(uint32_t Level); + +/* +** =================================================================== +** Method : Cpu_Cpu_Interrupt (component MK70FN1M0MJ15) +** +** Description : +** This ISR services an unused interrupt/exception vector. +** This method is internal. It is used by Processor Expert only. +** =================================================================== +*/ +PE_ISR(Cpu_Interrupt) +{ + /* This code can be changed using the CPU component property "Build Options / Unhandled int code" */ + PE_DEBUGHALT(); +} + + +/*** !!! Here you can place your own code using property "User data declarations" on the build options tab. !!! ***/ + +/*lint -esym(765,__init_hardware) Disable MISRA rule (8.10) checking for symbols (__init_hardware). The function is linked to the EWL library */ +/*lint -esym(765,Cpu_Interrupt) Disable MISRA rule (8.10) checking for symbols (Cpu_Interrupt). */ +void __init_hardware(void) +{ + + /*** !!! Here you can place your own code before PE initialization using property "User code before PE initialization" on the build options tab. !!! ***/ + + /*** ### MK70FN1M0VMJ12 "Cpu" init code ... ***/ + /*** PE initialization code after reset ***/ + SCB_VTOR = (uint32_t)(&__vect_table); /* Set the interrupt vector table position */ + /* Disable the WDOG module */ + /* WDOG_UNLOCK: WDOGUNLOCK=0xC520 */ + WDOG_UNLOCK = WDOG_UNLOCK_WDOGUNLOCK(0xC520); /* Key 1 */ + /* WDOG_UNLOCK: WDOGUNLOCK=0xD928 */ + WDOG_UNLOCK = WDOG_UNLOCK_WDOGUNLOCK(0xD928); /* Key 2 */ + /* WDOG_STCTRLH: ??=0,DISTESTWDOG=0,BYTESEL=0,TESTSEL=0,TESTWDOG=0,??=0,??=1,WAITEN=1,STOPEN=1,DBGEN=0,ALLOWUPDATE=1,WINEN=0,IRQRSTEN=0,CLKSRC=1,WDOGEN=0 */ + WDOG_STCTRLH = WDOG_STCTRLH_BYTESEL(0x00) | + WDOG_STCTRLH_WAITEN_MASK | + WDOG_STCTRLH_STOPEN_MASK | + WDOG_STCTRLH_ALLOWUPDATE_MASK | + WDOG_STCTRLH_CLKSRC_MASK | + 0x0100U; + + /* System clock initialization */ + /* SIM_CLKDIV1: OUTDIV1=0,OUTDIV2=1,OUTDIV3=3,OUTDIV4=3,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0 */ + SIM_CLKDIV1 = SIM_CLKDIV1_OUTDIV1(0x00) | + SIM_CLKDIV1_OUTDIV2(0x01) | + SIM_CLKDIV1_OUTDIV3(0x03) | + SIM_CLKDIV1_OUTDIV4(0x03); /* Set the system prescalers to safe value */ + /* SIM_SCGC5: PORTA=1 */ + SIM_SCGC5 |= SIM_SCGC5_PORTA_MASK; /* Enable clock gate for ports to enable pin routing */ + if ((PMC_REGSC & PMC_REGSC_ACKISO_MASK) != 0x0U) { + /* PMC_REGSC: ACKISO=1 */ + PMC_REGSC |= PMC_REGSC_ACKISO_MASK; /* Release IO pads after wakeup from VLLS mode. */ + } + /* SIM_CLKDIV1: OUTDIV1=0,OUTDIV2=0,OUTDIV3=1,OUTDIV4=1,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0 */ + SIM_CLKDIV1 = SIM_CLKDIV1_OUTDIV1(0x00) | + SIM_CLKDIV1_OUTDIV2(0x00) | + SIM_CLKDIV1_OUTDIV3(0x01) | + SIM_CLKDIV1_OUTDIV4(0x01); /* Update system prescalers */ + /* SIM_SOPT2: PLLFLLSEL=0 */ + SIM_SOPT2 &= (uint32_t)~(uint32_t)(SIM_SOPT2_PLLFLLSEL(0x03)); /* Select FLL as a clock source for various peripherals */ + /* SIM_SOPT1: OSC32KSEL=0 */ + SIM_SOPT1 &= (uint32_t)~(uint32_t)(SIM_SOPT1_OSC32KSEL_MASK); /* System oscillator drives 32 kHz clock for various peripherals */ + /* SIM_SCGC1: OSC1=1 */ + SIM_SCGC1 |= SIM_SCGC1_OSC1_MASK; + /* Switch to FEI Mode */ + /* MCG_C1: CLKS=0,FRDIV=0,IREFS=1,IRCLKEN=1,IREFSTEN=0 */ + MCG_C1 = MCG_C1_CLKS(0x00) | + MCG_C1_FRDIV(0x00) | + MCG_C1_IREFS_MASK | + MCG_C1_IRCLKEN_MASK; + /* MCG_C2: LOCRE0=0,??=0,RANGE0=0,HGO0=0,EREFS0=0,LP=0,IRCS=0 */ + MCG_C2 = MCG_C2_RANGE0(0x00); + /* MCG_C4: DMX32=0,DRST_DRS=0 */ + MCG_C4 &= (uint8_t)~(uint8_t)((MCG_C4_DMX32_MASK | MCG_C4_DRST_DRS(0x03))); + /* OSC0_CR: ERCLKEN=1,??=0,EREFSTEN=0,??=0,SC2P=0,SC4P=0,SC8P=0,SC16P=0 */ + OSC0_CR = OSC_CR_ERCLKEN_MASK; + /* MCG_C10: LOCRE2=0,??=0,RANGE1=0,HGO1=0,EREFS1=0,??=0,??=0 */ + MCG_C10 = MCG_C10_RANGE1(0x00); + /* OSC1_CR: ERCLKEN=1,??=0,EREFSTEN=0,??=0,SC2P=0,SC4P=0,SC8P=0,SC16P=0 */ + OSC1_CR = OSC_CR_ERCLKEN_MASK; + /* MCG_C7: OSCSEL=0 */ + MCG_C7 &= (uint8_t)~(uint8_t)(MCG_C7_OSCSEL_MASK); + /* MCG_C5: PLLREFSEL0=0,PLLCLKEN0=0,PLLSTEN0=0,??=0,??=0,PRDIV0=0 */ + MCG_C5 = MCG_C5_PRDIV0(0x00); + /* MCG_C6: LOLIE0=0,PLLS=0,CME0=0,VDIV0=0 */ + MCG_C6 = MCG_C6_VDIV0(0x00); + /* MCG_C11: PLLREFSEL1=0,PLLCLKEN1=0,PLLSTEN1=0,PLLCS=0,??=0,PRDIV1=0 */ + MCG_C11 = MCG_C11_PRDIV1(0x00); + /* MCG_C12: LOLIE1=0,??=0,CME2=0,VDIV1=0 */ + MCG_C12 = MCG_C12_VDIV1(0x00); /* 3 */ + while((MCG_S & MCG_S_IREFST_MASK) == 0x00U) { /* Check that the source of the FLL reference clock is the internal reference clock. */ + } + while((MCG_S & 0x0CU) != 0x00U) { /* Wait until output of the FLL is selected */ + } + /*** End of PE initialization code after reset ***/ + + /*** !!! Here you can place your own code after PE initialization using property "User code after PE initialization" on the build options tab. !!! ***/ + +} + +/* +** =================================================================== +** Method : Cpu_SetBASEPRI (component MK70FN1M0MJ15) +** +** Description : +** This method sets the BASEPRI core register. +** This method is internal. It is used by Processor Expert only. +** =================================================================== +*/ +/*lint -save -e586 -e950 Disable MISRA rule (2.1,1.1) checking. */ +#ifdef _lint + #define Cpu_SetBASEPRI(Level) /* empty */ +#else +void Cpu_SetBASEPRI(uint32_t Level) { + __asm ("msr basepri, %[input]"::[input] "r" (Level):); +} +#endif +/*lint -restore Enable MISRA rule (2.1,1.1) checking. */ + + +/* +** =================================================================== +** Method : PE_low_level_init (component MK70FN1M0MJ15) +** +** Description : +** Initializes beans and provides common register initialization. +** The method is called automatically as a part of the +** application initialization code. +** This method is internal. It is used by Processor Expert only. +** =================================================================== +*/ +void PE_low_level_init(void) +{ + #ifdef PEX_RTOS_INIT + PEX_RTOS_INIT(); /* Initialization of the selected RTOS. Macro is defined by the RTOS component. */ + #endif + /* Initialization of the SIM module */ + /* SIM_SOPT2: CMTUARTPAD=0 */ + SIM_SOPT2 &= (uint32_t)~(uint32_t)(SIM_SOPT2_CMTUARTPAD_MASK); + /* PORTA_PCR4: MUX=0 */ + PORTA_PCR4 &= (uint32_t)~(uint32_t)(PORT_PCR_MUX(0x07)); /* Disable NMI function on the NMI pin */ + /* Initialization of the RCM module */ + /* RCM_RPFW: RSTFLTSEL=0 */ + RCM_RPFW &= (uint8_t)~(uint8_t)(RCM_RPFW_RSTFLTSEL(0x1F)); + /* RCM_RPFC: RSTFLTSS=0,RSTFLTSRW=0 */ + RCM_RPFC &= (uint8_t)~(uint8_t)( + RCM_RPFC_RSTFLTSS_MASK | + RCM_RPFC_RSTFLTSRW(0x03) + ); + /* Initialization of the FTFL_FlashConfig module */ + /* SIM_SCGC7: MPU=1 */ + SIM_SCGC7 |= SIM_SCGC7_MPU_MASK; + /* Initialization of the MPU module */ + /* MPU_CESR: SPERR=0,VLD=0 */ + MPU_CESR &= (uint32_t)~(uint32_t)((MPU_CESR_SPERR(0xFF) | MPU_CESR_VLD_MASK)); + /* Initialization of the PMC module */ + /* PMC_REGSC: ACKISO=0,BGBE=0 */ + PMC_REGSC &= (uint8_t)~(uint8_t)( + PMC_REGSC_ACKISO_MASK | + PMC_REGSC_BGBE_MASK + ); + /* PMC_LVDSC1: LVDACK=1,LVDIE=0,LVDRE=1,LVDV=0 */ + PMC_LVDSC1 = (uint8_t)((PMC_LVDSC1 & (uint8_t)~(uint8_t)( + PMC_LVDSC1_LVDIE_MASK | + PMC_LVDSC1_LVDV(0x03) + )) | (uint8_t)( + PMC_LVDSC1_LVDACK_MASK | + PMC_LVDSC1_LVDRE_MASK + )); + /* PMC_LVDSC2: LVWACK=1,LVWIE=0,LVWV=0 */ + PMC_LVDSC2 = (uint8_t)((PMC_LVDSC2 & (uint8_t)~(uint8_t)( + PMC_LVDSC2_LVWIE_MASK | + PMC_LVDSC2_LVWV(0x03) + )) | (uint8_t)( + PMC_LVDSC2_LVWACK_MASK + )); + /* SMC_PMPROT: ??=0,??=0,AVLP=0,??=0,ALLS=0,??=0,AVLLS=0,??=0 */ + SMC_PMPROT = 0x00U; /* Setup Power mode protection register */ + /* Common initialization of the CPU registers */ + /* NVICIP20: PRI20=0 */ + NVICIP20 = NVIC_IP_PRI20(0x00); + /* Enable interrupts of the given priority level */ + Cpu_SetBASEPRI(0U); +} + /* Flash configuration field */ + __attribute__ ((section (".cfmconfig"))) const uint8_t _cfm[0x10] = { + /* NV_BACKKEY3: KEY=0xFF */ + 0xFFU, + /* NV_BACKKEY2: KEY=0xFF */ + 0xFFU, + /* NV_BACKKEY1: KEY=0xFF */ + 0xFFU, + /* NV_BACKKEY0: KEY=0xFF */ + 0xFFU, + /* NV_BACKKEY7: KEY=0xFF */ + 0xFFU, + /* NV_BACKKEY6: KEY=0xFF */ + 0xFFU, + /* NV_BACKKEY5: KEY=0xFF */ + 0xFFU, + /* NV_BACKKEY4: KEY=0xFF */ + 0xFFU, + /* NV_FPROT3: PROT=0xFF */ + 0xFFU, + /* NV_FPROT2: PROT=0xFF */ + 0xFFU, + /* NV_FPROT1: PROT=0xFF */ + 0xFFU, + /* NV_FPROT0: PROT=0xFF */ + 0xFFU, + /* NV_FSEC: KEYEN=1,MEEN=3,FSLACC=3,SEC=2 */ + 0x7EU, + /* NV_FOPT: ??=1,??=1,??=1,??=1,??=1,??=1,EZPORT_DIS=1,LPBOOT=1 */ + 0xFFU, + /* NV_FEPROT: EPROT=0xFF */ + 0xFFU, + /* NV_FDPROT: DPROT=0xFF */ + 0xFFU + }; + +/* END Cpu. */ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +/*! +** @} +*/ +/* +** ################################################################### +** +** This file was created by Processor Expert 10.5 [05.21] +** for the Freescale Kinetis series of microcontrollers. +** +** ################################################################### +*/ diff --git a/Generated_Code/Cpu.h b/Generated_Code/Cpu.h new file mode 100644 index 0000000000000000000000000000000000000000..5494a7ad4c9b3b077ee27b61f0889035a0d8a283 --- /dev/null +++ b/Generated_Code/Cpu.h @@ -0,0 +1,202 @@ +/* ################################################################### +** This component module is generated by Processor Expert. Do not modify it. +** Filename : Cpu.h +** Project : Lab0 +** Processor : MK70FN1M0VMJ12 +** Component : MK70FN1M0MJ15 +** Version : Component 01.028, Driver 01.04, CPU db: 3.00.000 +** Repository : Kinetis +** Datasheet : K70P256M150SF3RM, Rev. 2, Dec 2011 +** Compiler : GNU C Compiler +** Date/Time : 2018-07-15, 23:43, # CodeGen: 0 +** Abstract : +** +** Settings : +** +** Contents : +** No public methods +** +** (c) Freescale Semiconductor, Inc. +** 2004 All Rights Reserved +** +** Copyright : 1997 - 2015 Freescale Semiconductor, Inc. +** All Rights Reserved. +** +** Redistribution and use in source and binary forms, with or without modification, +** are permitted provided that the following conditions are met: +** +** o Redistributions of source code must retain the above copyright notice, this list +** of conditions and the following disclaimer. +** +** o Redistributions in binary form must reproduce the above copyright notice, this +** list of conditions and the following disclaimer in the documentation and/or +** other materials provided with the distribution. +** +** o Neither the name of Freescale Semiconductor, Inc. nor the names of its +** contributors may be used to endorse or promote products derived from this +** software without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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. +** +** http: www.freescale.com +** mail: support@freescale.com +** ###################################################################*/ +/*! +** @file Cpu.h +** @version 01.04 +** @brief +** +*/ +/*! +** @addtogroup Cpu_module Cpu module documentation +** @{ +*/ + +#ifndef __Cpu_H +#define __Cpu_H + +/* MODULE Cpu. */ +/*Include shared modules, which are used for whole project*/ +#include "PE_Types.h" +#include "PE_Error.h" +#include "PE_Const.h" +#include "IO_Map.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Active configuration define symbol */ +#define PEcfg_FLASH 1U + +/* Methods configuration constants - generated for all enabled component's methods */ + +/* Events configuration constants - generated for all enabled component's events */ + +#define CPU_BUS_CLK_HZ 20971520U /* Initial value of the bus clock frequency in Hz */ +#define CPU_CORE_CLK_HZ 20971520U /* Initial value of the core/system clock frequency in Hz. */ + +#define CPU_CLOCK_CONFIG_NUMBER 0x01U /* Specifies number of defined clock configurations. */ + +#define CPU_BUS_CLK_HZ_CLOCK_CONFIG0 20971520U /* Value of the bus clock frequency in the clock configuration 0 in Hz. */ +#define CPU_CORE_CLK_HZ_CLOCK_CONFIG0 20971520U /* Value of the core/system clock frequency in the clock configuration 0 in Hz. */ + + +#define CPU_INT_SLOW_CLK_HZ 32768U /* Value of the slow internal oscillator clock frequency in Hz */ +#define CPU_INT_FAST_CLK_HZ 4000000U /* Value of the fast internal oscillator clock frequency in Hz */ + +#define CPU_FAMILY_Kinetis /* Specification of the core type of the selected cpu */ +#define CPU_DERIVATIVE_MK70FN1M0MJ15 /* Name of the selected cpu derivative */ +#define CPU_PARTNUM_MK70FN1M0VMJ12 /* Part number of the selected cpu */ +#define CPU_LITTLE_ENDIAN /* The selected cpu uses little endian */ + +/* CPU frequencies in clock configuration 0 */ +#define CPU_CLOCK_CONFIG_0 0x00U /* Clock configuration 0 identifier */ +#define CPU_CORE_CLK_HZ_CONFIG_0 20971520UL /* Core clock frequency in clock configuration 0 */ +#define CPU_BUS_CLK_HZ_CONFIG_0 20971520UL /* Bus clock frequency in clock configuration 0 */ +#define CPU_FLEXBUS_CLK_HZ_CONFIG_0 10485760UL /* Flexbus clock frequency in clock configuration 0 */ +#define CPU_FLASH_CLK_HZ_CONFIG_0 10485760UL /* FLASH clock frequency in clock configuration 0 */ +#define CPU_USB_CLK_HZ_CONFIG_0 0UL /* USB clock frequency in clock configuration 0 */ +#define CPU_PLL_FLL_CLK_HZ_CONFIG_0 20971520UL /* PLL/FLL clock frequency in clock configuration 0 */ +#define CPU_MCGIR_CLK_HZ_CONFIG_0 32768UL /* MCG internal reference clock frequency in clock configuration 0 */ +#define CPU_OSCER_CLK_HZ_CONFIG_0 0UL /* System OSC external reference clock frequency in clock configuration 0 */ +#define CPU_ERCLK32K_CLK_HZ_CONFIG_0 0UL /* External reference clock 32k frequency in clock configuration 0 */ +#define CPU_MCGFF_CLK_HZ_CONFIG_0 16384UL /* MCG fixed frequency clock */ + + +typedef struct { + uint32_t cpu_core_clk_hz; /* Core clock frequency in clock configuration */ + uint32_t cpu_bus_clk_hz; /* Bus clock frequency in clock configuration */ + uint32_t cpu_flexbus_clk_hz; /* Flexbus clock frequency in clock configuration */ + uint32_t cpu_flash_clk_hz; /* FLASH clock frequency in clock configuration */ + uint32_t cpu_usb_clk_hz; /* USB clock frequency in clock configuration */ + uint32_t cpu_pll_fll_clk_hz; /* PLL/FLL clock frequency in clock configuration */ + uint32_t cpu_mcgir_clk_hz; /* MCG internal reference clock frequency in clock configuration */ + uint32_t cpu_oscer_clk_hz; /* System OSC external reference clock frequency in clock configuration */ + uint32_t cpu_erclk32k_clk_hz; /* External reference clock 32k frequency in clock configuration */ + uint32_t cpu_mcgff_clk_hz; /* MCG fixed frequency clock */ +} TCpuClockConfiguration; + +/* The array of clock frequencies in configured clock configurations */ +extern const TCpuClockConfiguration PE_CpuClockConfigurations[CPU_CLOCK_CONFIG_NUMBER]; + + /* Interrupt vector table type definition */ + typedef void (*const tIsrFunc)(void); + typedef struct { + void * __ptr; + tIsrFunc __fun[0x79]; + } tVectorTable; + + extern const tVectorTable __vect_table; + +/* Global variables */ +/*lint -esym(765,SR_reg) Disable MISRA rule (8.10) checking for symbols (SR_reg). The SR_reg is used in inline assembler. */ +extern volatile uint8_t SR_reg; /* Current FAULTMASK register */ +/*lint -esym(765,SR_lock) Disable MISRA rule (8.10) checking for symbols (SR_lock). The SR_reg is used in inline assembler. */ +extern volatile uint8_t SR_lock; + + +/* +** =================================================================== +** Method : PE_low_level_init (component MK70FN1M0MJ15) +** +** Description : +** Initializes beans and provides common register initialization. +** The method is called automatically as a part of the +** application initialization code. +** This method is internal. It is used by Processor Expert only. +** =================================================================== +*/ +void PE_low_level_init(void); + +PE_ISR(Cpu_Interrupt); +/* +** =================================================================== +** Method : Cpu_Cpu_Interrupt (component MK70FN1M0MJ15) +** +** Description : +** This ISR services an unused interrupt/exception vector. +** This method is internal. It is used by Processor Expert only. +** =================================================================== +*/ + +void __init_hardware(void); +/* +** =================================================================== +** Method : __init_hardware (component MK70FN1M0MJ15) +** +** Description : +** Initializes the whole system like timing, external bus, etc. +** This method is internal. It is used by Processor Expert only. +** =================================================================== +*/ + +/* END Cpu. */ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif +/* __Cpu_H */ + +/*! +** @} +*/ +/* +** ################################################################### +** +** This file was created by Processor Expert 10.5 [05.21] +** for the Freescale Kinetis series of microcontrollers. +** +** ################################################################### +*/ diff --git a/Generated_Code/IO_Map.h b/Generated_Code/IO_Map.h new file mode 100644 index 0000000000000000000000000000000000000000..e0a531c7c8fc69fef6bd3e407bf63f594ef0427d --- /dev/null +++ b/Generated_Code/IO_Map.h @@ -0,0 +1,79 @@ +/* ################################################################### +** This component module is generated by Processor Expert. Do not modify it. +** Filename : IO_Map.h +** Project : Lab0 +** Processor : MK70FN1M0VMJ12 +** Component : IO_Map +** Version : Driver 01.00 +** Compiler : GNU C Compiler +** Date/Time : 2018-07-15, 23:43, # CodeGen: 0 +** Abstract : +** IO_Map.h - implements an IO device's mapping. +** This module contains symbol definitions of all peripheral +** registers and bits. +** Contents : +** No public methods +** +** Copyright : 1997 - 2015 Freescale Semiconductor, Inc. +** All Rights Reserved. +** +** Redistribution and use in source and binary forms, with or without modification, +** are permitted provided that the following conditions are met: +** +** o Redistributions of source code must retain the above copyright notice, this list +** of conditions and the following disclaimer. +** +** o Redistributions in binary form must reproduce the above copyright notice, this +** list of conditions and the following disclaimer in the documentation and/or +** other materials provided with the distribution. +** +** o Neither the name of Freescale Semiconductor, Inc. nor the names of its +** contributors may be used to endorse or promote products derived from this +** software without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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. +** +** http: www.freescale.com +** mail: support@freescale.com +** ###################################################################*/ +/*! +** @file IO_Map.h +** @version 01.00 +** @brief +** IO_Map.h - implements an IO device's mapping. +** This module contains symbol definitions of all peripheral +** registers and bits. +*/ +/*! +** @addtogroup IO_Map_module IO_Map module documentation +** @{ +*/ + +#ifndef __IO_Map_H +#define __IO_Map_H + +#include "MK70F12.h" + +#endif +/* __IO_Map_H */ + +/*! +** @} +*/ +/* +** ################################################################### +** +** This file was created by Processor Expert 10.5 [05.21] +** for the Freescale Kinetis series of microcontrollers. +** +** ################################################################### +*/ diff --git a/Generated_Code/PE_Const.h b/Generated_Code/PE_Const.h new file mode 100644 index 0000000000000000000000000000000000000000..0ad9341d8c32e6eac3e24236acf0dc35d6baf645 --- /dev/null +++ b/Generated_Code/PE_Const.h @@ -0,0 +1,94 @@ +/* ################################################################### +** This component module is generated by Processor Expert. Do not modify it. +** Filename : PE_Const.h +** Project : Lab0 +** Processor : MK70FN1M0VMJ12 +** Component : PE_Const +** Version : Driver 01.00 +** Compiler : GNU C Compiler +** Date/Time : 2018-07-15, 23:43, # CodeGen: 0 +** Abstract : +** This component "PE_Const" contains internal definitions +** of the constants. +** Contents : +** No public methods +** +** Copyright : 1997 - 2015 Freescale Semiconductor, Inc. +** All Rights Reserved. +** +** Redistribution and use in source and binary forms, with or without modification, +** are permitted provided that the following conditions are met: +** +** o Redistributions of source code must retain the above copyright notice, this list +** of conditions and the following disclaimer. +** +** o Redistributions in binary form must reproduce the above copyright notice, this +** list of conditions and the following disclaimer in the documentation and/or +** other materials provided with the distribution. +** +** o Neither the name of Freescale Semiconductor, Inc. nor the names of its +** contributors may be used to endorse or promote products derived from this +** software without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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. +** +** http: www.freescale.com +** mail: support@freescale.com +** ###################################################################*/ +/*! +** @file PE_Const.h +** @version 01.00 +** @brief +** This component "PE_Const" contains internal definitions +** of the constants. +*/ +/*! +** @addtogroup PE_Const_module PE_Const module documentation +** @{ +*/ + +#ifndef __PE_Const_H +#define __PE_Const_H + + +/* Reset cause constants */ +#define RSTSRC_WAKEUP 0x01U /*!< LLWU module wakeup reset */ +#define RSTSRC_LVD 0x02U /*!< Low-voltage detect reset */ +#define RSTSRC_LOC 0x04U /*!< Loss-of-clock reset */ +#define RSTSRC_COP 0x20U /*!< Watchdog reset */ +#define RSTSRC_WDOG 0x20U /*!< Watchdog reset */ +#define RSTSRC_PIN 0x40U /*!< External pin reset */ +#define RSTSRC_POR 0x80U /*!< Power-on reset */ +#define RSTSRC_JTAG 0x0100U /*!< JTAG reset pin */ +#define RSTSRC_LOCKUP 0x0200U /*!< Core Lock-up reset */ +#define RSTSRC_SW 0x0400U /*!< Software reset */ +#define RSTSRC_MDM_AP 0x0800U /*!< Reset caused by host debugger system */ +#define RSTSRC_EZPT 0x1000U /*!< EzPort reset */ +#define RSTSRC_SACKERR 0x2000U /*!< Stop Mode Acknowledge Error Reset */ + + +/* Low voltage interrupt cause constants */ +#define LVDSRC_LVD 0x01U /*!< Low voltage detect */ +#define LVDSRC_LVW 0x02U /*!< Low-voltage warning */ + +#endif /* _PE_Const_H */ +/*! +** @} +*/ +/* +** ################################################################### +** +** This file was created by Processor Expert 10.5 [05.21] +** for the Freescale Kinetis series of microcontrollers. +** +** ################################################################### +*/ diff --git a/Generated_Code/PE_Error.h b/Generated_Code/PE_Error.h new file mode 100644 index 0000000000000000000000000000000000000000..810fc110065e88cde38a7f1a785ba437e45e96d3 --- /dev/null +++ b/Generated_Code/PE_Error.h @@ -0,0 +1,128 @@ +/* ################################################################### +** This component module is generated by Processor Expert. Do not modify it. +** Filename : PE_Error.h +** Project : Lab0 +** Processor : MK70FN1M0VMJ12 +** Component : PE_Error +** Version : Driver 01.00 +** Compiler : GNU C Compiler +** Date/Time : 2018-07-15, 23:43, # CodeGen: 0 +** Abstract : +** This component "PE_Error" contains internal definitions +** of the error constants. +** Contents : +** No public methods +** +** Copyright : 1997 - 2015 Freescale Semiconductor, Inc. +** All Rights Reserved. +** +** Redistribution and use in source and binary forms, with or without modification, +** are permitted provided that the following conditions are met: +** +** o Redistributions of source code must retain the above copyright notice, this list +** of conditions and the following disclaimer. +** +** o Redistributions in binary form must reproduce the above copyright notice, this +** list of conditions and the following disclaimer in the documentation and/or +** other materials provided with the distribution. +** +** o Neither the name of Freescale Semiconductor, Inc. nor the names of its +** contributors may be used to endorse or promote products derived from this +** software without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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. +** +** http: www.freescale.com +** mail: support@freescale.com +** ###################################################################*/ +/*! +** @file PE_Error.h +** @version 01.00 +** @brief +** This component "PE_Error" contains internal definitions +** of the error constants. +*/ +/*! +** @addtogroup PE_Error_module PE_Error module documentation +** @{ +*/ + +#ifndef __PE_Error_H +#define __PE_Error_H + +#define ERR_OK 0x00U /*!< OK */ +#define ERR_SPEED 0x01U /*!< This device does not work in the active speed mode. */ +#define ERR_RANGE 0x02U /*!< Parameter out of range. */ +#define ERR_VALUE 0x03U /*!< Parameter of incorrect value. */ +#define ERR_OVERFLOW 0x04U /*!< Timer overflow. */ +#define ERR_MATH 0x05U /*!< Overflow during evaluation. */ +#define ERR_ENABLED 0x06U /*!< Device is enabled. */ +#define ERR_DISABLED 0x07U /*!< Device is disabled. */ +#define ERR_BUSY 0x08U /*!< Device is busy. */ +#define ERR_NOTAVAIL 0x09U /*!< Requested value or method not available. */ +#define ERR_RXEMPTY 0x0AU /*!< No data in receiver. */ +#define ERR_TXFULL 0x0BU /*!< Transmitter is full. */ +#define ERR_BUSOFF 0x0CU /*!< Bus not available. */ +#define ERR_OVERRUN 0x0DU /*!< Overrun error is detected. */ +#define ERR_FRAMING 0x0EU /*!< Framing error is detected. */ +#define ERR_PARITY 0x0FU /*!< Parity error is detected. */ +#define ERR_NOISE 0x10U /*!< Noise error is detected. */ +#define ERR_IDLE 0x11U /*!< Idle error is detected. */ +#define ERR_FAULT 0x12U /*!< Fault error is detected. */ +#define ERR_BREAK 0x13U /*!< Break char is received during communication. */ +#define ERR_CRC 0x14U /*!< CRC error is detected. */ +#define ERR_ARBITR 0x15U /*!< A node losts arbitration. This error occurs if two nodes start transmission at the same time. */ +#define ERR_PROTECT 0x16U /*!< Protection error is detected. */ +#define ERR_UNDERFLOW 0x17U /*!< Underflow error is detected. */ +#define ERR_UNDERRUN 0x18U /*!< Underrun error is detected. */ +#define ERR_COMMON 0x19U /*!< Common error of a device. */ +#define ERR_LINSYNC 0x1AU /*!< LIN synchronization error is detected. */ +#define ERR_FAILED 0x1BU /*!< Requested functionality or process failed. */ +#define ERR_QFULL 0x1CU /*!< Queue is full. */ +#define ERR_PARAM_MASK 0x80U /*!< Invalid mask. */ +#define ERR_PARAM_MODE 0x81U /*!< Invalid mode. */ +#define ERR_PARAM_INDEX 0x82U /*!< Invalid index. */ +#define ERR_PARAM_DATA 0x83U /*!< Invalid data. */ +#define ERR_PARAM_SIZE 0x84U /*!< Invalid size. */ +#define ERR_PARAM_VALUE 0x85U /*!< Invalid value. */ +#define ERR_PARAM_RANGE 0x86U /*!< Invalid parameter's range or parameters' combination. */ +#define ERR_PARAM_LOW_VALUE 0x87U /*!< Invalid value (LOW part). */ +#define ERR_PARAM_HIGH_VALUE 0x88U /*!< Invalid value (HIGH part). */ +#define ERR_PARAM_ADDRESS 0x89U /*!< Invalid address. */ +#define ERR_PARAM_PARITY 0x8AU /*!< Invalid parity. */ +#define ERR_PARAM_WIDTH 0x8BU /*!< Invalid width. */ +#define ERR_PARAM_LENGTH 0x8CU /*!< Invalid length. */ +#define ERR_PARAM_ADDRESS_TYPE 0x8DU /*!< Invalid address type. */ +#define ERR_PARAM_COMMAND_TYPE 0x8EU /*!< Invalid command type. */ +#define ERR_PARAM_COMMAND 0x8FU /*!< Invalid command. */ +#define ERR_PARAM_RECIPIENT 0x90U /*!< Invalid recipient. */ +#define ERR_PARAM_BUFFER_COUNT 0x91U /*!< Invalid buffer count. */ +#define ERR_PARAM_ID 0x92U /*!< Invalid ID. */ +#define ERR_PARAM_GROUP 0x93U /*!< Invalid group. */ +#define ERR_PARAM_CHIP_SELECT 0x94U /*!< Invalid chip select. */ +#define ERR_PARAM_ATTRIBUTE_SET 0x95U /*!< Invalid set of attributes. */ +#define ERR_PARAM_SAMPLE_COUNT 0x96U /*!< Invalid sample count. */ +#define ERR_PARAM_CONDITION 0x97U /*!< Invalid condition. */ +#define ERR_PARAM_TICKS 0x98U /*!< Invalid ticks parameter. */ + +#endif /* __PE_Error_H */ +/*! +** @} +*/ +/* +** ################################################################### +** +** This file was created by Processor Expert 10.5 [05.21] +** for the Freescale Kinetis series of microcontrollers. +** +** ################################################################### +*/ diff --git a/Generated_Code/PE_Types.h b/Generated_Code/PE_Types.h new file mode 100644 index 0000000000000000000000000000000000000000..9d175f45f7c061e5e81ce9510d1ccffb00f7c387 --- /dev/null +++ b/Generated_Code/PE_Types.h @@ -0,0 +1,2587 @@ +/* ################################################################### +** This component module is generated by Processor Expert. Do not modify it. +** Filename : PE_Types.h +** Project : Lab0 +** Processor : MK70FN1M0VMJ12 +** Component : PE_Types +** Version : Driver 01.01 +** Compiler : GNU C Compiler +** Date/Time : 2018-07-15, 23:43, # CodeGen: 0 +** Abstract : +** PE_Types.h - contains definitions of basic types, +** register access macros and hardware specific macros +** which can be used in user application. +** Contents : +** No public methods +** +** Copyright : 1997 - 2015 Freescale Semiconductor, Inc. +** All Rights Reserved. +** +** Redistribution and use in source and binary forms, with or without modification, +** are permitted provided that the following conditions are met: +** +** o Redistributions of source code must retain the above copyright notice, this list +** of conditions and the following disclaimer. +** +** o Redistributions in binary form must reproduce the above copyright notice, this +** list of conditions and the following disclaimer in the documentation and/or +** other materials provided with the distribution. +** +** o Neither the name of Freescale Semiconductor, Inc. nor the names of its +** contributors may be used to endorse or promote products derived from this +** software without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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. +** +** http: www.freescale.com +** mail: support@freescale.com +** ###################################################################*/ +/*! +** @file PE_Types.h +** @version 01.01 +** @brief +** PE_Types.h - contains definitions of basic types, +** register access macros and hardware specific macros +** which can be used in user application. +*/ +/*! +** @addtogroup PE_Types_module PE_Types module documentation +** @{ +*/ + +#ifndef __PE_Types_H +#define __PE_Types_H + +/* Standard ANSI C types */ +#include + +#ifndef FALSE + #define FALSE 0x00u /* Boolean value FALSE. FALSE is defined always as a zero value. */ +#endif +#ifndef TRUE + #define TRUE 0x01u /* Boolean value TRUE. TRUE is defined always as a non zero value. */ +#endif + +#ifndef NULL + #define NULL 0x00u +#endif + +/* PE types definition */ +#ifndef __cplusplus + #ifndef bool +typedef unsigned char bool; + #endif +#endif +typedef unsigned char byte; +typedef unsigned short word; +typedef unsigned long dword; +typedef unsigned long long dlong; +typedef unsigned char TPE_ErrCode; +#ifndef TPE_Float +typedef float TPE_Float; +#endif +#ifndef char_t +typedef char char_t; +#endif + +/* Other basic data types */ +typedef signed char int8; +typedef signed short int int16; +typedef signed long int int32; + +typedef unsigned char uint8; +typedef unsigned short int uint16; +typedef unsigned long int uint32; + + +/**********************************************************/ +/* Uniform multiplatform 8-bits peripheral access macros */ +/**********************************************************/ + +/* Enable maskable interrupts */ +#define __EI()\ + do {\ + /*lint -save -e950 Disable MISRA rule (1.1) checking. */\ + __asm("CPSIE f");\ + /*lint -restore Enable MISRA rule (1.1) checking. */\ + } while(0) + +/* Disable maskable interrupts */ +#define __DI() \ + do {\ + /*lint -save -e950 Disable MISRA rule (1.1) checking. */\ + __asm ("CPSID f");\ + /*lint -restore Enable MISRA rule (1.1) checking. */\ + } while(0) + + + +/* Save status register and disable interrupts */ +#define EnterCritical() \ + do {\ + uint8_t SR_reg_local;\ + /*lint -save -e586 -e950 Disable MISRA rule (2.1,1.1) checking. */\ + __asm ( \ + "MRS R0, FAULTMASK\n\t" \ + "CPSID f\n\t" \ + "STRB R0, %[output]" \ + : [output] "=m" (SR_reg_local)\ + :: "r0");\ + /*lint -restore Enable MISRA rule (2.1,1.1) checking. */\ + if (++SR_lock == 1u) {\ + SR_reg = SR_reg_local;\ + }\ + } while(0) + + +/* Restore status register */ +#define ExitCritical() \ + do {\ + if (--SR_lock == 0u) { \ + /*lint -save -e586 -e950 Disable MISRA rule (2.1,1.1) checking. */\ + __asm ( \ + "ldrb r0, %[input]\n\t"\ + "msr FAULTMASK,r0;\n\t" \ + ::[input] "m" (SR_reg) \ + : "r0"); \ + /*lint -restore Enable MISRA rule (2.1,1.1) checking. */\ + }\ + } while(0) + + +#define PE_DEBUGHALT() \ + /*lint -save -e586 -e950 Disable MISRA rule (2.1,1.1) checking. */\ + __asm( "BKPT 255") \ + /*lint -restore Enable MISRA rule (2.1,1.1) checking. */ + +#define PE_NOP() \ + /*lint -save -e586 -e950 Disable MISRA rule (2.1,1.1) checking. */\ + __asm( "NOP") \ + /*lint -restore Enable MISRA rule (2.1,1.1) checking. */ + +#define PE_WFI() \ + /*lint -save -e586 -e950 Disable MISRA rule (2.1,1.1) checking. */\ + __asm("WFI") \ + /*lint -restore Enable MISRA rule (2.1,1.1) checking. */ + + +/* Interrupt definition template */ +#if !defined(PE_ISR) + #define PE_ISR(ISR_name) void __attribute__ ((interrupt)) ISR_name(void) +#endif + +/* Logical Device Drivers (LDD) types */ + +/*! Logical Device Driver API version */ +#define PE_LDD_VERSION 0x0100U + +/* LDD driver states */ +#define PE_LDD_DRIVER_DISABLED_IN_CLOCK_CONFIGURATION 0x01U /*!< LDD driver is disabled in the selected clock configuration */ +#define PE_LDD_DRIVER_DISABLED_BY_USER 0x02U /*!< LDD driver is disabled by the user */ +#define PE_LDD_DRIVER_BUSY 0x04U /*!< LDD driver is busy */ + +/*! Macro to register component device structure */ +#define PE_LDD_RegisterDeviceStructure(ComponentIndex, DeviceStructure) (PE_LDD_DeviceDataList[ComponentIndex] = DeviceStructure) + +/*! Macro to unregister component device structure */ +#define PE_LDD_UnregisterDeviceStructure(ComponentIndex) (PE_LDD_DeviceDataList[ComponentIndex] = NULL) + +/*! Macro to get the component device structure */ +#define PE_LDD_GetDeviceStructure(ComponentIndex) (PE_LDD_DeviceDataList[ComponentIndex]) + +/* +** =================================================================== +** Global HAL types and constants +** =================================================================== +*/ +typedef uint32_t LDD_TPinMask; /*!< Pin mask type. */ +typedef uint16_t LDD_TError; /*!< Error type. */ +typedef uint32_t LDD_TEventMask; /*!< Event mask type. */ +typedef uint8_t LDD_TClockConfiguration; /*!< CPU clock configuration type. */ +typedef void LDD_TDeviceData; /*!< Pointer to private device structure managed and used by HAL components. */ +typedef void* LDD_TDeviceDataPtr; /*!< Obsolete type for backward compatibility. */ +typedef void LDD_TData; /*!< General pointer to data. */ +typedef void LDD_TUserData; /*!< Pointer to this type specifies the user or RTOS specific data will be passed as an event or callback parameter. */ + +/*! Driver operation mode type. */ +typedef enum { + DOM_NONE, + DOM_RUN, + DOM_WAIT, + DOM_SLEEP, + DOM_STOP +} LDD_TDriverOperationMode; + +typedef uint16_t LDD_TDriverState; /*!< Driver state type. */ +typedef void LDD_TCallbackParam; /*!< Pointer to this type specifies the user data to be passed as a callback parameter. */ +typedef void (* LDD_TCallback)(LDD_TCallbackParam *CallbackParam); /*!< Callback type used for definition of callback functions. */ + + +/* Fills a memory area block by a specified value. Function defined in PE_LDD.c */ +extern void PE_FillMemory(register void* SourceAddressPtr, register uint8_t c, register uint32_t len); + + +/* +** =================================================================== +** RTOS specific types and constants +** =================================================================== +*/ +/* {Default RTOS Adapter} RTOS specific definition of type of Ioctl() command constants */ + + +/* +** =================================================================== +** Published RTOS settings and constants +** =================================================================== +*/ +/* {Default RTOS Adapter} No published RTOS settings */ + + +/* +** =================================================================== +** TimerUnit device types and constants +** =================================================================== +*/ +#define LDD_TIMERUNIT_ON_CHANNEL_0 0x01u /*!< OnChannel0 event mask value */ +#define LDD_TIMERUNIT_ON_CHANNEL_1 0x02u /*!< OnChannel1 event mask value */ +#define LDD_TIMERUNIT_ON_CHANNEL_2 0x04u /*!< OnChannel2 event mask value */ +#define LDD_TIMERUNIT_ON_CHANNEL_3 0x08u /*!< OnChannel3 event mask value */ +#define LDD_TIMERUNIT_ON_CHANNEL_4 0x10u /*!< OnChannel4 event mask value */ +#define LDD_TIMERUNIT_ON_CHANNEL_5 0x20u /*!< OnChannel5 event mask value */ +#define LDD_TIMERUNIT_ON_CHANNEL_6 0x40u /*!< OnChannel6 event mask value */ +#define LDD_TIMERUNIT_ON_CHANNEL_7 0x80u /*!< OnChannel7 event mask value */ +#define LDD_TIMERUNIT_ON_COUNTER_RESTART 0x0100u /*!< OnCounterRestart event mask value */ + +/*! Direction of counting */ +typedef enum { + DIR_UP, /*!< UP */ + DIR_DOWN /*!< DOWN */ +} LDD_TimerUnit_TCounterDirection; + +/*! Output action type (flip-flop action on overrun or compare match) */ +typedef enum { + OUTPUT_NONE, /*!< NONE */ + OUTPUT_TOGGLE, /*!< TOGGLE */ + OUTPUT_CLEAR, /*!< CLEAR */ + OUTPUT_SET /*!< SET */ +} LDD_TimerUnit_TOutAction; + +/*! Input edge type */ +typedef enum { + EDGE_NONE, /*!< NONE */ + EDGE_RISING, /*!< RISING */ + EDGE_FALLING, /*!< FALLING */ + EDGE_BOTH /*!< BOTH */ +} LDD_TimerUnit_TEdge; + +typedef float LDD_TimerUnit_Tfloat; /*!< Float type */ + +/* +** =================================================================== +** CMT device types and constants +** =================================================================== +*/ +#define LDD_CMT_ON_END 0x01u /*!< OnEnd event mask value */ + +/* +** =================================================================== +** PPG device types and constants +** =================================================================== +*/ +#define LDD_PPG_ON_END 0x01u /*!< OnEnd event mask value */ + +typedef float LDD_PPG_Tfloat; /*!< Float type */ + +/* +** =================================================================== +** PWM types and constants +** =================================================================== +*/ +#define LDD_PWM_ON_END 0x01u /*!< OnEnd event mask value */ + +/* +** =================================================================== +** Capture types and constants +** =================================================================== +*/ +#define LDD_CAPTURE_ON_CAPTURE 0x01u /*!< OnCapture event mask value */ +#define LDD_CAPTURE_ON_OVERRUN 0x02u /*!< OnOverrun event mask value */ + +/* +** =================================================================== +** TimerInt types and constants +** =================================================================== +*/ +#define LDD_TIMERINT_ON_INTERRUPT 0x01u /*!< OnInterrupt event mask value */ + +/* +** =================================================================== +** TimerOut types and constants +** =================================================================== +*/ +#define LDD_TIMEROUT_ON_INTERRUPT 0x01u /*!< OnInterrupt event mask value */ + +/* +** =================================================================== +** EventCntr types and constants +** =================================================================== +*/ +#define LDD_EVENTCNTR_ON_END 0x01u /*!< OnEnd event mask value */ + +/* +** =================================================================== +** FreeCntr types and constants +** =================================================================== +*/ +#define LDD_FREECNTR_ON_INTERRUPT 0x01u /*!< OnInterrupt event mask value */ + +/* +** =================================================================== +** RealTime types and constants +** =================================================================== +*/ + +typedef float LDD_RealTime_Tfloat; /*!< Float type */ + +/* +** =================================================================== +** TimeDate types and constants +** =================================================================== +*/ +#define LDD_TIMEDATE_ON_ALARM 0x01u /*!< OnAlarm event mask value */ +#define LDD_TIMEDATE_ON_SECOND 0x02u /*!< OnSecond event mask value */ + +/*!< Time struct */ +typedef struct { + uint16_t Hour; /*!< Hours (0 - 23) */ + uint16_t Min; /*!< Minutes (0 - 59) */ + uint16_t Sec; /*!< Seconds (0 - 59) */ + uint16_t Sec100; /*!< Hundredths of seconds (0 - 99) */ +} LDD_TimeDate_TTimeRec; + +/*!< Date struct */ +typedef struct { + uint16_t Year; /*!< Years (1998 - 2099) */ + uint16_t Month; /*!< Months (1 - 12) */ + uint16_t Day; /*!< Days (1 - 31) */ + uint16_t DayOfWeek; /*!< Day of week (0-Sunday, .. 6-Saturday) */ +} LDD_TimeDate_TDateRec; + +/* +** =================================================================== +** UART device types and constants +** =================================================================== +*/ +#define LDD_SERIAL_RX_PIN 0x01u /*!< Receiver pin mask */ +#define LDD_SERIAL_TX_PIN 0x02u /*!< Transmitter pin mask */ +#define LDD_SERIAL_CTS_PIN 0x04u /*!< CTS pin mask */ +#define LDD_SERIAL_RTS_PIN 0x08u /*!< RTS pin mask */ + +#define LDD_SERIAL_ON_BLOCK_RECEIVED 0x01u /*!< OnBlockReceived event mask */ +#define LDD_SERIAL_ON_BLOCK_SENT 0x02u /*!< OnBlockSent event mask */ +#define LDD_SERIAL_ON_BREAK 0x04u /*!< OnBreak event mask */ +#define LDD_SERIAL_ON_TXCOMPLETE 0x08u /*!< OnTxComplete event mask */ +#define LDD_SERIAL_ON_ERROR 0x10u /*!< OnError event mask */ + +#define LDD_SERIAL_RX_OVERRUN 0x01u /*!< Receiver overrun */ +#define LDD_SERIAL_PARITY_ERROR 0x02u /*!< Parity error */ +#define LDD_SERIAL_FRAMING_ERROR 0x04u /*!< Framing error */ +#define LDD_SERIAL_NOISE_ERROR 0x08u /*!< Noise error */ + +typedef uint32_t LDD_SERIAL_TError; /*!< Serial communication error type */ + +typedef uint8_t LDD_SERIAL_TDataWidth; /*!< Bit length type. The number of bits transmitted by one character. */ + +typedef uint16_t LDD_SERIAL_TSize; /*!< Type specifying the length of the data or buffer. */ + +typedef uint8_t LDD_SERIAL_TBaudMode; /*!< Type specifying the baud mode. */ + +/*! Type specifying the parity. */ +typedef enum { + LDD_SERIAL_PARITY_UNDEF, /*!< Undefined parity */ + LDD_SERIAL_PARITY_NONE, /*!< Parity none */ + LDD_SERIAL_PARITY_ODD, /*!< Parity odd */ + LDD_SERIAL_PARITY_EVEN, /*!< Parity even */ + LDD_SERIAL_PARITY_MARK, /*!< Parity mark */ + LDD_SERIAL_PARITY_SPACE /*!< Parity space */ +} LDD_SERIAL_TParity; + +/*! Type specifying the stop bit length. */ +typedef enum { + LDD_SERIAL_STOP_BIT_LEN_UNDEF, /*!< Undefined bit length */ + LDD_SERIAL_STOP_BIT_LEN_1, /*!< 1 bit length */ + LDD_SERIAL_STOP_BIT_LEN_1_5, /*!< 1.5 bit length */ + LDD_SERIAL_STOP_BIT_LEN_2 /*!< 2 bit length */ +} LDD_SERIAL_TStopBitLen; + +/*! Communication statistics */ +typedef struct { + uint32_t ReceivedChars; /*!< Number of received characters */ + uint32_t SentChars; /*!< Number of transmitted characters */ + uint32_t ReceivedBreaks; /*!< Number of received break characters */ + uint32_t ParityErrors; /*!< Number of receiver parity errors */ + uint32_t FramingErrors; /*!< Number of receiver framing errors */ + uint32_t OverrunErrors; /*!< Number of receiver overrun errors */ + uint32_t NoiseErrors; /*!< Number of receiver noise errors */ +} LDD_SERIAL_TStats; + +/*! Type specifying the loop mode operation. */ +typedef enum { + LOOPMODE_UNDEF, /*!< Undefined loop mode */ + LOOPMODE_NORMAL, /*!< Normal operation */ + LOOPMODE_AUTO_ECHO, /*!< Auto echo mode */ + LOOPMODE_LOCAL_LOOPBACK, /*!< Local loopback mode */ + LOOPMODE_REMOTE_LOOPBACK /*!< Remote loopback mode */ +} LDD_SERIAL_TLoopMode; + + +/* +** =================================================================== +** ADC device types and constants +** =================================================================== +*/ + +#define LDD_ADC_CHANNEL_0_PIN 0x01u /*!< Channel 0 pin mask */ +#define LDD_ADC_CHANNEL_1_PIN 0x02u /*!< Channel 1 pin mask */ +#define LDD_ADC_CHANNEL_2_PIN 0x04u /*!< Channel 2 pin mask */ +#define LDD_ADC_CHANNEL_3_PIN 0x08u /*!< Channel 3 pin mask */ +#define LDD_ADC_CHANNEL_4_PIN 0x10u /*!< Channel 4 pin mask */ +#define LDD_ADC_CHANNEL_5_PIN 0x20u /*!< Channel 5 pin mask */ +#define LDD_ADC_CHANNEL_6_PIN 0x40u /*!< Channel 6 pin mask */ +#define LDD_ADC_CHANNEL_7_PIN 0x80u /*!< Channel 7 pin mask */ +#define LDD_ADC_CHANNEL_8_PIN 0x0100u /*!< Channel 8 pin mask */ +#define LDD_ADC_CHANNEL_9_PIN 0x0200u /*!< Channel 9 pin mask */ +#define LDD_ADC_CHANNEL_10_PIN 0x0400u /*!< Channel 10 pin mask */ +#define LDD_ADC_CHANNEL_11_PIN 0x0800u /*!< Channel 11 pin mask */ +#define LDD_ADC_CHANNEL_12_PIN 0x1000u /*!< Channel 12 pin mask */ +#define LDD_ADC_CHANNEL_13_PIN 0x2000u /*!< Channel 13 pin mask */ +#define LDD_ADC_CHANNEL_14_PIN 0x4000u /*!< Channel 14 pin mask */ +#define LDD_ADC_CHANNEL_15_PIN 0x8000u /*!< Channel 15 pin mask */ +#define LDD_ADC_CHANNEL_16_PIN 0x00010000u /*!< Channel 16 pin mask */ +#define LDD_ADC_CHANNEL_17_PIN 0x00020000u /*!< Channel 17 pin mask */ +#define LDD_ADC_CHANNEL_18_PIN 0x00040000u /*!< Channel 18 pin mask */ +#define LDD_ADC_CHANNEL_19_PIN 0x00080000u /*!< Channel 19 pin mask */ +#define LDD_ADC_CHANNEL_20_PIN 0x00100000u /*!< Channel 20 pin mask */ +#define LDD_ADC_CHANNEL_21_PIN 0x00200000u /*!< Channel 21 pin mask */ +#define LDD_ADC_CHANNEL_22_PIN 0x00400000u /*!< Channel 22 pin mask */ +#define LDD_ADC_CHANNEL_23_PIN 0x00800000u /*!< Channel 23 pin mask */ +#define LDD_ADC_CHANNEL_24_PIN 0x01000000u /*!< Channel 24 pin mask */ +#define LDD_ADC_CHANNEL_25_PIN 0x02000000u /*!< Channel 25 pin mask */ +#define LDD_ADC_CHANNEL_26_PIN 0x04000000u /*!< Channel 26 pin mask */ +#define LDD_ADC_CHANNEL_27_PIN 0x08000000u /*!< Channel 27 pin mask */ +#define LDD_ADC_CHANNEL_28_PIN 0x10000000u /*!< Channel 28 pin mask */ +#define LDD_ADC_CHANNEL_29_PIN 0x20000000u /*!< Channel 29 pin mask */ +#define LDD_ADC_CHANNEL_30_PIN 0x40000000u /*!< Channel 30 pin mask */ +#define LDD_ADC_CHANNEL_31_PIN 0x80000000u /*!< Channel 31 pin mask */ +#define LDD_ADC_CHANNEL_32_PIN 0x01u /*!< Channel 32 pin mask */ +#define LDD_ADC_CHANNEL_33_PIN 0x02u /*!< Channel 33 pin mask */ +#define LDD_ADC_CHANNEL_34_PIN 0x04u /*!< Channel 34 pin mask */ +#define LDD_ADC_CHANNEL_35_PIN 0x08u /*!< Channel 35 pin mask */ +#define LDD_ADC_CHANNEL_36_PIN 0x10u /*!< Channel 36 pin mask */ +#define LDD_ADC_CHANNEL_37_PIN 0x20u /*!< Channel 37 pin mask */ +#define LDD_ADC_CHANNEL_38_PIN 0x40u /*!< Channel 38 pin mask */ +#define LDD_ADC_CHANNEL_39_PIN 0x80u /*!< Channel 39 pin mask */ +#define LDD_ADC_CHANNEL_40_PIN 0x0100u /*!< Channel 40 pin mask */ +#define LDD_ADC_CHANNEL_41_PIN 0x0200u /*!< Channel 41 pin mask */ +#define LDD_ADC_CHANNEL_42_PIN 0x0400u /*!< Channel 42 pin mask */ +#define LDD_ADC_CHANNEL_43_PIN 0x0800u /*!< Channel 43 pin mask */ +#define LDD_ADC_CHANNEL_44_PIN 0x1000u /*!< Channel 44 pin mask */ +#define LDD_ADC_CHANNEL_45_PIN 0x2000u /*!< Channel 45 pin mask */ +#define LDD_ADC_CHANNEL_46_PIN 0x4000u /*!< Channel 46 pin mask */ +#define LDD_ADC_CHANNEL_47_PIN 0x8000u /*!< Channel 47 pin mask */ +#define LDD_ADC_CHANNEL_48_PIN 0x00010000u /*!< Channel 48 pin mask */ +#define LDD_ADC_CHANNEL_49_PIN 0x00020000u /*!< Channel 49 pin mask */ +#define LDD_ADC_CHANNEL_50_PIN 0x00040000u /*!< Channel 50 pin mask */ +#define LDD_ADC_CHANNEL_51_PIN 0x00080000u /*!< Channel 51 pin mask */ +#define LDD_ADC_CHANNEL_52_PIN 0x00100000u /*!< Channel 52 pin mask */ +#define LDD_ADC_CHANNEL_53_PIN 0x00200000u /*!< Channel 53 pin mask */ +#define LDD_ADC_CHANNEL_54_PIN 0x00400000u /*!< Channel 54 pin mask */ +#define LDD_ADC_CHANNEL_55_PIN 0x00800000u /*!< Channel 55 pin mask */ +#define LDD_ADC_CHANNEL_56_PIN 0x01000000u /*!< Channel 56 pin mask */ +#define LDD_ADC_CHANNEL_57_PIN 0x02000000u /*!< Channel 57 pin mask */ +#define LDD_ADC_CHANNEL_58_PIN 0x04000000u /*!< Channel 58 pin mask */ +#define LDD_ADC_CHANNEL_59_PIN 0x08000000u /*!< Channel 59 pin mask */ +#define LDD_ADC_CHANNEL_60_PIN 0x10000000u /*!< Channel 60 pin mask */ +#define LDD_ADC_CHANNEL_61_PIN 0x20000000u /*!< Channel 61 pin mask */ +#define LDD_ADC_CHANNEL_62_PIN 0x40000000u /*!< Channel 62 pin mask */ +#define LDD_ADC_CHANNEL_63_PIN 0x80000000u /*!< Channel 63 pin mask */ + +#define LDD_ADC_TRIGGER_0_PIN 0x01u /*!< Trigger 0 pin mask */ +#define LDD_ADC_TRIGGER_1_PIN 0x02u /*!< Trigger 1 pin mask */ + +#define LDD_ADC_LOW_VOLT_REF_PIN 0x01u /*!< Low voltage reference pin mask */ +#define LDD_ADC_HIGH_VOLT_REF_PIN 0x02u /*!< High voltage reference pin mask */ + +#define LDD_ADC_ON_MEASUREMENT_COMPLETE 0x40u /*!< OnMeasurementComplete event mask */ +#define LDD_ADC_ON_ERROR 0x80u /*!< OnError event mask */ + +#define LDD_ADC_DMA_ERROR 0x01u /*!< DMA error mask */ + +typedef uint32_t LDD_ADC_TErrorMask; /*!< ADC error type */ + +/*! Structure pins for pin connection method */ +typedef struct { + uint32_t Channel0_31PinMask; /*!< Channel pin mask for channels 0 through 31 */ + uint32_t Channel32_63PinMask; /*!< Channel pin mask for channels 32 through 63 */ + uint16_t TriggerPinMask; /*!< Trigger pin mask */ + uint8_t VoltRefPinMask; /*!< Voltage reference pin mask */ +} LDD_ADC_TPinMask; + +/*! Structure used to describing one sample */ +typedef struct { + uint8_t ChannelIdx; /*!< Channel index */ +} LDD_ADC_TSample; + +/*! Type specifying the ADC compare mode */ +typedef enum { + LDD_ADC_LESS_THAN = 0x00u, /*!< Compare true if the result is less than the Low compare value */ + LDD_ADC_GREATER_THAN_OR_EQUAL = 0x01u, /*!< Compare true if the result is greater than or equal to Low compare value */ + LDD_ADC_INSIDE_RANGE_INCLUSIVE = 0x02u, /*!< Compare true if the result is greater than or equal to Low compare value and the result is less than or equal to High compare value */ + LDD_ADC_INSIDE_RANGE_NOT_INCLUSIVE = 0x03u, /*!< Compare true if the result is greater than Low compare value and the result is less than High compare value */ + LDD_ADC_OUTSIDE_RANGE_INCLUSIVE = 0x04u, /*!< Compare true if the result is less than or equal to Low compare value or the result is greater than or equal to High compare value */ + LDD_ADC_OUTSIDE_RANGE_NOT_INCLUSIVE = 0x05u /*!< Compare true if the result is less than Low compare value or the result is greater than High compare value */ +} LDD_ADC_TCompareMode; + +/* +** =================================================================== +** I2C device types and constants +** =================================================================== +*/ + +#define LDD_I2C_SDA_PIN 0x01u /*!< SDA pin mask */ +#define LDD_I2C_SCL_PIN 0x02u /*!< SCL pin mask */ + +#define LDD_I2C_ON_MASTER_BLOCK_SENT 0x0001u /*!< OnMasterBlockSent event mask */ +#define LDD_I2C_ON_MASTER_BLOCK_RECEIVED 0x0002u /*!< OnMasterBlockReceived event mask */ +#define LDD_I2C_ON_SLAVE_BLOCK_SENT 0x0004u /*!< OnSlaveBlockSent event mask */ +#define LDD_I2C_ON_SLAVE_BLOCK_RECEIVED 0x0008u /*!< OnSlaveBlockReceived event mask */ +#define LDD_I2C_ON_SLAVE_TX_REQUEST 0x0010u /*!< OnSlaveTxRequest event mask */ +#define LDD_I2C_ON_SLAVE_RX_REQUEST 0x0020u /*!< OnSlaveRxRequest event mask */ +#define LDD_I2C_ON_ERROR 0x0040u /*!< OnError event mask */ +#define LDD_I2C_ON_SLAVE_SM_BUS_CALL_ADDR 0x0080u /*!< OnSlaveSMBusCallAddr event mask */ +#define LDD_I2C_ON_SLAVE_SM_BUS_ALERT_RESPONSE 0x0100u /*!< OnSlaveSMBusAlertResponse event mask */ +#define LDD_I2C_ON_SLAVE_GENERAL_CALL_ADDR 0x0200u /*!< OnSlaveGeneralCallAddr event mask */ +#define LDD_I2C_ON_MASTER_BYTE_RECEIVED 0x0400u /*!< OnMasterByteReceived event mask */ +#define LDD_I2C_ON_SLAVE_BYTE_RECEIVED 0x0800u /*!< OnMasterByteReceived event mask */ +#define LDD_I2C_ON_BUS_START_DETECTED 0x1000u /*!< OnBusStartDetected event mask */ +#define LDD_I2C_ON_BUS_STOP_DETECTED 0x2000u /*!< OnBusStopDetected event mask */ + +#define LDD_I2C_SLAVE_TX_UNDERRUN 0x0001u /*!< SlaveTxUnderrun error mask */ +#define LDD_I2C_SLAVE_RX_OVERRUN 0x0002u /*!< SlaveRxOverrun error mask */ +#define LDD_I2C_ARBIT_LOST 0x0004u /*!< ArbitLost error mask */ +#define LDD_I2C_MASTER_NACK 0x0008u /*!< MasterNACK error mask */ +#define LDD_I2C_SCL_LOW_TIMEOUT 0x0010u /*!< SCLLowTimeout error mask */ +#define LDD_I2C_SDA_LOW_TIMEOUT 0x0020u /*!< SDALowTimeout error mask */ +#define LDD_I2C_SLAVE_NACK 0x0040u /*!< SlaveNACK error mask */ + +typedef uint16_t LDD_I2C_TSize; /*!< Type specifying the length of the data or buffer. */ +typedef uint16_t LDD_I2C_TAddr; /*!< Type specifying the address variable */ +typedef uint16_t LDD_I2C_TErrorMask; /*!< Type specifying the error mask type. */ +typedef bool LDD_I2C_TMode; /*!< Type specifynng the Actual operating mode */ + +/*! Type specifying the address type */ +typedef enum { + LDD_I2C_ADDRTYPE_7BITS, /*!< 7 bits address */ + LDD_I2C_ADDRTYPE_10BITS, /*!< 10 bits address */ + LDD_I2C_ADDRTYPE_GENERAL_CALL /*!< General call address */ +} LDD_I2C_TAddrType; + +/*! Type specifying generate the stop condition */ +typedef enum { + LDD_I2C_NO_SEND_STOP, /*!< Do not send stop signal */ + LDD_I2C_SEND_STOP /*!< Send stop signal */ +} LDD_I2C_TSendStop; + +/*! Type specifying the I2C state of BUS. */ +typedef enum { + LDD_I2C_BUSY, /*!< The bus is busy */ + LDD_I2C_IDLE /*!< The bus is idle */ +} LDD_I2C_TBusState; + +/*! Type specifying the I2C byte acknowledge response. */ +typedef enum { + LDD_I2C_ACK_BYTE, /*!< Byte acknowledged */ + LDD_I2C_NACK_BYTE /*!< Byte not acknowledged */ +} LDD_I2C_TAckType; + +/*! Communication statistics */ +typedef struct { + uint32_t MasterSentChars; /*!< Number of master transmitted characters. */ + uint32_t MasterReceivedChars; /*!< Number of master received characters. */ + uint32_t MasterNacks; /*!< Number of no acknowledges. */ + uint32_t ArbitLost; /*!< Number of lost the bus arbitration. */ + uint32_t SlaveSentChars; /*!< Number of slave transmitted characters. */ + uint32_t SlaveReceivedChars; /*!< Number of slave received characters. */ + uint32_t SlaveTxUnderrun; /*!< Number of slave underrun. */ + uint32_t SlaveRxOverrun; /*!< Number of slave overrun. */ + uint32_t SlaveGeneralCallAddr; /*!< Number of a general call address. */ + uint32_t SlaveSmBusCallAddr; /*!< Number of a SMBus call address. */ + uint32_t SlaveSmBusAlertResponse; /*!< Number of slave SMBus alert response received. */ + uint32_t SCLLowTimeout; /*!< Number of SCL low timeout occur. */ + uint32_t SDALowTimeout; /*!< Number of SCL low timeout occur. */ +} LDD_I2C_TStats; + + +/* +** =================================================================== +** SegLCD device types and constants +** =================================================================== +*/ + +#define LDD_SEGLCD_ON_FRAME_FREQUENCY 0x0001u /*!< OnFrameFrequency event mask */ +#define LDD_SEGLCD_ON_FAULT_DETECT_COMPLETE 0x0002u /*!< OnFaultDetectComplete event mask */ + +typedef uint8_t LDD_SegLCD_TPinIndex; /*!< Type specifying the segment LCD pin index variable */ +typedef uint8_t LDD_SegLCD_TFrontplaneData; /*!< Type specifying the frontplane/backplane segment variable */ +typedef uint8_t LDD_SegLCD_TFaultValue; /*!< Type specifying the frontplane/backplane segment variable */ + +/*! Types specifying the segment LCD blinking. */ +typedef enum { + LDD_SEGLCD_BLINK_OFF, /*!< Disables display blinking */ + LDD_SEGLCD_BLINK_ALL, /*!< Display blank during the blink period */ + LDD_SEGLCD_BLINK_ALL_ALTERNATE /*!< Blinking between alternate backplane */ +} LDD_SegLCD_TBlinking; + +/*! Segment LCD blank state type. */ +typedef enum { + LDD_SEGLCD_BLANK_STATE, /*!< Blank display mode */ + LDD_SEGLCD_NORMAL_STATE, /*!< Normal display mode */ + LDD_SEGLCD_ALTERNATE_STATE /*!< Alternate display mode */ +} LDD_SegLCD_TSetBlank; + +/*! Segment LCD pin type (frontplane/backplane) */ +typedef enum { + LDD_SEGLCD_BACKPLANE_PIN, /*!< Backplane pin */ + LDD_SEGLCD_FRONTPLANE_PIN /*!< Frontplane pin */ +} LDD_SegLCD_TPinType; + + +/* +** =================================================================== +** GPIO device types and constants +** =================================================================== +*/ + +#define LDD_GPIO_PIN_0 0x01u /*!< Pin 0 inside the port */ +#define LDD_GPIO_PIN_1 0x02u /*!< Pin 1 inside the port */ +#define LDD_GPIO_PIN_2 0x04u /*!< Pin 2 inside the port */ +#define LDD_GPIO_PIN_3 0x08u /*!< Pin 3 inside the port */ +#define LDD_GPIO_PIN_4 0x10u /*!< Pin 4 inside the port */ +#define LDD_GPIO_PIN_5 0x20u /*!< Pin 5 inside the port */ +#define LDD_GPIO_PIN_6 0x40u /*!< Pin 6 inside the port */ +#define LDD_GPIO_PIN_7 0x80u /*!< Pin 7 inside the port */ +#define LDD_GPIO_PIN_8 0x0100u /*!< Pin 8 inside the port */ +#define LDD_GPIO_PIN_9 0x0200u /*!< Pin 9 inside the port */ +#define LDD_GPIO_PIN_10 0x0400u /*!< Pin 10 inside the port */ +#define LDD_GPIO_PIN_11 0x0800u /*!< Pin 11 inside the port */ +#define LDD_GPIO_PIN_12 0x1000u /*!< Pin 12 inside the port */ +#define LDD_GPIO_PIN_13 0x2000u /*!< Pin 13 inside the port */ +#define LDD_GPIO_PIN_14 0x4000u /*!< Pin 14 inside the port */ +#define LDD_GPIO_PIN_15 0x8000u /*!< Pin 15 inside the port */ +#define LDD_GPIO_PIN_16 0x00010000u /*!< Pin 16 inside the port */ +#define LDD_GPIO_PIN_17 0x00020000u /*!< Pin 17 inside the port */ +#define LDD_GPIO_PIN_18 0x00040000u /*!< Pin 18 inside the port */ +#define LDD_GPIO_PIN_19 0x00080000u /*!< Pin 19 inside the port */ +#define LDD_GPIO_PIN_20 0x00100000u /*!< Pin 20 inside the port */ +#define LDD_GPIO_PIN_21 0x00200000u /*!< Pin 21 inside the port */ +#define LDD_GPIO_PIN_22 0x00400000u /*!< Pin 22 inside the port */ +#define LDD_GPIO_PIN_23 0x00800000u /*!< Pin 23 inside the port */ +#define LDD_GPIO_PIN_24 0x01000000u /*!< Pin 24 inside the port */ +#define LDD_GPIO_PIN_25 0x02000000u /*!< Pin 25 inside the port */ +#define LDD_GPIO_PIN_26 0x04000000u /*!< Pin 26 inside the port */ +#define LDD_GPIO_PIN_27 0x08000000u /*!< Pin 27 inside the port */ +#define LDD_GPIO_PIN_28 0x10000000u /*!< Pin 28 inside the port */ +#define LDD_GPIO_PIN_29 0x20000000u /*!< Pin 29 inside the port */ +#define LDD_GPIO_PIN_30 0x40000000u /*!< Pin 30 inside the port */ +#define LDD_GPIO_PIN_31 0x80000000u /*!< Pin 31 inside the port */ + +#define LDD_GPIO_ON_PORT_EVENT 0x01u /*!< OnPortEvent event mask */ + +typedef uint32_t LDD_GPIO_TBitField; /*!< Abstract type specifying the bit field within the port. */ + +/*! Defines condition when event is invoked. */ +typedef enum { + LDD_GPIO_DISABLED = 0x00u, /*!< Event doesn't invoke */ + LDD_GPIO_LOW = 0x00080000u, /*!< Event when logic zero */ + LDD_GPIO_HIGH = 0x000C0000u, /*!< Event when logic one */ + LDD_GPIO_RISING = 0x00090000u, /*!< Event on rising edge */ + LDD_GPIO_FALLING = 0x000A0000u, /*!< Event on falling edge */ + LDD_GPIO_BOTH = 0x000B0000u /*!< Event on rising and falling edge */ +} LDD_GPIO_TEventCondition; /*!< Defines condition when event is invoked. */ + +#define LDD_GPIO_EVENT_CONDITIONS_MASK 0x000F0000u + +/* +** =================================================================== +** BITSIO device types and constants +** =================================================================== +*/ +#define LDD_BITSIO_PIN_0 0x01U /*!< Pin 0 inside pin list of component */ +#define LDD_BITSIO_PIN_1 0x02U /*!< Pin 1 inside pin list of component */ +#define LDD_BITSIO_PIN_2 0x04U /*!< Pin 2 inside pin list of component */ +#define LDD_BITSIO_PIN_3 0x08U /*!< Pin 3 inside pin list of component */ +#define LDD_BITSIO_PIN_4 0x10U /*!< Pin 4 inside pin list of component */ +#define LDD_BITSIO_PIN_5 0x20U /*!< Pin 5 inside pin list of component */ +#define LDD_BITSIO_PIN_6 0x40U /*!< Pin 6 inside pin list of component */ +#define LDD_BITSIO_PIN_7 0x80U /*!< Pin 7 inside pin list of component */ +#define LDD_BITSIO_PIN_8 0x0100U /*!< Pin 8 inside pin list of component */ +#define LDD_BITSIO_PIN_9 0x0200U /*!< Pin 9 inside pin list of component */ +#define LDD_BITSIO_PIN_10 0x0400U /*!< Pin 10 inside pin list of component */ +#define LDD_BITSIO_PIN_11 0x0800U /*!< Pin 11 inside pin list of component */ +#define LDD_BITSIO_PIN_12 0x1000U /*!< Pin 12 inside pin list of component */ +#define LDD_BITSIO_PIN_13 0x2000U /*!< Pin 13 inside pin list of component */ +#define LDD_BITSIO_PIN_14 0x4000U /*!< Pin 14 inside pin list of component */ +#define LDD_BITSIO_PIN_15 0x8000U /*!< Pin 15 inside pin list of component */ +#define LDD_BITSIO_PIN_16 0x00010000U /*!< Pin 16 inside pin list of component */ +#define LDD_BITSIO_PIN_17 0x00020000U /*!< Pin 17 inside pin list of component */ +#define LDD_BITSIO_PIN_18 0x00040000U /*!< Pin 18 inside pin list of component */ +#define LDD_BITSIO_PIN_19 0x00080000U /*!< Pin 19 inside pin list of component */ +#define LDD_BITSIO_PIN_20 0x00100000U /*!< Pin 20 inside pin list of component */ +#define LDD_BITSIO_PIN_21 0x00200000U /*!< Pin 21 inside pin list of component */ +#define LDD_BITSIO_PIN_22 0x00400000U /*!< Pin 22 inside pin list of component */ +#define LDD_BITSIO_PIN_23 0x00800000U /*!< Pin 23 inside pin list of component */ +#define LDD_BITSIO_PIN_24 0x01000000U /*!< Pin 24 inside pin list of component */ +#define LDD_BITSIO_PIN_25 0x02000000U /*!< Pin 25 inside pin list of component */ +#define LDD_BITSIO_PIN_26 0x04000000U /*!< Pin 26 inside pin list of component */ +#define LDD_BITSIO_PIN_27 0x08000000U /*!< Pin 27 inside pin list of component */ +#define LDD_BITSIO_PIN_28 0x10000000U /*!< Pin 28 inside pin list of component */ +#define LDD_BITSIO_PIN_29 0x20000000U /*!< Pin 29 inside pin list of component */ +#define LDD_BITSIO_PIN_30 0x40000000U /*!< Pin 30 inside pin list of component */ +#define LDD_BITSIO_PIN_31 0x80000000U /*!< Pin 31 inside pin list of component */ + +/* +** =================================================================== +** Ethernet device types and constants +** =================================================================== +*/ + +#define LDD_ETH_MDC_PIN 0x01u /*!< MDC pin mask */ +#define LDD_ETH_MDIO_PIN 0x02u /*!< MDIO pin mask */ +#define LDD_ETH_COL_PIN 0x04u /*!< COL pin mask */ +#define LDD_ETH_CRS_PIN 0x08u /*!< CRS pin mask */ +#define LDD_ETH_TXCLK_PIN 0x10u /*!< TXCLK pin mask */ +#define LDD_ETH_TXD0_PIN 0x20u /*!< TXD0 pin mask */ +#define LDD_ETH_TXD1_PIN 0x40u /*!< TXD1 pin mask */ +#define LDD_ETH_TXD2_PIN 0x80u /*!< TXD2 pin mask */ +#define LDD_ETH_TXD3_PIN 0x0100u /*!< TXD3 pin mask */ +#define LDD_ETH_TXEN_PIN 0x0200u /*!< TXEN pin mask */ +#define LDD_ETH_TXER_PIN 0x0400u /*!< TXER pin mask */ +#define LDD_ETH_RXCLK_PIN 0x0800u /*!< RXCLK pin mask */ +#define LDD_ETH_RXDV_PIN 0x1000u /*!< RXDV pin mask */ +#define LDD_ETH_RXD0_PIN 0x2000u /*!< RXD0 pin mask */ +#define LDD_ETH_RXD1_PIN 0x4000u /*!< RXD1 pin mask */ +#define LDD_ETH_RXD2_PIN 0x8000u /*!< RXD2 pin mask */ +#define LDD_ETH_RXD3_PIN 0x00010000u /*!< RXD3 pin mask */ +#define LDD_ETH_RXER_PIN 0x00020000u /*!< RXER pin mask */ + +#define LDD_ETH_ON_FRAME_TRANSMITTED 0x01u /*!< OnFrameTransmitted event mask */ +#define LDD_ETH_ON_FRAME_TRANSMITTED_TIMESTAMPED 0x02u /*!< OnFrameTransmittedTimestamped event mask */ +#define LDD_ETH_ON_FRAME_RECEIVED 0x04u /*!< OnFrameReceived event mask */ +#define LDD_ETH_ON_FRAME_RECEIVED_TIMESTAMPED 0x08u /*!< OnFrameReceivedTimestamped event mask */ +#define LDD_ETH_ON_MII_FINISHED 0x10u /*!< OnMIIFinished event mask */ +#define LDD_ETH_ON_FATAL_ERROR 0x20u /*!< OnFatalError event mask */ +#define LDD_ETH_ON_WAKE_UP 0x40u /*!< OnWakeUp event mask */ + +typedef uint8_t LDD_ETH_TMACAddress[6]; /*!< Ethernet MAC address */ + +/*! Ethernet duplex mode */ +typedef enum { + LDD_ETH_FULL_DUPLEX, /*!< Full duplex mode */ + LDD_ETH_HALF_DUPLEX /*!< Half duplex mode */ +} LDD_ETH_TDuplexMode; + +/*! Ethernet address filter mode options */ +typedef enum { + LDD_ETH_PROMISC, /*!< Promiscuous mode */ + LDD_ETH_REJECT_BC, /*!< Reject broadcast frames */ + LDD_ETH_ACCEPT_BC /*!< Accept broadcast frames */ +} LDD_ETH_TFilterMode; + +/*! Ethernet sleep mode options */ +typedef enum { + LDD_ETH_ENABLED, /*!< Sleep mode enabled */ + LDD_ETH_ENABLED_WITH_WAKEUP, /*!< Sleep mode enabled, waiting for wake-up */ + LDD_ETH_DISABLED /*!< Sleep mode disabled */ +} LDD_ETH_TSleepMode; + +/*! Ethernet frame buffer (fragment) descriptor */ +typedef struct { + uint8_t *DataPtr; /*!< Pointer to buffer data */ + uint16_t Size; /*!< Buffer data size */ +} LDD_ETH_TBufferDesc; + +typedef LDD_ETH_TBufferDesc* LDD_ETH_TBufferDescPtr; /*!< Frame buffer descriptor pointer type */ + +/*! Ethernet communication statistics */ +typedef struct { + uint32_t TxRMONDropEvents; /*!< Count of frames not counted correctly */ + uint32_t TxRMONOctets; /*!< Octet count for frames transmitted without error */ + uint32_t TxRMONPackets; /*!< Transmitted packet count */ + uint32_t TxRMONBroadcastPackets; /*!< Transmitted broadcast packets */ + uint32_t TxRMONMulticastPackets; /*!< Transmitted multicast packets */ + uint32_t TxRMONCRCAlignErrors; /*!< Transmitted packets with CRC or alignment error */ + uint32_t TxRMONUndersizePackets; /*!< Transmitted packets smaller than 64 bytes with good CRC */ + uint32_t TxRMONOversizePackets; /*!< Transmitted packets greater than max. frame length with good CRC */ + uint32_t TxRMONFragments; /*!< Transmitted packets smaller than 64 bytes with bad CRC */ + uint32_t TxRMONJabbers; /*!< Transmitted packets greater than max. frame length with bad CRC */ + uint32_t TxRMONCollisions; /*!< Transmit collision count */ + uint32_t TxRMONPackets64Octets; /*!< Transmitted 64 byte packets */ + uint32_t TxRMONPackets65To127Octets; /*!< Transmitted 65 to 127 byte packets */ + uint32_t TxRMONPackets128To255Octets; /*!< Transmitted 128 to 255 byte packets */ + uint32_t TxRMONPackets256To511Octets; /*!< Transmitted 256 to 511 byte packets */ + uint32_t TxRMONPackets512To1023Octets; /*!< Transmitted 512 to 1023 byte packets */ + uint32_t TxRMONPackets1024To2047Octets; /*!< Transmitted 1024 to 2047 byte packets */ + uint32_t TxRMONPacketsGreaterThan2048Octets; /*!< Transmitted packets greater than 2048 byte */ + uint32_t TxIEEEDrop; /*!< Count of frames not counted correctly */ + uint32_t TxIEEEFrameOK; /*!< Frames transmitted OK */ + uint32_t TxIEEESingleCollision; /*!< Frames transmitted with single collision */ + uint32_t TxIEEEMultipleCollisions; /*!< Frames transmitted with multiple collisions */ + uint32_t TxIEEEDeferralDelay; /*!< Frames transmitted after deferral delay */ + uint32_t TxIEEELateCollision; /*!< Frames transmitted with late collision */ + uint32_t TxIEEEExcessiveCollision; /*!< Frames transmitted with excessive collisions */ + uint32_t TxIEEEFIFOUnderrun; /*!< Frames transmitted with transmit FIFO underrun */ + uint32_t TxIEEECarrierSenseError; /*!< Frames transmitted with carrier sense error */ + uint32_t TxIEEESQEError; /*!< Frames transmitted with SQE error */ + uint32_t TxIEEEPauseFrame; /*!< Flow control pause frames transmitted */ + uint32_t TxIEEEOctetsOK; /*!< Octet count for frames transmitted without error */ + uint32_t RxRMONDropEvents; /*!< Count of frames not counted correctly */ + uint32_t RxRMONOctets; /*!< Octet count for frames recieved without error */ + uint32_t RxRMONPackets; /*!< Received packet count */ + uint32_t RxRMONBroadcastPackets; /*!< Received broadcast packets */ + uint32_t RxRMONMulticastPackets; /*!< Received multicast packets */ + uint32_t RxRMONCRCAlignErrors; /*!< Received packets with CRC or alignment error */ + uint32_t RxRMONUndersizePackets; /*!< Received packets smaller than 64 bytes with good CRC */ + uint32_t RxRMONOversizePackets; /*!< Received packets greater than max. frame length with good CRC */ + uint32_t RxRMONFragments; /*!< Received packets smaller than 64 bytes with bad CRC */ + uint32_t RxRMONJabbers; /*!< Received packets greater than max. frame length with bad CRC */ + uint32_t RxRMONPackets64Octets; /*!< Received 64 byte packets */ + uint32_t RxRMONPackets65To127Octets; /*!< Received 65 to 127 byte packets */ + uint32_t RxRMONPackets128To255Octets; /*!< Received 128 to 255 byte packets */ + uint32_t RxRMONPackets256To511Octets; /*!< Received 256 to 511 byte packets */ + uint32_t RxRMONPackets512To1023Octets; /*!< Received 512 to 1023 byte packets */ + uint32_t RxRMONPackets1024To2047Octets; /*!< Received 1024 to 2047 byte packets */ + uint32_t RxRMONPacketsGreaterThan2048Octets; /*!< Received packets greater than 2048 byte */ + uint32_t RxIEEEDrop; /*!< Count of frames not counted correctly */ + uint32_t RxIEEEFrameOK; /*!< Frames received OK */ + uint32_t RxIEEECRCError; /*!< Frames received with CRC error */ + uint32_t RxIEEEAlignmentError; /*!< Frames received with alignment error */ + uint32_t RxIEEEFIFOOverflow; /*!< Receive FIFO overflow count */ + uint32_t RxIEEEPauseFrame; /*!< Flow control pause frames received */ + uint32_t RxIEEEOctetsOK; /*!< Octet count for frames received without error */ +} LDD_ETH_TStats; + +/* +** =================================================================== +** FlexCAN device types and constants +** =================================================================== +*/ + +typedef uint8_t LDD_CAN_TMBIndex; /*!< CAN message buffer index */ +typedef uint32_t LDD_CAN_TAccMask; /*!< Type specifying the acceptance mask variable. */ +typedef uint32_t LDD_CAN_TMessageID; /*!< Type specifying the ID mask variable. */ +typedef uint8_t LDD_CAN_TErrorCounter; /*!< Type specifying the error counter variable. */ +typedef uint32_t LDD_CAN_TErrorMask; /*!< Type specifying the error mask variable. */ +typedef uint16_t LDD_CAN_TBufferMask; /*!< Type specifying the message buffer mask variable. */ +#define LDD_CAN_RX_PIN 0x01U /*!< Rx pin mask */ +#define LDD_CAN_TX_PIN 0x02U /*!< Tx pin mask */ + +#define LDD_CAN_ON_FULL_RXBUFFER 0x01U /*!< OnFullRxBuffer event mask */ +#define LDD_CAN_ON_FREE_TXBUFFER 0x02U /*!< OnFreeTxBuffer event mask */ +#define LDD_CAN_ON_BUSOFF 0x04U /*!< OnBusOff event mask */ +#define LDD_CAN_ON_TXWARNING 0x08U /*!< OnTransmitterWarning event mask */ +#define LDD_CAN_ON_RXWARNING 0x10U /*!< OnReceiverWarning event mask */ +#define LDD_CAN_ON_ERROR 0x20U /*!< OnError event mask */ +#define LDD_CAN_ON_WAKEUP 0x40U /*!< OnWakeUp event mask */ + +#define LDD_CAN_BIT0_ERROR 0x4000UL /*!< Bit0 error detect error mask */ +#define LDD_CAN_BIT1_ERROR 0x8000UL /*!< Bit1 error detect error mask */ +#define LDD_CAN_ACK_ERROR 0x2000UL /*!< Acknowledge error detect error mask */ +#define LDD_CAN_CRC_ERROR 0x1000UL /*!< Cyclic redundancy check error detect error mask */ +#define LDD_CAN_FORM_ERROR 0x0800UL /*!< Message form error detect error mask */ +#define LDD_CAN_STUFFING_ERROR 0x0400UL /*!< Bit stuff error detect error mask */ + +#define LDD_CAN_MESSAGE_ID_EXT 0x80000000UL /*!< Value specifying extended Mask, ID */ + +/*! Type specifying the CAN frame type. */ +typedef enum { + LDD_CAN_MB_RX_NOT_ACTIVE = 0x00U, + LDD_CAN_MB_RX_FULL = 0x02U, + LDD_CAN_MB_RX_EMPTY = 0x04U, + LDD_CAN_MB_RX_OVERRUN = 0x06U, + LDD_CAN_MB_RX_BUSY = 0x01U, + LDD_CAN_MB_RX_RANSWER = 0x0AU +} LDD_CAN_TRxBufferState; + +/*! Type specifying the CAN frame type. */ +typedef enum { + LDD_CAN_DATA_FRAME, /*!< Data frame type received or transmitted */ + LDD_CAN_REMOTE_FRAME, /*!< Remote frame type */ + LDD_CAN_RESPONSE_FRAME /*!< Response frame type - Tx buffer send data after receiving remote frame with the same ID */ +} LDD_CAN_TFrameType; + +/*! Type specifying the CAN communication statistics. */ +typedef struct { + uint32_t TxFrames; /*!< Transmitted frame counter */ + uint32_t TxWarnings; /*!< Transmission warning counter */ + uint32_t RxFrames; /*!< Received frame counter */ + uint32_t RxWarnings; /*!< Reception warning counter */ + uint32_t BusOffs; /*!< Bus off counter */ + uint32_t Wakeups; /*!< Wakeup counter */ + uint32_t Bit0Errors; /*!< Bit0 error counter */ + uint32_t Bit1Errors; /*!< Bit1 error counter */ + uint32_t AckErrors; /*!< ACK error counter */ + uint32_t CrcErrors; /*!< CRC error counter */ + uint32_t FormErrors; /*!< Message form error counter */ + uint32_t BitStuffErrors; /*!< Bit stuff error counter */ + uint32_t Errors; /*!< Error counter */ +} LDD_CAN_TStats; + +/*! Type specifying the CAN frame features. */ +typedef struct { + LDD_CAN_TMessageID MessageID; /*!< Message ID */ + LDD_CAN_TFrameType FrameType; /*!< Type of the frame DATA/REMOTE */ + uint8_t *Data; /*!< Message data buffer */ + uint8_t Length; /*!< Message length */ + uint16_t TimeStamp; /*!< Message time stamp */ + uint8_t LocPriority; /*!< Local Priority Tx Buffers */ +} LDD_CAN_TFrame; + +/* +** =================================================================== +** USB device types and constants +** =================================================================== +*/ + +/* Events' masks */ +#define LDD_USB_ON_DEVICE_RESET 0x00000001u /*!< OnDeviceReset event mask */ +#define LDD_USB_ON_DEVICE_SPEED_DETECT 0x00000002u /*!< OnDeviceSpeedDetect event mask */ +#define LDD_USB_ON_DEVICE_SUSPEND 0x00000004u /*!< OnDeviceSuspend event mask */ +#define LDD_USB_ON_DEVICE_RESUME 0x00000008u /*!< OnDeviceResume event mask */ +#define LDD_USB_ON_DEVICE_SETUP_PACKET 0x00000010u /*!< OnDeviceSetupPacket event mask */ +#define LDD_USB_ON_DEVICE_SOF 0x00000020u /*!< OnDeviceSof event mask */ +#define LDD_USB_ON_DEVICE_1MS_TIMER 0x00000040u /*!< OnDevice1msTimer event mask */ +#define LDD_USB_ON_DEVICE_1_MS_TIMER 0x00000040u /*!< OnDevice1msTimer event mask */ +#define LDD_USB_ON_DEVICE_ERROR 0x00000080u /*!< OnDeviceError event mask */ +#define LDD_USB_ON_HOST_DEVICE_DEATTACH 0x00000100u /*!< OnHostDeviceAttach event mask */ +#define LDD_USB_ON_HOST_RESET_RECOVERY 0x00000200u /*!< OnHostResetRecovery event mask */ +#define LDD_USB_ON_HOST_RESUME_RECOVERY 0x00000400u /*!< OnHostResumeRecovery event mask */ +#define LDD_USB_ON_HOST_1MS_TIMER 0x00000800u /*!< 1 ms timer event mask */ +#define LDD_USB_ON_HOST_1_MS_TIMER 0x00000800u /*!< 1 ms timer event mask */ +#define LDD_USB_ON_HOST_ERROR 0x00001000u /*!< OnHostError event mask */ +#define LDD_USB_ON_OTG_DEVICE 0x00002000u /*!< OnOtgDevice event mask */ +#define LDD_USB_ON_OTG_HOST 0x00004000u /*!< OnOtgHost event mask */ +#define LDD_USB_ON_OTG_STATE_CHANGE 0x00008000u /*!< OnOtgStageChange event mask */ +#define LDD_USB_ON_SIGNAL_CHANGE 0x00010000u /*!< OnSignalChange event mask */ + +/* Data pins' masks */ +#define LDD_USB_DP_PIN 0x00000001u /*!< Data+ pin mask */ +#define LDD_USB_DM_PIN 0x00000002u /*!< Data- pin mask */ + +/* Pullup/pulldown pin masks */ +#define LDD_USB_DP_PU_PIN 0x00000004u /*!< Data+ pull-up pin mask */ +#define LDD_USB_DM_PU_PIN 0x00000008u /*!< Data- pull-up pin mask */ +#define LDD_USB_DP_PD_PIN 0x00000010u /*!< Data+ pull-down pin mask */ +#define LDD_USB_DM_PD_PIN 0x00000020u /*!< Data- pull-down pin mask */ + +/* VBUS pins' mask */ +#define LDD_USB_DEVICE_VBUS_DETECT_PIN 0x00000040u /*!< VBUS detect pin mask */ +#define LDD_USB_HOST_VBUS_ENABLE_PIN 0x00000080u /*!< VBUS enable pin mask */ +#define LDD_USB_HOST_VBUS_OVERCURRENT_PIN 0x00000100u /*!< VBUS overcurrent pin mask */ + +/* OTG pins' masks */ +#define LDD_USB_OTG_ID_PIN 0x00000200u /*!< ID pin mask */ +#define LDD_USB_OTG_VBUS_VALID_PIN 0x00000400u /*!< VBUS valid pin mask */ +#define LDD_USB_OTG_SESSION_VALID_PIN 0x00000800u /*!< SESSION valid pin mask */ +#define LDD_USB_OTG_B_SESSION_END_PIN 0x00004000u /*!< B SESSION end pin mask */ +#define LDD_USB_OTG_VBUS_ENABLE_PIN 0x00008000u /*!< VBUS drive pin mask */ +#define LDD_USB_OTG_VBUS_CHARGE_PIN 0x00010000u /*!< VBUS charge pin mask */ +#define LDD_USB_OTG_VBUS_DISCHARGE_PIN 0x00020000u /*!< VBUS discharge pin mask */ + +/* ULPI pins' masks */ +#define LDD_USB_ULPI_CLK_PIN 0x00080000u /*!< ULPI_CLK pin mask */ +#define LDD_USB_ULPI_DIR_PIN 0x00100000u /*!< ULPI_DIR pin mask */ +#define LDD_USB_ULPI_NXT_PIN 0x00200000u /*!< ULPI_NXT pin mask */ +#define LDD_USB_ULPI_STP_PIN 0x00400000u /*!< ULPI_STOP pin mask */ +#define LDD_USB_ULPI_DATA_0_PIN 0x00800000u /*!< ULPI_DATA_0 pin mask */ +#define LDD_USB_ULPI_DATA_1_PIN 0x01000000u /*!< ULPI_DATA_1 pin mask */ +#define LDD_USB_ULPI_DATA_2_PIN 0x02000000u /*!< ULPI_DATA_2 pin mask */ +#define LDD_USB_ULPI_DATA_3_PIN 0x04000000u /*!< ULPI_DATA_3 pin mask */ +#define LDD_USB_ULPI_DATA_4_PIN 0x08000000u /*!< ULPI_DATA_4 pin mask */ +#define LDD_USB_ULPI_DATA_5_PIN 0x10000000u /*!< ULPI_DATA_5 pin mask */ +#define LDD_USB_ULPI_DATA_6_PIN 0x20000000u /*!< ULPI_DATA_6 pin mask */ +#define LDD_USB_ULPI_DATA_7_PIN 0x40000000u /*!< ULPI_DATA_7 pin mask */ + +/* Alternate clock pin*/ +#define LDD_USB_CLKIN_PIN 0x80000000u /*!< Alternate clock pin mask */ +#define LDD_USB_ALT_CLK_PIN 0x80000000u /*!< Alternate clock pin mask */ + +/* DeviceSetUsbStatus()/DeviceGetUsbStatus methods Cmd/CmdStatusPtr param. values */ +#define LDD_USB_CMD_GET_EP_STATUS 0x00u /*!< Get endpoint status command ID */ +#define LDD_USB_CMD_SET_EP_HALT_FATURE 0x01u /*!< Set endpoint HALT feature command ID */ +#define LDD_USB_CMD_CLR_EP_HALT_FATURE 0x02u /*!< Clear endpoint HALT feature command ID */ + +#define LDD_USB_CMD_EP_STATUS_HALT_MASK 0x01u /*!< Endpoint halt status mask */ + + +/* DeviceSetUsbStatus()/DeviceGetUsbStatus methods Recipient param. values */ +/* (see USB 2.0, chapter 9.3.4 wIndex description)*/ +#define LDD_USB_ID_EP0_OUT 0x00u /*!< EP0 OUT component ID */ +#define LDD_USB_ID_EP0_IN 0x80u /*!< EP0 IN component ID */ +#define LDD_USB_ID_EP1_OUT 0x01u /*!< EP1 OUT component ID */ +#define LDD_USB_ID_EP1_IN 0x81u /*!< EP1 IN component ID */ +#define LDD_USB_ID_EP2_OUT 0x02u /*!< EP2 OUT component ID */ +#define LDD_USB_ID_EP2_IN 0x82u /*!< EP2 IN component ID */ +#define LDD_USB_ID_EP3_OUT 0x03u /*!< EP3 OUT component ID */ +#define LDD_USB_ID_EP3_IN 0x83u /*!< EP3 IN component ID */ +#define LDD_USB_ID_EP4_OUT 0x04u /*!< EP4 OUT component ID */ +#define LDD_USB_ID_EP4_IN 0x84u /*!< EP4 IN component ID */ +#define LDD_USB_ID_EP5_OUT 0x05u /*!< EP5 OUT component ID */ +#define LDD_USB_ID_EP5_IN 0x85u /*!< EP5 IN component ID */ +#define LDD_USB_ID_EP6_OUT 0x06u /*!< EP6 OUT component ID */ +#define LDD_USB_ID_EP6_IN 0x86u /*!< EP6 IN component ID */ +#define LDD_USB_ID_EP7_OUT 0x07u /*!< EP7 OUT component ID */ +#define LDD_USB_ID_EP7_IN 0x87u /*!< EP7 IN component ID */ +#define LDD_USB_ID_EP8_OUT 0x08u /*!< EP8 OUT component ID */ +#define LDD_USB_ID_EP8_IN 0x88u /*!< EP8 IN component ID */ +#define LDD_USB_ID_EP9_OUT 0x09u /*!< EP9 OUT component ID */ +#define LDD_USB_ID_EP9_IN 0x89u /*!< EP9 IN component ID */ +#define LDD_USB_ID_EP10_OUT 0x0Au /*!< EP10 OUT component ID */ +#define LDD_USB_ID_EP10_IN 0x8Au /*!< EP10 IN component ID */ +#define LDD_USB_ID_EP11_OUT 0x0Bu /*!< EP11 OUT component ID */ +#define LDD_USB_ID_EP11_IN 0x8Bu /*!< EP11 IN component ID */ +#define LDD_USB_ID_EP12_OUT 0x0Cu /*!< EP12 OUT component ID */ +#define LDD_USB_ID_EP12_IN 0x8Cu /*!< EP12 IN component ID */ +#define LDD_USB_ID_EP13_OUT 0x0Du /*!< EP13 OUT component ID */ +#define LDD_USB_ID_EP13_IN 0x8Du /*!< EP13 IN component ID */ +#define LDD_USB_ID_EP14_OUT 0x0Eu /*!< EP14 OUT component ID */ +#define LDD_USB_ID_EP14_IN 0x8Eu /*!< EP14 IN component ID */ +#define LDD_USB_ID_EP15_OUT 0x0Fu /*!< EP15 OUT component ID */ +#define LDD_USB_ID_EP15_IN 0x8Fu /*!< EP15 IN component ID */ +#define LDD_USB_ID_EP_MASK 0x8Fu /*!< EP15 IN component ID */ + +/* Token PID */ +#define LDD_USB_PID_OUT 0x01u /*!< OUT */ +#define LDD_USB_PID_IN 0x09u /*!< IN */ +#define LDD_USB_PID_SOF 0x05u /*!< SOF */ +#define LDD_USB_PID_SETUP 0x0Du /*!< SETUP */ +/* Data PID */ +#define LDD_USB_PID_DATA0 0x03u /*!< DATA0 */ +#define LDD_USB_PID_DATA1 0x0Bu /*!< DATA1 */ +#define LDD_USB_PID_DATA2 0x07u /*!< DATA2 */ +#define LDD_USB_PID_MDATA 0x0Fu /*!< MDATA */ +/* Handshake PID */ +#define LDD_USB_PID_ACK 0x02u /*!< ACK */ +#define LDD_USB_PID_NACK 0x0Au /*!< NACK */ +#define LDD_USB_PID_STALL 0x0Eu /*!< STALL */ +#define LDD_USB_PID_NYET 0x06u /*!< NYET */ +/* Special PID */ +#define LDD_USB_PID_PRE 0x0Cu /*!< PRE */ +#define LDD_USB_PID_ERR 0x0Cu /*!< ERR */ +#define LDD_USB_PID_SPLIT 0x08u /*!< SPLIT */ +#define LDD_USB_PID_PING 0x04u /*!< PING */ + +/* Data direction */ +#define LDD_USB_DIR_OUT 0x00u /*!< Recipient is Device */ +#define LDD_USB_DIR_IN 0x80u /*!< Recipient is Host */ +#define LDD_USB_DIR_MASK 0x80u /*!< Bit mask for data transfer direction */ + +/* Flags used in the TD.Head.Flags variable */ + +/* The following flag can be used to force zero-length termination(ZLT) of the transfer. + Note: ZLT can be set for all transfer during the initialization of the endpoint. +*/ +#define LDD_USB_DEVICE_TRANSFER_FLAG_ZLT 0x01u + +/* If the TRANSFER_FLAG_EXT_PARAM is defined all variables of the TD are used + and TD must NOT be freed until transfer is done or is cancelled + (TransferState != LDD_USB_TRANSFER_PENDING) + If not defined only the Head member of TD is used and TD can be freed after + Send/Recv() method returns. +*/ +#define LDD_USB_DEVICE_TRANSFER_FLAG_EXT_PARAM 0x02u + + +#define ERR_COMPONET_SPECIFIC 0x100u + +/* Device mode USB specific error codes */ +#define ERR_USB_DEVICE_DISABLED (ERR_COMPONET_SPECIFIC + 0x00u) /*!< Device mode is disabled (by the user or by the clock configuration) */ +#define ERR_USB_DEVICE_DISABLED_BY_OTG (ERR_COMPONET_SPECIFIC + 0x01u) /*!< Device mode is disabled by the OTG driver */ +#define ERR_USB_DEVICE_VBUS_OFF (ERR_COMPONET_SPECIFIC + 0x02u) /*!< No VBUS is detected */ +#define ERR_USB_DEVICE_VBUS_ON (ERR_COMPONET_SPECIFIC + 0x03u) /*!< VBUS is detected */ +#define ERR_USB_DEVICE_ENABLED (ERR_COMPONET_SPECIFIC + 0x04u) /*!< Device is enabled */ +#define ERR_USB_DEVICE_SUSPENDED (ERR_COMPONET_SPECIFIC + 0x05u) /*!< Device is suspended */ +#define ERR_USB_DEVICE_SUSPENDED_RESUME_READY (ERR_COMPONET_SPECIFIC + 0x06u) /*!< Device is suspended and ready to generate resume signaling */ +#define ERR_USB_DEVICE_RESUME_PENDING (ERR_COMPONET_SPECIFIC + 0x07u) /*!< Device generates resume signaling */ + +/* Host mode USB specific error codes */ +#define ERR_USB_HOST_DISABLED (ERR_COMPONET_SPECIFIC + 0x00u) /*!< Host mode is disabled (by the user or by the clock configuration) */ +#define ERR_USB_HOST_DISABLED_BY_OTG (ERR_COMPONET_SPECIFIC + 0x01u) /*!< Host mode is disabled by the OTG driver */ +#define ERR_USB_HOST_PORT_POWERED_OFF (ERR_COMPONET_SPECIFIC + 0x02u) /*!< Port is power off */ +#define ERR_USB_HOST_PORT_DISCONNECTED (ERR_COMPONET_SPECIFIC + 0x03u) /*!< Port is power on */ +#define ERR_USB_HOST_PORT_DISABLED (ERR_COMPONET_SPECIFIC + 0x04u) /*!< Device is connected to the port */ +#define ERR_USB_HOST_PORT_RESETING (ERR_COMPONET_SPECIFIC + 0x05u) /*!< Port generates reset signaling */ +#define ERR_USB_HOST_PORT_RESET_RECOVERING (ERR_COMPONET_SPECIFIC + 0x06u) /*!< Port waits 10ms for reset recovery */ +#define ERR_USB_HOST_PORT_ENABLED (ERR_COMPONET_SPECIFIC + 0x07u) /*!< PortDevice is connected, reset and ready to use */ +#define ERR_USB_HOST_PORT_SUSPENDED (ERR_COMPONET_SPECIFIC + 0x08u) /*!< Port is suspended */ +#define ERR_USB_HOST_PORT_RESUME_READY (ERR_COMPONET_SPECIFIC + 0x09u) /*!< Port can generate resume signaling */ +#define ERR_USB_HOST_PORT_RESUMING (ERR_COMPONET_SPECIFIC + 0x0Au) /*!< Port generates resume signaling */ +#define ERR_USB_HOST_PORT_RESUME_RECOVERING (ERR_COMPONET_SPECIFIC + 0x0Bu) /*!< Port generates resume signaling */ + +/* OTG mode USB specific error codes */ +#define ERR_USB_OTG_DISABLED (ERR_COMPONET_SPECIFIC + 0x00u) /*!< OTG device is DISABLED state */ +#define ERR_USB_OTG_ENABLED_PENDING (ERR_COMPONET_SPECIFIC + 0x01u) /*!< OTG device is in ENABLED_PENDING state */ +#define ERR_USB_OTG_A_IDLE (ERR_COMPONET_SPECIFIC + 0x02u) /*!< OTG device is in A_IDLE state */ +#define ERR_USB_OTG_A_WAIT_VRISE (ERR_COMPONET_SPECIFIC + 0x03u) /*!< OTG device is in WAIT_VRISE state */ +#define ERR_USB_OTG_A_WAIT_VFALL (ERR_COMPONET_SPECIFIC + 0x05u) /*!< OTG device is in A_WAIT_VFALL state */ +#define ERR_USB_OTG_A_WAIT_BCON (ERR_COMPONET_SPECIFIC + 0x07u) /*!< OTG device is in A_WAIT_BCON state */ +#define ERR_USB_OTG_A_VBUS_ERROR (ERR_COMPONET_SPECIFIC + 0x09u) /*!< OTG device is in A_VBUS_ERROR state */ +#define ERR_USB_OTG_A_SUSPEND (ERR_COMPONET_SPECIFIC + 0x0Au) /*!< OTG device is in A_SUSPEND state */ + +#define ERR_USB_OTG_B_IDLE (ERR_COMPONET_SPECIFIC + 0x0Cu) /*!< OTG device is in B_IDLE state */ +#define ERR_USB_OTG_B_SRP_INIT (ERR_COMPONET_SPECIFIC + 0x0Eu) /*!< OTG device is in B_SRP_INIT state */ +#define ERR_USB_OTG_B_WAIT_ACON (ERR_COMPONET_SPECIFIC + 0x0Fu) /*!< OTG device is in B_WAIT_ACON state */ + +#define ERR_USB_OTG_A_HOST (ERR_COMPONET_SPECIFIC + 0x10u) /*!< OTG device is in A_HOST state */ +#define ERR_USB_OTG_A_PERIPHERAL (ERR_COMPONET_SPECIFIC + 0x11u) /*!< OTG device is in A_PERIPHERAL state */ +#define ERR_USB_OTG_B_HOST (ERR_COMPONET_SPECIFIC + 0x12u) /*!< OTG device is in B_HOST state */ +#define ERR_USB_OTG_B_PERIPHERAL (ERR_COMPONET_SPECIFIC + 0x13u) /*!< OTG device is in B_PERIPHERAL state */ + +/*! Device speed symbolic names */ +typedef enum { + LDD_USB_LOW_SPEED = 0x00u, /*!< Low-speed - 6 Mb/s mode */ + LDD_USB_FULL_SPEED = 0x01u, /*!< Full-speed - 12 Mb/s mode */ + LDD_USB_HIGH_SPEED = 0x02u, /*!< High-speed - 480 Mb/s mode */ + LDD_USB_SPEED_UNKNOWN = 0xFFu /*!< Unkown speed mode */ +} LDD_USB_TBusSpeed; + +/*! Transfer type symbolic names */ +typedef enum { + LDD_USB_CONTROL = 0x00u, /*!< Conrol transfer type */ + LDD_USB_ISOCHRONOUS = 0x01u, /*!< Isochronous transfer type */ + LDD_USB_BULK = 0x02u, /*!< Bulk transfer type */ + LDD_USB_INTERRUPT = 0x03u /*!< Interrupt transfer type */ +} LDD_USB_TTransferType; + +/*! Transfer state symbolic names */ +typedef enum { + LDD_USB_TRANSFER_NONE = 0x00u, /*!< Default valeu for new TD */ + LDD_USB_TRANSFER_DONE = 0x01u, /*!< Transfer done */ + LDD_USB_TRANSFER_ERROR_CANCELLED = 0x02u, /*!< Transfer cancelled by the user */ + LDD_USB_TRANSFER_ERROR_STALLED = 0x03u, /*!< Transfer stalled */ + LDD_USB_TRANSFER_ERROR_BUS_TIMEOUT = 0x04u, /*!< Bus timeute detected */ + LDD_USB_TRANSFER_ERROR_DATA = 0x05u, /*!< Data error deteceted */ + LDD_USB_TRANSFER_ERROR_PID = 0x06u, /*!< PID error deteceted */ + LDD_USB_TRANSFER_ERROR_EOF = 0x07u, /*!< EOF error deteceted */ + LDD_USB_TRANSFER_ERROR_CRC16 = 0x08u, /*!< CRC16 error deteceted */ + LDD_USB_TRANSFER_ERROR_DFN8 = 0x09u, /*!< DFN8 error deteceted */ + LDD_USB_TRANSFER_ERROR_DMA = 0x0Au, /*!< DMA error deteceted */ + LDD_USB_TRANSFER_ERROR_BTS = 0x0Bu, /*!< BTS error deteceted */ + LDD_USB_TRANSFER_ERROR = 0x0Fu, /*!< Transfer error deteceted */ + LDD_USB_TRANSFER_QUEUED = 0x10u, /*!< Transfer queued */ + LDD_USB_TRANSFER_PENDING = 0x30u /*!< Transfer in proggress */ +} LDD_USB_TTransferState; + +/*! Setup data packet structure, uint16_t items must be in little-endian format */ +typedef struct LDD_USB_TSDP_Struct { + uint8_t bmRequestType; /*!< Characteristics of request */ + uint8_t bRequest; /*!< Request code */ + uint16_t wValue; /*!< Word-sized field that varies according to request */ + uint16_t wIndex; /*!< Word-sized field that varies according to request, typically used to pass an index or offset */ + uint16_t wLength; /*!< Number of bytes to transfer if there is a data stage */ +} LDD_USB_TSDP; + +/*! Endpoint descriptor structure, uint16_t items must be in little-endian format */ +typedef struct LDD_USB_TEpDescriptor_Struct { + uint8_t bLength; /*!< Size of this descriptor in bytes */ + uint8_t bDescriptorType; /*!< Descriptor type */ + uint8_t bEndpointAddress; /*!< Endpoint address */ + uint8_t bmAttributes; /*!< Endpoint attributes */ + uint16_t wMaxPacketSize; /*!< Maximum packet size the endpoint is capable of sending or receiving */ + uint8_t bInterval; /*!< Interval for polling endpoint for data transfers */ +} LDD_USB_TEpDescriptor; + +/*! Standard device descriptor structure, uint16_t items must be in little-endian format */ +typedef struct LDD_USB_TDevDescriptor_Struct { + uint8_t bLength; /*!< Size of this descriptor in bytes */ + uint8_t bDescriptorType; /*!< Descriptor type */ + uint16_t bcdUSB; /*!< USB specification release number in binary-coded Decimal */ + uint8_t bDeviceClass; /*!< Class code (assigned by the USB-IF) */ + uint8_t bDeviceSubClass; /*!< Subclass code (assigned by the USB-IF) */ + uint8_t bDeviceProtocol; /*!< Protocol code (assigned by the USB-IF) */ + uint8_t bMaxPacketSize0; /*!< Maximum packet size for endpoint zero */ + uint16_t idVendor; /*!< Vendor ID (assigned by the USB-IF) */ + uint16_t idProduct; /*!< Product ID (assigned by the manufacturer) */ + uint16_t bcdDevice; /*!< Device release number in binary-coded decimal */ + uint8_t iManufacturer; /*!< Index of string descriptor describing manufacturer */ + uint8_t iProduct; /*!< Index of string descriptor describing product */ + uint8_t iSerialNumber; /*!< Index of string descriptor describing the device’s serial number */ + uint8_t bNumConfigurations; /*!< Number of possible configurations */ +} LDD_USB_TDevDescriptor; + + +/*! Device transfer descriptor structure forward declaration */ +struct LDD_USB_Device_TTD_Struct; + +/*! Device transfer done callback prototype */ +typedef void (LDD_USB_Device_TTransferDoneCalback)(LDD_TDeviceData *DevDataPtr, struct LDD_USB_Device_TTD_Struct *TrParamPtr); + +/*! Device transfer descriptor structure - head part */ +typedef struct LDD_USB_Device_TTD_Head_Struct { + uint8_t EpNum; /*!< Endpoint number */ + LDD_TData *BufferPtr; /*!< Buffer address */ + uint16_t BufferSize; /*!< Buffer size */ + uint8_t Flags; /*!< Transfer flags - see constants definition */ +} LDD_USB_Device_TTD_Head; + +/*! Device transfer descriptor structure */ +typedef struct LDD_USB_Device_TTD_Struct { + /* Requierd variables */ + LDD_USB_Device_TTD_Head Head; /*!< Td head data, not changed by the driver */ + /* Optional items - the following items are used */ + /* only if Head.Flags & LDD_USB_DEVICE_TRANSFER_FLAG_EXT_PARAM != 0 */ + LDD_USB_TTransferState TransferState; /*!< Transfer state. Set by the driver */ + uint16_t TransmittedDataSize; /*!< Transmitted data size. Set by the driver */ + LDD_USB_Device_TTransferDoneCalback *CallbackFnPtr; /*!< Address of the callback function. Must be set by the caller */ + uint8_t *ParamPtr; /*!< User parameter. Not changed by the driver */ +} LDD_USB_Device_TTD; + +/*! USB device states symbolic names */ +typedef enum { + LDD_USB_DEVICE_DISABLED = ERR_USB_DEVICE_DISABLED, /*!< Device mode is disabled (by the user or by the clock configuration) */ + LDD_USB_DEVICE_DISABLED_BY_OTG = ERR_USB_DEVICE_DISABLED_BY_OTG, /*!< Device mode is disabled by the OTG driver */ + LDD_USB_DEVICE_VBUS_OFF = ERR_USB_DEVICE_VBUS_OFF, /*!< No VBUS is detected */ + LDD_USB_DEVICE_VBUS_ON = ERR_USB_DEVICE_VBUS_ON, /*!< VBUS is detected */ + LDD_USB_DEVICE_ENABLED = ERR_USB_DEVICE_ENABLED, /*!< Device is enabled - reset by the host */ + LDD_USB_DEVICE_SUSPENDED = ERR_USB_DEVICE_SUSPENDED, /*!< Device is suspended - Bus is idle more then 3 ms */ + LDD_USB_DEVICE_SUSPENDED_RESUME_READY = ERR_USB_DEVICE_SUSPENDED_RESUME_READY, /*!< Device can generate resume signaling - Bus is idle more then 5 ms. */ + LDD_USB_DEVICE_RESUME_PENDING = ERR_USB_DEVICE_RESUME_PENDING /*!< Device generates resume signaling */ +} LDD_USB_Device_TState; + +/*! USB host mode states symbolic names */ +typedef enum { + LDD_USB_HOST_DISABLED = ERR_USB_HOST_DISABLED, /*!< Host mode is disabled (by the user or by the clock configuration) */ + LDD_USB_HOST_DISABLED_BY_OTG = ERR_USB_HOST_DISABLED_BY_OTG, /*!< Host mode is disabled by the OTG driver */ + LDD_USB_HOST_PORT_POWERED_OFF = ERR_USB_HOST_PORT_POWERED_OFF, /*!< Port is powered-off */ + LDD_USB_HOST_PORT_DISCONNECTED = ERR_USB_HOST_PORT_DISCONNECTED, /*!< No device is connected */ + LDD_USB_HOST_PORT_DISABLED = ERR_USB_HOST_PORT_DISABLED, /*!< Device is connected to the port */ + LDD_USB_HOST_PORT_RESETING = ERR_USB_HOST_PORT_RESETING, /*!< Port generates reset signaling */ + LDD_USB_HOST_PORT_RESET_RECOVERING = ERR_USB_HOST_PORT_RESET_RECOVERING, /*!< Port waits 10 ms for reset recovery */ + LDD_USB_HOST_PORT_ENABLED = ERR_USB_HOST_PORT_ENABLED, /*!< Device is connected, reset and ready to use */ + LDD_USB_HOST_PORT_SUSPENDED = ERR_USB_HOST_PORT_SUSPENDED, /*!< Port is suspended */ + LDD_USB_HOST_PORT_RESUME_READY = ERR_USB_HOST_PORT_RESUME_READY, /*!< Port is ready to generate resume signaling */ + LDD_USB_HOST_PORT_RESUMING = ERR_USB_HOST_PORT_RESUMING, /*!< Port generates resume signaling */ + LDD_USB_HOST_PORT_RESUME_RECOVERING = ERR_USB_HOST_PORT_RESUME_RECOVERING /*!< Port waits 10 ms for resume recovery */ +} LDD_USB_Host_TState; + +/*! USB otg mode states symbolic names */ +typedef enum { + LDD_USB_OTG_DISABLED = ERR_USB_OTG_DISABLED, /*!< OTG device is in DISABLED state */ + LDD_USB_OTG_ENABLED = ERR_USB_OTG_ENABLED_PENDING, /*!< OTG device is in ENABLED_PENDING state */ + LDD_USB_OTG_A_IDLE = ERR_USB_OTG_A_IDLE, /*!< OTG device is in A_IDLE state */ + LDD_USB_OTG_A_WAIT_VRISE = ERR_USB_OTG_A_WAIT_VRISE, /*!< OTG device is in A_WAIT_VRISE state */ + LDD_USB_OTG_A_WAIT_VFALL = ERR_USB_OTG_A_WAIT_VFALL, /*!< OTG device is in A_WAIT_VFALL state */ + LDD_USB_OTG_A_WAIT_BCON = ERR_USB_OTG_A_WAIT_BCON, /*!< OTG device is in A_WAIT_BCON state */ + LDD_USB_OTG_A_VBUS_ERROR = ERR_USB_OTG_A_VBUS_ERROR, /*!< OTG device is in A_VBUS_ERROR state */ + LDD_USB_OTG_A_SUSPEND = ERR_USB_OTG_A_SUSPEND, /*!< OTG device is in A_SUSPEND state */ + LDD_USB_OTG_B_IDLE = ERR_USB_OTG_B_IDLE, /*!< OTG device is in B_IDLE state */ + LDD_USB_OTG_B_SRP_INIT = ERR_USB_OTG_B_SRP_INIT, /*!< OTG device is in B_SRP_INIT state */ + LDD_USB_OTG_B_WAIT_ACON = ERR_USB_OTG_B_WAIT_ACON, /*!< OTG device is in B_WAIT_ACON state */ + LDD_USB_OTG_A_HOST = ERR_USB_OTG_A_HOST, /*!< OTG device is in A_HOST state */ + LDD_USB_OTG_A_PERIPHERAL = ERR_USB_OTG_A_PERIPHERAL, /*!< OTG device is in A_PERIPHERAL state */ + LDD_USB_OTG_B_HOST = ERR_USB_OTG_B_HOST, /*!< OTG device is in B_HOST state */ + LDD_USB_OTG_B_PERIPHERAL = ERR_USB_OTG_B_PERIPHERAL /*!< OTG device is in B_PERIPHERAL state */ +} LDD_USB_Otg_TState; + +/*! USB Otg commands symbolic names */ +typedef enum { + LDD_USB_OTG_CMD_SET_A_BUS_REQUEST, /*!< A-device application wants to use the bus */ + LDD_USB_OTG_CMD_CLR_A_BUS_REQUEST, /*!< A-device application doesn't want to use the bus */ + LDD_USB_OTG_CMD_SET_B_BUS_REQUEST, /*!< B-device application wants to use the bus */ + LDD_USB_OTG_CMD_CLR_B_BUS_REQUEST, /*!< B-device application doesn't want to use the bus */ + LDD_USB_OTG_CMD_SET_A_BUS_DROP, /*!< A-device application needs to power down the bus */ + LDD_USB_OTG_CMD_CLR_A_BUS_DROP, /*!< A-device application doesn't need to power down the bus */ + LDD_USB_OTG_CMD_SET_A_SUSPEND_REQUEST, /*!< A-device application wants to suspend the bus */ + LDD_USB_OTG_CMD_CLR_A_SUSPEND_REQUEST, /*!< A-device application doesn't want to suspend the bus */ + LDD_USB_OTG_CMD_SET_A_SET_B_HNP_EN_REQUEST, /*!< A-device sets HNP enabled feature on B-device */ + LDD_USB_OTG_CMD_CLR_A_SET_B_HNP_EN_REQUEST, /*!< A-device clears HNP enabled feature on B-device */ + LDD_USB_OTG_CMD_SET_B_HNP_EN_REQUEST, /*!< Enable B-device HNP */ + LDD_USB_OTG_CMD_CLR_B_HNP_EN_REQUEST /*!< Disable B-device HNP */ +} LDD_USB_Otg_TCmd; + +/*! USB host port control commands symbolic names */ +typedef enum { + LDD_USB_HOST_PORT_CMD_POWER_ON, /*!< Power-on the bus */ + LDD_USB_HOST_PORT_CMD_POWER_OFF, /*!< Power-off the bus */ + LDD_USB_HOST_PORT_CMD_RESET, /*!< Perform the bus reset signaling and call event after the reset recovery interval elapse */ + LDD_USB_HOST_PORT_CMD_RESUME, /*!< Perform the bus resume signaling and call event after the resume recovery interval elapse */ + LDD_USB_HOST_PORT_CMD_SUSPEND, /*!< Suspend the bus and transceiver */ + LDD_USB_HOST_PORT_CMD_DISABLE /*!< Disable the port */ +} LDD_USB_Host_TPortControlCmd; + +/*! USB host handle prototypes */ +typedef void LDD_USB_Host_TPipeHandle; /*!< Pipe handle prototype */ +typedef void LDD_USB_Host_TTransferHandle; /*!< Transfer handle prototype */ + +/*! USB host pipe descriptor structure */ +typedef struct LDD_USB_Host_TPipeDescr_Struct { + uint8_t DevAddress; /*!< Device address */ + LDD_USB_TBusSpeed DevSpeed; /*!< Device speed */ + uint8_t EpNumber; /*!< EP number */ + uint8_t EpDir; /*!< EP direction */ + LDD_USB_TTransferType TransferType; /*!< EP Transfer type */ + uint16_t MaxPacketSize; /*!< EP max. packet size */ + uint8_t TrPerUFrame; /*!< Transaction pre microframe */ + uint32_t Interval; /*!< Interval for polling endpoint for data transfers */ + uint32_t NAKCount; /*!< NAK count */ + uint8_t Flags; /*!< 1 = ZLT */ +} LDD_USB_Host_TPipeDescr; + +/*! USB host transfer done callback prototype */ +typedef void (LDD_USB_Host_TTransferDoneCalback)( + LDD_TDeviceData *DevDataPtr, /*!< User value passed as parameter of the Init() method */ + LDD_TData *BufferPtr, /*!< Buffer address */ + uint16_t BufferSize, /*!< Transferred data size */ + uint8_t *ParamPtr, /*!< User value passed in Send()/Recv() method */ + LDD_USB_TTransferState Status /*!< Transfer status */ +); + +/*! USB host transfer descriptor structure */ +typedef struct LDD_USB_Host_TTD_Struct { + LDD_TData *BufferPtr; /*!< Buffer address */ + uint16_t BufferSize; /*!< Buffer size */ + uint8_t Flags; /*!< Transfer flags */ + LDD_USB_Host_TTransferDoneCalback *CallbackFnPtr; /*!< Address of the callback function. Must be set by the caller */ + uint8_t *ParamPtr; /*!< User parameter. Not changed by the driver */ + LDD_USB_TSDP *SDPPrt; /*!< Setup data buffer pointer */ +} LDD_USB_Host_TTD; + +/*! Following USB constants and types are for test purpose only */ + +/* Request types */ +#define LDD_USB_REQ_TYPE_STANDARD 0x00u /*!< Standard request */ +#define LDD_USB_REQ_TYPE_CLASS 0x20u /*!< Class request */ +#define LDD_USB_REQ_TYPE_VENDOR 0x40u /*!< Vendor request */ +#define LDD_USB_REQ_TYPE_MASK 0x60u /*!< Bit mask for request type (bmRequestType) */ + +/* Request recepient */ +#define LDD_USB_REQ_RECP_DEVICE 0x00u /*!< Recipient = Device */ +#define LDD_USB_REQ_RECP_INTERFACE 0x01u /*!< Recipient = Interface */ +#define LDD_USB_REQ_RECP_ENDPOINT 0x02u /*!< Recipient = Endpoint */ +#define LDD_USB_REQ_RECP_OTHER 0x03u /*!< Recipient = Other */ +#define LDD_USB_REQ_RECP_MASK 0x03u /*!< Bit mask for recipient */ + +/* Standard request codes (bRequest) */ +#define LDD_USB_REQ_GET_STATUS 0x00u /*!< GET_STATUS request code */ +#define LDD_USB_REQ_CLEAR_FEATURE 0x01u /*!< CLEAR_FEATURE request code */ +#define LDD_USB_REQ_SET_FEATURE 0x03u /*!< SET_FEATURE request code */ +#define LDD_USB_REQ_GET_STATE 0x04u /*!< GET_STATE request code (for Hub Class only)*/ +#define LDD_USB_REQ_SET_ADDRESS 0x05u /*!< SET_ADDRESS request code */ +#define LDD_USB_REQ_GET_DESCRIPTOR 0x06u /*!< GET_DESCRIPTOR request code */ +#define LDD_USB_REQ_SET_DESCRIPTOR 0x07u /*!< SET_DESCRIPTOR request code, this request is not supported */ +#define LDD_USB_REQ_GET_CONFIGURATION 0x08u /*!< GET_CONFIGURATION request code */ +#define LDD_USB_REQ_SET_CONFIGURATION 0x09u /*!< SET_CONFIGURATION request code */ +#define LDD_USB_REQ_GET_INTERFACE 0x0Au /*!< GET_INTERFACE request code */ +#define LDD_USB_REQ_SET_INTERFACE 0x0Bu /*!< SET_INTERFACE request code */ +#define LDD_USB_REQ_SYNCH_FRAME 0x0Cu /*!< SYNCH_FRAME request code */ + +/* Standard request words for device (bmRequestType | bRequest) */ +#define LDD_USB_STD_REQ_GET_DEV_STATUS 0x0080u /*!< GET_DEVICE_STATUS bmRequestType and bRequest word */ +#define LDD_USB_STD_REQ_CLR_DEV_FEATURE 0x0100u /*!< CLEAR_DEVICE_FEATURE bmRequestType and bRequest word */ +#define LDD_USB_STD_REQ_SET_DEV_FEATURE 0x0300u /*!< SET_DEVICE_FEATURE bmRequestType and bRequest word */ +#define LDD_USB_STD_REQ_SET_ADDRESS 0x0500u /*!< SET_DEVICE_ADDRESS bmRequestType and bRequest word */ +#define LDD_USB_STD_REQ_GET_DESCRIPTOR 0x0680u /*!< GET_DESCRIPTOR bmRequestType and bRequest word */ +#define LDD_USB_STD_REQ_SET_DESCRIPTOR 0x0700u /*!< SET_DESCRIPTOR bmRequestType and bRequest word */ +#define LDD_USB_STD_REQ_GET_CONFIGURATION 0x0880u /*!< GET_DEVICE_CONFIGURATION bmRequestType and bRequest word */ +#define LDD_USB_STD_REQ_SET_CONFIGURATION 0x0900u /*!< SET_DEVICE_CONFIGURATION bmRequestType and bRequest word */ + +/* Standard request words for interface (bmRequestType | bRequest) */ +#define LDD_USB_STD_REQ_GET_INT_STATUS 0x0081u /*!< GET_INTERFACE_STATUS bmRequestType and bRequest word */ +#define LDD_USB_STD_REQ_CLR_INT_FEATURE 0x0101u /*!< CLEAR_INTERFACE_FEATURE bmRequestType and bRequest word */ +#define LDD_USB_STD_REQ_SET_INT_FEATURE 0x0301u /*!< SET_INTERFACE_FEATURE bmRequestType and bRequest word */ +#define LDD_USB_STD_REQ_GET_INTERFACE 0x0A81u /*!< GET_DEVICE_INTERFACE bmRequestType and bRequest word */ +#define LDD_USB_STD_REQ_SET_INTERFACE 0x0B01u /*!< SET_DEVICE_INTERFACE bmRequestType and bRequest word */ + +/* Standard request words for endpoint (bmRequestType | bRequest) */ +#define LDD_USB_STD_REQ_GET_EP_STATUS 0x0082u /*!< GET_ENDPOINT_STATUS bmRequestType and bRequest word */ +#define LDD_USB_STD_REQ_CLR_EP_FEATURE 0x0102u /*!< CLEAR_ENDPOINT_FEATURE bmRequestType and bRequest word */ +#define LDD_USB_STD_REQ_SET_EP_FEATURE 0x0302u /*!< ENDPOINT_ bmRequestType and bRequest word */ +#define LDD_USB_STD_REQ_SYNCH_FRAME 0x0C12u /*!< SYNCH_DEVICE_FRAME bmRequestType and bRequest code */ + +#define LDD_USB_STATUS_DEVICE_SELF_POWERED_MASK 0x01u +#define LDD_USB_STATUS_DEVICE_REMOTE_WAKEUP_MASK 0x02u + +/* Standard descriptors */ +#define LDD_USB_DT_DEVICE 0x01u /*!< Device descriptor */ +#define LDD_USB_DT_CONFIGURATION 0x02u /*!< Configuration descriptor */ +#define LDD_USB_DT_STRING 0x03u /*!< String descriptor */ +#define LDD_USB_DT_INTERFACE 0x04u /*!< Interface descriptor */ +#define LDD_USB_DT_ENDPOINT 0x05u /*!< Endpoint descriptor */ +#define LDD_USB_DT_DEVICE_QUALIFIER 0x06u /*!< Device qualifier descriptor */ +#define LDD_USB_DT_OTHER_SPEED_CONFIGURATION 0x07u /*!< Other speed configuration descriptor */ +#define LDD_USB_DT_INTERFACE_POWER 0x08u /*!< Interface-level power management descriptor */ +#define LDD_USB_DT_OTG 0x09u /*!< OTG descriptor */ +#define LDD_USB_DT_DEBUG 0x0Au /*!< Debug descriptor */ +#define LDD_USB_DT_INTERFACE_ASSOCIATION 0x0Bu /*!< Interface association descriptor */ + +/* Standard feature selectors */ +#define LDD_USB_FEATURE_EP_HALT 0x00u /*!< Endpoint HALT feature selector */ +#define LDD_USB_FEATURE_DEV_REMOTE_WAKEUP 0x01u /*!< Remote Wake-up feature selector */ +#define LDD_USB_FEATURE_DEV_TEST_MODE 0x02u /*!< Test mode feature selector */ + +/*! Get decriptor request structure */ +typedef struct LDD_USB_TGetDecriptorRequest_Struct { + uint8_t bmRequestType; /*!< Characteristics of request */ + uint8_t bRequest; /*!< Request ID */ + uint8_t bDescriptorIndex; /*!< Descriptor index */ + uint8_t bDescriptorType; /*!< Descriptor type */ + uint16_t wLanguageID; /*!< Language ID */ + uint16_t wLength; /*!< Requested data size */ +} LDD_USB_TGetDecriptorRequest; + +/*! Get endpoint status request structure */ +typedef struct LDD_USB_TEndpointStatusRequest_Struct { + uint8_t bmRequestType; /*!< Characteristics of request */ + uint8_t bRequest; /*!< Request ID */ + uint16_t wValue; /*!< Not used, should be set to zero */ + uint8_t bEndpoint; /*!< Endpoint address */ + uint8_t bIndexHigh; /*!< Not used, should be set to zero */ + uint16_t wLength; /*!< Reqested data size, should be set to 2 */ +} LDD_USB_TEndpointStatusRequest; + +/*! Clear/Set endpoint feature request structure */ +typedef struct LDD_USB_TEndpointFeatureRequest_Struct { + uint8_t bmRequestType; /*!< Characteristics of request */ + uint8_t bRequest; /*!< Request ID */ + uint16_t wFeatureSelector; /*!< Feature selector */ + uint8_t bEndpoint; /*!< Endpoint address */ + uint8_t bIndexHigh; /*!< Not used, should be set to zero */ + uint16_t wLength; /*!< Not used, should be set to zero */ +} LDD_USB_TEndpointFeatureRequest; + +/*! Clear/Set interface request structure */ +typedef struct LDD_USB_TInterfaceFeatureRequest_Struct { + uint8_t bmRequestType; /*!< Characteristics of request */ + uint8_t bRequest; /*!< Request ID */ + uint16_t wFeatureSelector; /*!< Feature selector */ + uint16_t wInterface; /*!< Interface index */ + uint16_t wLength; /*!< Not used, should be set to zero */ +} LDD_USB_TInterfaceFeatureRequest; + +/*! Clear/Set device request structure */ +typedef struct LDD_USB_TDeviceFeatureRequest_Struct { + uint8_t bmRequestType; /*!< Characteristics of request */ + uint8_t bRequest; /*!< Request ID */ + uint16_t wFeatureSelector; /*!< Feature selector */ + uint16_t wIndex; /*!< Not used, should be set to zero */ + uint16_t wLength; /*!< Not used, should be set to zero */ +} LDD_USB_TDeviceFeatureRequest; + +/*! Get interface request structure */ +typedef struct LDD_USB_TGetInterfaceRequest_Struct { + uint8_t bmRequestType; /*!< Characteristics of request */ + uint8_t bRequest; /*!< Request ID */ + uint16_t wWalue; /*!< Not used, should be zero */ + uint16_t wInterface; /*!< Interface index */ + uint16_t wLength; /*!< Reqested data size, should be set to 1 */ +} LDD_USB_TGetInterfaceRequest; + +/*! Set interface request structure */ +typedef struct LDD_USB_TSetInterfaceRequest_Struct { + uint8_t bmRequestType; /*!< Characteristics of request */ + uint8_t bRequest; /*!< Request ID */ + uint16_t wAltSet; /*!< Alternate setting */ + uint16_t wInterface; /*!< Interface index */ + uint16_t wLength; /*!< Not used, should be set to zero */ +} LDD_USB_TSetInterfaceRequest; + +/*! Set address request structure */ +typedef struct LDD_USB_TSetAddressRequest_Struct { + uint8_t bmRequestType; /*!< Characteristics of request */ + uint8_t bRequest; /*!< Request ID */ + uint8_t DeviceAddress; /*!< Device address */ + uint8_t bValueHigh; /*!< Not used, should be set to zero */ + uint16_t wIndex; /*!< Not used, should be set to zero */ + uint16_t wLength; /*!< Not used, should be set to zero */ +} LDD_USB_TSetAddressRequest; + +/*! Set address request structure */ +typedef struct LDD_USB_TSetConfigRequest_Struct { + uint8_t bmRequestType; /*!< Characteristics of request */ + uint8_t bRequest; /*!< Request ID */ + uint8_t bValueHigh; /*!< Not used, should be set to zero */ + uint8_t ConfigNumber; /*!< Configuration number */ + uint16_t wIndex; /*!< Not used, should be set to zero */ + uint16_t wLength; /*!< Not used, should be set to zero */ +} LDD_USB_TSetConfigRequest; + +/* +** =================================================================== +** DAC device types and constants +** =================================================================== +*/ +#define LDD_DAC_OUTPUT_PIN_0 0x01u /*!< DAC output pin 0 mask */ + +#define LDD_DAC_ON_BUFFER_END 0x01U /*!< OnBufferEnd event mask */ +#define LDD_DAC_ON_BUFFER_START 0x02U /*!< OnBufferStart event mask */ +#define LDD_DAC_ON_BUFFER_WATERMARK 0x04U /*!< OnBufferWatermark event mask */ +#define LDD_DAC_ON_COMPLETE LDD_DMA_ON_COMPLETE /*!< OnComplete event mask */ +#define LDD_DAC_ON_ERROR LDD_DMA_ON_ERROR /*!< OnError event mask */ + +/*! Type specifying the DAC buffer work mode */ +typedef enum { + LDD_DAC_BUFFER_NORMAL_MODE = 0x00U, /*!< Normal (cyclic) mode */ + LDD_DAC_BUFFER_SWING_MODE = 0x01U, /*!< Swing mode */ + LDD_DAC_BUFFER_SCAN_MODE = 0x02U /*!< One-time scan mode */ +} LDD_DAC_TBufferMode; + +/*! Type specifying the DAC buffer watermark levels */ +typedef enum { + LDD_DAC_BUFFER_WATERMARK_L1 = 0x00U, + LDD_DAC_BUFFER_WATERMARK_L2 = 0x01U, + LDD_DAC_BUFFER_WATERMARK_L3 = 0x02U, + LDD_DAC_BUFFER_WATERMARK_L4 = 0x03U +} LDD_DAC_TBufferWatermark; + +#define LDD_DAC_DMA_ERROR 0x01u /*!< DMA error mask */ + +typedef void* LDD_DAC_TDataPtr; /*!< Type specifying the pointer to the DAC data variable */ +typedef uint32_t LDD_DAC_TData; /*!< The DAC data variable type */ +typedef uint32_t LDD_DAC_TErrorMask; /*!< Error mask */ +typedef uint32_t LDD_DAC_TArrayLength; /*!< Array length type */ + +/* +** =================================================================== +** FLASH device types and constants +** =================================================================== +*/ +#define LDD_FLASH_ON_OPERATION_COMPLETE 0x02u /*!< OnOperationComplete event mask */ +#define LDD_FLASH_ON_ERROR 0x04u /*!< OnError event mask */ + +#define LDD_FLASH_READ_COLLISION_ERROR 0x40u /*!< Read collision error flag's mask */ +#define LDD_FLASH_ACCESS_ERROR 0x20u /*!< Access error flag's mask */ +#define LDD_FLASH_PROTECTION_VIOLATION 0x10u /*!< Protection violation error flag's mask */ +#define LDD_FLASH_ERASE_VERIFICATION_ERROR 0x08u /*!< Erase verification error flag's mask */ +#define LDD_FLASH_MULTIPLE_WRITE_ERROR 0x04u /*!< Multiple write to one flash memory location error flag's mask */ + +/*! Type specifying HW commands for a flash device */ +typedef enum { + LDD_FLASH_READ_1S_BLOCK = 0x00u, /*!< Checks if an entire program flash or data flash logical block has been erased to the specified margin level */ + LDD_FLASH_READ_1S_SECTION = 0x01u, /*!< Checks if a section of program flash or data flash memory is erased to the specified read margin level */ + LDD_FLASH_WRITE_BYTE = 0x04u, /*!< Program byte */ + LDD_FLASH_WRITE_WORD = 0x05u, /*!< Program word */ + LDD_FLASH_WRITE_LONG_WORD = 0x06u, /*!< Program long word */ + LDD_FLASH_WRITE_PHRASE = 0x07u, /*!< Program phrase */ + LDD_FLASH_ERASE_FLASH_BLOCK = 0x08u, /*!< Erase flash memory block */ + LDD_FLASH_ERASE_SECTOR = 0x09u, /*!< Erase sector */ + LDD_FLASH_ERASE_ALL_FLASH_BLOCKS = 0x44u /*!< Erase all flash memory blocks */ +} LDD_FLASH_TCommand; + +/*! Type specifying possible FLASH component operation types */ +typedef enum { + LDD_FLASH_NO_OPERATION, /*!< No operation - initial state */ + LDD_FLASH_READ, /*!< Read operation */ + LDD_FLASH_WRITE, /*!< Write operation */ + LDD_FLASH_ERASE, /*!< Erase operation */ + LDD_FLASH_ERASE_BLOCK, /*!< Erase block operation */ + LDD_FLASH_VERIFY_ERASED_BLOCK /*!< Verify erased block operation */ +} LDD_FLASH_TOperationType; + +/*! Type specifying possible FLASH component operation states */ +typedef enum { + LDD_FLASH_FAILED = 0x00u, /*!< Operation has failed */ + LDD_FLASH_STOP = 0x01u, /*!< The operation has been stopped */ + LDD_FLASH_IDLE = 0x02u, /*!< No operation in progress */ + LDD_FLASH_STOP_REQ = 0x03u, /*!< The operation is in the STOP request mode */ + LDD_FLASH_START = 0x04u, /*!< Start of the operation, no operation steps have been done yet */ + LDD_FLASH_RUNNING = 0x05u /*!< Operation is in progress */ +} LDD_FLASH_TOperationStatus; + +typedef uint8_t LDD_FLASH_TErrorFlags; /*!< Type specifying FLASH component's error flags bit field */ + +typedef uint32_t LDD_FLASH_TAddress; /*!< Type specifying the Address parameter used by the FLASH component's methods */ + +typedef uint32_t LDD_FLASH_TDataSize; /*!< Type specifying the Size parameter used by the FLASH component's methods */ + +typedef uint16_t LDD_FLASH_TErasableUnitSize; /*!< Type specifying the Size output parameter of the GetErasableUnitSize method (pointer to a variable of this type is passed to the method) */ + +/*! Type specifying the FLASH component's rrror status information */ +typedef struct { + LDD_FLASH_TOperationType CurrentOperation; /*!< Current operation */ + LDD_FLASH_TCommand CurrentCommand; /*!< Last flash controller command */ + LDD_FLASH_TErrorFlags CurrentErrorFlags; /*!< Bitfield with error flags. See FLASH2.h for details */ + LDD_FLASH_TAddress CurrentAddress; /*!< Address of the flash memory location the error status is related to */ + LDD_TData *CurrentDataPtr; /*!< Pointer to current input data the error status is related to */ + LDD_FLASH_TDataSize CurrentDataSize; /*!< Size of the current input data to be programmed or erased in bytes */ +} LDD_FLASH_TErrorStatus; + +/* +** =================================================================== +** HSCMP device types and constants +** =================================================================== +*/ + +#define LDD_ANALOGCOMP_ON_COMPARE 0x01u /*!< OnCompare event mask */ + +/* Positive input pin masks */ +#define LDD_ANALOGCOMP_POSITIVE_INPUT_0_MASK 0x01U /*!< Mask for positive input pin 0 */ +#define LDD_ANALOGCOMP_POSITIVE_INPUT_1_MASK 0x02U /*!< Mask for positive input pin 1 */ +#define LDD_ANALOGCOMP_POSITIVE_INPUT_2_MASK 0x04U /*!< Mask for positive input pin 2 */ +#define LDD_ANALOGCOMP_POSITIVE_INPUT_3_MASK 0x08U /*!< Mask for positive input pin 3 */ +#define LDD_ANALOGCOMP_POSITIVE_INPUT_4_MASK 0x10U /*!< Mask for positive input pin 4 */ +#define LDD_ANALOGCOMP_POSITIVE_INPUT_5_MASK 0x20U /*!< Mask for positive input pin 5 */ +#define LDD_ANALOGCOMP_POSITIVE_INPUT_6_MASK 0x40U /*!< Mask for positive input pin 6 */ +#define LDD_ANALOGCOMP_POSITIVE_INPUT_7_MASK 0x80U /*!< Mask for positive input pin 7 */ + +/* Negative input pin masks */ +#define LDD_ANALOGCOMP_NEGATIVE_INPUT_0_MASK 0x0100U /*!< Mask for negative input pin 0 */ +#define LDD_ANALOGCOMP_NEGATIVE_INPUT_1_MASK 0x0200U /*!< Mask for negative input pin 1 */ +#define LDD_ANALOGCOMP_NEGATIVE_INPUT_2_MASK 0x0400U /*!< Mask for negative input pin 2 */ +#define LDD_ANALOGCOMP_NEGATIVE_INPUT_3_MASK 0x0800U /*!< Mask for negative input pin 3 */ +#define LDD_ANALOGCOMP_NEGATIVE_INPUT_4_MASK 0x1000U /*!< Mask for negative input pin 4 */ +#define LDD_ANALOGCOMP_NEGATIVE_INPUT_5_MASK 0x2000U /*!< Mask for negative input pin 5 */ +#define LDD_ANALOGCOMP_NEGATIVE_INPUT_6_MASK 0x4000U /*!< Mask for negative input pin 6 */ +#define LDD_ANALOGCOMP_NEGATIVE_INPUT_7_MASK 0x8000U /*!< Mask for negative input pin 7 */ + +/* Output pin masks */ +#define LDD_ANALOGCOMP_OUTPUT_PIN_MASK 0x00010000U /*!< Mask for output pin */ + +/* Window Sample pin masks */ +#define LDD_ANALOGCOMP_WINDOWSAMPLE_PIN_MASK 0x00020000UL + +/*! Type specifying comparator input number */ +typedef enum { + LDD_ANALOGCOMP_INPUT_0 = 0x00U, /*!< Analog input 0 selected */ + LDD_ANALOGCOMP_INPUT_1 = 0x01U, /*!< Analog input 1 selected */ + LDD_ANALOGCOMP_INPUT_2 = 0x02U, /*!< Analog input 2 selected */ + LDD_ANALOGCOMP_INPUT_3 = 0x03U, /*!< Analog input 3 selected */ + LDD_ANALOGCOMP_INPUT_4 = 0x04U, /*!< Analog input 4 selected */ + LDD_ANALOGCOMP_INPUT_5 = 0x05U, /*!< Analog input 5 selected */ + LDD_ANALOGCOMP_INPUT_6 = 0x06U, /*!< Analog input 6 selected */ + LDD_ANALOGCOMP_INPUT_7 = 0x07U, /*!< Analog input 7 selected */ + LDD_ANALOGCOMP_INPUT_DISABLED = 0x08U /*!< Analog input disabled */ +} LDD_AnalogComp_TComparatorInput; + +/*! Type specifying current comparator output status */ +typedef enum { + LDD_ANALOGCOMP_NO_EDGE = 0x00U, /*!< No edge detected on output */ + LDD_ANALOGCOMP_FALLING_EDGE = 0x02U, /*!< Falling edge detected on output */ + LDD_ANALOGCOMP_RISING_EDGE = 0x04U, /*!< Rising edge detected on output */ + LDD_ANALOGCOMP_BOTH_EDGES = 0x06U /*!< Both edges detected on output */ +} LDD_AnalogComp_TCompareStatus; + +/*! Type specifying requested comparator mode */ +typedef enum { + LDD_ANALOGCOMP_RISING_EDGE_MODE = 0x10U, /*!< Rising edge detection */ + LDD_ANALOGCOMP_FALLING_EDGE_MODE = 0x08U, /*!< Falling edge detection */ + LDD_ANALOGCOMP_BOTH_EDGES_MODE = 0x18U /*!< Both edges detection */ +} LDD_AnalogComp_TComparatorMode; + +typedef uint8_t LDD_AnalogComp_TOutputValue; /*!< Type specifying comparator output value */ + +/* +** =================================================================== +** SDHC component types and constants +** =================================================================== +*/ + +#define LDD_SDHC_CARD_DATA_WIDTH_1_BIT 0x01u /*!< Card supports 1 bit data bus */ +#define LDD_SDHC_CARD_DATA_WIDTH_4_BIT 0x02u /*!< Card supports 4 bit data bus */ +#define LDD_SDHC_CARD_DATA_WIDTH_8_BIT 0x04u /*!< Card supports 8 bit data bus */ +#define LDD_SDHC_CARD_BLOCK_READ 0x01u /*!< Card supports block reading */ +#define LDD_SDHC_CARD_BLOCK_WRITE 0x04u /*!< Card supports block writing */ +#define LDD_SDHC_CARD_ERASE 0x08u /*!< Card supports block erasion */ +#define LDD_SDHC_CARD_WRITE_PROTECTION 0x10u /*!< Card supports write protection */ +#define LDD_SDHC_CARD_IO 0x80u /*!< Card supports IO */ + +#define LDD_SDHC_CLK_PIN 0x01u /*!< SD clock pin mask */ +#define LDD_SDHC_CMD_PIN 0x02u /*!< SD command line pin mask */ +#define LDD_SDHC_DAT0_PIN 0x04u /*!< SD data line 0 pin mask */ +#define LDD_SDHC_DAT1_PIN 0x08u /*!< SD data line 1 pin mask */ +#define LDD_SDHC_DAT2_PIN 0x10u /*!< SD data line 2 pin mask */ +#define LDD_SDHC_DAT3_PIN 0x20u /*!< SD data line 3 pin mask */ +#define LDD_SDHC_DAT4_PIN 0x40u /*!< SD data line 4 pin mask */ +#define LDD_SDHC_DAT5_PIN 0x80u /*!< SD data line 5 pin mask */ +#define LDD_SDHC_DAT6_PIN 0x0100u /*!< SD data line 6 pin mask */ +#define LDD_SDHC_DAT7_PIN 0x0200u /*!< SD data line 7 pin mask */ +#define LDD_SDHC_CD_PIN 0x0400u /*!< SD card detection pin mask */ +#define LDD_SDHC_WP_PIN 0x0800u /*!< SD write protection pin mask */ +#define LDD_SDHC_LCTL_PIN 0x1000u /*!< SD LED control pin mask */ +#define LDD_SDHC_VS_PIN 0x2000u /*!< SD voltage control pin mask */ + +#define LDD_SDHC_ON_CARD_INSERTED 0x01u /*!< OnCardInserted event mask */ +#define LDD_SDHC_ON_CARD_REMOVED 0x02u /*!< OnCardRemoved event mask */ +#define LDD_SDHC_ON_FINISHED 0x04u /*!< OnFinished event mask */ + +/*! Card types */ +typedef enum { + LDD_SDHC_SD, /*!< Secure Digital memory card */ + LDD_SDHC_SDIO, /*!< Secure Digital IO card */ + LDD_SDHC_SDCOMBO, /*!< Combined Secure Digital memory and IO card */ + LDD_SDHC_MMC, /*!< MultiMediaCard memory card */ + LDD_SDHC_CE_ATA /*!< Consumer Electronics ATA card */ +} LDD_SDHC_TCardType; + +/*! Card access properties */ +typedef struct { + uint16_t MaxBlockLength; /*!< Max. transferable block length */ + bool MisalignBlock; /*!< Indicates if the data block can be spread over more than one physical block of the memory device */ + bool PartialBlock; /*!< Indicates whether partial block sizes can be used in block access */ +} LDD_SDHC_TCardAccess; + +/*! Card erasion properties */ +typedef struct { + uint16_t SectorSize; /*!< The size of an erasable unit */ + uint8_t Pattern; /*!< Memory content after erase */ +} LDD_SDHC_TCardErase; + +/*! Card write protection properties */ +typedef struct { + uint16_t GroupSize; /*!< The size of write protected group in number of erase groups */ + bool Permanent; /*!< Indicates whether card is permanently write protected (read-only) */ +} LDD_SDHC_TCardWriteProtect; + +/*! Card capabilities */ +typedef struct { + uint8_t DataWidths; /*!< Bit mask of supported data bus widths */ + uint8_t Operations; /*!< Bit mask of supported operations */ + bool HighSpeed; /*!< Indicates whether the card supports high clock configuration (SD bus clock frequency higher than about 25MHz) */ + bool HighCapacity; /*!< Indicates whether the card requires block addressing instead of byte addressing */ + bool LowVoltage; /*!< Indicates whether the card supports the host's low voltage range */ + LDD_SDHC_TCardAccess Read; /*!< Card data read access capabilities */ + LDD_SDHC_TCardAccess Write; /*!< Card data write access capabilities */ + LDD_SDHC_TCardErase Erase; /*!< Card data erasion capabilities */ + LDD_SDHC_TCardWriteProtect WriteProtect; /*!< Write protection properties */ +} LDD_SDHC_TCardCaps; + +/*! Card features description */ +typedef struct { + LDD_SDHC_TCardType Type; /*!< Card type */ + uint16_t BlockLength; /*!< Physical memory block length */ + uint32_t BlockCount; /*!< Number of physical memory blocks */ + LDD_SDHC_TCardCaps Caps; /*!< Card capabilities */ +} LDD_SDHC_TCardInfo; + +/*! Transfer operations */ +typedef enum { + LDD_SDHC_READ, /*!< Read operation */ + LDD_SDHC_WRITE /*!< Write operation */ +} LDD_SDHC_TTransferOperation; + +/*! Transfer buffer descriptor */ +typedef struct { + uint16_t Size; /*!< Buffer data size */ + uint8_t *DataPtr; /*!< Pointer to buffer data */ +} LDD_SDHC_TBufferDesc; + +/*! Voltage options */ +typedef enum { + LDD_SDHC_LOW_VOLTAGE, /*!< Low voltage */ + LDD_SDHC_HIGH_VOLTAGE /*!< High voltage */ +} LDD_SDHC_TVoltage; + +/*! Write protection types */ +typedef enum { + LDD_SDHC_GROUP, /*!< Write protection by groups */ + LDD_SDHC_CARD /*!< Whole card write protection */ +} LDD_SDHC_TWriteProtectType; + +/*! Component states */ +typedef enum { + LDD_SDHC_DISABLED, /*!< Disabled */ + LDD_SDHC_RESET, /*!< Resetting card */ + LDD_SDHC_IDLE, /*!< Idling */ + LDD_SDHC_VOLTAGE_VALIDATION, /*!< Validating voltage */ + LDD_SDHC_CARD_REGISTRATION, /*!< Registrating card */ + LDD_SDHC_CARD_SELECTION, /*!< Selecting card */ + LDD_SDHC_CARD_INFO_RETRIEVAL, /*!< Retrieving card info */ + LDD_SDHC_TRANSFER, /*!< Transferring data */ + LDD_SDHC_ERASION, /*!< Erasing blocks */ + LDD_SDHC_IO_REG_TRANSFER, /*!< Transferring IO registers */ + LDD_SDHC_DATA_WIDTH_SELECTION, /*!< Selecting data width */ + LDD_SDHC_BUS_CLOCK_SELECTION, /*!< Selecting bus clock */ + LDD_SDHC_WRITE_PROTECTION_SETUP, /*!< Setting up write protection */ + LDD_SDHC_WRITE_PROTECTION_RETRIEVAL /*!< Retrieving write protection configuration */ +} LDD_SDHC_TStatus; + +/*! Operation completion error codes */ +typedef enum { + LDD_SDHC_ERR_OK, /*!< No error */ + LDD_SDHC_ERR_DMA, /*!< DMA or block size error */ + LDD_SDHC_ERR_NOT_SUPPORTED, /*!< Initiated operation is not supported by the card (supported operations are contained in the card information structure) */ + LDD_SDHC_ERR_TIMEOUT, /*!< Command or data timeout */ + LDD_SDHC_ERR_COMMAND_CRC, /*!< Command CRC check failed */ + LDD_SDHC_ERR_DATA_CRC, /*!< Data CRC check failed */ + LDD_SDHC_ERR_ADDRESS_OUT_OF_RANGE, /*!< The card address is beyond the card capacity */ + LDD_SDHC_ERR_ADDRESS_MISALIGN, /*!< The card address does not align with physical blocks of the card */ + LDD_SDHC_ERR_BLOCK_LEN_ERROR, /*!< Block length exceeds the maximum value for the card */ + LDD_SDHC_ERR_WP_VIOLATION, /*!< Attempt to program a write protected block */ + LDD_SDHC_ERR_CARD_IS_LOCKED, /*!< The card is locked by the host */ + LDD_SDHC_ERR_WP_ERASE_SKIP, /*!< Only partial address space was erased due to existing write protected blocks */ + LDD_SDHC_ERR_INTERNAL_FAILURE, /*!< Internal component error */ + LDD_SDHC_ERR_CARD_FAILURE /*!< The card was unable to complete the operation */ +} LDD_SDHC_TError; + +/* +** =================================================================== +** DMA device types and constants +** =================================================================== +*/ + +#define LDD_DMA_ON_COMPLETE 0x01U /*!< OnTransferComplete event mask. */ +#define LDD_DMA_ON_ERROR 0x02U /*!< OnError event mask. */ + +#define LDD_DMA_UNKNOWN_ERROR 0x80000000U /*!< Unknown error. */ +#define LDD_DMA_CHANNEL_PRIORITY_ERROR 0x4000U /*!< Channel priority error. */ +#define LDD_DMA_SOURCE_ADDRESS_ERROR 0x80U /*!< Address inconsistency with transfer size error. */ +#define LDD_DMA_SOURCE_OFFSET_ERROR 0x40U /*!< Offset inconsistency with transfer size error. */ +#define LDD_DMA_DESTINATION_ADDRESS_ERROR 0x20U /*!< Address inconsistency with transfer size error. */ +#define LDD_DMA_DESTINATION_OFFSET_ERROR 0x10U /*!< Offset inconsistency with transfer size error. */ +#define LDD_DMA_COUNT_ERROR 0x08U /*!< Byte count inconsistency with transfer sizes or transfer count error. */ +#define LDD_DMA_SCATTER_GATHER_ERROR 0x04U /*!< Scatter/gather configuration error. */ +#define LDD_DMA_SOURCE_BUS_ERROR 0x02U /*!< Bus error on a source read. */ +#define LDD_DMA_DESTINATION_BUS_ERROR 0x01U /*!< Bus error on a destination write. */ + +#define LDD_DMA_CHANNEL_0_MASK 0x01UL /*!< DMA channel 0 mask. */ +#define LDD_DMA_CHANNEL_1_MASK 0x02UL /*!< DMA channel 1 mask. */ +#define LDD_DMA_CHANNEL_2_MASK 0x04UL /*!< DMA channel 2 mask. */ +#define LDD_DMA_CHANNEL_3_MASK 0x08UL /*!< DMA channel 3 mask. */ +#define LDD_DMA_CHANNEL_4_MASK 0x10UL /*!< DMA channel 4 mask. */ +#define LDD_DMA_CHANNEL_5_MASK 0x20UL /*!< DMA channel 5 mask. */ +#define LDD_DMA_CHANNEL_6_MASK 0x40UL /*!< DMA channel 6 mask. */ +#define LDD_DMA_CHANNEL_7_MASK 0x80UL /*!< DMA channel 7 mask. */ +#define LDD_DMA_CHANNEL_8_MASK 0x0100UL /*!< DMA channel 8 mask. */ +#define LDD_DMA_CHANNEL_9_MASK 0x0200UL /*!< DMA channel 9 mask. */ +#define LDD_DMA_CHANNEL_10_MASK 0x0400UL /*!< DMA channel 10 mask. */ +#define LDD_DMA_CHANNEL_11_MASK 0x0800UL /*!< DMA channel 11 mask. */ +#define LDD_DMA_CHANNEL_12_MASK 0x1000UL /*!< DMA channel 12 mask. */ +#define LDD_DMA_CHANNEL_13_MASK 0x2000UL /*!< DMA channel 13 mask. */ +#define LDD_DMA_CHANNEL_14_MASK 0x4000UL /*!< DMA channel 14 mask. */ +#define LDD_DMA_CHANNEL_15_MASK 0x8000UL /*!< DMA channel 15 mask. */ +#define LDD_DMA_CHANNEL_16_MASK 0x00010000UL /*!< DMA channel 16 mask. */ +#define LDD_DMA_CHANNEL_17_MASK 0x00020000UL /*!< DMA channel 17 mask. */ +#define LDD_DMA_CHANNEL_18_MASK 0x00040000UL /*!< DMA channel 18 mask. */ +#define LDD_DMA_CHANNEL_19_MASK 0x00080000UL /*!< DMA channel 19 mask. */ +#define LDD_DMA_CHANNEL_20_MASK 0x00100000UL /*!< DMA channel 21 mask. */ +#define LDD_DMA_CHANNEL_21_MASK 0x00200000UL /*!< DMA channel 22 mask. */ +#define LDD_DMA_CHANNEL_22_MASK 0x00400000UL /*!< DMA channel 23 mask. */ +#define LDD_DMA_CHANNEL_23_MASK 0x00800000UL /*!< DMA channel 24 mask. */ +#define LDD_DMA_CHANNEL_24_MASK 0x01000000UL /*!< DMA channel 25 mask. */ +#define LDD_DMA_CHANNEL_25_MASK 0x02000000UL /*!< DMA channel 26 mask. */ +#define LDD_DMA_CHANNEL_26_MASK 0x04000000UL /*!< DMA channel 27 mask. */ +#define LDD_DMA_CHANNEL_27_MASK 0x08000000UL /*!< DMA channel 28 mask. */ +#define LDD_DMA_CHANNEL_28_MASK 0x10000000UL /*!< DMA channel 29 mask. */ +#define LDD_DMA_CHANNEL_29_MASK 0x20000000UL /*!< DMA channel 30 mask. */ +#define LDD_DMA_CHANNEL_30_MASK 0x40000000UL /*!< DMA channel 31 mask. */ +#define LDD_DMA_CHANNEL_31_MASK 0x80000000UL /*!< DMA channel 32 mask. */ + +/* Action executed after request and transfer service completes */ +#define LDD_DMA_NO_ACTION 0x00U /*!< No action performed after request serviced. */ +#define LDD_DMA_DESTINATION_ADDRESS_ADJUSTMENT 0x01U /*!< Destination address adjustment after request serviced. */ +#define LDD_DMA_SOURCE_ADDRESS_ADJUSTMENT 0x02U /*!< Source address adjustment after request serviced. */ +#define LDD_DMA_ADDRESS_ADJUSTMENT 0x01U /*!< Address adjustment after transfer completed. */ +#define LDD_DMA_SCATTER_GATHER 0x02U /*!< Scatter/gather performed after transfer completed. */ + +typedef void LDD_DMA_TData; +typedef uint8_t LDD_DMA_TTransactionSize; /* Type specifying the transfer size parameter used by the DMA component's methods. See the DMA_PDD header file for detail description of allowed values. */ +typedef uint32_t LDD_DMA_TTransactionCount; +typedef uint32_t LDD_DMA_TRequestCount; +typedef uint32_t LDD_DMA_TTransferDataSize; + +typedef uint32_t LDD_DMA_TAddress; /*!< Type specifying the address parameter used by the DMA component's methods. */ +typedef int32_t LDD_DMA_TAddressOffset; /*!< Type specifying the address signed offset parameter used by the DMA component's methods. */ +typedef uint32_t LDD_DMA_TByteCount; /*!< Type specifying the byte count/minor loop count parameter used by the DMA component's methods. */ +typedef uint8_t LDD_DMA_TTransferSize; /*!< Type specifying the transfer size parameter used by the DMA component's methods. See the DMA_PDD header file for detail description of allowed values. */ +typedef uint8_t LDD_DMA_TModuloSize; /*!< Type specifying the modulo size parameter used by the DMA component's methods. */ + /*!< This value power of two represents size of used circular buffer (0U - buffer disabled). See the MCU manual for detail description of allowed values. */ +typedef uint8_t LDD_DMA_TTriggerSource; /*!< Type specifying the trigger source signal number. See the MCU manual for detail description of allowed values. */ +typedef uint8_t LDD_DMA_TChannelNumber; /*!< Type specifying the DMA channel number. See the MCU manual for detail description of allowed values. */ +typedef uint8_t LDD_DMA_TRecordNumber; /*!< Type specifying the DMA descriptor record number. */ +typedef uint32_t LDD_DMA_TChannelMask; /*!< Type specifying the DMA channel mask. For possible values see channel mask constants. */ +typedef uint8_t LDD_DMA_TChannelPriority; /*!< Type specifying the DMA channel priority number. See the MCU manual for detail description of allowed values. */ +typedef uint16_t LDD_DMA_TOuterLoopCount; /*!< Type specifying the transfer outer/major loop count. */ +typedef uint8_t LDD_DMA_TAfterRequest; /*!< Type specifying the operation executed after request service is completed. */ +typedef uint8_t LDD_DMA_TAfterTransfer; /*!< Type specifying the operation executed after transfer service is completed. */ +typedef uint8_t LDD_DMA_TBandwidthControl; /*!< Type specifying the bandwidth control. See the DMA_PDD header file for detail description of allowed values. */ +typedef uint32_t LDD_DMA_TErrorFlags; /*!< DMA controller error flags. See the DMA_LDD component's header file for detail description of allowed values. */ + +/*! Type specifying a DMA channel status. */ +typedef enum { + LDD_DMA_IDLE, /*!< Channel is idle, no request is serviced nor transfer completed. */ + LDD_DMA_BUSY, /*!< Channel is active, request is serviced. */ + LDD_DMA_DONE, /*!< Transfer is completed, waiting to start of next transfer. */ + LDD_DMA_ERROR /*!< Error detected. */ +} LDD_DMA_TChannelStatus; + +/*! Type specifying a DMA transfer state. */ +typedef enum { + LDD_DMA_TRANSFER_IDLE, /*!< Channel is idle, no request is serviced nor transfer completed. */ + LDD_DMA_TRANSFER_BUSY, /*!< Channel is active, request is serviced. */ + LDD_DMA_TRANSFER_ERROR /*!< Error detected. */ +} LDD_DMA_TTransferState; + +/*! Type specifying the DMA transfer mode. */ +typedef enum { + LDD_DMA_CYCLE_STEAL_TRANSFERS, /*!< Only single read/write transfer is done per one service request. */ + LDD_DMA_SINGLE_TRANSFER, /*!< Transfer of all bytes defined by Data size is done after single service request. */ + LDD_DMA_NESTED_TRANSFERS /*!< Sequence of transfers triggered by service requests. One request transfers number of bytes defined by Byte count value. */ +} LDD_DMA_TTransferMode; + +/*! Type specifying the DMA trigger source type. */ +typedef enum { + LDD_DMA_SW_TRIGGER, /*!< Explicit software trigger. */ + LDD_DMA_HW_TRIGGER, /*!< Peripheral device trigger. */ + LDD_DMA_ALWAYS_ENABLED_TRIGGER /*!< Always enabled trigger. */ +} LDD_DMA_TTriggerType; + +/*! Type specifying the DMA error information structure. */ +typedef struct { + LDD_DMA_TChannelNumber ChannelNumber; /*!< Last error recorded channel number. */ + LDD_DMA_TErrorFlags ErrorFlags; /*!< Channel error flags. */ +} LDD_DMA_TError; + +/*! Type specifying the DMA Transfer descriptor information structure. */ +typedef struct { + LDD_TUserData *UserDataPtr; /*!< User device data structure pointer to be returned by the DMA_LDD component's ISR to the dynamic callback of this transfer descriptor. */ + LDD_DMA_TAddress SourceAddress; /*!< Address of a DMA transfer source data. */ + LDD_DMA_TAddressOffset SourceAddressOffset; /*!< Offset to be added to the source address after each elemental read operation. */ + LDD_DMA_TTransferSize SourceTransferSize; /*!< Source data transfer size (size of a elemental read operation). See the DMA_PDD header file for detail description of allowed values. */ + LDD_DMA_TModuloSize SourceModuloSize; /*!< Source address modulo size. For the description of allowed values see the LDD_DMA_TModuloSize type declaration. */ + LDD_DMA_TAddress DestinationAddress; /*!< Address of a DMA transfer destination. */ + LDD_DMA_TAddressOffset DestinationAddressOffset; /*!< Offset to be added to the destination address after each elemental write operation. */ + LDD_DMA_TTransferSize DestinationTransferSize; /*!< Destination data transfer size (size of a elemental write operation). See the DMA_PDD header file for detail description of allowed values. */ + LDD_DMA_TModuloSize DestinationModuloSize; /*!< Destination address modulo size. For the description of allowed values see the LDD_DMA_TModuloSize type declaration. */ + LDD_DMA_TTransferMode TransferMode; /*!< Selects DMA transfer mode. For the description of allowed values see the LDD_DMA_TTransferMode type declaration. */ + LDD_DMA_TByteCount ByteCount; /*!< Size of data in bytes to be transferred in single transfer. */ + LDD_DMA_TOuterLoopCount OuterLoopCount; /*!< Number of the outer loop iteration in the Nested operation mode, otherwise should have value of one. */ + bool InnerLoopChannelLink; /*!< TRUE - Inner loop channel linking enabled (if the nested operation is used, then this item enables the minor (inner) loop channel linking). */ + LDD_DMA_TChannelNumber InnerLoopLinkedChannel; /*!< Linked DMA channel number (used only if the InnerLoopChannelLink item is set TRUE) */ + bool OuterLoopChannelLink; /*!< TRUE - Outer (major) loop channel linking is enabled. Enables channel linking after transfer completes. */ + LDD_DMA_TChannelNumber OuterLoopLinkedChannel; /*!< Outer (major) loop linked DMA channel number (used only if the OuterLoopChannelLink item is set TRUE). */ + LDD_DMA_TAfterRequest AfterRequestComplete; /*!< Type of an action after the elemental read/write operation is done. For the description of allowed values see the LDD_DMA_TAfterRequest type declaration. */ + LDD_DMA_TAddressOffset AddressOffset; /*!< Address offset value. Address specified in AfterRequestComplete item is adjusted by stored value. See the LDD_DMA_TAfterRequest type declaration. */ + LDD_DMA_TAfterTransfer AfterTransferComplete; /*!< Type of an action executed after the last transfer operation is done. For the description of allowed values see the LDD_DMA_TAfterTransfer type declaration. */ + LDD_DMA_TAddressOffset SourceAddressAdjustment; /*!< Source address adjustment value. Used only if the AfterTransferComplete item is set to LDD_DMA_ADDRESS_ADJUSTMENT. */ + LDD_DMA_TAddressOffset DestinationAddressAdjustment; /*!< Destination address adjustment value. Used only if the AfterTransferComplete item is set to LDD_DMA_ADDRESS_ADJUSTMENT. */ + LDD_DMA_TAddress ScatterGatherAddress; /*!< Scatter / gather address. Used only if the AfterTransferComplete item is set to LDD_DMA_SCATTER_GATHER. */ + LDD_DMA_TBandwidthControl BandwidthControl; /*!< DMA channel bandwidth control. See the DMA_PDD header file for detail description of allowed values. */ + bool ChannelAutoSelection; /*!< TRUE - DMA channel autoselection engine is used. FALSE - DMA fixed channel is used. */ + LDD_DMA_TChannelNumber ChannelNumber; /*!< If ChannelAutoSelection is FALSE this item contains fixed channel number. If ChannelAutoSelection is TRUE then after allocation this item is filled by autoselected channel number. */ + LDD_DMA_TTriggerType TriggerType; /*!< DMA transfer trigger type. For the description of allowed values see the LDD_DMA_TBTriggerType declaration. */ + LDD_DMA_TTriggerSource TriggerSource; /*!< Trigger source number. For the description of allowed values see the LDD_DMA_TBTriggerType declaration. */ + bool PeriodicTrigger; /*!< TRUE - periodic trigger is required, FALSE - periodic trigger is not required. */ + bool DisableAfterRequest; /*!< TRUE - DMA transfer request is automatically disabled after transfer complete. */ + bool Interrupts; /*!< TRUE - interrupts are requested. */ + bool OnComplete; /*!< TRUE - event is enabled during initialization. */ + bool OnHalfComplete; /*!< TRUE - event is enabled during initialization. */ + bool OnError; /*!< TRUE - event is enabled during initialization. */ + void (*OnCompleteEventPtr)(LDD_TUserData* UserDataPtr); /*!< Pointer to the OnComplete event, NULL if event is not used. */ + void (*OnErrorEventPtr)(LDD_TUserData* UserDataPtr); /*!< Pointer to the OnError event, NULL if event is not used. */ + bool ChannelEnabled; /*!< TRUE - DMA channel is allocated and used by DMATransfer component. */ + bool DmaMux0; /*!< TRUE - DMA channel can be connected to DMA MUX0 */ + bool DmaMux1; /*!< TRUE - DMA channel can be connected to DMA MUX1 */ + LDD_DMA_TTriggerSource TriggerSourceMux1; /*!< Trigger source number used when channel connected to DMAMUX1. For the description of allowed values see the LDD_DMA_TBTriggerType declaration. */ +} LDD_DMA_TTransferDescriptor; + +typedef LDD_DMA_TTransferDescriptor *LDD_DMA_TTransferDescriptorPtr; /*!< Type specifying address of the DMA Transfer descriptor structure. */ + +/* +** =================================================================== +** SPI device types and constants - SPIMaster_LDD +** =================================================================== +*/ + +#define LDD_SPIMASTER_INPUT_PIN 0x01U /*!< Input pin mask */ +#define LDD_SPIMASTER_OUTPUT_PIN 0x02U /*!< Output pin mask */ +#define LDD_SPIMASTER_CLK_PIN 0x04U /*!< Clock pin mask */ +#define LDD_SPIMASTER_CS_0_PIN 0x08U /*!< Chip select 0 pin mask */ +#define LDD_SPIMASTER_CS_1_PIN 0x10U /*!< Chip select 1 pin mask */ +#define LDD_SPIMASTER_CS_2_PIN 0x20U /*!< Chip select 2 pin mask */ +#define LDD_SPIMASTER_CS_3_PIN 0x40U /*!< Chip select 3 pin mask */ +#define LDD_SPIMASTER_CS_4_PIN 0x80U /*!< Chip select 4 pin mask */ +#define LDD_SPIMASTER_CS_5_PIN 0x0100U /*!< Chip select 5 pin mask */ +#define LDD_SPIMASTER_CS_6_PIN 0x0200U /*!< Chip select 6 pin mask */ +#define LDD_SPIMASTER_CS_7_PIN 0x0400U /*!< Chip select 7 pin mask */ +#define LDD_SPIMASTER_CSS_PIN 0x0800U /*!< Chip select strobe pin mask */ + +#define LDD_SPIMASTER_ON_BLOCK_RECEIVED 0x01U /*!< OnBlockReceived event mask */ +#define LDD_SPIMASTER_ON_BLOCK_SENT 0x02U /*!< OnBlockSent event mask */ +#define LDD_SPIMASTER_ON_ERROR 0x04U /*!< OnError event mask */ + +#define LDD_SPIMASTER_RX_OVERFLOW 0x01U /*!< Receiver overflow */ +#define LDD_SPIMASTER_PARITY_ERROR 0x02U /*!< Parity error */ +#define LDD_SPIMASTER_RX_DMA_ERROR 0x04U /*!< Receive DMA channel error */ +#define LDD_SPIMASTER_TX_DMA_ERROR 0x08U /*!< Transmit DMA channel error */ + +typedef uint32_t LDD_SPIMASTER_TError; /*!< Communication error type */ + +/*! Communication statistics */ +typedef struct { + uint32_t RxChars; /*!< Number of received characters */ + uint32_t TxChars; /*!< Number of transmitted characters */ + uint32_t RxParityErrors; /*!< Number of receiver parity errors, which have occured */ + uint32_t RxOverruns; /*!< Number of receiver overruns, which have occured */ +} LDD_SPIMASTER_TStats; + +/* +** =================================================================== +** SPI device types and constants - SPISlave_LDD +** =================================================================== +*/ + +#define LDD_SPISLAVE_INPUT_PIN 0x01U /*!< Input pin mask */ +#define LDD_SPISLAVE_OUTPUT_PIN 0x02U /*!< Output pin mask */ +#define LDD_SPISLAVE_CLK_PIN 0x04U /*!< Clock pin mask */ +#define LDD_SPISLAVE_SS_PIN 0x08U /*!< Slave select pin mask */ + +#define LDD_SPISLAVE_ON_BLOCK_RECEIVED 0x01U /*!< OnBlockReceived event mask */ +#define LDD_SPISLAVE_ON_BLOCK_SENT 0x02U /*!< OnBlockSent event mask */ +#define LDD_SPISLAVE_ON_ERROR 0x04U /*!< OnError event mask */ + +#define LDD_SPISLAVE_RX_OVERFLOW 0x01U /*!< Receiver overflow */ +#define LDD_SPISLAVE_TX_UNDERFLOW 0x02U /*!< Transmitter underflow */ +#define LDD_SPISLAVE_PARITY_ERROR 0x04U /*!< Parity error */ +#define LDD_SPISLAVE_RX_DMA_ERROR 0x08U /*!< Receive DMA channel error */ +#define LDD_SPISLAVE_TX_DMA_ERROR 0x10U /*!< Transmit DMA channel error */ + +typedef uint32_t LDD_SPISLAVE_TError; /*!< Communication error type */ + +/*! Communication statistics */ +typedef struct { + uint32_t RxChars; /*!< Number of received characters */ + uint32_t TxChars; /*!< Number of transmitted characters */ + uint32_t RxParityErrors; /*!< Number of receiver parity errors, which have occured */ + uint32_t RxOverruns; /*!< Number of receiver overruns, which have occured */ + uint32_t TxUnderruns; /*!< Number of transmitter underruns, which have occured */ +} LDD_SPISLAVE_TStats; + +/* +** =================================================================== +** I2S device types and constants +** =================================================================== +*/ + +#define LDD_SSI_INPUT_PIN 0x01U /*!< Input pin mask */ +#define LDD_SSI_OUTPUT_PIN 0x02U /*!< Output pin mask */ +#define LDD_SSI_RX_CLK_PIN 0x04U /*!< Rx clock pin mask */ +#define LDD_SSI_TX_CLK_PIN 0x08U /*!< Tx clock pin mask */ +#define LDD_SSI_RX_FS_PIN 0x10U /*!< Rx frame sync pin mask */ +#define LDD_SSI_TX_FS_PIN 0x20U /*!< Tx frame sync pin mask */ +#define LDD_SSI_MCLK_PIN 0x40U /*!< Master clock pin mask */ +#define LDD_SSI_INPUT_PIN_CHANNEL_0 0x80U /*!< Input pin mask for data channel 0 */ +#define LDD_SSI_INPUT_PIN_CHANNEL_1 0x0100U /*!< Input pin mask for data channel 1 */ +#define LDD_SSI_OUTPUT_PIN_CHANNEL_0 0x0200U /*!< Output pin mask for data channel 0 */ +#define LDD_SSI_OUTPUT_PIN_CHANNEL_1 0x0400U /*!< Output pin mask for data channel 1 */ + +#define LDD_SSI_ON_BLOCK_RECEIVED 0x01u /*!< OnBlockReceived event mask */ +#define LDD_SSI_ON_BLOCK_SENT 0x02u /*!< OnBlockSent event mask */ +#define LDD_SSI_ON_ERROR 0x04u /*!< OnError event mask */ +#define LDD_SSI_ON_BLOCK_RECEIVED_1 0x08u /*!< OnBlockReceived event mask for second channel */ +#define LDD_SSI_ON_BLOCK_SENT_1 0x10u /*!< OnBlockSent event mask for second channel */ +#define LDD_SSI_ON_RECEIVE_FRAME_SYNC 0x20u /*!< OnReceiveFrameSync event mask for second channel */ +#define LDD_SSI_ON_TRANSMIT_FRAME_SYNC 0x40u /*!< OnTransmitFrameSync event mask for second channel */ +#define LDD_SSI_ON_RECEIVE_LAST_SLOT 0x80u /*!< OnReceiveLastSlot event mask for second channel */ +#define LDD_SSI_ON_TRANSMIT_LAST_SLOT 0x0100u /*!< OnTransmitLastSlot event mask for second channel */ +#define LDD_SSI_ON_RECEIVE_COMPLETE 0x0200u /*!< OnReceiveComplete event mask for second channel */ +#define LDD_SSI_ON_TRANSMIT_COMPLETE 0x0400u /*!< OnTransmitComplete event mask for second channel */ +#define LDD_SSI_ON_A_C_9_7_TAG_UPDATED 0x0800u /*!< OnAC97TagUpdated event mask for second channel */ +#define LDD_SSI_ON_AC_97_TAG_UPDATED 0x0800u /*!< OnAC97TagUpdated event mask for second channel */ +#define LDD_SSI_ON_A_C_9_7_COMMAND_ADDRESS_UPDATED 0x1000u /*!< OnAC97CommandAddressUpdated event mask for second channel */ +#define LDD_SSI_ON_AC_97_COMMAND_ADDRESS_UPDATED 0x1000u /*!< OnAC97CommandAddressUpdated event mask for second channel */ +#define LDD_SSI_ON_A_C_9_7_COMMAND_DATA_UPDATED 0x2000u /*!< OnAC97CommandDataUpdated event mask for second channel */ +#define LDD_SSI_ON_AC_97_COMMAND_DATA_UPDATED 0x2000u /*!< OnAC97CommandDataUpdated event mask for second channel */ + +#define LDD_SSI_RECEIVER 0x01U /*!< Receive section of the device. */ +#define LDD_SSI_TRANSMITTER 0x02U /*!< Transmit section of the device. */ + +#define LDD_SSI_RX_OVERFLOW 0x01U /*!< Receiver overflow */ +#define LDD_SSI_RX_OVERFLOW_1 0x02U /*!< Receiver overflow 1 */ +#define LDD_SSI_RX_SYNC_ERROR 0x04U /*!< Receiver frame sync error */ +#define LDD_SSI_RX_DMA_ERROR 0x08U /*!< Receiver DMA error */ + +#define LDD_SSI_TX_UNDERFLOW 0x10U /*!< Transmitter underflow */ +#define LDD_SSI_TX_UNDERFLOW_1 0x20U /*!< Transmitter underflow 1 */ +#define LDD_SSI_TX_SYNC_ERROR 0x40U /*!< Transmitter frame sync error */ +#define LDD_SSI_TX_DMA_ERROR 0x80U /*!< Transmitter DMA error */ + +#define LDD_SSI_RX_FRAME_COMPLETE 0x01U /*!< Receive frame is finished after disabling transfer */ +#define LDD_SSI_TX_FRAME_COMPLETE 0x02U /*!< Transmit frame is finished after disabling transfer */ +#define LDD_SSI_RX_FRAME_SYNC 0x04U /*!< Receiver frame sync */ +#define LDD_SSI_TX_FRAME_SYNC 0x08U /*!< Transmit frame sync */ +#define LDD_SSI_RX_LAST_SLOT 0x10U /*!< Receive last time slot */ +#define LDD_SSI_TX_LAST_SLOT 0x20U /*!< Transmit last time slot */ +#define LDD_SSI_AC97_TAG 0x40U /*!< AC97 tag updated */ +#define LDD_SSI_AC97_COMMAND_ADDRESS 0x80U /*!< AC97 command address updated */ +#define LDD_SSI_AC97_COMMAND_DATA 0x0100U /*!< AC97 command data updated */ + +typedef uint8_t LDD_SSI_TSectionMask; /*!< Device section type */ + +typedef uint32_t LDD_SSI_TError; /*!< Communication error type */ + +typedef uint32_t LDD_SSI_TComStatus; /*!< Communication status type */ + +/*! Group of pointers to data blocks. */ +typedef struct { + LDD_TData *Channel0Ptr; /*!< Pointer to data block to send/received via data channel 0 */ + LDD_TData *Channel1Ptr; /*!< Pointer to data block to send/received via data channel 1 */ +} LDD_SSI_TDataBlocks; + +/*! Command type */ +typedef enum { + LDD_SSI_READ_COMMAND = 0x08u, + LDD_SSI_WRITE_COMMAND = 0x10u +} LDD_SSI_TAC97CommandType; + +/*! AC97 command */ +typedef struct { + LDD_SSI_TAC97CommandType Type; /*!< Command type */ + uint32_t Address; /*!< Command address */ + uint32_t Data; /*!< Command data */ +} LDD_SSI_TAC97Command; + +/*! Communication statistics */ +typedef struct { + uint32_t RxChars; /*!< Number of received characters */ + uint32_t TxChars; /*!< Number of transmitted characters */ + uint32_t RxOverruns; /*!< Number of receiver overruns, which have occured */ + uint32_t TxUnderruns; /*!< Number of transmitter underruns, which have occured */ + uint32_t RxChars1; /*!< Number of received characters for second channel */ + uint32_t TxChars1; /*!< Number of transmitted characters for second channel */ + uint32_t RxOverruns1; /*!< Number of receiver overruns, which have occured for second channel */ + uint32_t TxUnderruns1; /*!< Number of transmitter underruns, which have occured for second channel */ +} LDD_SSI_TStats; + +/* +** =================================================================== +** RTC device types and constants +** =================================================================== +*/ + +#define LDD_RTC_ON_SECOND 0x10u /*!< OnSecond event mask */ +#define LDD_RTC_ON_MONOTONIC_OVERFLOW 0x08u /*!< OnMonotonicCounter event mask */ +#define LDD_RTC_ON_ALARM 0x04u /*!< OnAlarm event mask */ +#define LDD_RTC_ON_TIME_OVERFLOW 0x02u /*!< OnTimeOverflow event mask */ +#define LDD_RTC_ON_TIME_INVALID 0x01u /*!< OnTimeInvalid event mask */ +#define LDD_RTC_ON_STOPWATCH 0x0100u /*!< OnStopwatch event mask */ + +/*! Structure used for time operation */ +typedef struct { + uint32_t Second; /*!< seconds (0 - 59) */ + uint32_t Minute; /*!< minutes (0 - 59) */ + uint32_t Hour; /*!< hours (0 - 23) */ + uint32_t DayOfWeek; /*!< day of week (0-Sunday, .. 6-Saturday) */ + uint32_t Day; /*!< day (1 - 31) */ + uint32_t Month; /*!< month (1 - 12) */ + uint32_t Year; /*!< year */ +} LDD_RTC_TTime; + + + +/* +** =================================================================== +** CRC device types and constants +** =================================================================== +*/ + +#define LDD_CRC_16_SEED_LOW 0x00U /*!< CRC 16bit seed low */ +#define LDD_CRC_16_POLY_LOW 0x8005U /*!< CRC 16bit poly low */ +#define LDD_CRC_32_SEED_LOW 0xFFFFU /*!< CRC 32bit seed low */ +#define LDD_CRC_32_SEED_HIGH 0xFFFFU /*!< CRC 32bit seed high */ +#define LDD_CRC_32_POLY_LOW 0x1DB7U /*!< CRC 32bit poly low */ +#define LDD_CRC_32_POLY_HIGH 0x04C1U /*!< CRC 32bit poly high */ +#define LDD_CRC_CCITT_SEED_LOW 0xFFFFU /*!< CRC CCITT seed low */ +#define LDD_CRC_CCITT_POLY_LOW 0x1021U /*!< CRC CCITT poly low */ +#define LDD_CRC_MODBUS_16_SEED_LOW 0xFFFFU /*!< CRC MODBUS16 seed low */ +#define LDD_CRC_MODBUS_16_POLY_LOW 0x8005U /*!< CRC MODBUS16 poly low */ +#define LDD_CRC_KERMIT_SEED_LOW 0x00U /*!< CRC KERMIT seed low */ +#define LDD_CRC_KERMIT_POLY_LOW 0x1021U /*!< CRC KERMIT poly low */ +#define LDD_CRC_DNP_SEED_LOW 0x00U /*!< CRC DNP seed low */ +#define LDD_CRC_DNP_POLY_LOW 0x3D65U /*!< CRC DNP poly low */ + +/*! Transpose type */ +typedef enum { + LDD_CRC_NO_TRANSPOSE = 0, /*!< No transposition */ + LDD_CRC_BITS = 1, /*!< Bits are transposed */ + LDD_CRC_BITS_AND_BYTES = 2, /*!< Bits and bytes are transposed */ + LDD_CRC_BYTES = 3 /*!< Bytes are transposed */ +} LDD_CRC_TTransposeType; + +/*! CRC standard */ +typedef enum { + LDD_CRC_16, /*!< CRC16 standard */ + LDD_CRC_CCITT, /*!< CCITT standard */ + LDD_CRC_MODBUS_16, /*!< MODBUS16 standard */ + LDD_CRC_KERMIT, /*!< KERMIT standard */ + LDD_CRC_DNP, /*!< DNP standard */ + LDD_CRC_32, /*!< CRC32 standard */ + LDD_CRC_USER /*!< User defined type */ +} LDD_CRC_TCRCStandard; + +/*! User CRC standard */ +typedef struct { + bool Width32bit; /*!< 32bit CRC? */ + bool ResultXORed; /*!< Result XORed? */ + uint16_t SeedLow; /*!< Seed low value */ + uint16_t SeedHigh; /*!< Seed high value */ + uint16_t PolyLow; /*!< Poly low value */ + uint16_t PolyHigh; /*!< Poly high value */ + LDD_CRC_TTransposeType InputTransposeMode; /*!< Input transpose type */ + LDD_CRC_TTransposeType OutputTransposeMode; /*!< Output transpose type */ +} LDD_CRC_TUserCRCStandard; + +/* +** =================================================================== +** RNG device types and constants +** =================================================================== +*/ + + +#define LDD_RNG_LFSR_ERROR 0x01U /*!< Linear feedback shift register error */ +#define LDD_RNG_OSCILLATOR_ERROR 0x02U /*!< Oscillator error */ +#define LDD_RNG_SELF_TEST_ERROR 0x04U /*!< Self test error */ +#define LDD_RNG_STATISTICAL_ERROR 0x08U /*!< LStatistical test error */ +#define LDD_RNG_FIFO_UNDERFLOW_ERROR 0x10U /*!< FIFO underflow error */ + +#define LDD_RNG_SELF_TETS_RESEED_ERROR 0x00200000U /*!< Reseed self test fail */ +#define LDD_RNG_SELF_TEST_PRNG_ERROR 0x00400000U /*!< PRNG self test fail */ +#define LDD_RNG_SELF_TEST_TRNG_ERROR 0x00800000U /*!< TRNG self test fail */ +#define LDD_RNG_MONOBIT_TEST_ERROR 0x01000000U /*!< Monobit test fail */ +#define LDD_RNG_LENGTH_1_RUN_TEST_ERROR 0x02000000U /*!< Length 1 run test fail */ +#define LDD_RNG_LENGTH_2_RUN_TEST_ERROR 0x04000000U /*!< Length 2 run test fail */ +#define LDD_RNG_LENGTH_3_RUN_TEST_ERROR 0x08000000U /*!< Length 3 run test fail */ +#define LDD_RNG_LENGTH_4_RUN_TEST_ERROR 0x10000000U /*!< Length 4 run test fail */ +#define LDD_RNG_LENGTH_5_RUN_TEST_ERROR 0x20000000U /*!< Length 5 run test fail */ +#define LDD_RNG_LENGTH_6_RUN_TEST_ERROR 0x40000000U /*!< Length 6 run test fail */ +#define LDD_RNG_LONG_RUN_TEST_ERROR 0x80000000U /*!< Long run test fail */ + +#define LDD_RNG_ON_SEED_GENERATION_DONE 0x01U /*!< OnSeedGenerationDone event mask */ +#define LDD_RNG_ON_SELF_TEST_DONE 0x02U /*!< OnSelfTestDone event mask */ +#define LDD_RNG_ON_ERROR_LFSR 0x04U /*!< OnErrorLFSR event mask */ +#define LDD_RNG_ON_OSC_ERROR 0x08U /*!< OnOscError event mask */ +#define LDD_RNG_ON_SELF_TEST_ERROR 0x10U /*!< OnSelfTestError event mask */ +#define LDD_RNG_ON_STATISTICAL_ERROR 0x20U /*!< OnStatisticalError event mask */ +#define LDD_RNG_ON_FIFO_UNDER_FLOW_ERROR 0x40U /*!< OnFIFOUnderFlowError event mask */ +#define LDD_RNG_ON_FIFOUNDER_FLOW_ERROR 0x40U /*!< OnFIFOUnderFlowError event mask */ + +#define LDD_RNG_STATUS_ERROR 0xFFFFU /*!< Error in RNG module flag */ +#define LDD_RNG_STATUS_NEW_SEED_DONE 0x40U /*!< New seed done flag */ +#define LDD_RNG_STATUS_SEED_DONE 0x20U /*!< Seed done flag */ +#define LDD_RNG_STATUS_SELF_TEST_DONE 0x10U /*!< Self test done flag */ +#define LDD_RNG_STATUS_RESEED_NEEDED 0x08U /*!< Reseed needed flag */ +#define LDD_RNG_STATUS_SLEEP 0x04U /*!< RNG in sleep mode */ +#define LDD_RNG_STATUS_BUSY 0x02U /*!< RNG busy flag */ + + +/* +** =================================================================== +** RNGA device types and constants +** =================================================================== +*/ + +#define LDD_RNG_ON_ERROR 0x01U /*!< OnError event mask */ + +#define LDD_RNG_STATUS_SECURITY_VIOLATION 0x01U /*!< Security violation occured */ +#define LDD_RNG_STATUS_LAST_READ_UNDERFLOW 0x02U /*!< Last read from RNGA caused underflow error */ +#define LDD_RNG_STATUS_OUT_REG_UNDERFLOW 0x04U /*!< The RNGA Output Register has been read while empty since last read of the RNGA Status Register. */ +#define LDD_RNG_STATUS_ERR_INT_PENDING 0x08U /*!< Error interrupt pending */ +#define LDD_RNG_STATUS_SLEEP_MODE 0x10U /*!< Sleep mode enabled */ + +/*! RNGA sleep mode */ +typedef enum { + LDD_RNG_SLEEP_ENABLED, /*!< RNGA is in sleep mode */ + LDD_RNG_SLEEP_DISABLED /*!< RNGA is running */ +} LDD_RNG_TSleepMode; + +/* +** =================================================================== +** DryIce device types and constants +** =================================================================== +*/ + +#define LDD_DRY_ON_TAMPER_DETECTED 0x01U /*!< OnTamperDetected event mask */ + +/* Tamper flags */ +#define LDD_DRY_TIME_OVERFLOW 0x04U /*!< RTC time overflow has occurred. */ +#define LDD_DRY_MONOTONIC_OVERFLOW 0x08U /*!< RTC monotonic overflow has occurred. */ +#define LDD_DRY_VOLTAGE_TAMPER 0x10U /*!< VBAT voltage is outside of the valid range. */ +#define LDD_DRY_CLOCK_TAMPER 0x20U /*!< The 32.768 kHz clock source is outside the valid range. */ +#define LDD_DRY_TEMPERATURE_TAMPER 0x40U /*!< The junction temperature is outside of specification. */ +#define LDD_DRY_SECURITY_TAMPER 0x80U /*!< The (optional) security module asserted its tamper detect. */ +#define LDD_DRY_FLASH_SECURITY 0x0100U /*!< The flash security is disabled. */ +#define LDD_DRY_TEST_MODE 0x0200U /*!< Any test mode has been entered. */ +/* Tamper flags indicating that the pin does not equal its expected value and was not filtered by the glitch filter (if enabled). */ +#define LDD_DRY_TAMPER_PIN_0 0x00010000U /*!< Mismatch on tamper pin 0. */ +#define LDD_DRY_TAMPER_PIN_1 0x00020000U /*!< Mismatch on tamper pin 1. */ +#define LDD_DRY_TAMPER_PIN_2 0x00040000U /*!< Mismatch on tamper pin 2. */ +#define LDD_DRY_TAMPER_PIN_3 0x00080000U /*!< Mismatch on tamper pin 3. */ +#define LDD_DRY_TAMPER_PIN_4 0x00100000U /*!< Mismatch on tamper pin 4. */ +#define LDD_DRY_TAMPER_PIN_5 0x00200000U /*!< Mismatch on tamper pin 5. */ +#define LDD_DRY_TAMPER_PIN_6 0x00400000U /*!< Mismatch on tamper pin 6. */ +#define LDD_DRY_TAMPER_PIN_7 0x00800000U /*!< Mismatch on tamper pin 7. */ + +#define LDD_DRY_SECURE_KEY_WORD_0 0x01U /*!< Secure key word 0 mask */ +#define LDD_DRY_SECURE_KEY_WORD_1 0x02U /*!< Secure key word 1 mask */ +#define LDD_DRY_SECURE_KEY_WORD_2 0x04U /*!< Secure key word 2 mask */ +#define LDD_DRY_SECURE_KEY_WORD_3 0x08U /*!< Secure key word 3 mask */ +#define LDD_DRY_SECURE_KEY_WORD_4 0x10U /*!< Secure key word 4 mask */ +#define LDD_DRY_SECURE_KEY_WORD_5 0x20U /*!< Secure key word 5 mask */ +#define LDD_DRY_SECURE_KEY_WORD_6 0x40U /*!< Secure key word 6 mask */ +#define LDD_DRY_SECURE_KEY_WORD_7 0x80U /*!< Secure key word 7 mask */ + +/* +** =================================================================== +** NFC device types and constants +** =================================================================== +*/ + +/* Events' masks */ +#define LDD_NFC_ON_CMD_ERROR 0x01U /*!< OnCmdError event mask */ +#define LDD_NFC_ON_CMD_DONE 0x02U /*!< OnCmdDone event mask */ + +/* Pins' masks */ +#define LDD_NFC_CE0_PIN 0x01U /*!< CE0 pin mask */ +#define LDD_NFC_RB0_PIN 0x02U /*!< RB0 pin mask */ +#define LDD_NFC_CE1_PIN 0x04U /*!< CE1 pin mask */ +#define LDD_NFC_RB1_PIN 0x08U /*!< RB1 pin mask */ +#define LDD_NFC_CE2_PIN 0x10U /*!< CE2 pin mask */ +#define LDD_NFC_RB2_PIN 0x20U /*!< RB2 pin mask */ +#define LDD_NFC_CE3_PIN 0x40U /*!< CE3 pin mask */ +#define LDD_NFC_RB3_PIN 0x80U /*!< RB3 pin mask */ +#define LDD_NFC_ALE_PIN 0x0100U /*!< ALE pin mask */ +#define LDD_NFC_CLE_PIN 0x0200U /*!< CLE pin mask */ +#define LDD_NFC_RE_PIN 0x0400U /*!< RE pin mask */ +#define LDD_NFC_WE_PIN 0x0800U /*!< WE pin mask */ +#define LDD_NFC_D0_PIN 0x00010000U /*!< D0 pin mask */ +#define LDD_NFC_D1_PIN 0x00020000U /*!< D1 pin mask */ +#define LDD_NFC_D2_PIN 0x00040000U /*!< D2 pin mask */ +#define LDD_NFC_D3_PIN 0x00080000U /*!< D3 pin mask */ +#define LDD_NFC_D4_PIN 0x00100000U /*!< D4 pin mask */ +#define LDD_NFC_D5_PIN 0x00200000U /*!< D5 pin mask */ +#define LDD_NFC_D6_PIN 0x00400000U /*!< D6 pin mask */ +#define LDD_NFC_D7_PIN 0x00800000U /*!< D7 pin mask */ +#define LDD_NFC_D8_PIN 0x01000000U /*!< D8 pin mask */ +#define LDD_NFC_D9_PIN 0x02000000U /*!< D9 pin mask */ +#define LDD_NFC_D10_PIN 0x04000000U /*!< D10 pin mask */ +#define LDD_NFC_D11_PIN 0x08000000U /*!< D11 pin mask */ +#define LDD_NFC_D12_PIN 0x10000000U /*!< D12 pin mask */ +#define LDD_NFC_D13_PIN 0x20000000U /*!< D13 pin mask */ +#define LDD_NFC_D14_PIN 0x40000000U /*!< D14 pin mask */ +#define LDD_NFC_D15_PIN 0x80000000U /*!< D15 pin mask */ + +typedef uint32_t LDD_NFC_TTargetID; /*!< NFC target ID type */ + +/*! NCF command codes */ +typedef enum { + LDD_NFC_CMD_NONE = 0x00U, /* No command */ + LDD_NFC_CMD_RESET = 0x01U, /* Reset command */ + LDD_NFC_CMD_ERASE = 0x02U, /* Erase command */ + LDD_NFC_CMD_READ_ID = 0x03U, /* Read ID command */ + LDD_NFC_CMD_READ_PAGES = 0x04U, /* Read pages command */ + LDD_NFC_CMD_WRITE_PAGES = 0x05U, /* Write pages command */ + LDD_NFC_CMD_ERASE_BLOCKS = 0x06U, /* Erase page command */ + LDD_NFC_CMD_READ_RAW_PAGE = 0x07U, /* Read raw page command */ + LDD_NFC_CMD_WRITE_RAW_PAGE = 0x08U /* Write raw page command */ +} LDD_NFC_TeCmd; + +/* +** =================================================================== +** LCDC device types and constants +** =================================================================== +*/ + +#define LDD_LCDC_ON_ERROR 0x01U /*!< OnError event mask */ +#define LDD_LCDC_ON_START_OF_FRAME 0x02U /*!< OnStartOfFrame event mask */ +#define LDD_LCDC_ON_END_OF_FRAME 0x04U /*!< OnEndOfFrame event mask */ + +#define LDD_LCDC_NO_ERR 0x00U /*!< No error */ +#define LDD_LCDC_PLANE_0_UNDERRUN_ERR 0x01U /*!< Plane 0 underrurn error */ +#define LDD_LCDC_PLANE_1_UNDERRUN_ERR 0x02U /*!< Plane 1 underrurn error */ + +#define LDD_LCDC_REVERSED_VERTICAL_SCAN 0x8000U /*!< Enable reversed vertical scan (flip along x-axis) */ + +/*! Bitmap description */ +typedef struct { + LDD_TData *Address; /*!< Bitmap starting address */ + uint16_t Width; /*!< Bitmap width */ + uint16_t Height; /*!< Bitmap height */ + uint16_t Format; /*!< Bitmap format */ +} LDD_LCDC_TBitmap; + +/*! Window description */ +typedef struct { + uint16_t X; /*!< Window position in bitmap - X */ + uint16_t Y; /*!< Window position in bitmap - Y */ + uint16_t Width; /*!< Window width */ + uint16_t Height; /*!< Window height */ +} LDD_LCDC_TWindow; + +/*! Cursor type */ +typedef enum { + LDD_LCDC_DISABLED = 0, /*!< Cursor disabled */ + LDD_LCDC_ALWAYS_1, /*!< Cursor 1''s, monochrome display only. */ + LDD_LCDC_ALWAYS_0, /*!< Cursor 0''s, monochrome display only. */ + LDD_LCDC_COLOR, /*!< Defined cursor color, color display only. */ + LDD_LCDC_INVERTED, /*!< Inverted background, monochrome display only. */ + LDD_LCDC_INVERTED_COLOR, /*!< Inverted cursor color, color display only. */ + LDD_LCDC_AND, /*!< Cursor color AND backgroun, color display only. */ + LDD_LCDC_OR, /*!< Cursor color OR backgroun, color display only. */ + LDD_LCDC_XOR +} LDD_LCDC_CursorOperation; + +/*! Plane identification */ +typedef enum { + LDD_LCDC_PLANE_COMMON, /*!< Common for all planes */ + LDD_LCDC_PLANE_0, /*!< Plane (layer) 0 */ + LDD_LCDC_PLANE_1 /*!< Plane (layer) 1 */ +} LDD_LCDC_TPlaneID; + + +/* +** =================================================================== +** Interrupt vector constants +** =================================================================== +*/ +#define LDD_ivIndex_INT_Initial_Stack_Pointer 0x00u +#define LDD_ivIndex_INT_Initial_Program_Counter 0x01u +#define LDD_ivIndex_INT_NMI 0x02u +#define LDD_ivIndex_INT_Hard_Fault 0x03u +#define LDD_ivIndex_INT_Mem_Manage_Fault 0x04u +#define LDD_ivIndex_INT_Bus_Fault 0x05u +#define LDD_ivIndex_INT_Usage_Fault 0x06u +#define LDD_ivIndex_INT_Reserved7 0x07u +#define LDD_ivIndex_INT_Reserved8 0x08u +#define LDD_ivIndex_INT_Reserved9 0x09u +#define LDD_ivIndex_INT_Reserved10 0x0Au +#define LDD_ivIndex_INT_SVCall 0x0Bu +#define LDD_ivIndex_INT_DebugMonitor 0x0Cu +#define LDD_ivIndex_INT_Reserved13 0x0Du +#define LDD_ivIndex_INT_PendableSrvReq 0x0Eu +#define LDD_ivIndex_INT_SysTick 0x0Fu +#define LDD_ivIndex_INT_DMA0_DMA16 0x10u +#define LDD_ivIndex_INT_DMA1_DMA17 0x11u +#define LDD_ivIndex_INT_DMA2_DMA18 0x12u +#define LDD_ivIndex_INT_DMA3_DMA19 0x13u +#define LDD_ivIndex_INT_DMA4_DMA20 0x14u +#define LDD_ivIndex_INT_DMA5_DMA21 0x15u +#define LDD_ivIndex_INT_DMA6_DMA22 0x16u +#define LDD_ivIndex_INT_DMA7_DMA23 0x17u +#define LDD_ivIndex_INT_DMA8_DMA24 0x18u +#define LDD_ivIndex_INT_DMA9_DMA25 0x19u +#define LDD_ivIndex_INT_DMA10_DMA26 0x1Au +#define LDD_ivIndex_INT_DMA11_DMA27 0x1Bu +#define LDD_ivIndex_INT_DMA12_DMA28 0x1Cu +#define LDD_ivIndex_INT_DMA13_DMA29 0x1Du +#define LDD_ivIndex_INT_DMA14_DMA30 0x1Eu +#define LDD_ivIndex_INT_DMA15_DMA31 0x1Fu +#define LDD_ivIndex_INT_DMA_Error 0x20u +#define LDD_ivIndex_INT_MCM 0x21u +#define LDD_ivIndex_INT_FTFE 0x22u +#define LDD_ivIndex_INT_Read_Collision 0x23u +#define LDD_ivIndex_INT_LVD_LVW 0x24u +#define LDD_ivIndex_INT_LLW 0x25u +#define LDD_ivIndex_INT_Watchdog 0x26u +#define LDD_ivIndex_INT_RNG 0x27u +#define LDD_ivIndex_INT_I2C0 0x28u +#define LDD_ivIndex_INT_I2C1 0x29u +#define LDD_ivIndex_INT_SPI0 0x2Au +#define LDD_ivIndex_INT_SPI1 0x2Bu +#define LDD_ivIndex_INT_SPI2 0x2Cu +#define LDD_ivIndex_INT_CAN0_ORed_Message_buffer 0x2Du +#define LDD_ivIndex_INT_CAN0_Bus_Off 0x2Eu +#define LDD_ivIndex_INT_CAN0_Error 0x2Fu +#define LDD_ivIndex_INT_CAN0_Tx_Warning 0x30u +#define LDD_ivIndex_INT_CAN0_Rx_Warning 0x31u +#define LDD_ivIndex_INT_CAN0_Wake_Up 0x32u +#define LDD_ivIndex_INT_I2S0_Tx 0x33u +#define LDD_ivIndex_INT_I2S0_Rx 0x34u +#define LDD_ivIndex_INT_CAN1_ORed_Message_buffer 0x35u +#define LDD_ivIndex_INT_CAN1_Bus_Off 0x36u +#define LDD_ivIndex_INT_CAN1_Error 0x37u +#define LDD_ivIndex_INT_CAN1_Tx_Warning 0x38u +#define LDD_ivIndex_INT_CAN1_Rx_Warning 0x39u +#define LDD_ivIndex_INT_CAN1_Wake_Up 0x3Au +#define LDD_ivIndex_INT_Reserved59 0x3Bu +#define LDD_ivIndex_INT_UART0_LON 0x3Cu +#define LDD_ivIndex_INT_UART0_RX_TX 0x3Du +#define LDD_ivIndex_INT_UART0_ERR 0x3Eu +#define LDD_ivIndex_INT_UART1_RX_TX 0x3Fu +#define LDD_ivIndex_INT_UART1_ERR 0x40u +#define LDD_ivIndex_INT_UART2_RX_TX 0x41u +#define LDD_ivIndex_INT_UART2_ERR 0x42u +#define LDD_ivIndex_INT_UART3_RX_TX 0x43u +#define LDD_ivIndex_INT_UART3_ERR 0x44u +#define LDD_ivIndex_INT_UART4_RX_TX 0x45u +#define LDD_ivIndex_INT_UART4_ERR 0x46u +#define LDD_ivIndex_INT_UART5_RX_TX 0x47u +#define LDD_ivIndex_INT_UART5_ERR 0x48u +#define LDD_ivIndex_INT_ADC0 0x49u +#define LDD_ivIndex_INT_ADC1 0x4Au +#define LDD_ivIndex_INT_CMP0 0x4Bu +#define LDD_ivIndex_INT_CMP1 0x4Cu +#define LDD_ivIndex_INT_CMP2 0x4Du +#define LDD_ivIndex_INT_FTM0 0x4Eu +#define LDD_ivIndex_INT_FTM1 0x4Fu +#define LDD_ivIndex_INT_FTM2 0x50u +#define LDD_ivIndex_INT_CMT 0x51u +#define LDD_ivIndex_INT_RTC 0x52u +#define LDD_ivIndex_INT_RTC_Seconds 0x53u +#define LDD_ivIndex_INT_PIT0 0x54u +#define LDD_ivIndex_INT_PIT1 0x55u +#define LDD_ivIndex_INT_PIT2 0x56u +#define LDD_ivIndex_INT_PIT3 0x57u +#define LDD_ivIndex_INT_PDB0 0x58u +#define LDD_ivIndex_INT_USB0 0x59u +#define LDD_ivIndex_INT_USBDCD 0x5Au +#define LDD_ivIndex_INT_ENET_1588_Timer 0x5Bu +#define LDD_ivIndex_INT_ENET_Transmit 0x5Cu +#define LDD_ivIndex_INT_ENET_Receive 0x5Du +#define LDD_ivIndex_INT_ENET_Error 0x5Eu +#define LDD_ivIndex_INT_Reserved95 0x5Fu +#define LDD_ivIndex_INT_SDHC 0x60u +#define LDD_ivIndex_INT_DAC0 0x61u +#define LDD_ivIndex_INT_DAC1 0x62u +#define LDD_ivIndex_INT_TSI0 0x63u +#define LDD_ivIndex_INT_MCG 0x64u +#define LDD_ivIndex_INT_LPTimer 0x65u +#define LDD_ivIndex_INT_Reserved102 0x66u +#define LDD_ivIndex_INT_PORTA 0x67u +#define LDD_ivIndex_INT_PORTB 0x68u +#define LDD_ivIndex_INT_PORTC 0x69u +#define LDD_ivIndex_INT_PORTD 0x6Au +#define LDD_ivIndex_INT_PORTE 0x6Bu +#define LDD_ivIndex_INT_PORTF 0x6Cu +#define LDD_ivIndex_INT_DDR 0x6Du +#define LDD_ivIndex_INT_SWI 0x6Eu +#define LDD_ivIndex_INT_NFC 0x6Fu +#define LDD_ivIndex_INT_USBHS 0x70u +#define LDD_ivIndex_INT_LCD 0x71u +#define LDD_ivIndex_INT_CMP3 0x72u +#define LDD_ivIndex_INT_Reserved115 0x73u +#define LDD_ivIndex_INT_Reserved116 0x74u +#define LDD_ivIndex_INT_FTM3 0x75u +#define LDD_ivIndex_INT_ADC2 0x76u +#define LDD_ivIndex_INT_ADC3 0x77u +#define LDD_ivIndex_INT_I2S1_Tx 0x78u +#define LDD_ivIndex_INT_I2S1_Rx 0x79u + +#endif /* __PE_Types_H */ + +/*! +** @} +*/ +/* +** ################################################################### +** +** This file was created by Processor Expert 10.5 [05.21] +** for the Freescale Kinetis series of microcontrollers. +** +** ################################################################### +*/ diff --git a/Generated_Code/Vectors.c b/Generated_Code/Vectors.c new file mode 100644 index 0000000000000000000000000000000000000000..4383846e2acbbdd1f98c0e9d4ef6e4192e6ea887 --- /dev/null +++ b/Generated_Code/Vectors.c @@ -0,0 +1,214 @@ +/** ################################################################### +** This component module is generated by Processor Expert. Do not modify it. +** Filename : Vectors.c +** Project : Lab1 +** Processor : MK70FN1M0VMJ12 +** Version : Component 01.028, Driver 01.04, CPU db: 3.00.000 +** Repository : Kinetis +** Compiler : GNU C Compiler +** Date/Time : 2015-07-29, 13:56, # CodeGen: 10 +** Abstract : +** +** Settings : +** +** +** Copyright : 1997 - 2015 Freescale Semiconductor, Inc. +** All Rights Reserved. +** +** Redistribution and use in source and binary forms, with or without modification, +** are permitted provided that the following conditions are met: +** +** o Redistributions of source code must retain the above copyright notice, this list +** of conditions and the following disclaimer. +** +** o Redistributions in binary form must reproduce the above copyright notice, this +** list of conditions and the following disclaimer in the documentation and/or +** other materials provided with the distribution. +** +** o Neither the name of Freescale Semiconductor, Inc. nor the names of its +** contributors may be used to endorse or promote products derived from this +** software without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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. +** +** http: www.freescale.com +** mail: support@freescale.com +** ###################################################################*/ +/*! +** @file Vectors.c +** @version 01.04 +** @brief +** +*/ +/*! +** @addtogroup Vectors_module Vectors module documentation +** @{ +*/ + +#include "Cpu.h" +#include "timer.h" +#include "buttons.h" + + /* ISR prototype */ + extern uint32_t __SP_INIT; + extern + #ifdef __cplusplus + "C" + #endif + void __thumb_startup( void ); + + + /*lint -esym(765,__vect_table) Disable MISRA rule (8.10) checking for symbols (__vect_table). Definition of the interrupt vector table placed by linker on a predefined location. */ + /*lint -save -e926 -e927 -e928 -e929 Disable MISRA rule (11.4) checking. Need to explicitly cast pointers to the general ISR for Interrupt vector table */ + + __attribute__ ((section (".vectortable"))) const tVectorTable __vect_table = { /* Interrupt vector table */ + + /* ISR name No. Address Pri Name Description */ + &__SP_INIT, /* 0x00 0x00000000 - ivINT_Initial_Stack_Pointer used by PE */ + { + (tIsrFunc)&__thumb_startup, /* 0x01 0x00000004 - ivINT_Initial_Program_Counter used by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x02 0x00000008 -2 ivINT_NMI unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x03 0x0000000C -1 ivINT_Hard_Fault unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x04 0x00000010 - ivINT_Mem_Manage_Fault unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x05 0x00000014 - ivINT_Bus_Fault unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x06 0x00000018 - ivINT_Usage_Fault unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x07 0x0000001C - ivINT_Reserved7 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x08 0x00000020 - ivINT_Reserved8 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x09 0x00000024 - ivINT_Reserved9 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x0A 0x00000028 - ivINT_Reserved10 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x0B 0x0000002C - ivINT_SVCall unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x0C 0x00000030 - ivINT_DebugMonitor unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x0D 0x00000034 - ivINT_Reserved13 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x0E 0x00000038 - ivINT_PendableSrvReq unused by PE */ + (tIsrFunc)&Timer_TickISR, /* 0x0F 0x0000003C - ivINT_SysTick unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x10 0x00000040 - ivINT_DMA0_DMA16 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x11 0x00000044 - ivINT_DMA1_DMA17 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x12 0x00000048 - ivINT_DMA2_DMA18 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x13 0x0000004C - ivINT_DMA3_DMA19 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x14 0x00000050 - ivINT_DMA4_DMA20 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x15 0x00000054 - ivINT_DMA5_DMA21 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x16 0x00000058 - ivINT_DMA6_DMA22 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x17 0x0000005C - ivINT_DMA7_DMA23 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x18 0x00000060 - ivINT_DMA8_DMA24 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x19 0x00000064 - ivINT_DMA9_DMA25 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x1A 0x00000068 - ivINT_DMA10_DMA26 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x1B 0x0000006C - ivINT_DMA11_DMA27 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x1C 0x00000070 - ivINT_DMA12_DMA28 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x1D 0x00000074 - ivINT_DMA13_DMA29 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x1E 0x00000078 - ivINT_DMA14_DMA30 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x1F 0x0000007C - ivINT_DMA15_DMA31 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x20 0x00000080 - ivINT_DMA_Error unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x21 0x00000084 - ivINT_MCM unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x22 0x00000088 - ivINT_FTFE unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x23 0x0000008C - ivINT_Read_Collision unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x24 0x00000090 - ivINT_LVD_LVW unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x25 0x00000094 - ivINT_LLW unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x26 0x00000098 - ivINT_Watchdog unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x27 0x0000009C - ivINT_RNG unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x28 0x000000A0 - ivINT_I2C0 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x29 0x000000A4 - ivINT_I2C1 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x2A 0x000000A8 - ivINT_SPI0 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x2B 0x000000AC - ivINT_SPI1 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x2C 0x000000B0 - ivINT_SPI2 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x2D 0x000000B4 - ivINT_CAN0_ORed_Message_buffer unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x2E 0x000000B8 - ivINT_CAN0_Bus_Off unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x2F 0x000000BC - ivINT_CAN0_Error unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x30 0x000000C0 - ivINT_CAN0_Tx_Warning unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x31 0x000000C4 - ivINT_CAN0_Rx_Warning unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x32 0x000000C8 - ivINT_CAN0_Wake_Up unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x33 0x000000CC - ivINT_I2S0_Tx unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x34 0x000000D0 - ivINT_I2S0_Rx unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x35 0x000000D4 - ivINT_CAN1_ORed_Message_buffer unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x36 0x000000D8 - ivINT_CAN1_Bus_Off unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x37 0x000000DC - ivINT_CAN1_Error unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x38 0x000000E0 - ivINT_CAN1_Tx_Warning unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x39 0x000000E4 - ivINT_CAN1_Rx_Warning unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x3A 0x000000E8 - ivINT_CAN1_Wake_Up unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x3B 0x000000EC - ivINT_Reserved59 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x3C 0x000000F0 - ivINT_UART0_LON unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x3D 0x000000F4 - ivINT_UART0_RX_TX unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x3E 0x000000F8 - ivINT_UART0_ERR unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x3F 0x000000FC - ivINT_UART1_RX_TX unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x40 0x00000100 - ivINT_UART1_ERR unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x41 0x00000104 - ivINT_UART2_RX_TX unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x42 0x00000108 - ivINT_UART2_ERR unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x43 0x0000010C - ivINT_UART3_RX_TX unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x44 0x00000110 - ivINT_UART3_ERR unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x45 0x00000114 - ivINT_UART4_RX_TX unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x46 0x00000118 - ivINT_UART4_ERR unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x47 0x0000011C - ivINT_UART5_RX_TX unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x48 0x00000120 - ivINT_UART5_ERR unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x49 0x00000124 - ivINT_ADC0 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x4A 0x00000128 - ivINT_ADC1 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x4B 0x0000012C - ivINT_CMP0 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x4C 0x00000130 - ivINT_CMP1 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x4D 0x00000134 - ivINT_CMP2 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x4E 0x00000138 - ivINT_FTM0 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x4F 0x0000013C - ivINT_FTM1 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x50 0x00000140 - ivINT_FTM2 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x51 0x00000144 - ivINT_CMT unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x52 0x00000148 - ivINT_RTC unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x53 0x0000014C - ivINT_RTC_Seconds unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x54 0x00000150 - ivINT_PIT0 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x55 0x00000154 - ivINT_PIT1 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x56 0x00000158 - ivINT_PIT2 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x57 0x0000015C - ivINT_PIT3 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x58 0x00000160 - ivINT_PDB0 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x59 0x00000164 - ivINT_USB0 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x5A 0x00000168 - ivINT_USBDCD unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x5B 0x0000016C - ivINT_ENET_1588_Timer unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x5C 0x00000170 - ivINT_ENET_Transmit unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x5D 0x00000174 - ivINT_ENET_Receive unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x5E 0x00000178 - ivINT_ENET_Error unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x5F 0x0000017C - ivINT_Reserved95 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x60 0x00000180 - ivINT_SDHC unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x61 0x00000184 - ivINT_DAC0 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x62 0x00000188 - ivINT_DAC1 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x63 0x0000018C - ivINT_TSI0 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x64 0x00000190 - ivINT_MCG unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x65 0x00000194 - ivINT_LPTimer unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x66 0x00000198 - ivINT_Reserved102 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x67 0x0000019C - ivINT_PORTA unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x68 0x000001A0 - ivINT_PORTB unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x69 0x000001A4 - ivINT_PORTC unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x6A 0x000001A8 - ivINT_PORTD unused by PE */ + (tIsrFunc)&PortE_ISR, /* 0x6B 0x000001AC - ivINT_PORTE unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x6C 0x000001B0 - ivINT_PORTF unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x6D 0x000001B4 - ivINT_DDR unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x6E 0x000001B8 - ivINT_SWI unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x6F 0x000001BC - ivINT_NFC unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x70 0x000001C0 - ivINT_USBHS unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x71 0x000001C4 - ivINT_LCD unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x72 0x000001C8 - ivINT_CMP3 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x73 0x000001CC - ivINT_Reserved115 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x74 0x000001D0 - ivINT_Reserved116 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x75 0x000001D4 - ivINT_FTM3 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x76 0x000001D8 - ivINT_ADC2 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x77 0x000001DC - ivINT_ADC3 unused by PE */ + (tIsrFunc)&Cpu_Interrupt, /* 0x78 0x000001E0 - ivINT_I2S1_Tx unused by PE */ + (tIsrFunc)&Cpu_Interrupt /* 0x79 0x000001E4 - ivINT_I2S1_Rx unused by PE */ + } + }; + /*lint -restore Enable MISRA rule (11.4) checking. */ + + +/*! +** @} +*/ +/* +** ################################################################### +** +** This file was created by Processor Expert 10.5 [05.21] +** for the Freescale Kinetis series of microcontrollers. +** +** ################################################################### +*/ diff --git a/Library/LEDs.h b/Library/LEDs.h new file mode 100644 index 0000000000000000000000000000000000000000..591b080cb2137f4039429f354001a6bb603341d0 --- /dev/null +++ b/Library/LEDs.h @@ -0,0 +1,55 @@ +/*! @file + * + * @brief Routines to access the LEDs on the TWR-K70F120M. + * + * This contains the functions for operating the LEDs. + * + * @author PMcL + * @date 2015-08-15 + */ + +#ifndef LEDS_H +#define LEDS_H + +// new types +#include "types.h" + +/*! @brief LED to pin mapping on the TWR-K70F120M + * + */ +typedef enum +{ + LED_ORANGE = (1 << 11), + LED_YELLOW = (1 << 28), + LED_GREEN = (1 << 29), + LED_BLUE = (1 << 10) +} TLED; + +/*! @brief Sets up the LEDs before first use. + * + * @return bool - TRUE if the LEDs were successfully initialized. + */ +bool LEDs_Init(void); + +/*! @brief Turns an LED on. + * + * @param color The color of the LED to turn on. + * @note Assumes that LEDs_Init has been called. + */ +void LEDs_On(const TLED color); + +/*! @brief Turns off an LED. + * + * @param color THe color of the LED to turn off. + * @note Assumes that LEDs_Init has been called. + */ +void LEDs_Off(const TLED color); + +/*! @brief Toggles an LED. + * + * @param color THe color of the LED to toggle. + * @note Assumes that LEDs_Init has been called. + */ +void LEDs_Toggle(const TLED color); + +#endif diff --git a/Library/buttons.h b/Library/buttons.h new file mode 100644 index 0000000000000000000000000000000000000000..e3a7476b0a42ada039d6c23247e0decd125d6ce2 --- /dev/null +++ b/Library/buttons.h @@ -0,0 +1,40 @@ +/*! @file + * + * @brief HAL for pushbutton switches on the TWR-K70. + * + * This contains the functions for the pushbutton switches on the TWR-K70. +* + * @author PMcL + * @date 2015-10-25 + */ + +#ifndef BUTTONS_H +#define BUTTONS_H + +// New types +#include "types.h" + +/*! @brief Initializes the pushbutton switches. + * + * @param buttonSetup is a pointer to a switch setup structure. + * @param userFunction is a pointer to a user callback function. + */ +bool Buttons_Init(void (*userFunction)(void)); + +/*! @brief Interrupt service routine for Port D buttons. + * + * A button in Port D has been pressed. + * The user callback function will be called. + * @note Assumes the button has been initialized. + */ +void __attribute__ ((interrupt)) PortD_ISR(void); + +/*! @brief Interrupt service routine for Port E buttons. + * + * A button in Port E has been pressed. + * The user callback function will be called. + * @note Assumes the button has been initialized. + */ +void __attribute__ ((interrupt)) PortE_ISR(void); + +#endif diff --git a/Library/libLab0.a b/Library/libLab0.a new file mode 100644 index 0000000000000000000000000000000000000000..88e3c5660faba329560ce247c598246a0cec6db5 Binary files /dev/null and b/Library/libLab0.a differ diff --git a/Library/timer.h b/Library/timer.h new file mode 100644 index 0000000000000000000000000000000000000000..5458d7d0f09457011e50ab648395492e43ac169b --- /dev/null +++ b/Library/timer.h @@ -0,0 +1,33 @@ +/*! @file + * + * @brief Routines to implement packet encoding and decoding for the serial port. + * + * This contains the functions for implementing the "Tower to PC Protocol" 5-byte packets. + * + * @author PMcL + * @date 2015-07-23 + */ + +#ifndef TIMER_H +#define TIMER_H + +// new types +#include "types.h" + +/*! @brief Initializes the Timer before first use. + * + * Sets up the internal SysTick clock. + * Registers the user's callback function. + * @param userFunction is a pointer to a user callback function. + */ +void Timer_Init(void (*userFunction)(void)); + +/*! @brief Interrupt service routine for the timer. + * + * The internal systick clock has ticked. + * The user callback function will be called after 1 second has elapsed. + * @note Assumes the Timer has been initialized. + */ +void __attribute__ ((interrupt)) Timer_TickISR(void); + +#endif diff --git a/Library/types.h b/Library/types.h new file mode 100644 index 0000000000000000000000000000000000000000..1341ab97cba24ebf4d1da989cf90118eaffef941 --- /dev/null +++ b/Library/types.h @@ -0,0 +1,60 @@ +/*! @file + * + * @brief Declares new types. + * + * This contains types that are especially useful for the Tower to PC Protocol. + * + * @author PMcL + * @date 2015-07-23 + */ + +#ifndef TYPES_H +#define TYPES_H + +#include +#include + +// Unions to efficiently access hi and lo parts of integers and words +typedef union +{ + int16_t l; + struct + { + int8_t Lo; + int8_t Hi; + } s; +} int16union_t; + +typedef union +{ + uint16_t l; + struct + { + uint8_t Lo; + uint8_t Hi; + } s; +} uint16union_t; + +// Union to efficiently access hi and lo parts of a long integer +typedef union +{ + uint32_t l; + struct + { + uint16_t Lo; + uint16_t Hi; + } s; +} uint32union_t; + +// Union to efficiently access individual bytes of a float +typedef union +{ + float d; + struct + { + uint16union_t dLo; + uint16union_t dHi; + } dParts; +} TFloat; + +#endif diff --git a/ProcessorExpert.pe b/ProcessorExpert.pe new file mode 100644 index 0000000000000000000000000000000000000000..f5408dec9f0814ca0a587ea546ace2a445c01f95 --- /dev/null +++ b/ProcessorExpert.pe @@ -0,0 +1,39543 @@ + + +
+ Lab0 + PMcL + 7 + 2015-07-20 + Eclipse IDE + 1.12.0.RT7_b1515-0427 +
+ + main + Sources + Generated_Code + Documentation + + Project_Settings + Static_Code + + 3 + 3 + 3 + true + false + true + 0 + false + false + true + false + true + 6 + true + false + true + CLASSIC + true + true + false + + STANDALONE + + + file:/${ProcessorExpert_loc}/Repositories/Kinetis_Repository + com.freescale.processorexpert.processor.mk70fn1m0mj15 + MK70FN1M0MJ15 + Cpu + 2 + false + ALWAYS_WRITE + CPU_CHIP2 + + +