From 14a43d4fddb21489704f0689b666cdbc3871117c Mon Sep 17 00:00:00 2001 From: "ANALOG\\EAtmaca" Date: Tue, 28 Nov 2023 15:38:03 +0300 Subject: [PATCH] AUDIO_Playback example added. --- Examples/MAX32665/AUDIO_Playback/.cproject | 81 ++ Examples/MAX32665/AUDIO_Playback/.project | 26 + .../.settings/language.settings.xml | 15 + .../org.eclipse.cdt.codan.core.prefs | 93 ++ .../.settings/org.eclipse.cdt.core.prefs | 15 + .../org.eclipse.core.resources.prefs | 2 + .../MAX32665/AUDIO_Playback/.vscode/README.md | 47 + .../.vscode/c_cpp_properties.json | 53 + .../MAX32665/AUDIO_Playback/.vscode/flash.gdb | 15 + .../AUDIO_Playback/.vscode/launch.json | 133 ++ .../AUDIO_Playback/.vscode/settings.json | 78 ++ .../AUDIO_Playback/.vscode/tasks.json | 115 ++ .../MAX32666_I2S_Example.launch | 62 + Examples/MAX32665/AUDIO_Playback/Makefile | 395 ++++++ Examples/MAX32665/AUDIO_Playback/README.md | 47 + Examples/MAX32665/AUDIO_Playback/audio.c | 198 +++ Examples/MAX32665/AUDIO_Playback/audio.h | 59 + Examples/MAX32665/AUDIO_Playback/audio_regs.h | 1139 +++++++++++++++++ Examples/MAX32665/AUDIO_Playback/main.c | 213 +++ Examples/MAX32665/AUDIO_Playback/max9867.c | 529 ++++++++ Examples/MAX32665/AUDIO_Playback/max9867.h | 371 ++++++ Examples/MAX32665/AUDIO_Playback/project.mk | 15 + 22 files changed, 3701 insertions(+) create mode 100644 Examples/MAX32665/AUDIO_Playback/.cproject create mode 100644 Examples/MAX32665/AUDIO_Playback/.project create mode 100644 Examples/MAX32665/AUDIO_Playback/.settings/language.settings.xml create mode 100644 Examples/MAX32665/AUDIO_Playback/.settings/org.eclipse.cdt.codan.core.prefs create mode 100644 Examples/MAX32665/AUDIO_Playback/.settings/org.eclipse.cdt.core.prefs create mode 100644 Examples/MAX32665/AUDIO_Playback/.settings/org.eclipse.core.resources.prefs create mode 100644 Examples/MAX32665/AUDIO_Playback/.vscode/README.md create mode 100644 Examples/MAX32665/AUDIO_Playback/.vscode/c_cpp_properties.json create mode 100644 Examples/MAX32665/AUDIO_Playback/.vscode/flash.gdb create mode 100644 Examples/MAX32665/AUDIO_Playback/.vscode/launch.json create mode 100644 Examples/MAX32665/AUDIO_Playback/.vscode/settings.json create mode 100644 Examples/MAX32665/AUDIO_Playback/.vscode/tasks.json create mode 100644 Examples/MAX32665/AUDIO_Playback/MAX32666_I2S_Example.launch create mode 100644 Examples/MAX32665/AUDIO_Playback/Makefile create mode 100644 Examples/MAX32665/AUDIO_Playback/README.md create mode 100644 Examples/MAX32665/AUDIO_Playback/audio.c create mode 100644 Examples/MAX32665/AUDIO_Playback/audio.h create mode 100644 Examples/MAX32665/AUDIO_Playback/audio_regs.h create mode 100644 Examples/MAX32665/AUDIO_Playback/main.c create mode 100644 Examples/MAX32665/AUDIO_Playback/max9867.c create mode 100644 Examples/MAX32665/AUDIO_Playback/max9867.h create mode 100644 Examples/MAX32665/AUDIO_Playback/project.mk diff --git a/Examples/MAX32665/AUDIO_Playback/.cproject b/Examples/MAX32665/AUDIO_Playback/.cproject new file mode 100644 index 00000000000..ec8059ff032 --- /dev/null +++ b/Examples/MAX32665/AUDIO_Playback/.cproject @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Examples/MAX32665/AUDIO_Playback/.project b/Examples/MAX32665/AUDIO_Playback/.project new file mode 100644 index 00000000000..df03924e55c --- /dev/null +++ b/Examples/MAX32665/AUDIO_Playback/.project @@ -0,0 +1,26 @@ + + + MAX32666_I2S_Example + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + diff --git a/Examples/MAX32665/AUDIO_Playback/.settings/language.settings.xml b/Examples/MAX32665/AUDIO_Playback/.settings/language.settings.xml new file mode 100644 index 00000000000..5109a622725 --- /dev/null +++ b/Examples/MAX32665/AUDIO_Playback/.settings/language.settings.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Examples/MAX32665/AUDIO_Playback/.settings/org.eclipse.cdt.codan.core.prefs b/Examples/MAX32665/AUDIO_Playback/.settings/org.eclipse.cdt.codan.core.prefs new file mode 100644 index 00000000000..59c0b37ba75 --- /dev/null +++ b/Examples/MAX32665/AUDIO_Playback/.settings/org.eclipse.cdt.codan.core.prefs @@ -0,0 +1,93 @@ +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},suppression_comment\=>"@suppress(\\"No return\\")",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},suppression_comment\=>"@suppress(\\"Unused return value\\")"} +org.eclipse.cdt.codan.checkers.nocommentinside=-Error +org.eclipse.cdt.codan.checkers.nocommentinside.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},suppression_comment\=>"@suppress(\\"Nesting comments\\")"} +org.eclipse.cdt.codan.checkers.nolinecomment=-Error +org.eclipse.cdt.codan.checkers.nolinecomment.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},suppression_comment\=>"@suppress(\\"Line comments\\")"} +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},suppression_comment\=>"@suppress(\\"No return value\\")",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},suppression_comment\=>"@suppress(\\"Abstract class cannot be instantiated\\")"} +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},suppression_comment\=>"@suppress(\\"Ambiguous problem\\")"} +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},suppression_comment\=>"@suppress(\\"Assignment in condition\\")"} +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},suppression_comment\=>"@suppress(\\"Assignment to itself\\")"} +org.eclipse.cdt.codan.internal.checkers.CStyleCastProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.CStyleCastProblem.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},suppression_comment\=>"@suppress(\\"C-Style cast instead of C++ cast\\")"} +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},suppression_comment\=>"@suppress(\\"No break at end of case\\")",no_break_comment\=>"no break",last_case_param\=>false,empty_case_param\=>false,enable_fallthrough_quickfix_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},suppression_comment\=>"@suppress(\\"Catching by reference is recommended\\")",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},suppression_comment\=>"@suppress(\\"Circular inheritance\\")"} +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},suppression_comment\=>"@suppress(\\"Class members should be properly initialized\\")",skip\=>true} +org.eclipse.cdt.codan.internal.checkers.CopyrightProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.CopyrightProblem.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},suppression_comment\=>"@suppress(\\"Lack of copyright information\\")",regex\=>".*Copyright.*"} +org.eclipse.cdt.codan.internal.checkers.DecltypeAutoProblem=Error +org.eclipse.cdt.codan.internal.checkers.DecltypeAutoProblem.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},suppression_comment\=>"@suppress(\\"Invalid 'decltype(auto)' specifier\\")"} +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},suppression_comment\=>"@suppress(\\"Field cannot be resolved\\")"} +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},suppression_comment\=>"@suppress(\\"Function cannot be resolved\\")"} +org.eclipse.cdt.codan.internal.checkers.GotoStatementProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.GotoStatementProblem.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},suppression_comment\=>"@suppress(\\"Goto statement used\\")"} +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},suppression_comment\=>"@suppress(\\"Invalid arguments\\")"} +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},suppression_comment\=>"@suppress(\\"Invalid template argument\\")"} +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},suppression_comment\=>"@suppress(\\"Label statement not found\\")"} +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},suppression_comment\=>"@suppress(\\"Member declaration not found\\")"} +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},suppression_comment\=>"@suppress(\\"Method cannot be resolved\\")"} +org.eclipse.cdt.codan.internal.checkers.MissCaseProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.MissCaseProblem.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},suppression_comment\=>"@suppress(\\"Missing cases in switch\\")"} +org.eclipse.cdt.codan.internal.checkers.MissDefaultProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.MissDefaultProblem.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},suppression_comment\=>"@suppress(\\"Missing default in switch\\")",defaultWithAllEnums\=>false} +org.eclipse.cdt.codan.internal.checkers.MissReferenceProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.MissReferenceProblem.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},suppression_comment\=>"@suppress(\\"Missing reference return value in assignment operator\\")"} +org.eclipse.cdt.codan.internal.checkers.MissSelfCheckProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.MissSelfCheckProblem.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},suppression_comment\=>"@suppress(\\"Missing self check in assignment operator\\")"} +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},suppression_comment\=>"@suppress(\\"Name convention for function\\")",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},suppression_comment\=>"@suppress(\\"Class has a virtual method and non-virtual destructor\\")"} +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},suppression_comment\=>"@suppress(\\"Invalid overload\\")"} +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},suppression_comment\=>"@suppress(\\"Invalid redeclaration\\")"} +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},suppression_comment\=>"@suppress(\\"Invalid redefinition\\")"} +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},suppression_comment\=>"@suppress(\\"Return with parenthesis\\")"} +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},suppression_comment\=>"@suppress(\\"Format String Vulnerability\\")"} +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},suppression_comment\=>"@suppress(\\"Statement has no effect\\")",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},suppression_comment\=>"@suppress(\\"Suggested parenthesis around expression\\")",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},suppression_comment\=>"@suppress(\\"Suspicious semicolon\\")",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},suppression_comment\=>"@suppress(\\"Type cannot be resolved\\")"} +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},suppression_comment\=>"@suppress(\\"Unused function declaration\\")",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},suppression_comment\=>"@suppress(\\"Unused static function\\")",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},suppression_comment\=>"@suppress(\\"Unused variable declaration in file scope\\")",macro\=>true,exceptions\=>("@(\#)","$Id")} +org.eclipse.cdt.codan.internal.checkers.UsingInHeaderProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.UsingInHeaderProblem.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},suppression_comment\=>"@suppress(\\"Using directive in header\\")"} +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},suppression_comment\=>"@suppress(\\"Symbol is not resolved\\")"} +org.eclipse.cdt.codan.internal.checkers.VirtualMethodCallProblem=-Error +org.eclipse.cdt.codan.internal.checkers.VirtualMethodCallProblem.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},suppression_comment\=>"@suppress(\\"Virtual method call in constructor/destructor\\")"} +org.eclipse.cdt.qt.core.qtproblem=Warning +org.eclipse.cdt.qt.core.qtproblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_ON_FILE_OPEN\=>true,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>null} diff --git a/Examples/MAX32665/AUDIO_Playback/.settings/org.eclipse.cdt.core.prefs b/Examples/MAX32665/AUDIO_Playback/.settings/org.eclipse.cdt.core.prefs new file mode 100644 index 00000000000..b49eb4f6e48 --- /dev/null +++ b/Examples/MAX32665/AUDIO_Playback/.settings/org.eclipse.cdt.core.prefs @@ -0,0 +1,15 @@ +eclipse.preferences.version=1 +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1028364529/BOARD/delimiter=; +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1028364529/BOARD/operation=append +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1028364529/BOARD/value=EvKit_V1 +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1028364529/GCC_PREFIX/delimiter=; +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1028364529/GCC_PREFIX/operation=replace +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1028364529/GCC_PREFIX/value=arm-none-eabi- +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1028364529/PROJECT/delimiter=; +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1028364529/PROJECT/operation=append +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1028364529/PROJECT/value=MAX32666_I2S_Example +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1028364529/TARGET/delimiter=; +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1028364529/TARGET/operation=append +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1028364529/TARGET/value=MAX32665 +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1028364529/append=true +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1028364529/appendContributed=true diff --git a/Examples/MAX32665/AUDIO_Playback/.settings/org.eclipse.core.resources.prefs b/Examples/MAX32665/AUDIO_Playback/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 00000000000..99f26c0203a --- /dev/null +++ b/Examples/MAX32665/AUDIO_Playback/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/Examples/MAX32665/AUDIO_Playback/.vscode/README.md b/Examples/MAX32665/AUDIO_Playback/.vscode/README.md new file mode 100644 index 00000000000..58733e941c7 --- /dev/null +++ b/Examples/MAX32665/AUDIO_Playback/.vscode/README.md @@ -0,0 +1,47 @@ +# VSCode-Maxim + +_(If you're viewing this document from within Visual Studio Code you can press `CTRL+SHIFT+V` to open a Markdown preview window.)_ + +## Quick Links + +* [MSDK User Guide](https://analog-devices-msdk.github.io/msdk/USERGUIDE/) +* [VSCode-Maxim Github](https://github.com/Analog-Devices-MSDK/VSCode-Maxim) + +## Introduction + +VSCode-Maxim is a set of [Visual Studio Code](https://code.visualstudio.com/) project configurations and utilities for enabling embedded development for [Analog Device's MSDK](https://github.com/Analog-Devices-MSDK/msdk) and the [MAX32xxx/MAX78xxx microcontrollers](https://www.analog.com/en/product-category/microcontrollers.html). + +The following features are supported: + +* Code editing with intellisense down to the register level +* Code compilation with the ability to easily re-target a project for different microcontrollers and boards +* Flashing programs +* GUI and command-line debugging + +## Dependencies + +* [Visual Studio Code](https://code.visualstudio.com/) + * [C/C++ VSCode Extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) + * [Cortex-Debug Extension](https://marketplace.visualstudio.com/items?itemName=marus25.cortex-debug) +* [Analog Devices MSDK](https://analog-devices-msdk.github.io/msdk/) + +## Installation + +Install the MSDK, then set `"MAXIM_PATH"` in your _user_ VS Code settings. + +See [Getting Started with Visual Studio Code](https://analog-devices-msdk.github.io/msdk/USERGUIDE/#getting-started-with-visual-studio-code) in the MSDK User Guide for detailed instructions. + +## Usage + +See the [MSDK User Guide](https://analog-devices-msdk.github.io/msdk/USERGUIDE/#visual-studio-code) for detailed usage info. + +## Issue Tracker + +Bug reports, feature requests, and contributions are welcome via the [issues](https://github.com/Analog-Devices-MSDK/VSCode-Maxim/issues) tracker on Github. + +New issues should contain _at minimum_ the following information: + +* Visual Studio Code version #s (see `Help -> About`) +* C/C++ Extension version # +* Target microcontroller and evaluation platform +* The projects `.vscode` folder and `Makefile` (where applicable). Standard compression formats such as `.zip`, `.rar`, `.tar.gz`, etc. are all acceptable. diff --git a/Examples/MAX32665/AUDIO_Playback/.vscode/c_cpp_properties.json b/Examples/MAX32665/AUDIO_Playback/.vscode/c_cpp_properties.json new file mode 100644 index 00000000000..dfbed47b581 --- /dev/null +++ b/Examples/MAX32665/AUDIO_Playback/.vscode/c_cpp_properties.json @@ -0,0 +1,53 @@ +{ + "configurations": [ + { + "name": "Win32", + "includePath": [ + "${default}" + ], + "defines": [ + "${default}" + ], + "intelliSenseMode": "gcc-arm", + "compilerPath": "${config:ARM_GCC_path}/bin/arm-none-eabi-gcc.exe", + "browse": { + "path": [ + "${default}" + ] + } + }, + { + "name": "Linux", + "includePath": [ + "${default}" + ], + "defines": [ + "${default}" + ], + "intelliSenseMode": "gcc-arm", + "compilerPath": "${config:ARM_GCC_path}/bin/arm-none-eabi-gcc", + "browse": { + "path": [ + "${default}" + ] + } + }, + { + "name": "Mac", + "includePath": [ + "${default}" + ], + "defines": [ + "${default}" + ], + "intelliSenseMode": "gcc-arm", + "compilerPath": "${config:ARM_GCC_path}/bin/arm-none-eabi-gcc", + "browse": { + "path": [ + "${default}" + ] + } + } + ], + "version": 4 +} \ No newline at end of file diff --git a/Examples/MAX32665/AUDIO_Playback/.vscode/flash.gdb b/Examples/MAX32665/AUDIO_Playback/.vscode/flash.gdb new file mode 100644 index 00000000000..fc627ae86a3 --- /dev/null +++ b/Examples/MAX32665/AUDIO_Playback/.vscode/flash.gdb @@ -0,0 +1,15 @@ +define flash_m4 + set architecture armv7e-m + target remote | openocd -c "gdb_port pipe;log_output flash.log" -s $arg0/scripts -f interface/$arg1 -f target/$arg2 -c "init; reset halt" + load + compare-sections + monitor reset halt +end + +define flash_m4_run + set architecture armv7e-m + target remote | openocd -c "gdb_port pipe;log_output flash.log" -s $arg0/scripts -f interface/$arg1 -f target/$arg2 -c "init; reset halt" + load + compare-sections + monitor resume +end \ No newline at end of file diff --git a/Examples/MAX32665/AUDIO_Playback/.vscode/launch.json b/Examples/MAX32665/AUDIO_Playback/.vscode/launch.json new file mode 100644 index 00000000000..01fe5199048 --- /dev/null +++ b/Examples/MAX32665/AUDIO_Playback/.vscode/launch.json @@ -0,0 +1,133 @@ +{ + "configurations": [ + { + "name": "Debug Arm (Cortex-debug)", + "cwd":"${workspaceRoot}", + "executable": "${workspaceFolder}/build/${config:program_file}", + "loadFiles": ["${workspaceFolder}/build/${config:program_file}"], + "symbolFiles": [{ + "file": "${workspaceFolder}/build/${config:symbol_file}" + }], + "request": "launch", + "type": "cortex-debug", + "servertype": "openocd", + "linux": { + "gdbPath": "${config:ARM_GCC_path}/bin/arm-none-eabi-gdb", + "serverpath": "${config:OCD_path}/openocd", + }, + "windows": { + "gdbPath": "${config:ARM_GCC_path}/bin/arm-none-eabi-gdb.exe", + "serverpath": "${config:OCD_path}/openocd.exe", + }, + "osx": { + "gdbPath": "${config:ARM_GCC_path}/bin/arm-none-eabi-gdb", + "serverpath": "${config:OCD_path}/openocd", + }, + "searchDir": ["${config:OCD_path}/scripts"], + "configFiles": ["interface/${config:M4_OCD_interface_file}", "target/${config:M4_OCD_target_file}"], + "interface": "swd", + "runToEntryPoint": "main", + "svdFile": "${config:MAXIM_PATH}/Libraries/CMSIS/Device/Maxim/${config:target}/Include/${config:target}.svd" + }, + { + "name": "GDB (Arm M4)", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/build/${config:program_file}", + "args": [], + "stopAtEntry": true, + "cwd": "${workspaceFolder}", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "linux": { + "miDebuggerPath": "${config:ARM_GCC_path}/bin/arm-none-eabi-gdb", + "debugServerPath": "${config:OCD_path}/openocd", + }, + "windows": { + "miDebuggerPath": "${config:ARM_GCC_path}/bin/arm-none-eabi-gdb.exe", + "debugServerPath": "${config:OCD_path}/openocd.exe", + }, + "osx": { + "miDebuggerPath": "${config:ARM_GCC_path}/bin/arm-none-eabi-gdb", + "debugServerPath": "${config:OCD_path}/bin/openocd", + }, + "logging": { + "exceptions": true, + "trace": false, + "traceResponse": false, + "engineLogging": false + }, + "miDebuggerServerAddress": "localhost:3333", + "debugServerArgs": "-s ${config:OCD_path}/scripts -f interface/${config:M4_OCD_interface_file} -f target/${config:M4_OCD_target_file} -c \"init; reset halt\"", + "serverStarted": "Info : Listening on port 3333 for gdb connections", + "filterStderr": true, + "targetArchitecture": "arm", + "customLaunchSetupCommands": [ + {"text":"-list-features"} + ], + "setupCommands": [ + { "text":"set logging overwrite on"}, + { "text":"set logging file debug-arm.log"}, + { "text":"set logging on"}, + { "text":"cd ${workspaceFolder}" }, + { "text":"exec-file build/${config:program_file}" }, + { "text":"symbol-file build/${config:symbol_file}" }, + { "text":"target remote localhost:3333" }, + { "text":"monitor reset halt" }, + { "text":"set $pc=Reset_Handler"}, + { "text":"b main" } + ] + }, + { + "name": "GDB (RISC-V)", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/buildrv/${config:program_file}", + "args": [], + "stopAtEntry": false, + "cwd": "${workspaceFolder}", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "linux": { + "miDebuggerPath": "${config:xPack_GCC_path}/bin/riscv-none-elf-gdb", + "debugServerPath": "${config:OCD_path}/openocd", + }, + "windows": { + "miDebuggerPath": "${config:xPack_GCC_path}/bin/riscv-none-elf-gdb.exe", + "debugServerPath": "${config:OCD_path}/openocd.exe", + }, + "osx": { + "miDebuggerPath": "${config:xPack_GCC_path}/bin/riscv-none-elf-gdb", + "debugServerPath": "${config:OCD_path}/bin/openocd", + }, + "logging": { + "exceptions": true, + "trace": false, + "traceResponse": false, + "engineLogging": false + }, + "miDebuggerServerAddress": "localhost:3334", + "debugServerArgs": "-c \"gdb_port 3334\" -s ${config:OCD_path}/scripts -f interface/${config:RV_OCD_interface_file} -f target/${config:RV_OCD_target_file}", + "serverStarted": "Info : Listening on port 3334 for gdb connections", + "filterStderr": true, + "customLaunchSetupCommands": [ + {"text":"-list-features"} + ], + "targetArchitecture": "arm", + "setupCommands": [ + { "text":"set logging overwrite on"}, + { "text":"set logging file debug-riscv.log"}, + { "text":"set logging on"}, + { "text":"cd ${workspaceFolder}" }, + { "text": "set architecture riscv:rv32", "ignoreFailures": false }, + { "text":"exec-file build/${config:program_file}", "ignoreFailures": false }, + { "text":"symbol-file buildrv/${config:symbol_file}", "ignoreFailures": false }, + { "text":"target remote localhost:3334" }, + { "text":"b main" }, + { "text": "set $pc=Reset_Handler","ignoreFailures": false } + ] + } + ] +} diff --git a/Examples/MAX32665/AUDIO_Playback/.vscode/settings.json b/Examples/MAX32665/AUDIO_Playback/.vscode/settings.json new file mode 100644 index 00000000000..3aa08c1d937 --- /dev/null +++ b/Examples/MAX32665/AUDIO_Playback/.vscode/settings.json @@ -0,0 +1,78 @@ +{ + "terminal.integrated.env.windows": { + "Path":"${config:OCD_path};${config:ARM_GCC_path}/bin;${config:xPack_GCC_path}/bin;${config:MSYS_path}/usr/bin;${config:Make_path};${env:PATH}", + "MAXIM_PATH":"${config:MAXIM_PATH}" + }, + "terminal.integrated.defaultProfile.windows": "Command Prompt", + + "terminal.integrated.env.linux": { + "PATH":"${config:OCD_path}:${config:ARM_GCC_path}/bin:${config:xPack_GCC_path}/bin:${env:PATH}", + "MAXIM_PATH":"${config:MAXIM_PATH}" + }, + "terminal.integrated.env.osx": { + "PATH":"${config:OCD_path}/bin:${config:ARM_GCC_path}/bin:${config:xPack_GCC_path}/bin:${env:PATH}", + "MAXIM_PATH":"${config:MAXIM_PATH}" + }, + + "target":"MAX32665", + "board":"EvKit_V1", + + "project_name":"${workspaceFolderBasename}", + + "program_file":"${config:project_name}.elf", + "symbol_file":"${config:program_file}", + + "M4_OCD_interface_file":"cmsis-dap.cfg", + "M4_OCD_target_file":"max32665.cfg", + "RV_OCD_interface_file":"ftdi/olimex-arm-usb-ocd-h.cfg", + "RV_OCD_target_file":"${config:target}_riscv.cfg", + + "v_Arm_GCC":"10.3", + "v_xPack_GCC":"12.2.0-3.1", + + "OCD_path":"${config:MAXIM_PATH}/Tools/OpenOCD", + "ARM_GCC_path":"${config:MAXIM_PATH}/Tools/GNUTools/${config:v_Arm_GCC}", + "xPack_GCC_path":"${config:MAXIM_PATH}/Tools/xPack/riscv-none-elf-gcc/${config:v_xPack_GCC}", + "Make_path":"${config:MAXIM_PATH}/Tools/GNUTools/Make", + "MSYS_path":"${config:MAXIM_PATH}/Tools/MSYS2", + + "C_Cpp.default.includePath": [ + "${workspaceFolder}", + "${workspaceFolder}/**", + "${config:MAXIM_PATH}/Libraries/Boards/${config:target}/Include", + "${config:MAXIM_PATH}/Libraries/Boards/${config:target}/${config:board}/Include", + "${config:MAXIM_PATH}/Libraries/CMSIS/Device/Maxim/${config:target}/Include", + "${config:MAXIM_PATH}/Libraries/CMSIS/Include", + "${config:ARM_GCC_path}/arm-none-eabi/include", + "${config:ARM_GCC_path}/lib/gcc/arm-none-eabi/${config:v_Arm_GCC}/include", + "${config:MAXIM_PATH}/Libraries/PeriphDrivers/Include/${config:target}", + "${config:MAXIM_PATH}/Libraries/MiscDrivers/Camera", + "${config:MAXIM_PATH}/Libraries/MiscDrivers/Display", + "${config:MAXIM_PATH}/Libraries/MiscDrivers/ExtMemory", + "${config:MAXIM_PATH}/Libraries/MiscDrivers/LED", + "${config:MAXIM_PATH}/Libraries/MiscDrivers/PMIC", + "${config:MAXIM_PATH}/Libraries/MiscDrivers/PushButton", + "${config:MAXIM_PATH}/Libraries/MiscDrivers/Touchscreen" + ], + "C_Cpp.default.browse.path": [ + "${workspaceFolder}", + "${config:MAXIM_PATH}/Libraries/Boards/${config:target}/Source", + "${config:MAXIM_PATH}/Libraries/Boards/${config:target}/${config:board}/Source", + "${config:MAXIM_PATH}/Libraries/PeriphDrivers/Source", + "${config:MAXIM_PATH}/Libraries/MiscDrivers/Camera", + "${config:MAXIM_PATH}/Libraries/MiscDrivers/Display", + "${config:MAXIM_PATH}/Libraries/MiscDrivers/LED", + "${config:MAXIM_PATH}/Libraries/MiscDrivers/PMIC", + "${config:MAXIM_PATH}/Libraries/MiscDrivers/PushButton", + "${config:MAXIM_PATH}/Libraries/MiscDrivers/Touchscreen", + "${config:MAXIM_PATH}/Libraries/MiscDrivers" + ], + "C_Cpp.default.defines": [ + + ], + "C_Cpp.default.forcedInclude": [ + "${workspaceFolder}/build/project_defines.h" + ], + "cmake.configureOnOpen": false +} + diff --git a/Examples/MAX32665/AUDIO_Playback/.vscode/tasks.json b/Examples/MAX32665/AUDIO_Playback/.vscode/tasks.json new file mode 100644 index 00000000000..e95445e2b3e --- /dev/null +++ b/Examples/MAX32665/AUDIO_Playback/.vscode/tasks.json @@ -0,0 +1,115 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "type": "shell", + "command": "make -r -j 8 --output-sync=target --no-print-directory TARGET=${config:target} BOARD=${config:board} MAXIM_PATH=${config:MAXIM_PATH} MAKE=make PROJECT=${config:project_name}", + "osx":{ + "command": "source ~/.zshrc && make -r -j 8 --output-sync=target --no-print-directory TARGET=${config:target} BOARD=${config:board} MAXIM_PATH=${config:MAXIM_PATH} MAKE=make PROJECT=${config:project_name}" + }, + "group": "build", + "problemMatcher": [] + }, + { + "label": "clean", + "type": "shell", + "command": "make -j 8 clean --output-sync=target --no-print-directory TARGET=${config:target} BOARD=${config:board} MAXIM_PATH=${config:MAXIM_PATH} MAKE=make PROJECT=${config:project_name}", + "osx":{ + "command": "source ~/.zshrc && make -j 8 clean --output-sync=target --no-print-directory TARGET=${config:target} BOARD=${config:board} MAXIM_PATH=${config:MAXIM_PATH} MAKE=make PROJECT=${config:project_name}" + }, + "group": "build", + "problemMatcher": [] + }, + { + "label": "clean-periph", + "type": "shell", + "command": "make -j 8 distclean --output-sync=target --no-print-directory TARGET=${config:target} BOARD=${config:board} MAXIM_PATH=${config:MAXIM_PATH} MAKE=make PROJECT=${config:project_name}", + "osx":{ + "command": "source ~/.zshrc && make -j 8 distclean --output-sync=target --no-print-directory TARGET=${config:target} BOARD=${config:board} MAXIM_PATH=${config:MAXIM_PATH} MAKE=make PROJECT=${config:project_name}" + }, + "group": "build", + "problemMatcher": [] + }, + { + "label": "flash", + "type": "shell", + "command": "arm-none-eabi-gdb", + "args": [ + "--cd=\"${workspaceFolder}\"", + "--se=\"build/${config:program_file}\"", + "--symbols=build/${config:symbol_file}", + "-x=\"${workspaceFolder}/.vscode/flash.gdb\"", + "--ex=\"flash_m4 ${config:OCD_path} ${config:M4_OCD_interface_file} ${config:M4_OCD_target_file}\"", + "--batch" + ], + "group": "build", + "problemMatcher": [], + "dependsOn":["build"] + }, + { + "label": "flash & run", + "type": "shell", + "command": "arm-none-eabi-gdb", + "args": [ + "--cd=\"${workspaceFolder}\"", + "--se=\"build/${config:program_file}\"", + "--symbols=build/${config:symbol_file}", + "-x=\"${workspaceFolder}/.vscode/flash.gdb\"", + "--ex=\"flash_m4_run ${config:OCD_path} ${config:M4_OCD_interface_file} ${config:M4_OCD_target_file}\"", + "--batch" + ], + "group": "build", + "problemMatcher": [], + "dependsOn":["build"] + }, + { + "label": "erase flash", + "type": "shell", + "command": "openocd", + "args": [ + "-s", "${config:OCD_path}/scripts", + "-f", "interface/${config:M4_OCD_interface_file}", + "-f", "target/${config:M4_OCD_target_file}", + "-c", "\"init; reset halt; max32xxx mass_erase 0;\"", + "-c", "exit" + ], + "group":"build", + "problemMatcher": [], + "dependsOn":[] + }, + { + "label": "openocd (m4)", + "type": "shell", + "command": "openocd", + "args": [ + "-s", + "${config:OCD_path}/scripts", + "-f", + "interface/${config:M4_OCD_interface_file}", + "-f", + "target/${config:M4_OCD_target_file}", + "-c", + "\"init; reset halt\"" + ], + "problemMatcher": [], + "dependsOn":[] + }, + { + "label": "gdb (m4)", + "type": "shell", + "command": "arm-none-eabi-gdb", + "args": [ + "--ex=\"cd ${workspaceFolder}\"", + "--se=\"build/${config:program_file}\"", + "--symbols=build/${config:symbol_file}", + "--ex=\"target remote localhost:3333\"", + "--ex=\"monitor reset halt\"", + "--ex=\"b main\"", + "--ex=\"c\"" + ], + "problemMatcher": [], + "dependsOn":[] + }, + ] +} \ No newline at end of file diff --git a/Examples/MAX32665/AUDIO_Playback/MAX32666_I2S_Example.launch b/Examples/MAX32665/AUDIO_Playback/MAX32666_I2S_Example.launch new file mode 100644 index 00000000000..d35bc69d8f3 --- /dev/null +++ b/Examples/MAX32665/AUDIO_Playback/MAX32666_I2S_Example.launch @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Examples/MAX32665/AUDIO_Playback/Makefile b/Examples/MAX32665/AUDIO_Playback/Makefile new file mode 100644 index 00000000000..ba87cf69828 --- /dev/null +++ b/Examples/MAX32665/AUDIO_Playback/Makefile @@ -0,0 +1,395 @@ +################################################################################ + # Copyright (C) 2023 Maxim Integrated Products, Inc., All Rights Reserved. + # + # Permission is hereby granted, free of charge, to any person obtaining a + # copy of this software and associated documentation files (the "Software"), + # to deal in the Software without restriction, including without limitation + # the rights to use, copy, modify, merge, publish, distribute, sublicense, + # and/or sell copies of the Software, and to permit persons to whom the + # Software is furnished to do so, subject to the following conditions: + # + # The above copyright notice and this permission notice shall be included + # in all copies or substantial portions of the Software. + # + # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + # IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES + # OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + # OTHER DEALINGS IN THE SOFTWARE. + # + # Except as contained in this notice, the name of Maxim Integrated + # Products, Inc. shall not be used except as stated in the Maxim Integrated + # Products, Inc. Branding Policy. + # + # The mere transfer of this software does not imply any licenses + # of trade secrets, proprietary technology, copyrights, patents, + # trademarks, maskwork rights, or any other form of intellectual + # property whatsoever. Maxim Integrated Products, Inc. retains all + # ownership rights. + # +############################################################################### + +# ** Readme! ** +# Don't edit this file! This is the core Makefile for a MaximSDK +# project. The available configuration options can be overridden +# in "project.mk", on the command-line, or with system environment +# variables. + +# See https://analog-devices-msdk.github.io/msdk/USERGUIDE/#build-system +# for more detailed instructions on how to use this system. + +# The detailed instructions mentioned above are easier to read than +# this file, but the comments found in this file also outline the +# available configuration variables. This file is organized into +# sub-sections, some of which expose config variables. + + +# ******************************************************************************* +# Set the target microcontroller and board to compile for. + +# Every TARGET microcontroller has some Board Support Packages (BSPs) that are +# available for it under the MaximSDK/Libraries/Boards/TARGET folder. The BSP +# that gets selected is MaximSDK/Libraries/Boards/TARGET/BOARD. + +# Configuration Variables: +# - TARGET : Override the default target microcontroller. Ex: TARGET=MAX78000 +# - BOARD : Override the default BSP (case sensitive). Ex: BOARD=EvKit_V1, BOARD=FTHR_RevA + + +ifeq "$(TARGET)" "" +# Default target microcontroller +TARGET := MAX32665 +TARGET_UC := MAX32665 +TARGET_LC := max32665 +else +# "TARGET" has been overridden in the environment or on the command-line. +# We need to calculate an upper and lowercase version of the part number, +# because paths on Linux and MacOS are case-sensitive. +TARGET_UC := $(subst m,M,$(subst a,A,$(subst x,X,$(TARGET)))) +TARGET_LC := $(subst M,m,$(subst A,a,$(subst X,x,$(TARGET)))) +endif + +# Default board. +BOARD ?= EvKit_V1 + +# ******************************************************************************* +# Locate the MaximSDK + +# This Makefile needs to know where to find the MaximSDK, and the MAXIM_PATH variable +# should point to the root directory of the MaximSDK installation. Setting this manually +# is usually only required if you're working on the command-line. + +# If MAXIM_PATH is not specified, we assume the project still lives inside of the MaximSDK +# and move up from this project's original location. + +# Configuration Variables: +# - MAXIM_PATH : Tell this Makefile where to find the MaximSDK. Ex: MAXIM_PATH=C:/MaximSDK + + +ifneq "$(MAXIM_PATH)" "" +# Sanitize MAXIM_PATH for backslashes +MAXIM_PATH := $(subst \,/,$(MAXIM_PATH)) +# Locate some other useful paths... +LIBS_DIR := $(abspath $(MAXIM_PATH)/Libraries) +CMSIS_ROOT := $(LIBS_DIR)/CMSIS +endif + +# ******************************************************************************* +# Include project Makefile. We do this after formulating TARGET, BOARD, and MAXIM_PATH +# in case project.mk needs to reference those values. However, we also include +# this as early as possible in the Makefile so that it can append to or override +# the variables below. + + +PROJECTMK ?= $(abspath ./project.mk) +include $(PROJECTMK) +$(info Loaded project.mk) +# PROJECTMK is also used by implicit rules and other libraries to add project.mk as a watch file + +# ******************************************************************************* +# Final path sanitization and re-calculation. No options here. + +ifeq "$(MAXIM_PATH)" "" +# MAXIM_PATH is still not defined... +DEPTH := ../../../ +MAXIM_PATH := $(abspath $(DEPTH)) +$(warning Warning: MAXIM_PATH is not set! Set MAXIM_PATH in your environment or in project.mk to clear this warning.) +$(warning Warning: Attempting to use $(MAXIM_PATH) calculated from relative path) +else +# Sanitize MAXIM_PATH for backslashes +MAXIM_PATH := $(subst \,/,$(MAXIM_PATH)) +endif + +# Final recalculation of LIBS_DIR/CMSIS_ROOT +LIBS_DIR := $(abspath $(MAXIM_PATH)/Libraries) +CMSIS_ROOT := $(LIBS_DIR)/CMSIS + +# One final UC/LC check in case user set TARGET in project.mk +TARGET_UC := $(subst m,M,$(subst a,A,$(subst x,X,$(TARGET)))) +TARGET_LC := $(subst M,m,$(subst A,a,$(subst X,x,$(TARGET)))) + +export TARGET +export TARGET_UC +export TARGET_LC +export CMSIS_ROOT +# TODO: Remove dependency on exports for these variables. + +# ******************************************************************************* +# Set up search paths, and auto-detect all source code on those paths. + +# The following paths are searched by default, where "./" is the project directory. +# ./ +# |- *.h +# |- *.c +# |-include (optional) +# |- *.h +# |-src (optional) +# |- *.c + +# Configuration Variables: +# - VPATH : Tell this Makefile to search additional locations for source (.c) files. +# You should use the "+=" operator with this option. +# Ex: VPATH += your/new/path +# - IPATH : Tell this Makefile to search additional locations for header (.h) files. +# You should use the "+=" operator with this option. +# Ex: VPATH += your/new/path +# - SRCS : Tell this Makefile to explicitly add a source (.c) file to the build. +# This is really only useful if you want to add a source file that isn't +# on any VPATH, in which case you can add the full path to the file here. +# You should use the "+=" operator with this option. +# Ex: SRCS += your/specific/source/file.c +# - AUTOSEARCH : Set whether this Makefile should automatically detect .c files on +# VPATH and add them to the build. This is enabled by default. Set +# to 0 to disable. If autosearch is disabled, source files must be +# manually added to SRCS. +# Ex: AUTOSEARCH = 0 + + +# Where to find source files for this project. +VPATH += . +VPATH += src +VPATH := $(VPATH) + +# Where to find header files for this project +IPATH += . +IPATH += include +IPATH := $(IPATH) + +AUTOSEARCH ?= 1 +ifeq ($(AUTOSEARCH), 1) +# Auto-detect all C/C++ source files on VPATH +SRCS += $(wildcard $(addsuffix /*.c, $(VPATH))) +SRCS += $(wildcard $(addsuffix /*.cpp, $(VPATH))) +endif + +# Collapse SRCS before passing them on to the next stage +SRCS := $(SRCS) + +# ******************************************************************************* +# Set the output filename + +# Configuration Variables: +# - PROJECT : Override the default output filename. Ex: PROJECT=MyProject + + +# The default value creates a file named after the target micro. Ex: MAX78000.elf +PROJECT ?= $(TARGET_LC) + +# ******************************************************************************* +# Compiler options + +# Configuration Variables: +# - DEBUG : Set DEBUG=1 to build explicitly for debugging. This adds some additional +# symbols and sets -Og as the default optimization level. +# - MXC_OPTIMIZE_CFLAGS : Override the default compiler optimization level. +# Ex: MXC_OPTIMIZE_CFLAGS = -O2 +# - PROJ_CFLAGS : Add additional compiler flags to the build. +# You should use the "+=" operator with this option. +# Ex: PROJ_CFLAGS += -Wextra +# - MFLOAT_ABI : Set the floating point acceleration level. +# The only options are "hard", "soft", or "softfp". +# Ex: MFLOAT_ABI = hard +# - LINKERFILE : Override the default linkerfile. +# Ex: LINKERFILE = customlinkerfile.ld +# - LINKERPATH : Override the default search location for $(LINKERFILE) +# The default search location is $(CMSIS_ROOT)/Device/Maxim/$(TARGET_UC)/Source/GCC +# If $(LINKERFILE) cannot be found at this path, then the root project +# directory will be used as a fallback. + +# Select 'GCC' or 'IAR' compiler +ifeq "$(COMPILER)" "" +COMPILER := GCC +endif + +# Set default compiler optimization levels +ifeq "$(MAKECMDGOALS)" "release" +# Default optimization level for "release" builds (make release) +MXC_OPTIMIZE_CFLAGS ?= -O2 +DEBUG = 0 +endif + +ifeq ($(DEBUG),1) +# Optimizes for debugging as recommended +# by GNU for code-edit-debug cycles +# https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#Optimize-Options +MXC_OPTIMIZE_CFLAGS := -Og +endif + +# Default level if not building for release or explicitly for debug +MXC_OPTIMIZE_CFLAGS ?= -Og + +# Set compiler flags +PROJ_CFLAGS += -Wall # Enable warnings +PROJ_CFLAGS += -DMXC_ASSERT_ENABLE + +# Set hardware floating point acceleration. +# Options are: +# - hard +# - soft +# - softfp (default if MFLOAT_ABI is not set) +MFLOAT_ABI ?= softfp +# MFLOAT_ABI must be exported to other Makefiles +export MFLOAT_ABI + +# This path contains system-level intialization files for the target micro. Add to the build. +VPATH += $(CMSIS_ROOT)/Device/Maxim/$(TARGET_UC)/Source + +# ******************************************************************************* +# Secure Boot Tools (SBT) + +# This section integrates the Secure Boot Tools. It's intended for use with +# microcontrollers that have a secure bootloader. + +# Enabling SBT integration will add some special rules, such as "make sla", "make scpa", etc. + +# Configuration variables: +# SBT : Toggle SBT integration. Set to 1 to enable, or 0 +# to disable +# MAXIM_SBT_DIR : Specify the location of the SBT tool binaries. This defaults to +# Tools/SBT in the MaximSDK. The standalone SBT installer will override +# this via an environment variable. +# TARGET_SEC : Specify the part number to be passed into the SBT. This should match +# the secure variant part #. The default value will depend on TARGET. +# For example, TARGET=MAX32650 will result in TARGET_SEC=MAX32651, and +# the default selection happens in Tools/SBT/SBT-config. +# However, if there are multiple secure part #s for the target +# microcontroller this variable may need to be changed. + +SBT ?= 0 +ifeq ($(SBT), 1) +MAXIM_SBT_DIR ?= $(MAXIM_PATH)/Tools/SBT +MAXIM_SBT_DIR := $(subst \,/,$(MAXIM_SBT_DIR)) +# ^ Must sanitize path for \ on Windows, since this may come from an environment +# variable. + +export MAXIM_SBT_DIR # SBTs must have this environment variable defined to work + +# SBT-config.mk and SBT-rules.mk are included further down this Makefile. + +endif # SBT + +# ******************************************************************************* +# Default goal selection. This section allows you to override the default goal +# that will run if no targets are specified on the command-line. +# (ie. just running 'make' instead of 'make all') + +# Configuration variables: +# .DEFAULT_GOAL : Set the default goal if no targets were specified on the +# command-line +# ** "override" must be used with this variable. ** +# Ex: "override .DEFAULT_GOAL = mygoal" + +ifeq "$(.DEFAULT_GOAL)" "" +ifeq ($(SBT),1) +override .DEFAULT_GOAL := sla +else +override .DEFAULT_GOAL := all +endif +endif + +# Developer note: 'override' is used above for legacy Makefile compatibility. +# gcc.mk/gcc_riscv.mk need to hard-set 'all' internally, so this new system +# uses 'override' to come in over the top without breaking old projects. + +# It's also necessary to explicitly set MAKECMDGOALS... +ifeq "$(MAKECMDGOALS)" "" +MAKECMDGOALS:=$(.DEFAULT_GOAL) +endif + +# Enable colors when --sync-output is used. +# See https://www.gnu.org/software/make/manual/make.html#Terminal-Output (section 13.2) +ifneq ($(MAKE_TERMOUT),) +PROJ_CFLAGS += -fdiagnostics-color=always +endif + +ifneq ($(FORCE_COLOR),) +PROJ_CFLAGS += -fdiagnostics-color=always +endif + +# ******************************************************************************* +# Include SBT config. We need to do this here because it needs to know +# the current MAKECMDGOAL. +ifeq ($(SBT),1) +include $(MAXIM_PATH)/Tools/SBT/SBT-config.mk +endif + +# ******************************************************************************* +# Libraries + +# This section offers "toggle switches" to include or exclude the libraries that +# are available in the MaximSDK. Set a configuration variable to 1 to include the +# library in the build, or 0 to exclude. + +# Each library may also have its own library specific configuration variables. See +# Libraries/libs.mk for more details. + +# Configuration variables: +# - LIB_BOARD : Include the Board-Support Package (BSP) library. (Enabled by default) +# - LIB_PERIPHDRIVERS : Include the peripheral driver library. (Enabled by default) +# - LIB_CMSIS_DSP : Include the CMSIS-DSP library. +# - LIB_CORDIO : Include the Cordio BLE library +# - LIB_FCL : Include the Free Cryptographic Library (FCL) +# - LIB_FREERTOS : Include the FreeRTOS and FreeRTOS-Plus-CLI libraries +# - LIB_LC3 : Include the Low Complexity Communication Codec (LC3) library +# - LIB_LITTLEFS : Include the "little file system" (littleFS) library +# - LIB_LWIP : Include the lwIP library +# - LIB_MAXUSB : Include the MAXUSB library +# - LIB_SDHC : Include the SDHC library + +include $(LIBS_DIR)/libs.mk + + +# ******************************************************************************* +# Rules + +# Include the rules for building for this target. All other makefiles should be +# included before this one. +include $(CMSIS_ROOT)/Device/Maxim/$(TARGET_UC)/Source/$(COMPILER)/$(TARGET_LC).mk + +# Include the rules that integrate the SBTs. SBTs are a special case that must be +# include after the core gcc rules to extend them. +ifeq ($(SBT), 1) +include $(MAXIM_PATH)/Tools/SBT/SBT-rules.mk +endif + + +# Get .DEFAULT_GOAL working. +ifeq "$(MAKECMDGOALS)" "" +MAKECMDGOALS:=$(.DEFAULT_GOAL) +endif + + +all: +# Extend the functionality of the "all" recipe here + arm-none-eabi-size --format=berkeley $(BUILD_DIR)/$(PROJECT).elf + +libclean: + $(MAKE) -f ${PERIPH_DRIVER_DIR}/periphdriver.mk clean.periph + +clean: +# Extend the functionality of the "clean" recipe here + +# The rule to clean out all the build products. +distclean: clean libclean diff --git a/Examples/MAX32665/AUDIO_Playback/README.md b/Examples/MAX32665/AUDIO_Playback/README.md new file mode 100644 index 00000000000..db6d8002132 --- /dev/null +++ b/Examples/MAX32665/AUDIO_Playback/README.md @@ -0,0 +1,47 @@ +## Description + +This example uses the I2C Master to read/write from/to the I2C Slave. + + +## Software + +### Project Usage + +Universal instructions on building, flashing, and debugging this project can be found in the **[MSDK User Guide](https://analog-devices-msdk.github.io/msdk/USERGUIDE/)**. + +### Project-Specific Build Notes + +(None - this project builds as a standard example) + +## Required Connections + +- Connect a USB cable between the PC and the CN2 (USB/PWR) connector. +- Open an terminal application on the PC and connect to the EV kit's console UART at 115200, 8-N-1. +- You must connect P0.06 (I2C0 SDA) to P0.14 (I2C1 SDA) and P0.07 (I2C0 SCL) to P0.15 (I2C1 SCL). + - This connection may differ on different HW. Please follow the instructions on the console prints. +- Ensure the pull-up resistors are enabled by connecting jumper JP1 or JP2. + +## Expected Output +``` +******** I2C Master-Slave Transaction Demo ********* + +This example uses one I2C peripheral as a master to +read and write to another I2C which acts as a slave. + +You will need to connect P0.6 (I2C0 SDA) to P0.14 (I2C1 SDA) and +P0.7 (I2C0 SCL) to P0.15 (I2C1 SCL). + +-->I2C Master Initialization Complete +-->I2C Slave Initialization Complete + +-->Writing data to slave, and reading the data back + +-->Result: + +-->TxData: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe + +-->RxData: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe + + +-->I2C Transaction Successful +``` \ No newline at end of file diff --git a/Examples/MAX32665/AUDIO_Playback/audio.c b/Examples/MAX32665/AUDIO_Playback/audio.c new file mode 100644 index 00000000000..680444affe0 --- /dev/null +++ b/Examples/MAX32665/AUDIO_Playback/audio.c @@ -0,0 +1,198 @@ +/****************************************************************************** + * Copyright (C) 2023 Maxim Integrated Products, Inc., All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES + * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of Maxim Integrated + * Products, Inc. shall not be used except as stated in the Maxim Integrated + * Products, Inc. Branding Policy. + * + * The mere transfer of this software does not imply any licenses + * of trade secrets, proprietary technology, copyrights, patents, + * trademarks, maskwork rights, or any other form of intellectual + * property whatsoever. Maxim Integrated Products, Inc. retains all + * ownership rights. + * + ******************************************************************************/ + +#include "audio.h" +#include +#include "mxc_device.h" +#include "mxc_assert.h" +#include "mxc_sys.h" +#include "mxc_errors.h" + +/* **** Definitions **** */ + +/* **** Variable Declaration **** */ + +const mxc_gpio_cfg_t gpio_cfg_audio = { MXC_GPIO0, + (MXC_GPIO_PIN_24 | MXC_GPIO_PIN_25 | MXC_GPIO_PIN_26 | + MXC_GPIO_PIN_27), + MXC_GPIO_FUNC_ALT1, + MXC_GPIO_PAD_PULL_UP, + MXC_GPIO_VSSEL_VDDIO, + MXC_GPIO_DRVSTR_0 }; + +/* ************************************************************************* */ +/* Control/Configuration functions */ +/* ************************************************************************* */ + +static int MXC_AUDIO_SetMasterClock(mxc_audio_regs_t *audio) +{ + if (audio == NULL) { + return E_NULL_PTR; + } + + if (!(MXC_GCR->clkcn & MXC_F_GCR_CLKCN_HIRC96M_EN)) { + MXC_GCR->clkcn |= MXC_F_GCR_CLKCN_HIRC96M_EN; + while (!(MXC_GCR->clkcn & MXC_F_GCR_CLKCN_HIRC96M_RDY)) {} + } + + //Enable audio subsytem peripheral clock + MXC_SYS_ClockEnable(MXC_SYS_PERIPH_CLOCK_AUDIO); + //Enable gpio clock and configure as alternate function + MXC_SYS_ClockEnable(MXC_SYS_PERIPH_CLOCK_GPIO0); + MXC_GPIO_Config(&gpio_cfg_audio); + + /* I2S Clock generation */ + // Clear GLOBAL_ENABLE to 0 to disable the audio system. + audio->global_en = 0; + // Set GCR_PCKDIV.audclksel for clock source, 96MHz high-frequency internal oscillato is selected + MXC_GCR->pckdiv &= ~(0x03 << 16); + // Set GLOBAL_ENABLE.enable to 1 to enable the audio subsystem + audio->global_en = 1; + + //Set M and N values for master clock(Set to 12288MHz) + audio->m_val = 125; + audio->n_val = 16; + + return E_NO_ERROR; +} + +static int MXC_AUDIO_EnablePCMMode(mxc_audio_regs_t *audio) +{ + if (audio == NULL) { + return E_NULL_PTR; + } + + //Enable the PCM Mode + audio->modulator_controls |= MXC_F_PDM_PCM_SELECT; + + return E_NO_ERROR; +} + +static int MXC_AUDIO_PCM_Config(mxc_audio_regs_t *audio) +{ + if (audio == NULL) { + return E_NULL_PTR; + } + + //PCM Clock config, BCLK polarity high, 32 BCLK per LRCLK + audio->pcm_clock_setup = MXC_F_PCM_BSEL_32; + + //PCM Confif, 16 bit I2S mode + audio->pcm_config = (MXC_F_PCM_FORMATX_I2S | MXC_F_PCM_CHANSZ_16); + + //Set PCM Clock Dividers + audio->pcm_clock_dividers_msb = + (MXC_F_PCM_BCLK_SEL_BCLK_TOGGLE | MXC_F_PCM_BCLK_MASTER_SEL_MODULATOR_CLK); + audio->pcm_clock_dividers_lsb = 0x06; + + return E_NO_ERROR; +} + +static int MXC_AUDIO_PCM_Tx_Enable(mxc_audio_regs_t *audio) +{ + if (audio == NULL) { + return E_NULL_PTR; + } + + //Set PCM TX dataport and interface sample rates to 192kHz + audio->pcm_tx_sample_rates = (MXC_F_PCM_TX_INTERFACE_SR_192 | MXC_F_PCM_TX_DATAPORT_SR_192); + + //Enable PCM Tx CH0 and CH1 Channels + audio->pcm_tx_enables_byte0 = (MXC_F_PCM_TX_CH0_EN | MXC_F_PCM_TX_CH1_EN); + + //Enables the PCM TRANSMIT dataport channel 0, which is connected to APB Channel TX_PCM_CH 0 + audio->dataport1_slot_mapping_ch0 |= MXC_F_PCM_DPORT1_CH0_EN; + + //Enables the PCM TRANSMIT dataport channel 1, which is connected to APB Channel TX_PCM_CH 1 + audio->dataport1_slot_mapping_ch1 |= MXC_F_PCM_DPORT1_CH1_EN; + + return E_NO_ERROR; +} + +static int MXC_AUDIO_PCM_Rx_Enable(mxc_audio_regs_t *audio) +{ + if (audio == NULL) { + return E_NULL_PTR; + } + + //Set PCM TX dataport and interface sample rates to 192kHz + audio->pcm_rx_sample_rates = (MXC_F_PCM_RX_INTERFACE_SR_192 | MXC_F_PCM_RX_DATAPORT_SR_192); + + //Enable PCM Tx CH0 and CH1 Channels + audio->pcm_rx_enables_byte0 = (MXC_F_PCM_RX_CH0_EN | MXC_F_PCM_RX_CH1_EN); + + //Enables the PCM TRANSMIT dataport channel 0, which is connected to APB Channel TX_PCM_CH 0 + audio->dataport2_slot_mapping_ch0 |= MXC_F_PCM_DPORT2_CH0_EN; + + //Enables the PCM TRANSMIT dataport channel 1, which is connected to APB Channel TX_PCM_CH 1 + audio->dataport2_slot_mapping_ch1 |= MXC_F_PCM_DPORT2_CH1_EN; + + return E_NO_ERROR; +} + +static int MXC_AUDIO_EnableInterrupts(mxc_audio_regs_t *audio) +{ + if (audio == NULL) { + return E_NULL_PTR; + } + audio->int_en |= MXC_F_EN_AE_PCM_RX; + + return E_NO_ERROR; +} + +int MXC_AUDIO_Init(mxc_audio_regs_t *audio) +{ + int err = E_NO_ERROR; + + if (audio == NULL) { + return E_NULL_PTR; + } + + if ((err = MXC_AUDIO_SetMasterClock(audio)) != E_NO_ERROR) { + return err; + } + if ((err = MXC_AUDIO_EnablePCMMode(audio)) != E_NO_ERROR) { + return err; + } + if ((err = MXC_AUDIO_PCM_Config(audio)) != E_NO_ERROR) { + return err; + } + if ((err = MXC_AUDIO_PCM_Tx_Enable(audio)) != E_NO_ERROR) { + return err; + } + if ((err = MXC_AUDIO_PCM_Rx_Enable(audio)) != E_NO_ERROR) { + return err; + } + + return MXC_AUDIO_EnableInterrupts(audio); +} \ No newline at end of file diff --git a/Examples/MAX32665/AUDIO_Playback/audio.h b/Examples/MAX32665/AUDIO_Playback/audio.h new file mode 100644 index 00000000000..ee120a90f06 --- /dev/null +++ b/Examples/MAX32665/AUDIO_Playback/audio.h @@ -0,0 +1,59 @@ +/****************************************************************************** + * Copyright (C) 2023 Maxim Integrated Products, Inc., All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES + * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of Maxim Integrated + * Products, Inc. shall not be used except as stated in the Maxim Integrated + * Products, Inc. Branding Policy. + * + * The mere transfer of this software does not imply any licenses + * of trade secrets, proprietary technology, copyrights, patents, + * trademarks, maskwork rights, or any other form of intellectual + * property whatsoever. Maxim Integrated Products, Inc. retains all + * ownership rights. + * + ******************************************************************************/ + +#ifndef LIBRARIES_PERIPHDRIVERS_SOURCE_AUDIO_H_ +#define LIBRARIES_PERIPHDRIVERS_SOURCE_AUDIO_H_ + +/* **** Includes **** */ +#include +#include "mxc_device.h" +#include "mxc_assert.h" +#include "mxc_sys.h" +#include "audio_regs.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* **** Definitions **** */ + +/* **** Globals **** */ + +/* **** Functions **** */ +int MXC_AUDIO_Init(mxc_audio_regs_t *audio); + +#ifdef __cplusplus +} +#endif + +#endif // LIBRARIES_PERIPHDRIVERS_SOURCE_AUDIO_H_ diff --git a/Examples/MAX32665/AUDIO_Playback/audio_regs.h b/Examples/MAX32665/AUDIO_Playback/audio_regs.h new file mode 100644 index 00000000000..04b14acdd1d --- /dev/null +++ b/Examples/MAX32665/AUDIO_Playback/audio_regs.h @@ -0,0 +1,1139 @@ +/** + * @file audio_regs.h + * @brief Registers, Bit Masks and Bit Positions for the AUDIO Peripheral Module. + */ + +/****************************************************************************** + * Copyright (C) 2023 Maxim Integrated Products, Inc., All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES + * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of Maxim Integrated + * Products, Inc. shall not be used except as stated in the Maxim Integrated + * Products, Inc. Branding Policy. + * + * The mere transfer of this software does not imply any licenses + * of trade secrets, proprietary technology, copyrights, patents, + * trademarks, maskwork rights, or any other form of intellectual + * property whatsoever. Maxim Integrated Products, Inc. retains all + * ownership rights. + * + ******************************************************************************/ + +#ifndef LIBRARIES_PERIPHDRIVERS_SOURCE_AUDIO_REGS_H_ +#define LIBRARIES_PERIPHDRIVERS_SOURCE_AUDIO_REGS_H_ + +/* **** Includes **** */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__ICCARM__) +#pragma system_include +#endif + +#if defined(__CC_ARM) +#pragma anon_unions +#endif +/// @cond +/* + If types are not defined elsewhere (CMSIS) define them here +*/ +#ifndef __IO +#define __IO volatile /*!< Defines 'read / write' permissions */ +#endif +#ifndef __I +#define __I volatile const /*!< Defines 'read only' permissions */ +#endif +#ifndef __O +#define __O volatile /*!< Defines 'write only' permissions */ +#endif +#ifndef __R +#define __R volatile const /*!< Defines 'read only' permissions */ +#endif +/// @endcond + +/* **** Definitions **** */ + +/** + * @ingroup audio + * @defgroup audio_registers PCM_Registers + * @brief Registers, Bit Masks and Bit Positions for the AUDIO Subsystem Peripheral Module. + * @details Audio Subsystem. + */ + +/** + * @ingroup audio_registers + * Structure type to access the AUDIO Registers. + */ + +typedef struct { + __IO uint32_t tx_pdm_ch0_addr; /**< \b 0x00: PDM Tx FIFO Data Channel 0 Register */ + __IO uint32_t tx_pdm_ch1_addr; /**< \b 0x04: PDM Tx FIFO Data Channel 1 Register */ + __I uint32_t rx_pdm_1_ch0_addr; /**< \b 0x08: PDM Rx1 FIFO Data Channel 0 Register */ + __I uint32_t rx_pdm_1_ch1_addr; /**< \b 0x0C: PDM Rx1 FIFO Data Channel 1 Register */ + __I uint32_t rx_pdm_2_ch0_addr; /**< \b 0x10: PDM Rx2 FIFO Data Channel 0 Register */ + __I uint32_t rx_pdm_2_ch1_addr; /**< \b 0x14: PDM Rx2 FIFO Data Channel 1 Register */ + __I uint32_t rx_pdm_3_ch0_addr; /**< \b 0x18: PDM Rx3 FIFO Data Channel 0 Register */ + __I uint32_t rx_pdm_3_ch1_addr; /**< \b 0x1C: PDM Rx3 FIFO Data Channel 1 Register */ + + __IO uint32_t tx_pcm_ch0_addr; /**< \b 0x20: PCM Tx FIFO Data Channel 0 Register */ + __IO uint32_t tx_pcm_ch1_addr; /**< \b 0x24: PCM Tx FIFO Data Channel 1 Register */ + __IO uint32_t tx_pcm_ch2_addr; /**< \b 0x28: PCM Tx FIFO Data Channel 2 Register */ + __IO uint32_t tx_pcm_ch3_addr; /**< \b 0x2C: PCM Tx FIFO Data Channel 3 Register */ + __I uint32_t rx_pcm_ch0_addr; /**< \b 0x30: PCM Rx FIFO Data Channel 0 Register */ + __I uint32_t rx_pcm_ch1_addr; /**< \b 0x34: PCM Rx FIFO Data Channel 1 Register */ + __I uint32_t rx_pcm_ch2_addr; /**< \b 0x38: PCM Rx FIFO Data Channel 2 Register */ + __I uint32_t rx_pcm_ch3_addr; /**< \b 0x3C: PCM Rx FIFO Data Channel 3 Register */ + __I uint32_t rx_pcm_ch4_addr; /**< \b 0x40: PCM Rx FIFO Data Channel 4 Register */ + __I uint32_t rx_pcm_ch5_addr; /**< \b 0x44: PCM Rx FIFO Data Channel 5 Register */ + __I uint32_t rx_pcm_ch6_addr; /**< \b 0x48: PCM Rx FIFO Data Channel 6 Register */ + __I uint32_t rx_pcm_ch7_addr; /**< \b 0x4C: PCM Rx FIFO Data Channel 7 Register */ + + __I uint32_t int_pdm_status; /**< \b 0x50: PDM FIFO Status Register */ + __IO uint32_t int_pdm_clr; /**< \b 0x54: PDM Interrupt Clear Register */ + + __I uint32_t int_pcm_tx_status; /**< \b 0x58: PCM Tx FIFO Status Register */ + __IO uint32_t int_pcm_tx_clr; /**< \b 0x5C: PCM Tx Interrupt Clear Register */ + __I uint32_t int_pcm_rx_status; /**< \b 0x60: PCM Rx FIFO Status Register */ + __IO uint32_t int_pcm_rx_clr; /**< \b 0x64: PCM Rx Interrupt Clear Register */ + __IO uint32_t int_en; /**< \b 0x68: Interrupt Enable Register */ + + __I uint8_t rsv_0x6C_0x7F[0x14]; + + __IO uint32_t m_val; /**< \b 0x80: NM Generator Denominator M Register */ + __I uint32_t rsv_0x840_0x87[0x01]; + __IO uint32_t n_val; /**< \b 0x88: NM Generator Denominator N Register */ + + __I uint8_t rsv_0x8C_0x93[0x08]; + + __IO uint32_t pdm_tx_rate_setup; /**< \b 0x94: PDM Tx Rate Setup Register */ + + __IO uint32_t modulator_controls; /**< \b 0x98: Modulator Configuration Register */ + + __IO uint32_t pdm_tx_control_1; /**< \b 0x9C: PDM Tx Configuration 0 Register */ + __IO uint32_t pdm_rx_rate_setup; /**< \b 0xA0: PDM Rx Clock Configuration Register */ + __IO uint32_t pdm_tx_control_2; /**< \b 0xA4: PDM Tx Configuration 1 Register */ + __IO uint32_t pdm_rx_1_control; /**< \b 0xA8: PDM Rx1 Configuration Register */ + __IO uint32_t pdm_rx_2_control; /**< \b 0xAC: PDM Rx2 Configuration Register */ + __IO uint32_t pdm_rx_3_control; /**< \b 0xB0: PDM Rx3 Configuration Register */ + + __IO uint32_t pcm_clock_dividers_msb; /**< \b 0xB4: PCM BCLK Configuration 0 Register */ + __IO uint32_t pcm_clock_dividers_lsb; /**< \b 0xB8: PCM BCLK Configuration 1 Register */ + __IO uint32_t pcm_clock_setup; /**< \b 0xBC: PCM Clock Configuration Register */ + __IO uint32_t pcm_config; /**< \b 0xC0: PCM Configuration Register */ + + __IO uint32_t + pcm_tx_sample_rates; /**< \b 0xC4: PCM Tx Sample Rate Configuration Register */ + __IO uint32_t + pcm_rx_sample_rates; /**< \b 0xC8: PCM Rx Sample Rate Configuration Register */ + + __IO uint32_t pcm_rx_enables_byte0; /**< \b 0xCC: PCM Rx Channel Enable 0 Register */ + __IO uint32_t pcm_rx_enables_byte1; /**< \b 0xD0: PCM Rx Channel Enable 1 Register */ + + __IO uint32_t pcm_tx_enables_byte0; /**< \b 0xD4: PCM Tx Channel Enable 0 Register */ + __IO uint32_t pcm_tx_enables_byte1; /**< \b 0xD8: PCM Tx Channel Enable 1 Register */ + + __IO uint32_t pcm_tx_hiz_byte0; /**< \b 0xDC: PCM Tx Channel HI-Z Enable 0 Register */ + __IO uint32_t pcm_tx_hiz_byte1; /**< \b 0xE0: PCM Tx Channel HI-Z Enable 1 Register */ + + __IO uint32_t + dataport1_slot_mapping_ch0; /**< \b 0xE4: Dataport 1 Slot Mapping Channel 0 Register */ + __IO uint32_t + dataport1_slot_mapping_ch1; /**< \b 0xE8: Dataport 1 Slot Mapping Channel 1 Register */ + __IO uint32_t + dataport1_slot_mapping_ch2; /**< \b 0xEC: Dataport 1 Slot Mapping Channel 2 Register */ + __IO uint32_t + dataport1_slot_mapping_ch3; /**< \b 0xF0: Dataport 1 Slot Mapping Channel 3 Register */ + __IO uint32_t + dataport2_slot_mapping_ch0; /**< \b 0xF4: Dataport 2 Slot Mapping Channel 0 Register */ + __IO uint32_t + dataport2_slot_mapping_ch1; /**< \b 0xF8: Dataport 2 Slot Mapping Channel 1 Register */ + __IO uint32_t + dataport2_slot_mapping_ch2; /**< \b 0xFC: Dataport 2 Slot Mapping Channel 2 Register */ + __IO uint32_t + dataport2_slot_mapping_ch3; /**< \b 0x100: Dataport 2 Slot Mapping Channel 3 Register */ + __IO uint32_t + dataport2_slot_mapping_ch4; /**< \b 0x104: Dataport 2 Slot Mapping Channel 4 Register */ + __IO uint32_t + dataport2_slot_mapping_ch5; /**< \b 0x108: Dataport 2 Slot Mapping Channel 5 Register */ + __IO uint32_t + dataport2_slot_mapping_ch6; /**< \b 0x10C: Dataport 2 Slot Mapping Channel 6 Register */ + __IO uint32_t + dataport2_slot_mapping_ch7; /**< \b 0x110: Dataport 2 Slot Mapping Channel 7 Register */ + + __IO uint32_t pcm_data_controls; /**< \b 0x114: PCM Data Controls Register */ + __IO uint32_t global_en; /**< \b 0x118: Audio Enable Register */ +} mxc_audio_regs_t; + +/* Register offsets for module AUDIO */ +/** + * @ingroup audio_registers + * @defgroup AUDIO_Register_Offsets Register Offsets + * @brief AUDIO Peripheral Register Offsets from the I2S_REVA Base Peripheral Address. + * @{ + */ + +#define MXC_R_AUDIO_TX_PDM_CH0_ADDR \ + ((uint32_t)0x00000000UL) /**< Offset from AUDIO Base Address: 0x0000 */ +#define MXC_R_AUDIO_TX_PDM_CH1_ADDR \ + ((uint32_t)0x00000004UL) /**< Offset from AUDIO Base Address: 0x0004 */ +#define MXC_R_AUDIO_RX_PDM_1_CH0_ADDR \ + ((uint32_t)0x00000008UL) /**< Offset from AUDIO Base Address: 0x0008 */ +#define MXC_R_AUDIO_RX_PDM_1_CH1_ADDR \ + ((uint32_t)0x0000000CUL) /**< Offset from AUDIO Base Address: 0x000C */ +#define MXC_R_AUDIO_RX_PDM_2_CH0_ADDR \ + ((uint32_t)0x00000010UL) /**< Offset from AUDIO Base Address: 0x0010 */ +#define MXC_R_AUDIO_RX_PDM_2_CH1_ADDR \ + ((uint32_t)0x00000014UL) /**< Offset from AUDIO Base Address: 0x0014 */ +#define MXC_R_AUDIO_RX_PDM_3_CH0_ADDR \ + ((uint32_t)0x00000018UL) /**< Offset from AUDIO Base Address: 0x0018 */ +#define MXC_R_AUDIO_RX_PDM_3_CH1_ADDR \ + ((uint32_t)0x0000001CUL) /**< Offset from AUDIO Base Address: 0x001C */ +#define MXC_R_AUDIO_TX_PCM_CH0_ADDR \ + ((uint32_t)0x00000020UL) /**< Offset from AUDIO Base Address: 0x0020 */ +#define MXC_R_AUDIO_TX_PCM_CH1_ADDR \ + ((uint32_t)0x00000024UL) /**< Offset from AUDIO Base Address: 0x0024 */ +#define MXC_R_AUDIO_TX_PCM_CH2_ADDR \ + ((uint32_t)0x00000028UL) /**< Offset from AUDIO Base Address: 0x0028 */ +#define MXC_R_AUDIO_TX_PCM_CH3_ADDR \ + ((uint32_t)0x0000002CUL) /**< Offset from AUDIO Base Address: 0x002C */ +#define MXC_R_AUDIO_RX_PCM_CH0_ADDR \ + ((uint32_t)0x00000030UL) /**< Offset from AUDIO Base Address: 0x0030 */ +#define MXC_R_AUDIO_RX_PCM_CH1_ADDR \ + ((uint32_t)0x00000034UL) /**< Offset from AUDIO Base Address: 0x0034 */ +#define MXC_R_AUDIO_RX_PCM_CH2_ADDR \ + ((uint32_t)0x00000038UL) /**< Offset from AUDIO Base Address: 0x0038 */ +#define MXC_R_AUDIO_RX_PCM_CH3_ADDR \ + ((uint32_t)0x0000003CUL) /**< Offset from AUDIO Base Address: 0x003C */ +#define MXC_R_AUDIO_RX_PCM_CH4_ADDR \ + ((uint32_t)0x00000040UL) /**< Offset from AUDIO Base Address: 0x0040 */ +#define MXC_R_AUDIO_RX_PCM_CH5_ADDR \ + ((uint32_t)0x00000044UL) /**< Offset from AUDIO Base Address: 0x0044 */ +#define MXC_R_AUDIO_RX_PCM_CH6_ADDR \ + ((uint32_t)0x00000048UL) /**< Offset from AUDIO Base Address: 0x0048 */ +#define MXC_R_AUDIO_RX_PCM_CH7_ADDR \ + ((uint32_t)0x0000004CUL) /**< Offset from AUDIO Base Address: 0x004C */ +#define MXC_R_AUDIO_INT_PDM_STATUS \ + ((uint32_t)0x00000050UL) /**< Offset from AUDIO Base Address: 0x0050 */ +#define MXC_R_AUDIO_INT_PDM_CLR \ + ((uint32_t)0x00000054UL) /**< Offset from AUDIO Base Address: 0x0054 */ +#define MXC_R_AUDIO_INT_PCM_TX_STATUS \ + ((uint32_t)0x00000058UL) /**< Offset from AUDIO Base Address: 0x0058 */ +#define MXC_R_AUDIO_INT_PCM_TX_CLR \ + ((uint32_t)0x0000005CUL) /**< Offset from AUDIO Base Address: 0x005C */ +#define MXC_R_AUDIO_INT_PCM_RX_STATUS \ + ((uint32_t)0x00000060UL) /**< Offset from AUDIO Base Address: 0x0060 */ +#define MXC_R_AUDIO_INT_PCM_RX_CLR \ + ((uint32_t)0x00000064UL) /**< Offset from AUDIO Base Address: 0x0064 */ +#define MXC_R_AUDIO_INT_EN \ + ((uint32_t)0x00000068UL) /**< Offset from AUDIO Base Address: 0x0068 */ +#define MXC_R_AUDIO_M_VAL \ + ((uint32_t)0x00000080UL) /**< Offset from AUDIO Base Address: 0x0080 */ +#define MXC_R_AUDIO_RES \ + ((uint32_t)0x00000084UL) /**< Offset from AUDIO Base Address: 0x0084 */ +#define MXC_R_AUDIO_N_VAL \ + ((uint32_t)0x00000088UL) /**< Offset from AUDIO Base Address: 0x0088 */ +#define MXC_R_AUDIO_PDM_TX_RATE_SETUP \ + ((uint32_t)0x00000094UL) /**< Offset from AUDIO Base Address: 0x0094 */ +#define MXC_R_AUDIO_MODULATOR_CONTROLS \ + ((uint32_t)0x00000098UL) /**< Offset from AUDIO Base Address: 0x0098 */ +#define MXC_R_AUDIO_PDM_TX_CONTROL_1 \ + ((uint32_t)0x0000009CUL) /**< Offset from AUDIO Base Address: 0x009C */ +#define MXC_R_AUDIO_PDM_RX_RATE_SETUP \ + ((uint32_t)0x000000A0UL) /**< Offset from AUDIO Base Address: 0x00A0 */ +#define MXC_R_AUDIO_PDM_TX_CONTROL_2 \ + ((uint32_t)0x000000A4UL) /**< Offset from AUDIO Base Address: 0x00A4 */ +#define MXC_R_AUDIO_PDM_RX_1_CONTROL \ + ((uint32_t)0x000000A8UL) /**< Offset from AUDIO Base Address: 0x00A8 */ +#define MXC_R_AUDIO_PDM_RX_2_CONTROL \ + ((uint32_t)0x000000ACUL) /**< Offset from AUDIO Base Address: 0x00AC */ +#define MXC_R_AUDIO_PDM_RX_3_CONTROL \ + ((uint32_t)0x000000B0UL) /**< Offset from AUDIO Base Address: 0x00B0 */ +#define MXC_R_AUDIO_PCM_CLOCK_DIVIDERS_MSB \ + ((uint32_t)0x000000B4UL) /**< Offset from AUDIO Base Address: 0x00B4 */ +#define MXC_R_AUDIO_PCM_CLOCK_DIVIDERS_LSB \ + ((uint32_t)0x000000B8UL) /**< Offset from AUDIO Base Address: 0x00B8 */ +#define MXC_R_AUDIO_PCM_CLOCK_SET_UP \ + ((uint32_t)0x000000BCUL) /**< Offset from AUDIO Base Address: 0x00BC */ +#define MXC_R_AUDIO_PCM_CONFIG \ + ((uint32_t)0x000000C0UL) /**< Offset from AUDIO Base Address: 0x00C0 */ +#define MXC_R_AUDIO_PCM_TX_SAMPLE_RATES \ + ((uint32_t)0x000000C4UL) /**< Offset from AUDIO Base Address: 0x00C4 */ +#define MXC_R_AUDIO_PCM_RX_SAMPLE_RATES \ + ((uint32_t)0x000000C8UL) /**< Offset from AUDIO Base Address: 0x00C8 */ +#define MXC_R_AUDIO_PCM_RX_ENABLES_BYTE0 \ + ((uint32_t)0x000000CCUL) /**< Offset from AUDIO Base Address: 0x00CC */ +#define MXC_R_AUDIO_PCM_RX_ENABLES_BYTE1 \ + ((uint32_t)0x000000D0UL) /**< Offset from AUDIO Base Address: 0x00D0 */ +#define MXC_R_AUDIO_PCM_TX_ENABLES_BYTE0 \ + ((uint32_t)0x000000D4UL) /**< Offset from AUDIO Base Address: 0x00D4 */ +#define MXC_R_AUDIO_PCM_TX_ENABLES_BYTE1 \ + ((uint32_t)0x000000D8UL) /**< Offset from AUDIO Base Address: 0x00D8 */ +#define MXC_R_AUDIO_PCM_TX_HIZ_BYTE0 \ + ((uint32_t)0x000000DCUL) /**< Offset from AUDIO Base Address: 0x00DC */ +#define MXC_R_AUDIO_PCM_TX_HIZ_BYTE1 \ + ((uint32_t)0x000000E0UL) /**< Offset from AUDIO Base Address: 0x00E0 */ +#define MXC_R_AUDIO_DATAPORT1_SLOT_MAPPING_CH0 \ + ((uint32_t)0x000000E4UL) /**< Offset from AUDIO Base Address: 0x00E4 */ +#define MXC_R_AUDIO_DATAPORT1_SLOT_MAPPING_CH1 \ + ((uint32_t)0x000000E8UL) /**< Offset from AUDIO Base Address: 0x00E8 */ +#define MXC_R_AUDIO_DATAPORT1_SLOT_MAPPING_CH2 \ + ((uint32_t)0x000000ECUL) /**< Offset from AUDIO Base Address: 0x00EC */ +#define MXC_R_AUDIO_DATAPORT1_SLOT_MAPPING_CH3 \ + ((uint32_t)0x000000F0UL) /**< Offset from AUDIO Base Address: 0x00F0 */ +#define MXC_R_AUDIO_DATAPORT2_SLOT_MAPPING_CH0 \ + ((uint32_t)0x000000F4UL) /**< Offset from AUDIO Base Address: 0x00F4 */ +#define MXC_R_AUDIO_DATAPORT2_SLOT_MAPPING_CH1 \ + ((uint32_t)0x000000F8UL) /**< Offset from AUDIO Base Address: 0x00F8 */ +#define MXC_R_AUDIO_DATAPORT2_SLOT_MAPPING_CH2 \ + ((uint32_t)0x000000FCUL) /**< Offset from AUDIO Base Address: 0x00FC */ +#define MXC_R_AUDIO_DATAPORT2_SLOT_MAPPING_CH3 \ + ((uint32_t)0x00000100UL) /**< Offset from AUDIO Base Address: 0x0100 */ +#define MXC_R_AUDIO_DATAPORT2_SLOT_MAPPING_CH4 \ + ((uint32_t)0x00000104UL) /**< Offset from AUDIO Base Address: 0x0104 */ +#define MXC_R_AUDIO_DATAPORT2_SLOT_MAPPING_CH5 \ + ((uint32_t)0x00000108UL) /**< Offset from AUDIO Base Address: 0x0108 */ +#define MXC_R_AUDIO_DATAPORT2_SLOT_MAPPING_CH6 \ + ((uint32_t)0x0000010CUL) /**< Offset from AUDIO Base Address: 0x010C */ +#define MXC_R_AUDIO_DATAPORT2_SLOT_MAPPING_CH7 \ + ((uint32_t)0x00000110UL) /**< Offset from AUDIO Base Address: 0x0110 */ +#define MXC_R_AUDIO_PCM_DATA_CONTROLS \ + ((uint32_t)0x00000114UL) /**< Offset from AUDIO Base Address: 0x0114 */ +#define MXC_R_AUDIO_GLOBAL_EN \ + ((uint32_t)0x00000118UL) /**< Offset from AUDIO Base Address: 0x0000 */ + +/**@} end of group audio_registers */ + +/** + * @ingroup audio_registers + * @defgroup AUDIO_INT_PDM_STATUS AUDIO_INT_PDM_STATUS + * @brief PDM Interrupt Status. + * @{ + */ +#define MXC_F_PDM_RX3_FIFO_CH1_ALMOST_EMPTY_POS \ + 8 /**< MXC_F_PDM_RX3_FIFO_CH1_ALMOST_EMPTY_POS Position */ +#define MXC_F_PDM_RX3_FIFO_CH1_ALMOST_EMPTY \ + ((uint32_t)(0x1UL \ + << MXC_F_PDM_RX3_FIFO_CH1_ALMOST_EMPTY_POS)) /**< MXC_F_PDM_RX3_FIFO_CH1_ALMOST_EMPTY_POS Mask */ + +#define MXC_F_PDM_RX3_FIFO_CH0_ALMOST_EMPTY_POS \ + 9 /**< MXC_F_PDM_RX3_FIFO_CH0_ALMOST_EMPTY_POS Position */ +#define MXC_F_PDM_RX3_FIFO_CH0_ALMOST_EMPTY \ + ((uint32_t)(0x1UL \ + << MXC_F_PDM_RX3_FIFO_CH0_ALMOST_EMPTY_POS)) /**< MXC_F_PDM_RX3_FIFO_CH0_ALMOST_EMPTY_POS Mask */ + +#define MXC_F_PDM_RX2_FIFO_CH1_ALMOST_EMPTY_POS \ + 10 /**< MXC_F_PDM_RX2_FIFO_CH1_ALMOST_EMPTY_POS Position */ +#define MXC_F_PDM_RX2_FIFO_CH1_ALMOST_EMPTY \ + ((uint32_t)(0x1UL \ + << MXC_F_PDM_RX2_FIFO_CH1_ALMOST_EMPTY_POS)) /**< MXC_F_PDM_RX2_FIFO_CH1_ALMOST_EMPTY_POS Mask */ + +#define MXC_F_PDM_RX02FIFO_CH0_ALMOST_EMPTY_POS \ + 11 /**< MXC_F_PDM_RX02FIFO_CH0_ALMOST_EMPTY_POS Position */ +#define MXC_F_PDM_RX02FIFO_CH0_ALMOST_EMPTY \ + ((uint32_t)(0x1UL \ + << MXC_F_PDM_RX02FIFO_CH0_ALMOST_EMPTY_POS)) /**< MXC_F_PDM_RX02FIFO_CH0_ALMOST_EMPTY_POS Mask */ + +#define MXC_F_PDM_RX1_FIFO_CH1_ALMOST_EMPTY_POS \ + 12 /**< MXC_F_PDM_RX1_FIFO_CH1_ALMOST_EMPTY_POS Position */ +#define MXC_F_PDM_RX1_FIFO_CH1_ALMOST_EMPTY \ + ((uint32_t)(0x1UL \ + << MXC_F_PDM_RX1_FIFO_CH1_ALMOST_EMPTY_POS)) /**< MXC_F_PDM_RX1_FIFO_CH1_ALMOST_EMPTY_POS Mask */ + +#define MXC_F_PDM_RX1_FIFO_CH0_ALMOST_EMPTY_POS \ + 13 /**< MXC_F_PDM_RX1_FIFO_CH0_ALMOST_EMPTY_POS Position */ +#define MXC_F_PDM_RX1_FIFO_CH0_ALMOST_EMPTY \ + ((uint32_t)(0x1UL \ + << MXC_F_PDM_RX1_FIFO_CH0_ALMOST_EMPTY_POS)) /**< MXC_F_PDM_RX1_FIFO_CH0_ALMOST_EMPTY_POS Mask */ + +#define MXC_F_PDM_TX_FIFO_CH1_ALMOST_EMPTY_POS \ + 14 /**< MXC_F_PDM_TX_FIFO_CH1_ALMOST_EMPTY_POS Position */ +#define MXC_F_PDM_TX_FIFO_CH1_ALMOST_EMPTY \ + ((uint32_t)(0x1UL \ + << MXC_F_PDM_TX_FIFO_CH1_ALMOST_EMPTY_POS)) /**< MXC_F_PDM_TX_FIFO_CH1_ALMOST_EMPTY_POS Mask */ + +#define MXC_F_PDM_TX_FIFO_CH0_ALMOST_EMPTY_POS \ + 15 /**< MXC_F_PDM_TX_FIFO_CH0_ALMOST_EMPTY_POS Position */ +#define MXC_F_PDM_TX_FIFO_CH0_ALMOST_EMPTY \ + ((uint32_t)(0x1UL \ + << MXC_F_PDM_TX_FIFO_CH0_ALMOST_EMPTY_POS)) /**< MXC_F_PDM_TX_FIFO_CH0_ALMOST_EMPTY_POS Mask */ + +#define MXC_F_PDM_RX3_FIFO_CH1_HALF_FULL_POS \ + 16 /**< MXC_F_PDM_RX3_FIFO_CH1_HALF_FULL_POS Position */ +#define MXC_F_PDM_RX3_FIFO_CH1_HALF_FULL \ + ((uint32_t)(0x1UL \ + << MXC_F_PDM_RX3_FIFO_CH1_HALF_FULL_POS)) /**< MXC_F_PDM_RX3_FIFO_CH1_HALF_FULL_POS Mask */ + +#define MXC_F_PDM_RX3_FIFO_CH0_HALF_FULL_POS \ + 17 /**< MXC_F_PDM_RX3_FIFO_CH0_HALF_FULL_POS Position */ +#define MXC_F_PDM_RX3_FIFO_CH0_HALF_FULL \ + ((uint32_t)(0x1UL \ + << MXC_F_PDM_RX3_FIFO_CH0_HALF_FULL_POS)) /**< MXC_F_PDM_RX3_FIFO_CH0_HALF_FULL_POS Mask */ + +#define MXC_F_PDM_RX2_FIFO_CH1_HALF_FULL_POS \ + 18 /**< MXC_F_PDM_RX2_FIFO_CH1_HALF_FULL_POS Position */ +#define MXC_F_PDM_RX2_FIFO_CH1_HALF_FULL \ + ((uint32_t)(0x1UL \ + << MXC_F_PDM_RX2_FIFO_CH1_HALF_FULL_POS)) /**< MXC_F_PDM_RX2_FIFO_CH1_HALF_FULL_POS Mask */ + +#define MXC_F_PDM_RX2_FIFO_CH0_HALF_FULL_POS \ + 19 /**< MXC_F_PDM_RX2_FIFO_CH0_HALF_FULL_POS Position */ +#define MXC_F_PDM_RX2_FIFO_CH0_HALF_FULL \ + ((uint32_t)(0x1UL \ + << MXC_F_PDM_RX2_FIFO_CH0_HALF_FULL_POS)) /**< MXC_F_PDM_RX2_FIFO_CH0_HALF_FULL_POS Mask */ + +#define MXC_F_PDM_RX1_FIFO_CH1_HALF_FULL_POS \ + 20 /**< MXC_F_PDM_RX1_FIFO_CH1_HALF_FULL_POS Position */ +#define MXC_F_PDM_RX1_FIFO_CH1_HALF_FULL \ + ((uint32_t)(0x1UL \ + << MXC_F_PDM_RX1_FIFO_CH1_HALF_FULL_POS)) /**< MXC_F_PDM_RX1_FIFO_CH1_HALF_FULL_POS Mask */ + +#define MXC_F_PDM_RX1_FIFO_CH0_HALF_FULL_POS \ + 21 /**< MXC_F_PDM_RX1_FIFO_CH0_HALF_FULL_POS Position */ +#define MXC_F_PDM_RX1_FIFO_CH0_HALF_FULL \ + ((uint32_t)(0x1UL \ + << MXC_F_PDM_RX1_FIFO_CH0_HALF_FULL_POS)) /**< MXC_F_PDM_RX1_FIFO_CH0_HALF_FULL_POS Mask */ + +#define MXC_F_PDM_TX_FIFO_CH1_HALF_FULL_POS 22 /**< MXC_F_PDM_TX_FIFO_CH1_HALF_FULL_POS Position */ +#define MXC_F_PDM_TX_FIFO_CH1_HALF_FULL \ + ((uint32_t)(0x1UL \ + << MXC_F_PDM_TX_FIFO_CH1_HALF_FULL_POS)) /**< MXC_F_PDM_TX_FIFO_CH1_HALF_FULL_POS Mask */ + +#define MXC_F_PDM_TX_FIFO_CH0_HALF_FULL_POS 23 /**< MXC_F_PDM_TX_FIFO_CH0_HALF_FULL_POS Position */ +#define MXC_F_PDM_TX_FIFO_CH0_HALF_FULL \ + ((uint32_t)(0x1UL \ + << MXC_F_PDM_TX_FIFO_CH0_HALF_FULL_POS)) /**< MXC_F_PDM_TX_FIFO_CH0_HALF_FULL_POS Mask */ + +#define MXC_F_PDM_RX3_FIFO_CH1_ALMOST_FULL_POS \ + 24 /**< MXC_F_PDM_RX3_FIFO_CH1_ALMOST_FULL_POS Position */ +#define MXC_F_PDM_RX3_FIFO_CH1_ALMOST_FULL \ + ((uint32_t)(0x1UL \ + << MXC_F_PDM_RX3_FIFO_CH1_ALMOST_FULL_POS)) /**< MXC_F_PDM_RX3_FIFO_CH1_ALMOST_FULL_POS Mask */ + +#define MXC_F_PDM_RX3_FIFO_CH0_ALMOST_FULL_POS \ + 25 /**< MXC_F_PDM_RX3_FIFO_CH0_ALMOST_FULL_POS Position */ +#define MXC_F_PDM_RX3_FIFO_CH0_ALMOST_FULL \ + ((uint32_t)(0x1UL \ + << MXC_F_PDM_RX3_FIFO_CH0_ALMOST_FULL_POS)) /**< MXC_F_PDM_RX3_FIFO_CH0_ALMOST_FULL_POS Mask */ + +#define MXC_F_PDM_RX2_FIFO_CH1_ALMOST_FULL_POS \ + 26 /**< MXC_F_PDM_RX2_FIFO_CH1_ALMOST_FULL_POS Position */ +#define MXC_F_PDM_RX2_FIFO_CH1_ALMOST_FULL \ + ((uint32_t)(0x1UL \ + << MXC_F_PDM_RX2_FIFO_CH1_ALMOST_FULL_POS)) /**< MXC_F_PDM_RX2_FIFO_CH1_ALMOST_FULL_POS Mask */ + +#define MXC_F_PDM_RX2_FIFO_CH0_ALMOST_FULL_POS \ + 27 /**< MXC_F_PDM_RX2_FIFO_CH0_ALMOST_FULL_POS Position */ +#define MXC_F_PDM_RX2_FIFO_CH0_ALMOST_FULL \ + ((uint32_t)(0x1UL \ + << MXC_F_PDM_RX2_FIFO_CH0_ALMOST_FULL_POS)) /**< MXC_F_PDM_RX2_FIFO_CH0_ALMOST_FULL_POS Mask */ + +#define MXC_F_PDM_RX1_FIFO_CH1_ALMOST_FULL_POS \ + 28 /**< MXC_F_PDM_RX1_FIFO_CH1_ALMOST_FULL_POS Position */ +#define MXC_F_PDM_RX1_FIFO_CH1_ALMOST_FULL \ + ((uint32_t)(0x1UL \ + << MXC_F_PDM_RX1_FIFO_CH1_ALMOST_FULL_POS)) /**< MXC_F_PDM_RX1_FIFO_CH1_ALMOST_FULL_POS Mask */ + +#define MXC_F_PDM_RX1_FIFO_CH0_ALMOST_FULL_POS \ + 29 /**< MXC_F_PDM_RX1_FIFO_CH0_ALMOST_FULL_POS Position */ +#define MXC_F_PDM_RX1_FIFO_CH0_ALMOST_FULL \ + ((uint32_t)(0x1UL \ + << MXC_F_PDM_RX1_FIFO_CH0_ALMOST_FULL_POS)) /**< MXC_F_PDM_RX1_FIFO_CH0_ALMOST_FULL_POS Mask */ + +#define MXC_F_PDM_TX_FIFO_CH1_ALMOST_FULL_POS \ + 30 /**< MXC_F_PDM_TX_FIFO_CH1_ALMOST_FULL_POS Position */ +#define MXC_F_PDM_TX_FIFO_CH1_ALMOST_FULL \ + ((uint32_t)(0x1UL \ + << MXC_F_PDM_TX_FIFO_CH1_ALMOST_FULL_POS)) /**< MXC_F_PDM_TX_FIFO_CH1_ALMOST_FULL_POS Mask */ + +#define MXC_F_PDM_TX_FIFO_CH0_ALMOST_FULL_POS \ + 31 /**< MXC_F_PDM_TX_FIFO_CH0_ALMOST_FULL_POS Position */ +#define MXC_F_PDM_TX_FIFO_CH0_ALMOST_FULL \ + ((uint32_t)(0x1UL \ + << MXC_F_PDM_TX_FIFO_CH0_ALMOST_FULL_POS)) /**< MXC_F_PDM_TX_FIFO_CH0_ALMOST_FULL_POS Mask */ + +/**@} end of group AUDIO_INT_PDM_STATUS */ + +/** + * @ingroup audio_registers + * @defgroup AUDIO_INT_EN AUDIO_INT_EN + * @brief Interrupt Enable Register + * @{ + */ + +#define MXC_F_EN_AE_PCM_RX_POS 10 /**< MXC_F_EN_AE_PCM_RX Position */ +#define MXC_F_EN_AE_PCM_RX ((uint32_t)(0x01UL << MXC_F_EN_AE_PCM_RX_POS)) /**< MXC_F_EN_AE_PCM_RX */ + +/**@} end of group AUDIO_INT_EN */ + +/** + * @ingroup audio_registers + * @defgroup AUDIO_MODULATOR_CONTROLS AUDIO_MODULATOR_CONTROLS + * @brief Modulator control register + * @{ + */ + +#define MXC_F_TX_MOD_ENABLE_POS 0 /**< MXC_F_TX_MOD_ENABLE Position */ +#define MXC_F_TX_MOD_ENABLE \ + ((uint32_t)(0x01UL << MXC_F_TX_MOD_ENABLE_POS)) /**< MXC_F_TX_MOD_ENABLE */ + +#define MXC_F_TX_MONO_ENABLE_POS 1 /**< MXC_F_TX_MONO_ENABLE Position */ +#define MXC_F_TX_MONO_ENABLE \ + ((uint32_t)(0x01UL << MXC_F_TX_MONO_ENABLE_POS)) /**< MXC_F_TX_MONO_ENABLE */ + +#define MXC_F_TX_MOD_BYPASS_POS 2 /**< MXC_F_TX_MOD_BYPASS Position */ +#define MXC_F_TX_MOD_BYPASS \ + ((uint32_t)(0x01UL << MXC_F_TX_MOD_BYPASS_POS)) /**< MXC_F_TX_MOD_BYPASS */ + +#define MXC_F_PDM_TX_ALT_ENCODE_POS 3 /**< MXC_F_PDM_TX_ALT_ENCODE Position */ +#define MXC_F_PDM_TX_ALT_ENCODE \ + ((uint32_t)(0x01UL << MXC_F_PDM_TX_ALT_ENCODE_POS)) /**< MXC_F_PDM_TX_ALT_ENCODE */ + +#define MXC_F_PDM_PCM_SELECT_POS 7 /**< MXC_F_PDM_PCM_SELECT Position */ +#define MXC_F_PDM_PCM_SELECT \ + ((uint32_t)(0x01UL << MXC_F_PDM_PCM_SELECT_POS)) /**< MXC_F_PDM_PCM_SELECT */ + +/**@} end of group AUDIO_MODULATOR_CONTROLS */ + +/** + * @ingroup audio_registers + * @defgroup AUDIO_PCM_CLOCK_DIVIDERS_MSB AUDIO_PCM_CLOCK_DIVIDERS_MSB + * @brief PCM Clock Dividers MSB + * @{ + */ + +#define MXC_F_PCM_BCLK_DIV_MSB_POS 0 /**< MXC_F_PCM_BCLK_DIV_MSB Position */ +#define MXC_F_PCM_BCLK_DIV_MSB \ + ((uint32_t)(0x00UL << MXC_F_PCM_BCLK_DIV_MSB_POS)) /**< MXC_F_PCM_BCLK_DIV_MSB */ + +#define MXC_F_PCM_BCLK_SEL_POS 5 /**< MXC_F_PCM_BCLK_SEL Position */ +#define MXC_F_PCM_BCLK_SEL_BCLK_TICK \ + ((uint32_t)(0x00UL \ + << MXC_F_PCM_BCLK_SEL_POS)) /**< MXC_F_PCM_BCLK_SEL BCLK generator, tick out*/ +#define MXC_F_PCM_BCLK_SEL_BCLK_TOGGLE \ + ((uint32_t)(0x01UL \ + << MXC_F_PCM_BCLK_SEL_POS)) /**< MXC_F_PCM_BCLK_SEL BCLK generator, toggle out*/ +#define MXC_F_PCM_BCLK_SEL_BCLK_MASTER \ + ((uint32_t)(0x02UL << MXC_F_PCM_BCLK_SEL_POS)) /**< MXC_F_PCM_BCLK_SEL BCLK master*/ + +#define MXC_F_PCM_BCLK_MASTER_SEL_POS 7 /**< MXC_F_PCM_BCLK_MASTER_SEL Position */ +#define MXC_F_PCM_BCLK_MASTER_SEL_AUDIO_CLK \ + ((uint32_t)(0x00UL \ + << MXC_F_PCM_BCLK_MASTER_SEL_POS)) /**< MXC_F_PCM_BCLK_MASTER_SEL Audio Clock*/ +#define MXC_F_PCM_BCLK_MASTER_SEL_MODULATOR_CLK \ + ((uint32_t)(0x01UL \ + << MXC_F_PCM_BCLK_MASTER_SEL_POS)) /**< MXC_F_PCM_BCLK_MASTER_SEL Modulator Clock*/ + +/**@} end of group AUDIO_PCM_CLOCK_DIVIDERS_MSB */ + +/** + * @ingroup audio_registers + * @defgroup AUDIO_PCM_CLOCK_DIVIDERS_LSB AUDIO_PCM_CLOCK_DIVIDERS_LSB + * @brief PCM Clock Dividers LSB + * @{ + */ + +#define MXC_F_PCM_BCLK_DIV_LSB_POS 0 /**< MXC_F_PCM_BCLK_DIV_MSB Position */ +#define MXC_F_PCM_BCLK_DIV_LSB \ + ((uint32_t)(0x01UL << MXC_F_PCM_BCLK_DIV_MSB_POS)) /**< MXC_F_PCM_BCLK_DIV_MSB */ + +/**@} end of group AUDIO_PCM_CLOCK_DIVIDERS_LSB */ + +/** + * @ingroup audio_registers + * @defgroup AUDIO_PCM_CLOCK_SET_UP AUDIO_PCM_CLOCK_SET_UP + * @brief PCM Clock Config + * @{ + */ + +#define MXC_F_PCM_BSEL_POS 0 /**< MXC_F_PCM_BSEL Position */ +#define MXC_F_PCM_BSEL_32 \ + ((uint32_t)(0x02UL << MXC_F_PCM_BSEL_POS)) /**< MXC_F_PCM_BSEL Mask 32 BCLK pulses per LRCLK*/ +#define MXC_F_PCM_BSEL_48 \ + ((uint32_t)(0x03UL << MXC_F_PCM_BSEL_POS)) /**< MXC_F_PCM_BSEL Mask 48 BCLK pulses per LRCLK*/ +#define MXC_F_PCM_BSEL_64 \ + ((uint32_t)(0x04UL << MXC_F_PCM_BSEL_POS)) /**< MXC_F_PCM_BSEL Mask 64 BCLK pulses per LRCLK*/ +#define MXC_F_PCM_BSEL_96 \ + ((uint32_t)(0x05UL << MXC_F_PCM_BSEL_POS)) /**< MXC_F_PCM_BSEL Mask 96 BCLK pulses per LRCLK*/ +#define MXC_F_PCM_BSEL_128 \ + ((uint32_t)(0x06UL << MXC_F_PCM_BSEL_POS)) /**< MXC_F_PCM_BSEL Mask 128 BCLK pulses per LRCLK*/ +#define MXC_F_PCM_BSEL_192 \ + ((uint32_t)(0x07UL << MXC_F_PCM_BSEL_POS)) /**< MXC_F_PCM_BSEL Mask 192 BCLK pulses per LRCLK*/ +#define MXC_F_PCM_BSEL_256 \ + ((uint32_t)(0x08UL << MXC_F_PCM_BSEL_POS)) /**< MXC_F_PCM_BSEL Mask 256 BCLK pulses per LRCLK*/ +#define MXC_F_PCM_BSEL_384 \ + ((uint32_t)(0x09UL << MXC_F_PCM_BSEL_POS)) /**< MXC_F_PCM_BSEL Mask 384 BCLK pulses per LRCLK*/ +#define MXC_F_PCM_BSEL_512 \ + ((uint32_t)(0x0AUL << MXC_F_PCM_BSEL_POS)) /**< MXC_F_PCM_BSEL Mask 512 BCLK pulses per LRCLK*/ +#define MXC_F_PCM_BSEL_320 \ + ((uint32_t)(0x0BUL << MXC_F_PCM_BSEL_POS)) /**< MXC_F_PCM_BSEL Mask 320 BCLK pulses per LRCLK*/ + +#define MXC_F_PCM_BCLKEDGE_POS 4 /**< MXC_F_PCM_BCLKEDGE Position */ +#define MXC_F_PCM_BCLKEDGE \ + ((uint32_t)(0x01UL << MXC_F_PCM_BCLKEDGE_POS)) /**< MXC_F_PCM_BCLKEDGE Mask */ + +/**@} end of group AUDIO_PCM_CLOCK_SET_UP */ + +/** + * @ingroup audio_registers + * @defgroup AUDIO_PCM_CONFIG AUDIO_PCM_CONFIG + * @brief PCM Config + * @{ + */ + +#define MXC_F_PCM_TX_EXTRA_HIZ_POS 0 /**< MXC_F_PCM_TX_EXTRA_HIZ Position */ +#define MXC_F_PCM_TX_EXTRA_HIZ \ + ((uint32_t)(0x01UL << MXC_F_PCM_TX_EXTRA_HIZ_POS)) /**< MXC_F_PCM_TX_EXTRA_HIZ Mask */ + +#define MXC_F_PCM_CHANSEL_POS 2 /**< MXC_F_PCM_CHANSEL Position */ +#define MXC_F_PCM_CHANSEL \ + ((uint32_t)(0x01UL << MXC_F_PCM_CHANSEL_POS)) /**< MXC_F_PCM_CHANSEL Mask */ + +#define MXC_F_PCM_FORMATX_POS 3 /**< MXC_F_PCM_BSEL Position */ +#define MXC_F_PCM_FORMATX_I2S \ + ((uint32_t)(0x00UL << MXC_F_PCM_FORMATX_POS)) /**< MXC_F_PCM_FORMATX I2S Format*/ +#define MXC_F_PCM_FORMATX_PCM_LEFT \ + ((uint32_t)(0x01UL << MXC_F_PCM_FORMATX_POS)) /**< MXC_F_PCM_FORMATX PCM justified*/ +#define MXC_F_PCM_FORMATX_PCM_RIGT \ + ((uint32_t)(0x02UL << MXC_F_PCM_FORMATX_POS)) /**< MXC_F_PCM_FORMATX PCM right justified*/ +#define MXC_F_PCM_FORMATX_TDM_MODE_1 \ + ((uint32_t)(0x03UL << MXC_F_PCM_FORMATX_POS)) /**< MXC_F_PCM_FORMATX TDM mode 1*/ +#define MXC_F_PCM_FORMATX_TDM_MODE_2 \ + ((uint32_t)(0x04UL << MXC_F_PCM_FORMATX_POS)) /**< MXC_F_PCM_FORMATX TDM mode 2*/ +#define MXC_F_PCM_FORMATX_TDM_MODE_3 \ + ((uint32_t)(0x05UL << MXC_F_PCM_FORMATX_POS)) /**< MXC_F_PCM_FORMATX TDM mode 3*/ + +#define MXC_F_PCM_CHANSZ_POS 6 /**< MXC_F_PCM_CHANSZ Position */ +#define MXC_F_PCM_CHANSZ_16 \ + ((uint32_t)(0x01UL << MXC_F_PCM_CHANSZ_POS)) /**< MXC_F_PCM_CHANSZ 16-bit*/ +#define MXC_F_PCM_CHANSZ_24 \ + ((uint32_t)(0x02UL << MXC_F_PCM_CHANSZ_POS)) /**< MXC_F_PCM_CHANSZ 24-bit*/ +#define MXC_F_PCM_CHANSZ_32 \ + ((uint32_t)(0x03UL << MXC_F_PCM_CHANSZ_POS)) /**< MXC_F_PCM_CHANSZ 32-bit*/ + +/**@} end of group AUDIO_PCM_CONFIG */ + +/** + * @ingroup audio_registers + * @defgroup AUDIO_PCM_TX_SAMPLE_RATES AUDIO_PCM_TX_SAMPLE_RATES + * @brief PCM Tx Sample Rates + * @{ + */ + +#define MXC_F_PCM_TX_INTERFACE_SR_POS 0 /**< MXC_F_PCM_TX_INTERFACE_SR Position */ +#define MXC_F_PCM_TX_INTERFACE_SR_8 \ + ((uint32_t)(0x00UL << MXC_F_PCM_TX_INTERFACE_SR_POS)) /**< MXC_F_PCM_TX_INTERFACE_SR 8kHz */ +#define MXC_F_PCM_TX_INTERFACE_SR_11_025 \ + ((uint32_t)(0x01UL \ + << MXC_F_PCM_TX_INTERFACE_SR_POS)) /**< MXC_F_PCM_TX_INTERFACE_SR 11.025kHz */ +#define MXC_F_PCM_TX_INTERFACE_SR_12 \ + ((uint32_t)(0x02UL << MXC_F_PCM_TX_INTERFACE_SR_POS)) /**< MXC_F_PCM_TX_INTERFACE_SR 12kHz */ +#define MXC_F_PCM_TX_INTERFACE_SR_16 \ + ((uint32_t)(0x03UL << MXC_F_PCM_TX_INTERFACE_SR_POS)) /**< MXC_F_PCM_TX_INTERFACE_SR 16kHz */ +#define MXC_F_PCM_TX_INTERFACE_SR_22_05 \ + ((uint32_t)(0x04UL << MXC_F_PCM_TX_INTERFACE_SR_POS)) /**< MXC_F_PCM_TX_INTERFACE_SR 22.05kHz */ +#define MXC_F_PCM_TX_INTERFACE_SR_24 \ + ((uint32_t)(0x05UL << MXC_F_PCM_TX_INTERFACE_SR_POS)) /**< MXC_F_PCM_TX_INTERFACE_SR 24kHz */ +#define MXC_F_PCM_TX_INTERFACE_SR_32 \ + ((uint32_t)(0x06UL << MXC_F_PCM_TX_INTERFACE_SR_POS)) /**< MXC_F_PCM_TX_INTERFACE_SR 32kHz */ +#define MXC_F_PCM_TX_INTERFACE_SR_44_1 \ + ((uint32_t)(0x07UL << MXC_F_PCM_TX_INTERFACE_SR_POS)) /**< MXC_F_PCM_TX_INTERFACE_SR 44.1kHz */ +#define MXC_F_PCM_TX_INTERFACE_SR_48 \ + ((uint32_t)(0x08UL << MXC_F_PCM_TX_INTERFACE_SR_POS)) /**< MXC_F_PCM_TX_INTERFACE_SR 48kHz */ +#define MXC_F_PCM_TX_INTERFACE_SR_88_2 \ + ((uint32_t)(0x09UL << MXC_F_PCM_TX_INTERFACE_SR_POS)) /**< MXC_F_PCM_TX_INTERFACE_SR 88.2kHz */ +#define MXC_F_PCM_TX_INTERFACE_SR_96 \ + ((uint32_t)(0x0AUL << MXC_F_PCM_TX_INTERFACE_SR_POS)) /**< MXC_F_PCM_TX_INTERFACE_SR 96kHz */ +#define MXC_F_PCM_TX_INTERFACE_SR_176_4 \ + ((uint32_t)(0x0BUL << MXC_F_PCM_TX_INTERFACE_SR_POS)) /**< MXC_F_PCM_TX_INTERFACE_SR 176.4kHz */ +#define MXC_F_PCM_TX_INTERFACE_SR_192 \ + ((uint32_t)(0x0CUL << MXC_F_PCM_TX_INTERFACE_SR_POS)) /**< MXC_F_PCM_TX_INTERFACE_SR 192kHz */ + +#define MXC_F_PCM_TX_DATAPORT_SR_POS 4 /**< MXC_F_PCM_TX_DATAPORT_SR Position */ +#define MXC_F_PCM_TX_DATAPORT_SR_8 \ + ((uint32_t)(0x00UL << MXC_F_PCM_TX_DATAPORT_SR_POS)) /**< MXC_F_PCM_TX_DATAPORT_SR 8kHz */ +#define MXC_F_PCM_TX_DATAPORT_SR_11_025 \ + ((uint32_t)(0x01UL << MXC_F_PCM_TX_DATAPORT_SR_POS)) /**< MXC_F_PCM_TX_DATAPORT_SR 11.025kHz */ +#define MXC_F_PCM_TX_DATAPORT_SR_12 \ + ((uint32_t)(0x02UL << MXC_F_PCM_TX_DATAPORT_SR_POS)) /**< MXC_F_PCM_TX_DATAPORT_SR 12kHz */ +#define MXC_F_PCM_TX_DATAPORT_SR_16 \ + ((uint32_t)(0x03UL << MXC_F_PCM_TX_DATAPORT_SR_POS)) /**< MXC_F_PCM_TX_DATAPORT_SR 16kHz */ +#define MXC_F_PCM_TX_DATAPORT_SR_22_05 \ + ((uint32_t)(0x04UL << MXC_F_PCM_TX_DATAPORT_SR_POS)) /**< MXC_F_PCM_TX_DATAPORT_SR 22.05kHz */ +#define MXC_F_PCM_TX_DATAPORT_SR_24 \ + ((uint32_t)(0x05UL << MXC_F_PCM_TX_DATAPORT_SR_POS)) /**< MXC_F_PCM_TX_DATAPORT_SR 24kHz */ +#define MXC_F_PCM_TX_DATAPORT_SR_32 \ + ((uint32_t)(0x06UL << MXC_F_PCM_TX_DATAPORT_SR_POS)) /**< MXC_F_PCM_TX_DATAPORT_SR 32kHz */ +#define MXC_F_PCM_TX_DATAPORT_SR_44_1 \ + ((uint32_t)(0x07UL << MXC_F_PCM_TX_DATAPORT_SR_POS)) /**< MXC_F_PCM_TX_DATAPORT_SR 44.1kHz */ +#define MXC_F_PCM_TX_DATAPORT_SR_48 \ + ((uint32_t)(0x08UL << MXC_F_PCM_TX_DATAPORT_SR_POS)) /**< MXC_F_PCM_TX_DATAPORT_SR 48kHz */ +#define MXC_F_PCM_TX_DATAPORT_SR_88_2 \ + ((uint32_t)(0x09UL << MXC_F_PCM_TX_DATAPORT_SR_POS)) /**< MXC_F_PCM_TX_DATAPORT_SR 88.2kHz */ +#define MXC_F_PCM_TX_DATAPORT_SR_96 \ + ((uint32_t)(0x0AUL << MXC_F_PCM_TX_DATAPORT_SR_POS)) /**< MXC_F_PCM_TX_DATAPORT_SR 96kHz */ +#define MXC_F_PCM_TX_DATAPORT_SR_176_4 \ + ((uint32_t)(0x0BUL << MXC_F_PCM_TX_DATAPORT_SR_POS)) /**< MXC_F_PCM_TX_DATAPORT_SR 176.4kHz */ +#define MXC_F_PCM_TX_DATAPORT_SR_192 \ + ((uint32_t)(0x0CUL << MXC_F_PCM_TX_DATAPORT_SR_POS)) /**< MXC_F_PCM_TX_DATAPORT_SR 192kHz */ + +/**@} end of group AUDIO_PCM_TX_SAMPLE_RATES */ + +/** + * @ingroup audio_registers + * @defgroup AUDIO_PCM_RX_SAMPLE_RATES AUDIO_PCM_RX_SAMPLE_RATES + * @brief PCM Rx Sample Rates + * @{ + */ + +#define MXC_F_PCM_RX_INTERFACE_SR_POS 0 /**< MXC_F_PCM_RX_INTERFACE_SR Position */ +#define MXC_F_PCM_RX_INTERFACE_SR_8 \ + ((uint32_t)(0x00UL << MXC_F_PCM_RX_INTERFACE_SR_POS)) /**< MXC_F_PCM_RX_INTERFACE_SR 8kHz */ +#define MXC_F_PCM_RX_INTERFACE_SR_11_025 \ + ((uint32_t)(0x01UL \ + << MXC_F_PCM_RX_INTERFACE_SR_POS)) /**< MXC_F_PCM_RX_INTERFACE_SR 11.025kHz */ +#define MXC_F_PCM_RX_INTERFACE_SR_12 \ + ((uint32_t)(0x02UL << MXC_F_PCM_RX_INTERFACE_SR_POS)) /**< MXC_F_PCM_RX_INTERFACE_SR 12kHz */ +#define MXC_F_PCM_RX_INTERFACE_SR_16 \ + ((uint32_t)(0x03UL << MXC_F_PCM_RX_INTERFACE_SR_POS)) /**< MXC_F_PCM_RX_INTERFACE_SR 16kHz */ +#define MXC_F_PCM_RX_INTERFACE_SR_22_05 \ + ((uint32_t)(0x04UL << MXC_F_PCM_RX_INTERFACE_SR_POS)) /**< MXC_F_PCM_RX_INTERFACE_SR 22.05kHz */ +#define MXC_F_PCM_RX_INTERFACE_SR_24 \ + ((uint32_t)(0x05UL << MXC_F_PCM_RX_INTERFACE_SR_POS)) /**< MXC_F_PCM_RX_INTERFACE_SR 24kHz */ +#define MXC_F_PCM_RX_INTERFACE_SR_32 \ + ((uint32_t)(0x06UL << MXC_F_PCM_RX_INTERFACE_SR_POS)) /**< MXC_F_PCM_RX_INTERFACE_SR 32kHz */ +#define MXC_F_PCM_RX_INTERFACE_SR_44_1 \ + ((uint32_t)(0x07UL << MXC_F_PCM_RX_INTERFACE_SR_POS)) /**< MXC_F_PCM_RX_INTERFACE_SR 44.1kHz */ +#define MXC_F_PCM_RX_INTERFACE_SR_48 \ + ((uint32_t)(0x08UL << MXC_F_PCM_RX_INTERFACE_SR_POS)) /**< MXC_F_PCM_RX_INTERFACE_SR 48kHz */ +#define MXC_F_PCM_RX_INTERFACE_SR_88_2 \ + ((uint32_t)(0x09UL << MXC_F_PCM_RX_INTERFACE_SR_POS)) /**< MXC_F_PCM_RX_INTERFACE_SR 88.2kHz */ +#define MXC_F_PCM_RX_INTERFACE_SR_96 \ + ((uint32_t)(0x0AUL << MXC_F_PCM_RX_INTERFACE_SR_POS)) /**< MXC_F_PCM_RX_INTERFACE_SR 96kHz */ +#define MXC_F_PCM_RX_INTERFACE_SR_176_4 \ + ((uint32_t)(0x0BUL << MXC_F_PCM_RX_INTERFACE_SR_POS)) /**< MXC_F_PCM_RX_INTERFACE_SR 176.4kHz */ +#define MXC_F_PCM_RX_INTERFACE_SR_192 \ + ((uint32_t)(0x0CUL << MXC_F_PCM_RX_INTERFACE_SR_POS)) /**< MXC_F_PCM_RX_INTERFACE_SR 192kHz */ + +#define MXC_F_PCM_RX_DATAPORT_SR_POS 4 /**< MXC_F_PCM_RX_DATAPORT_SR Position */ +#define MXC_F_PCM_RX_DATAPORT_SR_8 \ + ((uint32_t)(0x00UL << MXC_F_PCM_RX_DATAPORT_SR_POS)) /**< MXC_F_PCM_RX_DATAPORT_SR 8kHz */ +#define MXC_F_PCM_RX_DATAPORT_SR_11_025 \ + ((uint32_t)(0x01UL << MXC_F_PCM_RX_DATAPORT_SR_POS)) /**< MXC_F_PCM_RX_DATAPORT_SR 11.025kHz */ +#define MXC_F_PCM_RX_DATAPORT_SR_12 \ + ((uint32_t)(0x02UL << MXC_F_PCM_RX_DATAPORT_SR_POS)) /**< MXC_F_PCM_RX_DATAPORT_SR 12kHz */ +#define MXC_F_PCM_RX_DATAPORT_SR_16 \ + ((uint32_t)(0x03UL << MXC_F_PCM_RX_DATAPORT_SR_POS)) /**< MXC_F_PCM_RX_DATAPORT_SR 16kHz */ +#define MXC_F_PCM_RX_DATAPORT_SR_22_05 \ + ((uint32_t)(0x04UL << MXC_F_PCM_RX_DATAPORT_SR_POS)) /**< MXC_F_PCM_RX_DATAPORT_SR 22.05kHz */ +#define MXC_F_PCM_RX_DATAPORT_SR_24 \ + ((uint32_t)(0x05UL << MXC_F_PCM_RX_DATAPORT_SR_POS)) /**< MXC_F_PCM_RX_DATAPORT_SR 24kHz */ +#define MXC_F_PCM_RX_DATAPORT_SR_32 \ + ((uint32_t)(0x06UL << MXC_F_PCM_RX_DATAPORT_SR_POS)) /**< MXC_F_PCM_RX_DATAPORT_SR 32kHz */ +#define MXC_F_PCM_RX_DATAPORT_SR_44_1 \ + ((uint32_t)(0x07UL << MXC_F_PCM_RX_DATAPORT_SR_POS)) /**< MXC_F_PCM_RX_DATAPORT_SR 44.1kHz */ +#define MXC_F_PCM_RX_DATAPORT_SR_48 \ + ((uint32_t)(0x08UL << MXC_F_PCM_RX_DATAPORT_SR_POS)) /**< MXC_F_PCM_RX_DATAPORT_SR 48kHz */ +#define MXC_F_PCM_RX_DATAPORT_SR_88_2 \ + ((uint32_t)(0x09UL << MXC_F_PCM_RX_DATAPORT_SR_POS)) /**< MXC_F_PCM_RX_DATAPORT_SR 88.2kHz */ +#define MXC_F_PCM_RX_DATAPORT_SR_96 \ + ((uint32_t)(0x0AUL << MXC_F_PCM_RX_DATAPORT_SR_POS)) /**< MXC_F_PCM_RX_DATAPORT_SR 96kHz */ +#define MXC_F_PCM_RX_DATAPORT_SR_176_4 \ + ((uint32_t)(0x0BUL << MXC_F_PCM_RX_DATAPORT_SR_POS)) /**< MXC_F_PCM_RX_DATAPORT_SR 176.4kHz */ +#define MXC_F_PCM_RX_DATAPORT_SR_192 \ + ((uint32_t)(0x0CUL << MXC_F_PCM_RX_DATAPORT_SR_POS)) /**< MXC_F_PCM_RX_DATAPORT_SR 192kHz */ + +/**@} end of group AUDIO_PCM_RX_SAMPLE_RATES */ + +/** + * @ingroup audio_registers + * @defgroup AUDIO_PCM_RX_ENABLES_BYTE_0 AUDIO_PCM_RX_ENABLES_BYTE_0 + * @brief PCM Rx Channels Enable Byte 0 + * @{ + */ + +#define MXC_F_PCM_RX_CH0_EN_POS 0 /**< MXC_F_PCM_RX_CH0_EN Position */ +#define MXC_F_PCM_RX_CH0_EN \ + ((uint32_t)(0x01UL << MXC_F_PCM_RX_CH0_EN_POS)) /**< MXC_F_PCM_RX_CH0_EN */ + +#define MXC_F_PCM_RX_CH1_EN_POS 1 /**< MXC_F_PCM_RX_CH1_EN Position */ +#define MXC_F_PCM_RX_CH1_EN \ + ((uint32_t)(0x01UL << MXC_F_PCM_RX_CH1_EN_POS)) /**< MXC_F_PCM_RX_CH1_EN */ + +#define MXC_F_PCM_RX_CH2_EN_POS 2 /**< MXC_F_PCM_RX_CH2_EN Position */ +#define MXC_F_PCM_RX_CH2_EN \ + ((uint32_t)(0x01UL << MXC_F_PCM_RX_CH2_EN_POS)) /**< MXC_F_PCM_RX_CH2_EN */ + +#define MXC_F_PCM_RX_CH3_EN_POS 3 /**< MXC_F_PCM_RX_CH3_EN Position */ +#define MXC_F_PCM_RX_CH3_EN \ + ((uint32_t)(0x01UL << MXC_F_PCM_RX_CH3_EN_POS)) /**< MXC_F_PCM_RX_CH3_EN */ + +#define MXC_F_PCM_RX_CH4_EN_POS 4 /**< MXC_F_PCM_RX_CH4_EN Position */ +#define MXC_F_PCM_RX_CH4_EN \ + ((uint32_t)(0x01UL << MXC_F_PCM_RX_CH4_EN_POS)) /**< MXC_F_PCM_RX_CH4_EN */ + +#define MXC_F_PCM_RX_CH5_EN_POS 5 /**< MXC_F_PCM_RX_CH5_EN Position */ +#define MXC_F_PCM_RX_CH5_EN \ + ((uint32_t)(0x01UL << MXC_F_PCM_RX_CH5_EN_POS)) /**< MXC_F_PCM_RX_CH5_EN */ + +#define MXC_F_PCM_RX_CH6_EN_POS 6 /**< MXC_F_PCM_RX_CH6_EN Position */ +#define MXC_F_PCM_RX_CH6_EN \ + ((uint32_t)(0x01UL << MXC_F_PCM_RX_CH6_EN_POS)) /**< MXC_F_PCM_RX_CH6_EN */ + +#define MXC_F_PCM_RX_CH7_EN_POS 7 /**< MXC_F_PCM_RX_CH7_EN Position */ +#define MXC_F_PCM_RX_CH7_EN \ + ((uint32_t)(0x01UL << MXC_F_PCM_RX_CH7_EN_POS)) /**< MXC_F_PCM_RX_CH7_EN */ + +/**@} end of group AUDIO_PCM_RX_ENABLES_BYTE_0 */ + +/** + * @ingroup audio_registers + * @defgroup AUDIO_PCM_RX_ENABLES_BYTE_1 AUDIO_PCM_RX_ENABLES_BYTE_1 + * @brief PCM Rx Channels Enable Byte 1 + * @{ + */ + +#define MXC_F_PCM_RX_CH8_EN_POS 0 /**< MXC_F_PCM_RX_CH8_EN Position */ +#define MXC_F_PCM_RX_CH8_EN \ + ((uint32_t)(0x01UL << MXC_F_PCM_RX_CH8_EN_POS)) /**< MXC_F_PCM_RX_CH8_EN */ + +#define MXC_F_PCM_RX_CH9_EN_POS 1 /**< MXC_F_PCM_RX_CH9_EN Position */ +#define MXC_F_PCM_RX_CH9_EN \ + ((uint32_t)(0x01UL << MXC_F_PCM_RX_CH9_EN_POS)) /**< MXC_F_PCM_RX_CH9_EN */ + +#define MXC_F_PCM_RX_CH10_EN_POS 2 /**< MXC_F_PCM_RX_CH10_EN Position */ +#define MXC_F_PCM_RX_CH10_EN \ + ((uint32_t)(0x01UL << MXC_F_PCM_RX_CH10_EN_POS)) /**< MXC_F_PCM_RX_CH10_EN */ + +#define MXC_F_PCM_RX_CH11_EN_POS 3 /**< MXC_F_PCM_RX_CH11_EN Position */ +#define MXC_F_PCM_RX_CH11_EN \ + ((uint32_t)(0x01UL << MXC_F_PCM_RX_CH11_EN_POS)) /**< MXC_F_PCM_RX_CH11_EN */ + +#define MXC_F_PCM_RX_CH12_EN_POS 4 /**< MXC_F_PCM_RX_CH12_EN Position */ +#define MXC_F_PCM_RX_CH12_EN \ + ((uint32_t)(0x01UL << MXC_F_PCM_RX_CH12_EN_POS)) /**< MXC_F_PCM_RX_CH12_EN */ + +#define MXC_F_PCM_RX_CH13_EN_POS 5 /**< MXC_F_PCM_RX_CH13_EN Position */ +#define MXC_F_PCM_RX_CH13_EN \ + ((uint32_t)(0x01UL << MXC_F_PCM_RX_CH13_EN_POS)) /**< MXC_F_PCM_RX_CH13_EN */ + +#define MXC_F_PCM_RX_CH14_EN_POS 6 /**< MXC_F_PCM_RX_CH14_EN Position */ +#define MXC_F_PCM_RX_CH14_EN \ + ((uint32_t)(0x01UL << MXC_F_PCM_RX_CH14_EN_POS)) /**< MXC_F_PCM_RX_CH14_EN */ + +#define MXC_F_PCM_RX_CH15_EN_POS 7 /**< MXC_F_PCM_RX_CH15_EN Position */ +#define MXC_F_PCM_RX_CH15_EN \ + ((uint32_t)(0x01UL << MXC_F_PCM_RX_CH15_EN_POS)) /**< MXC_F_PCM_RX_CH15_EN */ + +/**@} end of group AUDIO_PCM_RX_ENABLES_BYTE_1 */ + +/** + * @ingroup audio_registers + * @defgroup AUDIO_PCM_TX_ENABLES_BYTE_0 AUDIO_PCM_TX_ENABLES_BYTE_0 + * @brief PCM Tx Channels Enable Byte 0 + * @{ + */ + +#define MXC_F_PCM_TX_CH0_EN_POS 0 /**< MXC_F_PCM_TX_CH0_EN Position */ +#define MXC_F_PCM_TX_CH0_EN \ + ((uint32_t)(0x01UL << MXC_F_PCM_TX_CH0_EN_POS)) /**< MXC_F_PCM_TX_CH0_EN */ + +#define MXC_F_PCM_TX_CH1_EN_POS 1 /**< MXC_F_PCM_TX_CH1_EN Position */ +#define MXC_F_PCM_TX_CH1_EN \ + ((uint32_t)(0x01UL << MXC_F_PCM_TX_CH1_EN_POS)) /**< MXC_F_PCM_TX_CH1_EN */ + +#define MXC_F_PCM_TX_CH2_EN_POS 2 /**< MXC_F_PCM_TX_CH2_EN Position */ +#define MXC_F_PCM_TX_CH2_EN \ + ((uint32_t)(0x01UL << MXC_F_PCM_TX_CH2_EN_POS)) /**< MXC_F_PCM_TX_CH2_EN */ + +#define MXC_F_PCM_TX_CH3_EN_POS 3 /**< MXC_F_PCM_TX_CH3_EN Position */ +#define MXC_F_PCM_TX_CH3_EN \ + ((uint32_t)(0x01UL << MXC_F_PCM_TX_CH3_EN_POS)) /**< MXC_F_PCM_TX_CH3_EN */ + +#define MXC_F_PCM_TX_CH4_EN_POS 4 /**< MXC_F_PCM_TX_CH4_EN Position */ +#define MXC_F_PCM_TX_CH4_EN \ + ((uint32_t)(0x01UL << MXC_F_PCM_TX_CH4_EN_POS)) /**< MXC_F_PCM_TX_CH4_EN */ + +#define MXC_F_PCM_TX_CH5_EN_POS 5 /**< MXC_F_PCM_TX_CH5_EN Position */ +#define MXC_F_PCM_TX_CH5_EN \ + ((uint32_t)(0x01UL << MXC_F_PCM_TX_CH5_EN_POS)) /**< MXC_F_PCM_TX_CH5_EN */ + +#define MXC_F_PCM_TX_CH6_EN_POS 6 /**< MXC_F_PCM_TX_CH6_EN Position */ +#define MXC_F_PCM_TX_CH6_EN \ + ((uint32_t)(0x01UL << MXC_F_PCM_TX_CH6_EN_POS)) /**< MXC_F_PCM_TX_CH6_EN */ + +#define MXC_F_PCM_TX_CH7_EN_POS 7 /**< MXC_F_PCM_TX_CH7_EN Position */ +#define MXC_F_PCM_TX_CH7_EN \ + ((uint32_t)(0x01UL << MXC_F_PCM_TX_CH7_EN_POS)) /**< MXC_F_PCM_TX_CH7_EN */ + +/**@} end of group AUDIO_PCM_TX_ENABLES_BYTE_0 */ + +/** + * @ingroup audio_registers + * @defgroup AUDIO_PCM_TX_ENABLES_BYTE_1 AUDIO_PCM_TX_ENABLES_BYTE_1 + * @brief PCM Tx Channels Enable Byte 1 + * @{ + */ + +#define MXC_F_PCM_TX_CH8_EN_POS 0 /**< MXC_F_PCM_TX_CH8_EN Position */ +#define MXC_F_PCM_TX_CH8_EN \ + ((uint32_t)(0x01UL << MXC_F_PCM_TX_CH8_EN_POS)) /**< MXC_F_PCM_TX_CH8_EN */ + +#define MXC_F_PCM_TX_CH9_EN_POS 1 /**< MXC_F_PCM_TX_CH9_EN Position */ +#define MXC_F_PCM_TX_CH9_EN \ + ((uint32_t)(0x01UL << MXC_F_PCM_TX_CH9_EN_POS)) /**< MXC_F_PCM_TX_CH9_EN */ + +#define MXC_F_PCM_TX_CH10_EN_POS 2 /**< MXC_F_PCM_TX_CH10_EN Position */ +#define MXC_F_PCM_TX_CH10_EN \ + ((uint32_t)(0x01UL << MXC_F_PCM_TX_CH10_EN_POS)) /**< MXC_F_PCM_TX_CH10_EN */ + +#define MXC_F_PCM_TX_CH11_EN_POS 3 /**< MXC_F_PCM_TX_CH11_EN Position */ +#define MXC_F_PCM_TX_CH11_EN \ + ((uint32_t)(0x01UL << MXC_F_PCM_TX_CH11_EN_POS)) /**< MXC_F_PCM_TX_CH11_EN */ + +#define MXC_F_PCM_TX_CH12_EN_POS 4 /**< MXC_F_PCM_TX_CH12_EN Position */ +#define MXC_F_PCM_TX_CH12_EN \ + ((uint32_t)(0x01UL << MXC_F_PCM_TX_CH12_EN_POS)) /**< MXC_F_PCM_TX_CH12_EN */ + +#define MXC_F_PCM_TX_CH13_EN_POS 5 /**< MXC_F_PCM_TX_CH13_EN Position */ +#define MXC_F_PCM_TX_CH13_EN \ + ((uint32_t)(0x01UL << MXC_F_PCM_TX_CH13_EN_POS)) /**< MXC_F_PCM_TX_CH13_EN */ + +#define MXC_F_PCM_TX_CH14_EN_POS 6 /**< MXC_F_PCM_TX_CH14_EN Position */ +#define MXC_F_PCM_TX_CH14_EN \ + ((uint32_t)(0x01UL << MXC_F_PCM_TX_CH14_EN_POS)) /**< MXC_F_PCM_TX_CH14_EN */ + +#define MXC_F_PCM_TX_CH15_EN_POS 7 /**< MXC_F_PCM_TX_CH15_EN Position */ +#define MXC_F_PCM_TX_CH15_EN \ + ((uint32_t)(0x01UL << MXC_F_PCM_TX_CH15_EN_POS)) /**< MXC_F_PCM_TX_CH15_EN */ + +/**@} end of group AUDIO_PCM_TX_ENABLES_BYTE_1 */ + +/** + * @ingroup audio_registers + * @defgroup AUDIO_PCM_DATAPORT_1_SLOT_MAPPING_CHANNEL_0 AUDIO_PCM_DATAPORT_1_SLOT_MAPPING_CHANNEL_0 + * @brief Dataport 1 Slot Mapping Registers Channel 0 + * @{ + */ + +#define MXC_F_PCM_DPORT1_SLOT_MAP_CH0_POS 0 /**< MXC_F_PCM_DPORT1_SLOT_MAP_CH0 Position */ +#define MXC_F_PCM_DPORT1_SLOT_MAP_CH0 \ + ((uint32_t)(0x000UL << MXC_F_PCM_DPORT1_SLOT_MAP_CH0_POS)) /**< MXC_F_PCM_DPORT1_SLOT_MAP_CH0 */ + +#define MXC_F_PCM_DPORT1_CH0_EN_POS 7 /**< MXC_F_PCM_DPORT1_CH0_EN Position */ +#define MXC_F_PCM_DPORT1_CH0_EN \ + ((uint32_t)(0x01UL << MXC_F_PCM_DPORT1_CH0_EN_POS)) /**< MXC_F_PCM_DPORT1_CH0_EN */ + +/**@} end of group AUDIO_PCM_DATAPORT_1_SLOT_MAPPING_CHANNEL_0 */ + +/** + * @ingroup audio_registers + * @defgroup AUDIO_PCM_DATAPORT_1_SLOT_MAPPING_CHANNEL_1 AUDIO_PCM_DATAPORT_1_SLOT_MAPPING_CHANNEL_1 + * @brief Dataport 1 Slot Mapping Registers Channel 1 + * @{ + */ + +#define MXC_F_PCM_DPORT1_SLOT_MAP_CH1_POS 0 /**< MXC_F_PCM_DPORT1_SLOT_MAP_CH1 Position */ +#define MXC_F_PCM_DPORT1_SLOT_MAP_CH1 \ + ((uint32_t)(0x000UL << MXC_F_PCM_DPORT1_SLOT_MAP_CH1_POS)) /**< MXC_F_PCM_DPORT1_SLOT_MAP_CH1 */ + +#define MXC_F_PCM_DPORT1_CH1_EN_POS 7 /**< MXC_F_PCM_DPORT1_CH1_EN Position */ +#define MXC_F_PCM_DPORT1_CH1_EN \ + ((uint32_t)(0x01UL << MXC_F_PCM_DPORT1_CH1_EN_POS)) /**< MXC_F_PCM_DPORT1_CH1_EN */ + +/**@} end of group AUDIO_PCM_DATAPORT_1_SLOT_MAPPING_CHANNEL_1 */ + +/** + * @ingroup audio_registers + * @defgroup AUDIO_PCM_DATAPORT_1_SLOT_MAPPING_CHANNEL_2 AUDIO_PCM_DATAPORT_1_SLOT_MAPPING_CHANNEL_2 + * @brief Dataport 1 Slot Mapping Registers Channel 2 + * @{ + */ + +#define MXC_F_PCM_DPORT1_SLOT_MAP_CH2_POS 0 /**< MXC_F_PCM_DPORT1_SLOT_MAP_CH2 Position */ +#define MXC_F_PCM_DPORT1_SLOT_MAP_CH2 \ + ((uint32_t)(0x000UL << MXC_F_PCM_DPORT1_SLOT_MAP_CH2_POS)) /**< MXC_F_PCM_DPORT1_SLOT_MAP_CH2 */ + +#define MXC_F_PCM_DPORT1_CH2_EN_POS 7 /**< MXC_F_PCM_DPORT1_CH2_EN Position */ +#define MXC_F_PCM_DPORT1_CH2_EN \ + ((uint32_t)(0x01UL << MXC_F_PCM_DPORT1_CH2_EN_POS)) /**< MXC_F_PCM_DPORT1_CH2_EN */ + +/**@} end of group AUDIO_PCM_DATAPORT_1_SLOT_MAPPING_CHANNEL_2 */ + +/** + * @ingroup audio_registers + * @defgroup AUDIO_PCM_DATAPORT_1_SLOT_MAPPING_CHANNEL_3 AUDIO_PCM_DATAPORT_1_SLOT_MAPPING_CHANNEL_3 + * @brief Dataport 1 Slot Mapping Registers Channel 3 + * @{ + */ + +#define MXC_F_PCM_DPORT1_SLOT_MAP_CH3_POS 0 /**< MXC_F_PCM_DPORT1_SLOT_MAP_CH3 Position */ +#define MXC_F_PCM_DPORT1_SLOT_MAP_CH3 \ + ((uint32_t)(0x000UL << MXC_F_PCM_DPORT1_SLOT_MAP_CH3_POS)) /**< MXC_F_PCM_DPORT1_SLOT_MAP_CH3 */ + +#define MXC_F_PCM_DPORT1_CH3_EN_POS 7 /**< MXC_F_PCM_DPORT1_CH3_EN Position */ +#define MXC_F_PCM_DPORT1_CH3_EN \ + ((uint32_t)(0x01UL << MXC_F_PCM_DPORT1_CH3_EN_POS)) /**< MXC_F_PCM_DPORT1_CH3_EN */ + +/**@} end of group AUDIO_PCM_DATAPORT_1_SLOT_MAPPING_CHANNEL_3 */ + +/** + * @ingroup audio_registers + * @defgroup AUDIO_PCM_DATAPORT_2_SLOT_MAPPING_CHANNEL_0 AUDIO_PCM_DATAPORT_2_SLOT_MAPPING_CHANNEL_0 + * @brief Dataport 1 Slot Mapping Registers Channel 0 + * @{ + */ + +#define MXC_F_PCM_DPORT2_SLOT_MAP_CH0_POS 0 /**< MXC_F_PCM_DPORT2_SLOT_MAP_CH0 Position */ +#define MXC_F_PCM_DPORT2_SLOT_MAP_CH0 \ + ((uint32_t)(0x000UL << MXC_F_PCM_DPORT2_SLOT_MAP_CH0_POS)) /**< MXC_F_PCM_DPORT2_SLOT_MAP_CH0 */ + +#define MXC_F_PCM_DPORT2_CH0_EN_POS 7 /**< MXC_F_PCM_DPORT2_CH0_EN Position */ +#define MXC_F_PCM_DPORT2_CH0_EN \ + ((uint32_t)(0x01UL << MXC_F_PCM_DPORT2_CH0_EN_POS)) /**< MXC_F_PCM_DPORT2_CH0_EN */ + +/**@} end of group AUDIO_PCM_DATAPORT_2_SLOT_MAPPING_CHANNEL_0 */ + +/** + * @ingroup audio_registers + * @defgroup AUDIO_PCM_DATAPORT_2_SLOT_MAPPING_CHANNEL_1 AUDIO_PCM_DATAPORT_2_SLOT_MAPPING_CHANNEL_1 + * @brief Dataport 1 Slot Mapping Registers Channel 1 + * @{ + */ + +#define MXC_F_PCM_DPORT2_SLOT_MAP_CH1_POS 0 /**< MXC_F_PCM_DPORT2_SLOT_MAP_CH1 Position */ +#define MXC_F_PCM_DPORT2_SLOT_MAP_CH1 \ + ((uint32_t)(0x000UL << MXC_F_PCM_DPORT2_SLOT_MAP_CH1_POS)) /**< MXC_F_PCM_DPORT2_SLOT_MAP_CH1 */ + +#define MXC_F_PCM_DPORT2_CH1_EN_POS 7 /**< MXC_F_PCM_DPORT2_CH1_EN Position */ +#define MXC_F_PCM_DPORT2_CH1_EN \ + ((uint32_t)(0x01UL << MXC_F_PCM_DPORT2_CH1_EN_POS)) /**< MXC_F_PCM_DPORT2_CH1_EN */ + +/**@} end of group AUDIO_PCM_DATAPORT_2_SLOT_MAPPING_CHANNEL_1 */ + +/** + * @ingroup audio_registers + * @defgroup AUDIO_PCM_DATAPORT_2_SLOT_MAPPING_CHANNEL_2 AUDIO_PCM_DATAPORT_2_SLOT_MAPPING_CHANNEL_2 + * @brief Dataport 1 Slot Mapping Registers Channel 2 + * @{ + */ + +#define MXC_F_PCM_DPORT2_SLOT_MAP_CH2_POS 0 /**< MXC_F_PCM_DPORT2_SLOT_MAP_CH2 Position */ +#define MXC_F_PCM_DPORT2_SLOT_MAP_CH2 \ + ((uint32_t)(0x000UL << MXC_F_PCM_DPORT2_SLOT_MAP_CH2_POS)) /**< MXC_F_PCM_DPORT2_SLOT_MAP_CH2 */ + +#define MXC_F_PCM_DPORT2_CH2_EN_POS 7 /**< MXC_F_PCM_DPORT2_CH2_EN Position */ +#define MXC_F_PCM_DPORT2_CH2_EN \ + ((uint32_t)(0x01UL << MXC_F_PCM_DPORT2_CH2_EN_POS)) /**< MXC_F_PCM_DPORT2_CH2_EN */ + +/**@} end of group AUDIO_PCM_DATAPORT_2_SLOT_MAPPING_CHANNEL_2 */ + +/** + * @ingroup audio_registers + * @defgroup AUDIO_PCM_DATAPORT_2_SLOT_MAPPING_CHANNEL_3 AUDIO_PCM_DATAPORT_2_SLOT_MAPPING_CHANNEL_3 + * @brief Dataport 1 Slot Mapping Registers Channel 3 + * @{ + */ + +#define MXC_F_PCM_DPORT2_SLOT_MAP_CH3_POS 0 /**< MXC_F_PCM_DPORT2_SLOT_MAP_CH3 Position */ +#define MXC_F_PCM_DPORT2_SLOT_MAP_CH3 \ + ((uint32_t)(0x000UL << MXC_F_PCM_DPORT2_SLOT_MAP_CH3_POS)) /**< MXC_F_PCM_DPORT2_SLOT_MAP_CH3 */ + +#define MXC_F_PCM_DPORT2_CH3_EN_POS 7 /**< MXC_F_PCM_DPORT2_CH3_EN Position */ +#define MXC_F_PCM_DPORT2_CH3_EN \ + ((uint32_t)(0x01UL << MXC_F_PCM_DPORT2_CH3_EN_POS)) /**< MXC_F_PCM_DPORT2_CH3_EN */ + +/**@} end of group AUDIO_PCM_DATAPORT_2_SLOT_MAPPING_CHANNEL_3 */ + +/** + * @ingroup audio_registers + * @defgroup AUDIO_PCM_DATAPORT_2_SLOT_MAPPING_CHANNEL_4 AUDIO_PCM_DATAPORT_2_SLOT_MAPPING_CHANNEL_4 + * @brief Dataport 1 Slot Mapping Registers Channel 4 + * @{ + */ + +#define MXC_F_PCM_DPORT2_SLOT_MAP_CH4_POS 0 /**< MXC_F_PCM_DPORT2_SLOT_MAP_CH4 Position */ +#define MXC_F_PCM_DPORT2_SLOT_MAP_CH4 \ + ((uint32_t)(0x000UL << MXC_F_PCM_DPORT2_SLOT_MAP_CH4_POS)) /**< MXC_F_PCM_DPORT2_SLOT_MAP_CH4 */ + +#define MXC_F_PCM_DPORT2_CH4_EN_POS 7 /**< MXC_F_PCM_DPORT2_CH4_EN Position */ +#define MXC_F_PCM_DPORT2_CH4_EN \ + ((uint32_t)(0x01UL << MXC_F_PCM_DPORT2_CH4_EN_POS)) /**< MXC_F_PCM_DPORT2_CH4_EN */ + +/**@} end of group AUDIO_PCM_DATAPORT_2_SLOT_MAPPING_CHANNEL_4 */ + +/** + * @ingroup audio_registers + * @defgroup AUDIO_PCM_DATAPORT_2_SLOT_MAPPING_CHANNEL_5 AUDIO_PCM_DATAPORT_2_SLOT_MAPPING_CHANNEL_5 + * @brief Dataport 1 Slot Mapping Registers Channel 5 + * @{ + */ + +#define MXC_F_PCM_DPORT2_SLOT_MAP_CH5_POS 0 /**< MXC_F_PCM_DPORT2_SLOT_MAP_CH5 Position */ +#define MXC_F_PCM_DPORT2_SLOT_MAP_CH5 \ + ((uint32_t)(0x000UL << MXC_F_PCM_DPORT2_SLOT_MAP_CH5_POS)) /**< MXC_F_PCM_DPORT2_SLOT_MAP_CH5 */ + +#define MXC_F_PCM_DPORT2_CH5_EN_POS 7 /**< MXC_F_PCM_DPORT2_CH5_EN Position */ +#define MXC_F_PCM_DPORT2_CH5_EN \ + ((uint32_t)(0x01UL << MXC_F_PCM_DPORT2_CH5_EN_POS)) /**< MXC_F_PCM_DPORT2_CH5_EN */ + +/**@} end of group AUDIO_PCM_DATAPORT_2_SLOT_MAPPING_CHANNEL_5 */ + +/** + * @ingroup audio_registers + * @defgroup AUDIO_PCM_DATAPORT_2_SLOT_MAPPING_CHANNEL_6 AUDIO_PCM_DATAPORT_2_SLOT_MAPPING_CHANNEL_6 + * @brief Dataport 1 Slot Mapping Registers Channel 6 + * @{ + */ + +#define MXC_F_PCM_DPORT2_SLOT_MAP_CH6_POS 0 /**< MXC_F_PCM_DPORT2_SLOT_MAP_CH6 Position */ +#define MXC_F_PCM_DPORT2_SLOT_MAP_CH6 \ + ((uint32_t)(0x000UL << MXC_F_PCM_DPORT2_SLOT_MAP_CH6_POS)) /**< MXC_F_PCM_DPORT2_SLOT_MAP_CH6 */ + +#define MXC_F_PCM_DPORT2_CH6_EN_POS 7 /**< MXC_F_PCM_DPORT2_CH6_EN Position */ +#define MXC_F_PCM_DPORT2_CH6_EN \ + ((uint32_t)(0x01UL << MXC_F_PCM_DPORT2_CH6_EN_POS)) /**< MXC_F_PCM_DPORT2_CH6_EN */ + +/**@} end of group AUDIO_PCM_DATAPORT_2_SLOT_MAPPING_CHANNEL_6 */ + +/** + * @ingroup audio_registers + * @defgroup AUDIO_PCM_DATAPORT_2_SLOT_MAPPING_CHANNEL_7 AUDIO_PCM_DATAPORT_2_SLOT_MAPPING_CHANNEL_7 + * @brief Dataport 1 Slot Mapping Registers Channel 7 + * @{ + */ + +#define MXC_F_PCM_DPORT2_SLOT_MAP_CH7_POS 0 /**< MXC_F_PCM_DPORT2_SLOT_MAP_CH7 Position */ +#define MXC_F_PCM_DPORT2_SLOT_MAP_CH7 \ + ((uint32_t)(0x000UL << MXC_F_PCM_DPORT2_SLOT_MAP_CH7_POS)) /**< MXC_F_PCM_DPORT2_SLOT_MAP_CH7 */ + +#define MXC_F_PCM_DPORT2_CH7_EN_POS 7 /**< MXC_F_PCM_DPORT2_CH7_EN Position */ +#define MXC_F_PCM_DPORT2_CH7_EN \ + ((uint32_t)(0x01UL << MXC_F_PCM_DPORT2_CH7_EN_POS)) /**< MXC_F_PCM_DPORT2_CH7_EN */ + +/**@} end of group AUDIO_PCM_DATAPORT_2_SLOT_MAPPING_CHANNEL_7 */ + +#ifdef __cplusplus +} +#endif + +#endif // LIBRARIES_PERIPHDRIVERS_SOURCE_AUDIO_REGS_H_ diff --git a/Examples/MAX32665/AUDIO_Playback/main.c b/Examples/MAX32665/AUDIO_Playback/main.c new file mode 100644 index 00000000000..8b8ec42ae3f --- /dev/null +++ b/Examples/MAX32665/AUDIO_Playback/main.c @@ -0,0 +1,213 @@ +/****************************************************************************** + * Copyright (C) 2023 Maxim Integrated Products, Inc., All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES + * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of Maxim Integrated + * Products, Inc. shall not be used except as stated in the Maxim Integrated + * Products, Inc. Branding Policy. + * + * The mere transfer of this software does not imply any licenses + * of trade secrets, proprietary technology, copyrights, patents, + * trademarks, maskwork rights, or any other form of intellectual + * property whatsoever. Maxim Integrated Products, Inc. retains all + * ownership rights. + * + ******************************************************************************/ + +/** + * @file main.c + * @brief Audio Playback Example + * @details This example uses the I2C Master to initialize MAX9867. + * For this example, if user wants to get audio data from Line-in + * they must connect microphone to line in jack. For output sound, + * user also must connect headphone to HD_PHONE jack. Refer UART + * messages for more information. + * @note Digital microphone input only works with MAX32666 EV KIT REV D. + * + */ + +/***** Includes *****/ +#include +#include +#include +#include "mxc_device.h" +#include "mxc_delay.h" +#include "nvic_table.h" +#include "i2c.h" +#include "board.h" +#include "max9867.h" +#include "audio.h" + +/***** Definitions *****/ + +#define AUDIO MXC_AUDIO +#define I2C_MASTER MXC_I2C0_BUS0 + +#define AUDIO_IRQ AUDIO_IRQn + +#define I2C_FREQ 100000 + +/***** Globals *****/ +volatile bool lineIn = true; + +/***** Protottypes *****/ +static int max9867ConfigureHeadphone(void); +static int max9867ConfigureDigitalMicrophone(void); +static int max9867ConfigureLineIn(void); +static int max9867Configure(void); + +/***** Functions *****/ + +void AUDIO_IRQHandler(void) +{ + AUDIO->tx_pcm_ch0_addr = AUDIO->rx_pcm_ch0_addr; + AUDIO->tx_pcm_ch1_addr = AUDIO->rx_pcm_ch1_addr; + + //Clear RX interrupts + AUDIO->int_pcm_rx_clr |= 0xFFFFFFFF; +} + +int main() +{ + int err; + SystemCoreClockUpdate(); + + MXC_SYS_ClockEnable(MXC_SYS_PERIPH_CLOCK_GPIO0); + + printf("\n************************ Audio Subsystem I2S Example ************************\n"); + + printf( + "\nIn this example, the device reads audio data simultaneously from the LINE_IN input or \n"); + printf("the Digital Microphone, then writes it to HD_PHONE using the MAX9867 Audio Codec. \n"); + printf( + "\nThis example utilizes the audio subsystem peripheral to receive and transmit audio \n"); + printf("data via the I2S protocol. If you wish to use 'LINE_IN' as the input source, \n"); + printf("you must connect a microphone to the 'LINE_IN' port and listen to the sound using \n"); + printf("headphones connected to 'HD_PHONE'. \n"); + printf("\nAlternatively, you can switch the input source to the Digital Microphone by \n"); + printf("setting the 'lineIn' global variable to 'false'. \n"); + printf( + "\n\nIt's important to note that the Digital microphone input source is only compatible \n"); + printf("with MAX32666 EV KIT REV D. \n"); + + // Initialize I2C peripheral to initialize the MAX9867 Audio Codec + err = MXC_I2C_Init(I2C_MASTER, TRUE, 0); + if (err != E_NO_ERROR) { + printf("\nError I2C init: %i", err); + while (1) {} + } + + MXC_I2C_SetFrequency(I2C_MASTER, I2C_FREQ); + + err = max9867Configure(); + if (err != E_NO_ERROR) { + printf("\nError Configuring Audio Codec: %i", err); + while (1) {} + } + + if (lineIn) { + err = max9867ConfigureLineIn(); + if (err != E_NO_ERROR) { + printf("\nError Configuring Audio Codec Line In: %i", err); + while (1) {} + } + } else { + err = max9867ConfigureDigitalMicrophone(); + if (err != E_NO_ERROR) { + printf("\nError Configuring Digital Microphone: %i", err); + while (1) {} + } + } + + err = max9867ConfigureHeadphone(); + if (err != E_NO_ERROR) { + printf("\nError Configuring Headphone: %i", err); + while (1) {} + } + + err = MXC_AUDIO_Init(AUDIO); + if (err != E_NO_ERROR) { + printf("\nError Configuring Adudio Subsystem peripheral: %i", err); + while (1) {} + } + + //Enable Audio Subsytem interrupts + NVIC_ClearPendingIRQ(AUDIO_IRQ); + NVIC_DisableIRQ(AUDIO_IRQ); + MXC_NVIC_SetVector(AUDIO_IRQ, AUDIO_IRQHandler); + NVIC_EnableIRQ(AUDIO_IRQ); + + while (1) {} +} + +static int max9867ConfigureHeadphone(void) +{ + int err = E_NO_ERROR; + + if ((err = max9867_headphone_mode(HPMODE_STEREO_SE_CLICKLESS)) != E_NO_ERROR) { + return err; + } + + return max9867_playback_volume(6, 6); +} + +static int max9867ConfigureDigitalMicrophone(void) +{ + int err = E_NO_ERROR; + + if ((err = max9867_microphone_enable(1, 0)) != E_NO_ERROR) { + return err; + } + if ((err = max9867_adc_level(0, 0)) != E_NO_ERROR) { + return err; + } + if ((err = max9867_linein_mute(1, 1)) != E_NO_ERROR) { + return err; + } + + return max9867_linein_gain(0, 0); +} + +static int max9867ConfigureLineIn(void) +{ + int err = E_NO_ERROR; + if ((err = max9867_adc_level(-12, -12)) != E_NO_ERROR) { + return err; + } + if ((err = max9867_linein_mute(0, 0)) != E_NO_ERROR) { + return err; + } + if ((err = max9867_linein_gain(24, 24)) != E_NO_ERROR) { + return err; + } + + return max9867_adc_input(ADC_IN_LINE_IN, ADC_IN_LINE_IN); +} + +static int max9867Configure(void) +{ + int err = E_NO_ERROR; + // Initialize audio codec + if ((err = max9867_init(I2C_MASTER, 12288000, 0)) != E_NO_ERROR) { + return err; + } + + return max9867_digital_filter(1, BUTTERWORTH_SR16KHZ, BUTTERWORTH_SR16KHZ); +} diff --git a/Examples/MAX32665/AUDIO_Playback/max9867.c b/Examples/MAX32665/AUDIO_Playback/max9867.c new file mode 100644 index 00000000000..fd3faa1780d --- /dev/null +++ b/Examples/MAX32665/AUDIO_Playback/max9867.c @@ -0,0 +1,529 @@ +/****************************************************************************** + * Copyright (C) 2023 Maxim Integrated Products, Inc., All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES + * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of Maxim Integrated + * Products, Inc. shall not be used except as stated in the Maxim Integrated + * Products, Inc. Branding Policy. + * + * The mere transfer of this software does not imply any licenses + * of trade secrets, proprietary technology, copyrights, patents, + * trademarks, maskwork rights, or any other form of intellectual + * property whatsoever. Maxim Integrated Products, Inc. retains all + * ownership rights. + * + ******************************************************************************/ + +#include +#include "i2c.h" +#include "max9867.h" + +// clang-format off +#define MAX9867_00_STATUS 0x00 +#define MAX9867_01_JACKSENSE 0x01 +#define MAX9867_02_AUX_HIGH 0x02 +#define MAX9867_03_AUX_LOW 0x03 +#define MAX9867_04_INT_EN 0x04 +#define MAX9867_05_SYS_CLK 0x05 +#define MAX9867_06_CLK_HIGH 0x06 +#define MAX9867_07_CLK_LOW 0x07 +#define MAX9867_08_DAI_FORMAT 0x08 +#define MAX9867_09_DAI_CLOCK 0x09 +#define MAX9867_0A_DIG_FILTER 0x0A +#define MAX9867_0B_SIDETONE 0x0B +#define MAX9867_0C_LVL_DAC 0x0C +#define MAX9867_0D_LVL_ADC 0x0D +#define MAX9867_0E_LVL_LINE_IN_LEFT 0x0E +#define MAX9867_0F_LVL_LINE_IN_RIGHT 0x0F +#define MAX9867_10_VOL_LEFT 0x10 +#define MAX9867_11_VOL_RIGHT 0x11 +#define MAX9867_12_MIC_GAIN_LEFT 0x12 +#define MAX9867_13_MIC_GAIN_RIGHT 0x13 +#define MAX9867_14_ADC_INPUT 0x14 +#define MAX9867_15_MIC 0x15 +#define MAX9867_16_MODE 0x16 +#define MAX9867_17_PWR_SYS 0x17 +#define MAX9867_FF_REV_ID 0xFF +// clang-format on + +#define MAX9867_ADDR 0x18 +#define MAX9867_REVID 0x42 + +#define MHZ(N) (N * 1000000) + +static mxc_i2c_req_t i2c_req; + +static int reg_write(uint8_t reg, uint8_t val) +{ + uint8_t buf[2] = { reg, val }; + + i2c_req.tx_buf = buf; + i2c_req.tx_len = sizeof(buf); + i2c_req.rx_len = 0; + + return MXC_I2C_MasterTransaction(&i2c_req); +} + +static int reg_read(uint8_t reg, uint8_t *dest) +{ + uint8_t buf[1] = { reg }; + + i2c_req.tx_buf = buf; + i2c_req.tx_len = sizeof(buf); + i2c_req.rx_buf = dest; + i2c_req.rx_len = 1; + + return MXC_I2C_MasterTransaction(&i2c_req); +} + +static int reg_update(uint8_t reg, uint8_t mask, uint8_t val) +{ + int err; + uint8_t tmp; + + if ((err = reg_read(reg, &tmp)) != E_NO_ERROR) + return err; + + tmp &= ~mask; + tmp |= val & mask; + + return reg_write(reg, tmp); +} + +int max9867_digital_filter(int fir, digital_filter_t fltra, digital_filter_t fltrd) +{ + return reg_write(MAX9867_0A_DIG_FILTER, (!!fir << 7) | (fltra << 4) | (fltrd << 0)); +} + +int max9867_digital_sidetone_source(digital_sidetone_source_t src) +{ + return reg_update(MAX9867_0B_SIDETONE, 0xC0, src << 6); +} + +int max9867_digital_sidetone_level(headphone_mode_t mode, int level) +{ + uint8_t dvst; + + if (level > 0) + dvst = 0; + else if ((mode == HPMODE_STEREO_DIFF_CLICKLESS) || (mode == HPMODE_MONO_DIFF_CLICKLESS)) + dvst = (0 - level) / 2 + 1; + else + dvst = ((0 - level) - 5) / 2 + 1; + + return reg_update(MAX9867_0B_SIDETONE, 0x1F, dvst); +} + +int max9867_dac_mute(int mute) +{ + return reg_update(MAX9867_0C_LVL_DAC, 0x40, !!mute << 6); +} + +int max9867_dac_gain(dac_gain_t gain) +{ + return reg_update(MAX9867_0C_LVL_DAC, 0x30, gain << 4); +} + +int max9867_dac_level(int level) +{ + uint8_t daca; + + daca = 0 - level; + + return reg_update(MAX9867_0C_LVL_DAC, 0x0F, daca); +} + +int max9867_adc_level(int left, int right) +{ + uint8_t avl, avr; + + avl = 3 - left; + avr = 3 - right; + + return reg_update(MAX9867_0D_LVL_ADC, 0xFF, (avl << 4) | (avr & 0x0F)); +} + +int max9867_linein_mute(int left, int right) +{ + int err; + + if ((err = reg_update(MAX9867_0E_LVL_LINE_IN_LEFT, 0x40, !!left << 6)) != E_NO_ERROR) + return err; + + return reg_update(MAX9867_0F_LVL_LINE_IN_RIGHT, 0x40, !!right << 6); +} + +int max9867_linein_gain(int left, int right) +{ + int err; + uint8_t ligl, ligr; + + ligl = (24 - left) / 2; + ligr = (24 - right) / 2; + + if ((err = reg_update(MAX9867_0E_LVL_LINE_IN_LEFT, 0x0F, ligl)) != E_NO_ERROR) + return err; + + return reg_update(MAX9867_0F_LVL_LINE_IN_RIGHT, 0x0F, ligr); +} + +int max9867_linein_vol_fix(int fix) +{ + return reg_update(MAX9867_09_DAI_CLOCK, 0x01, !!fix << 4); +} + +int max9867_playback_mute(int left, int right) +{ + int err; + + if ((err = reg_update(MAX9867_10_VOL_LEFT, 0x40, !!left << 6)) != E_NO_ERROR) + return err; + + return reg_update(MAX9867_11_VOL_RIGHT, 0x40, !!right << 6); +} + +static uint8_t map_vol(float vol) +{ + int tmp; + uint8_t res; + + tmp = vol * 10; + + if (tmp >= 30) + res = (60 - tmp) / 5; + else if (tmp >= -60) + res = (2 - (int)vol) + 7; + else if (tmp >= -220) + res = (8 - (int)vol) / 2 + 8; + else if (tmp >= -860) + res = (26 - (int)vol) / 4 + 11; + else + res = 0x3F; + + return res; +} + +int max9867_playback_volume(float left, float right) +{ + int err; + uint8_t voll, volr; + + voll = map_vol(left); + volr = map_vol(right); + + if ((err = reg_update(MAX9867_10_VOL_LEFT, 0x3F, voll)) != E_NO_ERROR) + return err; + + return reg_update(MAX9867_11_VOL_RIGHT, 0x3F, volr); +} + +int max9867_microphone_preamp(mic_pa_gain_t left, mic_pa_gain_t right) +{ + int err; + + if ((err = reg_update(MAX9867_12_MIC_GAIN_LEFT, 0x60, left << 5)) != E_NO_ERROR) + return err; + + return reg_update(MAX9867_13_MIC_GAIN_RIGHT, 0x60, right << 5); +} + +int max9867_microphone_gain(int left, int right) +{ + int err; + uint8_t pgaml, pgamr; + + pgaml = 20 - left; + pgamr = 20 - right; + + if ((err = reg_update(MAX9867_12_MIC_GAIN_LEFT, 0x1F, pgaml)) != E_NO_ERROR) + return err; + + return reg_update(MAX9867_13_MIC_GAIN_RIGHT, 0x1F, pgamr); +} + +int max9867_adc_input(adc_input_t left, adc_input_t right) +{ + return reg_update(MAX9867_14_ADC_INPUT, 0xF0, (left << 6) | (right << 4)); +} + +int max9867_microphone_clock(mic_clk_t mclk) +{ + return reg_update(MAX9867_15_MIC, 0xC0, mclk << 6); +} + +int max9867_microphone_enable(int left, int right) +{ + return reg_update(MAX9867_15_MIC, 0x30, (!!left << 5) | (!!right << 4)); +} + +int max9867_digital_volume_slew(int slew_80) +{ + return reg_update(MAX9867_16_MODE, 0x80, !!slew_80 << 7); +} + +int max9867_volume_change_smoothing(int one_step) +{ + return reg_update(MAX9867_16_MODE, 0x40, !!one_step << 6); +} + +int max9867_linein_zero_crossing_disable(int disable) +{ + return reg_update(MAX9867_16_MODE, 0x20, !!disable << 5); +} + +int max9867_jack_detect_enable(int enable) +{ + return reg_update(MAX9867_16_MODE, 0x08, !!enable << 3); +} + +int max9867_headphone_mode(headphone_mode_t mode) +{ + return reg_update(MAX9867_16_MODE, 0x07, mode); +} + +int max9867_power_enable(int shutdown, int enable) +{ + int err; + + if (shutdown) { + err = reg_write(MAX9867_17_PWR_SYS, 0x00); + return err; + } else { + return reg_write(MAX9867_17_PWR_SYS, 0x80 | enable); + } +} + +int max9867_enable_playback(int stereo) +{ + int err; + uint8_t en; + + if (!i2c_req.i2c) + return E_NULL_PTR; + + if ((err = max9867_headphone_mode(HPMODE_STEREO_SE_CLICKLESS)) != E_NO_ERROR) + return err; + + if ((err = max9867_playback_volume(0, 0)) != E_NO_ERROR) + return err; + + /* Assert SHDN as first step in toggling SHDN when changing enabled circuitry */ + if ((err = reg_update(MAX9867_17_PWR_SYS, 0x80, 0x00)) != E_NO_ERROR) + return err; + + en = EN_LEFT_DAC; + if (stereo) + en |= EN_RIGHT_DAC; + + return reg_update(MAX9867_17_PWR_SYS, 0x8C, 0x80 | en); +} + +int max9867_enable_record(int stereo) +{ + int err; + uint8_t en; + + if (!i2c_req.i2c) + return E_NULL_PTR; + + if ((err = max9867_adc_input(ADC_IN_LINE_IN, stereo ? ADC_IN_LINE_IN : ADC_IN_NONE)) != + E_NO_ERROR) + return err; + + if ((err = max9867_adc_level(0, 0)) != E_NO_ERROR) + return err; + + /* disconnect line inputs from headphone amplifiers */ + if ((err = max9867_linein_mute(1, 1)) != E_NO_ERROR) + return err; + + if ((err = max9867_linein_gain(0, 0)) != E_NO_ERROR) + return err; + + /* Assert SHDN as first step in toggling SHDN when changing enabled circuitry */ + if ((err = reg_update(MAX9867_17_PWR_SYS, 0x80, 0x00)) != E_NO_ERROR) + return err; + + en = EN_LEFT_ADC | EN_LEFT_LINEIN; + if (stereo) + en |= EN_RIGHT_ADC | EN_RIGHT_LINEIN; + + return reg_update(MAX9867_17_PWR_SYS, 0xE3, 0x80 | en); +} + +// Register addresses +#define MAX9867_00_STATUS 0x00 +#define MAX9867_01_JACKSENSE 0x01 +#define MAX9867_02_AUX_HIGH 0x02 +#define MAX9867_03_AUX_LOW 0x03 +#define MAX9867_04_INT_EN 0x04 +#define MAX9867_05_SYS_CLK 0x05 +#define MAX9867_06_CLK_HIGH 0x06 +#define MAX9867_07_CLK_LOW 0x07 +#define MAX9867_08_DAI_FORMAT 0x08 +#define MAX9867_09_DAI_CLOCK 0x09 +#define MAX9867_0A_DIG_FILTER 0x0A +#define MAX9867_0B_SIDETONE 0x0B +#define MAX9867_0C_LVL_DAC 0x0C +#define MAX9867_0D_LVL_ADC 0x0D +#define MAX9867_0E_LVL_LINE_IN_LEFT 0x0E +#define MAX9867_0F_LVL_LINE_IN_RIGHT 0x0F +#define MAX9867_10_VOL_LEFT 0x10 +#define MAX9867_11_VOL_RIGHT 0x11 +#define MAX9867_12_MIC_GAIN_LEFT 0x12 +#define MAX9867_13_MIC_GAIN_RIGHT 0x13 +#define MAX9867_14_ADC_INPUT 0x14 +#define MAX9867_15_MIC 0x15 +#define MAX9867_16_MODE 0x16 +#define MAX9867_17_PWR_SYS 0x17 +#define MAX9867_FF_REV_ID 0xFF + +// MAX9867_04_INT_EN +#define MAX9867_ICLD (1 << 7) +#define MAX9867_SDODLY (1 << 2) + +// MAX9867_05_SYS_CLK +#define MAX9867_PSCLK_POS 4 + +// MAX9867_06_CLK_HIGH +#define MAX9867_PLL (1 << 7) +#define MAX9867_NI_UPPER_48KHZ 0x60 + +// MAX9867_07_CLK_LOW +#define MAX9867_NI_LOWER_48KHZ 0x00 + +// MAX9867_08_DAI_FORMAT +#define MAX9867_MAS (1 << 7) +#define MAX9867_WCI (1 << 6) +#define MAX9867_BCI (1 << 5) +#define MAX9867_DLY (1 << 4) +#define MAX9867_HIZOFF (1 << 3) +#define MAX9867_TDM (1 << 2) + +// MAX9867_09_DAI_CLOCK +#define MAX9867_BSEL_PCLK_DIV8 0x06 + +// MAX9867_0D_LVL_ADC +#define MAX9867_AVL_POS 4 +#define MAX9867_AVR_POS 0 + +// MAX9867_0E_LVL_LINE_IN_LEFT +// MAX9867_0F_LVL_LINE_IN_RIGHT +#define MAX9867_LI_MUTE (1 << 6) +#define MAX9867_LI_GAIN_POS 0 + +// MAX9867_10_VOL_LEFT +// MAX9867_11_VOL_RIGHT +#define MAX9867_VOL_POS 0 + +// MAX9867_14_ADC_INPUT +#define MAX9867_MXINL_POS 6 +#define MAX9867_MXINR_POS 4 +#define MAX9867_MXIN_DIS 0 +#define MAX9867_MXIN_ANALOG_MIC 1 +#define MAX9867_MXIN_LINE 2 + +// MAX9867_15_MIC +#define MAX9867_MICCLK_POS 6 +#define MAX9867_DIGMICL_POS 5 +#define MAX9867_DIGMICR_POS 4 + +// MAX9867_16_MODE +#define MAX9867_HPMODE_POS 0 +#define MAX9867_STEREO_SE_CLICKLESS 4 +#define MAX9867_MONO_SE_CLICKLESS 5 + +// MAX9867_17_PWR_SYS +#define MAX9867_SHDN (1 << 7) +#define MAX9867_LNLEN (1 << 6) +#define MAX9867_LNREN (1 << 5) +#define MAX9867_DALEN (1 << 3) +#define MAX9867_DAREN (1 << 2) +#define MAX9867_ADLEN (1 << 1) +#define MAX9867_ADREN (1 << 0) + +#define MHZ(N) (N * 1000000) + +int max9867_init(mxc_i2c_regs_t *i2c_inst, int mclk, int controller) +{ + int err; + uint8_t rev_id; + int psclk; + + if (!i2c_inst) + return E_NULL_PTR; + + /* Static I2C request values */ + i2c_req.i2c = i2c_inst; + i2c_req.addr = MAX9867_ADDR; + i2c_req.restart = 0; + i2c_req.callback = (void *)0; + + /* Probe for MAX9867 */ + if ((err = reg_read(MAX9867_FF_REV_ID, &rev_id)) != E_NO_ERROR) + return err; + + if (rev_id != MAX9867_REVID) + return E_NOT_SUPPORTED; + + /* Shutdown for configuration */ + if ((err = max9867_power_enable(1, 0)) != E_NO_ERROR) + return err; + + /* Clear all regs to POR state */ + for (int i = MAX9867_04_INT_EN; i < MAX9867_17_PWR_SYS; i++) + if ((err = reg_write(i, 0x00)) != E_NO_ERROR) + return err; + + /* Select MCLK prescaler */ + if ((mclk < MHZ(10)) || (mclk > MHZ(60))) + return E_INVALID; + else if (mclk < MHZ(20)) + psclk = 0x1; + else if (mclk < MHZ(40)) + psclk = 0x2; + else + psclk = 0x3; + + /* Set prescaler, FREQ field is 0 for Normal clock mode */ + if ((err = reg_write(MAX9867_05_SYS_CLK, psclk << 4)) != E_NO_ERROR) + return err; + + /* Use PLL in target mode or appropriate NI in controller mode. + NI=0x3000 when MCLK=12.288MHz and LRCLK=24KHz + See MAX9867 datasheet for NI selection */ + if ((err = reg_write(MAX9867_06_CLK_HIGH, controller ? 0x30 : 0x80)) != E_NO_ERROR) + return err; + + if (controller) + if ((err = reg_write(MAX9867_09_DAI_CLOCK, 0x02)) != E_NO_ERROR) + return err; + + /* I2S format, data is delayed 1 bit clock, HI-Z mode disabled */ + if ((err = reg_write(MAX9867_08_DAI_FORMAT, controller ? 0x98 : 0x18)) != E_NO_ERROR) + return err; + + // Enable device + return reg_write(MAX9867_17_PWR_SYS, MAX9867_LNLEN | MAX9867_LNREN | MAX9867_SHDN | + MAX9867_DALEN | MAX9867_DAREN | MAX9867_ADLEN | + MAX9867_ADREN); + + return E_NO_ERROR; +} diff --git a/Examples/MAX32665/AUDIO_Playback/max9867.h b/Examples/MAX32665/AUDIO_Playback/max9867.h new file mode 100644 index 00000000000..7752e34a4d8 --- /dev/null +++ b/Examples/MAX32665/AUDIO_Playback/max9867.h @@ -0,0 +1,371 @@ +/****************************************************************************** + * Copyright (C) 2023 Maxim Integrated Products, Inc., All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES + * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of Maxim Integrated + * Products, Inc. shall not be used except as stated in the Maxim Integrated + * Products, Inc. Branding Policy. + * + * The mere transfer of this software does not imply any licenses + * of trade secrets, proprietary technology, copyrights, patents, + * trademarks, maskwork rights, or any other form of intellectual + * property whatsoever. Maxim Integrated Products, Inc. retains all + * ownership rights. + * + ******************************************************************************/ + +#ifndef LIBRARIES_MISCDRIVERS_CODEC_MAX9867_H_ +#define LIBRARIES_MISCDRIVERS_CODEC_MAX9867_H_ + +#include "i2c.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// clang-format off +typedef enum _AVFLT_DVFLT { + FILTER_DISABLED, + ELLIPTICAL_SR16KHZ, + BUTTERWORTH_SR16KHZ, + ELLIPTICAL_SR8KHZ, + BUTTERWORTH_SR8KHZ, + BUTTERWORTH_SR8TO24KHZ, + DC_BLOCKING = BUTTERWORTH_SR8TO24KHZ +} digital_filter_t; + +typedef enum _DSTS { + DSTS_NONE, + DSTS_LEFT_ADC, + DSTS_RIGHT_ADC, + DSTS_LEFT_RIGHT_ADC +} digital_sidetone_source_t; + +typedef enum _DACG { + DAC_GAIN_0, + DAC_GAIN_6, + DAC_GAIN_12, + DAC_GAIN_18 +} dac_gain_t; + +typedef enum _MXINL_MXINR { + ADC_IN_NONE, + ADC_IN_ANALOG_MIC, + ADC_IN_LINE_IN, + ADC_IN_LINE_IN_ANALOG_MIC +} adc_input_t; + +typedef enum _PGAML_PGAMR { + MIC_PA_GAIN_DISABLE, + MIC_PA_GAIN_0, + MIC_PA_GAIN_20, + MIC_PA_GAIN_30 +} mic_pa_gain_t; + +typedef enum _MICCLK { + MICCLK_PCLK_DIV8, + MICCLK_PCLK_DIV6 +} mic_clk_t; + +typedef enum _PMREG { + EN_RIGHT_ADC = 0x01, + EN_LEFT_ADC = 0x02, + EN_RIGHT_DAC = 0x04, + EN_LEFT_DAC = 0x08, + EN_LEFT_LINEIN = 0x20, + EN_RIGHT_LINEIN = 0x40 +} codec_enables_t; + +typedef enum _HPMODE { + HPMODE_STEREO_DIFF_CLICKLESS, + HPMODE_MONO_DIFF_CLICKLESS, + HPMODE_STEREO_NOCAP_CLICKLESS, + HPMODE_MONO_NOCAP_CLICKLESS, + HPMODE_STEREO_SE_CLICKLESS, + HPMODE_MONO_SE_CLICKLESS, + HPMODE_STEREO_SE_FAST_ON, + HPMODE_MONO_SE_FAST_ON +} headphone_mode_t; +// clang-format on + +/** + * @brief Select IIR Voice or FIR Audio filters for ADC and DAC + * + * @param fir Filter type selection 0 = IIR, 1 = FIR. + * @param fltra ADC digital audio filter, one of digital_filter_t. + * @param fltrd DAC digital audio filter, one of digital_filter_t. + * @return int #E_NO_ERROR if successful, @ref MXC_Error_Codes "error" if unsuccessful. + */ +int max9867_digital_filter(int fir, digital_filter_t fltra, digital_filter_t fltrd); + +/** + * @brief Select digital sidetone source + * + * @param src Sidetone source, one of digital_sidetone_source_t. + * @return int #E_NO_ERROR if successful, @ref MXC_Error_Codes "error" if unsuccessful. + */ +int max9867_digital_sidetone_source(digital_sidetone_source_t src); + +/** + * @brief Select digital sidetone level + * + * @note Valid sidetone levels are [-60,0] in steps of +2 for differential mode and + * [-65,-5] in steps of +2 for capacitorless and single-ended modes. + * + * @param differential Current mode headphone mode, one of headphone_mode_t. + * @param level Sidetone level, levels greater than zero are taken as OFF. + * @return int #E_NO_ERROR if successful, @ref MXC_Error_Codes "error" if unsuccessful. + */ +int max9867_digital_sidetone_level(headphone_mode_t differential, int level); + +/** + * @brief DAC mute control + * + * @param mute Mute state 0 = unmuted, 1 = muted. + * @return int #E_NO_ERROR if successful, @ref MXC_Error_Codes "error" if unsuccessful. + */ +int max9867_dac_mute(int mute); + +/** + * @brief Set DAC gain + * + * @param gain Gain value, one of dac_gain_t. + * @return int #E_NO_ERROR if successful, @ref MXC_Error_Codes "error" if unsuccessful. + */ +int max9867_dac_gain(dac_gain_t gain); + +/** + * @brief Set DAC level + * + * @note Valid DAC levels are [-15,0] + * + * @param level Level value + * @return int #E_NO_ERROR if successful, @ref MXC_Error_Codes "error" if unsuccessful. + */ +int max9867_dac_level(int level); + +/** + * @brief Set ADC left and right level + * + * @note Valid left and right levels are [-12,+3] + * + * @param left Left level value + * @param right Right level value + * @return int #E_NO_ERROR if successful, @ref MXC_Error_Codes "error" if unsuccessful. + */ +int max9867_adc_level(int left, int right); + +/** + * @brief Set line-in playback mute + * + * @param left Mute state 0 = unmuted, 1 = muted. + * @param right Mute state 0 = unmuted, 1 = muted. + * @return int #E_NO_ERROR if successful, @ref MXC_Error_Codes "error" if unsuccessful. + */ +int max9867_linein_mute(int left, int right); + +/** + * @brief Set line-in left and right gain + * + * @note Valid line-in gain values are [-6,+24] in steps of +2 ie -6, -4, -2, 0, +2 + * + * @param left Gain value. + * @param right Gain value. + * @return int #E_NO_ERROR if successful, @ref MXC_Error_Codes "error" if unsuccessful. + */ +int max9867_linein_gain(int left, int right); + +/** + * @brief Set line-in to headphone output volume tracking + * + * @param fix Fix value 0 = headphone output volume tracks line-in, 1 headphone output volume fixed. + * @return int #E_NO_ERROR if successful, @ref MXC_Error_Codes "error" if unsuccessful. + */ +int max9867_linein_vol_fix(int fix); + +/** + * @brief Set playback mute of DAC and line-in signals + * + * @param left Mute state 0 = unmuted, 1 = muted + * @param right Mute state 0 = unmuted, 1 = muted + * @return int #E_NO_ERROR if successful, @ref MXC_Error_Codes "error" if unsuccessful. + */ +int max9867_playback_mute(int left, int right); + +/** + * @brief Set playback volume of DAC and line-in signals + * + * @note Valid left and right volume values are + * +6.0, +1.0, -8.0, -26.0, -58.0, + * +5.5, 0.0, -10.0, -30.0, -62.0, + * +5.0, -1.0, -12.0, -34.0, -66.0, + * +4.5, -2.0, -14.0, -38.0, -70.0, + * +4.0, -3.0, -16.0, -42.0, -74.0, + * +3.5, -4.0, -18.0, -46.0, -78.0, + * +3.0, -5.0, -20.0, -50.0, -82.0, + * +2.0, -6.0, -22.0, -54.0, -84.0 + * A value of -85.0 mutes the channel. + * + * @param left Volume value. + * @param right Volume value. + * @return int #E_NO_ERROR if successful, @ref MXC_Error_Codes "error" if unsuccessful. + */ +int max9867_playback_volume(float left, float right); + +/** + * @brief Set microphone preamplifier gain + * + * @param left Gain value, one of mic_pa_gain_t. + * @param right Gain value, one of mic_pa_gain_t. + * @return int #E_NO_ERROR if successful, @ref MXC_Error_Codes "error" if unsuccessful. + */ +int max9867_microphone_preamp(mic_pa_gain_t left, mic_pa_gain_t right); + +/** + * @brief Set microphone PGA gain + * + * @note Valid gain values are [0,+20] + * + * @param left Gain value. + * @param right Gain value. + * @return int #E_NO_ERROR if successful, @ref MXC_Error_Codes "error" if unsuccessful. + */ +int max9867_microphone_gain(int left, int right); + +/** + * @brief Set ADC mixer input + * + * @param left Mixer input selection, one of adc_input_t. + * @param right Mixer input selection, one of adc_input_t. + * @return int #E_NO_ERROR if successful, @ref MXC_Error_Codes "error" if unsuccessful. + */ +int max9867_adc_input(adc_input_t left, adc_input_t right); + +/** + * @brief Set digital microphone clock + * + * @param mclk Clock value, one of mic_clk_t. + * @return int #E_NO_ERROR if successful, @ref MXC_Error_Codes "error" if unsuccessful. + */ +int max9867_microphone_clock(mic_clk_t mclk); + +/** + * @brief Digital microphone enable + * + * @param left Enable value 0 = disabled, 1 = enabled. + * @param right Enable value 0 = disabled, 1 = enabled. + * @return int #E_NO_ERROR if successful, @ref MXC_Error_Codes "error" if unsuccessful. + */ +int max9867_microphone_enable(int left, int right); + +/** + * @brief Set digital volume slew speed + * + * @param slew_80 Slew speed 0 = 10ms, 1 = 80ms. + * @return int #E_NO_ERROR if successful, @ref MXC_Error_Codes "error" if unsuccessful. + */ +int max9867_digital_volume_slew(int slew_80); + +/** + * @brief Set volume smoothing + * + * @param one_step Step rate 0 = slew through intermediate values, 1 = change on one step. + * @return int #E_NO_ERROR if successful, @ref MXC_Error_Codes "error" if unsuccessful. + */ +int max9867_volume_change_smoothing(int one_step); + +/** + * @brief Set line-in zero crossing detection + * + * @param disable Detection state 0 = change volume at zero crossings or after 62ms if no zero crossing, + * 1 = volume changes occur immediately. + * @return int #E_NO_ERROR if successful, @ref MXC_Error_Codes "error" if unsuccessful. + */ +int max9867_linein_zero_crossing_disable(int disable); + +/** + * @brief Jack detection enable + * + * @param enable Enable state + * @return int #E_NO_ERROR if successful, @ref MXC_Error_Codes "error" if unsuccessful. + */ +int max9867_jack_detect_enable(int enable); + +/** + * @brief Set headphone amplifier mode + * + * @param mode Mode selection, headphone_mode_t. + * @return int #E_NO_ERROR if successful, @ref MXC_Error_Codes "error" if unsuccessful. + */ +int max9867_headphone_mode(headphone_mode_t mode); + +/** + * @brief Set power state + * + * @param shutdown Shutdown 0 = normal operation, 1 = low-power shutdown mode. + * @param enable Enabled device functions. A bitfield of devices to be enabled. + * @return int #E_NO_ERROR if successful, @ref MXC_Error_Codes "error" if unsuccessful. + */ +int max9867_power_enable(int shutdown, int enable); + +/** + * @brief Enable playback signal path + * + * @note Headphone output is configured for single-ended clickless mode, playback volume is set to 0dB. + * The CODEC must be initialized by calling max9867_init() prior to calling this function. + * + * @param stereo Enable left and right channels when = 1, enable left channel only when = 0. + * @return int #E_NO_ERROR if successful, @ref MXC_Error_Codes "error" if unsuccessful. + */ +int max9867_enable_playback(int stereo); + +/** + * @brief Enable record signal path + * + * @note ADC and line-in circuits are enabled, ADC and line-in levels are set to 0dB. The CODEC must + * be initialized by calling max9867_init() prior to calling this function. + * + * @param stereo Enable left and right channels when = 1, enable left channel only when = 0. + * @return int #E_NO_ERROR if successful, @ref MXC_Error_Codes "error" if unsuccessful. + */ +int max9867_enable_record(int stereo); + +/** + * @brief Initialize MAX9867 CODEC + * + * @details The initialization function first verifies communication with a MAX9867 CODEC by reading + * the part revision identification register. If a suitable device is found then the digital + * audio interface (DAI) is configured for I2S data. The MCLK prescaler is configured based on + * the provided mclk parameter. + * On return if no errors are encountered the DAI and MCLK are configured and the device is in + * low-power mode. + * + * @param i2c_inst I2C instance for communication with CODEC + * @param mclk MCLK input frequency in Hz + * @param controller configure as I2S controller + * @return int #E_NO_ERROR if successful, @ref MXC_Error_Codes "error" if unsuccessful. + */ +int max9867_init(mxc_i2c_regs_t *i2c_inst, int mclk, int controller); + +#ifdef __cplusplus +} +#endif + +#endif // LIBRARIES_MISCDRIVERS_CODEC_MAX9867_H_ diff --git a/Examples/MAX32665/AUDIO_Playback/project.mk b/Examples/MAX32665/AUDIO_Playback/project.mk new file mode 100644 index 00000000000..70d124b049a --- /dev/null +++ b/Examples/MAX32665/AUDIO_Playback/project.mk @@ -0,0 +1,15 @@ +# This file can be used to set build configuration +# variables. These variables are defined in a file called +# "Makefile" that is located next to this one. + +# For instructions on how to use this system, see +# https://analog-devices-msdk.github.io/msdk/USERGUIDE/#build-system + +# ********************************************************** + +# Add your config here! + +# If you have secure version of MCU (MAX32666), set SBT=1 to generate signed binary +# For more information on how sing process works, see +# https://www.analog.com/en/education/education-library/videos/6313214207112.html +SBT=0