diff options
author | Jonas Gunz <himself@jonasgunz.de> | 2017-05-01 12:02:08 +0200 |
---|---|---|
committer | Jonas Gunz <himself@jonasgunz.de> | 2017-05-01 12:02:08 +0200 |
commit | 677c370834102ae43ce19d0931cc98d8267dacc5 (patch) | |
tree | 80f5ee66e9c7d36a886c8a87afca073765083800 | |
download | avrFloppy-677c370834102ae43ce19d0931cc98d8267dacc5.tar.gz |
init
-rw-r--r-- | .gitignore | 29 | ||||
-rw-r--r-- | .tfignore | 1 | ||||
-rw-r--r-- | .vs/floppyMusic/v14/.atsuo | bin | 0 -> 34304 bytes | |||
-rw-r--r-- | floppyMusic.atsln | 22 | ||||
-rw-r--r-- | floppyMusic/floppy.c | 87 | ||||
-rw-r--r-- | floppyMusic/floppy.h | 30 | ||||
-rw-r--r-- | floppyMusic/floppyMusic.componentinfo.xml | 86 | ||||
-rw-r--r-- | floppyMusic/floppyMusic.cproj | 173 | ||||
-rw-r--r-- | floppyMusic/main.c | 22 |
9 files changed, 450 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..176c449 --- /dev/null +++ b/.gitignore @@ -0,0 +1,29 @@ +Thumbs.db +*.obj +*.exe +*.pdb +*.user +*.aps +*.pch +*.vspscc +*_i.c +*_p.c +*.ncb +*.suo +*.sln.docstates +*.tlb +*.tlh +*.bak +*.cache +*.ilk +*.log +[Bb]in +[Dd]ebug*/ +*.lib +*.sbr +obj/ +[Rr]elease*/ +_ReSharper*/ +[Tt]est[Rr]esult* +*.vssscc +$tf*/
\ No newline at end of file diff --git a/.tfignore b/.tfignore new file mode 100644 index 0000000..e37a9f1 --- /dev/null +++ b/.tfignore @@ -0,0 +1 @@ +\.git
\ No newline at end of file diff --git a/.vs/floppyMusic/v14/.atsuo b/.vs/floppyMusic/v14/.atsuo Binary files differnew file mode 100644 index 0000000..706c20b --- /dev/null +++ b/.vs/floppyMusic/v14/.atsuo diff --git a/floppyMusic.atsln b/floppyMusic.atsln new file mode 100644 index 0000000..fd00043 --- /dev/null +++ b/floppyMusic.atsln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Atmel Studio Solution File, Format Version 11.00 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "floppyMusic", "floppyMusic\floppyMusic.cproj", "{DCE6C7E3-EE26-4D79-826B-08594B9AD897}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|AVR = Debug|AVR + Release|AVR = Release|AVR + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Debug|AVR.ActiveCfg = Debug|AVR + {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Debug|AVR.Build.0 = Debug|AVR + {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Release|AVR.ActiveCfg = Release|AVR + {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Release|AVR.Build.0 = Release|AVR + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/floppyMusic/floppy.c b/floppyMusic/floppy.c new file mode 100644 index 0000000..716502a --- /dev/null +++ b/floppyMusic/floppy.c @@ -0,0 +1,87 @@ +/* + * floppy.c + * + * Created: 29.04.2017 17:06:37 + * Author: Jonas + */ + + #include "floppy.h" + +ISR(TIMER0_OVF_vect) +{ + cli(); + + timer_overflow_counter ++; + + *fPORT = 0xff; + + for(uint8_t i = 0; i < 8; i++) + { + if(floppy_nextrun[i] == (timer_overflow_counter + 1)) //Do Stuff. Doesnt work + { + floppy_nextrun[i] += floppy_frequencies[i]; + floppy_pulse(i); + } + } + + sei(); +} + +void floppy_setup(char *_pulse_port, char *_pulse_ddr, char *_direction_port, char *_direction_ddr) + { + //Setup Ports + fPORT = _pulse_port; + fDDR = _pulse_ddr; + dPORT = _direction_port; + dDDR = _direction_ddr; + + *fDDR = 0xff; + *fPORT = 0xff; + *dDDR = 0xff; + *dPORT = 0xff; + + + + //Variable init + timer_overflow_counter = 0; + + for(uint8_t i = 0; i < 8; i++) + { + floppy_head_return_counter[i] = 0; + floppy_frequencies[i] = 0; + floppy_nextrun[i] = 0; + } + + //Return all FDDs to track 0 + + for(uint8_t i = 0; i < 200; i++) + { + _delay_ms(5); + *fPORT ^= 0xff; + } + + *fPORT = 0xff; + + //Setup Timer + TCCR0 |= (1 << CS01); // Prescaler 8, for max Frequency of 488 Hertz for F_CPU = 1MHz + TIMSK |= (1 << TOIE0); //Activate Interrupt + sei(); + } + + void floppy_set_frequency(uint8_t _floppy_id, uint8_t _freq) + { + floppy_frequencies[_floppy_id] = floppy_nextrun[_floppy_id] = _freq; + } + + void floppy_pulse(uint8_t _floppy_id) + { + *fPORT &= ~(1 << _floppy_id); //Activate pin + + floppy_head_return_counter[_floppy_id] ++; + + if(floppy_head_return_counter[_floppy_id] > 75) //Toggle direction pin if more than 75 steps performed + { + *dPORT ^= (1<<_floppy_id); + floppy_head_return_counter[_floppy_id] = 0; + } + }
\ No newline at end of file diff --git a/floppyMusic/floppy.h b/floppyMusic/floppy.h new file mode 100644 index 0000000..280bb2f --- /dev/null +++ b/floppyMusic/floppy.h @@ -0,0 +1,30 @@ +/* + * floppy.h + * + * Created: 29.04.2017 17:06:28 + * Author: Jonas + */ + + +#ifndef FLOPPY_H_ +#define FLOPPY_H_ + +#include <avr/io.h> +#include <avr/interrupt.h> +#include <avr/delay.h> + +uint8_t timer_overflow_counter; +uint8_t floppy_frequencies[8]; +uint8_t floppy_nextrun[8]; +uint8_t floppy_head_return_counter[8]; + +char *fPORT, *fDDR, *dPORT, *dDDR; //Ports for floppy and Direction of Heads + +void floppy_setup(char *_pulse_port, char *_pulse_ddr, char *_direction_port, char *_direction_ddr); + +void floppy_set_frequency(uint8_t _floppy_id, uint8_t _freq); + +void floppy_pulse(uint8_t _floppy_id); + + +#endif /* FLOPPY_H_ */
\ No newline at end of file diff --git a/floppyMusic/floppyMusic.componentinfo.xml b/floppyMusic/floppyMusic.componentinfo.xml new file mode 100644 index 0000000..7c3c717 --- /dev/null +++ b/floppyMusic/floppyMusic.componentinfo.xml @@ -0,0 +1,86 @@ +<?xml version="1.0" encoding="utf-8"?> +<Store xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="AtmelPackComponentManagement"> + <ProjectComponents> + <ProjectComponent z:Id="i1" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/"> + <CApiVersion></CApiVersion> + <CBundle></CBundle> + <CClass>Device</CClass> + <CGroup>Startup</CGroup> + <CSub></CSub> + <CVariant></CVariant> + <CVendor>Atmel</CVendor> + <CVersion>1.2.0</CVersion> + <DefaultRepoPath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs</DefaultRepoPath> + <DependentComponents xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" /> + <Description></Description> + <Files xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> + <d4p1:anyType i:type="FileInfo"> + <AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.132\include</AbsolutePath> + <Attribute></Attribute> + <Category>include</Category> + <Condition>C</Condition> + <FileContentHash i:nil="true" /> + <FileVersion></FileVersion> + <Name>include</Name> + <SelectString></SelectString> + <SourcePath></SourcePath> + </d4p1:anyType> + <d4p1:anyType i:type="FileInfo"> + <AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.132\include\avr\iom8.h</AbsolutePath> + <Attribute></Attribute> + <Category>header</Category> + <Condition>C</Condition> + <FileContentHash>hDXIougjReqD1inJugv1UA==</FileContentHash> + <FileVersion></FileVersion> + <Name>include/avr/iom8.h</Name> + <SelectString></SelectString> + <SourcePath></SourcePath> + </d4p1:anyType> + <d4p1:anyType i:type="FileInfo"> + <AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.132\templates\main.c</AbsolutePath> + <Attribute>template</Attribute> + <Category>source</Category> + <Condition>C Exe</Condition> + <FileContentHash>6uB4FLeVljduSJojLjAg+A==</FileContentHash> + <FileVersion></FileVersion> + <Name>templates/main.c</Name> + <SelectString>Main file (.c)</SelectString> + <SourcePath></SourcePath> + </d4p1:anyType> + <d4p1:anyType i:type="FileInfo"> + <AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.132\templates\main.cpp</AbsolutePath> + <Attribute>template</Attribute> + <Category>source</Category> + <Condition>C Exe</Condition> + <FileContentHash>YXFphlh0CtZJU+ebktABgQ==</FileContentHash> + <FileVersion></FileVersion> + <Name>templates/main.cpp</Name> + <SelectString>Main file (.cpp)</SelectString> + <SourcePath></SourcePath> + </d4p1:anyType> + <d4p1:anyType i:type="FileInfo"> + <AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.132\gcc\dev\atmega8</AbsolutePath> + <Attribute></Attribute> + <Category>libraryPrefix</Category> + <Condition>GCC</Condition> + <FileContentHash i:nil="true" /> + <FileVersion></FileVersion> + <Name>gcc/dev/atmega8</Name> + <SelectString></SelectString> + <SourcePath></SourcePath> + </d4p1:anyType> + </Files> + <PackName>ATmega_DFP</PackName> + <PackPath>C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.2.132/Atmel.ATmega_DFP.pdsc</PackPath> + <PackVersion>1.2.132</PackVersion> + <PresentInProject>true</PresentInProject> + <ReferenceConditionId>ATmega8</ReferenceConditionId> + <RteComponents xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> + <d4p1:string></d4p1:string> + </RteComponents> + <Status>Resolved</Status> + <VersionMode>Fixed</VersionMode> + <IsComponentInAtProject>true</IsComponentInAtProject> + </ProjectComponent> + </ProjectComponents> +</Store>
\ No newline at end of file diff --git a/floppyMusic/floppyMusic.cproj b/floppyMusic/floppyMusic.cproj new file mode 100644 index 0000000..71fa9a4 --- /dev/null +++ b/floppyMusic/floppyMusic.cproj @@ -0,0 +1,173 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0"> + <PropertyGroup> + <SchemaVersion>2.0</SchemaVersion> + <ProjectVersion>7.0</ProjectVersion> + <ToolchainName>com.Atmel.AVRGCC8.C</ToolchainName> + <ProjectGuid>dce6c7e3-ee26-4d79-826b-08594b9ad897</ProjectGuid> + <avrdevice>ATmega8</avrdevice> + <avrdeviceseries>none</avrdeviceseries> + <OutputType>Executable</OutputType> + <Language>C</Language> + <OutputFileName>$(MSBuildProjectName)</OutputFileName> + <OutputFileExtension>.elf</OutputFileExtension> + <OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory> + <AssemblyName>floppyMusic</AssemblyName> + <Name>floppyMusic</Name> + <RootNamespace>floppyMusic</RootNamespace> + <ToolchainFlavour>Native</ToolchainFlavour> + <KeepTimersRunning>true</KeepTimersRunning> + <OverrideVtor>false</OverrideVtor> + <CacheFlash>true</CacheFlash> + <ProgFlashFromRam>true</ProgFlashFromRam> + <RamSnippetAddress>0x20000000</RamSnippetAddress> + <UncachedRange /> + <preserveEEPROM>true</preserveEEPROM> + <OverrideVtorValue>exception_table</OverrideVtorValue> + <BootSegment>2</BootSegment> + <eraseonlaunchrule>0</eraseonlaunchrule> + <AsfFrameworkConfig> + <framework-data xmlns=""> + <options /> + <configurations /> + <files /> + <documentation help="" /> + <offline-documentation help="" /> + <dependencies> + <content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.34.1" /> + </dependencies> + </framework-data> + </AsfFrameworkConfig> + <avrtool>com.atmel.avrdbg.tool.stk500</avrtool> + <avrtoolserialnumber /> + <avrdeviceexpectedsignature>0x1E9307</avrdeviceexpectedsignature> + <custom> + <ToolOptions> + <InterfaceProperties> + </InterfaceProperties> + <InterfaceName> + </InterfaceName> + </ToolOptions> + <ToolType>custom</ToolType> + <ToolNumber> + </ToolNumber> + <ToolName>Custom Programming Tool</ToolName> + </custom> + <avrtoolinterface>ISP</avrtoolinterface> + <com_atmel_avrdbg_tool_simulator> + <ToolOptions xmlns=""> + <InterfaceProperties> + </InterfaceProperties> + <InterfaceName> + </InterfaceName> + </ToolOptions> + <ToolType xmlns="">com.atmel.avrdbg.tool.simulator</ToolType> + <ToolNumber xmlns=""> + </ToolNumber> + <ToolName xmlns="">Simulator</ToolName> + </com_atmel_avrdbg_tool_simulator> + <com_atmel_avrdbg_tool_stk500> + <ToolOptions> + <InterfaceProperties> + <IspClock>125000</IspClock> + </InterfaceProperties> + <InterfaceName>ISP</InterfaceName> + </ToolOptions> + <ToolType>com.atmel.avrdbg.tool.stk500</ToolType> + <ToolNumber> + </ToolNumber> + <ToolName>STK500</ToolName> + </com_atmel_avrdbg_tool_stk500> + <avrtoolinterfaceclock>125000</avrtoolinterfaceclock> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)' == 'Release' "> + <ToolchainSettings> + <AvrGcc> + <avrgcc.common.Device>-mmcu=atmega8 -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.2.132\gcc\dev\atmega8"</avrgcc.common.Device> + <avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex> + <avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss> + <avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep> + <avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec> + <avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures> + <avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned> + <avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned> + <avrgcc.compiler.symbols.DefSymbols> + <ListValues> + <Value>NDEBUG</Value> + </ListValues> + </avrgcc.compiler.symbols.DefSymbols> + <avrgcc.compiler.directories.IncludePaths> + <ListValues> + <Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.2.132\include</Value> + </ListValues> + </avrgcc.compiler.directories.IncludePaths> + <avrgcc.compiler.optimization.level>Optimize for size (-Os)</avrgcc.compiler.optimization.level> + <avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers> + <avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum> + <avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings> + <avrgcc.linker.libraries.Libraries> + <ListValues> + <Value>libm</Value> + </ListValues> + </avrgcc.linker.libraries.Libraries> + <avrgcc.assembler.general.IncludePaths> + <ListValues> + <Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.2.132\include</Value> + </ListValues> + </avrgcc.assembler.general.IncludePaths> + </AvrGcc> + </ToolchainSettings> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> + <ToolchainSettings> + <AvrGcc> + <avrgcc.common.Device>-mmcu=atmega8 -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.2.132\gcc\dev\atmega8"</avrgcc.common.Device> + <avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex> + <avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss> + <avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep> + <avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec> + <avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures> + <avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned> + <avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned> + <avrgcc.compiler.symbols.DefSymbols> + <ListValues> + <Value>DEBUG</Value> + </ListValues> + </avrgcc.compiler.symbols.DefSymbols> + <avrgcc.compiler.directories.IncludePaths> + <ListValues> + <Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.2.132\include</Value> + </ListValues> + </avrgcc.compiler.directories.IncludePaths> + <avrgcc.compiler.optimization.level>Optimize (-O1)</avrgcc.compiler.optimization.level> + <avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers> + <avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum> + <avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel> + <avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings> + <avrgcc.linker.libraries.Libraries> + <ListValues> + <Value>libm</Value> + </ListValues> + </avrgcc.linker.libraries.Libraries> + <avrgcc.assembler.general.IncludePaths> + <ListValues> + <Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.2.132\include</Value> + </ListValues> + </avrgcc.assembler.general.IncludePaths> + <avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel> + </AvrGcc> + </ToolchainSettings> + </PropertyGroup> + <ItemGroup> + <Compile Include="floppy.c"> + <SubType>compile</SubType> + </Compile> + <Compile Include="floppy.h"> + <SubType>compile</SubType> + </Compile> + <Compile Include="main.c"> + <SubType>compile</SubType> + </Compile> + </ItemGroup> + <Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" /> +</Project>
\ No newline at end of file diff --git a/floppyMusic/main.c b/floppyMusic/main.c new file mode 100644 index 0000000..9743636 --- /dev/null +++ b/floppyMusic/main.c @@ -0,0 +1,22 @@ +/* + * floppyMusic.c + * + * Created: 29.04.2017 16:59:57 + * Author : Jonas + */ + +#include <avr/io.h> + +#include "floppy.h" + +int main(void) +{ + floppy_setup(&PORTC, &DDRC, &PORTD, &DDRD); + floppy_set_frequency(0, 4); + + while (1) + { + + } +} + |