Changeset - 0d9900312165
[Not reviewed]
default
! ! !
Ethan Zonca - 10 years ago 2016-01-19 21:34:58
ez@ethanzonca.com
Initial import
41 files changed:
.cproject
137
Makefile
232
TODO
1
Changeset was too big and was cut off... Show full diff anyway
0 comments (0 inline, 0 general)
.cproject
Show inline comments
 
new file 100644
 
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
 
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
 
	<storageModule moduleId="org.eclipse.cdt.core.settings">
 
		<cconfiguration id="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.1179702141">
 
			<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.1179702141" moduleId="org.eclipse.cdt.core.settings" name="Default">
 
				<externalSettings/>
 
				<extensions>
 
					<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
 
					<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
 
					<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
 
					<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
 
					<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
 
					<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
 
				</extensions>
 
			</storageModule>
 
			<storageModule moduleId="cdtBuildSystem" version="4.0.0">
 
				<configuration buildProperties="" id="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.1179702141" name="Default" parent="org.eclipse.cdt.build.core.emptycfg">
 
					<folderInfo id="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.1179702141.563078694" name="/" resourcePath="">
 
						<toolChain id="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.284267348" name="Cross ARM GCC" superClass="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base">
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.architecture.1569844285" name="Architecture" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.architecture"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.prefix.605969051" name="Prefix" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.prefix"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.suffix.2136464713" name="Suffix" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.suffix"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.c.1196909888" name="C compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.c"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.cpp.1459917032" name="C++ compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.cpp"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.ar.2064709582" name="Archiver" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.ar"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.objcopy.157043647" name="Hex/Bin converter" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.objcopy"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.objdump.1497304368" name="Listing generator" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.objdump"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.size.229591456" name="Size command" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.size"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.make.2026466757" name="Build command" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.make"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.rm.1946599489" name="Remove command" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.rm"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.useglobalpath.1436654245" name="Use global path" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.useglobalpath"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.path.860226905" name="Path" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.path"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createflash.1290254481" name="Create flash image" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createflash"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createlisting.347447502" name="Create extended listing" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createlisting"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.printsize.1513063856" name="Print size" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.printsize"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.family.605857637" name="ARM family" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.family"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.architecture.537705050" name="Architecture" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.architecture"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.instructionset.1320909947" name="Instruction set" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.instructionset"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.thumbinterwork.245751081" name="Thumb interwork (-mthumb-interwork)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.thumbinterwork"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.endianness.786205649" name="Endianness" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.endianness"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.abi.119758581" name="Float ABI" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.abi"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.unit.418791700" name="FPU Type" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.unit"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.unalignedaccess.2110027511" name="Unaligned access" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.unalignedaccess"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.family.105078982" name="AArch64 family" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.family"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.crc.1426533836" name="Feature crc" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.crc"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.crypto.632213283" name="Feature crypto" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.crypto"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.fp.58025618" name="Feature fp" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.fp"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.simd.1943951582" name="Feature simd" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.simd"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.cmodel.868050951" name="Code model" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.cmodel"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.strictalign.1532216982" name="Strict align (-mstrict-align)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.strictalign"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.target.other.1637683631" name="Other target flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.target.other"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.level.350995061" name="Optimization Level" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.level"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.messagelength.1824978766" name="Message length (-fmessage-length=0)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.messagelength"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.signedchar.1168480527" name="'char' is signed (-fsigned-char)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.signedchar"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.functionsections.201297509" name="Function sections (-ffunction-sections)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.functionsections"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.datasections.2139463062" name="Data sections (-fdata-sections)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.datasections"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.nocommon.862204323" name="No common unitialized (-fno-common)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.nocommon"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.noinlinefunctions.1098163650" name="Do not inline functions (-fno-inline-functions)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.noinlinefunctions"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.freestanding.1740661362" name="Assume freestanding environment (-ffreestanding)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.freestanding"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.nobuiltin.962998611" name="Disable builtin (-fno-builtin)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.nobuiltin"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.spconstant.1811642886" name="Single precision constants (-fsingle-precision-constant)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.spconstant"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.PIC.1291959450" name="Position independent code (-fPIC)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.PIC"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.other.719137075" name="Other optimization flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.other"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.name.646545745" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.name"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.syntaxonly.524833904" name="Check syntax only (-fsyntax-only)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.syntaxonly"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pedantic.1018431314" name="Pedantic (-pedantic)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pedantic"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pedanticerrors.1406575137" name="Pedantic warnings as errors (-pedantic-errors)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pedanticerrors"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.nowarn.752150954" name="Inhibit all warnings (-w)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.nowarn"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.unused.849054942" name="Warn on various unused elements (-Wunused)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.unused"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.uninitialized.803518835" name="Warn on uninitialized variables (-Wuninitialised)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.uninitialized"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.allwarn.2022318774" name="Enable all common warnings (-Wall)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.allwarn"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.extrawarn.61330147" name="Enable extra warnings (-Wextra)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.extrawarn"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.missingdeclaration.933355601" name="Warn on undeclared global function (-Wmissing-declaration)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.missingdeclaration"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.conversion.869249753" name="Warn on implicit conversions (-Wconversion)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.conversion"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pointerarith.268080389" name="Warn if pointer arithmetic (-Wpointer-arith)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pointerarith"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.padded.352884270" name="Warn if padding is included (-Wpadded)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.padded"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.shadow.1124831646" name="Warn if shadowed variable (-Wshadow)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.shadow"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.logicalop.1490132188" name="Warn if suspicious logical ops (-Wlogical-op)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.logicalop"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.agreggatereturn.844171767" name="Warn if struct is returned (-Wagreggate-return)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.agreggatereturn"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.floatequal.667498679" name="Warn if floats are compared as equal (-Wfloat-equal)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.floatequal"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.toerrors.371847146" name="Generate errors instead of warnings (-Werror)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.toerrors"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.other.63993206" name="Other warning flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.other"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.level.120866882" name="Debug level" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.level"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.format.1726987778" name="Debug format" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.format"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.prof.1216926424" name="Generate prof information (-p)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.prof"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.gprof.1054277487" name="Generate gprof information (-pg)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.gprof"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.other.1924442072" name="Other debugging flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.other"/>
 
							<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform.104420869" isAbstract="false" osList="all" superClass="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform"/>
 
							<builder id="ilg.gnuarmeclipse.managedbuild.cross.builder.2134930605" managedBuildOn="false" name="Gnu Make Builder.Default" superClass="ilg.gnuarmeclipse.managedbuild.cross.builder"/>
 
							<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.1256890659" name="Cross ARM GNU Assembler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler">
 
								<option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor.1205395087" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor" value="true" valueType="boolean"/>
 
								<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input.1711087786" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input"/>
 
							</tool>
 
							<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.136903252" name="Cross ARM C Compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler">
 
								<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.347317412" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input"/>
 
							</tool>
 
							<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.1246495526" name="Cross ARM C++ Compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler"/>
 
							<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.linker.1047334191" name="Cross ARM C Linker" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.linker">
 
								<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.gcsections.543163159" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.gcsections" value="true" valueType="boolean"/>
 
								<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.linker.input.597966856" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.linker.input">
 
									<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
 
									<additionalInput kind="additionalinput" paths="$(LIBS)"/>
 
								</inputType>
 
							</tool>
 
							<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.linker.1547689373" name="Cross ARM C++ Linker" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.linker">
 
								<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.gcsections.1375494925" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.gcsections" value="true" valueType="boolean"/>
 
							</tool>
 
							<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.archiver.133486429" name="Cross ARM GNU Archiver" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.archiver"/>
 
							<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.createflash.2093603710" name="Cross ARM GNU Create Flash Image" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.createflash"/>
 
							<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.createlisting.872028790" name="Cross ARM GNU Create Listing" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.createlisting">
 
								<option id="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.source.403476032" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.source" value="true" valueType="boolean"/>
 
								<option id="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.allheaders.1084849349" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.allheaders" value="true" valueType="boolean"/>
 
								<option id="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.demangle.1330032315" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.demangle" value="true" valueType="boolean"/>
 
								<option id="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.linenumbers.113912156" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.linenumbers" value="true" valueType="boolean"/>
 
								<option id="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.wide.105087480" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.wide" value="true" valueType="boolean"/>
 
							</tool>
 
							<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.printsize.1264269538" name="Cross ARM GNU Print Size" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.printsize">
 
								<option id="ilg.gnuarmeclipse.managedbuild.cross.option.printsize.format.1013771305" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.printsize.format"/>
 
							</tool>
 
						</toolChain>
 
					</folderInfo>
 
				</configuration>
 
			</storageModule>
 
			<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
 
		</cconfiguration>
 
	</storageModule>
 
	<storageModule moduleId="cdtBuildSystem" version="4.0.0">
 
		<project id="wsprhab.null.304095724" name="wsprhab"/>
 
	</storageModule>
 
	<storageModule moduleId="scannerConfiguration">
 
		<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
 
		<scannerConfigBuildInfo instanceId="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.1179702141;ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.1179702141.563078694;ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.136903252;ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.347317412">
 
			<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
 
		</scannerConfigBuildInfo>
 
	</storageModule>
 
	<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
 
</cproject>
.project
Show inline comments
 
new file 100644
 
<?xml version="1.0" encoding="UTF-8"?>
 
<projectDescription>
 
	<name>wsprhab</name>
 
	<comment></comment>
 
	<projects>
 
	</projects>
 
	<buildSpec>
 
		<buildCommand>
 
			<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
 
			<triggers>clean,full,incremental,</triggers>
 
			<arguments>
 
			</arguments>
 
		</buildCommand>
 
		<buildCommand>
 
			<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
 
			<triggers>full,incremental,</triggers>
 
			<arguments>
 
			</arguments>
 
		</buildCommand>
 
	</buildSpec>
 
	<natures>
 
		<nature>org.eclipse.cdt.core.cnature</nature>
 
		<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
 
		<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
 
	</natures>
 
</projectDescription>
.settings/language.settings.xml
Show inline comments
 
new file 100644
 
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
 
<project>
 
	<configuration id="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.1179702141" name="Default">
 
		<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
 
			<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
 
			<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
 
			<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
 
			<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="1398045149230176998" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings Cross ARM" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
 
				<language-scope id="org.eclipse.cdt.core.gcc"/>
 
				<language-scope id="org.eclipse.cdt.core.g++"/>
 
			</provider>
 
			<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
 
		</extension>
 
	</configuration>
 
</project>
Makefile
Show inline comments
 
new file 100644
 
# STM32F0xx Makefile
 
# #####################################
 
#
 
# Part of the uCtools project
 
# uctools.github.com
 
#
 
#######################################
 
# user configuration:
 
#######################################
 

	
 
BUILD_NUMBER ?= 0
 

	
 
# SOURCES: list of sources in the user application
 
SOURCES = main.c system_stm32f0xx.c adc.c dma.c gpio.c i2c.c stm32f0xx_hal_msp.c stm32f0xx_it.c usart.c  gps.c
 

	
 
# TARGET: name of the user application
 
TARGET = wsprhab-b$(BUILD_NUMBER)
 

	
 
# BUILD_DIR: directory to place output files in
 
BUILD_DIR = build
 

	
 
# LD_SCRIPT: location of the linker script
 
LD_SCRIPT = STM32F031G6_FLASH.ld
 

	
 
# USER_DEFS user defined macros
 
USER_DEFS = -D HSE_VALUE=16000000
 
USER_DEFS += -D WSPRHAB_BUILD_NUMBER=$(BUILD_NUMBER)
 

	
 
# USER_INCLUDES: user defined includes
 
USER_INCLUDES =
 

	
 
# USB_INCLUDES: includes for the usb library
 
# USB_INCLUDES = -IMiddlewares/ST/STM32_USB_Device_Library/Core/Inc
 
#USB_INCLUDES += -IMiddlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc
 

	
 
SI5351_INCLUDES = -Ilib/si5351
 

	
 
JTENCODE_INCLUDES = -Ilib/jtencode
 

	
 
# USER_CFLAGS: user C flags (enable warnings, enable debug info)
 
USER_CFLAGS = -Wall -g -ffunction-sections -fdata-sections -Os -fno-common --function-sections -fdata-sections -flto
 
# USER_LDFLAGS:  user LD flags
 
USER_LDFLAGS = -fno-exceptions -ffunction-sections -fdata-sections -Wl,--gc-sections -flto
 
USER_LDFLAGS += --static
 
# -nostartfiles 
 

	
 
# TARGET_DEVICE: device to compile for
 
TARGET_DEVICE = STM32F031x6
 

	
 
#######################################
 
# end of user configuration
 
#######################################
 
#
 
#######################################
 
# binaries
 
#######################################
 
CC = arm-none-eabi-gcc
 
AR = arm-none-eabi-ar
 
RANLIB = arm-none-eabi-ranlib
 
SIZE = arm-none-eabi-size
 
OBJCOPY = arm-none-eabi-objcopy
 
MKDIR = mkdir -p
 
#######################################
 

	
 
# core and CPU type for Cortex M0
 
# ARM core type (CORE_M0, CORE_M3)
 
CORE = CORE_M0
 
# ARM CPU type (cortex-m0, cortex-m3)
 
CPU = cortex-m0
 

	
 
# where to build STM32Cube
 
CUBELIB_BUILD_DIR = $(BUILD_DIR)/STM32Cube
 

	
 
# various paths within the STmicro library
 
CMSIS_PATH = drivers/CMSIS
 
CMSIS_DEVICE_PATH = $(CMSIS_PATH)/Device/ST/STM32F0xx
 
DRIVER_PATH = drivers/STM32F0xx_HAL_Driver
 

	
 

	
 
# includes for gcc
 
INCLUDES = -I$(CMSIS_PATH)/Include
 
INCLUDES += -I$(CMSIS_DEVICE_PATH)/Include
 
INCLUDES += -I$(DRIVER_PATH)/Inc
 
INCLUDES += -Iinc
 
#INCLUDES += $(USB_INCLUDES)
 
INCLUDES += $(USER_INCLUDES)
 
INCLUDES += $(SI5351_INCLUDES)
 
INCLUDES += $(JTENCODE_INCLUDES)
 

	
 

	
 
# macros for gcc
 
DEFS = -D$(CORE) $(USER_DEFS) -D$(TARGET_DEVICE)
 

	
 
# compile gcc flags
 
CFLAGS = $(DEFS) $(INCLUDES)
 
CFLAGS += -mcpu=$(CPU) -mthumb -msoft-float
 
CFLAGS += $(USER_CFLAGS)
 

	
 
# default action: build the user application
 
all: $(BUILD_DIR)/$(TARGET).bin $(BUILD_DIR)/$(TARGET).hex
 

	
 
flash: all
 
	st-flash write $(BUILD_DIR)/$(TARGET).bin 0x8000000
 

	
 

	
 
#######################################
 
# build the st micro peripherial library
 
# (drivers and CMSIS)
 
#######################################
 

	
 
CUBELIB = $(CUBELIB_BUILD_DIR)/libstm32cube.a
 

	
 
# List of stm32 driver objects
 
CUBELIB_DRIVER_OBJS = $(addprefix $(CUBELIB_BUILD_DIR)/, $(patsubst %.c, %.o, $(notdir $(wildcard $(DRIVER_PATH)/Src/*.c))))
 

	
 
# shortcut for building core library (make cubelib)
 
cubelib: $(CUBELIB)
 

	
 
$(CUBELIB): $(CUBELIB_DRIVER_OBJS)
 
	$(AR) rv $@ $(CUBELIB_DRIVER_OBJS)
 
	$(RANLIB) $@
 

	
 
$(CUBELIB_BUILD_DIR)/%.o: $(DRIVER_PATH)/Src/%.c | $(CUBELIB_BUILD_DIR)
 
	$(CC) -c $(CFLAGS) -o $@ $^
 

	
 
$(CUBELIB_BUILD_DIR):
 
	$(MKDIR) $@
 

	
 
#######################################
 
# build the USB library
 
#######################################
 
#USB_MIDDLEWARE_PATH = ./Middlewares/ST/STM32_USB_Device_Library/
 
#USB_BUILD_DIR = $(BUILD_DIR)/usb
 
#USB_SOURCES += usbd_ctlreq.c usbd_ioreq.c usbd_core.c usbd_cdc.c
 
# list of usb library objects
 
#USB_OBJECTS += $(addprefix $(USB_BUILD_DIR)/,$(notdir $(USB_SOURCES:.c=.o)))
 

	
 
#usb: $(USB_OBJECTS)
 

	
 
#$(USB_BUILD_DIR)/%.o: $(USB_MIDDLEWARE_PATH)/Core/Src/%.c | $(USB_BUILD_DIR)
 
#	$(CC) -Os $(CFLAGS) -c -o $@ $^
 
#
 
#$(USB_BUILD_DIR)/%.o: $(USB_MIDDLEWARE_PATH)/Class/CDC/Src/%.c | $(USB_BUILD_DIR)
 
#	$(CC) -Os $(CFLAGS) -c -o $@ $^
 

	
 
#$(USB_BUILD_DIR):
 
#	@echo $(USB_BUILD_DIR)
 
#	$(MKDIR) $@
 

	
 

	
 
#######################################
 
# build the user libraries
 
#######################################
 

	
 
# si5351
 
SI5351_PATH = ./lib/si5351/
 
SI5351_BUILD_DIR = $(BUILD_DIR)/si5351
 
SI5351_SOURCES += si5351.c
 

	
 
SI5351_OBJECTS += $(addprefix $(SI5351_BUILD_DIR)/,$(notdir $(SI5351_SOURCES:.c=.o)))
 

	
 
si5351: $(SI5351_OBJECTS)
 

	
 
$(SI5351_BUILD_DIR)/%.o: $(SI5351_PATH)/%.c | $(SI5351_BUILD_DIR)
 
	$(CC) -Os $(CFLAGS) -c -o $@ $^
 

	
 
$(SI5351_BUILD_DIR):
 
	@echo $(SI5351_BUILD_DIR)
 
	$(MKDIR) $@
 

	
 
# jtencode
 
JTENCODE_PATH = ./lib/jtencode/
 
JTENCODE_BUILD_DIR = $(BUILD_DIR)/jtencode
 
JTENCODE_SOURCES += jtencode.c init_rs_int.c encode_rs_int.c
 

	
 
JTENCODE_OBJECTS += $(addprefix $(JTENCODE_BUILD_DIR)/,$(notdir $(JTENCODE_SOURCES:.c=.o)))
 

	
 
jtencode: $(JTENCODE_OBJECTS)
 

	
 
$(JTENCODE_BUILD_DIR)/%.o: $(JTENCODE_PATH)/%.c | $(JTENCODE_BUILD_DIR)
 
	$(CC) -Os $(CFLAGS) -c -o $@ $^
 

	
 
$(JTENCODE_BUILD_DIR):
 
	@echo $(JTENCODE_BUILD_DIR)
 
	$(MKDIR) $@
 

	
 

	
 

	
 
#######################################
 
# build the user application
 
#######################################
 

	
 
# list of user program objects
 
OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(SOURCES:.c=.o)))
 
# add an object for the startup code
 
OBJECTS += $(BUILD_DIR)/startup_stm32f031x6.o
 

	
 
# use the periphlib core library, plus generic ones (libc, libm, libnosys)
 
LIBS = -lstm32cube -lc -lm -lnosys
 
LDFLAGS = -T $(LD_SCRIPT) -L $(CUBELIB_BUILD_DIR) -static $(LIBS) $(USER_LDFLAGS)
 

	
 
$(BUILD_DIR)/$(TARGET).hex: $(BUILD_DIR)/$(TARGET).elf
 
	$(OBJCOPY) -O ihex $(BUILD_DIR)/$(TARGET).elf $@
 

	
 
$(BUILD_DIR)/$(TARGET).bin: $(BUILD_DIR)/$(TARGET).elf
 
	$(OBJCOPY) -O binary $(BUILD_DIR)/$(TARGET).elf $@
 

	
 
#$(USB_OBJECTS) -o $(USB_OBJECTS)
 
$(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) $(SI5351_OBJECTS) $(JTENCODE_OBJECTS) $(CUBELIB)
 
	$(CC) -o $@ $(CFLAGS) $(OBJECTS) $(SI5351_OBJECTS) $(JTENCODE_OBJECTS)  \
 
		$(LDFLAGS) -Xlinker \
 
		-Map=$(BUILD_DIR)/$(TARGET).map
 
	$(SIZE) $@
 

	
 
$(BUILD_DIR)/%.o: src/%.c | $(BUILD_DIR)
 
	$(CC) $(CFLAGS) -Os -c -o $@ $^
 

	
 
$(BUILD_DIR)/%.o: src/%.s | $(BUILD_DIR)
 
	$(CC) $(CFLAGS) -c -o $@ $^
 

	
 
$(BUILD_DIR):
 
	$(MKDIR) $@
 

	
 
# delete all user application files, keep the libraries
 
clean:
 
		-rm $(BUILD_DIR)/*.o
 
		-rm $(BUILD_DIR)/*.elf
 
		-rm $(BUILD_DIR)/*.hex
 
		-rm $(BUILD_DIR)/*.map
 
		-rm $(BUILD_DIR)/*.bin
 

	
 
.PHONY: clean all cubelib
STM32F031G6_FLASH.ld
Show inline comments
 
new file 100644
 
/*
 
*****************************************************************************
 
**
 
**  File        : stm32_flash.ld
 
**
 
**  Abstract    : Linker script for STM32F031G6 Device with
 
**                32KByte FLASH, 4KByte RAM
 
**
 
**                Set heap size, stack size and stack location according
 
**                to application requirements.
 
**
 
**                Set memory bank area and size if external memory is used.
 
**
 
**  Target      : STMicroelectronics STM32
 
**
 
**  Environment : Atollic TrueSTUDIO(R)
 
**
 
**  Distribution: The file is distributed “as is,” without any warranty
 
**                of any kind.
 
**
 
**  (c)Copyright Atollic AB.
 
**  You may use this file as-is or modify it according to the needs of your
 
**  project. This file may only be built (assembled or compiled and linked)
 
**  using the Atollic TrueSTUDIO(R) product. The use of this file together
 
**  with other tools than Atollic TrueSTUDIO(R) is not permitted.
 
**
 
*****************************************************************************
 
*/
 

	
 
/* Entry Point */
 
ENTRY(Reset_Handler)
 

	
 
/* Highest address of the user mode stack */
 
_estack = 0x20001000;    /* end of RAM */
 

	
 
/* Generate a link error if heap and stack don't fit into RAM */
 
_Min_Heap_Size = 0;      /* required amount of heap  */
 
_Min_Stack_Size = 0x300; /* required amount of stack */
 

	
 
/* Specify the memory areas */
 
MEMORY
 
{
 
FLASH (rx)      : ORIGIN = 0x8000000, LENGTH = 32K
 
RAM (xrw)      : ORIGIN = 0x20000000, LENGTH = 4K
 
}
 

	
 
/* Define output sections */
 
SECTIONS
 
{
 
  /* The startup code goes first into FLASH */
 
  .isr_vector :
 
  {
 
    . = ALIGN(4);
 
    KEEP(*(.isr_vector)) /* Startup code */
 
    . = ALIGN(4);
 
  } >FLASH
 

	
 
  /* The program code and other data goes into FLASH */
 
  .text :
 
  {
 
    . = ALIGN(4);
 
    *(.text)           /* .text sections (code) */
 
    *(.text*)          /* .text* sections (code) */
 
    *(.glue_7)         /* glue arm to thumb code */
 
    *(.glue_7t)        /* glue thumb to arm code */
 
    *(.eh_frame)
 

	
 
    KEEP (*(.init))
 
    KEEP (*(.fini))
 

	
 
    . = ALIGN(4);
 
    _etext = .;        /* define a global symbols at end of code */
 
  } >FLASH
 

	
 
  /* Constant data goes into FLASH */
 
  .rodata :
 
  {
 
    . = ALIGN(4);
 
    *(.rodata)         /* .rodata sections (constants, strings, etc.) */
 
    *(.rodata*)        /* .rodata* sections (constants, strings, etc.) */
 
    . = ALIGN(4);
 
  } >FLASH
 

	
 
  .ARM.extab   : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
 
  .ARM : {
 
    __exidx_start = .;
 
    *(.ARM.exidx*)
 
    __exidx_end = .;
 
  } >FLASH
 

	
 
  .preinit_array     :
 
  {
 
    PROVIDE_HIDDEN (__preinit_array_start = .);
 
    KEEP (*(.preinit_array*))
 
    PROVIDE_HIDDEN (__preinit_array_end = .);
 
  } >FLASH
 
  .init_array :
 
  {
 
    PROVIDE_HIDDEN (__init_array_start = .);
 
    KEEP (*(SORT(.init_array.*)))
 
    KEEP (*(.init_array*))
 
    PROVIDE_HIDDEN (__init_array_end = .);
 
  } >FLASH
 
  .fini_array :
 
  {
 
    PROVIDE_HIDDEN (__fini_array_start = .);
 
    KEEP (*(SORT(.fini_array.*)))
 
    KEEP (*(.fini_array*))
 
    PROVIDE_HIDDEN (__fini_array_end = .);
 
  } >FLASH
 

	
 
  /* used by the startup to initialize data */
 
  _sidata = LOADADDR(.data);
 

	
 
  /* Initialized data sections goes into RAM, load LMA copy after code */
 
  .data : 
 
  {
 
    . = ALIGN(4);
 
    _sdata = .;        /* create a global symbol at data start */
 
    *(.data)           /* .data sections */
 
    *(.data*)          /* .data* sections */
 

	
 
    . = ALIGN(4);
 
    _edata = .;        /* define a global symbol at data end */
 
  } >RAM AT> FLASH
 

	
 
  
 
  /* Uninitialized data section */
 
  . = ALIGN(4);
 
  .bss :
 
  {
 
    /* This is used by the startup in order to initialize the .bss secion */
 
    _sbss = .;         /* define a global symbol at bss start */
 
    __bss_start__ = _sbss;
 
    *(.bss)
 
    *(.bss*)
 
    *(COMMON)
 

	
 
    . = ALIGN(4);
 
    _ebss = .;         /* define a global symbol at bss end */
 
    __bss_end__ = _ebss;
 
  } >RAM
 

	
 
  /* User_heap_stack section, used to check that there is enough RAM left */
 
  ._user_heap_stack :
 
  {
 
    . = ALIGN(4);
 
    PROVIDE ( end = . );
 
    PROVIDE ( _end = . );
 
    . = . + _Min_Heap_Size;
 
    . = . + _Min_Stack_Size;
 
    . = ALIGN(4);
 
  } >RAM
 

	
 
  
 

	
 
  /* Remove information from the standard libraries */
 
  /DISCARD/ :
 
  {
 
    libc.a ( * )
 
    libm.a ( * )
 
    libgcc.a ( * )
 
  }
 

	
 
  .ARM.attributes 0 : { *(.ARM.attributes) }
 
}
TODO
Show inline comments
 
new file 100644
 
allocate heap for mallocs... see what size we need
drivers/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_abs_f32.c
Show inline comments
 
new file 100644
 
/* ----------------------------------------------------------------------    
 
* Copyright (C) 2010-2014 ARM Limited. All rights reserved.    
 
*    
 
* $Date:        19. March 2015
 
* $Revision: 	V.1.4.5
 
*    
 
* Project: 	    CMSIS DSP Library    
 
* Title:		arm_abs_f32.c    
 
*    
 
* Description:	Vector absolute value.    
 
*    
 
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
 
*  
 
* Redistribution and use in source and binary forms, with or without 
 
* modification, are permitted provided that the following conditions
 
* are met:
 
*   - Redistributions of source code must retain the above copyright
 
*     notice, this list of conditions and the following disclaimer.
 
*   - Redistributions in binary form must reproduce the above copyright
 
*     notice, this list of conditions and the following disclaimer in
 
*     the documentation and/or other materials provided with the 
 
*     distribution.
 
*   - Neither the name of ARM LIMITED nor the names of its contributors
 
*     may be used to endorse or promote products derived from this
 
*     software without specific prior written permission.
 
*
 
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
 
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
* POSSIBILITY OF SUCH DAMAGE.   
 
* ---------------------------------------------------------------------------- */
 
 
#include "arm_math.h"
 
#include <math.h>
 
 
/**        
 
 * @ingroup groupMath        
 
 */
 
 
/**        
 
 * @defgroup BasicAbs Vector Absolute Value        
 
 *        
 
 * Computes the absolute value of a vector on an element-by-element basis.        
 
 *        
 
 * <pre>        
 
 *     pDst[n] = abs(pSrc[n]),   0 <= n < blockSize.        
 
 * </pre>        
 
 *        
 
 * The functions support in-place computation allowing the source and
 
 * destination pointers to reference the same memory buffer.
 
 * There are separate functions for floating-point, Q7, Q15, and Q31 data types.
 
 */
 
 
/**        
 
 * @addtogroup BasicAbs        
 
 * @{        
 
 */
 
 
/**        
 
 * @brief Floating-point vector absolute value.        
 
 * @param[in]       *pSrc points to the input buffer        
 
 * @param[out]      *pDst points to the output buffer        
 
 * @param[in]       blockSize number of samples in each vector        
 
 * @return none.        
 
 */
 
 
void arm_abs_f32(
 
  float32_t * pSrc,
 
  float32_t * pDst,
 
  uint32_t blockSize)
 
{
 
  uint32_t blkCnt;                               /* loop counter */
 
 
#ifndef ARM_MATH_CM0_FAMILY
 
 
  /* Run the below code for Cortex-M4 and Cortex-M3 */
 
  float32_t in1, in2, in3, in4;                  /* temporary variables */
 
 
  /*loop Unrolling */
 
  blkCnt = blockSize >> 2u;
 
 
  /* First part of the processing with loop unrolling.  Compute 4 outputs at a time.    
 
   ** a second loop below computes the remaining 1 to 3 samples. */
 
  while(blkCnt > 0u)
 
  {
 
    /* C = |A| */
 
    /* Calculate absolute and then store the results in the destination buffer. */
 
    /* read sample from source */
 
    in1 = *pSrc;
 
    in2 = *(pSrc + 1);
 
    in3 = *(pSrc + 2);
 
 
    /* find absolute value */
 
    in1 = fabsf(in1);
 
 
    /* read sample from source */
 
    in4 = *(pSrc + 3);
 
 
    /* find absolute value */
 
    in2 = fabsf(in2);
 
 
    /* read sample from source */
 
    *pDst = in1;
 
 
    /* find absolute value */
 
    in3 = fabsf(in3);
 
 
    /* find absolute value */
 
    in4 = fabsf(in4);
 
 
    /* store result to destination */
 
    *(pDst + 1) = in2;
 
 
    /* store result to destination */
 
    *(pDst + 2) = in3;
 
 
    /* store result to destination */
 
    *(pDst + 3) = in4;
 
 
 
    /* Update source pointer to process next sampels */
 
    pSrc += 4u;
 
 
    /* Update destination pointer to process next sampels */
 
    pDst += 4u;
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
  /* If the blockSize is not a multiple of 4, compute any remaining output samples here.    
 
   ** No loop unrolling is used. */
 
  blkCnt = blockSize % 0x4u;
 
 
#else
 
 
  /* Run the below code for Cortex-M0 */
 
 
  /* Initialize blkCnt with number of samples */
 
  blkCnt = blockSize;
 
 
#endif /*   #ifndef ARM_MATH_CM0_FAMILY   */
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = |A| */
 
    /* Calculate absolute and then store the results in the destination buffer. */
 
    *pDst++ = fabsf(*pSrc++);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
}
 
 
/**        
 
 * @} end of BasicAbs group        
 
 */
drivers/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_abs_q15.c
Show inline comments
 
new file 100644
 
/* ----------------------------------------------------------------------    
 
* Copyright (C) 2010-2014 ARM Limited. All rights reserved.    
 
*    
 
* $Date:        19. March 2015
 
* $Revision: 	V.1.4.5
 
*    
 
* Project: 	    CMSIS DSP Library    
 
* Title:		arm_abs_q15.c    
 
*    
 
* Description:	Q15 vector absolute value.    
 
*    
 
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
 
*  
 
* Redistribution and use in source and binary forms, with or without 
 
* modification, are permitted provided that the following conditions
 
* are met:
 
*   - Redistributions of source code must retain the above copyright
 
*     notice, this list of conditions and the following disclaimer.
 
*   - Redistributions in binary form must reproduce the above copyright
 
*     notice, this list of conditions and the following disclaimer in
 
*     the documentation and/or other materials provided with the 
 
*     distribution.
 
*   - Neither the name of ARM LIMITED nor the names of its contributors
 
*     may be used to endorse or promote products derived from this
 
*     software without specific prior written permission.
 
*
 
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
 
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
* POSSIBILITY OF SUCH DAMAGE. 
 
* -------------------------------------------------------------------- */
 
 
#include "arm_math.h"
 
 
/**    
 
 * @ingroup groupMath    
 
 */
 
 
/**    
 
 * @addtogroup BasicAbs    
 
 * @{    
 
 */
 
 
/**    
 
 * @brief Q15 vector absolute value.    
 
 * @param[in]       *pSrc points to the input buffer    
 
 * @param[out]      *pDst points to the output buffer    
 
 * @param[in]       blockSize number of samples in each vector    
 
 * @return none.    
 
 *    
 
 * <b>Scaling and Overflow Behavior:</b>    
 
 * \par    
 
 * The function uses saturating arithmetic.    
 
 * The Q15 value -1 (0x8000) will be saturated to the maximum allowable positive value 0x7FFF.    
 
 */
 
 
void arm_abs_q15(
 
  q15_t * pSrc,
 
  q15_t * pDst,
 
  uint32_t blockSize)
 
{
 
  uint32_t blkCnt;                               /* loop counter */
 
 
#ifndef ARM_MATH_CM0_FAMILY
 
  __SIMD32_TYPE *simd;
 
 
/* Run the below code for Cortex-M4 and Cortex-M3 */
 
 
  q15_t in1;                                     /* Input value1 */
 
  q15_t in2;                                     /* Input value2 */
 
 
 
  /*loop Unrolling */
 
  blkCnt = blockSize >> 2u;
 
 
  /* First part of the processing with loop unrolling.  Compute 4 outputs at a time.    
 
   ** a second loop below computes the remaining 1 to 3 samples. */
 
  simd = __SIMD32_CONST(pDst);
 
  while(blkCnt > 0u)
 
  {
 
    /* C = |A| */
 
    /* Read two inputs */
 
    in1 = *pSrc++;
 
    in2 = *pSrc++;
 
 
 
    /* Store the Absolute result in the destination buffer by packing the two values, in a single cycle */
 
#ifndef  ARM_MATH_BIG_ENDIAN
 
    *simd++ =
 
      __PKHBT(((in1 > 0) ? in1 : (q15_t)__QSUB16(0, in1)),
 
              ((in2 > 0) ? in2 : (q15_t)__QSUB16(0, in2)), 16);
 
 
#else
 
 
 
    *simd++ =
 
      __PKHBT(((in2 > 0) ? in2 : (q15_t)__QSUB16(0, in2)),
 
              ((in1 > 0) ? in1 : (q15_t)__QSUB16(0, in1)), 16);
 
 
#endif /* #ifndef  ARM_MATH_BIG_ENDIAN    */
 
 
    in1 = *pSrc++;
 
    in2 = *pSrc++;
 
 
 
#ifndef  ARM_MATH_BIG_ENDIAN
 
 
    *simd++ =
 
      __PKHBT(((in1 > 0) ? in1 : (q15_t)__QSUB16(0, in1)),
 
              ((in2 > 0) ? in2 : (q15_t)__QSUB16(0, in2)), 16);
 
 
#else
 
 
 
    *simd++ =
 
      __PKHBT(((in2 > 0) ? in2 : (q15_t)__QSUB16(0, in2)),
 
              ((in1 > 0) ? in1 : (q15_t)__QSUB16(0, in1)), 16);
 
 
#endif /* #ifndef  ARM_MATH_BIG_ENDIAN    */
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
  pDst = (q15_t *)simd;
 
	
 
  /* If the blockSize is not a multiple of 4, compute any remaining output samples here.    
 
   ** No loop unrolling is used. */
 
  blkCnt = blockSize % 0x4u;
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = |A| */
 
    /* Read the input */
 
    in1 = *pSrc++;
 
 
    /* Calculate absolute value of input and then store the result in the destination buffer. */
 
    *pDst++ = (in1 > 0) ? in1 : (q15_t)__QSUB16(0, in1);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
#else
 
 
  /* Run the below code for Cortex-M0 */
 
 
  q15_t in;                                      /* Temporary input variable */
 
 
  /* Initialize blkCnt with number of samples */
 
  blkCnt = blockSize;
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = |A| */
 
    /* Read the input */
 
    in = *pSrc++;
 
 
    /* Calculate absolute value of input and then store the result in the destination buffer. */
 
    *pDst++ = (in > 0) ? in : ((in == (q15_t) 0x8000) ? 0x7fff : -in);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
#endif /* #ifndef ARM_MATH_CM0_FAMILY */
 
 
}
 
 
/**    
 
 * @} end of BasicAbs group    
 
 */
drivers/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_abs_q31.c
Show inline comments
 
new file 100644
 
/* ----------------------------------------------------------------------    
 
* Copyright (C) 2010-2014 ARM Limited. All rights reserved.    
 
*    
 
* $Date:        19. March 2015
 
* $Revision: 	V.1.4.5
 
*    
 
* Project: 	    CMSIS DSP Library    
 
* Title:		arm_abs_q31.c    
 
*    
 
* Description:	Q31 vector absolute value.    
 
*    
 
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
 
*  
 
* Redistribution and use in source and binary forms, with or without 
 
* modification, are permitted provided that the following conditions
 
* are met:
 
*   - Redistributions of source code must retain the above copyright
 
*     notice, this list of conditions and the following disclaimer.
 
*   - Redistributions in binary form must reproduce the above copyright
 
*     notice, this list of conditions and the following disclaimer in
 
*     the documentation and/or other materials provided with the 
 
*     distribution.
 
*   - Neither the name of ARM LIMITED nor the names of its contributors
 
*     may be used to endorse or promote products derived from this
 
*     software without specific prior written permission.
 
*
 
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
 
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
* POSSIBILITY OF SUCH DAMAGE. 
 
* -------------------------------------------------------------------- */
 
 
#include "arm_math.h"
 
 
/**    
 
 * @ingroup groupMath    
 
 */
 
 
/**    
 
 * @addtogroup BasicAbs    
 
 * @{    
 
 */
 
 
 
/**    
 
 * @brief Q31 vector absolute value.    
 
 * @param[in]       *pSrc points to the input buffer    
 
 * @param[out]      *pDst points to the output buffer    
 
 * @param[in]       blockSize number of samples in each vector    
 
 * @return none.    
 
 *    
 
 * <b>Scaling and Overflow Behavior:</b>    
 
 * \par    
 
 * The function uses saturating arithmetic.    
 
 * The Q31 value -1 (0x80000000) will be saturated to the maximum allowable positive value 0x7FFFFFFF.    
 
 */
 
 
void arm_abs_q31(
 
  q31_t * pSrc,
 
  q31_t * pDst,
 
  uint32_t blockSize)
 
{
 
  uint32_t blkCnt;                               /* loop counter */
 
  q31_t in;                                      /* Input value */
 
 
#ifndef ARM_MATH_CM0_FAMILY
 
 
  /* Run the below code for Cortex-M4 and Cortex-M3 */
 
  q31_t in1, in2, in3, in4;
 
 
  /*loop Unrolling */
 
  blkCnt = blockSize >> 2u;
 
 
  /* First part of the processing with loop unrolling.  Compute 4 outputs at a time.    
 
   ** a second loop below computes the remaining 1 to 3 samples. */
 
  while(blkCnt > 0u)
 
  {
 
    /* C = |A| */
 
    /* Calculate absolute of input (if -1 then saturated to 0x7fffffff) and then store the results in the destination buffer. */
 
    in1 = *pSrc++;
 
    in2 = *pSrc++;
 
    in3 = *pSrc++;
 
    in4 = *pSrc++;
 
 
    *pDst++ = (in1 > 0) ? in1 : (q31_t)__QSUB(0, in1);
 
    *pDst++ = (in2 > 0) ? in2 : (q31_t)__QSUB(0, in2);
 
    *pDst++ = (in3 > 0) ? in3 : (q31_t)__QSUB(0, in3);
 
    *pDst++ = (in4 > 0) ? in4 : (q31_t)__QSUB(0, in4);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
  /* If the blockSize is not a multiple of 4, compute any remaining output samples here.    
 
   ** No loop unrolling is used. */
 
  blkCnt = blockSize % 0x4u;
 
 
#else
 
 
  /* Run the below code for Cortex-M0 */
 
 
  /* Initialize blkCnt with number of samples */
 
  blkCnt = blockSize;
 
 
#endif /*   #ifndef ARM_MATH_CM0_FAMILY   */
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = |A| */
 
    /* Calculate absolute value of the input (if -1 then saturated to 0x7fffffff) and then store the results in the destination buffer. */
 
    in = *pSrc++;
 
    *pDst++ = (in > 0) ? in : ((in == INT32_MIN) ? INT32_MAX : -in);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
}
 
 
/**    
 
 * @} end of BasicAbs group    
 
 */
drivers/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_abs_q7.c
Show inline comments
 
new file 100644
 
/* ----------------------------------------------------------------------    
 
* Copyright (C) 2010-2014 ARM Limited. All rights reserved.    
 
*    
 
* $Date:        19. March 2015
 
* $Revision: 	V.1.4.5
 
*    
 
* Project: 	    CMSIS DSP Library    
 
* Title:		arm_abs_q7.c    
 
*    
 
* Description:	Q7 vector absolute value.    
 
*    
 
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
 
*  
 
* Redistribution and use in source and binary forms, with or without 
 
* modification, are permitted provided that the following conditions
 
* are met:
 
*   - Redistributions of source code must retain the above copyright
 
*     notice, this list of conditions and the following disclaimer.
 
*   - Redistributions in binary form must reproduce the above copyright
 
*     notice, this list of conditions and the following disclaimer in
 
*     the documentation and/or other materials provided with the 
 
*     distribution.
 
*   - Neither the name of ARM LIMITED nor the names of its contributors
 
*     may be used to endorse or promote products derived from this
 
*     software without specific prior written permission.
 
*
 
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
 
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
* POSSIBILITY OF SUCH DAMAGE.
 
* -------------------------------------------------------------------- */
 
 
#include "arm_math.h"
 
 
/**        
 
 * @ingroup groupMath        
 
 */
 
 
/**        
 
 * @addtogroup BasicAbs        
 
 * @{        
 
 */
 
 
/**        
 
 * @brief Q7 vector absolute value.        
 
 * @param[in]       *pSrc points to the input buffer        
 
 * @param[out]      *pDst points to the output buffer        
 
 * @param[in]       blockSize number of samples in each vector        
 
 * @return none.        
 
 *    
 
 * \par Conditions for optimum performance    
 
 *  Input and output buffers should be aligned by 32-bit    
 
 *    
 
 *        
 
 * <b>Scaling and Overflow Behavior:</b>        
 
 * \par        
 
 * The function uses saturating arithmetic.        
 
 * The Q7 value -1 (0x80) will be saturated to the maximum allowable positive value 0x7F.        
 
 */
 
 
void arm_abs_q7(
 
  q7_t * pSrc,
 
  q7_t * pDst,
 
  uint32_t blockSize)
 
{
 
  uint32_t blkCnt;                               /* loop counter */
 
  q7_t in;                                       /* Input value1 */
 
 
#ifndef ARM_MATH_CM0_FAMILY
 
 
  /* Run the below code for Cortex-M4 and Cortex-M3 */
 
  q31_t in1, in2, in3, in4;                      /* temporary input variables */
 
  q31_t out1, out2, out3, out4;                  /* temporary output variables */
 
 
  /*loop Unrolling */
 
  blkCnt = blockSize >> 2u;
 
 
  /* First part of the processing with loop unrolling.  Compute 4 outputs at a time.    
 
   ** a second loop below computes the remaining 1 to 3 samples. */
 
  while(blkCnt > 0u)
 
  {
 
    /* C = |A| */
 
    /* Read inputs */
 
    in1 = (q31_t) * pSrc;
 
    in2 = (q31_t) * (pSrc + 1);
 
    in3 = (q31_t) * (pSrc + 2);
 
 
    /* find absolute value */
 
    out1 = (in1 > 0) ? in1 : (q31_t)__QSUB8(0, in1);
 
 
    /* read input */
 
    in4 = (q31_t) * (pSrc + 3);
 
 
    /* find absolute value */
 
    out2 = (in2 > 0) ? in2 : (q31_t)__QSUB8(0, in2);
 
 
    /* store result to destination */
 
    *pDst = (q7_t) out1;
 
 
    /* find absolute value */
 
    out3 = (in3 > 0) ? in3 : (q31_t)__QSUB8(0, in3);
 
 
    /* find absolute value */
 
    out4 = (in4 > 0) ? in4 : (q31_t)__QSUB8(0, in4);
 
 
    /* store result to destination */
 
    *(pDst + 1) = (q7_t) out2;
 
 
    /* store result to destination */
 
    *(pDst + 2) = (q7_t) out3;
 
 
    /* store result to destination */
 
    *(pDst + 3) = (q7_t) out4;
 
 
    /* update pointers to process next samples */
 
    pSrc += 4u;
 
    pDst += 4u;
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
  /* If the blockSize is not a multiple of 4, compute any remaining output samples here.    
 
   ** No loop unrolling is used. */
 
  blkCnt = blockSize % 0x4u;
 
#else
 
 
  /* Run the below code for Cortex-M0 */
 
  blkCnt = blockSize;
 
 
#endif //      #define ARM_MATH_CM0_FAMILY
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = |A| */
 
    /* Read the input */
 
    in = *pSrc++;
 
 
    /* Store the Absolute result in the destination buffer */
 
    *pDst++ = (in > 0) ? in : ((in == (q7_t) 0x80) ? 0x7f : -in);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
}
 
 
/**        
 
 * @} end of BasicAbs group        
 
 */
drivers/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_add_f32.c
Show inline comments
 
new file 100644
 
/* ----------------------------------------------------------------------    
 
* Copyright (C) 2010-2014 ARM Limited. All rights reserved.    
 
*    
 
* $Date:        19. March 2015
 
* $Revision: 	V.1.4.5
 
*    
 
* Project: 	    CMSIS DSP Library    
 
* Title:		arm_add_f32.c    
 
*    
 
* Description:	Floating-point vector addition.    
 
*    
 
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
 
*  
 
* Redistribution and use in source and binary forms, with or without 
 
* modification, are permitted provided that the following conditions
 
* are met:
 
*   - Redistributions of source code must retain the above copyright
 
*     notice, this list of conditions and the following disclaimer.
 
*   - Redistributions in binary form must reproduce the above copyright
 
*     notice, this list of conditions and the following disclaimer in
 
*     the documentation and/or other materials provided with the 
 
*     distribution.
 
*   - Neither the name of ARM LIMITED nor the names of its contributors
 
*     may be used to endorse or promote products derived from this
 
*     software without specific prior written permission.
 
*
 
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
 
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
* POSSIBILITY OF SUCH DAMAGE.  
 
* ---------------------------------------------------------------------------- */
 
 
#include "arm_math.h"
 
 
/**        
 
 * @ingroup groupMath        
 
 */
 
 
/**        
 
 * @defgroup BasicAdd Vector Addition        
 
 *        
 
 * Element-by-element addition of two vectors.        
 
 *        
 
 * <pre>        
 
 *     pDst[n] = pSrcA[n] + pSrcB[n],   0 <= n < blockSize.        
 
 * </pre>        
 
 *        
 
 * There are separate functions for floating-point, Q7, Q15, and Q31 data types.        
 
 */
 
 
/**        
 
 * @addtogroup BasicAdd        
 
 * @{        
 
 */
 
 
/**        
 
 * @brief Floating-point vector addition.        
 
 * @param[in]       *pSrcA points to the first input vector        
 
 * @param[in]       *pSrcB points to the second input vector        
 
 * @param[out]      *pDst points to the output vector        
 
 * @param[in]       blockSize number of samples in each vector        
 
 * @return none.        
 
 */
 
 
void arm_add_f32(
 
  float32_t * pSrcA,
 
  float32_t * pSrcB,
 
  float32_t * pDst,
 
  uint32_t blockSize)
 
{
 
  uint32_t blkCnt;                               /* loop counter */
 
 
#ifndef ARM_MATH_CM0_FAMILY
 
 
/* Run the below code for Cortex-M4 and Cortex-M3 */
 
  float32_t inA1, inA2, inA3, inA4;              /* temporary input variabels */
 
  float32_t inB1, inB2, inB3, inB4;              /* temporary input variables */
 
 
  /*loop Unrolling */
 
  blkCnt = blockSize >> 2u;
 
 
  /* First part of the processing with loop unrolling.  Compute 4 outputs at a time.        
 
   ** a second loop below computes the remaining 1 to 3 samples. */
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A + B */
 
    /* Add and then store the results in the destination buffer. */
 
 
    /* read four inputs from sourceA and four inputs from sourceB */
 
    inA1 = *pSrcA;
 
    inB1 = *pSrcB;
 
    inA2 = *(pSrcA + 1);
 
    inB2 = *(pSrcB + 1);
 
    inA3 = *(pSrcA + 2);
 
    inB3 = *(pSrcB + 2);
 
    inA4 = *(pSrcA + 3);
 
    inB4 = *(pSrcB + 3);
 
 
    /* C = A + B */
 
    /* add and store result to destination */
 
    *pDst = inA1 + inB1;
 
    *(pDst + 1) = inA2 + inB2;
 
    *(pDst + 2) = inA3 + inB3;
 
    *(pDst + 3) = inA4 + inB4;
 
 
    /* update pointers to process next samples */
 
    pSrcA += 4u;
 
    pSrcB += 4u;
 
    pDst += 4u;
 
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
  /* If the blockSize is not a multiple of 4, compute any remaining output samples here.        
 
   ** No loop unrolling is used. */
 
  blkCnt = blockSize % 0x4u;
 
 
#else
 
 
  /* Run the below code for Cortex-M0 */
 
 
  /* Initialize blkCnt with number of samples */
 
  blkCnt = blockSize;
 
 
#endif /* #ifndef ARM_MATH_CM0_FAMILY */
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A + B */
 
    /* Add and then store the results in the destination buffer. */
 
    *pDst++ = (*pSrcA++) + (*pSrcB++);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
}
 
 
/**        
 
 * @} end of BasicAdd group        
 
 */
drivers/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_add_q15.c
Show inline comments
 
new file 100644
 
/* ----------------------------------------------------------------------    
 
* Copyright (C) 2010-2014 ARM Limited. All rights reserved.    
 
*    
 
* $Date:        19. March 2015
 
* $Revision: 	V.1.4.5
 
*    
 
* Project: 	    CMSIS DSP Library    
 
* Title:		arm_add_q15.c    
 
*    
 
* Description:	Q15 vector addition    
 
*    
 
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
 
*  
 
* Redistribution and use in source and binary forms, with or without 
 
* modification, are permitted provided that the following conditions
 
* are met:
 
*   - Redistributions of source code must retain the above copyright
 
*     notice, this list of conditions and the following disclaimer.
 
*   - Redistributions in binary form must reproduce the above copyright
 
*     notice, this list of conditions and the following disclaimer in
 
*     the documentation and/or other materials provided with the 
 
*     distribution.
 
*   - Neither the name of ARM LIMITED nor the names of its contributors
 
*     may be used to endorse or promote products derived from this
 
*     software without specific prior written permission.
 
*
 
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
 
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
* POSSIBILITY OF SUCH DAMAGE.  
 
* -------------------------------------------------------------------- */
 
 
#include "arm_math.h"
 
 
/**    
 
 * @ingroup groupMath    
 
 */
 
 
/**    
 
 * @addtogroup BasicAdd    
 
 * @{    
 
 */
 
 
/**    
 
 * @brief Q15 vector addition.    
 
 * @param[in]       *pSrcA points to the first input vector    
 
 * @param[in]       *pSrcB points to the second input vector    
 
 * @param[out]      *pDst points to the output vector    
 
 * @param[in]       blockSize number of samples in each vector    
 
 * @return none.    
 
 *    
 
 * <b>Scaling and Overflow Behavior:</b>    
 
 * \par    
 
 * The function uses saturating arithmetic.    
 
 * Results outside of the allowable Q15 range [0x8000 0x7FFF] will be saturated.    
 
 */
 
 
void arm_add_q15(
 
  q15_t * pSrcA,
 
  q15_t * pSrcB,
 
  q15_t * pDst,
 
  uint32_t blockSize)
 
{
 
  uint32_t blkCnt;                               /* loop counter */
 
 
#ifndef ARM_MATH_CM0_FAMILY
 
 
/* Run the below code for Cortex-M4 and Cortex-M3 */
 
  q31_t inA1, inA2, inB1, inB2;
 
 
  /*loop Unrolling */
 
  blkCnt = blockSize >> 2u;
 
 
  /* First part of the processing with loop unrolling.  Compute 4 outputs at a time.    
 
   ** a second loop below computes the remaining 1 to 3 samples. */
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A + B */
 
    /* Add and then store the results in the destination buffer. */
 
    inA1 = *__SIMD32(pSrcA)++;
 
    inA2 = *__SIMD32(pSrcA)++;
 
    inB1 = *__SIMD32(pSrcB)++;
 
    inB2 = *__SIMD32(pSrcB)++;
 
 
    *__SIMD32(pDst)++ = __QADD16(inA1, inB1);
 
    *__SIMD32(pDst)++ = __QADD16(inA2, inB2);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
  /* If the blockSize is not a multiple of 4, compute any remaining output samples here.    
 
   ** No loop unrolling is used. */
 
  blkCnt = blockSize % 0x4u;
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A + B */
 
    /* Add and then store the results in the destination buffer. */
 
    *pDst++ = (q15_t) __QADD16(*pSrcA++, *pSrcB++);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
#else
 
 
  /* Run the below code for Cortex-M0 */
 
 
 
 
  /* Initialize blkCnt with number of samples */
 
  blkCnt = blockSize;
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A + B */
 
    /* Add and then store the results in the destination buffer. */
 
    *pDst++ = (q15_t) __SSAT(((q31_t) * pSrcA++ + *pSrcB++), 16);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
#endif /* #ifndef ARM_MATH_CM0_FAMILY */
 
 
 
}
 
 
/**    
 
 * @} end of BasicAdd group    
 
 */
drivers/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_add_q31.c
Show inline comments
 
new file 100644
 
/* ----------------------------------------------------------------------    
 
* Copyright (C) 2010-2014 ARM Limited. All rights reserved.    
 
*    
 
* $Date:        19. March 2015
 
* $Revision: 	V.1.4.5
 
*    
 
* Project: 	    CMSIS DSP Library    
 
* Title:		arm_add_q31.c    
 
*    
 
* Description:	Q31 vector addition.    
 
*    
 
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
 
*  
 
* Redistribution and use in source and binary forms, with or without 
 
* modification, are permitted provided that the following conditions
 
* are met:
 
*   - Redistributions of source code must retain the above copyright
 
*     notice, this list of conditions and the following disclaimer.
 
*   - Redistributions in binary form must reproduce the above copyright
 
*     notice, this list of conditions and the following disclaimer in
 
*     the documentation and/or other materials provided with the 
 
*     distribution.
 
*   - Neither the name of ARM LIMITED nor the names of its contributors
 
*     may be used to endorse or promote products derived from this
 
*     software without specific prior written permission.
 
*
 
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
 
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
* POSSIBILITY OF SUCH DAMAGE.  
 
* -------------------------------------------------------------------- */
 
 
#include "arm_math.h"
 
 
/**    
 
 * @ingroup groupMath    
 
 */
 
 
/**    
 
 * @addtogroup BasicAdd    
 
 * @{    
 
 */
 
 
 
/**    
 
 * @brief Q31 vector addition.    
 
 * @param[in]       *pSrcA points to the first input vector    
 
 * @param[in]       *pSrcB points to the second input vector    
 
 * @param[out]      *pDst points to the output vector    
 
 * @param[in]       blockSize number of samples in each vector    
 
 * @return none.    
 
 *    
 
 * <b>Scaling and Overflow Behavior:</b>    
 
 * \par    
 
 * The function uses saturating arithmetic.    
 
 * Results outside of the allowable Q31 range[0x80000000 0x7FFFFFFF] will be saturated.    
 
 */
 
 
void arm_add_q31(
 
  q31_t * pSrcA,
 
  q31_t * pSrcB,
 
  q31_t * pDst,
 
  uint32_t blockSize)
 
{
 
  uint32_t blkCnt;                               /* loop counter */
 
 
#ifndef ARM_MATH_CM0_FAMILY
 
 
/* Run the below code for Cortex-M4 and Cortex-M3 */
 
  q31_t inA1, inA2, inA3, inA4;
 
  q31_t inB1, inB2, inB3, inB4;
 
 
  /*loop Unrolling */
 
  blkCnt = blockSize >> 2u;
 
 
  /* First part of the processing with loop unrolling.  Compute 4 outputs at a time.    
 
   ** a second loop below computes the remaining 1 to 3 samples. */
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A + B */
 
    /* Add and then store the results in the destination buffer. */
 
    inA1 = *pSrcA++;
 
    inA2 = *pSrcA++;
 
    inB1 = *pSrcB++;
 
    inB2 = *pSrcB++;
 
 
    inA3 = *pSrcA++;
 
    inA4 = *pSrcA++;
 
    inB3 = *pSrcB++;
 
    inB4 = *pSrcB++;
 
 
    *pDst++ = __QADD(inA1, inB1);
 
    *pDst++ = __QADD(inA2, inB2);
 
    *pDst++ = __QADD(inA3, inB3);
 
    *pDst++ = __QADD(inA4, inB4);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
  /* If the blockSize is not a multiple of 4, compute any remaining output samples here.    
 
   ** No loop unrolling is used. */
 
  blkCnt = blockSize % 0x4u;
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A + B */
 
    /* Add and then store the results in the destination buffer. */
 
    *pDst++ = __QADD(*pSrcA++, *pSrcB++);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
#else
 
 
  /* Run the below code for Cortex-M0 */
 
 
 
 
  /* Initialize blkCnt with number of samples */
 
  blkCnt = blockSize;
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A + B */
 
    /* Add and then store the results in the destination buffer. */
 
    *pDst++ = (q31_t) clip_q63_to_q31((q63_t) * pSrcA++ + *pSrcB++);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
#endif /* #ifndef ARM_MATH_CM0_FAMILY */
 
 
}
 
 
/**    
 
 * @} end of BasicAdd group    
 
 */
drivers/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_add_q7.c
Show inline comments
 
new file 100644
 
/* ----------------------------------------------------------------------    
 
* Copyright (C) 2010-2014 ARM Limited. All rights reserved.    
 
*    
 
* $Date:        19. March 2015
 
* $Revision: 	V.1.4.5
 
*    
 
* Project: 	    CMSIS DSP Library    
 
* Title:		arm_add_q7.c    
 
*    
 
* Description:	Q7 vector addition.    
 
*    
 
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
 
*  
 
* Redistribution and use in source and binary forms, with or without 
 
* modification, are permitted provided that the following conditions
 
* are met:
 
*   - Redistributions of source code must retain the above copyright
 
*     notice, this list of conditions and the following disclaimer.
 
*   - Redistributions in binary form must reproduce the above copyright
 
*     notice, this list of conditions and the following disclaimer in
 
*     the documentation and/or other materials provided with the 
 
*     distribution.
 
*   - Neither the name of ARM LIMITED nor the names of its contributors
 
*     may be used to endorse or promote products derived from this
 
*     software without specific prior written permission.
 
*
 
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
 
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
* POSSIBILITY OF SUCH DAMAGE.
 
* -------------------------------------------------------------------- */
 
 
#include "arm_math.h"
 
 
/**    
 
 * @ingroup groupMath    
 
 */
 
 
/**    
 
 * @addtogroup BasicAdd    
 
 * @{    
 
 */
 
 
/**    
 
 * @brief Q7 vector addition.    
 
 * @param[in]       *pSrcA points to the first input vector    
 
 * @param[in]       *pSrcB points to the second input vector    
 
 * @param[out]      *pDst points to the output vector    
 
 * @param[in]       blockSize number of samples in each vector    
 
 * @return none.    
 
 *    
 
 * <b>Scaling and Overflow Behavior:</b>    
 
 * \par    
 
 * The function uses saturating arithmetic.    
 
 * Results outside of the allowable Q7 range [0x80 0x7F] will be saturated.    
 
 */
 
 
void arm_add_q7(
 
  q7_t * pSrcA,
 
  q7_t * pSrcB,
 
  q7_t * pDst,
 
  uint32_t blockSize)
 
{
 
  uint32_t blkCnt;                               /* loop counter */
 
 
#ifndef ARM_MATH_CM0_FAMILY
 
 
/* Run the below code for Cortex-M4 and Cortex-M3 */
 
 
 
  /*loop Unrolling */
 
  blkCnt = blockSize >> 2u;
 
 
  /* First part of the processing with loop unrolling.  Compute 4 outputs at a time.    
 
   ** a second loop below computes the remaining 1 to 3 samples. */
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A + B */
 
    /* Add and then store the results in the destination buffer. */
 
    *__SIMD32(pDst)++ = __QADD8(*__SIMD32(pSrcA)++, *__SIMD32(pSrcB)++);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
  /* If the blockSize is not a multiple of 4, compute any remaining output samples here.    
 
   ** No loop unrolling is used. */
 
  blkCnt = blockSize % 0x4u;
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A + B */
 
    /* Add and then store the results in the destination buffer. */
 
    *pDst++ = (q7_t) __SSAT(*pSrcA++ + *pSrcB++, 8);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
#else
 
 
  /* Run the below code for Cortex-M0 */
 
 
 
 
  /* Initialize blkCnt with number of samples */
 
  blkCnt = blockSize;
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A + B */
 
    /* Add and then store the results in the destination buffer. */
 
    *pDst++ = (q7_t) __SSAT((q15_t) * pSrcA++ + *pSrcB++, 8);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
#endif /* #ifndef ARM_MATH_CM0_FAMILY */
 
 
 
}
 
 
/**    
 
 * @} end of BasicAdd group    
 
 */
drivers/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_dot_prod_f32.c
Show inline comments
 
new file 100644
 
/* ----------------------------------------------------------------------    
 
* Copyright (C) 2010-2014 ARM Limited. All rights reserved.    
 
*    
 
* $Date:        19. March 2015
 
* $Revision: 	V.1.4.5
 
*    
 
* Project: 	    CMSIS DSP Library    
 
* Title:		arm_dot_prod_f32.c    
 
*    
 
* Description:	Floating-point dot product.    
 
*    
 
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
 
*  
 
* Redistribution and use in source and binary forms, with or without 
 
* modification, are permitted provided that the following conditions
 
* are met:
 
*   - Redistributions of source code must retain the above copyright
 
*     notice, this list of conditions and the following disclaimer.
 
*   - Redistributions in binary form must reproduce the above copyright
 
*     notice, this list of conditions and the following disclaimer in
 
*     the documentation and/or other materials provided with the 
 
*     distribution.
 
*   - Neither the name of ARM LIMITED nor the names of its contributors
 
*     may be used to endorse or promote products derived from this
 
*     software without specific prior written permission.
 
*
 
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
 
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
* POSSIBILITY OF SUCH DAMAGE.  
 
* ---------------------------------------------------------------------------- */
 
 
#include "arm_math.h"
 
 
/**    
 
 * @ingroup groupMath
 
 */
 
 
/**
 
 * @defgroup dot_prod Vector Dot Product
 
 *
 
 * Computes the dot product of two vectors.
 
 * The vectors are multiplied element-by-element and then summed.
 
 *
 
 * <pre>
 
 *     sum = pSrcA[0]*pSrcB[0] + pSrcA[1]*pSrcB[1] + ... + pSrcA[blockSize-1]*pSrcB[blockSize-1]
 
 * </pre>     
 
 *
 
 * There are separate functions for floating-point, Q7, Q15, and Q31 data types.    
 
 */
 
 
/**    
 
 * @addtogroup dot_prod    
 
 * @{    
 
 */
 
 
/**    
 
 * @brief Dot product of floating-point vectors.    
 
 * @param[in]       *pSrcA points to the first input vector    
 
 * @param[in]       *pSrcB points to the second input vector    
 
 * @param[in]       blockSize number of samples in each vector    
 
 * @param[out]      *result output result returned here    
 
 * @return none.    
 
 */
 
 
 
void arm_dot_prod_f32(
 
  float32_t * pSrcA,
 
  float32_t * pSrcB,
 
  uint32_t blockSize,
 
  float32_t * result)
 
{
 
  float32_t sum = 0.0f;                          /* Temporary result storage */
 
  uint32_t blkCnt;                               /* loop counter */
 
 
 
#ifndef ARM_MATH_CM0_FAMILY
 
 
/* Run the below code for Cortex-M4 and Cortex-M3 */
 
  /*loop Unrolling */
 
  blkCnt = blockSize >> 2u;
 
 
  /* First part of the processing with loop unrolling.  Compute 4 outputs at a time.    
 
   ** a second loop below computes the remaining 1 to 3 samples. */
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A[0]* B[0] + A[1]* B[1] + A[2]* B[2] + .....+ A[blockSize-1]* B[blockSize-1] */
 
    /* Calculate dot product and then store the result in a temporary buffer */
 
    sum += (*pSrcA++) * (*pSrcB++);
 
    sum += (*pSrcA++) * (*pSrcB++);
 
    sum += (*pSrcA++) * (*pSrcB++);
 
    sum += (*pSrcA++) * (*pSrcB++);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
  /* If the blockSize is not a multiple of 4, compute any remaining output samples here.    
 
   ** No loop unrolling is used. */
 
  blkCnt = blockSize % 0x4u;
 
 
#else
 
 
  /* Run the below code for Cortex-M0 */
 
 
  /* Initialize blkCnt with number of samples */
 
  blkCnt = blockSize;
 
 
#endif /* #ifndef ARM_MATH_CM0_FAMILY */
 
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A[0]* B[0] + A[1]* B[1] + A[2]* B[2] + .....+ A[blockSize-1]* B[blockSize-1] */
 
    /* Calculate dot product and then store the result in a temporary buffer. */
 
    sum += (*pSrcA++) * (*pSrcB++);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
  /* Store the result back in the destination buffer */
 
  *result = sum;
 
}
 
 
/**    
 
 * @} end of dot_prod group    
 
 */
drivers/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_dot_prod_q15.c
Show inline comments
 
new file 100644
 
/* ----------------------------------------------------------------------    
 
* Copyright (C) 2010-2014 ARM Limited. All rights reserved.    
 
*    
 
* $Date:        19. March 2015
 
* $Revision: 	V.1.4.5
 
*    
 
* Project: 	    CMSIS DSP Library    
 
* Title:		arm_dot_prod_q15.c    
 
*    
 
* Description:	Q15 dot product.    
 
*    
 
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
 
*  
 
* Redistribution and use in source and binary forms, with or without 
 
* modification, are permitted provided that the following conditions
 
* are met:
 
*   - Redistributions of source code must retain the above copyright
 
*     notice, this list of conditions and the following disclaimer.
 
*   - Redistributions in binary form must reproduce the above copyright
 
*     notice, this list of conditions and the following disclaimer in
 
*     the documentation and/or other materials provided with the 
 
*     distribution.
 
*   - Neither the name of ARM LIMITED nor the names of its contributors
 
*     may be used to endorse or promote products derived from this
 
*     software without specific prior written permission.
 
*
 
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
 
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
* POSSIBILITY OF SUCH DAMAGE.
 
* -------------------------------------------------------------------- */
 
 
#include "arm_math.h"
 
 
/**    
 
 * @ingroup groupMath    
 
 */
 
 
/**    
 
 * @addtogroup dot_prod    
 
 * @{    
 
 */
 
 
/**    
 
 * @brief Dot product of Q15 vectors.    
 
 * @param[in]       *pSrcA points to the first input vector    
 
 * @param[in]       *pSrcB points to the second input vector    
 
 * @param[in]       blockSize number of samples in each vector    
 
 * @param[out]      *result output result returned here    
 
 * @return none.    
 
 *    
 
 * <b>Scaling and Overflow Behavior:</b>    
 
 * \par    
 
 * The intermediate multiplications are in 1.15 x 1.15 = 2.30 format and these    
 
 * results are added to a 64-bit accumulator in 34.30 format.    
 
 * Nonsaturating additions are used and given that there are 33 guard bits in the accumulator    
 
 * there is no risk of overflow.    
 
 * The return result is in 34.30 format.    
 
 */
 
 
void arm_dot_prod_q15(
 
  q15_t * pSrcA,
 
  q15_t * pSrcB,
 
  uint32_t blockSize,
 
  q63_t * result)
 
{
 
  q63_t sum = 0;                                 /* Temporary result storage */
 
  uint32_t blkCnt;                               /* loop counter */
 
 
#ifndef ARM_MATH_CM0_FAMILY
 
 
/* Run the below code for Cortex-M4 and Cortex-M3 */
 
 
 
  /*loop Unrolling */
 
  blkCnt = blockSize >> 2u;
 
 
  /* First part of the processing with loop unrolling.  Compute 4 outputs at a time.    
 
   ** a second loop below computes the remaining 1 to 3 samples. */
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A[0]* B[0] + A[1]* B[1] + A[2]* B[2] + .....+ A[blockSize-1]* B[blockSize-1] */
 
    /* Calculate dot product and then store the result in a temporary buffer. */
 
    sum = __SMLALD(*__SIMD32(pSrcA)++, *__SIMD32(pSrcB)++, sum);
 
    sum = __SMLALD(*__SIMD32(pSrcA)++, *__SIMD32(pSrcB)++, sum);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
  /* If the blockSize is not a multiple of 4, compute any remaining output samples here.    
 
   ** No loop unrolling is used. */
 
  blkCnt = blockSize % 0x4u;
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A[0]* B[0] + A[1]* B[1] + A[2]* B[2] + .....+ A[blockSize-1]* B[blockSize-1] */
 
    /* Calculate dot product and then store the results in a temporary buffer. */
 
    sum = __SMLALD(*pSrcA++, *pSrcB++, sum);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
 
#else
 
 
  /* Run the below code for Cortex-M0 */
 
 
  /* Initialize blkCnt with number of samples */
 
  blkCnt = blockSize;
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A[0]* B[0] + A[1]* B[1] + A[2]* B[2] + .....+ A[blockSize-1]* B[blockSize-1] */
 
    /* Calculate dot product and then store the results in a temporary buffer. */
 
    sum += (q63_t) ((q31_t) * pSrcA++ * *pSrcB++);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
#endif /* #ifndef ARM_MATH_CM0_FAMILY */
 
 
  /* Store the result in the destination buffer in 34.30 format */
 
  *result = sum;
 
 
}
 
 
/**    
 
 * @} end of dot_prod group    
 
 */
drivers/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_dot_prod_q31.c
Show inline comments
 
new file 100644
 
/* ----------------------------------------------------------------------    
 
* Copyright (C) 2010-2014 ARM Limited. All rights reserved.    
 
*    
 
* $Date:        19. March 2015
 
* $Revision: 	V.1.4.5
 
*    
 
* Project: 	    CMSIS DSP Library    
 
* Title:		arm_dot_prod_q31.c    
 
*    
 
* Description:	Q31 dot product.    
 
*    
 
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
 
*  
 
* Redistribution and use in source and binary forms, with or without 
 
* modification, are permitted provided that the following conditions
 
* are met:
 
*   - Redistributions of source code must retain the above copyright
 
*     notice, this list of conditions and the following disclaimer.
 
*   - Redistributions in binary form must reproduce the above copyright
 
*     notice, this list of conditions and the following disclaimer in
 
*     the documentation and/or other materials provided with the 
 
*     distribution.
 
*   - Neither the name of ARM LIMITED nor the names of its contributors
 
*     may be used to endorse or promote products derived from this
 
*     software without specific prior written permission.
 
*
 
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
 
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
* POSSIBILITY OF SUCH DAMAGE. 
 
* -------------------------------------------------------------------- */
 
 
#include "arm_math.h"
 
 
/**    
 
 * @ingroup groupMath    
 
 */
 
 
/**    
 
 * @addtogroup dot_prod    
 
 * @{    
 
 */
 
 
/**    
 
 * @brief Dot product of Q31 vectors.    
 
 * @param[in]       *pSrcA points to the first input vector    
 
 * @param[in]       *pSrcB points to the second input vector    
 
 * @param[in]       blockSize number of samples in each vector    
 
 * @param[out]      *result output result returned here    
 
 * @return none.    
 
 *    
 
 * <b>Scaling and Overflow Behavior:</b>    
 
 * \par    
 
 * The intermediate multiplications are in 1.31 x 1.31 = 2.62 format and these    
 
 * are truncated to 2.48 format by discarding the lower 14 bits.    
 
 * The 2.48 result is then added without saturation to a 64-bit accumulator in 16.48 format.    
 
 * There are 15 guard bits in the accumulator and there is no risk of overflow as long as    
 
 * the length of the vectors is less than 2^16 elements.    
 
 * The return result is in 16.48 format.    
 
 */
 
 
void arm_dot_prod_q31(
 
  q31_t * pSrcA,
 
  q31_t * pSrcB,
 
  uint32_t blockSize,
 
  q63_t * result)
 
{
 
  q63_t sum = 0;                                 /* Temporary result storage */
 
  uint32_t blkCnt;                               /* loop counter */
 
 
 
#ifndef ARM_MATH_CM0_FAMILY
 
 
/* Run the below code for Cortex-M4 and Cortex-M3 */
 
  q31_t inA1, inA2, inA3, inA4;
 
  q31_t inB1, inB2, inB3, inB4;
 
 
  /*loop Unrolling */
 
  blkCnt = blockSize >> 2u;
 
 
  /* First part of the processing with loop unrolling.  Compute 4 outputs at a time.    
 
   ** a second loop below computes the remaining 1 to 3 samples. */
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A[0]* B[0] + A[1]* B[1] + A[2]* B[2] + .....+ A[blockSize-1]* B[blockSize-1] */
 
    /* Calculate dot product and then store the result in a temporary buffer. */
 
    inA1 = *pSrcA++;
 
    inA2 = *pSrcA++;
 
    inA3 = *pSrcA++;
 
    inA4 = *pSrcA++;
 
    inB1 = *pSrcB++;
 
    inB2 = *pSrcB++;
 
    inB3 = *pSrcB++;
 
    inB4 = *pSrcB++;
 
 
    sum += ((q63_t) inA1 * inB1) >> 14u;
 
    sum += ((q63_t) inA2 * inB2) >> 14u;
 
    sum += ((q63_t) inA3 * inB3) >> 14u;
 
    sum += ((q63_t) inA4 * inB4) >> 14u;
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
  /* If the blockSize is not a multiple of 4, compute any remaining output samples here.    
 
   ** No loop unrolling is used. */
 
  blkCnt = blockSize % 0x4u;
 
 
#else
 
 
  /* Run the below code for Cortex-M0 */
 
 
  /* Initialize blkCnt with number of samples */
 
  blkCnt = blockSize;
 
 
#endif /* #ifndef ARM_MATH_CM0_FAMILY */
 
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A[0]* B[0] + A[1]* B[1] + A[2]* B[2] + .....+ A[blockSize-1]* B[blockSize-1] */
 
    /* Calculate dot product and then store the result in a temporary buffer. */
 
    sum += ((q63_t) * pSrcA++ * *pSrcB++) >> 14u;
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
  /* Store the result in the destination buffer in 16.48 format */
 
  *result = sum;
 
}
 
 
/**    
 
 * @} end of dot_prod group    
 
 */
drivers/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_dot_prod_q7.c
Show inline comments
 
new file 100644
 
/* ----------------------------------------------------------------------    
 
* Copyright (C) 2010-2014 ARM Limited. All rights reserved.    
 
*    
 
* $Date:        19. March 2015
 
* $Revision: 	V.1.4.5
 
*    
 
* Project: 	    CMSIS DSP Library    
 
* Title:		arm_dot_prod_q7.c    
 
*    
 
* Description:	Q7 dot product.    
 
*    
 
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
 
*  
 
* Redistribution and use in source and binary forms, with or without 
 
* modification, are permitted provided that the following conditions
 
* are met:
 
*   - Redistributions of source code must retain the above copyright
 
*     notice, this list of conditions and the following disclaimer.
 
*   - Redistributions in binary form must reproduce the above copyright
 
*     notice, this list of conditions and the following disclaimer in
 
*     the documentation and/or other materials provided with the 
 
*     distribution.
 
*   - Neither the name of ARM LIMITED nor the names of its contributors
 
*     may be used to endorse or promote products derived from this
 
*     software without specific prior written permission.
 
*
 
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
 
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
* POSSIBILITY OF SUCH DAMAGE.
 
* -------------------------------------------------------------------- */
 
 
#include "arm_math.h"
 
 
/**    
 
 * @ingroup groupMath    
 
 */
 
 
/**    
 
 * @addtogroup dot_prod    
 
 * @{    
 
 */
 
 
/**    
 
 * @brief Dot product of Q7 vectors.    
 
 * @param[in]       *pSrcA points to the first input vector    
 
 * @param[in]       *pSrcB points to the second input vector    
 
 * @param[in]       blockSize number of samples in each vector    
 
 * @param[out]      *result output result returned here    
 
 * @return none.    
 
 *    
 
 * <b>Scaling and Overflow Behavior:</b>    
 
 * \par    
 
 * The intermediate multiplications are in 1.7 x 1.7 = 2.14 format and these    
 
 * results are added to an accumulator in 18.14 format.    
 
 * Nonsaturating additions are used and there is no danger of wrap around as long as    
 
 * the vectors are less than 2^18 elements long.    
 
 * The return result is in 18.14 format.    
 
 */
 
 
void arm_dot_prod_q7(
 
  q7_t * pSrcA,
 
  q7_t * pSrcB,
 
  uint32_t blockSize,
 
  q31_t * result)
 
{
 
  uint32_t blkCnt;                               /* loop counter */
 
 
  q31_t sum = 0;                                 /* Temporary variables to store output */
 
 
#ifndef ARM_MATH_CM0_FAMILY
 
 
/* Run the below code for Cortex-M4 and Cortex-M3 */
 
 
  q31_t input1, input2;                          /* Temporary variables to store input */
 
  q31_t inA1, inA2, inB1, inB2;                  /* Temporary variables to store input */
 
 
 
 
  /*loop Unrolling */
 
  blkCnt = blockSize >> 2u;
 
 
  /* First part of the processing with loop unrolling.  Compute 4 outputs at a time.    
 
   ** a second loop below computes the remaining 1 to 3 samples. */
 
  while(blkCnt > 0u)
 
  {
 
    /* read 4 samples at a time from sourceA */
 
    input1 = *__SIMD32(pSrcA)++;
 
    /* read 4 samples at a time from sourceB */
 
    input2 = *__SIMD32(pSrcB)++;
 
 
    /* extract two q7_t samples to q15_t samples */
 
    inA1 = __SXTB16(__ROR(input1, 8));
 
    /* extract reminaing two samples */
 
    inA2 = __SXTB16(input1);
 
    /* extract two q7_t samples to q15_t samples */
 
    inB1 = __SXTB16(__ROR(input2, 8));
 
    /* extract reminaing two samples */
 
    inB2 = __SXTB16(input2);
 
 
    /* multiply and accumulate two samples at a time */
 
    sum = __SMLAD(inA1, inB1, sum);
 
    sum = __SMLAD(inA2, inB2, sum);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
  /* If the blockSize is not a multiple of 4, compute any remaining output samples here.    
 
   ** No loop unrolling is used. */
 
  blkCnt = blockSize % 0x4u;
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A[0]* B[0] + A[1]* B[1] + A[2]* B[2] + .....+ A[blockSize-1]* B[blockSize-1] */
 
    /* Dot product and then store the results in a temporary buffer. */
 
    sum = __SMLAD(*pSrcA++, *pSrcB++, sum);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
#else
 
 
  /* Run the below code for Cortex-M0 */
 
 
 
 
  /* Initialize blkCnt with number of samples */
 
  blkCnt = blockSize;
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A[0]* B[0] + A[1]* B[1] + A[2]* B[2] + .....+ A[blockSize-1]* B[blockSize-1] */
 
    /* Dot product and then store the results in a temporary buffer. */
 
    sum += (q31_t) ((q15_t) * pSrcA++ * *pSrcB++);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
#endif /* #ifndef ARM_MATH_CM0_FAMILY */
 
 
 
  /* Store the result in the destination buffer in 18.14 format */
 
  *result = sum;
 
}
 
 
/**    
 
 * @} end of dot_prod group    
 
 */
drivers/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_mult_f32.c
Show inline comments
 
new file 100644
 
/* ----------------------------------------------------------------------    
 
* Copyright (C) 2010-2014 ARM Limited. All rights reserved.    
 
*    
 
* $Date:        19. March 2015
 
* $Revision: 	V.1.4.5
 
*    
 
* Project: 	    CMSIS DSP Library    
 
* Title:	    arm_mult_f32.c    
 
*    
 
* Description:	Floating-point vector multiplication.    
 
*    
 
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
 
*  
 
* Redistribution and use in source and binary forms, with or without 
 
* modification, are permitted provided that the following conditions
 
* are met:
 
*   - Redistributions of source code must retain the above copyright
 
*     notice, this list of conditions and the following disclaimer.
 
*   - Redistributions in binary form must reproduce the above copyright
 
*     notice, this list of conditions and the following disclaimer in
 
*     the documentation and/or other materials provided with the 
 
*     distribution.
 
*   - Neither the name of ARM LIMITED nor the names of its contributors
 
*     may be used to endorse or promote products derived from this
 
*     software without specific prior written permission.
 
*
 
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
 
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
* POSSIBILITY OF SUCH DAMAGE.  
 
* -------------------------------------------------------------------- */
 
 
#include "arm_math.h"
 
 
/**        
 
 * @ingroup groupMath        
 
 */
 
 
/**        
 
 * @defgroup BasicMult Vector Multiplication        
 
 *        
 
 * Element-by-element multiplication of two vectors.        
 
 *        
 
 * <pre>        
 
 *     pDst[n] = pSrcA[n] * pSrcB[n],   0 <= n < blockSize.        
 
 * </pre>        
 
 *        
 
 * There are separate functions for floating-point, Q7, Q15, and Q31 data types.        
 
 */
 
 
/**        
 
 * @addtogroup BasicMult        
 
 * @{        
 
 */
 
 
/**        
 
 * @brief Floating-point vector multiplication.        
 
 * @param[in]       *pSrcA points to the first input vector        
 
 * @param[in]       *pSrcB points to the second input vector        
 
 * @param[out]      *pDst points to the output vector        
 
 * @param[in]       blockSize number of samples in each vector        
 
 * @return none.        
 
 */
 
 
void arm_mult_f32(
 
  float32_t * pSrcA,
 
  float32_t * pSrcB,
 
  float32_t * pDst,
 
  uint32_t blockSize)
 
{
 
  uint32_t blkCnt;                               /* loop counters */
 
#ifndef ARM_MATH_CM0_FAMILY
 
 
  /* Run the below code for Cortex-M4 and Cortex-M3 */
 
  float32_t inA1, inA2, inA3, inA4;              /* temporary input variables */
 
  float32_t inB1, inB2, inB3, inB4;              /* temporary input variables */
 
  float32_t out1, out2, out3, out4;              /* temporary output variables */
 
 
  /* loop Unrolling */
 
  blkCnt = blockSize >> 2u;
 
 
  /* First part of the processing with loop unrolling.  Compute 4 outputs at a time.        
 
   ** a second loop below computes the remaining 1 to 3 samples. */
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A * B */
 
    /* Multiply the inputs and store the results in output buffer */
 
    /* read sample from sourceA */
 
    inA1 = *pSrcA;
 
    /* read sample from sourceB */
 
    inB1 = *pSrcB;
 
    /* read sample from sourceA */
 
    inA2 = *(pSrcA + 1);
 
    /* read sample from sourceB */
 
    inB2 = *(pSrcB + 1);
 
 
    /* out = sourceA * sourceB */
 
    out1 = inA1 * inB1;
 
 
    /* read sample from sourceA */
 
    inA3 = *(pSrcA + 2);
 
    /* read sample from sourceB */
 
    inB3 = *(pSrcB + 2);
 
 
    /* out = sourceA * sourceB */
 
    out2 = inA2 * inB2;
 
 
    /* read sample from sourceA */
 
    inA4 = *(pSrcA + 3);
 
 
    /* store result to destination buffer */
 
    *pDst = out1;
 
 
    /* read sample from sourceB */
 
    inB4 = *(pSrcB + 3);
 
 
    /* out = sourceA * sourceB */
 
    out3 = inA3 * inB3;
 
 
    /* store result to destination buffer */
 
    *(pDst + 1) = out2;
 
 
    /* out = sourceA * sourceB */
 
    out4 = inA4 * inB4;
 
    /* store result to destination buffer */
 
    *(pDst + 2) = out3;
 
    /* store result to destination buffer */
 
    *(pDst + 3) = out4;
 
 
 
    /* update pointers to process next samples */
 
    pSrcA += 4u;
 
    pSrcB += 4u;
 
    pDst += 4u;
 
 
    /* Decrement the blockSize loop counter */
 
    blkCnt--;
 
  }
 
 
  /* If the blockSize is not a multiple of 4, compute any remaining output samples here.        
 
   ** No loop unrolling is used. */
 
  blkCnt = blockSize % 0x4u;
 
 
#else
 
 
  /* Run the below code for Cortex-M0 */
 
 
  /* Initialize blkCnt with number of samples */
 
  blkCnt = blockSize;
 
 
#endif /* #ifndef ARM_MATH_CM0_FAMILY */
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A * B */
 
    /* Multiply the inputs and store the results in output buffer */
 
    *pDst++ = (*pSrcA++) * (*pSrcB++);
 
 
    /* Decrement the blockSize loop counter */
 
    blkCnt--;
 
  }
 
}
 
 
/**        
 
 * @} end of BasicMult group        
 
 */
drivers/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_mult_q15.c
Show inline comments
 
new file 100644
 
/* ----------------------------------------------------------------------    
 
* Copyright (C) 2010-2014 ARM Limited. All rights reserved.    
 
*    
 
* $Date:        19. March 2015
 
* $Revision: 	V.1.4.5
 
*    
 
* Project: 	    CMSIS DSP Library    
 
* Title:	    arm_mult_q15.c    
 
*    
 
* Description:	Q15 vector multiplication.    
 
*    
 
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
 
*  
 
* Redistribution and use in source and binary forms, with or without 
 
* modification, are permitted provided that the following conditions
 
* are met:
 
*   - Redistributions of source code must retain the above copyright
 
*     notice, this list of conditions and the following disclaimer.
 
*   - Redistributions in binary form must reproduce the above copyright
 
*     notice, this list of conditions and the following disclaimer in
 
*     the documentation and/or other materials provided with the 
 
*     distribution.
 
*   - Neither the name of ARM LIMITED nor the names of its contributors
 
*     may be used to endorse or promote products derived from this
 
*     software without specific prior written permission.
 
*
 
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
 
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
* POSSIBILITY OF SUCH DAMAGE.   
 
* -------------------------------------------------------------------- */
 
 
#include "arm_math.h"
 
 
/**    
 
 * @ingroup groupMath    
 
 */
 
 
/**    
 
 * @addtogroup BasicMult    
 
 * @{    
 
 */
 
 
 
/**    
 
 * @brief           Q15 vector multiplication    
 
 * @param[in]       *pSrcA points to the first input vector    
 
 * @param[in]       *pSrcB points to the second input vector    
 
 * @param[out]      *pDst points to the output vector    
 
 * @param[in]       blockSize number of samples in each vector    
 
 * @return none.    
 
 *    
 
 * <b>Scaling and Overflow Behavior:</b>    
 
 * \par    
 
 * The function uses saturating arithmetic.    
 
 * Results outside of the allowable Q15 range [0x8000 0x7FFF] will be saturated.    
 
 */
 
 
void arm_mult_q15(
 
  q15_t * pSrcA,
 
  q15_t * pSrcB,
 
  q15_t * pDst,
 
  uint32_t blockSize)
 
{
 
  uint32_t blkCnt;                               /* loop counters */
 
 
#ifndef ARM_MATH_CM0_FAMILY
 
 
/* Run the below code for Cortex-M4 and Cortex-M3 */
 
  q31_t inA1, inA2, inB1, inB2;                  /* temporary input variables */
 
  q15_t out1, out2, out3, out4;                  /* temporary output variables */
 
  q31_t mul1, mul2, mul3, mul4;                  /* temporary variables */
 
 
  /* loop Unrolling */
 
  blkCnt = blockSize >> 2u;
 
 
  /* First part of the processing with loop unrolling.  Compute 4 outputs at a time.        
 
   ** a second loop below computes the remaining 1 to 3 samples. */
 
  while(blkCnt > 0u)
 
  {
 
    /* read two samples at a time from sourceA */
 
    inA1 = *__SIMD32(pSrcA)++;
 
    /* read two samples at a time from sourceB */
 
    inB1 = *__SIMD32(pSrcB)++;
 
    /* read two samples at a time from sourceA */
 
    inA2 = *__SIMD32(pSrcA)++;
 
    /* read two samples at a time from sourceB */
 
    inB2 = *__SIMD32(pSrcB)++;
 
 
    /* multiply mul = sourceA * sourceB */
 
    mul1 = (q31_t) ((q15_t) (inA1 >> 16) * (q15_t) (inB1 >> 16));
 
    mul2 = (q31_t) ((q15_t) inA1 * (q15_t) inB1);
 
    mul3 = (q31_t) ((q15_t) (inA2 >> 16) * (q15_t) (inB2 >> 16));
 
    mul4 = (q31_t) ((q15_t) inA2 * (q15_t) inB2);
 
 
    /* saturate result to 16 bit */
 
    out1 = (q15_t) __SSAT(mul1 >> 15, 16);
 
    out2 = (q15_t) __SSAT(mul2 >> 15, 16);
 
    out3 = (q15_t) __SSAT(mul3 >> 15, 16);
 
    out4 = (q15_t) __SSAT(mul4 >> 15, 16);
 
 
    /* store the result */
 
#ifndef ARM_MATH_BIG_ENDIAN
 
 
    *__SIMD32(pDst)++ = __PKHBT(out2, out1, 16);
 
    *__SIMD32(pDst)++ = __PKHBT(out4, out3, 16);
 
 
#else
 
 
    *__SIMD32(pDst)++ = __PKHBT(out2, out1, 16);
 
    *__SIMD32(pDst)++ = __PKHBT(out4, out3, 16);
 
 
#endif //      #ifndef ARM_MATH_BIG_ENDIAN
 
 
    /* Decrement the blockSize loop counter */
 
    blkCnt--;
 
  }
 
 
  /* If the blockSize is not a multiple of 4, compute any remaining output samples here.    
 
   ** No loop unrolling is used. */
 
  blkCnt = blockSize % 0x4u;
 
 
#else
 
 
  /* Run the below code for Cortex-M0 */
 
 
  /* Initialize blkCnt with number of samples */
 
  blkCnt = blockSize;
 
 
#endif /* #ifndef ARM_MATH_CM0_FAMILY */
 
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A * B */
 
    /* Multiply the inputs and store the result in the destination buffer */
 
    *pDst++ = (q15_t) __SSAT((((q31_t) (*pSrcA++) * (*pSrcB++)) >> 15), 16);
 
 
    /* Decrement the blockSize loop counter */
 
    blkCnt--;
 
  }
 
}
 
 
/**    
 
 * @} end of BasicMult group    
 
 */
drivers/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_mult_q31.c
Show inline comments
 
new file 100644
 
/* ----------------------------------------------------------------------    
 
* Copyright (C) 2010-2014 ARM Limited. All rights reserved.    
 
*    
 
* $Date:        19. March 2015
 
* $Revision: 	V.1.4.5
 
*    
 
* Project: 	    CMSIS DSP Library    
 
* Title:	    arm_mult_q31.c    
 
*    
 
* Description:	Q31 vector multiplication.    
 
*    
 
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
 
*  
 
* Redistribution and use in source and binary forms, with or without 
 
* modification, are permitted provided that the following conditions
 
* are met:
 
*   - Redistributions of source code must retain the above copyright
 
*     notice, this list of conditions and the following disclaimer.
 
*   - Redistributions in binary form must reproduce the above copyright
 
*     notice, this list of conditions and the following disclaimer in
 
*     the documentation and/or other materials provided with the 
 
*     distribution.
 
*   - Neither the name of ARM LIMITED nor the names of its contributors
 
*     may be used to endorse or promote products derived from this
 
*     software without specific prior written permission.
 
*
 
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
 
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
* POSSIBILITY OF SUCH DAMAGE. 
 
* -------------------------------------------------------------------- */
 
 
#include "arm_math.h"
 
 
/**    
 
 * @ingroup groupMath    
 
 */
 
 
/**    
 
 * @addtogroup BasicMult    
 
 * @{    
 
 */
 
 
/**    
 
 * @brief Q31 vector multiplication.    
 
 * @param[in]       *pSrcA points to the first input vector    
 
 * @param[in]       *pSrcB points to the second input vector    
 
 * @param[out]      *pDst points to the output vector    
 
 * @param[in]       blockSize number of samples in each vector    
 
 * @return none.    
 
 *    
 
 * <b>Scaling and Overflow Behavior:</b>    
 
 * \par    
 
 * The function uses saturating arithmetic.    
 
 * Results outside of the allowable Q31 range[0x80000000 0x7FFFFFFF] will be saturated.    
 
 */
 
 
void arm_mult_q31(
 
  q31_t * pSrcA,
 
  q31_t * pSrcB,
 
  q31_t * pDst,
 
  uint32_t blockSize)
 
{
 
  uint32_t blkCnt;                               /* loop counters */
 
 
#ifndef ARM_MATH_CM0_FAMILY
 
 
/* Run the below code for Cortex-M4 and Cortex-M3 */
 
  q31_t inA1, inA2, inA3, inA4;                  /* temporary input variables */
 
  q31_t inB1, inB2, inB3, inB4;                  /* temporary input variables */
 
  q31_t out1, out2, out3, out4;                  /* temporary output variables */
 
 
  /* loop Unrolling */
 
  blkCnt = blockSize >> 2u;
 
 
  /* First part of the processing with loop unrolling.  Compute 4 outputs at a time.    
 
   ** a second loop below computes the remaining 1 to 3 samples. */
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A * B */
 
    /* Multiply the inputs and then store the results in the destination buffer. */
 
    inA1 = *pSrcA++;
 
    inA2 = *pSrcA++;
 
    inA3 = *pSrcA++;
 
    inA4 = *pSrcA++;
 
    inB1 = *pSrcB++;
 
    inB2 = *pSrcB++;
 
    inB3 = *pSrcB++;
 
    inB4 = *pSrcB++;
 
 
    out1 = ((q63_t) inA1 * inB1) >> 32;
 
    out2 = ((q63_t) inA2 * inB2) >> 32;
 
    out3 = ((q63_t) inA3 * inB3) >> 32;
 
    out4 = ((q63_t) inA4 * inB4) >> 32;
 
 
    out1 = __SSAT(out1, 31);
 
    out2 = __SSAT(out2, 31);
 
    out3 = __SSAT(out3, 31);
 
    out4 = __SSAT(out4, 31);
 
 
    *pDst++ = out1 << 1u;
 
    *pDst++ = out2 << 1u;
 
    *pDst++ = out3 << 1u;
 
    *pDst++ = out4 << 1u;
 
 
    /* Decrement the blockSize loop counter */
 
    blkCnt--;
 
  }
 
 
  /* If the blockSize is not a multiple of 4, compute any remaining output samples here.    
 
   ** No loop unrolling is used. */
 
  blkCnt = blockSize % 0x4u;
 
  
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A * B */
 
    /* Multiply the inputs and then store the results in the destination buffer. */
 
    inA1 = *pSrcA++;
 
    inB1 = *pSrcB++;
 
    out1 = ((q63_t) inA1 * inB1) >> 32;
 
    out1 = __SSAT(out1, 31);
 
    *pDst++ = out1 << 1u;
 
 
    /* Decrement the blockSize loop counter */
 
    blkCnt--;
 
  }
 
 
#else
 
 
  /* Run the below code for Cortex-M0 */
 
 
  /* Initialize blkCnt with number of samples */
 
  blkCnt = blockSize;
 
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A * B */
 
    /* Multiply the inputs and then store the results in the destination buffer. */
 
    *pDst++ =
 
      (q31_t) clip_q63_to_q31(((q63_t) (*pSrcA++) * (*pSrcB++)) >> 31);
 
 
    /* Decrement the blockSize loop counter */
 
    blkCnt--;
 
  }
 
  
 
#endif /* #ifndef ARM_MATH_CM0_FAMILY */
 
}
 
 
/**    
 
 * @} end of BasicMult group    
 
 */
drivers/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_mult_q7.c
Show inline comments
 
new file 100644
 
/* ----------------------------------------------------------------------    
 
* Copyright (C) 2010-2014 ARM Limited. All rights reserved.    
 
*    
 
* $Date:        19. March 2015
 
* $Revision: 	V.1.4.5
 
*    
 
* Project: 	    CMSIS DSP Library    
 
* Title:	    arm_mult_q7.c    
 
*    
 
* Description:	Q7 vector multiplication.    
 
*    
 
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
 
*  
 
* Redistribution and use in source and binary forms, with or without 
 
* modification, are permitted provided that the following conditions
 
* are met:
 
*   - Redistributions of source code must retain the above copyright
 
*     notice, this list of conditions and the following disclaimer.
 
*   - Redistributions in binary form must reproduce the above copyright
 
*     notice, this list of conditions and the following disclaimer in
 
*     the documentation and/or other materials provided with the 
 
*     distribution.
 
*   - Neither the name of ARM LIMITED nor the names of its contributors
 
*     may be used to endorse or promote products derived from this
 
*     software without specific prior written permission.
 
*
 
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
 
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
* POSSIBILITY OF SUCH DAMAGE. 
 
* -------------------------------------------------------------------- */
 
 
#include "arm_math.h"
 
 
/**    
 
 * @ingroup groupMath    
 
 */
 
 
/**    
 
 * @addtogroup BasicMult    
 
 * @{    
 
 */
 
 
/**    
 
 * @brief           Q7 vector multiplication    
 
 * @param[in]       *pSrcA points to the first input vector    
 
 * @param[in]       *pSrcB points to the second input vector    
 
 * @param[out]      *pDst points to the output vector    
 
 * @param[in]       blockSize number of samples in each vector    
 
 * @return none.    
 
 *    
 
 * <b>Scaling and Overflow Behavior:</b>    
 
 * \par    
 
 * The function uses saturating arithmetic.    
 
 * Results outside of the allowable Q7 range [0x80 0x7F] will be saturated.    
 
 */
 
 
void arm_mult_q7(
 
  q7_t * pSrcA,
 
  q7_t * pSrcB,
 
  q7_t * pDst,
 
  uint32_t blockSize)
 
{
 
  uint32_t blkCnt;                               /* loop counters */
 
 
#ifndef ARM_MATH_CM0_FAMILY
 
 
/* Run the below code for Cortex-M4 and Cortex-M3 */
 
  q7_t out1, out2, out3, out4;                   /* Temporary variables to store the product */
 
 
  /* loop Unrolling */
 
  blkCnt = blockSize >> 2u;
 
 
  /* First part of the processing with loop unrolling.  Compute 4 outputs at a time.    
 
   ** a second loop below computes the remaining 1 to 3 samples. */
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A * B */
 
    /* Multiply the inputs and store the results in temporary variables */
 
    out1 = (q7_t) __SSAT((((q15_t) (*pSrcA++) * (*pSrcB++)) >> 7), 8);
 
    out2 = (q7_t) __SSAT((((q15_t) (*pSrcA++) * (*pSrcB++)) >> 7), 8);
 
    out3 = (q7_t) __SSAT((((q15_t) (*pSrcA++) * (*pSrcB++)) >> 7), 8);
 
    out4 = (q7_t) __SSAT((((q15_t) (*pSrcA++) * (*pSrcB++)) >> 7), 8);
 
 
    /* Store the results of 4 inputs in the destination buffer in single cycle by packing */
 
    *__SIMD32(pDst)++ = __PACKq7(out1, out2, out3, out4);
 
 
    /* Decrement the blockSize loop counter */
 
    blkCnt--;
 
  }
 
 
  /* If the blockSize is not a multiple of 4, compute any remaining output samples here.    
 
   ** No loop unrolling is used. */
 
  blkCnt = blockSize % 0x4u;
 
 
#else
 
 
  /* Run the below code for Cortex-M0 */
 
 
  /* Initialize blkCnt with number of samples */
 
  blkCnt = blockSize;
 
 
#endif /* #ifndef ARM_MATH_CM0_FAMILY */
 
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A * B */
 
    /* Multiply the inputs and store the result in the destination buffer */
 
    *pDst++ = (q7_t) __SSAT((((q15_t) (*pSrcA++) * (*pSrcB++)) >> 7), 8);
 
 
    /* Decrement the blockSize loop counter */
 
    blkCnt--;
 
  }
 
}
 
 
/**    
 
 * @} end of BasicMult group    
 
 */
drivers/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_negate_f32.c
Show inline comments
 
new file 100644
 
/* ----------------------------------------------------------------------    
 
* Copyright (C) 2010-2014 ARM Limited. All rights reserved.    
 
*    
 
* $Date:        19. March 2015
 
* $Revision: 	V.1.4.5
 
*    
 
* Project: 	    CMSIS DSP Library    
 
* Title:		arm_negate_f32.c    
 
*    
 
* Description:	Negates floating-point vectors.    
 
*    
 
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
 
*  
 
* Redistribution and use in source and binary forms, with or without 
 
* modification, are permitted provided that the following conditions
 
* are met:
 
*   - Redistributions of source code must retain the above copyright
 
*     notice, this list of conditions and the following disclaimer.
 
*   - Redistributions in binary form must reproduce the above copyright
 
*     notice, this list of conditions and the following disclaimer in
 
*     the documentation and/or other materials provided with the 
 
*     distribution.
 
*   - Neither the name of ARM LIMITED nor the names of its contributors
 
*     may be used to endorse or promote products derived from this
 
*     software without specific prior written permission.
 
*
 
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
 
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
* POSSIBILITY OF SUCH DAMAGE.  
 
* ---------------------------------------------------------------------------- */
 
 
#include "arm_math.h"
 
 
/**        
 
 * @ingroup groupMath        
 
 */
 
 
/**        
 
 * @defgroup negate Vector Negate        
 
 *        
 
 * Negates the elements of a vector.        
 
 *        
 
 * <pre>        
 
 *     pDst[n] = -pSrc[n],   0 <= n < blockSize.        
 
 * </pre>        
 
 *
 
 * The functions support in-place computation allowing the source and
 
 * destination pointers to reference the same memory buffer.
 
 * There are separate functions for floating-point, Q7, Q15, and Q31 data types.
 
 */
 
 
/**        
 
 * @addtogroup negate        
 
 * @{        
 
 */
 
 
/**        
 
 * @brief  Negates the elements of a floating-point vector.        
 
 * @param[in]  *pSrc points to the input vector        
 
 * @param[out]  *pDst points to the output vector        
 
 * @param[in]  blockSize number of samples in the vector        
 
 * @return none.        
 
 */
 
 
void arm_negate_f32(
 
  float32_t * pSrc,
 
  float32_t * pDst,
 
  uint32_t blockSize)
 
{
 
  uint32_t blkCnt;                               /* loop counter */
 
 
 
#ifndef ARM_MATH_CM0_FAMILY
 
 
/* Run the below code for Cortex-M4 and Cortex-M3 */
 
  float32_t in1, in2, in3, in4;                  /* temporary variables */
 
 
  /*loop Unrolling */
 
  blkCnt = blockSize >> 2u;
 
 
  /* First part of the processing with loop unrolling.  Compute 4 outputs at a time.        
 
   ** a second loop below computes the remaining 1 to 3 samples. */
 
  while(blkCnt > 0u)
 
  {
 
    /* read inputs from source */
 
    in1 = *pSrc;
 
    in2 = *(pSrc + 1);
 
    in3 = *(pSrc + 2);
 
    in4 = *(pSrc + 3);
 
 
    /* negate the input */
 
    in1 = -in1;
 
    in2 = -in2;
 
    in3 = -in3;
 
    in4 = -in4;
 
 
    /* store the result to destination */
 
    *pDst = in1;
 
    *(pDst + 1) = in2;
 
    *(pDst + 2) = in3;
 
    *(pDst + 3) = in4;
 
 
    /* update pointers to process next samples */
 
    pSrc += 4u;
 
    pDst += 4u;
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
  /* If the blockSize is not a multiple of 4, compute any remaining output samples here.        
 
   ** No loop unrolling is used. */
 
  blkCnt = blockSize % 0x4u;
 
 
#else
 
 
  /* Run the below code for Cortex-M0 */
 
 
  /* Initialize blkCnt with number of samples */
 
  blkCnt = blockSize;
 
 
#endif /* #ifndef ARM_MATH_CM0_FAMILY */
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = -A */
 
    /* Negate and then store the results in the destination buffer. */
 
    *pDst++ = -*pSrc++;
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
}
 
 
/**        
 
 * @} end of negate group        
 
 */
drivers/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_negate_q15.c
Show inline comments
 
new file 100644
 
/* ----------------------------------------------------------------------    
 
* Copyright (C) 2010-2014 ARM Limited. All rights reserved.    
 
*    
 
* $Date:        19. March 2015
 
* $Revision: 	V.1.4.5
 
*    
 
* Project: 	    CMSIS DSP Library    
 
* Title:		arm_negate_q15.c    
 
*    
 
* Description:	Negates Q15 vectors.    
 
*    
 
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
 
*  
 
* Redistribution and use in source and binary forms, with or without 
 
* modification, are permitted provided that the following conditions
 
* are met:
 
*   - Redistributions of source code must retain the above copyright
 
*     notice, this list of conditions and the following disclaimer.
 
*   - Redistributions in binary form must reproduce the above copyright
 
*     notice, this list of conditions and the following disclaimer in
 
*     the documentation and/or other materials provided with the 
 
*     distribution.
 
*   - Neither the name of ARM LIMITED nor the names of its contributors
 
*     may be used to endorse or promote products derived from this
 
*     software without specific prior written permission.
 
*
 
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
 
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
* POSSIBILITY OF SUCH DAMAGE.   
 
* -------------------------------------------------------------------- */
 
#include "arm_math.h"
 
 
/**        
 
 * @ingroup groupMath        
 
 */
 
 
/**        
 
 * @addtogroup negate        
 
 * @{        
 
 */
 
 
/**        
 
 * @brief  Negates the elements of a Q15 vector.        
 
 * @param[in]  *pSrc points to the input vector        
 
 * @param[out]  *pDst points to the output vector        
 
 * @param[in]  blockSize number of samples in the vector        
 
 * @return none.        
 
 *    
 
 * \par Conditions for optimum performance    
 
 *  Input and output buffers should be aligned by 32-bit    
 
 *    
 
 *        
 
 * <b>Scaling and Overflow Behavior:</b>        
 
 * \par        
 
 * The function uses saturating arithmetic.        
 
 * The Q15 value -1 (0x8000) will be saturated to the maximum allowable positive value 0x7FFF.        
 
 */
 
 
void arm_negate_q15(
 
  q15_t * pSrc,
 
  q15_t * pDst,
 
  uint32_t blockSize)
 
{
 
  uint32_t blkCnt;                               /* loop counter */
 
  q15_t in;
 
 
#ifndef ARM_MATH_CM0_FAMILY
 
 
/* Run the below code for Cortex-M4 and Cortex-M3 */
 
 
  q31_t in1, in2;                                /* Temporary variables */
 
 
 
  /*loop Unrolling */
 
  blkCnt = blockSize >> 2u;
 
 
  /* First part of the processing with loop unrolling.  Compute 4 outputs at a time.        
 
   ** a second loop below computes the remaining 1 to 3 samples. */
 
  while(blkCnt > 0u)
 
  {
 
    /* C = -A */
 
    /* Read two inputs at a time */
 
    in1 = _SIMD32_OFFSET(pSrc);
 
    in2 = _SIMD32_OFFSET(pSrc + 2);
 
 
    /* negate two samples at a time */
 
    in1 = __QSUB16(0, in1);
 
 
    /* negate two samples at a time */
 
    in2 = __QSUB16(0, in2);
 
 
    /* store the result to destination 2 samples at a time */
 
    _SIMD32_OFFSET(pDst) = in1;
 
    /* store the result to destination 2 samples at a time */
 
    _SIMD32_OFFSET(pDst + 2) = in2;
 
 
 
    /* update pointers to process next samples */
 
    pSrc += 4u;
 
    pDst += 4u;
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
  /* If the blockSize is not a multiple of 4, compute any remaining output samples here.        
 
   ** No loop unrolling is used. */
 
  blkCnt = blockSize % 0x4u;
 
 
#else
 
 
  /* Run the below code for Cortex-M0 */
 
 
  /* Initialize blkCnt with number of samples */
 
  blkCnt = blockSize;
 
 
#endif /* #ifndef ARM_MATH_CM0_FAMILY */
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = -A */
 
    /* Negate and then store the result in the destination buffer. */
 
    in = *pSrc++;
 
    *pDst++ = (in == (q15_t) 0x8000) ? 0x7fff : -in;
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
}
 
 
/**        
 
 * @} end of negate group        
 
 */
drivers/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_negate_q31.c
Show inline comments
 
new file 100644
 
/* ----------------------------------------------------------------------    
 
* Copyright (C) 2010-2014 ARM Limited. All rights reserved.    
 
*    
 
* $Date:        19. March 2015
 
* $Revision: 	V.1.4.5
 
*    
 
* Project: 	    CMSIS DSP Library    
 
* Title:		arm_negate_q31.c    
 
*    
 
* Description:	Negates Q31 vectors.    
 
*    
 
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
 
*  
 
* Redistribution and use in source and binary forms, with or without 
 
* modification, are permitted provided that the following conditions
 
* are met:
 
*   - Redistributions of source code must retain the above copyright
 
*     notice, this list of conditions and the following disclaimer.
 
*   - Redistributions in binary form must reproduce the above copyright
 
*     notice, this list of conditions and the following disclaimer in
 
*     the documentation and/or other materials provided with the 
 
*     distribution.
 
*   - Neither the name of ARM LIMITED nor the names of its contributors
 
*     may be used to endorse or promote products derived from this
 
*     software without specific prior written permission.
 
*
 
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
 
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
* POSSIBILITY OF SUCH DAMAGE.   
 
* -------------------------------------------------------------------- */
 
 
#include "arm_math.h"
 
 
/**    
 
 * @ingroup groupMath    
 
 */
 
 
/**    
 
 * @addtogroup negate    
 
 * @{    
 
 */
 
 
/**    
 
 * @brief  Negates the elements of a Q31 vector.    
 
 * @param[in]  *pSrc points to the input vector    
 
 * @param[out]  *pDst points to the output vector    
 
 * @param[in]  blockSize number of samples in the vector    
 
 * @return none.    
 
 *    
 
 * <b>Scaling and Overflow Behavior:</b>    
 
 * \par    
 
 * The function uses saturating arithmetic.    
 
 * The Q31 value -1 (0x80000000) will be saturated to the maximum allowable positive value 0x7FFFFFFF.    
 
 */
 
 
void arm_negate_q31(
 
  q31_t * pSrc,
 
  q31_t * pDst,
 
  uint32_t blockSize)
 
{
 
  q31_t in;                                      /* Temporary variable */
 
  uint32_t blkCnt;                               /* loop counter */
 
 
#ifndef ARM_MATH_CM0_FAMILY
 
 
/* Run the below code for Cortex-M4 and Cortex-M3 */
 
  q31_t in1, in2, in3, in4;
 
 
  /*loop Unrolling */
 
  blkCnt = blockSize >> 2u;
 
 
  /* First part of the processing with loop unrolling.  Compute 4 outputs at a time.    
 
   ** a second loop below computes the remaining 1 to 3 samples. */
 
  while(blkCnt > 0u)
 
  {
 
    /* C = -A */
 
    /* Negate and then store the results in the destination buffer. */
 
    in1 = *pSrc++;
 
    in2 = *pSrc++;
 
    in3 = *pSrc++;
 
    in4 = *pSrc++;
 
 
    *pDst++ = __QSUB(0, in1);
 
    *pDst++ = __QSUB(0, in2);
 
    *pDst++ = __QSUB(0, in3);
 
    *pDst++ = __QSUB(0, in4);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
  /* If the blockSize is not a multiple of 4, compute any remaining output samples here.    
 
   ** No loop unrolling is used. */
 
  blkCnt = blockSize % 0x4u;
 
 
#else
 
 
  /* Run the below code for Cortex-M0 */
 
 
  /* Initialize blkCnt with number of samples */
 
  blkCnt = blockSize;
 
 
#endif /* #ifndef ARM_MATH_CM0_FAMILY */
 
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = -A */
 
    /* Negate and then store the result in the destination buffer. */
 
    in = *pSrc++;
 
    *pDst++ = (in == INT32_MIN) ? INT32_MAX : -in;
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
}
 
 
/**    
 
 * @} end of negate group    
 
 */
drivers/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_negate_q7.c
Show inline comments
 
new file 100644
 
/* ----------------------------------------------------------------------    
 
* Copyright (C) 2010-2014 ARM Limited. All rights reserved.    
 
*    
 
* $Date:        19. March 2015
 
* $Revision: 	V.1.4.5
 
*    
 
* Project: 	    CMSIS DSP Library    
 
* Title:		arm_negate_q7.c    
 
*    
 
* Description:	Negates Q7 vectors.    
 
*    
 
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
 
*  
 
* Redistribution and use in source and binary forms, with or without 
 
* modification, are permitted provided that the following conditions
 
* are met:
 
*   - Redistributions of source code must retain the above copyright
 
*     notice, this list of conditions and the following disclaimer.
 
*   - Redistributions in binary form must reproduce the above copyright
 
*     notice, this list of conditions and the following disclaimer in
 
*     the documentation and/or other materials provided with the 
 
*     distribution.
 
*   - Neither the name of ARM LIMITED nor the names of its contributors
 
*     may be used to endorse or promote products derived from this
 
*     software without specific prior written permission.
 
*
 
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
 
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
* POSSIBILITY OF SUCH DAMAGE.   
 
* -------------------------------------------------------------------- */
 
 
#include "arm_math.h"
 
 
/**    
 
 * @ingroup groupMath    
 
 */
 
 
/**    
 
 * @addtogroup negate    
 
 * @{    
 
 */
 
 
/**    
 
 * @brief  Negates the elements of a Q7 vector.    
 
 * @param[in]  *pSrc points to the input vector    
 
 * @param[out]  *pDst points to the output vector    
 
 * @param[in]  blockSize number of samples in the vector    
 
 * @return none.    
 
 *    
 
 * <b>Scaling and Overflow Behavior:</b>    
 
 * \par    
 
 * The function uses saturating arithmetic.    
 
 * The Q7 value -1 (0x80) will be saturated to the maximum allowable positive value 0x7F.    
 
 */
 
 
void arm_negate_q7(
 
  q7_t * pSrc,
 
  q7_t * pDst,
 
  uint32_t blockSize)
 
{
 
  uint32_t blkCnt;                               /* loop counter */
 
  q7_t in;
 
 
#ifndef ARM_MATH_CM0_FAMILY
 
 
/* Run the below code for Cortex-M4 and Cortex-M3 */
 
  q31_t input;                                   /* Input values1-4 */
 
  q31_t zero = 0x00000000;
 
 
 
  /*loop Unrolling */
 
  blkCnt = blockSize >> 2u;
 
 
  /* First part of the processing with loop unrolling.  Compute 4 outputs at a time.    
 
   ** a second loop below computes the remaining 1 to 3 samples. */
 
  while(blkCnt > 0u)
 
  {
 
    /* C = -A */
 
    /* Read four inputs */
 
    input = *__SIMD32(pSrc)++;
 
 
    /* Store the Negated results in the destination buffer in a single cycle by packing the results */
 
    *__SIMD32(pDst)++ = __QSUB8(zero, input);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
  /* If the blockSize is not a multiple of 4, compute any remaining output samples here.    
 
   ** No loop unrolling is used. */
 
  blkCnt = blockSize % 0x4u;
 
 
#else
 
 
  /* Run the below code for Cortex-M0 */
 
 
  /* Initialize blkCnt with number of samples */
 
  blkCnt = blockSize;
 
 
#endif /* #ifndef ARM_MATH_CM0_FAMILY */
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = -A */
 
    /* Negate and then store the results in the destination buffer. */ \
 
      in = *pSrc++;
 
    *pDst++ = (in == (q7_t) 0x80) ? 0x7f : -in;
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
}
 
 
/**    
 
 * @} end of negate group    
 
 */
drivers/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_offset_f32.c
Show inline comments
 
new file 100644
 
/* ----------------------------------------------------------------------    
 
* Copyright (C) 2010-2014 ARM Limited. All rights reserved.    
 
*    
 
* $Date:        19. March 2015
 
* $Revision: 	V.1.4.5
 
*    
 
* Project: 	    CMSIS DSP Library    
 
* Title:		arm_offset_f32.c    
 
*    
 
* Description:	Floating-point vector offset.    
 
*    
 
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
 
*  
 
* Redistribution and use in source and binary forms, with or without 
 
* modification, are permitted provided that the following conditions
 
* are met:
 
*   - Redistributions of source code must retain the above copyright
 
*     notice, this list of conditions and the following disclaimer.
 
*   - Redistributions in binary form must reproduce the above copyright
 
*     notice, this list of conditions and the following disclaimer in
 
*     the documentation and/or other materials provided with the 
 
*     distribution.
 
*   - Neither the name of ARM LIMITED nor the names of its contributors
 
*     may be used to endorse or promote products derived from this
 
*     software without specific prior written permission.
 
*
 
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
 
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
* POSSIBILITY OF SUCH DAMAGE.   
 
* ---------------------------------------------------------------------------- */
 
#include "arm_math.h"
 
 
/**        
 
 * @ingroup groupMath        
 
 */
 
 
/**        
 
 * @defgroup offset Vector Offset        
 
 *        
 
 * Adds a constant offset to each element of a vector.        
 
 *        
 
 * <pre>        
 
 *     pDst[n] = pSrc[n] + offset,   0 <= n < blockSize.        
 
 * </pre>        
 
 *        
 
 * The functions support in-place computation allowing the source and
 
 * destination pointers to reference the same memory buffer.
 
 * There are separate functions for floating-point, Q7, Q15, and Q31 data types.
 
 */
 
 
/**        
 
 * @addtogroup offset        
 
 * @{        
 
 */
 
 
/**        
 
 * @brief  Adds a constant offset to a floating-point vector.        
 
 * @param[in]  *pSrc points to the input vector        
 
 * @param[in]  offset is the offset to be added        
 
 * @param[out]  *pDst points to the output vector        
 
 * @param[in]  blockSize number of samples in the vector        
 
 * @return none.        
 
 */
 
 
 
void arm_offset_f32(
 
  float32_t * pSrc,
 
  float32_t offset,
 
  float32_t * pDst,
 
  uint32_t blockSize)
 
{
 
  uint32_t blkCnt;                               /* loop counter */
 
 
#ifndef ARM_MATH_CM0_FAMILY
 
 
/* Run the below code for Cortex-M4 and Cortex-M3 */
 
  float32_t in1, in2, in3, in4;
 
 
  /*loop Unrolling */
 
  blkCnt = blockSize >> 2u;
 
 
  /* First part of the processing with loop unrolling.  Compute 4 outputs at a time.        
 
   ** a second loop below computes the remaining 1 to 3 samples. */
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A + offset */
 
    /* Add offset and then store the results in the destination buffer. */
 
    /* read samples from source */
 
    in1 = *pSrc;
 
    in2 = *(pSrc + 1);
 
 
    /* add offset to input */
 
    in1 = in1 + offset;
 
 
    /* read samples from source */
 
    in3 = *(pSrc + 2);
 
 
    /* add offset to input */
 
    in2 = in2 + offset;
 
 
    /* read samples from source */
 
    in4 = *(pSrc + 3);
 
 
    /* add offset to input */
 
    in3 = in3 + offset;
 
 
    /* store result to destination */
 
    *pDst = in1;
 
 
    /* add offset to input */
 
    in4 = in4 + offset;
 
 
    /* store result to destination */
 
    *(pDst + 1) = in2;
 
 
    /* store result to destination */
 
    *(pDst + 2) = in3;
 
 
    /* store result to destination */
 
    *(pDst + 3) = in4;
 
 
    /* update pointers to process next samples */
 
    pSrc += 4u;
 
    pDst += 4u;
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
  /* If the blockSize is not a multiple of 4, compute any remaining output samples here.        
 
   ** No loop unrolling is used. */
 
  blkCnt = blockSize % 0x4u;
 
 
#else
 
 
  /* Run the below code for Cortex-M0 */
 
 
  /* Initialize blkCnt with number of samples */
 
  blkCnt = blockSize;
 
 
#endif /* #ifndef ARM_MATH_CM0_FAMILY */
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A + offset */
 
    /* Add offset and then store the result in the destination buffer. */
 
    *pDst++ = (*pSrc++) + offset;
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
}
 
 
/**        
 
 * @} end of offset group        
 
 */
drivers/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_offset_q15.c
Show inline comments
 
new file 100644
 
/* ----------------------------------------------------------------------    
 
* Copyright (C) 2010-2014 ARM Limited. All rights reserved.    
 
*    
 
* $Date:        19. March 2015
 
* $Revision: 	V.1.4.5
 
*    
 
* Project: 	    CMSIS DSP Library    
 
* Title:		arm_offset_q15.c    
 
*    
 
* Description:	Q15 vector offset.    
 
*    
 
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
 
*  
 
* Redistribution and use in source and binary forms, with or without 
 
* modification, are permitted provided that the following conditions
 
* are met:
 
*   - Redistributions of source code must retain the above copyright
 
*     notice, this list of conditions and the following disclaimer.
 
*   - Redistributions in binary form must reproduce the above copyright
 
*     notice, this list of conditions and the following disclaimer in
 
*     the documentation and/or other materials provided with the 
 
*     distribution.
 
*   - Neither the name of ARM LIMITED nor the names of its contributors
 
*     may be used to endorse or promote products derived from this
 
*     software without specific prior written permission.
 
*
 
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
 
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
* POSSIBILITY OF SUCH DAMAGE.   
 
* -------------------------------------------------------------------- */
 
 
#include "arm_math.h"
 
 
/**    
 
 * @ingroup groupMath    
 
 */
 
 
/**    
 
 * @addtogroup offset    
 
 * @{    
 
 */
 
 
/**    
 
 * @brief  Adds a constant offset to a Q15 vector.    
 
 * @param[in]  *pSrc points to the input vector    
 
 * @param[in]  offset is the offset to be added    
 
 * @param[out]  *pDst points to the output vector    
 
 * @param[in]  blockSize number of samples in the vector    
 
 * @return none.    
 
 *    
 
 * <b>Scaling and Overflow Behavior:</b>    
 
 * \par    
 
 * The function uses saturating arithmetic.    
 
 * Results outside of the allowable Q15 range [0x8000 0x7FFF] are saturated.    
 
 */
 
 
void arm_offset_q15(
 
  q15_t * pSrc,
 
  q15_t offset,
 
  q15_t * pDst,
 
  uint32_t blockSize)
 
{
 
  uint32_t blkCnt;                               /* loop counter */
 
 
#ifndef ARM_MATH_CM0_FAMILY
 
 
/* Run the below code for Cortex-M4 and Cortex-M3 */
 
  q31_t offset_packed;                           /* Offset packed to 32 bit */
 
 
 
  /*loop Unrolling */
 
  blkCnt = blockSize >> 2u;
 
 
  /* Offset is packed to 32 bit in order to use SIMD32 for addition */
 
  offset_packed = __PKHBT(offset, offset, 16);
 
 
  /* First part of the processing with loop unrolling.  Compute 4 outputs at a time.    
 
   ** a second loop below computes the remaining 1 to 3 samples. */
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A + offset */
 
    /* Add offset and then store the results in the destination buffer, 2 samples at a time. */
 
    *__SIMD32(pDst)++ = __QADD16(*__SIMD32(pSrc)++, offset_packed);
 
    *__SIMD32(pDst)++ = __QADD16(*__SIMD32(pSrc)++, offset_packed);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
  /* If the blockSize is not a multiple of 4, compute any remaining output samples here.    
 
   ** No loop unrolling is used. */
 
  blkCnt = blockSize % 0x4u;
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A + offset */
 
    /* Add offset and then store the results in the destination buffer. */
 
    *pDst++ = (q15_t) __QADD16(*pSrc++, offset);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
#else
 
 
  /* Run the below code for Cortex-M0 */
 
 
  /* Initialize blkCnt with number of samples */
 
  blkCnt = blockSize;
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A + offset */
 
    /* Add offset and then store the results in the destination buffer. */
 
    *pDst++ = (q15_t) __SSAT(((q31_t) * pSrc++ + offset), 16);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
#endif /* #ifndef ARM_MATH_CM0_FAMILY */
 
 
}
 
 
/**    
 
 * @} end of offset group    
 
 */
drivers/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_offset_q31.c
Show inline comments
 
new file 100644
 
/* ----------------------------------------------------------------------    
 
* Copyright (C) 2010-2014 ARM Limited. All rights reserved.    
 
*    
 
* $Date:        19. March 2015
 
* $Revision: 	V.1.4.5
 
*    
 
* Project: 	    CMSIS DSP Library    
 
* Title:		arm_offset_q31.c    
 
*    
 
* Description:	Q31 vector offset.    
 
*    
 
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
 
*  
 
* Redistribution and use in source and binary forms, with or without 
 
* modification, are permitted provided that the following conditions
 
* are met:
 
*   - Redistributions of source code must retain the above copyright
 
*     notice, this list of conditions and the following disclaimer.
 
*   - Redistributions in binary form must reproduce the above copyright
 
*     notice, this list of conditions and the following disclaimer in
 
*     the documentation and/or other materials provided with the 
 
*     distribution.
 
*   - Neither the name of ARM LIMITED nor the names of its contributors
 
*     may be used to endorse or promote products derived from this
 
*     software without specific prior written permission.
 
*
 
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
 
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
* POSSIBILITY OF SUCH DAMAGE. 
 
* -------------------------------------------------------------------- */
 
 
#include "arm_math.h"
 
 
/**    
 
 * @ingroup groupMath    
 
 */
 
 
/**    
 
 * @addtogroup offset    
 
 * @{    
 
 */
 
 
/**    
 
 * @brief  Adds a constant offset to a Q31 vector.    
 
 * @param[in]  *pSrc points to the input vector    
 
 * @param[in]  offset is the offset to be added    
 
 * @param[out]  *pDst points to the output vector    
 
 * @param[in]  blockSize number of samples in the vector    
 
 * @return none.    
 
 *    
 
 * <b>Scaling and Overflow Behavior:</b>    
 
 * \par    
 
 * The function uses saturating arithmetic.    
 
 * Results outside of the allowable Q31 range [0x80000000 0x7FFFFFFF] are saturated.    
 
 */
 
 
void arm_offset_q31(
 
  q31_t * pSrc,
 
  q31_t offset,
 
  q31_t * pDst,
 
  uint32_t blockSize)
 
{
 
  uint32_t blkCnt;                               /* loop counter */
 
 
#ifndef ARM_MATH_CM0_FAMILY
 
 
/* Run the below code for Cortex-M4 and Cortex-M3 */
 
  q31_t in1, in2, in3, in4;
 
 
 
  /*loop Unrolling */
 
  blkCnt = blockSize >> 2u;
 
 
  /* First part of the processing with loop unrolling.  Compute 4 outputs at a time.    
 
   ** a second loop below computes the remaining 1 to 3 samples. */
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A + offset */
 
    /* Add offset and then store the results in the destination buffer. */
 
    in1 = *pSrc++;
 
    in2 = *pSrc++;
 
    in3 = *pSrc++;
 
    in4 = *pSrc++;
 
 
    *pDst++ = __QADD(in1, offset);
 
    *pDst++ = __QADD(in2, offset);
 
    *pDst++ = __QADD(in3, offset);
 
    *pDst++ = __QADD(in4, offset);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
  /* If the blockSize is not a multiple of 4, compute any remaining output samples here.    
 
   ** No loop unrolling is used. */
 
  blkCnt = blockSize % 0x4u;
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A + offset */
 
    /* Add offset and then store the result in the destination buffer. */
 
    *pDst++ = __QADD(*pSrc++, offset);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
#else
 
 
  /* Run the below code for Cortex-M0 */
 
 
  /* Initialize blkCnt with number of samples */
 
  blkCnt = blockSize;
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A + offset */
 
    /* Add offset and then store the result in the destination buffer. */
 
    *pDst++ = (q31_t) clip_q63_to_q31((q63_t) * pSrc++ + offset);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
#endif /* #ifndef ARM_MATH_CM0_FAMILY */
 
 
}
 
 
/**    
 
 * @} end of offset group    
 
 */
drivers/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_offset_q7.c
Show inline comments
 
new file 100644
 
/* ----------------------------------------------------------------------    
 
* Copyright (C) 2010-2014 ARM Limited. All rights reserved.    
 
*    
 
* $Date:        19. March 2015
 
* $Revision: 	V.1.4.5
 
*    
 
* Project: 	    CMSIS DSP Library    
 
* Title:		arm_offset_q7.c    
 
*    
 
* Description:	Q7 vector offset.    
 
*    
 
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
 
*  
 
* Redistribution and use in source and binary forms, with or without 
 
* modification, are permitted provided that the following conditions
 
* are met:
 
*   - Redistributions of source code must retain the above copyright
 
*     notice, this list of conditions and the following disclaimer.
 
*   - Redistributions in binary form must reproduce the above copyright
 
*     notice, this list of conditions and the following disclaimer in
 
*     the documentation and/or other materials provided with the 
 
*     distribution.
 
*   - Neither the name of ARM LIMITED nor the names of its contributors
 
*     may be used to endorse or promote products derived from this
 
*     software without specific prior written permission.
 
*
 
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
 
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
* POSSIBILITY OF SUCH DAMAGE.   
 
* -------------------------------------------------------------------- */
 
 
#include "arm_math.h"
 
 
/**    
 
 * @ingroup groupMath    
 
 */
 
 
/**    
 
 * @addtogroup offset    
 
 * @{    
 
 */
 
 
/**    
 
 * @brief  Adds a constant offset to a Q7 vector.    
 
 * @param[in]  *pSrc points to the input vector    
 
 * @param[in]  offset is the offset to be added    
 
 * @param[out]  *pDst points to the output vector    
 
 * @param[in]  blockSize number of samples in the vector    
 
 * @return none.    
 
 *    
 
 * <b>Scaling and Overflow Behavior:</b>    
 
 * \par    
 
 * The function uses saturating arithmetic.    
 
 * Results outside of the allowable Q7 range [0x80 0x7F] are saturated.    
 
 */
 
 
void arm_offset_q7(
 
  q7_t * pSrc,
 
  q7_t offset,
 
  q7_t * pDst,
 
  uint32_t blockSize)
 
{
 
  uint32_t blkCnt;                               /* loop counter */
 
 
#ifndef ARM_MATH_CM0_FAMILY
 
 
/* Run the below code for Cortex-M4 and Cortex-M3 */
 
  q31_t offset_packed;                           /* Offset packed to 32 bit */
 
 
 
  /*loop Unrolling */
 
  blkCnt = blockSize >> 2u;
 
 
  /* Offset is packed to 32 bit in order to use SIMD32 for addition */
 
  offset_packed = __PACKq7(offset, offset, offset, offset);
 
 
  /* First part of the processing with loop unrolling.  Compute 4 outputs at a time.    
 
   ** a second loop below computes the remaining 1 to 3 samples. */
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A + offset */
 
    /* Add offset and then store the results in the destination bufferfor 4 samples at a time. */
 
    *__SIMD32(pDst)++ = __QADD8(*__SIMD32(pSrc)++, offset_packed);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
  /* If the blockSize is not a multiple of 4, compute any remaining output samples here.    
 
   ** No loop unrolling is used. */
 
  blkCnt = blockSize % 0x4u;
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A + offset */
 
    /* Add offset and then store the result in the destination buffer. */
 
    *pDst++ = (q7_t) __SSAT(*pSrc++ + offset, 8);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
#else
 
 
  /* Run the below code for Cortex-M0 */
 
 
  /* Initialize blkCnt with number of samples */
 
  blkCnt = blockSize;
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A + offset */
 
    /* Add offset and then store the result in the destination buffer. */
 
    *pDst++ = (q7_t) __SSAT((q15_t) * pSrc++ + offset, 8);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
#endif /* #ifndef ARM_MATH_CM0_FAMILY */
 
 
}
 
 
/**    
 
 * @} end of offset group    
 
 */
drivers/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_scale_f32.c
Show inline comments
 
new file 100644
 
/* ----------------------------------------------------------------------    
 
* Copyright (C) 2010-2014 ARM Limited. All rights reserved.    
 
*    
 
* $Date:        19. March 2015
 
* $Revision: 	V.1.4.5
 
*    
 
* Project: 	    CMSIS DSP Library    
 
* Title:		arm_scale_f32.c    
 
*    
 
* Description:	Multiplies a floating-point vector by a scalar.    
 
*    
 
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
 
*  
 
* Redistribution and use in source and binary forms, with or without 
 
* modification, are permitted provided that the following conditions
 
* are met:
 
*   - Redistributions of source code must retain the above copyright
 
*     notice, this list of conditions and the following disclaimer.
 
*   - Redistributions in binary form must reproduce the above copyright
 
*     notice, this list of conditions and the following disclaimer in
 
*     the documentation and/or other materials provided with the 
 
*     distribution.
 
*   - Neither the name of ARM LIMITED nor the names of its contributors
 
*     may be used to endorse or promote products derived from this
 
*     software without specific prior written permission.
 
*
 
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
 
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
* POSSIBILITY OF SUCH DAMAGE.    
 
* ---------------------------------------------------------------------------- */
 
 
#include "arm_math.h"
 
 
/**        
 
 * @ingroup groupMath        
 
 */
 
 
/**        
 
 * @defgroup scale Vector Scale        
 
 *        
 
 * Multiply a vector by a scalar value.  For floating-point data, the algorithm used is:        
 
 *        
 
 * <pre>        
 
 *     pDst[n] = pSrc[n] * scale,   0 <= n < blockSize.        
 
 * </pre>        
 
 *        
 
 * In the fixed-point Q7, Q15, and Q31 functions, <code>scale</code> is represented by        
 
 * a fractional multiplication <code>scaleFract</code> and an arithmetic shift <code>shift</code>.        
 
 * The shift allows the gain of the scaling operation to exceed 1.0.        
 
 * The algorithm used with fixed-point data is:        
 
 *        
 
 * <pre>        
 
 *     pDst[n] = (pSrc[n] * scaleFract) << shift,   0 <= n < blockSize.        
 
 * </pre>        
 
 *        
 
 * The overall scale factor applied to the fixed-point data is        
 
 * <pre>        
 
 *     scale = scaleFract * 2^shift.        
 
 * </pre>        
 
 *
 
 * The functions support in-place computation allowing the source and destination
 
 * pointers to reference the same memory buffer.
 
 */
 
 
/**        
 
 * @addtogroup scale        
 
 * @{        
 
 */
 
 
/**        
 
 * @brief Multiplies a floating-point vector by a scalar.        
 
 * @param[in]       *pSrc points to the input vector        
 
 * @param[in]       scale scale factor to be applied        
 
 * @param[out]      *pDst points to the output vector        
 
 * @param[in]       blockSize number of samples in the vector        
 
 * @return none.        
 
 */
 
 
 
void arm_scale_f32(
 
  float32_t * pSrc,
 
  float32_t scale,
 
  float32_t * pDst,
 
  uint32_t blockSize)
 
{
 
  uint32_t blkCnt;                               /* loop counter */
 
#ifndef ARM_MATH_CM0_FAMILY
 
 
/* Run the below code for Cortex-M4 and Cortex-M3 */
 
  float32_t in1, in2, in3, in4;                  /* temporary variabels */
 
 
  /*loop Unrolling */
 
  blkCnt = blockSize >> 2u;
 
 
  /* First part of the processing with loop unrolling.  Compute 4 outputs at a time.        
 
   ** a second loop below computes the remaining 1 to 3 samples. */
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A * scale */
 
    /* Scale the input and then store the results in the destination buffer. */
 
    /* read input samples from source */
 
    in1 = *pSrc;
 
    in2 = *(pSrc + 1);
 
 
    /* multiply with scaling factor */
 
    in1 = in1 * scale;
 
 
    /* read input sample from source */
 
    in3 = *(pSrc + 2);
 
 
    /* multiply with scaling factor */
 
    in2 = in2 * scale;
 
 
    /* read input sample from source */
 
    in4 = *(pSrc + 3);
 
 
    /* multiply with scaling factor */
 
    in3 = in3 * scale;
 
    in4 = in4 * scale;
 
    /* store the result to destination */
 
    *pDst = in1;
 
    *(pDst + 1) = in2;
 
    *(pDst + 2) = in3;
 
    *(pDst + 3) = in4;
 
 
    /* update pointers to process next samples */
 
    pSrc += 4u;
 
    pDst += 4u;
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
  /* If the blockSize is not a multiple of 4, compute any remaining output samples here.        
 
   ** No loop unrolling is used. */
 
  blkCnt = blockSize % 0x4u;
 
 
#else
 
 
  /* Run the below code for Cortex-M0 */
 
 
  /* Initialize blkCnt with number of samples */
 
  blkCnt = blockSize;
 
 
#endif /* #ifndef ARM_MATH_CM0_FAMILY */
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A * scale */
 
    /* Scale the input and then store the result in the destination buffer. */
 
    *pDst++ = (*pSrc++) * scale;
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
}
 
 
/**        
 
 * @} end of scale group        
 
 */
drivers/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_scale_q15.c
Show inline comments
 
new file 100644
 
/* ----------------------------------------------------------------------    
 
* Copyright (C) 2010-2014 ARM Limited. All rights reserved.    
 
*    
 
* $Date:        19. March 2015
 
* $Revision: 	V.1.4.5
 
*    
 
* Project: 	    CMSIS DSP Library    
 
* Title:		arm_scale_q15.c    
 
*    
 
* Description:	Multiplies a Q15 vector by a scalar.    
 
*    
 
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
 
*  
 
* Redistribution and use in source and binary forms, with or without 
 
* modification, are permitted provided that the following conditions
 
* are met:
 
*   - Redistributions of source code must retain the above copyright
 
*     notice, this list of conditions and the following disclaimer.
 
*   - Redistributions in binary form must reproduce the above copyright
 
*     notice, this list of conditions and the following disclaimer in
 
*     the documentation and/or other materials provided with the 
 
*     distribution.
 
*   - Neither the name of ARM LIMITED nor the names of its contributors
 
*     may be used to endorse or promote products derived from this
 
*     software without specific prior written permission.
 
*
 
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
 
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
* POSSIBILITY OF SUCH DAMAGE.   
 
* -------------------------------------------------------------------- */
 
 
#include "arm_math.h"
 
 
/**    
 
 * @ingroup groupMath    
 
 */
 
 
/**    
 
 * @addtogroup scale    
 
 * @{    
 
 */
 
 
/**    
 
 * @brief Multiplies a Q15 vector by a scalar.    
 
 * @param[in]       *pSrc points to the input vector    
 
 * @param[in]       scaleFract fractional portion of the scale value    
 
 * @param[in]       shift number of bits to shift the result by    
 
 * @param[out]      *pDst points to the output vector    
 
 * @param[in]       blockSize number of samples in the vector    
 
 * @return none.    
 
 *    
 
 * <b>Scaling and Overflow Behavior:</b>    
 
 * \par    
 
 * The input data <code>*pSrc</code> and <code>scaleFract</code> are in 1.15 format.    
 
 * These are multiplied to yield a 2.30 intermediate result and this is shifted with saturation to 1.15 format.    
 
 */
 
 
 
void arm_scale_q15(
 
  q15_t * pSrc,
 
  q15_t scaleFract,
 
  int8_t shift,
 
  q15_t * pDst,
 
  uint32_t blockSize)
 
{
 
  int8_t kShift = 15 - shift;                    /* shift to apply after scaling */
 
  uint32_t blkCnt;                               /* loop counter */
 
 
#ifndef ARM_MATH_CM0_FAMILY
 
 
/* Run the below code for Cortex-M4 and Cortex-M3 */
 
  q15_t in1, in2, in3, in4;
 
  q31_t inA1, inA2;                              /* Temporary variables */
 
  q31_t out1, out2, out3, out4;
 
 
 
  /*loop Unrolling */
 
  blkCnt = blockSize >> 2u;
 
 
  /* First part of the processing with loop unrolling.  Compute 4 outputs at a time.        
 
   ** a second loop below computes the remaining 1 to 3 samples. */
 
  while(blkCnt > 0u)
 
  {
 
    /* Reading 2 inputs from memory */
 
    inA1 = *__SIMD32(pSrc)++;
 
    inA2 = *__SIMD32(pSrc)++;
 
 
    /* C = A * scale */
 
    /* Scale the inputs and then store the 2 results in the destination buffer        
 
     * in single cycle by packing the outputs */
 
    out1 = (q31_t) ((q15_t) (inA1 >> 16) * scaleFract);
 
    out2 = (q31_t) ((q15_t) inA1 * scaleFract);
 
    out3 = (q31_t) ((q15_t) (inA2 >> 16) * scaleFract);
 
    out4 = (q31_t) ((q15_t) inA2 * scaleFract);
 
 
    /* apply shifting */
 
    out1 = out1 >> kShift;
 
    out2 = out2 >> kShift;
 
    out3 = out3 >> kShift;
 
    out4 = out4 >> kShift;
 
 
    /* saturate the output */
 
    in1 = (q15_t) (__SSAT(out1, 16));
 
    in2 = (q15_t) (__SSAT(out2, 16));
 
    in3 = (q15_t) (__SSAT(out3, 16));
 
    in4 = (q15_t) (__SSAT(out4, 16));
 
 
    /* store the result to destination */
 
    *__SIMD32(pDst)++ = __PKHBT(in2, in1, 16);
 
    *__SIMD32(pDst)++ = __PKHBT(in4, in3, 16);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
  /* If the blockSize is not a multiple of 4, compute any remaining output samples here.    
 
   ** No loop unrolling is used. */
 
  blkCnt = blockSize % 0x4u;
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A * scale */
 
    /* Scale the input and then store the result in the destination buffer. */
 
    *pDst++ = (q15_t) (__SSAT(((*pSrc++) * scaleFract) >> kShift, 16));
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
#else
 
 
  /* Run the below code for Cortex-M0 */
 
 
  /* Initialize blkCnt with number of samples */
 
  blkCnt = blockSize;
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A * scale */
 
    /* Scale the input and then store the result in the destination buffer. */
 
    *pDst++ = (q15_t) (__SSAT(((q31_t) * pSrc++ * scaleFract) >> kShift, 16));
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
#endif /* #ifndef ARM_MATH_CM0_FAMILY */
 
 
}
 
 
/**    
 
 * @} end of scale group    
 
 */
drivers/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_scale_q31.c
Show inline comments
 
new file 100644
 
/* ----------------------------------------------------------------------    
 
* Copyright (C) 2010-2014 ARM Limited. All rights reserved.    
 
*    
 
* $Date:        19. March 2015
 
* $Revision: 	V.1.4.5
 
*    
 
* Project: 	    CMSIS DSP Library    
 
* Title:		arm_scale_q31.c    
 
*    
 
* Description:	Multiplies a Q31 vector by a scalar.    
 
*    
 
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
 
*  
 
* Redistribution and use in source and binary forms, with or without 
 
* modification, are permitted provided that the following conditions
 
* are met:
 
*   - Redistributions of source code must retain the above copyright
 
*     notice, this list of conditions and the following disclaimer.
 
*   - Redistributions in binary form must reproduce the above copyright
 
*     notice, this list of conditions and the following disclaimer in
 
*     the documentation and/or other materials provided with the 
 
*     distribution.
 
*   - Neither the name of ARM LIMITED nor the names of its contributors
 
*     may be used to endorse or promote products derived from this
 
*     software without specific prior written permission.
 
*
 
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
 
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
* POSSIBILITY OF SUCH DAMAGE.   
 
* -------------------------------------------------------------------- */
 
 
#include "arm_math.h"
 
 
/**       
 
 * @ingroup groupMath       
 
 */
 
 
/**       
 
 * @addtogroup scale       
 
 * @{       
 
 */
 
 
/**       
 
 * @brief Multiplies a Q31 vector by a scalar.       
 
 * @param[in]       *pSrc points to the input vector       
 
 * @param[in]       scaleFract fractional portion of the scale value       
 
 * @param[in]       shift number of bits to shift the result by       
 
 * @param[out]      *pDst points to the output vector       
 
 * @param[in]       blockSize number of samples in the vector       
 
 * @return none.       
 
 *       
 
 * <b>Scaling and Overflow Behavior:</b>       
 
 * \par       
 
 * The input data <code>*pSrc</code> and <code>scaleFract</code> are in 1.31 format.       
 
 * These are multiplied to yield a 2.62 intermediate result and this is shifted with saturation to 1.31 format.       
 
 */
 
 
void arm_scale_q31(
 
  q31_t * pSrc,
 
  q31_t scaleFract,
 
  int8_t shift,
 
  q31_t * pDst,
 
  uint32_t blockSize)
 
{
 
  int8_t kShift = shift + 1;                     /* Shift to apply after scaling */
 
  int8_t sign = (kShift & 0x80);
 
  uint32_t blkCnt;                               /* loop counter */
 
  q31_t in, out;
 
 
#ifndef ARM_MATH_CM0_FAMILY
 
 
/* Run the below code for Cortex-M4 and Cortex-M3 */
 
 
  q31_t in1, in2, in3, in4;                      /* temporary input variables */
 
  q31_t out1, out2, out3, out4;                  /* temporary output variabels */
 
 
 
  /*loop Unrolling */
 
  blkCnt = blockSize >> 2u;
 
 
  if(sign == 0u)
 
  {
 
    /* First part of the processing with loop unrolling.  Compute 4 outputs at a time.       
 
     ** a second loop below computes the remaining 1 to 3 samples. */
 
    while(blkCnt > 0u)
 
    {
 
      /* read four inputs from source */
 
      in1 = *pSrc;
 
      in2 = *(pSrc + 1);
 
      in3 = *(pSrc + 2);
 
      in4 = *(pSrc + 3);
 
 
      /* multiply input with scaler value */
 
      in1 = ((q63_t) in1 * scaleFract) >> 32;
 
      in2 = ((q63_t) in2 * scaleFract) >> 32;
 
      in3 = ((q63_t) in3 * scaleFract) >> 32;
 
      in4 = ((q63_t) in4 * scaleFract) >> 32;
 
 
      /* apply shifting */
 
      out1 = in1 << kShift;
 
      out2 = in2 << kShift;
 
 
      /* saturate the results. */
 
      if(in1 != (out1 >> kShift))
 
        out1 = 0x7FFFFFFF ^ (in1 >> 31);
 
 
      if(in2 != (out2 >> kShift))
 
        out2 = 0x7FFFFFFF ^ (in2 >> 31);
 
 
      out3 = in3 << kShift;
 
      out4 = in4 << kShift;
 
 
      *pDst = out1;
 
      *(pDst + 1) = out2;
 
 
      if(in3 != (out3 >> kShift))
 
        out3 = 0x7FFFFFFF ^ (in3 >> 31);
 
 
      if(in4 != (out4 >> kShift))
 
        out4 = 0x7FFFFFFF ^ (in4 >> 31);
 
 
      /* Store result destination */
 
      *(pDst + 2) = out3;
 
      *(pDst + 3) = out4;
 
 
      /* Update pointers to process next sampels */
 
      pSrc += 4u;
 
      pDst += 4u;
 
 
      /* Decrement the loop counter */
 
      blkCnt--;
 
    }
 
 
  }
 
  else
 
  {
 
    /* First part of the processing with loop unrolling.  Compute 4 outputs at a time.       
 
     ** a second loop below computes the remaining 1 to 3 samples. */
 
    while(blkCnt > 0u)
 
    {
 
      /* read four inputs from source */
 
      in1 = *pSrc;
 
      in2 = *(pSrc + 1);
 
      in3 = *(pSrc + 2);
 
      in4 = *(pSrc + 3);
 
 
      /* multiply input with scaler value */
 
      in1 = ((q63_t) in1 * scaleFract) >> 32;
 
      in2 = ((q63_t) in2 * scaleFract) >> 32;
 
      in3 = ((q63_t) in3 * scaleFract) >> 32;
 
      in4 = ((q63_t) in4 * scaleFract) >> 32;
 
 
      /* apply shifting */
 
      out1 = in1 >> -kShift;
 
      out2 = in2 >> -kShift;
 
 
      out3 = in3 >> -kShift;
 
      out4 = in4 >> -kShift;
 
 
      /* Store result destination */
 
      *pDst = out1;
 
      *(pDst + 1) = out2;
 
 
      *(pDst + 2) = out3;
 
      *(pDst + 3) = out4;
 
 
      /* Update pointers to process next sampels */
 
      pSrc += 4u;
 
      pDst += 4u;
 
 
      /* Decrement the loop counter */
 
      blkCnt--;
 
    }
 
  }
 
  /* If the blockSize is not a multiple of 4, compute any remaining output samples here.       
 
   ** No loop unrolling is used. */
 
  blkCnt = blockSize % 0x4u;
 
 
#else
 
 
  /* Run the below code for Cortex-M0 */
 
 
  /* Initialize blkCnt with number of samples */
 
  blkCnt = blockSize;
 
 
#endif /* #ifndef ARM_MATH_CM0_FAMILY */
 
 
  if(sign == 0)
 
  {
 
	  while(blkCnt > 0u)
 
	  {
 
		/* C = A * scale */
 
		/* Scale the input and then store the result in the destination buffer. */
 
		in = *pSrc++;
 
		in = ((q63_t) in * scaleFract) >> 32;
 
 
		out = in << kShift;
 
		
 
		if(in != (out >> kShift))
 
			out = 0x7FFFFFFF ^ (in >> 31);
 
 
		*pDst++ = out;
 
 
		/* Decrement the loop counter */
 
		blkCnt--;
 
	  }
 
  }
 
  else
 
  {
 
	  while(blkCnt > 0u)
 
	  {
 
		/* C = A * scale */
 
		/* Scale the input and then store the result in the destination buffer. */
 
		in = *pSrc++;
 
		in = ((q63_t) in * scaleFract) >> 32;
 
 
		out = in >> -kShift;
 
 
		*pDst++ = out;
 
 
		/* Decrement the loop counter */
 
		blkCnt--;
 
	  }
 
  
 
  }
 
}
 
 
/**       
 
 * @} end of scale group       
 
 */
drivers/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_scale_q7.c
Show inline comments
 
new file 100644
 
/* ----------------------------------------------------------------------    
 
* Copyright (C) 2010-2014 ARM Limited. All rights reserved.    
 
*    
 
* $Date:        19. March 2015
 
* $Revision: 	V.1.4.5
 
*    
 
* Project: 	    CMSIS DSP Library    
 
* Title:		arm_scale_q7.c    
 
*    
 
* Description:	Multiplies a Q7 vector by a scalar.    
 
*    
 
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
 
*  
 
* Redistribution and use in source and binary forms, with or without 
 
* modification, are permitted provided that the following conditions
 
* are met:
 
*   - Redistributions of source code must retain the above copyright
 
*     notice, this list of conditions and the following disclaimer.
 
*   - Redistributions in binary form must reproduce the above copyright
 
*     notice, this list of conditions and the following disclaimer in
 
*     the documentation and/or other materials provided with the 
 
*     distribution.
 
*   - Neither the name of ARM LIMITED nor the names of its contributors
 
*     may be used to endorse or promote products derived from this
 
*     software without specific prior written permission.
 
*
 
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
 
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
* POSSIBILITY OF SUCH DAMAGE.  
 
* -------------------------------------------------------------------- */
 
 
#include "arm_math.h"
 
 
/**    
 
 * @ingroup groupMath    
 
 */
 
 
/**    
 
 * @addtogroup scale    
 
 * @{    
 
 */
 
 
/**    
 
 * @brief Multiplies a Q7 vector by a scalar.    
 
 * @param[in]       *pSrc points to the input vector    
 
 * @param[in]       scaleFract fractional portion of the scale value    
 
 * @param[in]       shift number of bits to shift the result by    
 
 * @param[out]      *pDst points to the output vector    
 
 * @param[in]       blockSize number of samples in the vector    
 
 * @return none.    
 
 *    
 
 * <b>Scaling and Overflow Behavior:</b>    
 
 * \par    
 
 * The input data <code>*pSrc</code> and <code>scaleFract</code> are in 1.7 format.    
 
 * These are multiplied to yield a 2.14 intermediate result and this is shifted with saturation to 1.7 format.    
 
 */
 
 
void arm_scale_q7(
 
  q7_t * pSrc,
 
  q7_t scaleFract,
 
  int8_t shift,
 
  q7_t * pDst,
 
  uint32_t blockSize)
 
{
 
  int8_t kShift = 7 - shift;                     /* shift to apply after scaling */
 
  uint32_t blkCnt;                               /* loop counter */
 
 
#ifndef ARM_MATH_CM0_FAMILY
 
 
/* Run the below code for Cortex-M4 and Cortex-M3 */
 
  q7_t in1, in2, in3, in4, out1, out2, out3, out4;      /* Temporary variables to store input & output */
 
 
 
  /*loop Unrolling */
 
  blkCnt = blockSize >> 2u;
 
 
 
  /* First part of the processing with loop unrolling.  Compute 4 outputs at a time.    
 
   ** a second loop below computes the remaining 1 to 3 samples. */
 
  while(blkCnt > 0u)
 
  {
 
    /* Reading 4 inputs from memory */
 
    in1 = *pSrc++;
 
    in2 = *pSrc++;
 
    in3 = *pSrc++;
 
    in4 = *pSrc++;
 
 
    /* C = A * scale */
 
    /* Scale the inputs and then store the results in the temporary variables. */
 
    out1 = (q7_t) (__SSAT(((in1) * scaleFract) >> kShift, 8));
 
    out2 = (q7_t) (__SSAT(((in2) * scaleFract) >> kShift, 8));
 
    out3 = (q7_t) (__SSAT(((in3) * scaleFract) >> kShift, 8));
 
    out4 = (q7_t) (__SSAT(((in4) * scaleFract) >> kShift, 8));
 
 
    /* Packing the individual outputs into 32bit and storing in    
 
     * destination buffer in single write */
 
    *__SIMD32(pDst)++ = __PACKq7(out1, out2, out3, out4);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
  /* If the blockSize is not a multiple of 4, compute any remaining output samples here.    
 
   ** No loop unrolling is used. */
 
  blkCnt = blockSize % 0x4u;
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A * scale */
 
    /* Scale the input and then store the result in the destination buffer. */
 
    *pDst++ = (q7_t) (__SSAT(((*pSrc++) * scaleFract) >> kShift, 8));
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
#else
 
 
  /* Run the below code for Cortex-M0 */
 
 
  /* Initialize blkCnt with number of samples */
 
  blkCnt = blockSize;
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A * scale */
 
    /* Scale the input and then store the result in the destination buffer. */
 
    *pDst++ = (q7_t) (__SSAT((((q15_t) * pSrc++ * scaleFract) >> kShift), 8));
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
#endif /* #ifndef ARM_MATH_CM0_FAMILY */
 
 
}
 
 
/**    
 
 * @} end of scale group    
 
 */
drivers/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_shift_q15.c
Show inline comments
 
new file 100644
 
/* ----------------------------------------------------------------------    
 
* Copyright (C) 2010-2014 ARM Limited. All rights reserved.    
 
*    
 
* $Date:        19. March 2015
 
* $Revision: 	V.1.4.5
 
*    
 
* Project: 	    CMSIS DSP Library    
 
* Title:		arm_shift_q15.c    
 
*    
 
* Description:	Shifts the elements of a Q15 vector by a specified number of bits.    
 
*    
 
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
 
*  
 
* Redistribution and use in source and binary forms, with or without 
 
* modification, are permitted provided that the following conditions
 
* are met:
 
*   - Redistributions of source code must retain the above copyright
 
*     notice, this list of conditions and the following disclaimer.
 
*   - Redistributions in binary form must reproduce the above copyright
 
*     notice, this list of conditions and the following disclaimer in
 
*     the documentation and/or other materials provided with the 
 
*     distribution.
 
*   - Neither the name of ARM LIMITED nor the names of its contributors
 
*     may be used to endorse or promote products derived from this
 
*     software without specific prior written permission.
 
*
 
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
 
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
* POSSIBILITY OF SUCH DAMAGE. 
 
* -------------------------------------------------------------------- */
 
 
#include "arm_math.h"
 
 
/**    
 
 * @ingroup groupMath    
 
 */
 
 
/**    
 
 * @addtogroup shift    
 
 * @{    
 
 */
 
 
/**    
 
 * @brief  Shifts the elements of a Q15 vector a specified number of bits.    
 
 * @param[in]  *pSrc points to the input vector    
 
 * @param[in]  shiftBits number of bits to shift.  A positive value shifts left; a negative value shifts right.    
 
 * @param[out]  *pDst points to the output vector    
 
 * @param[in]  blockSize number of samples in the vector    
 
 * @return none.    
 
 *    
 
 * <b>Scaling and Overflow Behavior:</b>    
 
 * \par    
 
 * The function uses saturating arithmetic.    
 
 * Results outside of the allowable Q15 range [0x8000 0x7FFF] will be saturated.    
 
 */
 
 
void arm_shift_q15(
 
  q15_t * pSrc,
 
  int8_t shiftBits,
 
  q15_t * pDst,
 
  uint32_t blockSize)
 
{
 
  uint32_t blkCnt;                               /* loop counter */
 
  uint8_t sign;                                  /* Sign of shiftBits */
 
 
#ifndef ARM_MATH_CM0_FAMILY
 
 
/* Run the below code for Cortex-M4 and Cortex-M3 */
 
 
  q15_t in1, in2;                                /* Temporary variables */
 
 
 
  /*loop Unrolling */
 
  blkCnt = blockSize >> 2u;
 
 
  /* Getting the sign of shiftBits */
 
  sign = (shiftBits & 0x80);
 
 
  /* If the shift value is positive then do right shift else left shift */
 
  if(sign == 0u)
 
  {
 
    /* First part of the processing with loop unrolling.  Compute 4 outputs at a time.    
 
     ** a second loop below computes the remaining 1 to 3 samples. */
 
    while(blkCnt > 0u)
 
    {
 
      /* Read 2 inputs */
 
      in1 = *pSrc++;
 
      in2 = *pSrc++;
 
      /* C = A << shiftBits */
 
      /* Shift the inputs and then store the results in the destination buffer. */
 
#ifndef  ARM_MATH_BIG_ENDIAN
 
 
      *__SIMD32(pDst)++ = __PKHBT(__SSAT((in1 << shiftBits), 16),
 
                                  __SSAT((in2 << shiftBits), 16), 16);
 
 
#else
 
 
      *__SIMD32(pDst)++ = __PKHBT(__SSAT((in2 << shiftBits), 16),
 
                                  __SSAT((in1 << shiftBits), 16), 16);
 
 
#endif /* #ifndef  ARM_MATH_BIG_ENDIAN    */
 
 
      in1 = *pSrc++;
 
      in2 = *pSrc++;
 
 
#ifndef  ARM_MATH_BIG_ENDIAN
 
 
      *__SIMD32(pDst)++ = __PKHBT(__SSAT((in1 << shiftBits), 16),
 
                                  __SSAT((in2 << shiftBits), 16), 16);
 
 
#else
 
 
      *__SIMD32(pDst)++ = __PKHBT(__SSAT((in2 << shiftBits), 16),
 
                                  __SSAT((in1 << shiftBits), 16), 16);
 
 
#endif /* #ifndef  ARM_MATH_BIG_ENDIAN    */
 
 
      /* Decrement the loop counter */
 
      blkCnt--;
 
    }
 
 
    /* If the blockSize is not a multiple of 4, compute any remaining output samples here.    
 
     ** No loop unrolling is used. */
 
    blkCnt = blockSize % 0x4u;
 
 
    while(blkCnt > 0u)
 
    {
 
      /* C = A << shiftBits */
 
      /* Shift and then store the results in the destination buffer. */
 
      *pDst++ = __SSAT((*pSrc++ << shiftBits), 16);
 
 
      /* Decrement the loop counter */
 
      blkCnt--;
 
    }
 
  }
 
  else
 
  {
 
    /* First part of the processing with loop unrolling.  Compute 4 outputs at a time.    
 
     ** a second loop below computes the remaining 1 to 3 samples. */
 
    while(blkCnt > 0u)
 
    {
 
      /* Read 2 inputs */
 
      in1 = *pSrc++;
 
      in2 = *pSrc++;
 
 
      /* C = A >> shiftBits */
 
      /* Shift the inputs and then store the results in the destination buffer. */
 
#ifndef  ARM_MATH_BIG_ENDIAN
 
 
      *__SIMD32(pDst)++ = __PKHBT((in1 >> -shiftBits),
 
                                  (in2 >> -shiftBits), 16);
 
 
#else
 
 
      *__SIMD32(pDst)++ = __PKHBT((in2 >> -shiftBits),
 
                                  (in1 >> -shiftBits), 16);
 
 
#endif /* #ifndef  ARM_MATH_BIG_ENDIAN    */
 
 
      in1 = *pSrc++;
 
      in2 = *pSrc++;
 
 
#ifndef  ARM_MATH_BIG_ENDIAN
 
 
      *__SIMD32(pDst)++ = __PKHBT((in1 >> -shiftBits),
 
                                  (in2 >> -shiftBits), 16);
 
 
#else
 
 
      *__SIMD32(pDst)++ = __PKHBT((in2 >> -shiftBits),
 
                                  (in1 >> -shiftBits), 16);
 
 
#endif /* #ifndef  ARM_MATH_BIG_ENDIAN    */
 
 
      /* Decrement the loop counter */
 
      blkCnt--;
 
    }
 
 
    /* If the blockSize is not a multiple of 4, compute any remaining output samples here.    
 
     ** No loop unrolling is used. */
 
    blkCnt = blockSize % 0x4u;
 
 
    while(blkCnt > 0u)
 
    {
 
      /* C = A >> shiftBits */
 
      /* Shift the inputs and then store the results in the destination buffer. */
 
      *pDst++ = (*pSrc++ >> -shiftBits);
 
 
      /* Decrement the loop counter */
 
      blkCnt--;
 
    }
 
  }
 
 
#else
 
 
  /* Run the below code for Cortex-M0 */
 
 
  /* Getting the sign of shiftBits */
 
  sign = (shiftBits & 0x80);
 
 
  /* If the shift value is positive then do right shift else left shift */
 
  if(sign == 0u)
 
  {
 
    /* Initialize blkCnt with number of samples */
 
    blkCnt = blockSize;
 
 
    while(blkCnt > 0u)
 
    {
 
      /* C = A << shiftBits */
 
      /* Shift and then store the results in the destination buffer. */
 
      *pDst++ = __SSAT(((q31_t) * pSrc++ << shiftBits), 16);
 
 
      /* Decrement the loop counter */
 
      blkCnt--;
 
    }
 
  }
 
  else
 
  {
 
    /* Initialize blkCnt with number of samples */
 
    blkCnt = blockSize;
 
 
    while(blkCnt > 0u)
 
    {
 
      /* C = A >> shiftBits */
 
      /* Shift the inputs and then store the results in the destination buffer. */
 
      *pDst++ = (*pSrc++ >> -shiftBits);
 
 
      /* Decrement the loop counter */
 
      blkCnt--;
 
    }
 
  }
 
 
#endif /* #ifndef ARM_MATH_CM0_FAMILY */
 
 
}
 
 
/**    
 
 * @} end of shift group    
 
 */
drivers/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_shift_q31.c
Show inline comments
 
new file 100644
 
/* ----------------------------------------------------------------------    
 
* Copyright (C) 2010-2014 ARM Limited. All rights reserved.    
 
*    
 
* $Date:        19. March 2015
 
* $Revision: 	V.1.4.5
 
*    
 
* Project: 	    CMSIS DSP Library    
 
* Title:		arm_shift_q31.c    
 
*    
 
* Description:	Shifts the elements of a Q31 vector by a specified number of bits.    
 
*    
 
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
 
*  
 
* Redistribution and use in source and binary forms, with or without 
 
* modification, are permitted provided that the following conditions
 
* are met:
 
*   - Redistributions of source code must retain the above copyright
 
*     notice, this list of conditions and the following disclaimer.
 
*   - Redistributions in binary form must reproduce the above copyright
 
*     notice, this list of conditions and the following disclaimer in
 
*     the documentation and/or other materials provided with the 
 
*     distribution.
 
*   - Neither the name of ARM LIMITED nor the names of its contributors
 
*     may be used to endorse or promote products derived from this
 
*     software without specific prior written permission.
 
*
 
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
 
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
* POSSIBILITY OF SUCH DAMAGE. 
 
* -------------------------------------------------------------------- */
 
 
#include "arm_math.h"
 
 
/**        
 
 * @ingroup groupMath        
 
 */
 
/**        
 
 * @defgroup shift Vector Shift        
 
 *        
 
 * Shifts the elements of a fixed-point vector by a specified number of bits.        
 
 * There are separate functions for Q7, Q15, and Q31 data types.        
 
 * The underlying algorithm used is:        
 
 *        
 
 * <pre>        
 
 *     pDst[n] = pSrc[n] << shift,   0 <= n < blockSize.        
 
 * </pre>        
 
 *        
 
 * If <code>shift</code> is positive then the elements of the vector are shifted to the left.        
 
 * If <code>shift</code> is negative then the elements of the vector are shifted to the right.        
 
 *
 
 * The functions support in-place computation allowing the source and destination
 
 * pointers to reference the same memory buffer.
 
 */
 
 
/**        
 
 * @addtogroup shift        
 
 * @{        
 
 */
 
 
/**        
 
 * @brief  Shifts the elements of a Q31 vector a specified number of bits.        
 
 * @param[in]  *pSrc points to the input vector        
 
 * @param[in]  shiftBits number of bits to shift.  A positive value shifts left; a negative value shifts right.        
 
 * @param[out]  *pDst points to the output vector        
 
 * @param[in]  blockSize number of samples in the vector        
 
 * @return none.        
 
 *        
 
 *        
 
 * <b>Scaling and Overflow Behavior:</b>        
 
 * \par        
 
 * The function uses saturating arithmetic.        
 
 * Results outside of the allowable Q31 range [0x80000000 0x7FFFFFFF] will be saturated.        
 
 */
 
 
void arm_shift_q31(
 
  q31_t * pSrc,
 
  int8_t shiftBits,
 
  q31_t * pDst,
 
  uint32_t blockSize)
 
{
 
  uint32_t blkCnt;                               /* loop counter */
 
  uint8_t sign = (shiftBits & 0x80);             /* Sign of shiftBits */
 
 
#ifndef ARM_MATH_CM0_FAMILY
 
 
  q31_t in1, in2, in3, in4;                      /* Temporary input variables */
 
  q31_t out1, out2, out3, out4;                  /* Temporary output variables */
 
 
  /*loop Unrolling */
 
  blkCnt = blockSize >> 2u;
 
 
 
  if(sign == 0u)
 
  {
 
    /* First part of the processing with loop unrolling.  Compute 4 outputs at a time.    
 
     ** a second loop below computes the remaining 1 to 3 samples. */
 
    while(blkCnt > 0u)
 
    {
 
      /* C = A  << shiftBits */
 
      /* Shift the input and then store the results in the destination buffer. */
 
      in1 = *pSrc;
 
      in2 = *(pSrc + 1);
 
      out1 = in1 << shiftBits;
 
      in3 = *(pSrc + 2);
 
      out2 = in2 << shiftBits;
 
      in4 = *(pSrc + 3);
 
      if(in1 != (out1 >> shiftBits))
 
        out1 = 0x7FFFFFFF ^ (in1 >> 31);
 
 
      if(in2 != (out2 >> shiftBits))
 
        out2 = 0x7FFFFFFF ^ (in2 >> 31);
 
 
      *pDst = out1;
 
      out3 = in3 << shiftBits;
 
      *(pDst + 1) = out2;
 
      out4 = in4 << shiftBits;
 
 
      if(in3 != (out3 >> shiftBits))
 
        out3 = 0x7FFFFFFF ^ (in3 >> 31);
 
 
      if(in4 != (out4 >> shiftBits))
 
        out4 = 0x7FFFFFFF ^ (in4 >> 31);
 
 
      *(pDst + 2) = out3;
 
      *(pDst + 3) = out4;
 
 
      /* Update destination pointer to process next sampels */
 
      pSrc += 4u;
 
      pDst += 4u;
 
 
      /* Decrement the loop counter */
 
      blkCnt--;
 
    }
 
  }
 
  else
 
  {
 
 
    /* First part of the processing with loop unrolling.  Compute 4 outputs at a time.    
 
     ** a second loop below computes the remaining 1 to 3 samples. */
 
    while(blkCnt > 0u)
 
    {
 
      /* C = A >>  shiftBits */
 
      /* Shift the input and then store the results in the destination buffer. */
 
      in1 = *pSrc;
 
      in2 = *(pSrc + 1);
 
      in3 = *(pSrc + 2);
 
      in4 = *(pSrc + 3);
 
 
      *pDst = (in1 >> -shiftBits);
 
      *(pDst + 1) = (in2 >> -shiftBits);
 
      *(pDst + 2) = (in3 >> -shiftBits);
 
      *(pDst + 3) = (in4 >> -shiftBits);
 
 
 
      pSrc += 4u;
 
      pDst += 4u;
 
 
      blkCnt--;
 
    }
 
 
  }
 
 
  /* If the blockSize is not a multiple of 4, compute any remaining output samples here.    
 
   ** No loop unrolling is used. */
 
  blkCnt = blockSize % 0x4u;
 
 
#else
 
 
  /* Run the below code for Cortex-M0 */
 
 
 
  /* Initialize blkCnt with number of samples */
 
  blkCnt = blockSize;
 
 
#endif /* #ifndef ARM_MATH_CM0_FAMILY */
 
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A (>> or <<) shiftBits */
 
    /* Shift the input and then store the result in the destination buffer. */
 
    *pDst++ = (sign == 0u) ? clip_q63_to_q31((q63_t) * pSrc++ << shiftBits) :
 
      (*pSrc++ >> -shiftBits);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
 
}
 
 
/**        
 
 * @} end of shift group        
 
 */
drivers/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_shift_q7.c
Show inline comments
 
new file 100644
 
/* ----------------------------------------------------------------------    
 
* Copyright (C) 2010-2014 ARM Limited. All rights reserved.    
 
*    
 
* $Date:        19. March 2015
 
* $Revision: 	V.1.4.5
 
*    
 
* Project: 	    CMSIS DSP Library    
 
* Title:		arm_shift_q7.c    
 
*    
 
* Description:	Processing function for the Q7 Shifting    
 
*    
 
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
 
*  
 
* Redistribution and use in source and binary forms, with or without 
 
* modification, are permitted provided that the following conditions
 
* are met:
 
*   - Redistributions of source code must retain the above copyright
 
*     notice, this list of conditions and the following disclaimer.
 
*   - Redistributions in binary form must reproduce the above copyright
 
*     notice, this list of conditions and the following disclaimer in
 
*     the documentation and/or other materials provided with the 
 
*     distribution.
 
*   - Neither the name of ARM LIMITED nor the names of its contributors
 
*     may be used to endorse or promote products derived from this
 
*     software without specific prior written permission.
 
*
 
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
 
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
* POSSIBILITY OF SUCH DAMAGE.   
 
* -------------------------------------------------------------------- */
 
 
#include "arm_math.h"
 
 
/**        
 
 * @ingroup groupMath        
 
 */
 
 
/**        
 
 * @addtogroup shift        
 
 * @{        
 
 */
 
 
 
/**        
 
 * @brief  Shifts the elements of a Q7 vector a specified number of bits.        
 
 * @param[in]  *pSrc points to the input vector        
 
 * @param[in]  shiftBits number of bits to shift.  A positive value shifts left; a negative value shifts right.        
 
 * @param[out]  *pDst points to the output vector        
 
 * @param[in]  blockSize number of samples in the vector        
 
 * @return none.        
 
 *    
 
 * \par Conditions for optimum performance    
 
 *  Input and output buffers should be aligned by 32-bit    
 
 *    
 
 *        
 
 * <b>Scaling and Overflow Behavior:</b>        
 
 * \par        
 
 * The function uses saturating arithmetic.        
 
 * Results outside of the allowable Q7 range [0x8 0x7F] will be saturated.        
 
 */
 
 
void arm_shift_q7(
 
  q7_t * pSrc,
 
  int8_t shiftBits,
 
  q7_t * pDst,
 
  uint32_t blockSize)
 
{
 
  uint32_t blkCnt;                               /* loop counter */
 
  uint8_t sign;                                  /* Sign of shiftBits */
 
 
#ifndef ARM_MATH_CM0_FAMILY
 
 
/* Run the below code for Cortex-M4 and Cortex-M3 */
 
  q7_t in1;                                      /* Input value1 */
 
  q7_t in2;                                      /* Input value2 */
 
  q7_t in3;                                      /* Input value3 */
 
  q7_t in4;                                      /* Input value4 */
 
 
 
  /*loop Unrolling */
 
  blkCnt = blockSize >> 2u;
 
 
  /* Getting the sign of shiftBits */
 
  sign = (shiftBits & 0x80);
 
 
  /* If the shift value is positive then do right shift else left shift */
 
  if(sign == 0u)
 
  {
 
    /* First part of the processing with loop unrolling.  Compute 4 outputs at a time.    
 
     ** a second loop below computes the remaining 1 to 3 samples. */
 
    while(blkCnt > 0u)
 
    {
 
      /* C = A << shiftBits */
 
      /* Read 4 inputs */
 
      in1 = *pSrc;
 
      in2 = *(pSrc + 1);
 
      in3 = *(pSrc + 2);
 
      in4 = *(pSrc + 3);
 
 
      /* Store the Shifted result in the destination buffer in single cycle by packing the outputs */
 
      *__SIMD32(pDst)++ = __PACKq7(__SSAT((in1 << shiftBits), 8),
 
                                   __SSAT((in2 << shiftBits), 8),
 
                                   __SSAT((in3 << shiftBits), 8),
 
                                   __SSAT((in4 << shiftBits), 8));
 
      /* Update source pointer to process next sampels */
 
      pSrc += 4u;
 
 
      /* Decrement the loop counter */
 
      blkCnt--;
 
    }
 
 
    /* If the blockSize is not a multiple of 4, compute any remaining output samples here.        
 
     ** No loop unrolling is used. */
 
    blkCnt = blockSize % 0x4u;
 
 
    while(blkCnt > 0u)
 
    {
 
      /* C = A << shiftBits */
 
      /* Shift the input and then store the result in the destination buffer. */
 
      *pDst++ = (q7_t) __SSAT((*pSrc++ << shiftBits), 8);
 
 
      /* Decrement the loop counter */
 
      blkCnt--;
 
    }
 
  }
 
  else
 
  {
 
    shiftBits = -shiftBits;
 
    /* First part of the processing with loop unrolling.  Compute 4 outputs at a time.    
 
     ** a second loop below computes the remaining 1 to 3 samples. */
 
    while(blkCnt > 0u)
 
    {
 
      /* C = A >> shiftBits */
 
      /* Read 4 inputs */
 
      in1 = *pSrc;
 
      in2 = *(pSrc + 1);
 
      in3 = *(pSrc + 2);
 
      in4 = *(pSrc + 3);
 
 
      /* Store the Shifted result in the destination buffer in single cycle by packing the outputs */
 
      *__SIMD32(pDst)++ = __PACKq7((in1 >> shiftBits), (in2 >> shiftBits),
 
                                   (in3 >> shiftBits), (in4 >> shiftBits));
 
 
 
      pSrc += 4u;
 
 
      /* Decrement the loop counter */
 
      blkCnt--;
 
    }
 
 
    /* If the blockSize is not a multiple of 4, compute any remaining output samples here.    
 
     ** No loop unrolling is used. */
 
    blkCnt = blockSize % 0x4u;
 
 
    while(blkCnt > 0u)
 
    {
 
      /* C = A >> shiftBits */
 
      /* Shift the input and then store the result in the destination buffer. */
 
      in1 = *pSrc++;
 
      *pDst++ = (in1 >> shiftBits);
 
 
      /* Decrement the loop counter */
 
      blkCnt--;
 
    }
 
  }
 
 
#else
 
 
  /* Run the below code for Cortex-M0 */
 
 
  /* Getting the sign of shiftBits */
 
  sign = (shiftBits & 0x80);
 
 
  /* If the shift value is positive then do right shift else left shift */
 
  if(sign == 0u)
 
  {
 
    /* Initialize blkCnt with number of samples */
 
    blkCnt = blockSize;
 
 
    while(blkCnt > 0u)
 
    {
 
      /* C = A << shiftBits */
 
      /* Shift the input and then store the result in the destination buffer. */
 
      *pDst++ = (q7_t) __SSAT(((q15_t) * pSrc++ << shiftBits), 8);
 
 
      /* Decrement the loop counter */
 
      blkCnt--;
 
    }
 
  }
 
  else
 
  {
 
    /* Initialize blkCnt with number of samples */
 
    blkCnt = blockSize;
 
 
    while(blkCnt > 0u)
 
    {
 
      /* C = A >> shiftBits */
 
      /* Shift the input and then store the result in the destination buffer. */
 
      *pDst++ = (*pSrc++ >> -shiftBits);
 
 
      /* Decrement the loop counter */
 
      blkCnt--;
 
    }
 
  }
 
 
#endif /* #ifndef ARM_MATH_CM0_FAMILY */
 
}
 
 
/**        
 
 * @} end of shift group        
 
 */
drivers/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_sub_f32.c
Show inline comments
 
new file 100644
 
/* ----------------------------------------------------------------------    
 
* Copyright (C) 2010-2014 ARM Limited. All rights reserved.    
 
*    
 
* $Date:        19. March 2015
 
* $Revision: 	V.1.4.5
 
*    
 
* Project: 	    CMSIS DSP Library    
 
* Title:		arm_sub_f32.c    
 
*    
 
* Description:	Floating-point vector subtraction.    
 
*    
 
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
 
*  
 
* Redistribution and use in source and binary forms, with or without 
 
* modification, are permitted provided that the following conditions
 
* are met:
 
*   - Redistributions of source code must retain the above copyright
 
*     notice, this list of conditions and the following disclaimer.
 
*   - Redistributions in binary form must reproduce the above copyright
 
*     notice, this list of conditions and the following disclaimer in
 
*     the documentation and/or other materials provided with the 
 
*     distribution.
 
*   - Neither the name of ARM LIMITED nor the names of its contributors
 
*     may be used to endorse or promote products derived from this
 
*     software without specific prior written permission.
 
*
 
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
 
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
* POSSIBILITY OF SUCH DAMAGE.  
 
* ---------------------------------------------------------------------------- */
 
 
#include "arm_math.h"
 
 
/**        
 
 * @ingroup groupMath        
 
 */
 
 
/**        
 
 * @defgroup BasicSub Vector Subtraction        
 
 *        
 
 * Element-by-element subtraction of two vectors.        
 
 *        
 
 * <pre>        
 
 *     pDst[n] = pSrcA[n] - pSrcB[n],   0 <= n < blockSize.        
 
 * </pre>        
 
 *        
 
 * There are separate functions for floating-point, Q7, Q15, and Q31 data types.        
 
 */
 
 
/**        
 
 * @addtogroup BasicSub        
 
 * @{        
 
 */
 
 
 
/**        
 
 * @brief Floating-point vector subtraction.        
 
 * @param[in]       *pSrcA points to the first input vector        
 
 * @param[in]       *pSrcB points to the second input vector        
 
 * @param[out]      *pDst points to the output vector        
 
 * @param[in]       blockSize number of samples in each vector        
 
 * @return none.        
 
 */
 
 
void arm_sub_f32(
 
  float32_t * pSrcA,
 
  float32_t * pSrcB,
 
  float32_t * pDst,
 
  uint32_t blockSize)
 
{
 
  uint32_t blkCnt;                               /* loop counter */
 
 
#ifndef ARM_MATH_CM0_FAMILY
 
 
/* Run the below code for Cortex-M4 and Cortex-M3 */
 
  float32_t inA1, inA2, inA3, inA4;              /* temporary variables */
 
  float32_t inB1, inB2, inB3, inB4;              /* temporary variables */
 
 
  /*loop Unrolling */
 
  blkCnt = blockSize >> 2u;
 
 
  /* First part of the processing with loop unrolling.  Compute 4 outputs at a time.        
 
   ** a second loop below computes the remaining 1 to 3 samples. */
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A - B */
 
    /* Subtract and then store the results in the destination buffer. */
 
    /* Read 4 input samples from sourceA and sourceB */
 
    inA1 = *pSrcA;
 
    inB1 = *pSrcB;
 
    inA2 = *(pSrcA + 1);
 
    inB2 = *(pSrcB + 1);
 
    inA3 = *(pSrcA + 2);
 
    inB3 = *(pSrcB + 2);
 
    inA4 = *(pSrcA + 3);
 
    inB4 = *(pSrcB + 3);
 
 
    /* dst = srcA - srcB */
 
    /* subtract and store the result */
 
    *pDst = inA1 - inB1;
 
    *(pDst + 1) = inA2 - inB2;
 
    *(pDst + 2) = inA3 - inB3;
 
    *(pDst + 3) = inA4 - inB4;
 
 
 
    /* Update pointers to process next sampels */
 
    pSrcA += 4u;
 
    pSrcB += 4u;
 
    pDst += 4u;
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
  /* If the blockSize is not a multiple of 4, compute any remaining output samples here.        
 
   ** No loop unrolling is used. */
 
  blkCnt = blockSize % 0x4u;
 
 
#else
 
 
  /* Run the below code for Cortex-M0 */
 
 
  /* Initialize blkCnt with number of samples */
 
  blkCnt = blockSize;
 
 
#endif /* #ifndef ARM_MATH_CM0_FAMILY */
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A - B */
 
    /* Subtract and then store the results in the destination buffer. */
 
    *pDst++ = (*pSrcA++) - (*pSrcB++);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
}
 
 
/**        
 
 * @} end of BasicSub group        
 
 */
drivers/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_sub_q15.c
Show inline comments
 
new file 100644
 
/* ----------------------------------------------------------------------    
 
* Copyright (C) 2010-2014 ARM Limited. All rights reserved.    
 
*    
 
* $Date:        19. March 2015
 
* $Revision: 	V.1.4.5
 
*    
 
* Project: 	    CMSIS DSP Library    
 
* Title:		arm_sub_q15.c    
 
*    
 
* Description:	Q15 vector subtraction.    
 
*    
 
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
 
*  
 
* Redistribution and use in source and binary forms, with or without 
 
* modification, are permitted provided that the following conditions
 
* are met:
 
*   - Redistributions of source code must retain the above copyright
 
*     notice, this list of conditions and the following disclaimer.
 
*   - Redistributions in binary form must reproduce the above copyright
 
*     notice, this list of conditions and the following disclaimer in
 
*     the documentation and/or other materials provided with the 
 
*     distribution.
 
*   - Neither the name of ARM LIMITED nor the names of its contributors
 
*     may be used to endorse or promote products derived from this
 
*     software without specific prior written permission.
 
*
 
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
 
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
* POSSIBILITY OF SUCH DAMAGE.  
 
* -------------------------------------------------------------------- */
 
 
#include "arm_math.h"
 
 
/**    
 
 * @ingroup groupMath    
 
 */
 
 
/**    
 
 * @addtogroup BasicSub    
 
 * @{    
 
 */
 
 
/**    
 
 * @brief Q15 vector subtraction.    
 
 * @param[in]       *pSrcA points to the first input vector    
 
 * @param[in]       *pSrcB points to the second input vector    
 
 * @param[out]      *pDst points to the output vector    
 
 * @param[in]       blockSize number of samples in each vector    
 
 * @return none.    
 
 *    
 
 * <b>Scaling and Overflow Behavior:</b>    
 
 * \par    
 
 * The function uses saturating arithmetic.    
 
 * Results outside of the allowable Q15 range [0x8000 0x7FFF] will be saturated.    
 
 */
 
 
void arm_sub_q15(
 
  q15_t * pSrcA,
 
  q15_t * pSrcB,
 
  q15_t * pDst,
 
  uint32_t blockSize)
 
{
 
  uint32_t blkCnt;                               /* loop counter */
 
 
 
#ifndef ARM_MATH_CM0_FAMILY
 
 
/* Run the below code for Cortex-M4 and Cortex-M3 */
 
  q31_t inA1, inA2;
 
  q31_t inB1, inB2;
 
 
  /*loop Unrolling */
 
  blkCnt = blockSize >> 2u;
 
 
  /* First part of the processing with loop unrolling.  Compute 4 outputs at a time.    
 
   ** a second loop below computes the remaining 1 to 3 samples. */
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A - B */
 
    /* Subtract and then store the results in the destination buffer two samples at a time. */
 
    inA1 = *__SIMD32(pSrcA)++;
 
    inA2 = *__SIMD32(pSrcA)++;
 
    inB1 = *__SIMD32(pSrcB)++;
 
    inB2 = *__SIMD32(pSrcB)++;
 
 
    *__SIMD32(pDst)++ = __QSUB16(inA1, inB1);
 
    *__SIMD32(pDst)++ = __QSUB16(inA2, inB2);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
  /* If the blockSize is not a multiple of 4, compute any remaining output samples here.    
 
   ** No loop unrolling is used. */
 
  blkCnt = blockSize % 0x4u;
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A - B */
 
    /* Subtract and then store the result in the destination buffer. */
 
    *pDst++ = (q15_t) __QSUB16(*pSrcA++, *pSrcB++);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
#else
 
 
  /* Run the below code for Cortex-M0 */
 
 
  /* Initialize blkCnt with number of samples */
 
  blkCnt = blockSize;
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A - B */
 
    /* Subtract and then store the result in the destination buffer. */
 
    *pDst++ = (q15_t) __SSAT(((q31_t) * pSrcA++ - *pSrcB++), 16);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
#endif /* #ifndef ARM_MATH_CM0_FAMILY */
 
 
 
}
 
 
/**    
 
 * @} end of BasicSub group    
 
 */
drivers/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_sub_q31.c
Show inline comments
 
new file 100644
 
/* ----------------------------------------------------------------------    
 
* Copyright (C) 2010-2014 ARM Limited. All rights reserved.    
 
*    
 
* $Date:        19. March 2015
 
* $Revision: 	V.1.4.5
 
*    
 
* Project: 	    CMSIS DSP Library    
 
* Title:		arm_sub_q31.c    
 
*    
 
* Description:	Q31 vector subtraction.    
 
*    
 
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
 
*  
 
* Redistribution and use in source and binary forms, with or without 
 
* modification, are permitted provided that the following conditions
 
* are met:
 
*   - Redistributions of source code must retain the above copyright
 
*     notice, this list of conditions and the following disclaimer.
 
*   - Redistributions in binary form must reproduce the above copyright
 
*     notice, this list of conditions and the following disclaimer in
 
*     the documentation and/or other materials provided with the 
 
*     distribution.
 
*   - Neither the name of ARM LIMITED nor the names of its contributors
 
*     may be used to endorse or promote products derived from this
 
*     software without specific prior written permission.
 
*
 
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
 
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
* POSSIBILITY OF SUCH DAMAGE.
 
* -------------------------------------------------------------------- */
 
 
#include "arm_math.h"
 
 
/**    
 
 * @ingroup groupMath    
 
 */
 
 
/**    
 
 * @addtogroup BasicSub    
 
 * @{    
 
 */
 
 
/**    
 
 * @brief Q31 vector subtraction.    
 
 * @param[in]       *pSrcA points to the first input vector    
 
 * @param[in]       *pSrcB points to the second input vector    
 
 * @param[out]      *pDst points to the output vector    
 
 * @param[in]       blockSize number of samples in each vector    
 
 * @return none.    
 
 *    
 
 * <b>Scaling and Overflow Behavior:</b>    
 
 * \par    
 
 * The function uses saturating arithmetic.    
 
 * Results outside of the allowable Q31 range [0x80000000 0x7FFFFFFF] will be saturated.    
 
 */
 
 
void arm_sub_q31(
 
  q31_t * pSrcA,
 
  q31_t * pSrcB,
 
  q31_t * pDst,
 
  uint32_t blockSize)
 
{
 
  uint32_t blkCnt;                               /* loop counter */
 
 
 
#ifndef ARM_MATH_CM0_FAMILY
 
 
/* Run the below code for Cortex-M4 and Cortex-M3 */
 
  q31_t inA1, inA2, inA3, inA4;
 
  q31_t inB1, inB2, inB3, inB4;
 
 
  /*loop Unrolling */
 
  blkCnt = blockSize >> 2u;
 
 
  /* First part of the processing with loop unrolling.  Compute 4 outputs at a time.    
 
   ** a second loop below computes the remaining 1 to 3 samples. */
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A - B */
 
    /* Subtract and then store the results in the destination buffer. */
 
    inA1 = *pSrcA++;
 
    inA2 = *pSrcA++;
 
    inB1 = *pSrcB++;
 
    inB2 = *pSrcB++;
 
 
    inA3 = *pSrcA++;
 
    inA4 = *pSrcA++;
 
    inB3 = *pSrcB++;
 
    inB4 = *pSrcB++;
 
 
    *pDst++ = __QSUB(inA1, inB1);
 
    *pDst++ = __QSUB(inA2, inB2);
 
    *pDst++ = __QSUB(inA3, inB3);
 
    *pDst++ = __QSUB(inA4, inB4);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
  /* If the blockSize is not a multiple of 4, compute any remaining output samples here.    
 
   ** No loop unrolling is used. */
 
  blkCnt = blockSize % 0x4u;
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A - B */
 
    /* Subtract and then store the result in the destination buffer. */
 
    *pDst++ = __QSUB(*pSrcA++, *pSrcB++);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
#else
 
 
  /* Run the below code for Cortex-M0 */
 
 
  /* Initialize blkCnt with number of samples */
 
  blkCnt = blockSize;
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A - B */
 
    /* Subtract and then store the result in the destination buffer. */
 
    *pDst++ = (q31_t) clip_q63_to_q31((q63_t) * pSrcA++ - *pSrcB++);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
#endif /* #ifndef ARM_MATH_CM0_FAMILY */
 
 
}
 
 
/**    
 
 * @} end of BasicSub group    
 
 */
drivers/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_sub_q7.c
Show inline comments
 
new file 100644
 
/* ----------------------------------------------------------------------    
 
* Copyright (C) 2010-2014 ARM Limited. All rights reserved.    
 
*    
 
* $Date:        19. March 2015
 
* $Revision: 	V.1.4.5
 
*    
 
* Project: 	    CMSIS DSP Library    
 
* Title:		arm_sub_q7.c    
 
*    
 
* Description:	Q7 vector subtraction.    
 
*    
 
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
 
*  
 
* Redistribution and use in source and binary forms, with or without 
 
* modification, are permitted provided that the following conditions
 
* are met:
 
*   - Redistributions of source code must retain the above copyright
 
*     notice, this list of conditions and the following disclaimer.
 
*   - Redistributions in binary form must reproduce the above copyright
 
*     notice, this list of conditions and the following disclaimer in
 
*     the documentation and/or other materials provided with the 
 
*     distribution.
 
*   - Neither the name of ARM LIMITED nor the names of its contributors
 
*     may be used to endorse or promote products derived from this
 
*     software without specific prior written permission.
 
*
 
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
 
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
* POSSIBILITY OF SUCH DAMAGE.    
 
* -------------------------------------------------------------------- */
 
 
#include "arm_math.h"
 
 
/**    
 
 * @ingroup groupMath    
 
 */
 
 
/**    
 
 * @addtogroup BasicSub    
 
 * @{    
 
 */
 
 
/**    
 
 * @brief Q7 vector subtraction.    
 
 * @param[in]       *pSrcA points to the first input vector    
 
 * @param[in]       *pSrcB points to the second input vector    
 
 * @param[out]      *pDst points to the output vector    
 
 * @param[in]       blockSize number of samples in each vector    
 
 * @return none.    
 
 *    
 
 * <b>Scaling and Overflow Behavior:</b>    
 
 * \par    
 
 * The function uses saturating arithmetic.    
 
 * Results outside of the allowable Q7 range [0x80 0x7F] will be saturated.    
 
 */
 
 
void arm_sub_q7(
 
  q7_t * pSrcA,
 
  q7_t * pSrcB,
 
  q7_t * pDst,
 
  uint32_t blockSize)
 
{
 
  uint32_t blkCnt;                               /* loop counter */
 
 
#ifndef ARM_MATH_CM0_FAMILY
 
 
/* Run the below code for Cortex-M4 and Cortex-M3 */
 
 
  /*loop Unrolling */
 
  blkCnt = blockSize >> 2u;
 
 
  /* First part of the processing with loop unrolling.  Compute 4 outputs at a time.    
 
   ** a second loop below computes the remaining 1 to 3 samples. */
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A - B */
 
    /* Subtract and then store the results in the destination buffer 4 samples at a time. */
 
    *__SIMD32(pDst)++ = __QSUB8(*__SIMD32(pSrcA)++, *__SIMD32(pSrcB)++);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
  /* If the blockSize is not a multiple of 4, compute any remaining output samples here.    
 
   ** No loop unrolling is used. */
 
  blkCnt = blockSize % 0x4u;
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A - B */
 
    /* Subtract and then store the result in the destination buffer. */
 
    *pDst++ = __SSAT(*pSrcA++ - *pSrcB++, 8);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
#else
 
 
  /* Run the below code for Cortex-M0 */
 
 
  /* Initialize blkCnt with number of samples */
 
  blkCnt = blockSize;
 
 
  while(blkCnt > 0u)
 
  {
 
    /* C = A - B */
 
    /* Subtract and then store the result in the destination buffer. */
 
    *pDst++ = (q7_t) __SSAT((q15_t) * pSrcA++ - *pSrcB++, 8);
 
 
    /* Decrement the loop counter */
 
    blkCnt--;
 
  }
 
 
#endif /* #ifndef ARM_MATH_CM0_FAMILY */
 
 
 
}
 
 
/**    
 
 * @} end of BasicSub group    
 
 */

Changeset was too big and was cut off... Show full diff anyway

0 comments (0 inline, 0 general)