Importing code. I swear there are more commits :)

Imported code from larger repo for code. Has some stuff I didn't want
here.
This commit is contained in:
David Lenfesty 2019-12-05 17:24:03 -07:00
commit 0bff1ffcac
73 changed files with 13534 additions and 0 deletions

24
312_final.code-workspace Normal file
View File

@ -0,0 +1,24 @@
{
"folders": [
{
"path": "sd_reader"
},
{
"path": "lcd_disp"
},
{
"path": "testing"
}
],
"settings": {
"files.associations": {
"io.h": "c",
"interrupt.h": "c",
"periph.h": "c",
"comms.h": "c",
"string.h": "c",
"main.h": "c",
"sleep.h": "c"
}
}
}

16
hw/DAC.sch Normal file
View File

@ -0,0 +1,16 @@
EESchema Schematic File Version 4
EELAYER 30 0
EELAYER END
$Descr A4 11693 8268
encoding utf-8
Sheet 2 3
Title ""
Date ""
Rev ""
Comp ""
Comment1 ""
Comment2 ""
Comment3 ""
Comment4 ""
$EndDescr
$EndSCHEMATC

17
hw/DAC.sch-bak Normal file
View File

@ -0,0 +1,17 @@
EESchema Schematic File Version 4
LIBS:final_project-cache
EELAYER 30 0
EELAYER END
$Descr A4 11693 8268
encoding utf-8
Sheet 2 3
Title ""
Date ""
Rev ""
Comp ""
Comment1 ""
Comment2 ""
Comment3 ""
Comment4 ""
$EndDescr
$EndSCHEMATC

172
hw/amp.sch Normal file
View File

@ -0,0 +1,172 @@
EESchema Schematic File Version 4
EELAYER 30 0
EELAYER END
$Descr A4 11693 8268
encoding utf-8
Sheet 3 3
Title ""
Date ""
Rev ""
Comp ""
Comment1 ""
Comment2 ""
Comment3 ""
Comment4 ""
$EndDescr
Text HLabel 2350 1500 0 50 Input ~ 0
DAC_out
$Comp
L Amplifier_Operational:TL072 U?
U 1 1 5DDEF8DF
P 4500 2400
F 0 "U?" H 4500 2767 50 0000 C CNN
F 1 "TL072" H 4500 2676 50 0000 C CNN
F 2 "" H 4500 2400 50 0001 C CNN
F 3 "http://www.ti.com/lit/ds/symlink/tl071.pdf" H 4500 2400 50 0001 C CNN
1 4500 2400
1 0 0 -1
$EndComp
$Comp
L Amplifier_Operational:TL072 U?
U 2 1 5DDF08AD
P 6350 2650
F 0 "U?" H 6350 3017 50 0000 C CNN
F 1 "TL072" H 6350 2926 50 0000 C CNN
F 2 "" H 6350 2650 50 0001 C CNN
F 3 "http://www.ti.com/lit/ds/symlink/tl071.pdf" H 6350 2650 50 0001 C CNN
2 6350 2650
1 0 0 -1
$EndComp
Wire Wire Line
2350 1500 3050 1500
Wire Wire Line
3050 1500 3050 2300
Wire Wire Line
4150 2500 4200 2500
Text Label 5600 2400 0 50 ~ 0
DIVIDER_OUT
$Comp
L Device:R_POT RV?
U 1 1 5DDFB96D
P 5100 2550
F 0 "RV?" H 5031 2596 50 0000 R CNN
F 1 "R_POT" H 5031 2505 50 0000 R CNN
F 2 "" H 5100 2550 50 0001 C CNN
F 3 "~" H 5100 2550 50 0001 C CNN
1 5100 2550
1 0 0 -1
$EndComp
Wire Wire Line
4800 2400 5100 2400
Wire Wire Line
5100 2700 5100 2900
Wire Wire Line
5100 2900 5050 2900
$Comp
L power:GND #PWR?
U 1 1 5DDFD958
P 5050 2900
F 0 "#PWR?" H 5050 2650 50 0001 C CNN
F 1 "GND" H 5055 2727 50 0000 C CNN
F 2 "" H 5050 2900 50 0001 C CNN
F 3 "" H 5050 2900 50 0001 C CNN
1 5050 2900
1 0 0 -1
$EndComp
Wire Wire Line
5250 2550 6050 2550
Wire Wire Line
4150 2500 4150 2650
Wire Wire Line
4150 2650 4800 2650
Wire Wire Line
4800 2650 4800 2400
Connection ~ 4800 2400
Wire Wire Line
6050 2750 6050 2950
Wire Wire Line
6050 2950 6650 2950
Wire Wire Line
6650 2950 6650 2650
Wire Wire Line
6650 2650 6850 2650
Connection ~ 6650 2650
$Comp
L Device:R R?
U 1 1 5DE007D1
P 6850 2800
F 0 "R?" H 6920 2846 50 0000 L CNN
F 1 "R" H 6920 2755 50 0000 L CNN
F 2 "" V 6780 2800 50 0001 C CNN
F 3 "~" H 6850 2800 50 0001 C CNN
1 6850 2800
1 0 0 -1
$EndComp
$Comp
L Device:R R?
U 1 1 5DE00F57
P 6850 3100
F 0 "R?" H 6920 3146 50 0000 L CNN
F 1 "R" H 6920 3055 50 0000 L CNN
F 2 "" V 6780 3100 50 0001 C CNN
F 3 "~" H 6850 3100 50 0001 C CNN
1 6850 3100
1 0 0 -1
$EndComp
Wire Wire Line
6850 2950 7250 2950
Connection ~ 6850 2950
Wire Wire Line
6850 3250 6850 3350
$Comp
L power:GND #PWR?
U 1 1 5DE01A1C
P 6850 3350
F 0 "#PWR?" H 6850 3100 50 0001 C CNN
F 1 "GND" H 6855 3177 50 0000 C CNN
F 2 "" H 6850 3350 50 0001 C CNN
F 3 "" H 6850 3350 50 0001 C CNN
1 6850 3350
1 0 0 -1
$EndComp
$Comp
L Device:C C?
U 1 1 5DDF1BEF
P 3200 2300
F 0 "C?" V 2948 2300 50 0000 C CNN
F 1 "C" V 3039 2300 50 0000 C CNN
F 2 "" H 3238 2150 50 0001 C CNN
F 3 "~" H 3200 2300 50 0001 C CNN
1 3200 2300
0 1 1 0
$EndComp
$Comp
L Device:R 200k
U 1 1 5DDF226F
P 3700 2450
F 0 "200k" H 3770 2496 50 0000 L CNN
F 1 "R" H 3770 2405 50 0000 L CNN
F 2 "" V 3630 2450 50 0001 C CNN
F 3 "~" H 3700 2450 50 0001 C CNN
1 3700 2450
1 0 0 -1
$EndComp
Wire Wire Line
3350 2300 3700 2300
Wire Wire Line
3700 2300 4200 2300
Connection ~ 3700 2300
Wire Wire Line
3700 2600 3700 2750
$Comp
L power:GND #PWR?
U 1 1 5DDF33D2
P 3700 2750
F 0 "#PWR?" H 3700 2500 50 0001 C CNN
F 1 "GND" H 3705 2577 50 0000 C CNN
F 2 "" H 3700 2750 50 0001 C CNN
F 3 "" H 3700 2750 50 0001 C CNN
1 3700 2750
1 0 0 -1
$EndComp
$EndSCHEMATC

173
hw/amp.sch-bak Normal file
View File

@ -0,0 +1,173 @@
EESchema Schematic File Version 4
LIBS:final_project-cache
EELAYER 30 0
EELAYER END
$Descr A4 11693 8268
encoding utf-8
Sheet 3 3
Title ""
Date ""
Rev ""
Comp ""
Comment1 ""
Comment2 ""
Comment3 ""
Comment4 ""
$EndDescr
Text HLabel 2350 1500 0 50 Input ~ 0
DAC_out
$Comp
L Amplifier_Operational:TL072 U?
U 1 1 5DDEF8DF
P 4500 2400
F 0 "U?" H 4500 2767 50 0000 C CNN
F 1 "TL072" H 4500 2676 50 0000 C CNN
F 2 "" H 4500 2400 50 0001 C CNN
F 3 "http://www.ti.com/lit/ds/symlink/tl071.pdf" H 4500 2400 50 0001 C CNN
1 4500 2400
1 0 0 -1
$EndComp
$Comp
L Amplifier_Operational:TL072 U?
U 2 1 5DDF08AD
P 6350 2650
F 0 "U?" H 6350 3017 50 0000 C CNN
F 1 "TL072" H 6350 2926 50 0000 C CNN
F 2 "" H 6350 2650 50 0001 C CNN
F 3 "http://www.ti.com/lit/ds/symlink/tl071.pdf" H 6350 2650 50 0001 C CNN
2 6350 2650
1 0 0 -1
$EndComp
Wire Wire Line
2350 1500 3050 1500
Wire Wire Line
3050 1500 3050 2300
Wire Wire Line
4150 2500 4200 2500
Text Label 5600 2400 0 50 ~ 0
DIVIDER_OUT
$Comp
L Device:R_POT RV?
U 1 1 5DDFB96D
P 5100 2550
F 0 "RV?" H 5031 2596 50 0000 R CNN
F 1 "R_POT" H 5031 2505 50 0000 R CNN
F 2 "" H 5100 2550 50 0001 C CNN
F 3 "~" H 5100 2550 50 0001 C CNN
1 5100 2550
1 0 0 -1
$EndComp
Wire Wire Line
4800 2400 5100 2400
Wire Wire Line
5100 2700 5100 2900
Wire Wire Line
5100 2900 5050 2900
$Comp
L power:GND #PWR?
U 1 1 5DDFD958
P 5050 2900
F 0 "#PWR?" H 5050 2650 50 0001 C CNN
F 1 "GND" H 5055 2727 50 0000 C CNN
F 2 "" H 5050 2900 50 0001 C CNN
F 3 "" H 5050 2900 50 0001 C CNN
1 5050 2900
1 0 0 -1
$EndComp
Wire Wire Line
5250 2550 6050 2550
Wire Wire Line
4150 2500 4150 2650
Wire Wire Line
4150 2650 4800 2650
Wire Wire Line
4800 2650 4800 2400
Connection ~ 4800 2400
Wire Wire Line
6050 2750 6050 2950
Wire Wire Line
6050 2950 6650 2950
Wire Wire Line
6650 2950 6650 2650
Wire Wire Line
6650 2650 6850 2650
Connection ~ 6650 2650
$Comp
L Device:R R?
U 1 1 5DE007D1
P 6850 2800
F 0 "R?" H 6920 2846 50 0000 L CNN
F 1 "R" H 6920 2755 50 0000 L CNN
F 2 "" V 6780 2800 50 0001 C CNN
F 3 "~" H 6850 2800 50 0001 C CNN
1 6850 2800
1 0 0 -1
$EndComp
$Comp
L Device:R R?
U 1 1 5DE00F57
P 6850 3100
F 0 "R?" H 6920 3146 50 0000 L CNN
F 1 "R" H 6920 3055 50 0000 L CNN
F 2 "" V 6780 3100 50 0001 C CNN
F 3 "~" H 6850 3100 50 0001 C CNN
1 6850 3100
1 0 0 -1
$EndComp
Wire Wire Line
6850 2950 7250 2950
Connection ~ 6850 2950
Wire Wire Line
6850 3250 6850 3350
$Comp
L power:GND #PWR?
U 1 1 5DE01A1C
P 6850 3350
F 0 "#PWR?" H 6850 3100 50 0001 C CNN
F 1 "GND" H 6855 3177 50 0000 C CNN
F 2 "" H 6850 3350 50 0001 C CNN
F 3 "" H 6850 3350 50 0001 C CNN
1 6850 3350
1 0 0 -1
$EndComp
$Comp
L Device:C C?
U 1 1 5DDF1BEF
P 3200 2300
F 0 "C?" V 2948 2300 50 0000 C CNN
F 1 "C" V 3039 2300 50 0000 C CNN
F 2 "" H 3238 2150 50 0001 C CNN
F 3 "~" H 3200 2300 50 0001 C CNN
1 3200 2300
0 1 1 0
$EndComp
$Comp
L Device:R 200k
U 1 1 5DDF226F
P 3700 2450
F 0 "200k" H 3770 2496 50 0000 L CNN
F 1 "R" H 3770 2405 50 0000 L CNN
F 2 "" V 3630 2450 50 0001 C CNN
F 3 "~" H 3700 2450 50 0001 C CNN
1 3700 2450
1 0 0 -1
$EndComp
Wire Wire Line
3350 2300 3700 2300
Wire Wire Line
3700 2300 4200 2300
Connection ~ 3700 2300
Wire Wire Line
3700 2600 3700 2750
$Comp
L power:GND #PWR?
U 1 1 5DDF33D2
P 3700 2750
F 0 "#PWR?" H 3700 2500 50 0001 C CNN
F 1 "GND" H 3705 2577 50 0000 C CNN
F 2 "" H 3700 2750 50 0001 C CNN
F 3 "" H 3700 2750 50 0001 C CNN
1 3700 2750
1 0 0 -1
$EndComp
$EndSCHEMATC

32
hw/final.lib Normal file
View File

@ -0,0 +1,32 @@
EESchema-LIBRARY Version 2.4
#encoding utf-8
#
# LCD
#
DEF LCD U 0 40 Y Y 1 F N
F0 "U" 250 -1300 50 H V C CNN
F1 "LCD" 250 200 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
DRAW
S -150 250 350 -1350 0 1 0 f
X GND 1 -250 200 100 R 50 50 1 1 W
X D3 10 -250 -700 100 R 50 50 1 1 B
X D4 11 -250 -800 100 R 50 50 1 1 B
X D5 12 -250 -900 100 R 50 50 1 1 B
X D6 13 -250 -1000 100 R 50 50 1 1 B
X D7 14 -250 -1100 100 R 50 50 1 1 B
X NC 15 -250 -1200 100 R 50 50 1 1 N
X NC 16 -250 -1300 100 R 50 50 1 1 N
X VDD 2 -250 100 100 R 50 50 1 1 W
X Vo 3 -250 0 100 R 50 50 1 1 I
X RS 4 -250 -100 100 R 50 50 1 1 I
X RW 5 -250 -200 100 R 50 50 1 1 I
X EN 6 -250 -300 100 R 50 50 1 1 I
X D0 7 -250 -400 100 R 50 50 1 1 B
X D1 8 -250 -500 100 R 50 50 1 1 B
X D2 9 -250 -600 100 R 50 50 1 1 B
ENDDRAW
ENDDEF
#
#End Library

342
hw/final_project-cache.lib Normal file
View File

@ -0,0 +1,342 @@
EESchema-LIBRARY Version 2.4
#encoding utf-8
#
# Amplifier_Operational_TL072
#
DEF Amplifier_Operational_TL072 U 0 5 Y Y 3 L N
F0 "U" 0 200 50 H V L CNN
F1 "Amplifier_Operational_TL072" 0 -200 50 H V L CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
ALIAS LM358 AD8620 LMC6062 LMC6082 TL062 TL072 TL082 NE5532 SA5532 RC4558 RC4560 RC4580 LMV358 TS912 TSV912IDT TSV912IST TLC272 TLC277 MCP602 OPA1678 OPA2134 OPA2340 OPA2376xxD OPA2376xxDGK MC33078 MC33178 LM4562 OP249 OP275 ADA4075-2 MCP6002-xP MCP6002-xSN MCP6002-xMS LM7332 OPA2333xxD OPA2333xxDGK LMC6482 LT1492 LTC6081xMS8 LM6172 MCP6L92 NJM2043 NJM2114 NJM4556A NJM4558 NJM4559 NJM4560 NJM4580 NJM5532 ADA4807-2ARM OPA2691 LT6234 OPA2356xxD OPA2356xxDGK OPA1612AxD MC33172 OPA1602 TLV2372 LT6237 OPA2277
$FPLIST
SOIC*3.9x4.9mm*P1.27mm*
DIP*W7.62mm*
TO*99*
OnSemi*Micro8*
TSSOP*3x3mm*P0.65mm*
TSSOP*4.4x3mm*P0.65mm*
MSOP*3x3mm*P0.65mm*
SSOP*3.9x4.9mm*P0.635mm*
LFCSP*2x2mm*P0.5mm*
*SIP*
SOIC*5.3x6.2mm*P1.27mm*
$ENDFPLIST
DRAW
P 4 1 1 10 -200 200 200 0 -200 -200 -200 200 f
P 4 2 1 10 -200 200 200 0 -200 -200 -200 200 f
X ~ 1 300 0 100 L 50 50 1 1 O
X - 2 -300 -100 100 R 50 50 1 1 I
X + 3 -300 100 100 R 50 50 1 1 I
X + 5 -300 100 100 R 50 50 2 1 I
X - 6 -300 -100 100 R 50 50 2 1 I
X ~ 7 300 0 100 L 50 50 2 1 O
X V- 4 -100 -300 150 U 50 50 3 1 W
X V+ 8 -100 300 150 D 50 50 3 1 W
ENDDRAW
ENDDEF
#
# Connector_SD_Card
#
DEF Connector_SD_Card J 0 40 Y Y 1 F N
F0 "J" -650 550 50 H V C CNN
F1 "Connector_SD_Card" 600 -550 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
SD*
$ENDFPLIST
DRAW
S -350 -375 -250 -425 0 1 0 F
S -350 -275 -250 -325 0 1 0 F
S -350 -175 -250 -225 0 1 0 F
S -350 -75 -250 -125 0 1 0 F
S -350 25 -250 -25 0 1 0 F
S -350 125 -250 75 0 1 0 F
S -350 225 -250 175 0 1 0 F
S -350 325 -250 275 0 1 0 F
S -300 425 -200 375 0 1 0 F
P 6 0 1 0 -400 350 -300 450 800 450 800 -450 -400 -450 -400 350 f
P 6 0 1 0 650 450 650 500 -800 500 -800 -500 650 -500 650 -450 N
X CD/DAT3 1 -900 300 100 R 50 50 1 1 I
X CARD_DETECT 10 900 200 100 L 50 50 1 1 I
X WRITE_PROTECT 11 900 100 100 L 50 50 1 1 I
X SHELL1 12 900 -100 100 L 50 50 1 1 I
X SHELL2 13 900 -200 100 L 50 50 1 1 I
X CMD 2 -900 200 100 R 50 50 1 1 I
X VSS 3 -900 100 100 R 50 50 1 1 W
X VDD 4 -900 0 100 R 50 50 1 1 W
X CLK 5 -900 -100 100 R 50 50 1 1 I
X VSS 6 -900 -200 100 R 50 50 1 1 W
X DAT0 7 -900 -300 100 R 50 50 1 1 I
X DAT1 8 -900 -400 100 R 50 50 1 1 I
X DAT2 9 -900 400 100 R 50 50 1 1 I
ENDDRAW
ENDDEF
#
# Device_C
#
DEF Device_C C 0 10 N Y 1 F N
F0 "C" 25 100 50 H V L CNN
F1 "Device_C" 25 -100 50 H V L CNN
F2 "" 38 -150 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
C_*
$ENDFPLIST
DRAW
P 2 0 1 20 -80 -30 80 -30 N
P 2 0 1 20 -80 30 80 30 N
X ~ 1 0 150 110 D 50 50 1 1 P
X ~ 2 0 -150 110 U 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Device_Crystal
#
DEF Device_Crystal Y 0 40 N N 1 F N
F0 "Y" 0 150 50 H V C CNN
F1 "Device_Crystal" 0 -150 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
Crystal*
$ENDFPLIST
DRAW
S -45 100 45 -100 0 1 12 N
P 2 0 1 0 -100 0 -75 0 N
P 2 0 1 20 -75 -50 -75 50 N
P 2 0 1 20 75 -50 75 50 N
P 2 0 1 0 100 0 75 0 N
X 1 1 -150 0 50 R 50 50 1 1 P
X 2 2 150 0 50 L 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Device_R
#
DEF Device_R R 0 0 N Y 1 F N
F0 "R" 80 0 50 V V C CNN
F1 "Device_R" 0 0 50 V V C CNN
F2 "" -70 0 50 V I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
R_*
$ENDFPLIST
DRAW
S -40 -100 40 100 0 1 10 N
X ~ 1 0 150 50 D 50 50 1 1 P
X ~ 2 0 -150 50 U 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Device_R_POT
#
DEF Device_R_POT RV 0 40 Y N 1 F N
F0 "RV" -175 0 50 V V C CNN
F1 "Device_R_POT" -100 0 50 V V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
Potentiometer*
$ENDFPLIST
DRAW
S 40 100 -40 -100 0 1 10 N
P 2 0 1 0 100 0 60 0 N
P 4 0 1 0 45 0 90 20 90 -20 45 0 F
X 1 1 0 150 50 D 50 50 1 1 P
X 2 2 150 0 50 L 50 50 1 1 P
X 3 3 0 -150 50 U 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Regulator_Linear_AP2112K-3.3
#
DEF Regulator_Linear_AP2112K-3.3 U 0 10 Y Y 1 F N
F0 "U" -200 225 50 H V L CNN
F1 "Regulator_Linear_AP2112K-3.3" 0 225 50 H V L CNN
F2 "Package_TO_SOT_SMD:SOT-23-5" 0 325 50 H I C CNN
F3 "" 0 100 50 H I C CNN
ALIAS AP2204K-1.8 AP2204K-2.5 AP2204K-2.8 AP2204K-3.0 AP2204K-3.3 AP2204K-5.0 AP2127K-1.0 AP2127K-1.2 AP2127K-1.5 AP2127K-1.8 AP2127K-2.5 AP2127K-2.8 AP2127K-3.0 AP2127K-3.3 AP2127K-4.2 AP2127K-4.75 AP2112K-1.2 AP2112K-1.8 AP2112K-2.5 AP2112K-2.6 AP2112K-3.3
$FPLIST
SOT?23?5*
$ENDFPLIST
DRAW
S -200 175 200 -200 0 1 10 f
X VIN 1 -300 100 100 R 50 50 1 1 W
X GND 2 0 -300 100 U 50 50 1 1 W
X EN 3 -300 0 100 R 50 50 1 1 I
X NC 4 300 0 100 L 50 50 1 1 N N
X VOUT 5 300 100 100 L 50 50 1 1 w
ENDDRAW
ENDDEF
#
# Switch_SW_Push
#
DEF Switch_SW_Push SW 0 40 N N 1 F N
F0 "SW" 50 100 50 H V L CNN
F1 "Switch_SW_Push" 0 -60 50 H V C CNN
F2 "" 0 200 50 H I C CNN
F3 "" 0 200 50 H I C CNN
DRAW
C -80 0 20 0 1 0 N
C 80 0 20 0 1 0 N
P 2 0 1 0 0 50 0 120 N
P 2 0 1 0 100 50 -100 50 N
X 1 1 -200 0 100 R 50 50 0 1 P
X 2 2 200 0 100 L 50 50 0 1 P
ENDDRAW
ENDDEF
#
# final_LCD
#
DEF final_LCD U 0 40 Y Y 1 F N
F0 "U" 250 -1300 50 H V C CNN
F1 "final_LCD" 250 200 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
DRAW
S -150 250 350 -1350 0 1 0 f
X GND 1 -250 200 100 R 50 50 1 1 W
X D3 10 -250 -700 100 R 50 50 1 1 B
X D4 11 -250 -800 100 R 50 50 1 1 B
X D5 12 -250 -900 100 R 50 50 1 1 B
X D6 13 -250 -1000 100 R 50 50 1 1 B
X D7 14 -250 -1100 100 R 50 50 1 1 B
X NC 15 -250 -1200 100 R 50 50 1 1 N
X NC 16 -250 -1300 100 R 50 50 1 1 N
X VDD 2 -250 100 100 R 50 50 1 1 W
X Vo 3 -250 0 100 R 50 50 1 1 I
X RS 4 -250 -100 100 R 50 50 1 1 I
X RW 5 -250 -200 100 R 50 50 1 1 I
X EN 6 -250 -300 100 R 50 50 1 1 I
X D0 7 -250 -400 100 R 50 50 1 1 B
X D1 8 -250 -500 100 R 50 50 1 1 B
X D2 9 -250 -600 100 R 50 50 1 1 B
ENDDRAW
ENDDEF
#
# final_project-rescue_ATmega328-PU-MCU_Microchip_ATmega
#
DEF final_project-rescue_ATmega328-PU-MCU_Microchip_ATmega U 0 20 Y Y 1 F N
F0 "U" -500 1450 50 H V L BNN
F1 "final_project-rescue_ATmega328-PU-MCU_Microchip_ATmega" 100 -1450 50 H V L TNN
F2 "Package_DIP:DIP-28_W7.62mm" 0 0 50 H I C CIN
F3 "" 0 0 50 H I C CNN
$FPLIST
DIP*W7.62mm*
$ENDFPLIST
DRAW
S -500 -1400 500 1400 0 1 10 f
X ~RESET~/PC6 1 600 -300 100 L 50 50 1 1 T
X XTAL2/PB7 10 600 500 100 L 50 50 1 1 T
X PD5 11 600 -1000 100 L 50 50 1 1 T
X PD6 12 600 -1100 100 L 50 50 1 1 T
X PD7 13 600 -1200 100 L 50 50 1 1 T
X PB0 14 600 1200 100 L 50 50 1 1 T
X PB1 15 600 1100 100 L 50 50 1 1 T
X PB2 16 600 1000 100 L 50 50 1 1 T
X PB3 17 600 900 100 L 50 50 1 1 T
X PB4 18 600 800 100 L 50 50 1 1 T
X PB5 19 600 700 100 L 50 50 1 1 T
X PD0 2 600 -500 100 L 50 50 1 1 T
X AVCC 20 100 1500 100 D 50 50 1 1 W
X AREF 21 -600 1200 100 R 50 50 1 1 P
X GND 22 0 -1500 100 U 50 50 1 1 P N
X PC0 23 600 300 100 L 50 50 1 1 T
X PC1 24 600 200 100 L 50 50 1 1 T
X PC2 25 600 100 100 L 50 50 1 1 T
X PC3 26 600 0 100 L 50 50 1 1 T
X PC4 27 600 -100 100 L 50 50 1 1 T
X PC5 28 600 -200 100 L 50 50 1 1 T
X PD1 3 600 -600 100 L 50 50 1 1 T
X PD2 4 600 -700 100 L 50 50 1 1 T
X PD3 5 600 -800 100 L 50 50 1 1 T
X PD4 6 600 -900 100 L 50 50 1 1 T
X VCC 7 0 1500 100 D 50 50 1 1 W
X GND 8 0 -1500 100 U 50 50 1 1 W
X XTAL1/PB6 9 600 600 100 L 50 50 1 1 T
ENDDRAW
ENDDEF
#
# final_project-rescue_ATtiny2313-20MU-MCU_Microchip_ATtiny
#
DEF final_project-rescue_ATtiny2313-20MU-MCU_Microchip_ATtiny U 0 20 Y Y 1 F N
F0 "U" -500 1050 50 H V L BNN
F1 "final_project-rescue_ATtiny2313-20MU-MCU_Microchip_ATtiny" 100 -1050 50 H V L TNN
F2 "Package_DFN_QFN:MLF-20-1EP_4x4mm_P0.5mm_EP2.6x2.6mm" 0 0 50 H I C CIN
F3 "" 0 0 50 H I C CNN
$FPLIST
MLF*1EP*4x4mm*P0.5mm*
$ENDFPLIST
DRAW
S -500 -1000 500 1000 0 1 10 f
X PD1 1 600 -200 100 L 50 50 1 1 T
X PB0 10 600 800 100 L 50 50 1 1 T
X PB1 11 600 700 100 L 50 50 1 1 T
X PB2 12 600 600 100 L 50 50 1 1 T
X PB3 13 600 500 100 L 50 50 1 1 T
X PB4 14 600 400 100 L 50 50 1 1 T
X PB5 15 600 300 100 L 50 50 1 1 T
X PB6 16 600 200 100 L 50 50 1 1 T
X PB7 17 600 100 100 L 50 50 1 1 T
X VCC 18 0 1100 100 D 50 50 1 1 W
X PA2/~RESET 19 -600 800 100 R 50 50 1 1 T
X PA1/XTAL2 2 -600 400 100 R 50 50 1 1 T
X PD0 20 600 -100 100 L 50 50 1 1 T
X GND 21 0 -1100 100 U 50 50 1 1 P N
X PA0/XTAL1 3 -600 600 100 R 50 50 1 1 T
X PD2 4 600 -300 100 L 50 50 1 1 T
X PD3 5 600 -400 100 L 50 50 1 1 T
X PD4 6 600 -500 100 L 50 50 1 1 T
X PD5 7 600 -600 100 L 50 50 1 1 T
X GND 8 0 -1100 100 U 50 50 1 1 W
X PD6 9 600 -700 100 L 50 50 1 1 T
ENDDRAW
ENDDEF
#
# power_+3V3
#
DEF power_+3V3 #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 -150 50 H I C CNN
F1 "power_+3V3" 0 140 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
ALIAS +3.3V
DRAW
P 2 0 1 0 -30 50 0 100 N
P 2 0 1 0 0 0 0 100 N
P 2 0 1 0 0 100 30 50 N
X +3V3 1 0 0 0 U 50 50 1 1 W N
ENDDRAW
ENDDEF
#
# power_+5V
#
DEF power_+5V #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 -150 50 H I C CNN
F1 "power_+5V" 0 140 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
DRAW
P 2 0 1 0 -30 50 0 100 N
P 2 0 1 0 0 0 0 100 N
P 2 0 1 0 0 100 30 50 N
X +5V 1 0 0 0 U 50 50 1 1 W N
ENDDRAW
ENDDEF
#
# power_GND
#
DEF power_GND #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 -250 50 H I C CNN
F1 "power_GND" 0 -150 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
DRAW
P 6 0 1 0 0 0 0 -50 50 -50 0 -100 -50 -50 0 -50 N
X GND 1 0 0 0 D 50 50 1 1 W N
ENDDRAW
ENDDEF
#
#End Library

View File

@ -0,0 +1,3 @@
EESchema-DOCLIB Version 2.0
#
#End Doc Library

View File

@ -0,0 +1,83 @@
EESchema-LIBRARY Version 2.4
#encoding utf-8
#
# ATmega328-PU-MCU_Microchip_ATmega
#
DEF ATmega328-PU-MCU_Microchip_ATmega U 0 20 Y Y 1 F N
F0 "U" -500 1450 50 H V L BNN
F1 "ATmega328-PU-MCU_Microchip_ATmega" 100 -1450 50 H V L TNN
F2 "Package_DIP:DIP-28_W7.62mm" 0 0 50 H I C CIN
F3 "" 0 0 50 H I C CNN
$FPLIST
DIP*W7.62mm*
$ENDFPLIST
DRAW
S -500 -1400 500 1400 0 1 10 f
X ~RESET~/PC6 1 600 -300 100 L 50 50 1 1 T
X XTAL2/PB7 10 600 500 100 L 50 50 1 1 T
X PD5 11 600 -1000 100 L 50 50 1 1 T
X PD6 12 600 -1100 100 L 50 50 1 1 T
X PD7 13 600 -1200 100 L 50 50 1 1 T
X PB0 14 600 1200 100 L 50 50 1 1 T
X PB1 15 600 1100 100 L 50 50 1 1 T
X PB2 16 600 1000 100 L 50 50 1 1 T
X PB3 17 600 900 100 L 50 50 1 1 T
X PB4 18 600 800 100 L 50 50 1 1 T
X PB5 19 600 700 100 L 50 50 1 1 T
X PD0 2 600 -500 100 L 50 50 1 1 T
X AVCC 20 100 1500 100 D 50 50 1 1 W
X AREF 21 -600 1200 100 R 50 50 1 1 P
X GND 22 0 -1500 100 U 50 50 1 1 P N
X PC0 23 600 300 100 L 50 50 1 1 T
X PC1 24 600 200 100 L 50 50 1 1 T
X PC2 25 600 100 100 L 50 50 1 1 T
X PC3 26 600 0 100 L 50 50 1 1 T
X PC4 27 600 -100 100 L 50 50 1 1 T
X PC5 28 600 -200 100 L 50 50 1 1 T
X PD1 3 600 -600 100 L 50 50 1 1 T
X PD2 4 600 -700 100 L 50 50 1 1 T
X PD3 5 600 -800 100 L 50 50 1 1 T
X PD4 6 600 -900 100 L 50 50 1 1 T
X VCC 7 0 1500 100 D 50 50 1 1 W
X GND 8 0 -1500 100 U 50 50 1 1 W
X XTAL1/PB6 9 600 600 100 L 50 50 1 1 T
ENDDRAW
ENDDEF
#
# ATtiny2313-20MU-MCU_Microchip_ATtiny
#
DEF ATtiny2313-20MU-MCU_Microchip_ATtiny U 0 20 Y Y 1 F N
F0 "U" -500 1050 50 H V L BNN
F1 "ATtiny2313-20MU-MCU_Microchip_ATtiny" 100 -1050 50 H V L TNN
F2 "Package_DFN_QFN:MLF-20-1EP_4x4mm_P0.5mm_EP2.6x2.6mm" 0 0 50 H I C CIN
F3 "" 0 0 50 H I C CNN
$FPLIST
MLF*1EP*4x4mm*P0.5mm*
$ENDFPLIST
DRAW
S -500 -1000 500 1000 0 1 10 f
X PD1 1 600 -200 100 L 50 50 1 1 T
X PB0 10 600 800 100 L 50 50 1 1 T
X PB1 11 600 700 100 L 50 50 1 1 T
X PB2 12 600 600 100 L 50 50 1 1 T
X PB3 13 600 500 100 L 50 50 1 1 T
X PB4 14 600 400 100 L 50 50 1 1 T
X PB5 15 600 300 100 L 50 50 1 1 T
X PB6 16 600 200 100 L 50 50 1 1 T
X PB7 17 600 100 100 L 50 50 1 1 T
X VCC 18 0 1100 100 D 50 50 1 1 W
X PA2/~RESET 19 -600 800 100 R 50 50 1 1 T
X PA1/XTAL2 2 -600 400 100 R 50 50 1 1 T
X PD0 20 600 -100 100 L 50 50 1 1 T
X GND 21 0 -1100 100 U 50 50 1 1 P N
X PA0/XTAL1 3 -600 600 100 R 50 50 1 1 T
X PD2 4 600 -300 100 L 50 50 1 1 T
X PD3 5 600 -400 100 L 50 50 1 1 T
X PD4 6 600 -500 100 L 50 50 1 1 T
X PD5 7 600 -600 100 L 50 50 1 1 T
X GND 8 0 -1100 100 U 50 50 1 1 W
X PD6 9 600 -700 100 L 50 50 1 1 T
ENDDRAW
ENDDEF
#
#End Library

View File

@ -0,0 +1 @@
(kicad_pcb (version 4) (host kicad "dummy file") )

33
hw/final_project.pro Normal file
View File

@ -0,0 +1,33 @@
update=22/05/2015 07:44:53
version=1
last_client=kicad
[general]
version=1
RootSch=
BoardNm=
[pcbnew]
version=1
LastNetListRead=
UseCmpFile=1
PadDrill=0.600000000000
PadDrillOvalY=0.600000000000
PadSizeH=1.500000000000
PadSizeV=1.500000000000
PcbTextSizeV=1.500000000000
PcbTextSizeH=1.500000000000
PcbTextThickness=0.300000000000
ModuleTextSizeV=1.000000000000
ModuleTextSizeH=1.000000000000
ModuleTextSizeThickness=0.150000000000
SolderMaskClearance=0.000000000000
SolderMaskMinWidth=0.000000000000
DrawSegmentWidth=0.200000000000
BoardOutlineThickness=0.100000000000
ModuleOutlineThickness=0.150000000000
[cvpcb]
version=1
NetIExt=net
[eeschema]
version=1
LibDir=
[eeschema/libraries]

788
hw/final_project.sch Normal file
View File

@ -0,0 +1,788 @@
EESchema Schematic File Version 4
EELAYER 30 0
EELAYER END
$Descr A4 11693 8268
encoding utf-8
Sheet 1 3
Title ""
Date ""
Rev ""
Comp ""
Comment1 ""
Comment2 ""
Comment3 ""
Comment4 ""
$EndDescr
$Comp
L final_project-rescue:ATmega328-PU-MCU_Microchip_ATmega U?
U 1 1 5DDD9932
P 3450 2950
F 0 "U?" H 2806 2996 50 0000 R CNN
F 1 "ATmega328-PU" H 2806 2905 50 0000 R CNN
F 2 "Package_DIP:DIP-28_W7.62mm" H 3450 2950 50 0001 C CIN
F 3 "http://ww1.microchip.com/downloads/en/DeviceDoc/ATmega328_P%20AVR%20MCU%20with%20picoPower%20Technology%20Data%20Sheet%2040001984A.pdf" H 3450 2950 50 0001 C CNN
1 3450 2950
1 0 0 -1
$EndComp
Wire Wire Line
4050 2250 4250 2250
Wire Wire Line
4050 2150 4250 2150
Wire Wire Line
4050 2050 4250 2050
Wire Wire Line
4050 1950 4250 1950
Text Label 4250 2250 0 50 ~ 0
SCK
Text Label 4250 2150 0 50 ~ 0
MOSI
Text Label 4250 2050 0 50 ~ 0
MISO
Text Label 4250 1950 0 50 ~ 0
CS
Wire Wire Line
4050 3450 4250 3450
Wire Wire Line
4050 3550 4250 3550
Text Label 4250 3450 0 50 ~ 0
RXD
Text Label 4250 3550 0 50 ~ 0
TXD
$Comp
L Device:Crystal Y?
U 1 1 5DDDDF12
P 4650 2450
F 0 "Y?" V 4604 2581 50 0000 L CNN
F 1 "16MHz" V 4695 2581 50 0000 L CNN
F 2 "" H 4650 2450 50 0001 C CNN
F 3 "~" H 4650 2450 50 0001 C CNN
1 4650 2450
0 1 1 0
$EndComp
Wire Wire Line
4650 2350 4650 2300
Wire Wire Line
4050 2450 4300 2450
Wire Wire Line
4650 2300 5250 2300
Connection ~ 4650 2300
Wire Wire Line
4650 2600 5150 2600
$Comp
L Device:C C?
U 1 1 5DDDEABA
P 5150 2750
F 0 "C?" H 5265 2796 50 0000 L CNN
F 1 "18p" H 5265 2705 50 0000 L CNN
F 2 "" H 5188 2600 50 0001 C CNN
F 3 "~" H 5150 2750 50 0001 C CNN
1 5150 2750
1 0 0 -1
$EndComp
$Comp
L Device:C C?
U 1 1 5DDDEEAD
P 5250 2450
F 0 "C?" H 5365 2496 50 0000 L CNN
F 1 "18p" H 5365 2405 50 0000 L CNN
F 2 "" H 5288 2300 50 0001 C CNN
F 3 "~" H 5250 2450 50 0001 C CNN
1 5250 2450
1 0 0 -1
$EndComp
Wire Wire Line
5250 2600 5250 2900
Wire Wire Line
5250 2900 5150 2900
Wire Wire Line
5150 2900 5150 3000
Connection ~ 5150 2900
$Comp
L power:GND #PWR?
U 1 1 5DDDF660
P 5150 3000
F 0 "#PWR?" H 5150 2750 50 0001 C CNN
F 1 "GND" H 5155 2827 50 0000 C CNN
F 2 "" H 5150 3000 50 0001 C CNN
F 3 "" H 5150 3000 50 0001 C CNN
1 5150 3000
1 0 0 -1
$EndComp
Wire Wire Line
4050 1750 4500 1750
Wire Wire Line
4050 1850 4500 1850
Wire Wire Line
4050 2650 4150 2650
Wire Wire Line
4050 2950 4150 2950
Wire Wire Line
4050 3050 4150 3050
Wire Wire Line
4050 3150 4150 3150
Wire Wire Line
4050 3650 4600 3650
Wire Wire Line
4050 3750 4600 3750
Wire Wire Line
4050 3850 4600 3850
Wire Wire Line
4050 3950 4600 3950
Wire Wire Line
4050 4050 4600 4050
Wire Wire Line
4050 4150 4600 4150
Text Label 4600 3650 0 50 ~ 0
DAC6
Text Label 4600 3750 0 50 ~ 0
DAC7
Text Label 4600 3850 0 50 ~ 0
DAC8
Text Label 4600 3950 0 50 ~ 0
DAC9
Text Label 4600 4050 0 50 ~ 0
DAC10
Text Label 4600 4150 0 50 ~ 0
DAC11
Text Label 4500 1750 0 50 ~ 0
DAC12
Text Label 4500 1850 0 50 ~ 0
DAC13
Wire Wire Line
3450 1450 3450 1300
Wire Wire Line
3450 4450 3450 4600
$Comp
L power:+5V #PWR?
U 1 1 5DDEFED6
P 3450 1300
F 0 "#PWR?" H 3450 1150 50 0001 C CNN
F 1 "+5V" H 3465 1473 50 0000 C CNN
F 2 "" H 3450 1300 50 0001 C CNN
F 3 "" H 3450 1300 50 0001 C CNN
1 3450 1300
1 0 0 -1
$EndComp
$Comp
L power:GND #PWR?
U 1 1 5DDF0E43
P 3450 4600
F 0 "#PWR?" H 3450 4350 50 0001 C CNN
F 1 "GND" H 3455 4427 50 0000 C CNN
F 2 "" H 3450 4600 50 0001 C CNN
F 3 "" H 3450 4600 50 0001 C CNN
1 3450 4600
1 0 0 -1
$EndComp
$Comp
L power:GND #PWR?
U 1 1 5DDF122E
P 6650 3800
F 0 "#PWR?" H 6650 3550 50 0001 C CNN
F 1 "GND" H 6655 3627 50 0000 C CNN
F 2 "" H 6650 3800 50 0001 C CNN
F 3 "" H 6650 3800 50 0001 C CNN
1 6650 3800
1 0 0 -1
$EndComp
NoConn ~ 4050 3250
NoConn ~ 2850 1750
NoConn ~ 3550 1450
$Sheet
S 1800 5200 1550 1500
U 5DDEEC27
F0 "DAC" 50
F1 "DAC.sch" 50
F2 "DAC_OUT" I R 3350 5300 50
F3 "DAC0" I L 1800 5300 50
F4 "DAC1" I L 1800 5400 50
F5 "DAC2" I L 1800 5500 50
F6 "DAC3" I L 1800 5600 50
F7 "DAC4" I L 1800 5700 50
F8 "DAC5" I L 1800 5800 50
F9 "DAC6" I L 1800 5900 50
F10 "DAC7" I L 1800 6000 50
F11 "DAC8" I L 1800 6100 50
F12 "DAC9" I L 1800 6200 50
F13 "DAC10" I L 1800 6300 50
F14 "DAC11" I L 1800 6400 50
F15 "DAC12" I L 1800 6500 50
F16 "DAC13" I L 1800 6600 50
$EndSheet
$Sheet
S 5450 5300 1450 900
U 5DDEF065
F0 "amp" 50
F1 "amp.sch" 50
F2 "DAC_out" I L 5450 5400 50
$EndSheet
$Comp
L final:LCD U?
U 1 1 5DE2158A
P 9600 1500
F 0 "U?" H 9850 200 50 0000 L CNN
F 1 "LCD" H 9800 1700 50 0000 L CNN
F 2 "" H 9600 1500 50 0001 C CNN
F 3 "" H 9600 1500 50 0001 C CNN
1 9600 1500
1 0 0 -1
$EndComp
Text Label 9350 2300 2 50 ~ 0
LCD_D4
Text Label 9350 2400 2 50 ~ 0
LCD_D5
Text Label 9350 2500 2 50 ~ 0
LCD_D6
Text Label 9350 2600 2 50 ~ 0
LCD_D7
Text Label 9350 1600 2 50 ~ 0
LCD_RS
Text Label 9350 1700 2 50 ~ 0
LCD_RW
$Comp
L power:GND #PWR?
U 1 1 5DE24EEB
P 8750 1500
F 0 "#PWR?" H 8750 1250 50 0001 C CNN
F 1 "GND" H 8755 1327 50 0000 C CNN
F 2 "" H 8750 1500 50 0001 C CNN
F 3 "" H 8750 1500 50 0001 C CNN
1 8750 1500
1 0 0 -1
$EndComp
Wire Wire Line
9350 1400 9200 1400
Wire Wire Line
9200 1400 9200 1000
$Comp
L power:+5V #PWR?
U 1 1 5DE25CF2
P 9200 1000
F 0 "#PWR?" H 9200 850 50 0001 C CNN
F 1 "+5V" H 9215 1173 50 0000 C CNN
F 2 "" H 9200 1000 50 0001 C CNN
F 3 "" H 9200 1000 50 0001 C CNN
1 9200 1000
1 0 0 -1
$EndComp
Text Label 9350 1500 2 50 ~ 0
LCD_CONTRAST
Text Label 9350 1800 2 50 ~ 0
LCD_EN
NoConn ~ 9350 1900
NoConn ~ 9350 2000
NoConn ~ 9350 2100
NoConn ~ 9350 2200
$Comp
L power:GND #PWR?
U 1 1 5DE2FCEC
P 10350 1700
F 0 "#PWR?" H 10350 1450 50 0001 C CNN
F 1 "GND" H 10355 1527 50 0000 C CNN
F 2 "" H 10350 1700 50 0001 C CNN
F 3 "" H 10350 1700 50 0001 C CNN
1 10350 1700
1 0 0 -1
$EndComp
$Comp
L power:+5V #PWR?
U 1 1 5DE2FA18
P 10350 1000
F 0 "#PWR?" H 10350 850 50 0001 C CNN
F 1 "+5V" H 10365 1173 50 0000 C CNN
F 2 "" H 10350 1000 50 0001 C CNN
F 3 "" H 10350 1000 50 0001 C CNN
1 10350 1000
1 0 0 -1
$EndComp
Text Label 10550 1350 0 50 ~ 0
LCD_CONTRAST
Wire Wire Line
10350 1350 10350 1400
Connection ~ 10350 1350
Wire Wire Line
10350 1350 10550 1350
Wire Wire Line
10350 1300 10350 1350
$Comp
L Device:R R?
U 1 1 5DE2D84F
P 10350 1550
F 0 "R?" H 10420 1596 50 0000 L CNN
F 1 "R" H 10420 1505 50 0000 L CNN
F 2 "" V 10280 1550 50 0001 C CNN
F 3 "~" H 10350 1550 50 0001 C CNN
1 10350 1550
1 0 0 -1
$EndComp
$Comp
L Device:R R?
U 1 1 5DE2D413
P 10350 1150
F 0 "R?" H 10420 1196 50 0000 L CNN
F 1 "R" H 10420 1105 50 0000 L CNN
F 2 "" V 10280 1150 50 0001 C CNN
F 3 "~" H 10350 1150 50 0001 C CNN
1 10350 1150
1 0 0 -1
$EndComp
Wire Wire Line
8750 1300 8750 1500
Wire Wire Line
9350 1300 8750 1300
Wire Notes Line
8650 750 11150 750
Wire Notes Line
11150 750 11150 2900
Wire Notes Line
11150 2900 8650 2900
Wire Notes Line
8650 2900 8650 750
Text Notes 11000 2900 0 50 ~ 0
LCD\n
$Comp
L Connector:SD_Card J?
U 1 1 5DE47B4E
P 9850 4650
F 0 "J?" H 9850 5315 50 0000 C CNN
F 1 "SD_Card" H 9850 5224 50 0000 C CNN
F 2 "" H 9850 4650 50 0001 C CNN
F 3 "http://portal.fciconnect.com/Comergent//fci/drawing/10067847.pdf" H 9850 4650 50 0001 C CNN
1 9850 4650
1 0 0 -1
$EndComp
NoConn ~ 10750 4450
NoConn ~ 10750 4550
NoConn ~ 10750 4750
NoConn ~ 10750 4850
NoConn ~ 8900 5050
NoConn ~ 8950 4250
Wire Wire Line
8950 4550 8800 4550
Wire Wire Line
8800 4550 8800 4850
$Comp
L power:GND #PWR?
U 1 1 5DE4FECC
P 8800 5300
F 0 "#PWR?" H 8800 5050 50 0001 C CNN
F 1 "GND" H 8805 5127 50 0000 C CNN
F 2 "" H 8800 5300 50 0001 C CNN
F 3 "" H 8800 5300 50 0001 C CNN
1 8800 5300
1 0 0 -1
$EndComp
Wire Wire Line
8950 4850 8800 4850
Connection ~ 8800 4850
Wire Wire Line
8800 4850 8800 5300
Wire Wire Line
8950 4650 8750 4650
Wire Wire Line
8750 4650 8750 4000
Wire Wire Line
8950 4950 8650 4950
Text Label 8650 4950 2 50 ~ 0
MISO
Wire Wire Line
8950 4750 8650 4750
Text Label 8650 4750 2 50 ~ 0
CLK
Wire Wire Line
8950 4450 8650 4450
Text Label 8650 4450 2 50 ~ 0
CMD
Wire Wire Line
8950 4350 8650 4350
Text Label 8650 4350 2 50 ~ 0
CD
$Comp
L power:+3V3 #PWR?
U 1 1 5DE57C4F
P 8750 4000
F 0 "#PWR?" H 8750 3850 50 0001 C CNN
F 1 "+3V3" H 8765 4173 50 0000 C CNN
F 2 "" H 8750 4000 50 0001 C CNN
F 3 "" H 8750 4000 50 0001 C CNN
1 8750 4000
1 0 0 -1
$EndComp
$Comp
L Device:R R?
U 1 1 5DE5821B
P 7400 5500
F 0 "R?" H 7470 5546 50 0000 L CNN
F 1 "R" H 7470 5455 50 0000 L CNN
F 2 "" V 7330 5500 50 0001 C CNN
F 3 "~" H 7400 5500 50 0001 C CNN
1 7400 5500
1 0 0 -1
$EndComp
$Comp
L Device:R R?
U 1 1 5DE589C1
P 7400 5800
F 0 "R?" H 7470 5846 50 0000 L CNN
F 1 "R" H 7470 5755 50 0000 L CNN
F 2 "" V 7330 5800 50 0001 C CNN
F 3 "~" H 7400 5800 50 0001 C CNN
1 7400 5800
1 0 0 -1
$EndComp
$Comp
L Device:R R?
U 1 1 5DE58C5B
P 7900 5500
F 0 "R?" H 7970 5546 50 0000 L CNN
F 1 "R" H 7970 5455 50 0000 L CNN
F 2 "" V 7830 5500 50 0001 C CNN
F 3 "~" H 7900 5500 50 0001 C CNN
1 7900 5500
1 0 0 -1
$EndComp
$Comp
L Device:R R?
U 1 1 5DE58FA3
P 7900 5800
F 0 "R?" H 7970 5846 50 0000 L CNN
F 1 "R" H 7970 5755 50 0000 L CNN
F 2 "" V 7830 5800 50 0001 C CNN
F 3 "~" H 7900 5800 50 0001 C CNN
1 7900 5800
1 0 0 -1
$EndComp
$Comp
L Device:R R?
U 1 1 5DE5926A
P 8300 5500
F 0 "R?" H 8370 5546 50 0000 L CNN
F 1 "R" H 8370 5455 50 0000 L CNN
F 2 "" V 8230 5500 50 0001 C CNN
F 3 "~" H 8300 5500 50 0001 C CNN
1 8300 5500
1 0 0 -1
$EndComp
$Comp
L Device:R R?
U 1 1 5DE59509
P 8300 5800
F 0 "R?" H 8370 5846 50 0000 L CNN
F 1 "R" H 8370 5755 50 0000 L CNN
F 2 "" V 8230 5800 50 0001 C CNN
F 3 "~" H 8300 5800 50 0001 C CNN
1 8300 5800
1 0 0 -1
$EndComp
Wire Wire Line
7400 5350 7400 5250
Wire Wire Line
7400 5250 7300 5250
Text Label 7300 5250 2 50 ~ 0
MOSI
Wire Wire Line
7900 5350 7900 5250
Wire Wire Line
7900 5250 7750 5250
Text Label 7750 5250 2 50 ~ 0
SCK
Wire Wire Line
8300 5350 8300 5250
Wire Wire Line
8300 5250 8200 5250
Text Label 8200 5250 2 50 ~ 0
CS
Wire Wire Line
7400 5650 7500 5650
Connection ~ 7400 5650
Wire Wire Line
7900 5650 8000 5650
Connection ~ 7900 5650
Wire Wire Line
8300 5650 8400 5650
Connection ~ 8300 5650
$Comp
L power:GND #PWR?
U 1 1 5DE60F8B
P 8300 5950
F 0 "#PWR?" H 8300 5700 50 0001 C CNN
F 1 "GND" H 8305 5777 50 0000 C CNN
F 2 "" H 8300 5950 50 0001 C CNN
F 3 "" H 8300 5950 50 0001 C CNN
1 8300 5950
1 0 0 -1
$EndComp
$Comp
L power:GND #PWR?
U 1 1 5DE6121F
P 7900 5950
F 0 "#PWR?" H 7900 5700 50 0001 C CNN
F 1 "GND" H 7905 5777 50 0000 C CNN
F 2 "" H 7900 5950 50 0001 C CNN
F 3 "" H 7900 5950 50 0001 C CNN
1 7900 5950
1 0 0 -1
$EndComp
$Comp
L power:GND #PWR?
U 1 1 5DE61424
P 7400 5950
F 0 "#PWR?" H 7400 5700 50 0001 C CNN
F 1 "GND" H 7405 5777 50 0000 C CNN
F 2 "" H 7400 5950 50 0001 C CNN
F 3 "" H 7400 5950 50 0001 C CNN
1 7400 5950
1 0 0 -1
$EndComp
Text Label 8000 5650 0 50 ~ 0
CLK
Text Label 7500 5650 0 50 ~ 0
CMD
Text Label 8400 5650 0 50 ~ 0
CD
Text Notes 7650 6350 0 50 ~ 0
Level Shifting\n
Wire Wire Line
5150 5300 5150 5400
Wire Wire Line
5150 5400 5450 5400
Wire Wire Line
3350 5300 5150 5300
Wire Wire Line
4050 2750 4150 2750
Connection ~ 4650 2600
Wire Wire Line
4050 2350 4650 2350
Text Label 4150 3150 0 50 ~ 0
DAC5
Text Label 4150 3050 0 50 ~ 0
DAC4
Text Label 4150 2950 0 50 ~ 0
DAC3
Text Label 4200 2850 0 50 ~ 0
DAC2
Text Label 4150 2750 0 50 ~ 0
DAC1
Text Label 4150 2650 0 50 ~ 0
DAC0
Wire Wire Line
4050 2850 4200 2850
Wire Wire Line
4300 2600 4650 2600
Wire Wire Line
4300 2450 4300 2600
Text Label 1800 5800 2 50 ~ 0
DAC5
Text Label 1800 5700 2 50 ~ 0
DAC4
Text Label 1800 5600 2 50 ~ 0
DAC3
Text Label 1800 5500 2 50 ~ 0
DAC2
Text Label 1800 5400 2 50 ~ 0
DAC1
Text Label 1800 5300 2 50 ~ 0
DAC0
Text Label 1800 5900 2 50 ~ 0
DAC6
Text Label 1800 6000 2 50 ~ 0
DAC7
Text Label 1800 6100 2 50 ~ 0
DAC8
Text Label 1800 6200 2 50 ~ 0
DAC9
Text Label 1800 6300 2 50 ~ 0
DAC10
Text Label 1800 6400 2 50 ~ 0
DAC11
Text Label 1800 6500 2 50 ~ 0
DAC12
Text Label 1800 6600 2 50 ~ 0
DAC13
$Comp
L Switch:SW_Push SW?
U 1 1 5DE938F9
P 950 1400
F 0 "SW?" V 904 1548 50 0000 L CNN
F 1 "SW_Push" V 995 1548 50 0000 L CNN
F 2 "" H 950 1600 50 0001 C CNN
F 3 "~" H 950 1600 50 0001 C CNN
1 950 1400
0 1 1 0
$EndComp
$Comp
L Switch:SW_Push SW?
U 1 1 5DE95103
P 950 2150
F 0 "SW?" V 904 2298 50 0000 L CNN
F 1 "SW_Push" V 995 2298 50 0000 L CNN
F 2 "" H 950 2350 50 0001 C CNN
F 3 "~" H 950 2350 50 0001 C CNN
1 950 2150
0 1 1 0
$EndComp
$Comp
L Switch:SW_Push SW?
U 1 1 5DE95459
P 950 2850
F 0 "SW?" V 904 2998 50 0000 L CNN
F 1 "SW_Push" V 995 2998 50 0000 L CNN
F 2 "" H 950 3050 50 0001 C CNN
F 3 "~" H 950 3050 50 0001 C CNN
1 950 2850
0 1 1 0
$EndComp
Text Label 950 1200 2 50 ~ 0
BUT0
Text Label 950 1950 2 50 ~ 0
BUT1
Text Label 950 2650 2 50 ~ 0
BUT2
$Comp
L power:GND #PWR?
U 1 1 5DE97876
P 950 1600
F 0 "#PWR?" H 950 1350 50 0001 C CNN
F 1 "GND" H 955 1427 50 0000 C CNN
F 2 "" H 950 1600 50 0001 C CNN
F 3 "" H 950 1600 50 0001 C CNN
1 950 1600
1 0 0 -1
$EndComp
$Comp
L power:GND #PWR?
U 1 1 5DE97EED
P 950 2350
F 0 "#PWR?" H 950 2100 50 0001 C CNN
F 1 "GND" H 955 2177 50 0000 C CNN
F 2 "" H 950 2350 50 0001 C CNN
F 3 "" H 950 2350 50 0001 C CNN
1 950 2350
1 0 0 -1
$EndComp
$Comp
L power:GND #PWR?
U 1 1 5DE98112
P 950 3050
F 0 "#PWR?" H 950 2800 50 0001 C CNN
F 1 "GND" H 955 2877 50 0000 C CNN
F 2 "" H 950 3050 50 0001 C CNN
F 3 "" H 950 3050 50 0001 C CNN
1 950 3050
1 0 0 -1
$EndComp
$Comp
L Regulator_Linear:AP2112K-3.3 U?
U 1 1 5DE99466
P 7600 4300
F 0 "U?" H 7600 4642 50 0000 C CNN
F 1 "AP2112K-3.3" H 7600 4551 50 0000 C CNN
F 2 "Package_TO_SOT_SMD:SOT-23-5" H 7600 4625 50 0001 C CNN
F 3 "https://www.diodes.com/assets/Datasheets/AP2112.pdf" H 7600 4400 50 0001 C CNN
1 7600 4300
1 0 0 -1
$EndComp
Wire Wire Line
7300 4200 7200 4200
Wire Wire Line
7200 4200 7200 4100
$Comp
L power:+5V #PWR?
U 1 1 5DEA3406
P 7200 4100
F 0 "#PWR?" H 7200 3950 50 0001 C CNN
F 1 "+5V" H 7215 4273 50 0000 C CNN
F 2 "" H 7200 4100 50 0001 C CNN
F 3 "" H 7200 4100 50 0001 C CNN
1 7200 4100
1 0 0 -1
$EndComp
Wire Wire Line
7300 4300 7200 4300
Wire Wire Line
7200 4300 7200 4200
Connection ~ 7200 4200
$Comp
L power:GND #PWR?
U 1 1 5DEA545A
P 7600 4600
F 0 "#PWR?" H 7600 4350 50 0001 C CNN
F 1 "GND" H 7605 4427 50 0000 C CNN
F 2 "" H 7600 4600 50 0001 C CNN
F 3 "" H 7600 4600 50 0001 C CNN
1 7600 4600
1 0 0 -1
$EndComp
Wire Wire Line
7900 4200 8050 4200
Wire Wire Line
8050 4200 8050 4100
$Comp
L power:+3V3 #PWR?
U 1 1 5DEA72CB
P 8050 4100
F 0 "#PWR?" H 8050 3950 50 0001 C CNN
F 1 "+3V3" H 8065 4273 50 0000 C CNN
F 2 "" H 8050 4100 50 0001 C CNN
F 3 "" H 8050 4100 50 0001 C CNN
1 8050 4100
1 0 0 -1
$EndComp
NoConn ~ 6050 1950
NoConn ~ 6050 2150
NoConn ~ 6050 1750
Text Label 7250 1750 0 50 ~ 0
LCD_RW
Text Label 7250 3250 0 50 ~ 0
LCD_RS
Text Label 7250 2350 0 50 ~ 0
LCD_D6
Text Label 7250 2450 0 50 ~ 0
LCD_D7
Text Label 7250 2250 0 50 ~ 0
LCD_D5
Text Label 7250 2150 0 50 ~ 0
LCD_D4
$Comp
L power:+5V #PWR?
U 1 1 5DDF0261
P 6650 1150
F 0 "#PWR?" H 6650 1000 50 0001 C CNN
F 1 "+5V" H 6665 1323 50 0000 C CNN
F 2 "" H 6650 1150 50 0001 C CNN
F 3 "" H 6650 1150 50 0001 C CNN
1 6650 1150
1 0 0 -1
$EndComp
Wire Wire Line
6650 3650 6650 3800
Wire Wire Line
6650 1450 6650 1150
Text Label 7450 2750 0 50 ~ 0
RXD
Text Label 7450 2650 0 50 ~ 0
TXD
Wire Wire Line
7250 2750 7450 2750
Wire Wire Line
7250 2650 7450 2650
$Comp
L final_project-rescue:ATtiny2313-20MU-MCU_Microchip_ATtiny U?
U 1 1 5DDDA525
P 6650 2550
F 0 "U?" H 6650 3831 50 0000 C CNN
F 1 "ATtiny2313-20MU" H 6650 3740 50 0000 C CNN
F 2 "Package_DFN_QFN:MLF-20-1EP_4x4mm_P0.5mm_EP2.6x2.6mm" H 6650 2550 50 0001 C CIN
F 3 "http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-2543-AVR-ATtiny2313_Datasheet.pdf" H 6650 2550 50 0001 C CNN
1 6650 2550
1 0 0 -1
$EndComp
Text Label 7250 1950 0 50 ~ 0
BUT_RED
Text Label 6050 2150 2 50 ~ 0
BUT_RIGHT
Text Label 6050 1950 2 50 ~ 0
BUT_LEFT
Text Label 7250 1850 0 50 ~ 0
E
$EndSCHEMATC

787
hw/final_project.sch-bak Normal file
View File

@ -0,0 +1,787 @@
EESchema Schematic File Version 4
LIBS:final_project-cache
EELAYER 30 0
EELAYER END
$Descr A4 11693 8268
encoding utf-8
Sheet 1 3
Title ""
Date ""
Rev ""
Comp ""
Comment1 ""
Comment2 ""
Comment3 ""
Comment4 ""
$EndDescr
$Comp
L MCU_Microchip_ATmega:ATmega328-PU U?
U 1 1 5DDD9932
P 3450 2950
F 0 "U?" H 2806 2996 50 0000 R CNN
F 1 "ATmega328-PU" H 2806 2905 50 0000 R CNN
F 2 "Package_DIP:DIP-28_W7.62mm" H 3450 2950 50 0001 C CIN
F 3 "http://ww1.microchip.com/downloads/en/DeviceDoc/ATmega328_P%20AVR%20MCU%20with%20picoPower%20Technology%20Data%20Sheet%2040001984A.pdf" H 3450 2950 50 0001 C CNN
1 3450 2950
1 0 0 -1
$EndComp
$Comp
L MCU_Microchip_ATtiny:ATtiny2313-20MU U?
U 1 1 5DDDA525
P 6650 2550
F 0 "U?" H 6650 3831 50 0000 C CNN
F 1 "ATtiny2313-20MU" H 6650 3740 50 0000 C CNN
F 2 "Package_DFN_QFN:MLF-20-1EP_4x4mm_P0.5mm_EP2.6x2.6mm" H 6650 2550 50 0001 C CIN
F 3 "http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-2543-AVR-ATtiny2313_Datasheet.pdf" H 6650 2550 50 0001 C CNN
1 6650 2550
1 0 0 -1
$EndComp
Wire Wire Line
4050 2250 4250 2250
Wire Wire Line
4050 2150 4250 2150
Wire Wire Line
4050 2050 4250 2050
Wire Wire Line
4050 1950 4250 1950
Text Label 4250 2250 0 50 ~ 0
SCK
Text Label 4250 2150 0 50 ~ 0
MOSI
Text Label 4250 2050 0 50 ~ 0
MISO
Text Label 4250 1950 0 50 ~ 0
CS
Wire Wire Line
4050 3450 4250 3450
Wire Wire Line
4050 3550 4250 3550
Text Label 4250 3450 0 50 ~ 0
RXD
Text Label 4250 3550 0 50 ~ 0
TXD
$Comp
L Device:Crystal Y?
U 1 1 5DDDDF12
P 4650 2450
F 0 "Y?" V 4604 2581 50 0000 L CNN
F 1 "16MHz" V 4695 2581 50 0000 L CNN
F 2 "" H 4650 2450 50 0001 C CNN
F 3 "~" H 4650 2450 50 0001 C CNN
1 4650 2450
0 1 1 0
$EndComp
Wire Wire Line
4650 2350 4650 2300
Wire Wire Line
4050 2450 4300 2450
Wire Wire Line
4650 2300 5250 2300
Connection ~ 4650 2300
Wire Wire Line
4650 2600 5150 2600
$Comp
L Device:C C?
U 1 1 5DDDEABA
P 5150 2750
F 0 "C?" H 5265 2796 50 0000 L CNN
F 1 "18p" H 5265 2705 50 0000 L CNN
F 2 "" H 5188 2600 50 0001 C CNN
F 3 "~" H 5150 2750 50 0001 C CNN
1 5150 2750
1 0 0 -1
$EndComp
$Comp
L Device:C C?
U 1 1 5DDDEEAD
P 5250 2450
F 0 "C?" H 5365 2496 50 0000 L CNN
F 1 "18p" H 5365 2405 50 0000 L CNN
F 2 "" H 5288 2300 50 0001 C CNN
F 3 "~" H 5250 2450 50 0001 C CNN
1 5250 2450
1 0 0 -1
$EndComp
Wire Wire Line
5250 2600 5250 2900
Wire Wire Line
5250 2900 5150 2900
Wire Wire Line
5150 2900 5150 3000
Connection ~ 5150 2900
$Comp
L power:GND #PWR?
U 1 1 5DDDF660
P 5150 3000
F 0 "#PWR?" H 5150 2750 50 0001 C CNN
F 1 "GND" H 5155 2827 50 0000 C CNN
F 2 "" H 5150 3000 50 0001 C CNN
F 3 "" H 5150 3000 50 0001 C CNN
1 5150 3000
1 0 0 -1
$EndComp
Wire Wire Line
7250 2650 7450 2650
Wire Wire Line
7250 2750 7450 2750
Text Label 7450 2650 0 50 ~ 0
TXD
Text Label 7450 2750 0 50 ~ 0
RXD
Wire Wire Line
4050 1750 4500 1750
Wire Wire Line
4050 1850 4500 1850
Wire Wire Line
4050 2650 4150 2650
Wire Wire Line
4050 2950 4150 2950
Wire Wire Line
4050 3050 4150 3050
Wire Wire Line
4050 3150 4150 3150
Wire Wire Line
4050 3650 4600 3650
Wire Wire Line
4050 3750 4600 3750
Wire Wire Line
4050 3850 4600 3850
Wire Wire Line
4050 3950 4600 3950
Wire Wire Line
4050 4050 4600 4050
Wire Wire Line
4050 4150 4600 4150
Text Label 4600 3650 0 50 ~ 0
DAC6
Text Label 4600 3750 0 50 ~ 0
DAC7
Text Label 4600 3850 0 50 ~ 0
DAC8
Text Label 4600 3950 0 50 ~ 0
DAC9
Text Label 4600 4050 0 50 ~ 0
DAC10
Text Label 4600 4150 0 50 ~ 0
DAC11
Text Label 4500 1750 0 50 ~ 0
DAC12
Text Label 4500 1850 0 50 ~ 0
DAC13
Wire Wire Line
3450 1450 3450 1300
Wire Wire Line
3450 4450 3450 4600
Wire Wire Line
6650 1450 6650 1150
Wire Wire Line
6650 3650 6650 3800
$Comp
L power:+5V #PWR?
U 1 1 5DDEFED6
P 3450 1300
F 0 "#PWR?" H 3450 1150 50 0001 C CNN
F 1 "+5V" H 3465 1473 50 0000 C CNN
F 2 "" H 3450 1300 50 0001 C CNN
F 3 "" H 3450 1300 50 0001 C CNN
1 3450 1300
1 0 0 -1
$EndComp
$Comp
L power:+5V #PWR?
U 1 1 5DDF0261
P 6650 1150
F 0 "#PWR?" H 6650 1000 50 0001 C CNN
F 1 "+5V" H 6665 1323 50 0000 C CNN
F 2 "" H 6650 1150 50 0001 C CNN
F 3 "" H 6650 1150 50 0001 C CNN
1 6650 1150
1 0 0 -1
$EndComp
$Comp
L power:GND #PWR?
U 1 1 5DDF0E43
P 3450 4600
F 0 "#PWR?" H 3450 4350 50 0001 C CNN
F 1 "GND" H 3455 4427 50 0000 C CNN
F 2 "" H 3450 4600 50 0001 C CNN
F 3 "" H 3450 4600 50 0001 C CNN
1 3450 4600
1 0 0 -1
$EndComp
$Comp
L power:GND #PWR?
U 1 1 5DDF122E
P 6650 3800
F 0 "#PWR?" H 6650 3550 50 0001 C CNN
F 1 "GND" H 6655 3627 50 0000 C CNN
F 2 "" H 6650 3800 50 0001 C CNN
F 3 "" H 6650 3800 50 0001 C CNN
1 6650 3800
1 0 0 -1
$EndComp
Text Label 7250 1750 0 50 ~ 0
LCD_D4
Text Label 7250 1850 0 50 ~ 0
LCD_D5
Text Label 7250 2050 0 50 ~ 0
LCD_D7
Text Label 7250 1950 0 50 ~ 0
LCD_D6
Text Label 7250 2150 0 50 ~ 0
LCD_RS
Text Label 7250 2250 0 50 ~ 0
LCD_RW
Text Label 7250 3050 0 50 ~ 0
BUT1
Text Label 7250 2950 0 50 ~ 0
BUT2
Text Label 7250 3150 0 50 ~ 0
BUT0
NoConn ~ 6050 1750
NoConn ~ 6050 2150
NoConn ~ 6050 1950
NoConn ~ 4050 3250
NoConn ~ 2850 1750
NoConn ~ 3550 1450
$Sheet
S 1800 5200 1550 1500
U 5DDEEC27
F0 "DAC" 50
F1 "DAC.sch" 50
F2 "DAC_OUT" I R 3350 5300 50
F3 "DAC0" I L 1800 5300 50
F4 "DAC1" I L 1800 5400 50
F5 "DAC2" I L 1800 5500 50
F6 "DAC3" I L 1800 5600 50
F7 "DAC4" I L 1800 5700 50
F8 "DAC5" I L 1800 5800 50
F9 "DAC6" I L 1800 5900 50
F10 "DAC7" I L 1800 6000 50
F11 "DAC8" I L 1800 6100 50
F12 "DAC9" I L 1800 6200 50
F13 "DAC10" I L 1800 6300 50
F14 "DAC11" I L 1800 6400 50
F15 "DAC12" I L 1800 6500 50
F16 "DAC13" I L 1800 6600 50
$EndSheet
$Sheet
S 5450 5300 1450 900
U 5DDEF065
F0 "amp" 50
F1 "amp.sch" 50
F2 "DAC_out" I L 5450 5400 50
$EndSheet
$Comp
L final:LCD U?
U 1 1 5DE2158A
P 9600 1500
F 0 "U?" H 9850 200 50 0000 L CNN
F 1 "LCD" H 9800 1700 50 0000 L CNN
F 2 "" H 9600 1500 50 0001 C CNN
F 3 "" H 9600 1500 50 0001 C CNN
1 9600 1500
1 0 0 -1
$EndComp
Text Label 9350 2300 2 50 ~ 0
LCD_D4
Text Label 9350 2400 2 50 ~ 0
LCD_D5
Text Label 9350 2500 2 50 ~ 0
LCD_D6
Text Label 9350 2600 2 50 ~ 0
LCD_D7
Text Label 9350 1600 2 50 ~ 0
LCD_RS
Text Label 9350 1700 2 50 ~ 0
LCD_RW
$Comp
L power:GND #PWR?
U 1 1 5DE24EEB
P 8750 1500
F 0 "#PWR?" H 8750 1250 50 0001 C CNN
F 1 "GND" H 8755 1327 50 0000 C CNN
F 2 "" H 8750 1500 50 0001 C CNN
F 3 "" H 8750 1500 50 0001 C CNN
1 8750 1500
1 0 0 -1
$EndComp
Wire Wire Line
9350 1400 9200 1400
Wire Wire Line
9200 1400 9200 1000
$Comp
L power:+5V #PWR?
U 1 1 5DE25CF2
P 9200 1000
F 0 "#PWR?" H 9200 850 50 0001 C CNN
F 1 "+5V" H 9215 1173 50 0000 C CNN
F 2 "" H 9200 1000 50 0001 C CNN
F 3 "" H 9200 1000 50 0001 C CNN
1 9200 1000
1 0 0 -1
$EndComp
Text Label 9350 1500 2 50 ~ 0
LCD_CONTRAST
Text Label 9350 1800 2 50 ~ 0
LCD_EN
NoConn ~ 9350 1900
NoConn ~ 9350 2000
NoConn ~ 9350 2100
NoConn ~ 9350 2200
$Comp
L power:GND #PWR?
U 1 1 5DE2FCEC
P 10350 1700
F 0 "#PWR?" H 10350 1450 50 0001 C CNN
F 1 "GND" H 10355 1527 50 0000 C CNN
F 2 "" H 10350 1700 50 0001 C CNN
F 3 "" H 10350 1700 50 0001 C CNN
1 10350 1700
1 0 0 -1
$EndComp
$Comp
L power:+5V #PWR?
U 1 1 5DE2FA18
P 10350 1000
F 0 "#PWR?" H 10350 850 50 0001 C CNN
F 1 "+5V" H 10365 1173 50 0000 C CNN
F 2 "" H 10350 1000 50 0001 C CNN
F 3 "" H 10350 1000 50 0001 C CNN
1 10350 1000
1 0 0 -1
$EndComp
Text Label 10550 1350 0 50 ~ 0
LCD_CONTRAST
Wire Wire Line
10350 1350 10350 1400
Connection ~ 10350 1350
Wire Wire Line
10350 1350 10550 1350
Wire Wire Line
10350 1300 10350 1350
$Comp
L Device:R R?
U 1 1 5DE2D84F
P 10350 1550
F 0 "R?" H 10420 1596 50 0000 L CNN
F 1 "R" H 10420 1505 50 0000 L CNN
F 2 "" V 10280 1550 50 0001 C CNN
F 3 "~" H 10350 1550 50 0001 C CNN
1 10350 1550
1 0 0 -1
$EndComp
$Comp
L Device:R R?
U 1 1 5DE2D413
P 10350 1150
F 0 "R?" H 10420 1196 50 0000 L CNN
F 1 "R" H 10420 1105 50 0000 L CNN
F 2 "" V 10280 1150 50 0001 C CNN
F 3 "~" H 10350 1150 50 0001 C CNN
1 10350 1150
1 0 0 -1
$EndComp
Wire Wire Line
8750 1300 8750 1500
Wire Wire Line
9350 1300 8750 1300
Wire Notes Line
8650 750 11150 750
Wire Notes Line
11150 750 11150 2900
Wire Notes Line
11150 2900 8650 2900
Wire Notes Line
8650 2900 8650 750
Text Notes 11000 2900 0 50 ~ 0
LCD\n
$Comp
L Connector:SD_Card J?
U 1 1 5DE47B4E
P 9850 4650
F 0 "J?" H 9850 5315 50 0000 C CNN
F 1 "SD_Card" H 9850 5224 50 0000 C CNN
F 2 "" H 9850 4650 50 0001 C CNN
F 3 "http://portal.fciconnect.com/Comergent//fci/drawing/10067847.pdf" H 9850 4650 50 0001 C CNN
1 9850 4650
1 0 0 -1
$EndComp
NoConn ~ 10750 4450
NoConn ~ 10750 4550
NoConn ~ 10750 4750
NoConn ~ 10750 4850
NoConn ~ 8900 5050
NoConn ~ 8950 4250
Wire Wire Line
8950 4550 8800 4550
Wire Wire Line
8800 4550 8800 4850
$Comp
L power:GND #PWR?
U 1 1 5DE4FECC
P 8800 5300
F 0 "#PWR?" H 8800 5050 50 0001 C CNN
F 1 "GND" H 8805 5127 50 0000 C CNN
F 2 "" H 8800 5300 50 0001 C CNN
F 3 "" H 8800 5300 50 0001 C CNN
1 8800 5300
1 0 0 -1
$EndComp
Wire Wire Line
8950 4850 8800 4850
Connection ~ 8800 4850
Wire Wire Line
8800 4850 8800 5300
Wire Wire Line
8950 4650 8750 4650
Wire Wire Line
8750 4650 8750 4000
Wire Wire Line
8950 4950 8650 4950
Text Label 8650 4950 2 50 ~ 0
MISO
Wire Wire Line
8950 4750 8650 4750
Text Label 8650 4750 2 50 ~ 0
CLK
Wire Wire Line
8950 4450 8650 4450
Text Label 8650 4450 2 50 ~ 0
CMD
Wire Wire Line
8950 4350 8650 4350
Text Label 8650 4350 2 50 ~ 0
CD
$Comp
L power:+3V3 #PWR?
U 1 1 5DE57C4F
P 8750 4000
F 0 "#PWR?" H 8750 3850 50 0001 C CNN
F 1 "+3V3" H 8765 4173 50 0000 C CNN
F 2 "" H 8750 4000 50 0001 C CNN
F 3 "" H 8750 4000 50 0001 C CNN
1 8750 4000
1 0 0 -1
$EndComp
$Comp
L Device:R R?
U 1 1 5DE5821B
P 7400 5500
F 0 "R?" H 7470 5546 50 0000 L CNN
F 1 "R" H 7470 5455 50 0000 L CNN
F 2 "" V 7330 5500 50 0001 C CNN
F 3 "~" H 7400 5500 50 0001 C CNN
1 7400 5500
1 0 0 -1
$EndComp
$Comp
L Device:R R?
U 1 1 5DE589C1
P 7400 5800
F 0 "R?" H 7470 5846 50 0000 L CNN
F 1 "R" H 7470 5755 50 0000 L CNN
F 2 "" V 7330 5800 50 0001 C CNN
F 3 "~" H 7400 5800 50 0001 C CNN
1 7400 5800
1 0 0 -1
$EndComp
$Comp
L Device:R R?
U 1 1 5DE58C5B
P 7900 5500
F 0 "R?" H 7970 5546 50 0000 L CNN
F 1 "R" H 7970 5455 50 0000 L CNN
F 2 "" V 7830 5500 50 0001 C CNN
F 3 "~" H 7900 5500 50 0001 C CNN
1 7900 5500
1 0 0 -1
$EndComp
$Comp
L Device:R R?
U 1 1 5DE58FA3
P 7900 5800
F 0 "R?" H 7970 5846 50 0000 L CNN
F 1 "R" H 7970 5755 50 0000 L CNN
F 2 "" V 7830 5800 50 0001 C CNN
F 3 "~" H 7900 5800 50 0001 C CNN
1 7900 5800
1 0 0 -1
$EndComp
$Comp
L Device:R R?
U 1 1 5DE5926A
P 8300 5500
F 0 "R?" H 8370 5546 50 0000 L CNN
F 1 "R" H 8370 5455 50 0000 L CNN
F 2 "" V 8230 5500 50 0001 C CNN
F 3 "~" H 8300 5500 50 0001 C CNN
1 8300 5500
1 0 0 -1
$EndComp
$Comp
L Device:R R?
U 1 1 5DE59509
P 8300 5800
F 0 "R?" H 8370 5846 50 0000 L CNN
F 1 "R" H 8370 5755 50 0000 L CNN
F 2 "" V 8230 5800 50 0001 C CNN
F 3 "~" H 8300 5800 50 0001 C CNN
1 8300 5800
1 0 0 -1
$EndComp
Wire Wire Line
7400 5350 7400 5250
Wire Wire Line
7400 5250 7300 5250
Text Label 7300 5250 2 50 ~ 0
MOSI
Wire Wire Line
7900 5350 7900 5250
Wire Wire Line
7900 5250 7750 5250
Text Label 7750 5250 2 50 ~ 0
SCK
Wire Wire Line
8300 5350 8300 5250
Wire Wire Line
8300 5250 8200 5250
Text Label 8200 5250 2 50 ~ 0
CS
Wire Wire Line
7400 5650 7500 5650
Connection ~ 7400 5650
Wire Wire Line
7900 5650 8000 5650
Connection ~ 7900 5650
Wire Wire Line
8300 5650 8400 5650
Connection ~ 8300 5650
$Comp
L power:GND #PWR?
U 1 1 5DE60F8B
P 8300 5950
F 0 "#PWR?" H 8300 5700 50 0001 C CNN
F 1 "GND" H 8305 5777 50 0000 C CNN
F 2 "" H 8300 5950 50 0001 C CNN
F 3 "" H 8300 5950 50 0001 C CNN
1 8300 5950
1 0 0 -1
$EndComp
$Comp
L power:GND #PWR?
U 1 1 5DE6121F
P 7900 5950
F 0 "#PWR?" H 7900 5700 50 0001 C CNN
F 1 "GND" H 7905 5777 50 0000 C CNN
F 2 "" H 7900 5950 50 0001 C CNN
F 3 "" H 7900 5950 50 0001 C CNN
1 7900 5950
1 0 0 -1
$EndComp
$Comp
L power:GND #PWR?
U 1 1 5DE61424
P 7400 5950
F 0 "#PWR?" H 7400 5700 50 0001 C CNN
F 1 "GND" H 7405 5777 50 0000 C CNN
F 2 "" H 7400 5950 50 0001 C CNN
F 3 "" H 7400 5950 50 0001 C CNN
1 7400 5950
1 0 0 -1
$EndComp
Text Label 8000 5650 0 50 ~ 0
CLK
Text Label 7500 5650 0 50 ~ 0
CMD
Text Label 8400 5650 0 50 ~ 0
CD
Text Notes 7650 4900 0 50 ~ 0
Level Shifting\n
Wire Wire Line
5150 5300 5150 5400
Wire Wire Line
5150 5400 5450 5400
Wire Wire Line
3350 5300 5150 5300
Wire Wire Line
4050 2750 4150 2750
Connection ~ 4650 2600
Wire Wire Line
4050 2350 4650 2350
Text Label 4150 3150 0 50 ~ 0
DAC5
Text Label 4150 3050 0 50 ~ 0
DAC4
Text Label 4150 2950 0 50 ~ 0
DAC3
Text Label 4200 2850 0 50 ~ 0
DAC2
Text Label 4150 2750 0 50 ~ 0
DAC1
Text Label 4150 2650 0 50 ~ 0
DAC0
Wire Wire Line
4050 2850 4200 2850
Wire Wire Line
4300 2600 4650 2600
Wire Wire Line
4300 2450 4300 2600
Text Label 1800 5800 2 50 ~ 0
DAC5
Text Label 1800 5700 2 50 ~ 0
DAC4
Text Label 1800 5600 2 50 ~ 0
DAC3
Text Label 1800 5500 2 50 ~ 0
DAC2
Text Label 1800 5400 2 50 ~ 0
DAC1
Text Label 1800 5300 2 50 ~ 0
DAC0
Text Label 1800 5900 2 50 ~ 0
DAC6
Text Label 1800 6000 2 50 ~ 0
DAC7
Text Label 1800 6100 2 50 ~ 0
DAC8
Text Label 1800 6200 2 50 ~ 0
DAC9
Text Label 1800 6300 2 50 ~ 0
DAC10
Text Label 1800 6400 2 50 ~ 0
DAC11
Text Label 1800 6500 2 50 ~ 0
DAC12
Text Label 1800 6600 2 50 ~ 0
DAC13
$Comp
L Switch:SW_Push SW?
U 1 1 5DE938F9
P 950 1400
F 0 "SW?" V 904 1548 50 0000 L CNN
F 1 "SW_Push" V 995 1548 50 0000 L CNN
F 2 "" H 950 1600 50 0001 C CNN
F 3 "~" H 950 1600 50 0001 C CNN
1 950 1400
0 1 1 0
$EndComp
$Comp
L Switch:SW_Push SW?
U 1 1 5DE95103
P 950 2150
F 0 "SW?" V 904 2298 50 0000 L CNN
F 1 "SW_Push" V 995 2298 50 0000 L CNN
F 2 "" H 950 2350 50 0001 C CNN
F 3 "~" H 950 2350 50 0001 C CNN
1 950 2150
0 1 1 0
$EndComp
$Comp
L Switch:SW_Push SW?
U 1 1 5DE95459
P 950 2850
F 0 "SW?" V 904 2998 50 0000 L CNN
F 1 "SW_Push" V 995 2998 50 0000 L CNN
F 2 "" H 950 3050 50 0001 C CNN
F 3 "~" H 950 3050 50 0001 C CNN
1 950 2850
0 1 1 0
$EndComp
Text Label 950 1200 2 50 ~ 0
BUT0
Text Label 950 1950 2 50 ~ 0
BUT1
Text Label 950 2650 2 50 ~ 0
BUT2
$Comp
L power:GND #PWR?
U 1 1 5DE97876
P 950 1600
F 0 "#PWR?" H 950 1350 50 0001 C CNN
F 1 "GND" H 955 1427 50 0000 C CNN
F 2 "" H 950 1600 50 0001 C CNN
F 3 "" H 950 1600 50 0001 C CNN
1 950 1600
1 0 0 -1
$EndComp
$Comp
L power:GND #PWR?
U 1 1 5DE97EED
P 950 2350
F 0 "#PWR?" H 950 2100 50 0001 C CNN
F 1 "GND" H 955 2177 50 0000 C CNN
F 2 "" H 950 2350 50 0001 C CNN
F 3 "" H 950 2350 50 0001 C CNN
1 950 2350
1 0 0 -1
$EndComp
$Comp
L power:GND #PWR?
U 1 1 5DE98112
P 950 3050
F 0 "#PWR?" H 950 2800 50 0001 C CNN
F 1 "GND" H 955 2877 50 0000 C CNN
F 2 "" H 950 3050 50 0001 C CNN
F 3 "" H 950 3050 50 0001 C CNN
1 950 3050
1 0 0 -1
$EndComp
$Comp
L Regulator_Linear:AP2112K-3.3 U?
U 1 1 5DE99466
P 7600 4300
F 0 "U?" H 7600 4642 50 0000 C CNN
F 1 "AP2112K-3.3" H 7600 4551 50 0000 C CNN
F 2 "Package_TO_SOT_SMD:SOT-23-5" H 7600 4625 50 0001 C CNN
F 3 "https://www.diodes.com/assets/Datasheets/AP2112.pdf" H 7600 4400 50 0001 C CNN
1 7600 4300
1 0 0 -1
$EndComp
Wire Wire Line
7300 4200 7200 4200
Wire Wire Line
7200 4200 7200 4100
$Comp
L power:+5V #PWR?
U 1 1 5DEA3406
P 7200 4100
F 0 "#PWR?" H 7200 3950 50 0001 C CNN
F 1 "+5V" H 7215 4273 50 0000 C CNN
F 2 "" H 7200 4100 50 0001 C CNN
F 3 "" H 7200 4100 50 0001 C CNN
1 7200 4100
1 0 0 -1
$EndComp
Wire Wire Line
7300 4300 7200 4300
Wire Wire Line
7200 4300 7200 4200
Connection ~ 7200 4200
$Comp
L power:GND #PWR?
U 1 1 5DEA545A
P 7600 4600
F 0 "#PWR?" H 7600 4350 50 0001 C CNN
F 1 "GND" H 7605 4427 50 0000 C CNN
F 2 "" H 7600 4600 50 0001 C CNN
F 3 "" H 7600 4600 50 0001 C CNN
1 7600 4600
1 0 0 -1
$EndComp
Wire Wire Line
7900 4200 8050 4200
Wire Wire Line
8050 4200 8050 4100
$Comp
L power:+3V3 #PWR?
U 1 1 5DEA72CB
P 8050 4100
F 0 "#PWR?" H 8050 3950 50 0001 C CNN
F 1 "+3V3" H 8065 4273 50 0000 C CNN
F 2 "" H 8050 4100 50 0001 C CNN
F 3 "" H 8050 4100 50 0001 C CNN
1 8050 4100
1 0 0 -1
$EndComp
$EndSCHEMATC

4
hw/sym-lib-table Normal file
View File

@ -0,0 +1,4 @@
(sym_lib_table
(lib (name final)(type Legacy)(uri ${KIPRJMOD}/final.lib)(options "")(descr ""))
(lib (name final_project-rescue)(type Legacy)(uri ${KIPRJMOD}/final_project-rescue.lib)(options "")(descr ""))
)

19
lcd_disp/.vscode/c_cpp_properties.json vendored Normal file
View File

@ -0,0 +1,19 @@
{
"configurations": [
{
"name": "Linux",
"intelliSenseMode": "gcc-x64",
"compilerPath": "/usr/lib/ccache/avr-gcc",
"cStandard": "c99",
"cppStandard": "c++17",
"compilerArgs": [
"-Wall", "-pedantic", "-mmcu=attiy2313a"
],
"defines": [
"F_CPU=16000000",
"__"
]
}
],
"version": 4
}

3
lcd_disp/.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"C_Cpp.intelliSenseEngine": "Tag Parser"
}

19
lcd_disp/.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,19 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "make",
"type": "shell",
"command": "make",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [
"$gcc"
]
}
]
}

52
lcd_disp/Makefile Normal file
View File

@ -0,0 +1,52 @@
NAME := sd-reader
HEX := $(NAME).hex
OUT := $(NAME).out
MAP := $(NAME).map
SOURCES := $(wildcard *.c)
HEADERS := $(wildcard *.h)
OBJECTS := $(patsubst %.c,%.o,$(SOURCES))
MCU := attiny2313a
MCU_AVRDUDE := t2313
MCU_FREQ := 8000000UL
CC := avr-gcc
OBJCOPY := avr-objcopy
SIZE := avr-size -A
DOXYGEN := doxygen
CFLAGS := -Werror -Wall -pedantic -mmcu=$(MCU) -std=c99 -g -Os -DF_CPU=$(MCU_FREQ)
all: $(HEX)
clean:
rm -f $(HEX) $(OUT) $(MAP) $(OBJECTS)
rm -rf doc/html
flash: $(HEX)
avrdude -y -c avr910 -p $(MCU_AVRDUDE) -U flash:w:$(HEX)
$(HEX): $(OUT)
$(OBJCOPY) -R .eeprom -O ihex $< $@
$(OUT): $(OBJECTS)
$(CC) $(CFLAGS) -o $@ -Wl,-Map,$(MAP) $^
@echo
@$(SIZE) $@
@echo
%.o: %.c $(HEADERS)
$(CC) $(CFLAGS) -c -o $@ $<
%.pp: %.c
$(CC) $(CFLAGS) -E -o $@ $<
%.ppo: %.c
$(CC) $(CFLAGS) -E $<
doc: $(HEADERS) $(SOURCES) Doxyfile
$(DOXYGEN) Doxyfile
.PHONY: all clean flash doc

1
lcd_disp/comms.h Symbolic link
View File

@ -0,0 +1 @@
../comms/comms.h

BIN
lcd_disp/comms.o Normal file

Binary file not shown.

52
lcd_disp/fifo.c Normal file
View File

@ -0,0 +1,52 @@
#include "fifo.h"
static struct {
FIFO_TYPE buffer[FIFO_LEN];
uint16_t rd_ptr;
uint16_t wr_ptr;
uint16_t entries;
} fifo;
void fifo_init() {
fifo.rd_ptr = 0;
fifo.wr_ptr = 0;
fifo.entries = 0;
}
fifo_err_t fifo_pop(FIFO_TYPE* dest) {
// FIFO is empty, nothing to return!
if (fifo.entries == 0) {
return FIFO_EMPTY;
}
// Entries in FIFO, pop
*dest = fifo.buffer[fifo.rd_ptr];
fifo.rd_ptr++;
fifo.entries--;
// Ensure pointers don't overflow!
if (fifo.rd_ptr == FIFO_LEN) {
fifo.rd_ptr = 0;
}
return FIFO_SUCCESS;
}
fifo_err_t fifo_push(FIFO_TYPE src) {
// FIFO is full, don't store anything
if (fifo.entries == FIFO_LEN) {
return FIFO_FULL;
}
// FIFO has space, write
fifo.buffer[fifo.wr_ptr] = src;
fifo.wr_ptr++;
fifo.entries++;
// Ensure pointers don't overflow!
if (fifo.wr_ptr == FIFO_LEN) {
fifo.wr_ptr = 0;
}
return FIFO_SUCCESS;
}

36
lcd_disp/fifo.h Normal file
View File

@ -0,0 +1,36 @@
#ifndef FIFO_H_
#define FIFO_H_
#include <stdint.h>
typedef enum {
FIFO_SUCCESS,
FIFO_FULL,
FIFO_EMPTY
} fifo_err_t;
#define FIFO_LEN 20
#define FIFO_TYPE uint8_t
/** @brief Initialises FIFO
*
* This MUST be called before any other fifo_* functions are called.
* Unless memory is initialised to 0. Then it's fine I guess.
*/
void fifo_init();
/** @brief Pops most recent addition off of FIFO buffer.
*
* @retval FIFO_SUCCESS Successfully read data from FIFO
* @retval FIFO_EMPTY Buffer was empty, no data read
*/
fifo_err_t fifo_pop(FIFO_TYPE* dest);
/** @brief Pushes entry onto FIFO buffer.
*
* @retval FIFO_SUCCESS successfully wrote data to FIFO buffer
* @retval FIFO_FULL buffer, was full, no data written
*/
fifo_err_t fifo_push(FIFO_TYPE src);
#endif

BIN
lcd_disp/fifo.o Normal file

Binary file not shown.

592
lcd_disp/lcd.c Normal file
View File

@ -0,0 +1,592 @@
/****************************************************************************
Title: HD44780U LCD library
Author: Peter Fleury <pfleury@gmx.ch> http://tinyurl.com/peterfleury
File: $Id: lcd.c,v 1.15.2.2 2015/01/17 12:16:05 peter Exp $
Software: AVR-GCC 3.3
Target: any AVR device, memory mapped mode only for AT90S4414/8515/Mega
DESCRIPTION
Basic routines for interfacing a HD44780U-based text lcd display
Originally based on Volker Oth's lcd library,
changed lcd_init(), added additional constants for lcd_command(),
added 4-bit I/O mode, improved and optimized code.
Library can be operated in memory mapped mode (LCD_IO_MODE=0) or in
4-bit IO port mode (LCD_IO_MODE=1). 8-bit IO port mode not supported.
Memory mapped mode compatible with Kanda STK200, but supports also
generation of R/W signal through A8 address line.
USAGE
See the C include lcd.h file for a description of each function
*****************************************************************************/
#include <inttypes.h>
#include <avr/io.h>
#include <avr/pgmspace.h>
#include <util/delay.h>
#include "lcd.h"
/*
** constants/macros
*/
#define DDR(x) (*(&x - 1)) /* address of data direction register of port x */
#if defined(__AVR_ATmega64__) || defined(__AVR_ATmega128__)
/* on ATmega64/128 PINF is on port 0x00 and not 0x60 */
#define PIN(x) ( &PORTF==&(x) ? _SFR_IO8(0x00) : (*(&x - 2)) )
#else
#define PIN(x) (*(&x - 2)) /* address of input register of port x */
#endif
#if LCD_IO_MODE
#define lcd_e_delay() _delay_us(LCD_DELAY_ENABLE_PULSE)
#define lcd_e_high() LCD_E_PORT |= _BV(LCD_E_PIN);
#define lcd_e_low() LCD_E_PORT &= ~_BV(LCD_E_PIN);
#define lcd_e_toggle() toggle_e()
#define lcd_rw_high() LCD_RW_PORT |= _BV(LCD_RW_PIN)
#define lcd_rw_low() LCD_RW_PORT &= ~_BV(LCD_RW_PIN)
#define lcd_rs_high() LCD_RS_PORT |= _BV(LCD_RS_PIN)
#define lcd_rs_low() LCD_RS_PORT &= ~_BV(LCD_RS_PIN)
#endif
#if LCD_IO_MODE
#if LCD_LINES==1
#define LCD_FUNCTION_DEFAULT LCD_FUNCTION_4BIT_1LINE
#else
#define LCD_FUNCTION_DEFAULT LCD_FUNCTION_4BIT_2LINES
#endif
#else
#if LCD_LINES==1
#define LCD_FUNCTION_DEFAULT LCD_FUNCTION_8BIT_1LINE
#else
#define LCD_FUNCTION_DEFAULT LCD_FUNCTION_8BIT_2LINES
#endif
#endif
#if LCD_CONTROLLER_KS0073
#if LCD_LINES==4
#define KS0073_EXTENDED_FUNCTION_REGISTER_ON 0x2C /* |0|010|1100 4-bit mode, extension-bit RE = 1 */
#define KS0073_EXTENDED_FUNCTION_REGISTER_OFF 0x28 /* |0|010|1000 4-bit mode, extension-bit RE = 0 */
#define KS0073_4LINES_MODE 0x09 /* |0|000|1001 4 lines mode */
#endif
#endif
/*
** function prototypes
*/
#if LCD_IO_MODE
static void toggle_e(void);
#endif
/*
** local functions
*/
/*************************************************************************
delay for a minimum of <us> microseconds
the number of loops is calculated at compile-time from MCU clock frequency
*************************************************************************/
#define delay(us) _delay_us(us)
#if LCD_IO_MODE
/* toggle Enable Pin to initiate write */
static void toggle_e(void)
{
lcd_e_high();
lcd_e_delay();
lcd_e_low();
}
#endif
/*************************************************************************
Low-level function to write byte to LCD controller
Input: data byte to write to LCD
rs 1: write data
0: write instruction
Returns: none
*************************************************************************/
#if LCD_IO_MODE
static void lcd_write(uint8_t data,uint8_t rs)
{
unsigned char dataBits ;
if (rs) { /* write data (RS=1, RW=0) */
lcd_rs_high();
} else { /* write instruction (RS=0, RW=0) */
lcd_rs_low();
}
lcd_rw_low(); /* RW=0 write mode */
if ( ( &LCD_DATA0_PORT == &LCD_DATA1_PORT) && ( &LCD_DATA1_PORT == &LCD_DATA2_PORT ) && ( &LCD_DATA2_PORT == &LCD_DATA3_PORT )
&& (LCD_DATA0_PIN == 0) && (LCD_DATA1_PIN == 1) && (LCD_DATA2_PIN == 2) && (LCD_DATA3_PIN == 3) )
{
/* configure data pins as output */
DDR(LCD_DATA0_PORT) |= 0x0F;
/* output high nibble first */
dataBits = LCD_DATA0_PORT & 0xF0;
LCD_DATA0_PORT = dataBits |((data>>4)&0x0F);
lcd_e_toggle();
/* output low nibble */
LCD_DATA0_PORT = dataBits | (data&0x0F);
lcd_e_toggle();
/* all data pins high (inactive) */
LCD_DATA0_PORT = dataBits | 0x0F;
}
else
{
/* configure data pins as output */
DDR(LCD_DATA0_PORT) |= _BV(LCD_DATA0_PIN);
DDR(LCD_DATA1_PORT) |= _BV(LCD_DATA1_PIN);
DDR(LCD_DATA2_PORT) |= _BV(LCD_DATA2_PIN);
DDR(LCD_DATA3_PORT) |= _BV(LCD_DATA3_PIN);
/* output high nibble first */
LCD_DATA3_PORT &= ~_BV(LCD_DATA3_PIN);
LCD_DATA2_PORT &= ~_BV(LCD_DATA2_PIN);
LCD_DATA1_PORT &= ~_BV(LCD_DATA1_PIN);
LCD_DATA0_PORT &= ~_BV(LCD_DATA0_PIN);
if(data & 0x80) LCD_DATA3_PORT |= _BV(LCD_DATA3_PIN);
if(data & 0x40) LCD_DATA2_PORT |= _BV(LCD_DATA2_PIN);
if(data & 0x20) LCD_DATA1_PORT |= _BV(LCD_DATA1_PIN);
if(data & 0x10) LCD_DATA0_PORT |= _BV(LCD_DATA0_PIN);
lcd_e_toggle();
/* output low nibble */
LCD_DATA3_PORT &= ~_BV(LCD_DATA3_PIN);
LCD_DATA2_PORT &= ~_BV(LCD_DATA2_PIN);
LCD_DATA1_PORT &= ~_BV(LCD_DATA1_PIN);
LCD_DATA0_PORT &= ~_BV(LCD_DATA0_PIN);
if(data & 0x08) LCD_DATA3_PORT |= _BV(LCD_DATA3_PIN);
if(data & 0x04) LCD_DATA2_PORT |= _BV(LCD_DATA2_PIN);
if(data & 0x02) LCD_DATA1_PORT |= _BV(LCD_DATA1_PIN);
if(data & 0x01) LCD_DATA0_PORT |= _BV(LCD_DATA0_PIN);
lcd_e_toggle();
/* all data pins high (inactive) */
LCD_DATA0_PORT |= _BV(LCD_DATA0_PIN);
LCD_DATA1_PORT |= _BV(LCD_DATA1_PIN);
LCD_DATA2_PORT |= _BV(LCD_DATA2_PIN);
LCD_DATA3_PORT |= _BV(LCD_DATA3_PIN);
}
}
#else
#define lcd_write(d,rs) if (rs) *(volatile uint8_t*)(LCD_IO_DATA) = d; else *(volatile uint8_t*)(LCD_IO_FUNCTION) = d;
/* rs==0 -> write instruction to LCD_IO_FUNCTION */
/* rs==1 -> write data to LCD_IO_DATA */
#endif
/*************************************************************************
Low-level function to read byte from LCD controller
Input: rs 1: read data
0: read busy flag / address counter
Returns: byte read from LCD controller
*************************************************************************/
#if LCD_IO_MODE
static uint8_t lcd_read(uint8_t rs)
{
uint8_t data;
if (rs)
lcd_rs_high(); /* RS=1: read data */
else
lcd_rs_low(); /* RS=0: read busy flag */
lcd_rw_high(); /* RW=1 read mode */
if ( ( &LCD_DATA0_PORT == &LCD_DATA1_PORT) && ( &LCD_DATA1_PORT == &LCD_DATA2_PORT ) && ( &LCD_DATA2_PORT == &LCD_DATA3_PORT )
&& ( LCD_DATA0_PIN == 0 )&& (LCD_DATA1_PIN == 1) && (LCD_DATA2_PIN == 2) && (LCD_DATA3_PIN == 3) )
{
DDR(LCD_DATA0_PORT) &= 0xF0; /* configure data pins as input */
lcd_e_high();
lcd_e_delay();
data = PIN(LCD_DATA0_PORT) << 4; /* read high nibble first */
lcd_e_low();
lcd_e_delay(); /* Enable 500ns low */
lcd_e_high();
lcd_e_delay();
data |= PIN(LCD_DATA0_PORT)&0x0F; /* read low nibble */
lcd_e_low();
}
else
{
/* configure data pins as input */
DDR(LCD_DATA0_PORT) &= ~_BV(LCD_DATA0_PIN);
DDR(LCD_DATA1_PORT) &= ~_BV(LCD_DATA1_PIN);
DDR(LCD_DATA2_PORT) &= ~_BV(LCD_DATA2_PIN);
DDR(LCD_DATA3_PORT) &= ~_BV(LCD_DATA3_PIN);
/* read high nibble first */
lcd_e_high();
lcd_e_delay();
data = 0;
if ( PIN(LCD_DATA0_PORT) & _BV(LCD_DATA0_PIN) ) data |= 0x10;
if ( PIN(LCD_DATA1_PORT) & _BV(LCD_DATA1_PIN) ) data |= 0x20;
if ( PIN(LCD_DATA2_PORT) & _BV(LCD_DATA2_PIN) ) data |= 0x40;
if ( PIN(LCD_DATA3_PORT) & _BV(LCD_DATA3_PIN) ) data |= 0x80;
lcd_e_low();
lcd_e_delay(); /* Enable 500ns low */
/* read low nibble */
lcd_e_high();
lcd_e_delay();
if ( PIN(LCD_DATA0_PORT) & _BV(LCD_DATA0_PIN) ) data |= 0x01;
if ( PIN(LCD_DATA1_PORT) & _BV(LCD_DATA1_PIN) ) data |= 0x02;
if ( PIN(LCD_DATA2_PORT) & _BV(LCD_DATA2_PIN) ) data |= 0x04;
if ( PIN(LCD_DATA3_PORT) & _BV(LCD_DATA3_PIN) ) data |= 0x08;
lcd_e_low();
}
return data;
}
#else
#define lcd_read(rs) (rs) ? *(volatile uint8_t*)(LCD_IO_DATA+LCD_IO_READ) : *(volatile uint8_t*)(LCD_IO_FUNCTION+LCD_IO_READ)
/* rs==0 -> read instruction from LCD_IO_FUNCTION */
/* rs==1 -> read data from LCD_IO_DATA */
#endif
/*************************************************************************
loops while lcd is busy, returns address counter
*************************************************************************/
static uint8_t lcd_waitbusy(void)
{
register uint8_t c;
/* wait until busy flag is cleared */
while ( (c=lcd_read(0)) & (1<<LCD_BUSY)) {}
/* the address counter is updated 4us after the busy flag is cleared */
delay(LCD_DELAY_BUSY_FLAG);
/* now read the address counter */
return (lcd_read(0)); // return address counter
}/* lcd_waitbusy */
/*************************************************************************
Move cursor to the start of next line or to the first line if the cursor
is already on the last line.
*************************************************************************/
static inline void lcd_newline(uint8_t pos)
{
register uint8_t addressCounter;
#if LCD_LINES==1
addressCounter = 0;
#endif
#if LCD_LINES==2
if ( pos < (LCD_START_LINE2) )
addressCounter = LCD_START_LINE2;
else
addressCounter = LCD_START_LINE1;
#endif
#if LCD_LINES==4
#if KS0073_4LINES_MODE
if ( pos < LCD_START_LINE2 )
addressCounter = LCD_START_LINE2;
else if ( (pos >= LCD_START_LINE2) && (pos < LCD_START_LINE3) )
addressCounter = LCD_START_LINE3;
else if ( (pos >= LCD_START_LINE3) && (pos < LCD_START_LINE4) )
addressCounter = LCD_START_LINE4;
else
addressCounter = LCD_START_LINE1;
#else
if ( pos < LCD_START_LINE3 )
addressCounter = LCD_START_LINE2;
else if ( (pos >= LCD_START_LINE2) && (pos < LCD_START_LINE4) )
addressCounter = LCD_START_LINE3;
else if ( (pos >= LCD_START_LINE3) && (pos < LCD_START_LINE2) )
addressCounter = LCD_START_LINE4;
else
addressCounter = LCD_START_LINE1;
#endif
#endif
lcd_command((1<<LCD_DDRAM)+addressCounter);
}/* lcd_newline */
/*
** PUBLIC FUNCTIONS
*/
/*************************************************************************
Send LCD controller instruction command
Input: instruction to send to LCD controller, see HD44780 data sheet
Returns: none
*************************************************************************/
void lcd_command(uint8_t cmd)
{
lcd_waitbusy();
lcd_write(cmd,0);
}
/*************************************************************************
Send data byte to LCD controller
Input: data to send to LCD controller, see HD44780 data sheet
Returns: none
*************************************************************************/
void lcd_data(uint8_t data)
{
lcd_waitbusy();
lcd_write(data,1);
}
/*************************************************************************
Set cursor to specified position
Input: x horizontal position (0: left most position)
y vertical position (0: first line)
Returns: none
*************************************************************************/
void lcd_gotoxy(uint8_t x, uint8_t y)
{
#if LCD_LINES==1
lcd_command((1<<LCD_DDRAM)+LCD_START_LINE1+x);
#endif
#if LCD_LINES==2
if ( y==0 )
lcd_command((1<<LCD_DDRAM)+LCD_START_LINE1+x);
else
lcd_command((1<<LCD_DDRAM)+LCD_START_LINE2+x);
#endif
#if LCD_LINES==4
if ( y==0 )
lcd_command((1<<LCD_DDRAM)+LCD_START_LINE1+x);
else if ( y==1)
lcd_command((1<<LCD_DDRAM)+LCD_START_LINE2+x);
else if ( y==2)
lcd_command((1<<LCD_DDRAM)+LCD_START_LINE3+x);
else /* y==3 */
lcd_command((1<<LCD_DDRAM)+LCD_START_LINE4+x);
#endif
}/* lcd_gotoxy */
/*************************************************************************
*************************************************************************/
int lcd_getxy(void)
{
return lcd_waitbusy();
}
/*************************************************************************
Clear display and set cursor to home position
*************************************************************************/
void lcd_clrscr(void)
{
lcd_command(1<<LCD_CLR);
}
/*************************************************************************
Set cursor to home position
*************************************************************************/
void lcd_home(void)
{
lcd_command(1<<LCD_HOME);
}
/*************************************************************************
Display character at current cursor position
Input: character to be displayed
Returns: none
*************************************************************************/
void lcd_putc(char c)
{
uint8_t pos;
pos = lcd_waitbusy(); // read busy-flag and address counter
if (c=='\n')
{
lcd_newline(pos);
}
else
{
#if LCD_WRAP_LINES==1
#if LCD_LINES==1
if ( pos == LCD_START_LINE1+LCD_DISP_LENGTH ) {
lcd_write((1<<LCD_DDRAM)+LCD_START_LINE1,0);
}
#elif LCD_LINES==2
if ( pos == LCD_START_LINE1+LCD_DISP_LENGTH ) {
lcd_write((1<<LCD_DDRAM)+LCD_START_LINE2,0);
}else if ( pos == LCD_START_LINE2+LCD_DISP_LENGTH ){
lcd_write((1<<LCD_DDRAM)+LCD_START_LINE1,0);
}
#elif LCD_LINES==4
if ( pos == LCD_START_LINE1+LCD_DISP_LENGTH ) {
lcd_write((1<<LCD_DDRAM)+LCD_START_LINE2,0);
}else if ( pos == LCD_START_LINE2+LCD_DISP_LENGTH ) {
lcd_write((1<<LCD_DDRAM)+LCD_START_LINE3,0);
}else if ( pos == LCD_START_LINE3+LCD_DISP_LENGTH ) {
lcd_write((1<<LCD_DDRAM)+LCD_START_LINE4,0);
}else if ( pos == LCD_START_LINE4+LCD_DISP_LENGTH ) {
lcd_write((1<<LCD_DDRAM)+LCD_START_LINE1,0);
}
#endif
lcd_waitbusy();
#endif
lcd_write(c, 1);
}
}/* lcd_putc */
/*************************************************************************
Display string without auto linefeed
Input: string to be displayed
Returns: none
*************************************************************************/
void lcd_puts(const char *s)
/* print string on lcd (no auto linefeed) */
{
register char c;
while ( (c = *s++) ) {
lcd_putc(c);
}
}/* lcd_puts */
/*************************************************************************
Display string from program memory without auto linefeed
Input: string from program memory be be displayed
Returns: none
*************************************************************************/
void lcd_puts_p(const char *progmem_s)
/* print string from program memory on lcd (no auto linefeed) */
{
register char c;
while ( (c = pgm_read_byte(progmem_s++)) ) {
lcd_putc(c);
}
}/* lcd_puts_p */
/*************************************************************************
Initialize display and select type of cursor
Input: dispAttr LCD_DISP_OFF display off
LCD_DISP_ON display on, cursor off
LCD_DISP_ON_CURSOR display on, cursor on
LCD_DISP_CURSOR_BLINK display on, cursor on flashing
Returns: none
*************************************************************************/
void lcd_init(uint8_t dispAttr)
{
#if LCD_IO_MODE
/*
* Initialize LCD to 4 bit I/O mode
*/
if ( ( &LCD_DATA0_PORT == &LCD_DATA1_PORT) && ( &LCD_DATA1_PORT == &LCD_DATA2_PORT ) && ( &LCD_DATA2_PORT == &LCD_DATA3_PORT )
&& ( &LCD_RS_PORT == &LCD_DATA0_PORT) && ( &LCD_RW_PORT == &LCD_DATA0_PORT) && (&LCD_E_PORT == &LCD_DATA0_PORT)
&& (LCD_DATA0_PIN == 0 ) && (LCD_DATA1_PIN == 1) && (LCD_DATA2_PIN == 2) && (LCD_DATA3_PIN == 3)
&& (LCD_RS_PIN == 4 ) && (LCD_RW_PIN == 5) && (LCD_E_PIN == 6 ) )
{
/* configure all port bits as output (all LCD lines on same port) */
DDR(LCD_DATA0_PORT) |= 0x7F;
}
else if ( ( &LCD_DATA0_PORT == &LCD_DATA1_PORT) && ( &LCD_DATA1_PORT == &LCD_DATA2_PORT ) && ( &LCD_DATA2_PORT == &LCD_DATA3_PORT )
&& (LCD_DATA0_PIN == 0 ) && (LCD_DATA1_PIN == 1) && (LCD_DATA2_PIN == 2) && (LCD_DATA3_PIN == 3) )
{
/* configure all port bits as output (all LCD data lines on same port, but control lines on different ports) */
DDR(LCD_DATA0_PORT) |= 0x0F;
DDR(LCD_RS_PORT) |= _BV(LCD_RS_PIN);
DDR(LCD_RW_PORT) |= _BV(LCD_RW_PIN);
DDR(LCD_E_PORT) |= _BV(LCD_E_PIN);
}
else
{
/* configure all port bits as output (LCD data and control lines on different ports */
DDR(LCD_RS_PORT) |= _BV(LCD_RS_PIN);
DDR(LCD_RW_PORT) |= _BV(LCD_RW_PIN);
DDR(LCD_E_PORT) |= _BV(LCD_E_PIN);
DDR(LCD_DATA0_PORT) |= _BV(LCD_DATA0_PIN);
DDR(LCD_DATA1_PORT) |= _BV(LCD_DATA1_PIN);
DDR(LCD_DATA2_PORT) |= _BV(LCD_DATA2_PIN);
DDR(LCD_DATA3_PORT) |= _BV(LCD_DATA3_PIN);
}
delay(LCD_DELAY_BOOTUP); /* wait 16ms or more after power-on */
/* initial write to lcd is 8bit */
LCD_DATA1_PORT |= _BV(LCD_DATA1_PIN); // LCD_FUNCTION>>4;
LCD_DATA0_PORT |= _BV(LCD_DATA0_PIN); // LCD_FUNCTION_8BIT>>4;
lcd_e_toggle();
delay(LCD_DELAY_INIT); /* delay, busy flag can't be checked here */
/* repeat last command */
lcd_e_toggle();
delay(LCD_DELAY_INIT_REP); /* delay, busy flag can't be checked here */
/* repeat last command a third time */
lcd_e_toggle();
delay(LCD_DELAY_INIT_REP); /* delay, busy flag can't be checked here */
/* now configure for 4bit mode */
LCD_DATA0_PORT &= ~_BV(LCD_DATA0_PIN); // LCD_FUNCTION_4BIT_1LINE>>4
lcd_e_toggle();
delay(LCD_DELAY_INIT_4BIT); /* some displays need this additional delay */
/* from now the LCD only accepts 4 bit I/O, we can use lcd_command() */
#else
/*
* Initialize LCD to 8 bit memory mapped mode
*/
/* enable external SRAM (memory mapped lcd) and one wait state */
MCUCR = _BV(SRE) | _BV(SRW);
/* reset LCD */
delay(LCD_DELAY_BOOTUP); /* wait 16ms after power-on */
lcd_write(LCD_FUNCTION_8BIT_1LINE,0); /* function set: 8bit interface */
delay(LCD_DELAY_INIT); /* wait 5ms */
lcd_write(LCD_FUNCTION_8BIT_1LINE,0); /* function set: 8bit interface */
delay(LCD_DELAY_INIT_REP); /* wait 64us */
lcd_write(LCD_FUNCTION_8BIT_1LINE,0); /* function set: 8bit interface */
delay(LCD_DELAY_INIT_REP); /* wait 64us */
#endif
#if KS0073_4LINES_MODE
/* Display with KS0073 controller requires special commands for enabling 4 line mode */
lcd_command(KS0073_EXTENDED_FUNCTION_REGISTER_ON);
lcd_command(KS0073_4LINES_MODE);
lcd_command(KS0073_EXTENDED_FUNCTION_REGISTER_OFF);
#else
lcd_command(LCD_FUNCTION_DEFAULT); /* function set: display lines */
#endif
lcd_command(LCD_DISP_OFF); /* display off */
lcd_clrscr(); /* display clear */
lcd_command(LCD_MODE_DEFAULT); /* set entry mode */
lcd_command(dispAttr); /* display/cursor control */
}/* lcd_init */

369
lcd_disp/lcd.h Normal file
View File

@ -0,0 +1,369 @@
#ifndef LCD_H
#define LCD_H
/*************************************************************************
Title : C include file for the HD44780U LCD library (lcd.c)
Author: Peter Fleury <pfleury@gmx.ch> http://tinyurl.com/peterfleury
File: $Id: lcd.h,v 1.14.2.4 2015/01/20 17:16:07 peter Exp $
Software: AVR-GCC 4.x
Hardware: any AVR device, memory mapped mode only for AVR with
memory mapped interface (AT90S8515/ATmega8515/ATmega128)
***************************************************************************/
/**
@mainpage
Collection of libraries for AVR-GCC
@author Peter Fleury pfleury@gmx.ch http://tinyurl.com/peterfleury
@copyright (C) 2015 Peter Fleury, GNU General Public License Version 3
@file
@defgroup pfleury_lcd LCD library <lcd.h>
@code #include <lcd.h> @endcode
@brief Basic routines for interfacing a HD44780U-based character LCD display
LCD character displays can be found in many devices, like espresso machines, laser printers.
The Hitachi HD44780 controller and its compatible controllers like Samsung KS0066U have become an industry standard for these types of displays.
This library allows easy interfacing with a HD44780 compatible display and can be
operated in memory mapped mode (LCD_IO_MODE defined as 0 in the include file lcd.h.) or in
4-bit IO port mode (LCD_IO_MODE defined as 1). 8-bit IO port mode is not supported.
Memory mapped mode is compatible with old Kanda STK200 starter kit, but also supports
generation of R/W signal through A8 address line.
@see The chapter <a href=" http://homepage.hispeed.ch/peterfleury/avr-lcd44780.html" target="_blank">Interfacing a HD44780 Based LCD to an AVR</a>
on my home page, which shows example circuits how to connect an LCD to an AVR controller.
@author Peter Fleury pfleury@gmx.ch http://tinyurl.com/peterfleury
@version 2.0
@copyright (C) 2015 Peter Fleury, GNU General Public License Version 3
*/
#include <inttypes.h>
#include <avr/pgmspace.h>
#if (__GNUC__ * 100 + __GNUC_MINOR__) < 405
#error "This library requires AVR-GCC 4.5 or later, update to newer AVR-GCC compiler !"
#endif
/**@{*/
/*
* LCD and target specific definitions below can be defined in a separate include file with name lcd_definitions.h instead modifying this file
* by adding -D_LCD_DEFINITIONS_FILE to the CDEFS section in the Makefile
* All definitions added to the file lcd_definitions.h will override the default definitions from lcd.h
*/
#ifdef _LCD_DEFINITIONS_FILE
#include "lcd_definitions.h"
#endif
/**
* @name Definition for LCD controller type
* Use 0 for HD44780 controller, change to 1 for displays with KS0073 controller.
*/
#ifndef LCD_CONTROLLER_KS0073
#define LCD_CONTROLLER_KS0073 0 /**< Use 0 for HD44780 controller, 1 for KS0073 controller */
#endif
/**
* @name Definitions for Display Size
* Change these definitions to adapt setting to your display
*
* These definitions can be defined in a separate include file \b lcd_definitions.h instead modifying this file by
* adding -D_LCD_DEFINITIONS_FILE to the CDEFS section in the Makefile.
* All definitions added to the file lcd_definitions.h will override the default definitions from lcd.h
*
*/
#ifndef LCD_LINES
#define LCD_LINES 2 /**< number of visible lines of the display */
#endif
#ifndef LCD_DISP_LENGTH
#define LCD_DISP_LENGTH 16 /**< visibles characters per line of the display */
#endif
#ifndef LCD_LINE_LENGTH
#define LCD_LINE_LENGTH 0x40 /**< internal line length of the display */
#endif
#ifndef LCD_START_LINE1
#define LCD_START_LINE1 0x00 /**< DDRAM address of first char of line 1 */
#endif
#ifndef LCD_START_LINE2
#define LCD_START_LINE2 0x40 /**< DDRAM address of first char of line 2 */
#endif
#ifndef LCD_START_LINE3
#define LCD_START_LINE3 0x14 /**< DDRAM address of first char of line 3 */
#endif
#ifndef LCD_START_LINE4
#define LCD_START_LINE4 0x54 /**< DDRAM address of first char of line 4 */
#endif
#ifndef LCD_WRAP_LINES
#define LCD_WRAP_LINES 0 /**< 0: no wrap, 1: wrap at end of visibile line */
#endif
/**
* @name Definitions for 4-bit IO mode
*
* The four LCD data lines and the three control lines RS, RW, E can be on the
* same port or on different ports.
* Change LCD_RS_PORT, LCD_RW_PORT, LCD_E_PORT if you want the control lines on
* different ports.
*
* Normally the four data lines should be mapped to bit 0..3 on one port, but it
* is possible to connect these data lines in different order or even on different
* ports by adapting the LCD_DATAx_PORT and LCD_DATAx_PIN definitions.
*
* Adjust these definitions to your target.\n
* These definitions can be defined in a separate include file \b lcd_definitions.h instead modifying this file by
* adding \b -D_LCD_DEFINITIONS_FILE to the \b CDEFS section in the Makefile.
* All definitions added to the file lcd_definitions.h will override the default definitions from lcd.h
*
*/
#define LCD_IO_MODE 1 /**< 0: memory mapped mode, 1: IO port mode */
#if LCD_IO_MODE
#ifndef LCD_PORT
#define LCD_PORT PORTB /**< port for the LCD lines */
#endif
#ifndef LCD_DATA0_PORT
#define LCD_DATA0_PORT LCD_PORT /**< port for 4bit data bit 0 */
#endif
#ifndef LCD_DATA1_PORT
#define LCD_DATA1_PORT LCD_PORT /**< port for 4bit data bit 1 */
#endif
#ifndef LCD_DATA2_PORT
#define LCD_DATA2_PORT LCD_PORT /**< port for 4bit data bit 2 */
#endif
#ifndef LCD_DATA3_PORT
#define LCD_DATA3_PORT LCD_PORT /**< port for 4bit data bit 3 */
#endif
#ifndef LCD_DATA0_PIN
#define LCD_DATA0_PIN 5 /**< pin for 4bit data bit 0 */
#endif
#ifndef LCD_DATA1_PIN
#define LCD_DATA1_PIN 4 /**< pin for 4bit data bit 1 */
#endif
#ifndef LCD_DATA2_PIN
#define LCD_DATA2_PIN 3 /**< pin for 4bit data bit 2 */
#endif
#ifndef LCD_DATA3_PIN
#define LCD_DATA3_PIN 2 /**< pin for 4bit data bit 3 */
#endif
#ifndef LCD_RS_PORT
#define LCD_RS_PORT PORTD /**< port for RS line */
#endif
#ifndef LCD_RS_PIN
#define LCD_RS_PIN 0 /**< pin for RS line */
#endif
#ifndef LCD_RW_PORT
#define LCD_RW_PORT PORTD /**< port for RW line */
#endif
#ifndef LCD_RW_PIN
#define LCD_RW_PIN 1 /**< pin for RW line */
#endif
#ifndef LCD_E_PORT
#define LCD_E_PORT PORTD /**< port for Enable line */
#endif
#ifndef LCD_E_PIN
#define LCD_E_PIN 2 /**< pin for Enable line */
#endif
#elif defined(__AVR_AT90S4414__) || defined(__AVR_AT90S8515__) || defined(__AVR_ATmega64__) || \
defined(__AVR_ATmega8515__)|| defined(__AVR_ATmega103__) || defined(__AVR_ATmega128__) || \
defined(__AVR_ATmega161__) || defined(__AVR_ATmega162__)
/*
* memory mapped mode is only supported when the device has an external data memory interface
*/
#define LCD_IO_DATA 0xC000 /* A15=E=1, A14=RS=1 */
#define LCD_IO_FUNCTION 0x8000 /* A15=E=1, A14=RS=0 */
#define LCD_IO_READ 0x0100 /* A8 =R/W=1 (R/W: 1=Read, 0=Write */
#else
#error "external data memory interface not available for this device, use 4-bit IO port mode"
#endif
/**
* @name Definitions of delays
* Used to calculate delay timers.
* Adapt the F_CPU define in the Makefile to the clock frequency in Hz of your target
*
* These delay times can be adjusted, if some displays require different delays.\n
* These definitions can be defined in a separate include file \b lcd_definitions.h instead modifying this file by
* adding \b -D_LCD_DEFINITIONS_FILE to the \b CDEFS section in the Makefile.
* All definitions added to the file lcd_definitions.h will override the default definitions from lcd.h
*/
#ifndef LCD_DELAY_BOOTUP
#define LCD_DELAY_BOOTUP 16000 /**< delay in micro seconds after power-on */
#endif
#ifndef LCD_DELAY_INIT
#define LCD_DELAY_INIT 5000 /**< delay in micro seconds after initialization command sent */
#endif
#ifndef LCD_DELAY_INIT_REP
#define LCD_DELAY_INIT_REP 64 /**< delay in micro seconds after initialization command repeated */
#endif
#ifndef LCD_DELAY_INIT_4BIT
#define LCD_DELAY_INIT_4BIT 64 /**< delay in micro seconds after setting 4-bit mode */
#endif
#ifndef LCD_DELAY_BUSY_FLAG
#define LCD_DELAY_BUSY_FLAG 4 /**< time in micro seconds the address counter is updated after busy flag is cleared */
#endif
#ifndef LCD_DELAY_ENABLE_PULSE
#define LCD_DELAY_ENABLE_PULSE 1 /**< enable signal pulse width in micro seconds */
#endif
/**
* @name Definitions for LCD command instructions
* The constants define the various LCD controller instructions which can be passed to the
* function lcd_command(), see HD44780 data sheet for a complete description.
*/
/* instruction register bit positions, see HD44780U data sheet */
#define LCD_CLR 0 /* DB0: clear display */
#define LCD_HOME 1 /* DB1: return to home position */
#define LCD_ENTRY_MODE 2 /* DB2: set entry mode */
#define LCD_ENTRY_INC 1 /* DB1: 1=increment, 0=decrement */
#define LCD_ENTRY_SHIFT 0 /* DB2: 1=display shift on */
#define LCD_ON 3 /* DB3: turn lcd/cursor on */
#define LCD_ON_DISPLAY 2 /* DB2: turn display on */
#define LCD_ON_CURSOR 1 /* DB1: turn cursor on */
#define LCD_ON_BLINK 0 /* DB0: blinking cursor ? */
#define LCD_MOVE 4 /* DB4: move cursor/display */
#define LCD_MOVE_DISP 3 /* DB3: move display (0-> cursor) ? */
#define LCD_MOVE_RIGHT 2 /* DB2: move right (0-> left) ? */
#define LCD_FUNCTION 5 /* DB5: function set */
#define LCD_FUNCTION_8BIT 4 /* DB4: set 8BIT mode (0->4BIT mode) */
#define LCD_FUNCTION_2LINES 3 /* DB3: two lines (0->one line) */
#define LCD_FUNCTION_10DOTS 2 /* DB2: 5x10 font (0->5x7 font) */
#define LCD_CGRAM 6 /* DB6: set CG RAM address */
#define LCD_DDRAM 7 /* DB7: set DD RAM address */
#define LCD_BUSY 7 /* DB7: LCD is busy */
/* set entry mode: display shift on/off, dec/inc cursor move direction */
#define LCD_ENTRY_DEC 0x04 /* display shift off, dec cursor move dir */
#define LCD_ENTRY_DEC_SHIFT 0x05 /* display shift on, dec cursor move dir */
#define LCD_ENTRY_INC_ 0x06 /* display shift off, inc cursor move dir */
#define LCD_ENTRY_INC_SHIFT 0x07 /* display shift on, inc cursor move dir */
/* display on/off, cursor on/off, blinking char at cursor position */
#define LCD_DISP_OFF 0x08 /* display off */
#define LCD_DISP_ON 0x0C /* display on, cursor off */
#define LCD_DISP_ON_BLINK 0x0D /* display on, cursor off, blink char */
#define LCD_DISP_ON_CURSOR 0x0E /* display on, cursor on */
#define LCD_DISP_ON_CURSOR_BLINK 0x0F /* display on, cursor on, blink char */
/* move cursor/shift display */
#define LCD_MOVE_CURSOR_LEFT 0x10 /* move cursor left (decrement) */
#define LCD_MOVE_CURSOR_RIGHT 0x14 /* move cursor right (increment) */
#define LCD_MOVE_DISP_LEFT 0x18 /* shift display left */
#define LCD_MOVE_DISP_RIGHT 0x1C /* shift display right */
/* function set: set interface data length and number of display lines */
#define LCD_FUNCTION_4BIT_1LINE 0x20 /* 4-bit interface, single line, 5x7 dots */
#define LCD_FUNCTION_4BIT_2LINES 0x28 /* 4-bit interface, dual line, 5x7 dots */
#define LCD_FUNCTION_8BIT_1LINE 0x30 /* 8-bit interface, single line, 5x7 dots */
#define LCD_FUNCTION_8BIT_2LINES 0x38 /* 8-bit interface, dual line, 5x7 dots */
#define LCD_MODE_DEFAULT ((1<<LCD_ENTRY_MODE) | (1<<LCD_ENTRY_INC) )
/**
* @name Functions
*/
/**
@brief Initialize display and select type of cursor
@param dispAttr \b LCD_DISP_OFF display off\n
\b LCD_DISP_ON display on, cursor off\n
\b LCD_DISP_ON_CURSOR display on, cursor on\n
\b LCD_DISP_ON_CURSOR_BLINK display on, cursor on flashing
@return none
*/
extern void lcd_init(uint8_t dispAttr);
/**
@brief Clear display and set cursor to home position
@return none
*/
extern void lcd_clrscr(void);
/**
@brief Set cursor to home position
@return none
*/
extern void lcd_home(void);
/**
@brief Set cursor to specified position
@param x horizontal position\n (0: left most position)
@param y vertical position\n (0: first line)
@return none
*/
extern void lcd_gotoxy(uint8_t x, uint8_t y);
/**
@brief Display character at current cursor position
@param c character to be displayed
@return none
*/
extern void lcd_putc(char c);
/**
@brief Display string without auto linefeed
@param s string to be displayed
@return none
*/
extern void lcd_puts(const char *s);
/**
@brief Display string from program memory without auto linefeed
@param progmem_s string from program memory be be displayed
@return none
@see lcd_puts_P
*/
extern void lcd_puts_p(const char *progmem_s);
/**
@brief Send LCD controller instruction command
@param cmd instruction to send to LCD controller, see HD44780 data sheet
@return none
*/
extern void lcd_command(uint8_t cmd);
/**
@brief Send data byte to LCD controller
Similar to lcd_putc(), but without interpreting LF
@param data byte to send to LCD controller, see HD44780 data sheet
@return none
*/
extern void lcd_data(uint8_t data);
/**
@brief macros for automatically storing string constant in program memory
*/
#define lcd_puts_P(__s) lcd_puts_p(PSTR(__s))
/**@}*/
#endif //LCD_H

BIN
lcd_disp/lcd.o Normal file

Binary file not shown.

172
lcd_disp/main.c Normal file
View File

@ -0,0 +1,172 @@
#include "main.h"
/* ---- Global Flags ---- */
int8_t display_song = -1; //! ID of the song currently being displayed, -1 if song list is not initialised
int8_t last_displayed_song = -1;
int8_t selected_song = -1; //! ID of the selected song. -1 if no song is selected.
bool update_display = false; //! flag on whether or not to update display
struct {
char name[SONG_NAME_LEN + 1]; //! array of all song names, names are allocated on heap
uint8_t num_songs; //! Number of songs loaded into display memory
bool playing; //! Whether the currently selected song is playing
} songs;
/** @brief Handles right button press
*/
void handle_left_press() {
if (songs.num_songs == 0) {
lcd_clrscr();
lcd_puts("No songs to play!");
} else {
// Choose lower ID song. Wrap around.
display_song--;
if (display_song == 0) {
display_song = songs.num_songs - 1;
}
}
}
/** @brief Handles left button press
*/
void handle_right_press() {
if (songs.num_songs == 0) {
lcd_clrscr();
lcd_puts("No songs to play!");
} else {
// Choose higher ID song. Wrap around.
display_song++;
if (display_song == songs.num_songs) {
display_song = 0;
}
}
}
/** @brief Handles playpause button press.
*
* Based on selected song and displayed song, will select new song
* or play/pause song.
*/
void handle_playpause_press() {
// If there are no songs displayed, error
if (display_song == -1) {
lcd_clrscr();
lcd_puts("No songs to play!");
return;
}
// If no song selected, select the correct one.
if (selected_song == -1) {
comms_select_file(display_song);
return;
}
// Song selected, send play/pause
if (songs.playing) {
comms_pause();
songs.playing = false;
} else {
comms_play();
songs.playing = true;
}
return;
}
int main() {
// Scratch variables
uint8_t incoming_cmd = 0;
fifo_init();
gpio_init();
usart_init();
lcd_init(LCD_DISP_ON);
lcd_clrscr();
lcd_gotoxy(0,0);
// Main loop
while (1) {
// Handle incoming messages
if (fifo_pop(&incoming_cmd) == FIFO_SUCCESS) {
switch (incoming_cmd) {
// Clear songs, so there are none to display
case (COMMS_CMD_CLR):
songs.num_songs = 0;
display_song = -1;
break;
// change number of songs
case (COMMS_CMD_NUM):
while(fifo_pop((FIFO_TYPE*) &songs.num_songs) != FIFO_SUCCESS);
break;
default:
lcd_clrscr();
lcd_puts("Incorrect command!");
break;
}
}
// Handle "left" button press
if (BUTTONS_PORT & (1 << BUTTONS_LEFT_PIN)) {
handle_left_press();
_delay_ms(100); // Delay to debounce
}
// Handle "right" button press
if (BUTTONS_PORT & (1 << BUTTONS_LEFT_PIN)) {
handle_left_press();
_delay_ms(100); // Delay to debounce
}
// Handle play/pause button press
if (BUTTONS_PORT & (1 << BUTTONS_LEFT_PIN)) {
handle_left_press();
_delay_ms(100); // Delay to debounce
}
// Update display periodically
if (update_display) {
// check if song has changed
if (last_displayed_song != display_song) {
comms_query_name(display_song);
char tmp_chr;
// Wait for command to come in
while (fifo_pop((FIFO_TYPE*) &tmp_chr) != FIFO_SUCCESS);
// TODO add error handling here
// Wait for length info to come in
while (fifo_pop((FIFO_TYPE*) &tmp_chr) != FIFO_SUCCESS);
uint8_t len = tmp_chr;
// Read in string
for (uint8_t i = 0; i < len; i++) {
// Hold until fifo returns successfully
while(fifo_pop((FIFO_TYPE*) &songs.name[i]) != FIFO_SUCCESS);
}
}
lcd_clrscr();
if (display_song != -1) {
lcd_puts(songs.name);
lcd_gotoxy(0, 1);
lcd_putc('1' + display_song);
lcd_gotoxy(13,1);
lcd_putc('1' + display_song);
lcd_putc('/');
lcd_putc('0' + songs.num_songs);
} else {
lcd_puts("No song!");
}
update_display = false;
last_displayed_song = display_song;
}
}
}

23
lcd_disp/main.h Normal file
View File

@ -0,0 +1,23 @@
#ifndef MAIN_H_
#define MAIN_H_
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include "lcd.h"
#include "fifo.h"
#include "comms.h"
#include "periph.h"
#define SONG_NAME_LEN 16
/* ---- Globally available flags ---- */
extern bool update_display;
#endif

BIN
lcd_disp/main.o Normal file

Binary file not shown.

69
lcd_disp/periph.c Normal file
View File

@ -0,0 +1,69 @@
#include "periph.h"
/** @brief Handles incoming Serial commands from the main player.
*/
ISR(USART_RX_vect) {
cli();
// Push incoming data to FIFO
fifo_push(UDR);
// Flag is cleared by reading data from UDR
sei();
}
/** @brief Display update timer
*/
ISR(TIMER0_COMPA_vect) {
cli();
update_display = true;
// Flag is cleared by calling the vector
sei();
}
void gpio_init() {
// Initialise button pins as inputs
BUTTONS_DDR &= ~(1 << BUTTONS_LEFT_PIN) &
~(1 << BUTTONS_RIGHT_PIN) &
~(1 << BUTTONS_PLAYPAUSE_PIN);
// Turn on button pullups
BUTTONS_PORT |= (1 << BUTTONS_LEFT_PIN) |
(1 << BUTTONS_RIGHT_PIN) |
(1 << BUTTONS_PLAYPAUSE_PIN);
}
void timer_init() {
/**
* Need to verify the math here.
* But with a prescaler of 1024, f_cpu at 8MHz, an OCRA of 195 gives
* 20Hz refresh rate.
*/
// COM0x can be set to defaults
// To set to CTC, WGM = 0b010
TCCR0A = (1 << WGM01);
// CS = 0b101 -> 1024 prescaler
// Everything else should be 0.
// TCCR0B = 0b00000101; <- can't use this because binary stuff is a GCC extension
TCCR0B = 5;
// Set to ~20Hz
OCR0A = 195;
// Enable interrupt
TIMSK = (1 << OCIE0A);
}
void usart_init() {
// initialize USART
UBRRL = UBRR_VALUE & 255;
UBRRH = UBRR_VALUE >> 8;
UCSRB = (1 << TXEN) | (1 << RXEN); // fire-up USART
UCSRC = (1 << UCSZ1) | (1 << UCSZ0); // fire-up USART
// Enable RX complete interrupt
UCSRB |= (1 << RXCIE);
}

45
lcd_disp/periph.h Normal file
View File

@ -0,0 +1,45 @@
/**
* @mainpage
* Peripherals
*
* @brief Peripheral initialization functions and interrupt handling routines.
*
*
* Contains the ISRs to handle the USART RX interrupt and the display timer interrupt.
*/
#ifndef PERIPH_H_
#define PERIPH_H_
#include "main.h"
#define USART_BAUDRATE 9600 //! USART baudrate, change this to set it.
#define UBRR_VALUE (((F_CPU/(USART_BAUDRATE*16UL)))-1)
#define BUTTONS_DDR DDRD
#define BUTTONS_PORT PORTD
#define BUTTONS_LEFT_PIN PORTD2
#define BUTTONS_RIGHT_PIN PORTD3
#define BUTTONS_PLAYPAUSE_PIN PORTD4
/** @brief Sets up various GPIO functions
*
* First enables buttons as inputs.
*/
void gpio_init();
/** @brief Initialises timer for updating display
*
* Sets up timer0 in
*/
void timer_init();
/** @brief Sets up USART for TX and RX with a baud rate of USART_BAUDRATE
*/
void usart_init();
#endif

BIN
lcd_disp/periph.o Normal file

Binary file not shown.

91
lcd_disp/sd-reader.hex Normal file
View File

@ -0,0 +1,91 @@
:1000000014C02CC02BC02AC029C028C027C003C1DF
:1000100025C024C023C022C021C023C11FC01EC0D0
:100020001DC01CC01BC01AC019C011241FBECFEDBB
:10003000CDBF10E0A0E6B0E0EAE5F5E002C0059033
:100040000D92A239B107D9F720E0A2E9B0E001C0D2
:100050001D92A03CB207E1F7DCD17DC2D1CF929ACC
:1000600082E08A95F1F700C092980895CF93C82F47
:10007000662311F0909A01C090989198BD9ABC9A0D
:10008000BB9ABA9AC298C398C498C598C7FDC29A39
:10009000C6FDC39AC5FDC49AC4FDC59AE0DFC298E7
:1000A000C398C498C598C3FDC29AC2FDC39AC1FD46
:1000B000C49AC0FDC59AD3DFC59AC49AC39AC29A9E
:1000C000CF9108959098919ABD98BC98BB98BA9892
:1000D000929A82E08A95F1F700C0B59B02C080E158
:1000E00001C080E0B4998062B3998064B29980685D
:1000F000929892E09A95F1F700C0929A92E09A95C0
:10010000F1F700C0B5998160B4998260B3998460B9
:10011000B299886092980895D5DF87FDFDCF8AE077
:100120008A95F1F700C0CECFCF93C82FF5DF60E0FE
:100130008C2FCF919BCFCF93C82FEEDF61E08C2F18
:10014000CF9194CF611102C0805801C08054ECCF90
:10015000E3DF90E0089581E0E7CF82E0E5CFCF9341
:10016000C82FDADFCA3041F4803410F080E001C0DB
:1001700080E48058CF91D8CF61E08C2FCF9176CF9B
:10018000CF93DF93EC018991882311F0E8DFFBCF57
:10019000DF91CF910895CF93DF93FC018491EF011C
:1001A0002196882319F0DBDFFE01F8CFDF91CF9194
:1001B0000895CF93C82F889A899A8A9ABD9ABC9A33
:1001C000BB9ABA9A8FEF9CE70197F1F700C0000045
:1001D000C49AC59A44DF8FE097E20197F1F700C017
:1001E00000003DDF9AEA9A95F1F700C038DF8AEA0D
:1001F0008A95F1F700C0C59832DF9AEA9A95F1F72F
:1002000000C088E291DF88E08FDFA5DF86E08CDF29
:100210008C2FCF9189CF1F920F920FB60F9211247E
:100220002F933F934F935F936F937F938F939F93FE
:10023000AF93BF93EF93FF93F8948CB1C2D07894AF
:10024000FF91EF91BF91AF919F918F917F916F91AE
:100250005F914F913F912F910F900FBE0F901F9084
:1002600018951F920F920FB60F9211248F93F89446
:1002700081E08093920078948F910F900FBE0F9041
:100280001F90189581B3837E81BB82B38C6182BB42
:10029000089582E080BF85E083BF83EC86BF81E064
:1002A00089BF089583E389B912B888E18AB986E0E5
:1002B00083B9579A08958091BE00811104C04BDF25
:1002C00083E690E05DCF90916200915019F0909399
:1002D0006200089581508093620008952091BE00CD
:1002E000211104C038DF83E690E04ACF809162009C
:1002F0008F5F482F082E000C550B30E04217530734
:1003000019F0809362000895109262000895809120
:1003100062008F3F21F41FDF83E690E031CF9091A0
:1003200060009F3F41F45D9BFECF94E09CB95D9BD4
:10033000FECF8CB908958091BF00882339F05D9B72
:10034000FECF85E08CB91092BF0008955D9BFECF73
:1003500085E08CB981E08093BF000895E3E9F0E087
:10036000158A148A178A168A118E108E0895409164
:10037000AB005091AC0041155105E9F02091A70068
:100380003091A800F901ED56FF4F6081FC016083B8
:10039000C90101969093A8008093A700415051098C
:1003A0005093AC004093AB00449741F41092A800E6
:1003B0001092A70003C082E090E0089580E090E0F2
:1003C00008954091AB005091AC0044315105D9F0F3
:1003D0002091A9003091AA00F901ED56FF4F8083CA
:1003E000C90101969093AA008093A9004F5F5F4FC7
:1003F0005093AC004093AB00449741F41092AA0094
:100400001092A90003C081E090E0089580E090E0A0
:100410000895CF93DF9300D0CDB7DD271A829EDFFA
:1004200031DF40DF8CE0C5DE96DE60E080E08ADE12
:100430000FEF82E0D82ECE01029699DF892BA9F426
:100440008A81882319F0813031F00BC01092BE00F0
:10045000009362000AC08EEB90E089DF892BD9F708
:1004600004C079DE85E790E08BDE929B0AC023DF33
:100470002FEF30E782E0215030408040E1F700C0AC
:100480000000929B0AC017DF9FEF20E732E09150F7
:1004900020403040E1F700C00000929B0AC00BDF13
:1004A0008FEF90E722E0815090402040E1F700C0BC
:1004B000000080919200882309F4BDCF80916200F2
:1004C00090916100981701F15D9BFECFDCB85D9BB8
:1004D000FECF8CB9CE0101964ADF892BD9F7CE0128
:1004E000019645DF892BD9F7C98010E01C1561F012
:1004F000812F90E09C0123553F4F7901C70137DFE1
:10050000892BE1F71F5FF2CF26DE809162008F3FDB
:10051000C1F08DEA90E034DE61E080E013DE80918E
:1005200062008F5C1CDE61E08DE00CDE8091620079
:100530008F5C15DE8FE213DE8091BE00805D0FDEE2
:1005400003C088E890E01CDE109292008091620067
:0A0550008093610070CFF894FFCF94
:10055A00FFFFFF4E6F20736F6E677320746F2070FA
:10056A006C61792100496E636F72726563742063EE
:10057A006F6D6D616E6421004E6F20736F6E67211F
:02058A0000006F
:00000001FF

491
lcd_disp/sd-reader.map Normal file
View File

@ -0,0 +1,491 @@
Archive member included to satisfy reference by file (symbol)
/usr/lib/gcc/avr/5.4.0/avr25/tiny-stack/libgcc.a(_exit.o)
/usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr25/tiny-stack/crtattiny2313a.o (exit)
/usr/lib/gcc/avr/5.4.0/avr25/tiny-stack/libgcc.a(_copy_data.o)
main.o (__do_copy_data)
/usr/lib/gcc/avr/5.4.0/avr25/tiny-stack/libgcc.a(_clear_bss.o)
main.o (__do_clear_bss)
Allocating common symbols
Common symbol size file
songs 0x13 main.o
Memory Configuration
Name Origin Length Attributes
text 0x0000000000000000 0x0000000000002000 xr
data 0x0000000000800060 0x000000000000ffa0 rw !x
eeprom 0x0000000000810000 0x0000000000010000 rw !x
fuse 0x0000000000820000 0x0000000000000003 rw !x
lock 0x0000000000830000 0x0000000000000400 rw !x
signature 0x0000000000840000 0x0000000000000400 rw !x
user_signatures 0x0000000000850000 0x0000000000000400 rw !x
*default* 0x0000000000000000 0xffffffffffffffff
Linker script and memory map
LOAD /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr25/tiny-stack/crtattiny2313a.o
LOAD lcd.o
LOAD periph.o
LOAD main.o
LOAD fifo.o
START GROUP
LOAD /usr/lib/gcc/avr/5.4.0/avr25/tiny-stack/libgcc.a
LOAD /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr25/tiny-stack/libm.a
LOAD /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr25/tiny-stack/libc.a
LOAD /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr25/tiny-stack/libattiny2313a.a
END GROUP
0x0000000000002000 __TEXT_REGION_LENGTH__ = DEFINED (__TEXT_REGION_LENGTH__)?__TEXT_REGION_LENGTH__:0x2000
0x000000000000ffa0 __DATA_REGION_LENGTH__ = DEFINED (__DATA_REGION_LENGTH__)?__DATA_REGION_LENGTH__:0xffa0
0x0000000000010000 __EEPROM_REGION_LENGTH__ = DEFINED (__EEPROM_REGION_LENGTH__)?__EEPROM_REGION_LENGTH__:0x10000
[0x0000000000000003] __FUSE_REGION_LENGTH__ = DEFINED (__FUSE_REGION_LENGTH__)?__FUSE_REGION_LENGTH__:0x400
0x0000000000000400 __LOCK_REGION_LENGTH__ = DEFINED (__LOCK_REGION_LENGTH__)?__LOCK_REGION_LENGTH__:0x400
0x0000000000000400 __SIGNATURE_REGION_LENGTH__ = DEFINED (__SIGNATURE_REGION_LENGTH__)?__SIGNATURE_REGION_LENGTH__:0x400
0x0000000000000400 __USER_SIGNATURE_REGION_LENGTH__ = DEFINED (__USER_SIGNATURE_REGION_LENGTH__)?__USER_SIGNATURE_REGION_LENGTH__:0x400
.hash
*(.hash)
.dynsym
*(.dynsym)
.dynstr
*(.dynstr)
.gnu.version
*(.gnu.version)
.gnu.version_d
*(.gnu.version_d)
.gnu.version_r
*(.gnu.version_r)
.rel.init
*(.rel.init)
.rela.init
*(.rela.init)
.rel.text
*(.rel.text)
*(.rel.text.*)
*(.rel.gnu.linkonce.t*)
.rela.text
*(.rela.text)
*(.rela.text.*)
*(.rela.gnu.linkonce.t*)
.rel.fini
*(.rel.fini)
.rela.fini
*(.rela.fini)
.rel.rodata
*(.rel.rodata)
*(.rel.rodata.*)
*(.rel.gnu.linkonce.r*)
.rela.rodata
*(.rela.rodata)
*(.rela.rodata.*)
*(.rela.gnu.linkonce.r*)
.rel.data
*(.rel.data)
*(.rel.data.*)
*(.rel.gnu.linkonce.d*)
.rela.data
*(.rela.data)
*(.rela.data.*)
*(.rela.gnu.linkonce.d*)
.rel.ctors
*(.rel.ctors)
.rela.ctors
*(.rela.ctors)
.rel.dtors
*(.rel.dtors)
.rela.dtors
*(.rela.dtors)
.rel.got
*(.rel.got)
.rela.got
*(.rela.got)
.rel.bss
*(.rel.bss)
.rela.bss
*(.rela.bss)
.rel.plt
*(.rel.plt)
.rela.plt
*(.rela.plt)
.text 0x0000000000000000 0x55a
*(.vectors)
.vectors 0x0000000000000000 0x2a /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr25/tiny-stack/crtattiny2313a.o
0x0000000000000000 __vectors
0x0000000000000000 __vector_default
*(.vectors)
*(.progmem.gcc*)
0x000000000000002a . = ALIGN (0x2)
0x000000000000002a __trampolines_start = .
*(.trampolines)
.trampolines 0x000000000000002a 0x0 linker stubs
*(.trampolines*)
0x000000000000002a __trampolines_end = .
*libprintf_flt.a:*(.progmem.data)
*libc.a:*(.progmem.data)
*(.progmem*)
0x000000000000002a . = ALIGN (0x2)
*(.jumptables)
*(.jumptables*)
*(.lowtext)
*(.lowtext*)
0x000000000000002a __ctors_start = .
*(.ctors)
0x000000000000002a __ctors_end = .
0x000000000000002a __dtors_start = .
*(.dtors)
0x000000000000002a __dtors_end = .
SORT(*)(.ctors)
SORT(*)(.dtors)
*(.init0)
.init0 0x000000000000002a 0x0 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr25/tiny-stack/crtattiny2313a.o
0x000000000000002a __init
*(.init0)
*(.init1)
*(.init1)
*(.init2)
.init2 0x000000000000002a 0x8 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr25/tiny-stack/crtattiny2313a.o
*(.init2)
*(.init3)
*(.init3)
*(.init4)
.init4 0x0000000000000032 0x16 /usr/lib/gcc/avr/5.4.0/avr25/tiny-stack/libgcc.a(_copy_data.o)
0x0000000000000032 __do_copy_data
.init4 0x0000000000000048 0x10 /usr/lib/gcc/avr/5.4.0/avr25/tiny-stack/libgcc.a(_clear_bss.o)
0x0000000000000048 __do_clear_bss
*(.init4)
*(.init5)
*(.init5)
*(.init6)
*(.init6)
*(.init7)
*(.init7)
*(.init8)
*(.init8)
*(.init9)
.init9 0x0000000000000058 0x4 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr25/tiny-stack/crtattiny2313a.o
*(.init9)
*(.text)
.text 0x000000000000005c 0x2 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr25/tiny-stack/crtattiny2313a.o
0x000000000000005c __vector_1
0x000000000000005c __vector_12
0x000000000000005c __bad_interrupt
0x000000000000005c __vector_6
0x000000000000005c __vector_3
0x000000000000005c __vector_11
0x000000000000005c __vector_17
0x000000000000005c __vector_19
0x000000000000005c __vector_5
0x000000000000005c __vector_4
0x000000000000005c __vector_9
0x000000000000005c __vector_2
0x000000000000005c __vector_15
0x000000000000005c __vector_8
0x000000000000005c __vector_14
0x000000000000005c __vector_10
0x000000000000005c __vector_16
0x000000000000005c __vector_18
0x000000000000005c __vector_20
.text 0x000000000000005e 0x1b8 lcd.o
0x0000000000000128 lcd_command
0x0000000000000136 lcd_data
0x0000000000000144 lcd_gotoxy
0x0000000000000150 lcd_getxy
0x0000000000000156 lcd_clrscr
0x000000000000015a lcd_home
0x000000000000015e lcd_putc
0x0000000000000180 lcd_puts
0x0000000000000196 lcd_puts_p
0x00000000000001b2 lcd_init
.text 0x0000000000000216 0xa0 periph.o
0x0000000000000216 __vector_7
0x0000000000000262 __vector_13
0x0000000000000284 gpio_init
0x0000000000000292 timer_init
0x00000000000002a4 usart_init
.text 0x00000000000002b6 0xa6 main.o
0x00000000000002b6 handle_left_press
0x00000000000002dc handle_right_press
0x000000000000030e handle_playpause_press
.text 0x000000000000035c 0xb6 fifo.o
0x000000000000035c fifo_init
0x000000000000036e fifo_pop
0x00000000000003c2 fifo_push
.text 0x0000000000000412 0x0 /usr/lib/gcc/avr/5.4.0/avr25/tiny-stack/libgcc.a(_exit.o)
.text 0x0000000000000412 0x0 /usr/lib/gcc/avr/5.4.0/avr25/tiny-stack/libgcc.a(_copy_data.o)
.text 0x0000000000000412 0x0 /usr/lib/gcc/avr/5.4.0/avr25/tiny-stack/libgcc.a(_clear_bss.o)
0x0000000000000412 . = ALIGN (0x2)
*(.text.*)
.text.startup 0x0000000000000412 0x144 main.o
0x0000000000000412 main
.text.libgcc.mul
0x0000000000000556 0x0 /usr/lib/gcc/avr/5.4.0/avr25/tiny-stack/libgcc.a(_exit.o)
.text.libgcc.div
0x0000000000000556 0x0 /usr/lib/gcc/avr/5.4.0/avr25/tiny-stack/libgcc.a(_exit.o)
.text.libgcc 0x0000000000000556 0x0 /usr/lib/gcc/avr/5.4.0/avr25/tiny-stack/libgcc.a(_exit.o)
.text.libgcc.prologue
0x0000000000000556 0x0 /usr/lib/gcc/avr/5.4.0/avr25/tiny-stack/libgcc.a(_exit.o)
.text.libgcc.builtins
0x0000000000000556 0x0 /usr/lib/gcc/avr/5.4.0/avr25/tiny-stack/libgcc.a(_exit.o)
.text.libgcc.fmul
0x0000000000000556 0x0 /usr/lib/gcc/avr/5.4.0/avr25/tiny-stack/libgcc.a(_exit.o)
.text.libgcc.fixed
0x0000000000000556 0x0 /usr/lib/gcc/avr/5.4.0/avr25/tiny-stack/libgcc.a(_exit.o)
.text.libgcc.mul
0x0000000000000556 0x0 /usr/lib/gcc/avr/5.4.0/avr25/tiny-stack/libgcc.a(_copy_data.o)
.text.libgcc.div
0x0000000000000556 0x0 /usr/lib/gcc/avr/5.4.0/avr25/tiny-stack/libgcc.a(_copy_data.o)
.text.libgcc 0x0000000000000556 0x0 /usr/lib/gcc/avr/5.4.0/avr25/tiny-stack/libgcc.a(_copy_data.o)
.text.libgcc.prologue
0x0000000000000556 0x0 /usr/lib/gcc/avr/5.4.0/avr25/tiny-stack/libgcc.a(_copy_data.o)
.text.libgcc.builtins
0x0000000000000556 0x0 /usr/lib/gcc/avr/5.4.0/avr25/tiny-stack/libgcc.a(_copy_data.o)
.text.libgcc.fmul
0x0000000000000556 0x0 /usr/lib/gcc/avr/5.4.0/avr25/tiny-stack/libgcc.a(_copy_data.o)
.text.libgcc.fixed
0x0000000000000556 0x0 /usr/lib/gcc/avr/5.4.0/avr25/tiny-stack/libgcc.a(_copy_data.o)
.text.libgcc.mul
0x0000000000000556 0x0 /usr/lib/gcc/avr/5.4.0/avr25/tiny-stack/libgcc.a(_clear_bss.o)
.text.libgcc.div
0x0000000000000556 0x0 /usr/lib/gcc/avr/5.4.0/avr25/tiny-stack/libgcc.a(_clear_bss.o)
.text.libgcc 0x0000000000000556 0x0 /usr/lib/gcc/avr/5.4.0/avr25/tiny-stack/libgcc.a(_clear_bss.o)
.text.libgcc.prologue
0x0000000000000556 0x0 /usr/lib/gcc/avr/5.4.0/avr25/tiny-stack/libgcc.a(_clear_bss.o)
.text.libgcc.builtins
0x0000000000000556 0x0 /usr/lib/gcc/avr/5.4.0/avr25/tiny-stack/libgcc.a(_clear_bss.o)
.text.libgcc.fmul
0x0000000000000556 0x0 /usr/lib/gcc/avr/5.4.0/avr25/tiny-stack/libgcc.a(_clear_bss.o)
.text.libgcc.fixed
0x0000000000000556 0x0 /usr/lib/gcc/avr/5.4.0/avr25/tiny-stack/libgcc.a(_clear_bss.o)
0x0000000000000556 . = ALIGN (0x2)
*(.fini9)
.fini9 0x0000000000000556 0x0 /usr/lib/gcc/avr/5.4.0/avr25/tiny-stack/libgcc.a(_exit.o)
0x0000000000000556 exit
0x0000000000000556 _exit
*(.fini9)
*(.fini8)
*(.fini8)
*(.fini7)
*(.fini7)
*(.fini6)
*(.fini6)
*(.fini5)
*(.fini5)
*(.fini4)
*(.fini4)
*(.fini3)
*(.fini3)
*(.fini2)
*(.fini2)
*(.fini1)
*(.fini1)
*(.fini0)
.fini0 0x0000000000000556 0x4 /usr/lib/gcc/avr/5.4.0/avr25/tiny-stack/libgcc.a(_exit.o)
*(.fini0)
0x000000000000055a _etext = .
.data 0x0000000000800060 0x32 load address 0x000000000000055a
0x0000000000800060 PROVIDE (__data_start, .)
*(.data)
.data 0x0000000000800060 0x0 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr25/tiny-stack/crtattiny2313a.o
.data 0x0000000000800060 0x0 lcd.o
.data 0x0000000000800060 0x0 periph.o
.data 0x0000000000800060 0x3 main.o
0x0000000000800060 selected_song
0x0000000000800061 last_displayed_song
0x0000000000800062 display_song
.data 0x0000000000800063 0x0 fifo.o
.data 0x0000000000800063 0x0 /usr/lib/gcc/avr/5.4.0/avr25/tiny-stack/libgcc.a(_exit.o)
.data 0x0000000000800063 0x0 /usr/lib/gcc/avr/5.4.0/avr25/tiny-stack/libgcc.a(_copy_data.o)
.data 0x0000000000800063 0x0 /usr/lib/gcc/avr/5.4.0/avr25/tiny-stack/libgcc.a(_clear_bss.o)
*(.data*)
*(.rodata)
*(.rodata*)
.rodata.str1.1
0x0000000000800063 0x2e main.o
*(.gnu.linkonce.d*)
0x0000000000800092 . = ALIGN (0x2)
*fill* 0x0000000000800091 0x1
0x0000000000800092 _edata = .
0x0000000000800092 PROVIDE (__data_end, .)
.bss 0x0000000000800092 0x2e
0x0000000000800092 PROVIDE (__bss_start, .)
*(.bss)
.bss 0x0000000000800092 0x0 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr25/tiny-stack/crtattiny2313a.o
.bss 0x0000000000800092 0x0 lcd.o
.bss 0x0000000000800092 0x0 periph.o
.bss 0x0000000000800092 0x1 main.o
0x0000000000800092 update_display
.bss 0x0000000000800093 0x1a fifo.o
.bss 0x00000000008000ad 0x0 /usr/lib/gcc/avr/5.4.0/avr25/tiny-stack/libgcc.a(_exit.o)
.bss 0x00000000008000ad 0x0 /usr/lib/gcc/avr/5.4.0/avr25/tiny-stack/libgcc.a(_copy_data.o)
.bss 0x00000000008000ad 0x0 /usr/lib/gcc/avr/5.4.0/avr25/tiny-stack/libgcc.a(_clear_bss.o)
*(.bss*)
*(COMMON)
COMMON 0x00000000008000ad 0x13 main.o
0x00000000008000ad songs
0x00000000008000c0 PROVIDE (__bss_end, .)
0x000000000000055a __data_load_start = LOADADDR (.data)
0x000000000000058c __data_load_end = (__data_load_start + SIZEOF (.data))
.noinit 0x00000000008000c0 0x0
[!provide] PROVIDE (__noinit_start, .)
*(.noinit*)
[!provide] PROVIDE (__noinit_end, .)
0x00000000008000c0 _end = .
[!provide] PROVIDE (__heap_start, .)
.eeprom 0x0000000000810000 0x0
*(.eeprom*)
0x0000000000810000 __eeprom_end = .
.fuse
*(.fuse)
*(.lfuse)
*(.hfuse)
*(.efuse)
.lock
*(.lock*)
.signature
*(.signature*)
.user_signatures
*(.user_signatures*)
.stab 0x0000000000000000 0x2418
*(.stab)
.stab 0x0000000000000000 0x1008 lcd.o
.stab 0x0000000000001008 0x648 periph.o
0x81c (size before relaxing)
.stab 0x0000000000001650 0x96c main.o
0xc48 (size before relaxing)
.stab 0x0000000000001fbc 0x45c fifo.o
0x5f4 (size before relaxing)
.stabstr 0x0000000000000000 0x14ea
*(.stabstr)
.stabstr 0x0000000000000000 0x14ea lcd.o
.stab.excl
*(.stab.excl)
.stab.exclstr
*(.stab.exclstr)
.stab.index
*(.stab.index)
.stab.indexstr
*(.stab.indexstr)
.comment 0x0000000000000000 0x11
*(.comment)
.comment 0x0000000000000000 0x11 lcd.o
0x12 (size before relaxing)
.comment 0x0000000000000011 0x12 periph.o
.comment 0x0000000000000011 0x12 main.o
.comment 0x0000000000000011 0x12 fifo.o
.note.gnu.avr.deviceinfo
0x0000000000000000 0x40
.note.gnu.avr.deviceinfo
0x0000000000000000 0x40 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr25/tiny-stack/crtattiny2313a.o
.note.gnu.build-id
*(.note.gnu.build-id)
.debug
*(.debug)
.line
*(.line)
.debug_srcinfo
*(.debug_srcinfo)
.debug_sfnames
*(.debug_sfnames)
.debug_aranges
*(.debug_aranges)
.debug_pubnames
*(.debug_pubnames)
.debug_info 0x0000000000000000 0x456
*(.debug_info .gnu.linkonce.wi.*)
.debug_info 0x0000000000000000 0x456 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr25/tiny-stack/crtattiny2313a.o
.debug_abbrev 0x0000000000000000 0x41b
*(.debug_abbrev)
.debug_abbrev 0x0000000000000000 0x41b /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr25/tiny-stack/crtattiny2313a.o
.debug_line 0x0000000000000000 0x1a
*(.debug_line .debug_line.* .debug_line_end)
.debug_line 0x0000000000000000 0x1a /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr25/tiny-stack/crtattiny2313a.o
.debug_frame
*(.debug_frame)
.debug_str 0x0000000000000000 0x17b
*(.debug_str)
.debug_str 0x0000000000000000 0x17b /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr25/tiny-stack/crtattiny2313a.o
.debug_loc
*(.debug_loc)
.debug_macinfo
*(.debug_macinfo)
.debug_weaknames
*(.debug_weaknames)
.debug_funcnames
*(.debug_funcnames)
.debug_typenames
*(.debug_typenames)
.debug_varnames
*(.debug_varnames)
.debug_pubtypes
*(.debug_pubtypes)
.debug_ranges
*(.debug_ranges)
.debug_macro
*(.debug_macro)
OUTPUT(sd-reader.out elf32-avr)
LOAD linker stubs

BIN
lcd_disp/sd-reader.out Executable file

Binary file not shown.

18
sd_reader/.vscode/c_cpp_properties.json vendored Normal file
View File

@ -0,0 +1,18 @@
{
"configurations": [
{
"name": "Linux",
"intelliSenseMode": "gcc-x64",
"compilerPath": "/usr/lib/ccache/avr-gcc",
"cStandard": "c99",
"cppStandard": "c++17",
"compilerArgs": [
"-Wall", "-pedantic", "-mmcu=atmega328"
],
"defines": [
"F_CPU=16000000"
]
}
],
"version": 4
}

19
sd_reader/.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,19 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "make",
"type": "shell",
"command": "make",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [
"$gcc"
]
}
]
}

124
sd_reader/ChangeLog Normal file
View File

@ -0,0 +1,124 @@
2012-06-12 sd-reader
* fix capacity readout from csd register depending on format version
* fix gcc strict-aliasing warnings (also somewhat enlarges code size)
2011-04-23 sd-reader
* fix FAT access for cluster numbers beyond 2^15 (for FAT16) and 2^30 (for FAT32) (thanks to Darwin Engwer for testing)
* correctly return disk-full condition from fat_write_file() on certain conditions
* use byteorder memory access functions for fat_fs_get_free()
* be more specific on the return value of fat_write_file()
2011-02-05 sd-reader
* implement renaming a file or directory
* rewrite byteorder handling to fix unaligned memory accesses on 32-bit and probably 16-bit architectures
* make fat_create_file() not return failure if the file already exists
* make the "cat" output respect the count of bytes actually read
* document how to use fat_seek_file() for retrieving the file position
2010-10-10 sd-reader
* Fix equal file names when reading two successive 8.3 directory entries.
* Fix calculation of cluster positions beyond 4GB (32 bit integer overflow).
* Fix endless looping of directory listing (occured with valid entry at end of last cluster).
2010-01-10 sd-reader
* Make LFN support configurable.
* Ignore LFN directory entries without 8.3 name.
* Ignore LFN directory entries which do not match the 8.3 name's checksum.
* Implement delayed directory entry updates (disabled by default) (thanks to Adam Mayer).
* Speedup search for free cluster.
* Fix memory leak when using the "init" command (thanks to Tibor Vilhan).
* Fix ATmega328P-specific pin mappings.
* Add some of the picoPower MCU variants.
2009-03-30 sd-reader
* Make 8.3 basename and/or extension lowercase when told by Windows NT and later.
* Add ATmega328 pin configuration.
* Fix MMC/SD/SDHC distinction.
* Fix raw block read/write buffering (thanks to Kurt Sterckx).
* Fix fat size calculation for FAT16 when configured with FAT32.
* Fix compilation for read-only configurations.
* Fix card lock detection.
* Make it easier to link with a C++ application (thanks to Jérôme Despatis).
2008-11-21 sd-reader
* Support for SDHC cards (disabled by default).
* Support for FAT32 (disabled by default).
2008-06-08 sd-reader
* New "init" command to allow reinitialization of memory card.
* Fix searching through multi-cluster directories.
* Fix reading directory entries spanning a cluster border (backport from mega-eth).
* Do not abort the whole lfn entry when the file name is too long, just drop single characters (backport from mega-eth).
* Change fat16_get_dir_entry_of_path() to ignore a slash at the end (backport from mega-eth).
* Make listing a directory's content much faster (backport from mega-eth).
* Shrink code size by centralizing cluster offset calculation (backport from mega-eth).
* Some other small fixes and optimizations.
2007-12-13 sd-reader
* Dual-license the major implementation modules under GPL and LGPL.
2007-06-03 sd-reader
* Fix reading beyond cached block (by Benjamin Meier).
* Implement support for reading and writing file modification dates/times.
(Thanks to Torsten Seeboth for testing.)
2007-03-01 sd-reader
* Avoid LFN directory entries for the "." and ".." directory references.
This prevented Windows from deleting directories.
* Handle special case where the 8.3 filename begins with 0xe5.
* Fix return value of fat16_delete_file() when deleting empty files.
* Fix fat16_clear_cluster() which was zeroing only 16 of every 32 bytes.
2007-01-20 sd-reader
* Fix directory creation.
- Correctly create "." and ".." directory entries (8.3 <-> lfn versions).
- Correctly clear cluster containing the directory entries for new directory.
2006-11-01 sd-reader
* Implement creation and deletion of directories.
* Clear the directory entries of new directory clusters.
* Prevent linkage against printf().
* Make the use of malloc()/free() optional.
2006-09-01 sd-reader
* Fix shortening files.
* Fix free disk space calculation.
2006-08-24 sd-reader
* Improve sleep handling.
* Display extended card information on boot and
when executing the "disk" shell command.
* Correctly determine FAT type by cluster count.
* Fix cluster allocation beyond card capacity.
2006-08-16 sd-reader
* Provide FAT16 capacity and usage information.
* Implement the backspace key in the mini shell.
* Enter idle mode when waiting for uart activity.
* Make the Card Select pin MCU dependent as well.
* Add mini shell commands to documentation.
2006-08-08 sd-reader
* Thanks go to Torsten Seeboth for his ongoing efforts
to test changes, fix regressions and give suggestions.
Many of the changes below were initiated by him.
* Much more reliable card initialization.
* Highly improved performance
- optional write buffering
- better cluster handling
- remove unneeded SPI access when reading from buffered block
- use highest spi frequency after card initialization
* Add superfloppy support.
* Better checks when opening a FAT16 filesystem.
* Provide SPI pin mappings for commonly used ATmegas.
* Fix resizing files, hangs could occur.
* Fix overflow when creating files with names longer than 31 characters.
* Fix numerous other small things.
2006-03-19 sd-reader
* Fix speed regressions.
2006-03-16 sd-reader
* Initial release.

1525
sd_reader/Doxyfile Normal file

File diff suppressed because it is too large Load Diff

124
sd_reader/FAQ Normal file
View File

@ -0,0 +1,124 @@
Frequently Asked Questions for sd-reader
========================================
General
-------
Q: Which cards are supported?
A: All MMC/SD/SDHC/miniSD/microSD/microSDHC should work, although not all variants have been tested.
Some very old (low capacity) cards might be broken as well. Cards with a capacity of 16 MB or
less are usually formatted with FAT12, so these are supported in raw mode only, if at all.
Q: What data rates can I expect?
A: See the benchmark page on the homepage.
http://www.roland-riegel.de/sd-reader/benchmarks/
Q: Are there boards available for purchase?
A: No.
Hardware
--------
Q: Where can I find the schematic?
A: Get it on the homepage.
http://www.roland-riegel.de/sd-reader/sd-reader_circuit_latest.zip
Q: What if my card socket has no Card-Detect and/or Card-Lock switches?
A: Change sd_raw_config.h such that it looks like
#define configure_pin_available() /* nothing */
#define configure_pin_locked() /* nothing */
#define get_pin_available() 0
#define get_pin_locked() 1
Q: All attempts to write to the card fail, although reading works. What's the problem?
A: Enable write support within sd_raw_config.h. And probably, your card socket has no Card-lock
detection (see question above).
Q: The card initialization fails. What can I do?
A: Usually this is some kind of hardware problem.
* Check the physical connections.
* Keep the signal lines to the card as short as possible.
* Do not use diodes to derive the card's supply voltage. Use a 3.3V voltage regulator instead.
* Have a stable, buffered power supply and use capacitors for correct voltage regulator
operation (see the schematics linked above).
* Use extra capacitors of 50uF and 100nF as close to the card as possible.
* When using an integrated level shifter or no level shifting at all (see the next question),
try adding a pullup of 50k from the data-out line of the card to 3.3V.
* Make sure the limiting frequency of the level shifter is not exceeded. Have a look into its
datasheet!
* Check the signals with a scope.
Q: What alternatives to resistor level shifting exist?
A: If you want to use additional devices with SPI or the resistor solution appears too ugly, there
are two possibilities. Either operate the whole circuit with a single 3.3V supply and no level
shifting at all or use a level shifting IC which interfaces the memory card to the AVR.
Depending on your requirements, adequate devices could include MAX3378E, MAX3392E, MAX3395E,
74LVC245 and 74HCT4050 (optionally together with 74HCT125). Please check the datasheets for the
required DC/AC characteristics!
Software
--------
Q: What's the software license?
A: GPLv2 or (for most parts) LGPLv2.1. Before using a file, read its license terms included at the
beginning of the file.
Q: What's the programming language used?
A: It's C, in compliance with the ISO C99 standard.
Q: What are these .patch-files provided?
A: Those record the source code differences between the old and new release. If you edited your
private sd-reader version, it might be easier to apply the patch files using the "patch" utility
common on Unix-like systems, rather than manually inserting the changes by hand. For Windows
users, the GnuWin32 project provides a port of "patch".
Q: Where can I learn more about the library interface and how to use it?
A: Look into the HTML documentation provided online or within each source distribution. Also take
the provided main.c as an example application and as a starting point.
Q: How do I adapt it to an ATmegaXYZ and my circuit in particular?
A: Add your MCU-specific pin configuration to sd_raw_config.h. Some commonly used ones are already
included.
Q: How do I adapt it to a different MCU clock?
A: Change the MCU_FREQ variable within the Makefile.
Q: How do I adapt it to some different MCU architecture?
A: Change sd_raw_init(), sd_raw_send_byte(), sd_raw_rec_byte() within sd_raw.c and the pin
definitions within sd_raw_config.h appropriately.
Q: Can the library be used with Arduino?
A: Yes. I do not have any experience with Arduino myself, but people report that it works with some
minor modifications to the library code needed due to some different compiler settings. Please
search the web for details.
Q: Can I use software SPI?
A: Yes, but the code is not prepared for it.
Q: My application crashes somewhere in the lib. Is there some bug hidden?
A: There might be a bug. Much more likely, however, is that you experience memory problems,
especially heap/stack collisions. The crashes can appear everywhere, but typically this is not
the place where the real problem is. Try to minimize the size of structures and other memory
blocks your application uses. Sum up the amount of memory your application allocates with global
and local variables and the memory you allocate dynamically with malloc(). The avr-nm utility
also helps a lot here. When called with the "--print-size --size-sort" parameters, it lists all
symbols and their code/memory size within the given file. See the avr-libc FAQ and the nm manual
for further information.
http://www.nongnu.org/avr-libc/user-manual/FAQ.html#faq_ramoverlap
http://sourceware.org/binutils/docs/binutils/nm.html
Q: Opening the FAT filesystem fails. What can I do?
A: Make sure there is a FAT16 or FAT32 filesystem on the card. This usually isn't possible for old
cards with 16 MB or less. For larger ones, format the cards using the OS utilities, like the
Windows Explorer, the Unix/Linux mkdosfs command or special SD card format tools.
http://panasonic.jp/support/global/cs/sd/download/sd_formatter.html
http://www.sdcard.org/consumers/formatter/
Q: Writing to the card returns no failure, but when checking the file's content the data is not
there. What happens?
A: For performance reasons, writing to the card is always buffered. Before pulling the card out of
its socket (or issuing a reset of the MCU), make sure sd_raw_sync() gets called such that all
buffered data is written out to permanent card storage.

52
sd_reader/Makefile Normal file
View File

@ -0,0 +1,52 @@
NAME := sd-reader
HEX := $(NAME).hex
OUT := $(NAME).out
MAP := $(NAME).map
SOURCES := $(wildcard *.c)
HEADERS := $(wildcard *.h)
OBJECTS := $(patsubst %.c,%.o,$(SOURCES))
MCU := atmega328p
MCU_AVRDUDE := m328
MCU_FREQ := 16000000UL
CC := avr-gcc
OBJCOPY := avr-objcopy
SIZE := avr-size -A
DOXYGEN := doxygen
CFLAGS := -Werror -Wall -pedantic -mmcu=$(MCU) -std=c99 -g -O3 -DF_CPU=$(MCU_FREQ)
all: $(HEX)
clean:
rm -f $(HEX) $(OUT) $(MAP) $(OBJECTS)
rm -rf doc/html
flash: $(HEX)
avrdude -y -c avr910 -p $(MCU_AVRDUDE) -U flash:w:$(HEX)
$(HEX): $(OUT)
$(OBJCOPY) -R .eeprom -O ihex $< $@
$(OUT): $(OBJECTS)
$(CC) $(CFLAGS) -o $@ -Wl,-Map,$(MAP) $^
@echo
@$(SIZE) $@
@echo
%.o: %.c $(HEADERS)
$(CC) $(CFLAGS) -c -o $@ $<
%.pp: %.c
$(CC) $(CFLAGS) -E -o $@ $<
%.ppo: %.c
$(CC) $(CFLAGS) -E $<
doc: $(HEADERS) $(SOURCES) Doxyfile
$(DOXYGEN) Doxyfile
.PHONY: all clean flash doc

110
sd_reader/byteordering.c Normal file
View File

@ -0,0 +1,110 @@
/*
* Copyright (c) 2006-2012 by Roland Riegel <feedback@roland-riegel.de>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of either the GNU General Public License version 2
* or the GNU Lesser General Public License version 2.1, both as
* published by the Free Software Foundation.
*/
#include "byteordering.h"
/**
* \addtogroup byteordering
*
* Architecture-dependent handling of byte-ordering.
*
* @{
*/
/**
* \file
* Byte-order handling implementation (license: GPLv2 or LGPLv2.1)
*
* \author Roland Riegel
*/
#if DOXYGEN || SWAP_NEEDED
/**
* \internal
* Swaps the bytes of a 16-bit integer.
*
* \param[in] i A 16-bit integer which to swap.
* \returns The swapped 16-bit integer.
*/
uint16_t swap16(uint16_t i)
{
return SWAP16(i);
}
/**
* \internal
* Swaps the bytes of a 32-bit integer.
*
* \param[in] i A 32-bit integer which to swap.
* \returns The swapped 32-bit integer.
*/
uint32_t swap32(uint32_t i)
{
return SWAP32(i);
}
#endif
/**
* Reads a 16-bit integer from memory in little-endian byte order.
*
* \param[in] p Pointer from where to read the integer.
* \returns The 16-bit integer read from memory.
*/
uint16_t read16(const uint8_t* p)
{
return (((uint16_t) p[1]) << 8) |
(((uint16_t) p[0]) << 0);
}
/**
* Reads a 32-bit integer from memory in little-endian byte order.
*
* \param[in] p Pointer from where to read the integer.
* \returns The 32-bit integer read from memory.
*/
uint32_t read32(const uint8_t* p)
{
return (((uint32_t) p[3]) << 24) |
(((uint32_t) p[2]) << 16) |
(((uint32_t) p[1]) << 8) |
(((uint32_t) p[0]) << 0);
}
/**
* Writes a 16-bit integer into memory in little-endian byte order.
*
* \param[in] p Pointer where to write the integer to.
* \param[in] i The 16-bit integer to write.
*/
void write16(uint8_t* p, uint16_t i)
{
p[1] = (uint8_t) ((i & 0xff00) >> 8);
p[0] = (uint8_t) ((i & 0x00ff) >> 0);
}
/**
* Writes a 32-bit integer into memory in little-endian byte order.
*
* \param[in] p Pointer where to write the integer to.
* \param[in] i The 32-bit integer to write.
*/
void write32(uint8_t* p, uint32_t i)
{
p[3] = (uint8_t) ((i & 0xff000000) >> 24);
p[2] = (uint8_t) ((i & 0x00ff0000) >> 16);
p[1] = (uint8_t) ((i & 0x0000ff00) >> 8);
p[0] = (uint8_t) ((i & 0x000000ff) >> 0);
}
/**
* @}
*/

188
sd_reader/byteordering.h Normal file
View File

@ -0,0 +1,188 @@
/*
* Copyright (c) 2006-2012 by Roland Riegel <feedback@roland-riegel.de>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of either the GNU General Public License version 2
* or the GNU Lesser General Public License version 2.1, both as
* published by the Free Software Foundation.
*/
#ifndef BYTEORDERING_H
#define BYTEORDERING_H
#include <stdint.h>
#ifdef __cplusplus
extern "C"
{
#endif
/**
* \addtogroup byteordering
*
* @{
*/
/**
* \file
* Byte-order handling header (license: GPLv2 or LGPLv2.1)
*
* \author Roland Riegel
*/
#define SWAP16(val) ((((uint16_t) (val)) << 8) | \
(((uint16_t) (val)) >> 8) \
)
#define SWAP32(val) (((((uint32_t) (val)) & 0x000000ff) << 24) | \
((((uint32_t) (val)) & 0x0000ff00) << 8) | \
((((uint32_t) (val)) & 0x00ff0000) >> 8) | \
((((uint32_t) (val)) & 0xff000000) >> 24) \
)
#if LITTLE_ENDIAN || __AVR__
#define SWAP_NEEDED 0
#elif BIG_ENDIAN
#define SWAP_NEEDED 1
#else
#error "Endianess undefined! Please define LITTLE_ENDIAN=1 or BIG_ENDIAN=1."
#endif
/**
* \def HTOL16(val)
*
* Converts a 16-bit integer from host byte order to little-endian byte order.
*
* Use this macro for compile time constants only. For variable values
* use the function htol16() instead. This saves code size.
*
* \param[in] val A 16-bit integer in host byte order.
* \returns The given 16-bit integer converted to little-endian byte order.
*/
/**
* \def HTOL32(val)
*
* Converts a 32-bit integer from host byte order to little-endian byte order.
*
* Use this macro for compile time constants only. For variable values
* use the function htol32() instead. This saves code size.
*
* \param[in] val A 32-bit integer in host byte order.
* \returns The given 32-bit integer converted to little-endian byte order.
*/
/**
* \def LTOH16(val)
*
* Converts a 16-bit integer from little-endian byte order to host byte order.
*
* Use this macro for compile time constants only. For variable values
* use the function ltoh16() instead. This saves code size.
*
* \param[in] val A 16-bit integer in little-endian byte order.
* \returns The given 16-bit integer converted to host byte order.
*/
/**
* \def LTOH32(val)
*
* Converts a 32-bit integer from little-endian byte order to host byte order.
*
* Use this macro for compile time constants only. For variable values
* use the function ltoh32() instead. This saves code size.
*
* \param[in] val A 32-bit integer in little-endian byte order.
* \returns The given 32-bit integer converted to host byte order.
*/
#if SWAP_NEEDED
#define HTOL16(val) SWAP16(val)
#define HTOL32(val) SWAP32(val)
#define LTOH16(val) SWAP16(val)
#define LTOH32(val) SWAP32(val)
#else
#define HTOL16(val) (val)
#define HTOL32(val) (val)
#define LTOH16(val) (val)
#define LTOH32(val) (val)
#endif
#if DOXYGEN
/**
* Converts a 16-bit integer from host byte order to little-endian byte order.
*
* Use this function on variable values instead of the
* macro HTOL16(). This saves code size.
*
* \param[in] h A 16-bit integer in host byte order.
* \returns The given 16-bit integer converted to little-endian byte order.
*/
uint16_t htol16(uint16_t h);
/**
* Converts a 32-bit integer from host byte order to little-endian byte order.
*
* Use this function on variable values instead of the
* macro HTOL32(). This saves code size.
*
* \param[in] h A 32-bit integer in host byte order.
* \returns The given 32-bit integer converted to little-endian byte order.
*/
uint32_t htol32(uint32_t h);
/**
* Converts a 16-bit integer from little-endian byte order to host byte order.
*
* Use this function on variable values instead of the
* macro LTOH16(). This saves code size.
*
* \param[in] l A 16-bit integer in little-endian byte order.
* \returns The given 16-bit integer converted to host byte order.
*/
uint16_t ltoh16(uint16_t l);
/**
* Converts a 32-bit integer from little-endian byte order to host byte order.
*
* Use this function on variable values instead of the
* macro LTOH32(). This saves code size.
*
* \param[in] l A 32-bit integer in little-endian byte order.
* \returns The given 32-bit integer converted to host byte order.
*/
uint32_t ltoh32(uint32_t l);
#elif SWAP_NEEDED
#define htol16(h) swap16(h)
#define htol32(h) swap32(h)
#define ltoh16(l) swap16(l)
#define ltoh32(l) swap32(l)
#else
#define htol16(h) (h)
#define htol32(h) (h)
#define ltoh16(l) (l)
#define ltoh32(l) (l)
#endif
uint16_t read16(const uint8_t* p);
uint32_t read32(const uint8_t* p);
void write16(uint8_t* p, uint16_t i);
void write32(uint8_t* p, uint32_t i);
/**
* @}
*/
#if SWAP_NEEDED
uint16_t swap16(uint16_t i);
uint32_t swap32(uint32_t i);
#endif
#ifdef __cplusplus
}
#endif
#endif

BIN
sd_reader/byteordering.o Normal file

Binary file not shown.

1
sd_reader/comms.h Symbolic link
View File

@ -0,0 +1 @@
../comms/comms.h

BIN
sd_reader/doc/pic01.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

BIN
sd_reader/doc/pic02.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

2551
sd_reader/fat.c Normal file

File diff suppressed because it is too large Load Diff

131
sd_reader/fat.h Normal file
View File

@ -0,0 +1,131 @@
/*
* Copyright (c) 2006-2012 by Roland Riegel <feedback@roland-riegel.de>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of either the GNU General Public License version 2
* or the GNU Lesser General Public License version 2.1, both as
* published by the Free Software Foundation.
*/
#ifndef FAT_H
#define FAT_H
#include <stdint.h>
#include "fat_config.h"
#ifdef __cplusplus
extern "C"
{
#endif
/**
* \addtogroup fat
*
* @{
*/
/**
* \file
* FAT header (license: GPLv2 or LGPLv2.1)
*
* \author Roland Riegel
*/
/**
* \addtogroup fat_file
* @{
*/
/** The file is read-only. */
#define FAT_ATTRIB_READONLY (1 << 0)
/** The file is hidden. */
#define FAT_ATTRIB_HIDDEN (1 << 1)
/** The file is a system file. */
#define FAT_ATTRIB_SYSTEM (1 << 2)
/** The file is empty and has the volume label as its name. */
#define FAT_ATTRIB_VOLUME (1 << 3)
/** The file is a directory. */
#define FAT_ATTRIB_DIR (1 << 4)
/** The file has to be archived. */
#define FAT_ATTRIB_ARCHIVE (1 << 5)
/** The given offset is relative to the beginning of the file. */
#define FAT_SEEK_SET 0
/** The given offset is relative to the current read/write position. */
#define FAT_SEEK_CUR 1
/** The given offset is relative to the end of the file. */
#define FAT_SEEK_END 2
/**
* @}
*/
struct partition_struct;
struct fat_fs_struct;
struct fat_file_struct;
struct fat_dir_struct;
/**
* \ingroup fat_file
* Describes a directory entry.
*/
struct fat_dir_entry_struct
{
/** The file's name, truncated to 31 characters. */
char long_name[32];
/** The file's attributes. Mask of the FAT_ATTRIB_* constants. */
uint8_t attributes;
#if FAT_DATETIME_SUPPORT
/** Compressed representation of modification time. */
uint16_t modification_time;
/** Compressed representation of modification date. */
uint16_t modification_date;
#endif
/** The cluster in which the file's first byte resides. */
cluster_t cluster;
/** The file's size. */
uint32_t file_size;
/** The total disk offset of this directory entry. */
offset_t entry_offset;
};
struct fat_fs_struct* fat_open(struct partition_struct* partition);
void fat_close(struct fat_fs_struct* fs);
struct fat_file_struct* fat_open_file(struct fat_fs_struct* fs, const struct fat_dir_entry_struct* dir_entry);
void fat_close_file(struct fat_file_struct* fd);
intptr_t fat_read_file(struct fat_file_struct* fd, uint8_t* buffer, uintptr_t buffer_len);
intptr_t fat_write_file(struct fat_file_struct* fd, const uint8_t* buffer, uintptr_t buffer_len);
uint8_t fat_seek_file(struct fat_file_struct* fd, int32_t* offset, uint8_t whence);
uint8_t fat_resize_file(struct fat_file_struct* fd, uint32_t size);
struct fat_dir_struct* fat_open_dir(struct fat_fs_struct* fs, const struct fat_dir_entry_struct* dir_entry);
void fat_close_dir(struct fat_dir_struct* dd);
uint8_t fat_read_dir(struct fat_dir_struct* dd, struct fat_dir_entry_struct* dir_entry);
uint8_t fat_reset_dir(struct fat_dir_struct* dd);
uint8_t fat_create_file(struct fat_dir_struct* parent, const char* file, struct fat_dir_entry_struct* dir_entry);
uint8_t fat_delete_file(struct fat_fs_struct* fs, struct fat_dir_entry_struct* dir_entry);
uint8_t fat_move_file(struct fat_fs_struct* fs, struct fat_dir_entry_struct* dir_entry, struct fat_dir_struct* parent_new, const char* file_new);
uint8_t fat_create_dir(struct fat_dir_struct* parent, const char* dir, struct fat_dir_entry_struct* dir_entry);
#define fat_delete_dir fat_delete_file
#define fat_move_dir fat_move_file
void fat_get_file_modification_date(const struct fat_dir_entry_struct* dir_entry, uint16_t* year, uint8_t* month, uint8_t* day);
void fat_get_file_modification_time(const struct fat_dir_entry_struct* dir_entry, uint8_t* hour, uint8_t* min, uint8_t* sec);
uint8_t fat_get_dir_entry_of_path(struct fat_fs_struct* fs, const char* path, struct fat_dir_entry_struct* dir_entry);
offset_t fat_get_fs_size(const struct fat_fs_struct* fs);
offset_t fat_get_fs_free(const struct fat_fs_struct* fs);
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif

BIN
sd_reader/fat.o Normal file

Binary file not shown.

128
sd_reader/fat_config.h Normal file
View File

@ -0,0 +1,128 @@
/*
* Copyright (c) 2006-2012 by Roland Riegel <feedback@roland-riegel.de>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of either the GNU General Public License version 2
* or the GNU Lesser General Public License version 2.1, both as
* published by the Free Software Foundation.
*/
#ifndef FAT_CONFIG_H
#define FAT_CONFIG_H
#include <stdint.h>
#include "sd_raw_config.h"
#ifdef __cplusplus
extern "C"
{
#endif
/**
* \addtogroup fat
*
* @{
*/
/**
* \file
* FAT configuration (license: GPLv2 or LGPLv2.1)
*/
/**
* \ingroup fat_config
* Controls FAT write support.
*
* Set to 1 to enable FAT write support, set to 0 to disable it.
*/
#define FAT_WRITE_SUPPORT SD_RAW_WRITE_SUPPORT
/**
* \ingroup fat_config
* Controls FAT long filename (LFN) support.
*
* Set to 1 to enable LFN support, set to 0 to disable it.
*/
#define FAT_LFN_SUPPORT 1
/**
* \ingroup fat_config
* Controls FAT date and time support.
*
* Set to 1 to enable FAT date and time stamping support.
*/
#define FAT_DATETIME_SUPPORT 0
/**
* \ingroup fat_config
* Controls FAT32 support.
*
* Set to 1 to enable FAT32 support.
*/
#define FAT_FAT32_SUPPORT SD_RAW_SDHC
/**
* \ingroup fat_config
* Controls updates of directory entries.
*
* Set to 1 to delay directory entry updates until the file is closed.
* This can boost performance significantly, but may cause data loss
* if the file is not properly closed.
*/
#define FAT_DELAY_DIRENTRY_UPDATE 0
/**
* \ingroup fat_config
* Determines the function used for retrieving current date and time.
*
* Define this to the function call which shall be used to retrieve
* current date and time.
*
* \note Used only when FAT_DATETIME_SUPPORT is 1.
*
* \param[out] year Pointer to a \c uint16_t which receives the current year.
* \param[out] month Pointer to a \c uint8_t which receives the current month.
* \param[out] day Pointer to a \c uint8_t which receives the current day.
* \param[out] hour Pointer to a \c uint8_t which receives the current hour.
* \param[out] min Pointer to a \c uint8_t which receives the current minute.
* \param[out] sec Pointer to a \c uint8_t which receives the current sec.
*/
#define fat_get_datetime(year, month, day, hour, min, sec) \
get_datetime(year, month, day, hour, min, sec)
/* forward declaration for the above */
void get_datetime(uint16_t* year, uint8_t* month, uint8_t* day, uint8_t* hour, uint8_t* min, uint8_t* sec);
/**
* \ingroup fat_config
* Maximum number of filesystem handles.
*/
#define FAT_FS_COUNT 1
/**
* \ingroup fat_config
* Maximum number of file handles.
*/
#define FAT_FILE_COUNT 1
/**
* \ingroup fat_config
* Maximum number of directory handles.
*/
#define FAT_DIR_COUNT 2
/**
* @}
*/
#if FAT_FAT32_SUPPORT
typedef uint32_t cluster_t;
#else
typedef uint16_t cluster_t;
#endif
#ifdef __cplusplus
}
#endif
#endif

52
sd_reader/fifo.c Normal file
View File

@ -0,0 +1,52 @@
#include "fifo.h"
static struct {
FIFO_TYPE buffer[FIFO_LEN];
uint16_t rd_ptr;
uint16_t wr_ptr;
uint16_t entries;
} fifo;
void fifo_init() {
fifo.rd_ptr = 0;
fifo.wr_ptr = 0;
fifo.entries = 0;
}
fifo_err_t fifo_pop(FIFO_TYPE* dest) {
// FIFO is empty, nothing to return!
if (fifo.entries == 0) {
return FIFO_EMPTY;
}
// Entries in FIFO, pop
*dest = fifo.buffer[fifo.rd_ptr];
fifo.rd_ptr++;
fifo.entries--;
// Ensure pointers don't overflow!
if (fifo.rd_ptr == FIFO_LEN) {
fifo.rd_ptr = 0;
}
return FIFO_SUCCESS;
}
fifo_err_t fifo_push(FIFO_TYPE src) {
// FIFO is full, don't store anything
if (fifo.entries == FIFO_LEN) {
return FIFO_FULL;
}
// FIFO has space, write
fifo.buffer[fifo.wr_ptr] = src;
fifo.wr_ptr++;
fifo.entries++;
// Ensure pointers don't overflow!
if (fifo.wr_ptr == FIFO_LEN) {
fifo.wr_ptr = 0;
}
return FIFO_SUCCESS;
}

36
sd_reader/fifo.h Normal file
View File

@ -0,0 +1,36 @@
#ifndef FIFO_H_
#define FIFO_H_
#include <stdint.h>
typedef enum {
FIFO_SUCCESS,
FIFO_FULL,
FIFO_EMPTY
} fifo_err_t;
#define FIFO_LEN 20
#define FIFO_TYPE uint8_t
/** @brief Initialises FIFO
*
* This MUST be called before any other fifo_* functions are called.
* Unless memory is initialised to 0. Then it's fine I guess.
*/
void fifo_init();
/** @brief Pops most recent addition off of FIFO buffer.
*
* @retval FIFO_SUCCESS Successfully read data from FIFO
* @retval FIFO_EMPTY Buffer was empty, no data read
*/
fifo_err_t fifo_pop(FIFO_TYPE* dest);
/** @brief Pushes entry onto FIFO buffer.
*
* @retval FIFO_SUCCESS successfully wrote data to FIFO buffer
* @retval FIFO_FULL buffer, was full, no data written
*/
fifo_err_t fifo_push(FIFO_TYPE src);
#endif

BIN
sd_reader/fifo.o Normal file

Binary file not shown.

223
sd_reader/main.c Normal file
View File

@ -0,0 +1,223 @@
/*
* Copyright (c) 2006-2012 by Roland Riegel <feedback@roland-riegel.de>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include "main.h"
#define DEBUG 1
const char* DATA_CHUNK_ID = "data";
/* ---- Control Flow Variables ---- */
// Commands
uint8_t cmd_depth = 0;
uint8_t cmd_state;
// Song playing
// TODO fix this atrocious naming
uint16_t song_buf[2][SONG_BUF_LEN]; //! Buffers to play song from
uint8_t song_position; //! where we are in the buffers
bool song_buf_select; //! which buffer we're using
bool song_selected; //! Flag to say we just selected the song, read data in
int8_t song_selection = -1; //! ID of selected song
uint32_t song_len;
uint32_t song_read_position;
typedef struct {
struct fat_file_struct* fd;
char* name;
} song_info_t;
song_info_t songs[MAX_SONG_NUM];
int main()
{
gpio_init();
timer_init();
usart_init();
// TODO set SPI to highest freq possible, might just need tweaking
sd_raw_init();
/* we will just use ordinary idle mode */
//set_sleep_mode(SLEEP_MODE_IDLE);
/* open first partition */
struct partition_struct* partition = partition_open(sd_raw_read,
sd_raw_read_interval,
0,
0,
0
);
if(!partition)
{
/* If the partition did not open, assume the storage device
* is a "superfloppy", i.e. has no MBR.
*/
partition = partition_open(sd_raw_read,
sd_raw_read_interval,
0,
0,
-1
);
}
/* open file system */
struct fat_fs_struct* fs = fat_open(partition);
/* open root directory */
struct fat_dir_entry_struct directory;
fat_get_dir_entry_of_path(fs, "/", &directory);
struct fat_dir_struct* dd = fat_open_dir(fs, &directory);
// Get all of the song names
struct fat_dir_entry_struct dir_entry;
uint8_t song_id = 0;
while(fat_read_dir(dd, &dir_entry)) {
// too many files!
if (song_id == MAX_SONG_NUM) {
break;
}
// Is file, so add to list
if (!(dir_entry.attributes & FAT_ATTRIB_DIR)) {
// TODO add checking if its .wav
// Copy song name into memory
uint8_t len = strlen(dir_entry.long_name);
songs[song_id].name = malloc(len);
strcpy(songs[song_id].name, dir_entry.long_name);
// Open file and keep info in songs
fat_open_file(fs, (const struct fat_dir_entry_struct*) songs[song_id].fd);
// Move on to reading next song
song_id++;
}
}
// Print out all files/directories in top level
while (1) {
/// do stuff
// Handle incoming commands
if (cmd_depth == 0) {
if (fifo_pop(&cmd_state) == FIFO_SUCCESS) {
// Handle incoming command
switch(cmd_state) {
case (COMMS_CMD_PAUSE):
// Turn off interrupts for play timer to stop playing
TIFR0 &= ~(1 << OCF0A);
cmd_depth = 0;
break;
case (COMMS_CMD_PLAY):
// Turn on interrupts for play timer to start playing
TIFR0 |= (1 << OCF0A);
cmd_depth = 0;
break;
case (COMMS_CMD_SELECT_FILE):
// stop playing whatever song we have right now
// Wait for next loop to handle file
TIFR0 &= ~(1 << OCF0A);
cmd_depth = 1;
break;
case (COMMS_CMD_QUERY_NAME):
// Wait for next loop to handle file info
cmd_depth = 1;
break;
}
}
}
if (cmd_depth == 1) {
uint8_t song_id;
if (fifo_pop(&song_id) == FIFO_SUCCESS) {
switch (cmd_state) {
case (COMMS_CMD_SELECT_FILE):
// select proper song and begin reading in
song_selection = song_id;
song_selected = 1;
break;
case (COMMS_CMD_QUERY_NAME):
// Just going to hope we can bump the UART baudrate up high enough
comms_reply_name(songs[song_id].name);
break;
}
}
}
// TODO check here if we are running into the end of our song buffer, and read in song data
if (song_position > 128 || song_selected) {
// Select opposite buffer
bool read_song_buf = !song_buf_select;
// Need to get past the metadata
if (song_selected) {
// Seek beginning of file
fat_seek_file(songs[song_selection].fd, 0, FAT_SEEK_SET);
// Iterate until we get the data
bool is_data = false;
ck_hdr_t header;
while (!is_data) {
fat_read_file(songs[song_selection].fd,
(uint8_t* ) &header, sizeof(ck_hdr_t));
// Ghetto strcmp
for (uint8_t i = 0; i < 4; i++) {
if (DATA_CHUNK_ID[i] == header.ckID[i]) {
is_data = true;
} else {
break;
}
}
// If this is metadata, skip the chunk
int32_t* offset = NULL;
*offset = header.cksize;
if (!is_data) {
fat_seek_file(songs[song_selection].fd,
offset, FAT_SEEK_CUR);
}
}
// We are now at the actual data
// divide by two to get uint16
song_len = header.cksize / 2;
song_read_position = 0;
}
// hit end of song, no more to read
if (song_read_position == song_len) {
song_read_position = 0;
TIFR0 &= ~(1 << OCF0A);
return 0;
}
// Read in file
// 512 bytes to read, 256 samples
fat_read_file(songs[song_selection].fd, (uint8_t*) song_buf[read_song_buf], 512);
song_read_position += 256;
// If we selected the song, make sure we start playing from the right buffer
if (song_selected) {
song_buf_select = read_song_buf;
}
// Ensure we don't "re-select" the song
song_selected = false;
}
}
return 0;
}

28
sd_reader/main.h Normal file
View File

@ -0,0 +1,28 @@
#ifndef MAIN_H_
#define MAIN_H_
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <avr/pgmspace.h>
#include <avr/sleep.h>
#include "fat.h"
#include "fat_config.h"
#include "partition.h"
#include "sd_raw.h"
#include "sd_raw_config.h"
#include "fifo.h"
#include "comms.h"
#include "periph.h"
#include "wav.h"
#define MAX_SONG_NUM 9
#define SONG_BUF_LEN 256 // NO MORE THAN 256!!!
// Song playing
extern uint16_t song_buf[2][SONG_BUF_LEN]; //! Buffers to play song from
extern uint8_t song_position; //! where we are in the buffers
extern bool song_buf_select; //! which buffer we're using
#endif

BIN
sd_reader/main.o Normal file

Binary file not shown.

155
sd_reader/partition.c Normal file
View File

@ -0,0 +1,155 @@
/*
* Copyright (c) 2006-2012 by Roland Riegel <feedback@roland-riegel.de>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of either the GNU General Public License version 2
* or the GNU Lesser General Public License version 2.1, both as
* published by the Free Software Foundation.
*/
#include "byteordering.h"
#include "partition.h"
#include "partition_config.h"
#include "sd-reader_config.h"
#include <string.h>
#if USE_DYNAMIC_MEMORY
#include <stdlib.h>
#endif
/**
* \addtogroup partition Partition table support
*
* Support for reading partition tables and access to partitions.
*
* @{
*/
/**
* \file
* Partition table implementation (license: GPLv2 or LGPLv2.1)
*
* \author Roland Riegel
*/
/**
* \addtogroup partition_config Configuration of partition table support
* Preprocessor defines to configure the partition support.
*/
#if !USE_DYNAMIC_MEMORY
static struct partition_struct partition_handles[PARTITION_COUNT];
#endif
/**
* Opens a partition.
*
* Opens a partition by its index number and returns a partition
* handle which describes the opened partition.
*
* \note This function does not support extended partitions.
*
* \param[in] device_read A function pointer which is used to read from the disk.
* \param[in] device_read_interval A function pointer which is used to read in constant intervals from the disk.
* \param[in] device_write A function pointer which is used to write to the disk.
* \param[in] device_write_interval A function pointer which is used to write a data stream to disk.
* \param[in] index The index of the partition which should be opened, range 0 to 3.
* A negative value is allowed as well. In this case, the partition opened is
* not checked for existance, begins at offset zero, has a length of zero
* and is of an unknown type. Use this in case you want to open the whole device
* as a single partition (e.g. for "super floppy" use).
* \returns 0 on failure, a partition descriptor on success.
* \see partition_close
*/
struct partition_struct* partition_open(device_read_t device_read, device_read_interval_t device_read_interval, device_write_t device_write, device_write_interval_t device_write_interval, int8_t index)
{
struct partition_struct* new_partition = 0;
uint8_t buffer[0x10];
if(!device_read || !device_read_interval || index >= 4)
return 0;
if(index >= 0)
{
/* read specified partition table index */
if(!device_read(0x01be + index * 0x10, buffer, sizeof(buffer)))
return 0;
/* abort on empty partition entry */
if(buffer[4] == 0x00)
return 0;
}
/* allocate partition descriptor */
#if USE_DYNAMIC_MEMORY
new_partition = malloc(sizeof(*new_partition));
if(!new_partition)
return 0;
#else
new_partition = partition_handles;
uint8_t i;
for(i = 0; i < PARTITION_COUNT; ++i)
{
if(new_partition->type == PARTITION_TYPE_FREE)
break;
++new_partition;
}
if(i >= PARTITION_COUNT)
return 0;
#endif
memset(new_partition, 0, sizeof(*new_partition));
/* fill partition descriptor */
new_partition->device_read = device_read;
new_partition->device_read_interval = device_read_interval;
new_partition->device_write = device_write;
new_partition->device_write_interval = device_write_interval;
if(index >= 0)
{
new_partition->type = buffer[4];
new_partition->offset = read32(&buffer[8]);
new_partition->length = read32(&buffer[12]);
}
else
{
new_partition->type = 0xff;
}
return new_partition;
}
/**
* Closes a partition.
*
* This function destroys a partition descriptor which was
* previously obtained from a call to partition_open().
* When this function returns, the given descriptor will be
* invalid.
*
* \param[in] partition The partition descriptor to destroy.
* \returns 0 on failure, 1 on success.
* \see partition_open
*/
uint8_t partition_close(struct partition_struct* partition)
{
if(!partition)
return 0;
/* destroy partition descriptor */
#if USE_DYNAMIC_MEMORY
free(partition);
#else
partition->type = PARTITION_TYPE_FREE;
#endif
return 1;
}
/**
* @}
*/

212
sd_reader/partition.h Normal file
View File

@ -0,0 +1,212 @@
/*
* Copyright (c) 2006-2012 by Roland Riegel <feedback@roland-riegel.de>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of either the GNU General Public License version 2
* or the GNU Lesser General Public License version 2.1, both as
* published by the Free Software Foundation.
*/
#ifndef PARTITION_H
#define PARTITION_H
#include <stdint.h>
#include "sd_raw_config.h"
#include "partition_config.h"
#ifdef __cplusplus
extern "C"
{
#endif
/**
* \addtogroup partition
*
* @{
*/
/**
* \file
* Partition table header (license: GPLv2 or LGPLv2.1)
*
* \author Roland Riegel
*/
/**
* The partition table entry is not used.
*/
#define PARTITION_TYPE_FREE 0x00
/**
* The partition contains a FAT12 filesystem.
*/
#define PARTITION_TYPE_FAT12 0x01
/**
* The partition contains a FAT16 filesystem with 32MB maximum.
*/
#define PARTITION_TYPE_FAT16_32MB 0x04
/**
* The partition is an extended partition with its own partition table.
*/
#define PARTITION_TYPE_EXTENDED 0x05
/**
* The partition contains a FAT16 filesystem.
*/
#define PARTITION_TYPE_FAT16 0x06
/**
* The partition contains a FAT32 filesystem.
*/
#define PARTITION_TYPE_FAT32 0x0b
/**
* The partition contains a FAT32 filesystem with LBA.
*/
#define PARTITION_TYPE_FAT32_LBA 0x0c
/**
* The partition contains a FAT16 filesystem with LBA.
*/
#define PARTITION_TYPE_FAT16_LBA 0x0e
/**
* The partition is an extended partition with LBA.
*/
#define PARTITION_TYPE_EXTENDED_LBA 0x0f
/**
* The partition has an unknown type.
*/
#define PARTITION_TYPE_UNKNOWN 0xff
/**
* A function pointer used to read from the partition.
*
* \param[in] offset The offset on the device where to start reading.
* \param[out] buffer The buffer into which to place the data.
* \param[in] length The count of bytes to read.
*/
typedef uint8_t (*device_read_t)(offset_t offset, uint8_t* buffer, uintptr_t length);
/**
* A function pointer passed to a \c device_read_interval_t.
*
* \param[in] buffer The buffer which contains the data just read.
* \param[in] offset The offset from which the data in \c buffer was read.
* \param[in] p An opaque pointer.
* \see device_read_interval_t
*/
typedef uint8_t (*device_read_callback_t)(uint8_t* buffer, offset_t offset, void* p);
/**
* A function pointer used to continuously read units of \c interval bytes
* and call a callback function.
*
* This function starts reading at the specified offset. Every \c interval bytes,
* it calls the callback function with the associated data buffer.
*
* By returning zero, the callback may stop reading.
*
* \param[in] offset Offset from which to start reading.
* \param[in] buffer Pointer to a buffer which is at least interval bytes in size.
* \param[in] interval Number of bytes to read before calling the callback function.
* \param[in] length Number of bytes to read altogether.
* \param[in] callback The function to call every interval bytes.
* \param[in] p An opaque pointer directly passed to the callback function.
* \returns 0 on failure, 1 on success
* \see device_read_t
*/
typedef uint8_t (*device_read_interval_t)(offset_t offset, uint8_t* buffer, uintptr_t interval, uintptr_t length, device_read_callback_t callback, void* p);
/**
* A function pointer used to write to the partition.
*
* \param[in] offset The offset on the device where to start writing.
* \param[in] buffer The buffer which to write.
* \param[in] length The count of bytes to write.
*/
typedef uint8_t (*device_write_t)(offset_t offset, const uint8_t* buffer, uintptr_t length);
/**
* A function pointer passed to a \c device_write_interval_t.
*
* \param[in] buffer The buffer which receives the data to write.
* \param[in] offset The offset to which the data in \c buffer will be written.
* \param[in] p An opaque pointer.
* \returns The number of bytes put into \c buffer
* \see device_write_interval_t
*/
typedef uintptr_t (*device_write_callback_t)(uint8_t* buffer, offset_t offset, void* p);
/**
* A function pointer used to continuously write a data stream obtained from
* a callback function.
*
* This function starts writing at the specified offset. To obtain the
* next bytes to write, it calls the callback function. The callback fills the
* provided data buffer and returns the number of bytes it has put into the buffer.
*
* By returning zero, the callback may stop writing.
*
* \param[in] offset Offset where to start writing.
* \param[in] buffer Pointer to a buffer which is used for the callback function.
* \param[in] length Number of bytes to write in total. May be zero for endless writes.
* \param[in] callback The function used to obtain the bytes to write.
* \param[in] p An opaque pointer directly passed to the callback function.
* \returns 0 on failure, 1 on success
* \see device_write_t
*/
typedef uint8_t (*device_write_interval_t)(offset_t offset, uint8_t* buffer, uintptr_t length, device_write_callback_t callback, void* p);
/**
* Describes a partition.
*/
struct partition_struct
{
/**
* The function which reads data from the partition.
*
* \note The offset given to this function is relative to the whole disk,
* not to the start of the partition.
*/
device_read_t device_read;
/**
* The function which repeatedly reads a constant amount of data from the partition.
*
* \note The offset given to this function is relative to the whole disk,
* not to the start of the partition.
*/
device_read_interval_t device_read_interval;
/**
* The function which writes data to the partition.
*
* \note The offset given to this function is relative to the whole disk,
* not to the start of the partition.
*/
device_write_t device_write;
/**
* The function which repeatedly writes data to the partition.
*
* \note The offset given to this function is relative to the whole disk,
* not to the start of the partition.
*/
device_write_interval_t device_write_interval;
/**
* The type of the partition.
*
* Compare this value to the PARTITION_TYPE_* constants.
*/
uint8_t type;
/**
* The offset in blocks on the disk where this partition starts.
*/
uint32_t offset;
/**
* The length in blocks of this partition.
*/
uint32_t length;
};
struct partition_struct* partition_open(device_read_t device_read, device_read_interval_t device_read_interval, device_write_t device_write, device_write_interval_t device_write_interval, int8_t index);
uint8_t partition_close(struct partition_struct* partition);
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif

BIN
sd_reader/partition.o Normal file

Binary file not shown.

View File

@ -0,0 +1,44 @@
/*
* Copyright (c) 2006-2012 by Roland Riegel <feedback@roland-riegel.de>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of either the GNU General Public License version 2
* or the GNU Lesser General Public License version 2.1, both as
* published by the Free Software Foundation.
*/
#ifndef PARTITION_CONFIG_H
#define PARTITION_CONFIG_H
#ifdef __cplusplus
extern "C"
{
#endif
/**
* \addtogroup partition
*
* @{
*/
/**
* \file
* Partition configuration (license: GPLv2 or LGPLv2.1)
*/
/**
* \ingroup partition_config
* Maximum number of partition handles.
*/
#define PARTITION_COUNT 1
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif

91
sd_reader/periph.c Normal file
View File

@ -0,0 +1,91 @@
#include "main.h"
#include <avr/interrupt.h>
/** @brief intercepts incoming Serial commands
*/
ISR(USART_RX_vect) {
cli();
// Read byte into FIFO
fifo_push(UDR0);
// Flag is cleared by reading data from UDR
sei();
}
/** @brief Interrupt handler for actually playing music
*
* Will only be called if the TIFR OCF0A flag is high, using that as our play/pause flag
*
* This may be possible to hand-optimise better, but I cut it down to ~40 instructions
* which should be fine at 16MHz
*/
ISR(TIMER0_COMPA_vect) {
cli();
// Handle music playing
/* DAC0 -> DAC5 are on PC0 -> PC5
* Nothing relevent is on the rest of PORTC
*
* DAC6 -> DAC11 is PD2->PD7
*
* DAC12 and DAC13 are PB0 and PB1
*/
uint16_t in_data = song_buf[song_buf_select][song_position];
// Split into 8 bit because we are using an 8 bit MCU, so code can be better
uint8_t data_lo = in_data;
uint8_t data_hi = in_data >> 8;
// DAC0 -> DAC5
PORTC = (data_lo >> 2) & 0x3F;
// DAC6 -> DAC11
PORTD &= 0x03;
PORTD |= data_hi << 2;
// DAC12 and DAC13
PORTB &= 0xFC; // clear bits
PORTB |= data_hi >> 6;
// Go to next sample
song_position++;
// Can just wrap if it's 8 bit
sei();
}
void gpio_init() {
// Initialise all DAC outputs
/* DAC0 -> DAC5 are on PC0 -> PC5
* Nothing relevent is on the rest of PORTC
*
* DAC6 -> DAC11 is PD2->PD7
*
* DAC12 and DAC13 are PB0 and PB1
*/
DDRC |= 0x3F;
DDRD |= 0xFC;
DDRC |= 0x03;
}
void timer_init() {
// Compare outputs should be default, nothing
// Set to CTC, WGM = 0b010
TCCR0A = (1 << OCIE0A);
// Set timer to use clock input w/o prescaling
TCCR0B = 1;
// 16 MHz / 44kHz = 182 clock cycles
// Pushing it for time, may have to move to 8 bit...
OCR0A = 182;
// Don't enable the interrupt yet
}
void usart_init() {
// set baudrate
UBRR0L = UBRR_VALUE & 255;
UBRR0H = UBRR_VALUE >> 8;
// Set data info, no parity, 1 stop, 8-bit
UCSR0C |= (1 << UCSZ01) | (1 << UCSZ00);
// Start it up
UCSR0B |= (1 << TXEN0) | (1 << RXEN0);
}

13
sd_reader/periph.h Normal file
View File

@ -0,0 +1,13 @@
#ifndef PERIPH_H_
#define PERIPH_H_
#define USART_BAUDRATE 9600 //! USART baudrate, change this to set it.
#define UBRR_VALUE (((F_CPU/(USART_BAUDRATE*16UL)))-1)
// TODO comments
void gpio_init();
void timer_init();
void usart_init();
#endif

BIN
sd_reader/periph.o Normal file

Binary file not shown.

920
sd_reader/sd-reader.hex Normal file
View File

@ -0,0 +1,920 @@
:100000000C9443000C9460000C9460000C9460000D
:100010000C9460000C9460000C9460000C946000E0
:100020000C9460000C9460000C9460000C946000D0
:100030000C9460000C9460000C94E1060C94600039
:100040000C9460000C9460000C94B9060C94600051
:100050000C9460000C9460000C9460000C946000A0
:100060000C9460000C946000DE05DC05DC05D8050E
:10007000D805D805D805D805D605BD05BD05BD05EB
:10008000BD05B805E00511241FBECFEFD8E0DEBFE7
:10009000CDBF11E0A0E0B1E0E8E4F9E302C00590D3
:1000A0000D92AE31B107D9F726E0AEE1B1E001C063
:1000B0001D92A039B207E1F70E941C180C94A21CF3
:1000C0000C9400006F927F928F929F92AF92BF929A
:1000D000CF92DF92EF92FF920F931F93CF93DF9314
:1000E000CDB7DEB760970FB6F894DEBF0FBECDBFB9
:1000F000009761F16115710549F104303CF507FD88
:100100003CC039014A015B016C0120E10202C001DF
:10011000112482549E4FE92FEE0FEE0B20E1E22EC8
:10012000F12C8E010F5F1F4F9C014E2F5E2F6E2F03
:100130007E2F8E2F9E2FF6010995882339F08D8111
:10014000882321F0909126019923B9F180E090E075
:1001500060960FB6F894DEBF0FBECDBFDF91CF9192
:100160001F910F91FF90EF90DF90CF90BF90AF90D5
:100170009F908F907F906F900895E0912601E111FC
:10018000E5CF0EE111E0A1E1F8011192AA95E9F79E
:1001900090931F0180931E017093210160932001B1
:1001A0005093230140932201309325012093240191
:1001B0008FEF80932601C801CBCFEEE1F1E091E112
:1001C000DF011D929A95E9F7D0921F01C0921E019E
:1001D000B0922101A09220019092230180922201ED
:1001E000709225016092240180932601CE01099628
:1001F0000E94A9066093270170932801809329012A
:1002000090932A01CE010D960E94A90660932B01BE
:1002100070932C0180932D0190932E018EE191E03B
:1002200097CF009721F0FC01108681E0089580E0CF
:1002300008950F931F939FEF9EBD0DB407FEFDCF52
:100240009DB59F779DBD9EB5982F90649EBD0DB4C2
:1002500007FEFDCF9DB59F779DBD072F1127222754
:1002600033270EBD0DB407FEFDCF9DB59F779DBD15
:100270008B01222733270EBD0DB407FEFDCF9DB5A0
:100280009F779DBD052F162F272F33270EBD0DB449
:1002900007FEFDCF9DB59F779DBD4EBD0DB407FEFA
:1002A000FDCF9DB59F779DBD882331F18830C9F47E
:1002B00087E88EBD0DB407FEFDCF8DB58F778DBD60
:1002C0009AE02FEF2EBD0DB407FEFDCF8DB58F77D1
:1002D0008DBD8EB58F3F11F49150A1F71F910F91F5
:1002E00008958FEF8EBD0DB407FEFDCF8DB58F77CE
:1002F0008DBD9AE02FEFE6CF85E98EBD0DB407FEE8
:10030000FDCF8DB58F778DBD9AE02FEFDBCF9FEFBF
:100310009EBD0DB407FEFDCF9DB59F779DBD9EB5DB
:10032000982F90649EBD0DB407FEFDCF9DB59F77BD
:100330009DBD1EBC0DB407FEFDCF9DB59F779DBD35
:100340001EBC0DB407FEFDCF9DB59F779DBD1EBCA5
:100350000DB407FEFDCF9DB59F779DBD1EBC0DB4AE
:1003600007FEFDCF9DB59F779DBD882321F1883085
:10037000B9F487E88EBD0DB407FEFDCF8DB58F773C
:100380008DBD9AE02FEF2EBD0DB407FEFDCF8DB5CC
:100390008F778DBD8EB58F3F11F49150A1F70895E1
:1003A0008FEF8EBD0DB407FEFDCF8DB58F778DBD60
:1003B0009AE02FEFE8CF85E98EBD0DB407FEFDCFA3
:1003C0008DB58F778DBD9AE02FEFDDCFBF92CF92A5
:1003D000DF92EF92FF920F931F93CF93DF933C989E
:1003E0003D98239A259A229A24982A9A83E58CBDCF
:1003F0008DB58E7F8DBD10922F0134994AC01AE0C1
:100400009FEF9EBD0DB407FEFDCF8DB58F778DBDDF
:100410008EB51150B1F72A98C0E0D2E003C0219701
:1004200009F4B5C080E00E9487018130C1F74AEA33
:1004300051E060E070E088E00E94190182FD35C063
:100440008FEF8EBD0DB407FEFDCF8DB58F778DBDBF
:100450008EB58FEF8EBD0DB407FEFDCF8DB58F77B6
:100460008DBD8EB58FEF8EBD0DB407FEFDCF8DB562
:100470008F778DBD0EB400FE0CC08FEF8EBD0DB416
:1004800007FEFDCF8DB58F778DBD8EB58A3A09F405
:1004900078C010E0812FDF91CF911F910F91FF90D5
:1004A000EF90DF90CF90BF90089587E30E9487017F
:1004B00089E20E94870182FF70C080912F01082F7E
:1004C0000370982F9270B92E81FF63C0C12CD12C7C
:1004D000E12C80E4F82EC0E0D0E80DC087E30E9454
:1004E0008701B701A60189E20E94190180FF0AC0B5
:1004F000219709F44CC00111F1CF81E00E948701DE
:1005000080FDF6CFBB2059F18AE30E94870181115B
:1005100050C08FEF8EBD0DB407FEFDCF8DB58F7728
:100520008DBD0EB406FC3FC08FEF8EBD0DB407FE2F
:10053000FDCF8DB58F778DBD8EB58FEF8EBD0DB490
:1005400007FEFDCF8DB58F778DBD8EB58FEF8EBD3C
:100550000DB407FEFDCF8DB58F778DBD8EB540E014
:1005600052E060E070E080E10E9419012A9A811156
:1005700090CF8CB58C7F8CBD8DB581608DBD11E029
:1005800089CF80912F01826080932F0198CF2A9A82
:1005900081CFC12CD12C76019ECF80912F0181601B
:1005A00080932F018CCF80912F01846080932F0145
:1005B000BBCF2A9A6ECF86B18295817091E0892750
:1005C000089586B185FB882780F991E089270895F1
:1005D0002F923F924F925F926F927F928F929F9253
:1005E000AF92BF92CF92DF92EF92FF920F931F9341
:1005F000CF93DF93CDB7DEB760970FB6F894DEBF29
:100600000FBECDBF29833A834B835C836D837E838A
:100610008F83988738012701EF2809F4A3C0212C84
:1006200082E0382E89809A8021E09222940140E075
:1006300050E060E070E0CB0189863A874B875C87A9
:100640006D877E878F87988B29813A814B815C816A
:100650006D817E818F819885A984BA84C12CD12C2B
:10066000E12CF12C00E010E00E94321B7101E8182F
:10067000F9084E145F0408F472012A98E0912F01E2
:10068000E2FF03C009E00E94011BBA01422F532F71
:1006900081E10E941901811167C03FEF3EBD0DB499
:1006A00007FEFDCF8DB58F778DBD8EB58E3FA9F737
:1006B000A4014E0D5F1D80E090E06FEF6EBD0DB4A4
:1006C00007FEFDCF2DB52F772DBD2EB588159905C9
:1006D00048F08417950730F4F301208393012F5FCE
:1006E0003F4F39010196811532E0930731F74FEF03
:1006F0004EBD0DB407FEFDCF8DB58F778DBD8EB588
:100700005FEF5EBD0DB407FEFDCF8DB58F778DBD5C
:100710008EB52A9A6FEF6EBD0DB407FEFDCF8DB575
:100720008F778DBD8EB54E185F08970140E050E081
:1007300060E070E080E090E0A980BA80CB80DC804F
:10074000ED80FE800F8118850E941D1B29833A834E
:100750004B835C836D837E838F8398874114510420
:1007600009F060CF81E002C02A9A80E060960FB65F
:10077000F894DEBF0FBECDBFDF91CF911F910F91D7
:10078000FF90EF90DF90CF90BF90AF909F908F90B1
:100790007F906F905F904F903F902F9008952F9291
:1007A0003F924F925F926F927F928F929F92AF9201
:1007B000BF92CF92DF92EF92FF920F931F93CF934E
:1007C000DF93CDB7DEB76A970FB6F894DEBF0FBEE2
:1007D000CDBF29833A834B835C836D837E838F8374
:1007E00098871C8B0B8B2701DA86C986BE8AAD8A57
:1007F000988E8F8A012B09F436C1E114F10409F4B3
:1008000032C1CE14DF0408F42EC1AB2809F42BC189
:100810002A9866246A9477247A942B883C882E0C34
:100820003F1C29813A8131703A8F298F812C92E0C7
:10083000992E821A930A80912F0182FFF9C0298193
:100840003A814B815C816D817E818F81988509E041
:100850000E94011BF22FE32F942F852F4F2F5E2F25
:10086000692F782F81E10E9419018111F2C06EBCBD
:100870000DB407FEFDCF8DB58F778DBD8EB58E3F44
:10088000B1F7698D7A8D6115710581F0AB0120E0BA
:1008900030E06EBC0DB407FEFDCF8DB58F778DBDFA
:1008A0008EB52F5F3F4F4217530799F78414950475
:1008B00008F4F3C089859A858415950508F4EDC080
:1008C000E98DFA8DFC87EB87EB89FC897EBC0DB442
:1008D00007FEFDCF8DB58F778DBD8EB581932E161A
:1008E0003F06A1F7EB85FC859F0140E050E060E00A
:1008F00070E080E090E0A980BA80CB80DC80ED8061
:10090000FE800F8118850E941D1BEF88F88C8901DD
:100910009A01AB01BC018B899C89ED89FE890995FF
:10092000882309F49BC08418950829853A852419E1
:1009300035093A8729878114910409F48DC021155E
:10094000310571F08414950458F0A9012B853C857C
:10095000240D351D3C872B874415550508F0B4CF71
:1009600051E0851A9108E0E06EBC0DB407FEFDCFA2
:100970008DB58F778DBD8EB531E0831A9108A0F7C4
:100980006EBC0DB407FEFDCF8DB58F778DBD8EB5D6
:100990006EBC0DB407FEFDCF8DB58F778DBD8EB5C6
:1009A00069857A8564157505B8F1498D5A8D9A0166
:1009B00040E050E060E070E0CB012B873C874D8742
:1009C0005E876F87788B898B9A8B20E032E040E0DE
:1009D00050E060E070E080E090E0AB84BC84C12C2B
:1009E000D12CE12CF12C00E010E00E94321BA980F8
:1009F000BA80CB80DC80ED80FE800F8118850E945C
:100A00001D1B29833A834B835C836D837E838F8395
:100A10009887EE2309F405CF2A9A8FEF8EBD0DB487
:100A200007FEFDCF8DB58F778DBD8EB581E01CC0E3
:100A3000C901A0E0B0E049815A816B817C81481BEB
:100A4000590B6A0B7B0B81E10E941901882309F481
:100A50000ECF2A9A80E008C0E0E092CF61E0861ACB
:100A60009108E1E081CF80E06A960FB6F894DEBF8E
:100A70000FBECDBFDF91CF911F910F91FF90EF90EF
:100A8000DF90CF90BF90AF909F908F907F906F90AE
:100A90005F904F903F902F90089588248A949924D6
:100AA0009394698D7A8D861A970AE0E05DCF4F9214
:100AB0005F926F927F928F929F92AF92BF92CF92EE
:100AC000DF92EF92FF920F931F93CF93DF93EC018E
:100AD000892B29F096B1192F107194FF13C010E0E3
:100AE000812FDF91CF911F910F91FF90EF90DF90B9
:100AF000CF90BF90AF909F908F907F906F905F90BE
:100B00004F9008958DE1FE0111928A95E9F72A9898
:100B10008AE00E9487018111D3C09FEF9EBD0DB472
:100B200007FEFDCF8DB58F778DBD8EB58E3FB1F7AA
:100B3000DE0120E630E081E01FEFEFEFE80F1EBDA1
:100B40000DB407FEFDCF9DB59F779DBD9EB54E2F81
:100B500050E04F30510538F08231E1F18F5F28507D
:100B600031091196EACFFA01EC5CFF4F0C94511A4F
:100B7000492F4295407F4F87F1CF492F50E060E0E9
:100B800070E0022E04C0440F551F661F771F0A94A1
:100B9000D2F7CB84DC84ED84FE844C295D296E2958
:100BA0007F294B875C876D877E87D8CF9A87D6CF82
:100BB00011969C931197D2CF9C93D0CF9883CECF90
:100BC000492F42954F705F85452B4F87492F4F70B6
:100BD000488BC4CF89E00E948701E82F811152C061
:100BE0009FEF9EBD0DB407FEFDCF8DB58F778DBDF8
:100BF0008EB58E3FB1F7F1E010E0A0E0B0E0C12C7F
:100C0000E12CFF24FA94DD24D394FEBC0DB407FE3E
:100C1000FDCF8DB58F778DBD9EB5EE2309F46CC0E9
:100C2000EE3009F483C0113081F1111138C0E73082
:100C300009F448C0C8F1E93009F45AC008F44EC0BC
:100C4000EA3069F5991F9927991FC92AAD0160E01B
:100C500070E08E2D90E08C0D911D029604C0440F23
:100C6000551F661F771F8A95D2F79A01AB01298B12
:100C70003A8B4B8B5C8B1D8A1E8A1F8A188EFF5FF6
:100C8000EF5FC3CF2A9A10E02BCFE730B9F028F0FE
:100C9000EA3018F4BA2FAA27A92BE93099F1F231DA
:100CA00071F72A9A11E01CCFE530A9F0E630B9F7C8
:100CB0009370892F90E0B82FAA27E1CF9F73EACFD6
:100CC0002A9A0ECF9D01292BC901DC01AA0FBB1F57
:100CD000AA0FBB1FD4CF9F70E92ED1CF92959695C6
:100CE000969593709D01292BC901DC011196C7CF00
:100CF0009370C92ECC0CC3CF192F1295169516954B
:100D00001370BDCF11969D0140E050E060E070E0AF
:100D100080E090E003E10E94E61A298B3A8B4B8B2E
:100D20005C8B6D8B7E8B8F8B988FA9CF96FDD98E28
:100D300095FDDA8E94FDDB8E292F2C7030E03595F1
:100D40002795359527952C8F9ACFFC01808191812D
:100D50000895FC0160817181828193810895FC0175
:100D6000718360830895FC017383628351834083A0
:100D700008951F920F920FB60F9211242F933F9355
:100D80004F935F936F937F938F939F93AF93BF9393
:100D9000EF93FF93F8948091C6000E94F217789425
:100DA000FF91EF91BF91AF919F918F917F916F9143
:100DB0005F914F913F912F910F900FBE0F901F9019
:100DC00018951F920F920FB60F9211242F933F93F5
:100DD0004F938F939F93EF93FF93F894E0915D0669
:100DE000F0E080918B06FE2FEE27E80FF11DEE0F4D
:100DF000FF1FE35AFD4F2081818190E026952695C3
:100E000028B92BB123702BB94BB19C01220F331F92
:100E1000220F331F242B2BB995B19C7F95B995B127
:100E20008295869586958370892B85B980918B06EE
:100E30008F5F80938B067894FF91EF919F918F91B4
:100E40004F913F912F910F900FBE0F901F901895CB
:100E500087B18F6387B98AB18C6F8AB987B1836094
:100E600087B9089582E084BD81E085BD86EB87BDAA
:100E7000089587E68093C4001092C500E2ECF0E08C
:100E8000808186608083E1ECF0E0808188618083EE
:100E900008958F929F92AF92BF92CF92DF92EF927E
:100EA000FF920F931F93CF93DF9300D000D0CDB765
:100EB000DEB7009769F1423051056105710540F1D7
:100EC000FC01A081B18118968C9118974A015B01B1
:100ED0009A01A50160E070E08B30D9F180E090E0EC
:100EE00001E00E94E61AA284B384C484D584E68417
:100EF000F784008911890E941D1BED91FC91A2E0ED
:100F0000EA2EF12C8E010F5F1F4F0995811115C03C
:100F100060E070E080E090E00F900F900F900F90F5
:100F2000DF91CF911F910F91FF90EF90DF90CF90C5
:100F3000BF90AF909F908F90089589819A816C01A6
:100F4000E12CF12C01978F3E9F4F10F7B601C7019E
:100F5000E3CF80E090E002E00E94E61AA284B3842E
:100F6000C484D584E684F784008911890E941D1BFE
:100F7000ED91FC91B4E0EB2EF12C8E010F5F1F4F31
:100F80000995882329F2C980DA80EB80FC80C1149E
:100F9000D104E104F10409F4BBCFD701C601805F9D
:100FA0009F4FAF4FBF404097A105B10578F6B0CF36
:100FB000CF92DF92EF92FF920F931F93CF93DF9325
:100FC000F701C480D580C114D104D1F08C01C0E0F8
:100FD000D0E0C8018C0F9D1F0E94A506892B61F4EB
:100FE000F70180819181A281B3810196A11DB11D7C
:100FF00080839183A283B3832296CC15DD0548F3C9
:1010000081E0DF91CF911F910F91FF90EF90DF90E2
:10101000CF900895BF92CF92DF92EF92FF920F93FD
:101020001F93CF93DF93CDB7DEB72D970FB6F8940C
:10103000DEBF0FBECDBFF701C080D180A281B381DA
:101040009096B383A283DC01EC90B5EEEB1609F425
:10105000DFC1EE2009F4DCC1DC011B96BC90BFE0CF
:10106000BB1609F4E7C1D601FC90FF2009F45DC06E
:10107000E0FAE794E7F8DC011196FC90AE2DAF0D95
:10108000EA2EE0FAE794E7F8DC011296FC90AE2D28
:10109000AF0DEA2EE0FAE794E7F8DC011396FC9036
:1010A000AE2DAF0DEA2EE0FAE794E7F8DC011496D6
:1010B000FC90AE2DAF0DEA2EE0FAE794E7F8DC01E4
:1010C0001596FC90AE2DAF0DEA2EE0FAE794E7F806
:1010D000DC011696FC90AE2DAF0DEA2EE0FAE794F7
:1010E000E7F8DC011796FC90AE2DAF0DEA2EE0FA82
:1010F000E794E7F8DC011896FC90AE2DAF0DEA2ED0
:10110000E0FAE794E7F8DC011996FC90AE2DAF0DFC
:10111000EA2EE0FAE794E7F8DC011A96FC90AE2D8F
:10112000AF0DF480FA1609F43FC1A1E3FA2ED601FF
:101130001D92FA94E9F7D60199960C9399979A968D
:101140001C939A979B962C939B979C963C939C9769
:101150009D964C939D979E965C939E979F966C93BD
:101160009F97D0967C93DC012C91203209F46FC2BA
:10117000D6012C93DC011C963C911C9733FF07C0D1
:101180003C9131543A3118F4205ED6012C93DC01A5
:1011900011962C91203209F45EC2D60111962C933F
:1011A000DC011C963C911C9733FF09C011963C91C1
:1011B00031543A3120F4205ED60111962C93DC0193
:1011C00012962C91203209F44AC2D60112962C9321
:1011D000DC011C963C911C9733FF09C012963C9190
:1011E00031543A3120F4205ED60112962C93DC0162
:1011F00013962C91203209F436C2D60113962C9303
:10120000DC011C963C911C9733FF09C013963C915E
:1012100031543A3120F4205ED60113962C93DC0130
:1012200014962C91203209F422C2D60114962C93E4
:10123000DC011C963C911C9733FF09C014963C912D
:1012400031543A3120F4205ED60114962C93DC01FF
:1012500015962C91203209F40EC2D60115962C93C6
:10126000DC011C963C911C9733FF09C015963C91FC
:1012700031543A3120F4205ED60115962C93DC01CE
:1012800016962C91203209F4FAC1D60116962C93A9
:10129000DC011C963C911C9733FF09C016963C91CB
:1012A00031543A3120F4205ED60116962C93DC019D
:1012B00017962C91203209F4C1C1D60117962C93B0
:1012C000DC011C963C911C9733FF06C017963C919D
:1012D00031543A3108F4A1C128E030E048E0D601A9
:1012E0005C91553009F496C1DC0118965C9150323E
:1012F00009F453C051E0540FD601A20FB31F2EE2E0
:101300002C93DC0118962C91203209F49DC1B60172
:10131000650F711DDB012C93DC011C963C911C9721
:1013200034FF06C018963C9131543A3108F47AC122
:1013300052E0540FDC0119962C91203209F484C13B
:10134000B601650F711DDB012C93DC011C963C91ED
:101350001C9734FF06C019963C9131543A3108F479
:1013600065C153E0540FDC011A962C91203209F428
:101370006BC1B601650F711DDB012C93DC011C965E
:101380003C911C9734FF06C01A963C9131543A3177
:1013900008F450C14C5F242F30E0D601A20FB31FD8
:1013A0001C92DC011B96BC907F018C01F601B0A25F
:1013B0004A960E94A506A0E0B0E0F60181A392A3A0
:1013C000A3A3B4A3C80144960E94A506A0E0B0E080
:1013D000DC0199278827F60141A152A163A174A1DC
:1013E000842B952BA62BB72B81A392A3A3A3B4A3E5
:1013F000C8014C960E94A906D60195966D937D93DF
:101400008D939C93989781E0F701858380E002C0DB
:10141000148281E02D960FB6F894DEBF0FBECDBFCB
:10142000DF91CF911F910F91FF90EF90DF90CF90C0
:10143000BF900895B480BB2031F0DC011D96FC9074
:10144000BF1409F4FFC0B1E3FB2ED6011D92FA943C
:10145000E9F7DC011D96FC901D97F482F60101A7C7
:1014600012A723A734A745A756A767A770AB2C914F
:101470002F7330E0215031096DE0629FA001639F1E
:10148000500D1124E9E0F1E0DE01119601900D927A
:101490006A95E1F74F31510508F0BAC02981FC0186
:1014A000E20FF11D2081F601E40FF51F20839A0160
:1014B0002F5F3F4F2F31310509F4AAC0D601A20F8B
:1014C000B31F6A81FC01E60FF11D60816C932F5FF1
:1014D0003F4F2F31310509F49BC0D601A20FB31F36
:1014E0006B81FC01E60FF11D60816C932F5F3F4F14
:1014F0002F31310509F48CC0D601A20FB31F6C81C6
:10150000FC01E60FF11D60816C932F5F3F4F2F317F
:10151000310509F47DC0D601A20FB31F6D81FC0116
:10152000E60FF11D60816C932F5F3F4F2F31310526
:1015300009F46EC0D601A20FB31F6E81FC01E60F45
:10154000F11D60816C932F5F3F4F2F31310509F4FE
:101550005FC0D601A20FB31F6F81FC01E60FF11D22
:1015600060816C932F5F3F4F2F31310509F450C0DC
:10157000D601A20FB31F6885FC01E60FF11D608143
:101580006C932F5F3F4F2F31310509F441C0D601D5
:10159000A20FB31F6985FC01E60FF11D60816C93FA
:1015A0002F5F3F4F2F31310599F1D601A20FB31FA5
:1015B0006A85FC01E60FF11D60816C932F5F3F4F40
:1015C0002F31310529F1D601A20FB31F6B85FC0124
:1015D000E60FF11D60816C932F5F3F4F2F31310576
:1015E000B9F0D601A20FB31F6C85FC01E60FF11D07
:1015F00060816C93445F5F4F4F31510549F0F601B4
:10160000E40FF51F2D85DC01A20FB11D8C918083A5
:1016100081E000CF55EE5C9367CE205ED601179631
:101620002C935ACE205EDB012C9382CE205EDB0110
:101630002C9397CE205EDB012C93ACCE47E027E0C5
:1016400030E04DCE2E2D14CF252F30E0A6CE40E039
:1016500020E030E044CE41E021E030E040CE42E006
:1016600022E030E03CCE43E023E030E038CE44E0FE
:1016700024E030E034CE45E025E030E030CE46E0F6
:1016800026E030E02CCECF92DF92EF92FF920F93C4
:101690001F93CF93DF93F701C480D580C114D10489
:1016A000E1F08C01C0E0D0E0C8018C0F9D1F0E94CA
:1016B000A906672B682B692B61F4F7018081918162
:1016C000A281B3810196A11DB11D80839183A28364
:1016D000B3832496CC15DD0538F381E0DF91CF91FB
:1016E0001F910F91FF90EF90DF90CF9008952F9270
:1016F0003F924F925F926F927F928F929F92AF92A2
:10170000BF92CF92DF92EF92FF920F931F93CF93EE
:10171000DF93CDB7DEB7CE54D1090FB6F894DEBF54
:101720000FBECDBF009731F02091E1013091E20171
:10173000232BE1F080E090E0C25BDF4F0FB6F8941E
:10174000DEBF0FBECDBFDF91CF911F910F91FF90F4
:10175000EF90DF90CF90BF90AF909F908F907F9051
:101760006F905F904F903F902F9008952C01E1EE85
:10177000F1E082E3DF011D928A95E9F75092E201E0
:101780004092E101F20181849284A384B4849401A3
:10179000A50160E070E080E090E009E00E94E61AB8
:1017A00059016A01962E872E3C01ABE00E94261B50
:1017B0000190F081E02DA5E2EA2EF12C8E010F5F61
:1017C0001F4F0995811107C01092E2011092E101AB
:1017D00080E090E0B1CFCE0101960E94A5061C01E9
:1017E000CE0104960E94A5067C010B810CAF1E81E0
:1017F0001DAFCE0107960E94A5069FAF8EAFCE010A
:1018000009960E94A5068C01CE010C960E94A506A1
:101810009BAF8AAFCE0146960E94A9066EA37FA316
:1018200088A799A7CE014A960E94A9066EAB7FAB06
:1018300088AF99AFCE0182960E94A9062C966CAF14
:101840007DAF8EAF9FAF2C972EA13FA148A559A584
:10185000232B242B252B09F444C1AAADBBAD109733
:1018600009F44BC18D0120E030E00EAB1FAB28AF77
:1018700039AF870120E030E00AAB1BAB2CAB3DABAE
:10188000EEA0FFA008A519A52AA93BA94CA95DA90E
:10189000E21AF30A040B150B9DAD892F90E0A0E02E
:1018A000B0E024968CAF9DAFAEAFBFAF24979C0144
:1018B000AD016EA97FA988AD99AD0E940B1AE61AF9
:1018C000F70A080B190BC10101972EAD3FAD220F8E
:1018D000331F22953295307F3227207F3227820FA7
:1018E000931FB1010E941B1AA8019701261B370BF9
:1018F00041095109CA01B9014CAD042F10E020E0A3
:1019000030E0A90198010E942F1A2EA73FA748ABEB
:1019100059AB253F8FE038074105510508F454CFF6
:10192000253F3F4F4105510508F4F1C08BE0F2011E
:1019300080878CE2E3EEF1E0DF011D928A95E9F702
:10194000710100E010E02896ECAEFDAE0EAF1FAFC7
:101950002897C801B7012EA13FA148A559A50E940B
:10196000BB1A2093E3013093E4014093E5015093C7
:10197000E6016093E7017093E8018093E901909399
:10198000EA01C801B7012AA93BA94CA95DA90E9497
:10199000BB1AE92CF82C83010E941D1B922E832E6A
:1019A000742E652E6AAB2D967FAF2D972E968FAF36
:1019B0002E972F969FAF2F972093EB013093EC013A
:1019C0004093ED015093EE016093EF017093F001AD
:1019D0008093F1019093F2012EA53FA548A959A942
:1019E0002E5F3F4F4F4F5F4FD20118968C9186303C
:1019F00009F492C064E070E080E090E00E940B1A6D
:101A00006093F3017093F4018093F5019093F601D4
:101A10003092F8012092F701BCADB29DC001B39D98
:101A2000900D11249093FA018093F901F2018085C1
:101A3000863009F476C028966CAD7DAD8EAD9FAD35
:101A4000289724962CAD3DAD4EAD5FAD24970E94F6
:101A5000BB1ACEA8DFA8E8ACF9AC56016701E12CAF
:101A6000F12C8701AEA2BFA2C8A6D9A6EAA6FBA602
:101A70000CA71DA7E12CF12C00E010E00E94621AD7
:101A8000A92CB82CC72CD62CEAA82D96FFAC2D97E4
:101A90002E960FAD2E972F961FAD2F970E941D1BD0
:101AA0002093FB013093FC014093FD015093FE0114
:101AB0006093FF01709300028093010290930202F1
:101AC0002C96ECACFDAC0EAD1FAD2C97E0920B024A
:101AD000F0920C0200930D0210930E0281EE91E041
:101AE0002BCE0115110509F46FCEC801A0E0B0E0BE
:101AF0008EA39FA3A8A7B9A7B0CE8EA99FA9A8AD72
:101B0000B9AD892B8A2B8B2B09F0B3CE5DCE86E045
:101B1000D20118968C930DCF62E070E080E090E0E7
:101B20006DCFAAACBBAC950140E050E028966CADFF
:101B30007DAD8EAD9FAD28970E94BB1AADACB12C88
:101B4000C12CD12CE12CF12C00E010E00E94621A93
:101B5000A92CB82CC72CD62CEAA82D96FFAC2D9713
:101B60002E960FAD2E972F961FAD2F970E941D1BFF
:101B7000522E632E742EB52FA62FF72FE82F192F74
:101B8000209303023093040240930502509306020F
:101B900060930702709308028093090290930A02EF
:101BA0002EAD3FADA12CB12CA50160E070E080E02E
:101BB00090E005E00E94E61AA52CB62CC72CDB2E7F
:101BC000EA2EFF2E0E2F0E941D1B2093FB01309347
:101BD000FC014093FD015093FE016093FF0170935F
:101BE0000002809301029093020278CF009719F0CF
:101BF000FC011182108208952F923F924F925F92C2
:101C00006F927F928F929F92AF92BF92CF92DF920C
:101C1000EF92FF920F931F93CF93DF93CDB7DEB771
:101C2000C454D1090FB6F894DEBF0FBECDBF2396C2
:101C30009FAF8EAF23977CAF6BAF5CAB4BAB892B69
:101C400099F16115710581F1DB018C91882361F1B6
:101C5000452B51F18F3209F434C381E3EBA9FCA980
:101C600011928A95E9F780E1ABA9BCA990968C9373
:101C7000FE01B196F8A7EFA3ABADBCAD8C91882364
:101C800009F491C0EBA9FCA980A184FF0DC080914B
:101C9000300190913101892B09F40AC380916901C7
:101CA00090916A01892BD9F080E0CC5BDF4F0FB6B1
:101CB000F894DEBF0FBECDBFDF91CF911F910F9182
:101CC000FF90EF90DF90CF90BF90AF909F908F905C
:101CD0007F906F905F904F903F902F90089509E60E
:101CE00011E01AAB09ABD80181E3129601900D9275
:101CF0008A95E1F72396EEADFFAD2397A9A9BAA97E
:101D0000ED93FC93ABA9BCA99196FC909197929608
:101D1000EC9092979396DC9093979496CC90E9A947
:101D2000FAA9F3AAE4AAD5AAC6AA10AE17AA6FE226
:101D300070E08BAD9CAD0E94891C009709F417C21E
:101D4000282FFBAD2F1B8C010F5F1F4F25961FAF58
:101D50000EAF2597FDAAEEAADFAAC8AE23964EAC19
:101D60005FAC2397612C712C422F50E05AAF49AFE2
:101D7000F201208C318C62147304B8F0E9A9FAA93D
:101D800083A194A1A5A1B6A183AB94ABA5ABB6AB3F
:101D900010AE17AAA9A9BAA91D921C92ABADBCADF1
:101DA0008C9181116FCF81E080CFAFA1B8A5E6E023
:101DB0001D92EA95E9F7ABA9BCA9E1E31D92EA956A
:101DC000E9F7ABA8BCA8BAA2A9A2CDA8DEA8EFA843
:101DD000F8ACCD28CE28CF2879F4D201ED91FC9132
:101DE000119780858B3009F4B7C1F201228C338CB6
:101DF00082A193A1281A390A80E00DA91EA92FA952
:101E000038AD023011052105310508F40AC141142D
:101E1000510409F4C1C00250110921093109219668
:101E20000CAF1DAF2EAF3FAF219755C0D2015896D2
:101E30006D917C91599780E090E021962CAD3DAD5D
:101E40004EAD5FAD21970E94BB1AF201A28CB38CFC
:101E5000C48CD58CE68CF78C00A111A10E941D1BAF
:101E60005301C12CD12CE12CF12C870169A6BAA613
:101E7000CBA6DCA6EDA6FEA60FA718ABC12CD12CD5
:101E8000E12CF12C00E010E00E941D1B1CA21BA203
:101E90000190F081E02D0280F381E02D8E010F5D35
:101EA0001F4F4801AAE0AA2EA8E0BA2E6101C61869
:101EB000D708B0E2EB2EF12C0052110909958823C6
:101EC00009F468CF8BA19CA1680E791E621473047B
:101ED00008F087C08EA1882309F4A8CFEDA8FEA83A
:101EE0000FA918ADA9A9BAA9D396ED92FD920D93A9
:101EF0001C93D697D8967C926E92D797EBA9FCA9A3
:101F000001900020E9F73197ABA9BCA9EA1BFB0BB4
:101F1000A9ACBAACEA15FB0509F441C0A9A9BAA954
:101F20004D905C9025CF1CA21BA2930140E050E095
:101F300060E070E0CB01E0910000F09101000280D0
:101F4000F381E02DDE0191964D011AE0A12E18E0FB
:101F5000B12E6101C618D70800E2E02EF12C8E01E7
:101F60000F5F1F4F69A63AA74BA75CA76DA77EA777
:101F70008FA798AB40E050E060E070E080E090E038
:101F80000995882309F406CF8BA19CA1680E791EC0
:101F90006214730430F58EA1882329F29FCFA50126
:101FA000BD018BAD9CAD0E94941C892B09F0B6CF6E
:101FB000A9A9BAA91D921C92EBADFCADEA0DFB1DBF
:101FC0008081882309F4EFCEEBA9FCA980A184FFCE
:101FD0006BCE2596AEACBFAC2597BCAEABAED501F3
:101FE0004DCE4DA95EA96FA978ADC2010E944907E7
:101FF0006DAB7EAB8FAB98AF672B682B692B09F06D
:10200000A7C08EA1E9A9FAA98111C3C083A194A197
:10201000A5A1B6A183AB94ABA5ABB6AB10AE17AA86
:10202000B9CE4114510409F4BBC0012B022B032B80
:1020300009F48AC039C01CA21BA2930140E050E001
:1020400060E070E0CB01D201ED91FC910280F38160
:10205000E02D8E010F5D1F4F4801AAE0AA2EA8E0D7
:10206000BA2E6101C618D708B0E2EB2EF12C00524F
:10207000110969A63AA74BA75CA76DA77EA78FA7F2
:1020800098AB40E050E060E070E080E090E00995BF
:10209000882309F47FCE8BA19CA1680E791E62145F
:1020A000730408F09ECF8EA1882329F2A12CB12CB5
:1020B0006501A394ADAABEAACFAAD8AE0FCF930153
:1020C00040E050E060E070E090E0D2019296AC9089
:1020D00092979396BC9093979496CC90949795965C
:1020E000DC9095979696EC9096979796FC9097979C
:1020F00098960C91989799961C9199970E941D1B00
:102100001CA21BA2ED91FC910280F381E02D8E01B7
:102110000F5D1F4F4801AAE0AA2EA8E0BA2E610168
:10212000C618D708B0E2EB2EF12C00521109099520
:10213000882309F42FCE8BA19CA1680E791E62140E
:10214000730408F04ECF8EA1882309F4B8CFC6CE11
:102150008EA1612C712C51CE9A96AD90BD90CD90F0
:10216000DC909D97ADAABEAACFAAD8AE45CEEBAD66
:10217000FCAD01900020E9F731978BAD9CADE81BD9
:10218000F90B2E2F8E0F911D25969FAF8EAF2597A1
:10219000E1CD13AA14AA15AA16AA70AE67AAAECEEC
:1021A000A9019801232B242B252B09F47EC0811132
:1021B0003CC01CA21BA2930140E050E060E070E034
:1021C000CB01E0910000F09101000280F381E02D4D
:1021D000DE0191964D01AAE0AA2EA8E0BA2E610177
:1021E000C618D708B0E2EB2EF12C8E010F5F1F4FFF
:1021F00069A63AA74BA75CA76DA77EA78FA798AB48
:1022000040E050E060E070E080E090E009958823D5
:1022100009F4C0CD8BA19CA1680E791E62147304D1
:1022200008F0DFCE8EA1882321F2C12CD12C7601BB
:10223000C394CDAADEAAEFAAF8AE50CE930140E037
:1022400050E060E070E080E090E0A2B0B3B0C4B0D5
:10225000D5B0E6B0F7B008B119B10E941D1B1CA2A1
:102260001BA2E0910000F09101000280F381E02DBB
:102270008E010F5D1F4F4801AAE0AA2EA8E0BA2EDA
:102280006101C618D708B0E2EB2EF12C00521109FB
:102290000995882309F47ECD8BA19CA1680E791E37
:1022A0006214730408F09DCE8EA1882339F216CEF5
:1022B000E0E3F1E0FAABE9ABEBA9FCA9A9A9BAA963
:1022C00013CD1196BCAFABAFC8CC009769F06115C8
:1022D000710551F0FB0120A124FD06C02091A2014F
:1022E0003091A301232B19F080E090E0089521E3C1
:1022F000FB01A4EAB1E001900D922A95E1F79093D9
:10230000A3018093A2011092D5011092D6011092E0
:10231000D7011092D8011092D9011092DA011092CF
:10232000DB011092DC01FB0181A192A1A3A1B4A168
:102330008093DD019093DE01A093DF01B093E00173
:1023400082EA91E00895009719F0FC011182108251
:1023500008952F923F924F925F926F927F928F9249
:102360009F92AF92BF92CF92DF92EF92FF920F9324
:102370001F93CF93DF93CDB7DEB765970FB6F89471
:10238000DEBF0FBECDBF9B8B8A8B7C876B87598B43
:10239000488B009709F4C6C1672B09F4C3C16A01D1
:1023A000452B09F4BFC1DC01D396FC91D397D49699
:1023B000EC91D497D596BC91BC8BAA89BB89D69653
:1023C0009C90D697D796BC91BD8BAA89BB89D8968D
:1023D0008C90D897D996BC91B987AA89BB89DA968F
:1023E000BC91BF87AA89BB8997964D905D906D90EF
:1023F0007C909A97960140E050E060E070E080E0C9
:1024000090E0AF2EBE2ECC88D92CED88F82C098513
:102410001F850E941D1B63015201E12CF12C8701D5
:102420004982BA82CB82DC82ED82FE820F831887DA
:10243000E12CF12C00E010E00E943B1B31F128F16F
:102440008F2F9E2F8C016201C01AD10AD98AC88AA7
:10245000CD28F1F480E090E065960FB6F894DEBFE9
:102460000FBECDBFDF91CF911F910F91FF90EF90E5
:10247000DF90CF90BF90AF909F908F907F906F90A4
:102480005F904F903F902F900895CF01092F182F04
:102490002D903C90D10158960D90BC91A02DBE87F7
:1024A000AD87AA89BB89DB964D905D906D907C903D
:1024B000DE974114510461047104E1F593964D9047
:1024C0005D906D907C909697411451046104710465
:1024D00009F412C12F2F3E2F4C89592D6D89782D6B
:1024E00089859F85A0E00E94441B21F19F01832ED6
:1024F000922EA42EB52E2D853E856901E12CF12C5E
:1025000014C08C189D08AE08BF08B301A201C10118
:102510000E9449072B013C01672B682B692B09F4AA
:1025200001C1AA89BB892D903C908C149D04AE04F6
:10253000BF0438F78D859E850197FC01E023F123C8
:10254000FA87E987A888B988BA82A9820EC0DB9683
:102550004D925D926D927C92DE97E981FA81EF2B2C
:1025600009F4DDC0FD01208031802114310409F41B
:10257000ABC0F2E04F1651046104710408F4A4C02A
:10258000D10158966D917C91599780E090E0A3011C
:10259000920122503109410951090E94BB1AF101EF
:1025A000A28CB38CC48CD58CE68CF78C00A111A1C5
:1025B0000E941D1B59016A017B018C018D859E853E
:1025C00029853A85821B930B89809A808815990505
:1025D00008F44C01E985FA859F0140E050E060E095
:1025E00070E080E090E00E941D1BD101ED91FC9114
:1025F0000190F081E02D74010B851C8509958823DD
:1026000009F473C0AB84BC84A80CB91CBC86AB862F
:10261000C980DA80C818D908DA82C982940140E0FA
:1026200050E060E070E080E090E0AA89BB89D3963A
:10263000AC90D397D496BC90D497D596CC90D597A0
:10264000D696DC90D697D796EC90D797D896FC90F4
:10265000D897D9960C91D997DA961C91DA970E945F
:102660001D1BD3962C93D397D4963C93D497D59691
:102670004C93D597D6965C93D697D7966C93D7976D
:10268000D8967C93D897D9968C93D997DA969C93C1
:10269000DA97E985FA858E0E9F1EAD84BE848A1472
:1026A0009B0408F454CFB301A2018D919C910E9428
:1026B00049072B013C01672B682B692B71F01A86A7
:1026C0001986AA89BB8943CFA12CB12CC12CD12C4E
:1026D000E12CF12C00E010E071CFAA89BB89DB96D8
:1026E0001D921D921D921C92DE9788899989E9811D
:1026F000FA818E1B9F0BB0CE01E010E02F2F3E2FF2
:102700004C89592D6D89782D89859F85A0E00E947F
:10271000441B59F088279927801B910B9DCE8889EF
:1027200099899ACE8FEF9FEF97CE00E010E0F2CF1D
:102730008F929F92AF92BF92CF92DF92EF92FF92D1
:10274000CF93DF93FC01892B81F16115710569F14C
:10275000413009F440C0A8F1423039F5C7A0D0A4F7
:10276000E1A4F2A4EB0188819981AA81BB818C0D3F
:102770009D1DAE1DBF1DC816D906EA06FB06A8F0B2
:102780004C015D0183AB94AAA5AAB6AA17AA10AE04
:1027900011AE12AE13AE14AE15AE16AEFB018083B1
:1027A0009183A283B38381E001C080E0DF91CF9168
:1027B000FF90EF90DF90CF90BF90AF909F908F9061
:1027C0000895EB0188819981AA81BB81C7A0D0A41B
:1027D000E1A4F2A4D0CFC3A8D4A8E5A8F6A8EB0141
:1027E00088819981AA81BB818C0D9D1DAE1DBF1D65
:1027F000C7A0D0A4E1A4F2A4BECFCF93DF930097EB
:1028000099F06115710581F0FB0120A124FF0CC036
:102810002091300130913101232B59F02091690131
:1028200030916A01232B01F180E090E0DF91CF919C
:102830000895C0E3D1E0DE01129621E3FB0101908F
:102840000D922A95E1F799838883FB0181A192A1DA
:10285000A3A1B4A18BAB9CABADABBEAB18AE1FAA12
:10286000CE01DF91CF910895C9E6D1E0E4CF009782
:1028700019F0FC011182108208952F923F924F921D
:102880005F926F927F928F929F92AF92BF92CF9200
:10289000DF92EF92FF920F931F93CF93DF93CDB709
:1028A000DEB7EA970FB6F894DEBF0FBECDBFFC01CE
:1028B000892BC9F061157105B1F040805180D201BA
:1028C00058962D903C90599767A870AC6214730489
:1028D00020F183A194A1A5A1B6A183AB94ABA5AB34
:1028E000B6AB10AE17AA80E0EA960FB6F894DEBF3A
:1028F0000FBECDBFDF91CF911F910F91FF90EF9051
:10290000DF90CF90BF90AF909F908F907F906F900F
:102910005F904F903F902F900895A3A8B4A8C5A8AA
:10292000D6A8A9AABAAACBAADCAA8E010F5D1F4F0E
:1029300018A70FA386E0D8011D928A95E9F781E3D5
:10294000DB011D928A95E9F77AA369A3AB28AC282D
:10295000AD2809F415C1FAAFE9AF80E04114510484
:1029600009F44AC1A9A8BAA8CBA8DCA8A114B1044B
:10297000C104D10409F4BDC09601850102301105DE
:102980002105310508F4F1C002501109210931096E
:102990000DAB1EAB2FAB38AF53C0D20158966D9123
:1029A0007C91599780E090E02DA93EA94FA958ADA0
:1029B0000E94BB1AF201A28CB38CC48CD58CE68C1D
:1029C000F78C00A111A10E941D1B5301C12CD12C19
:1029D000E12CF12C870169A6BAA6CBA6DCA6EDA650
:1029E000FEA60FA718ABC12CD12CE12CF12C00E0D6
:1029F00010E00E941D1B1CA21BA20190F081E02D83
:102A00000280F381E02D8E010F5D1F4F4801AAE087
:102A1000AA2EA8E0BA2E6101C618D708B0E2EB2EA4
:102A2000F12C005211090995882309F45CCF8BA180
:102A30009CA1680E791E6214730408F0B7C08EA1C1
:102A4000882309F4AACFC9A8DAA8EBA8FCA8A9ADE5
:102A5000BAADD396CD92DD92ED92FC92D697D896F0
:102A60007C926E92D79740CF930140E050E060E0B7
:102A700070E090E0D2019296AC9092979396BC90C1
:102A800093979496CC9094979596DC90959796967C
:102A9000EC9096979796FC90979798960C919897AC
:102AA00099961C9199970E941D1B1CA21BA2ED9147
:102AB000FC910280F381E02D8E010F5D1F4F4801D4
:102AC000AAE0AA2EA8E0BA2E6101C618D708B0E283
:102AD000EB2EF12C005211090995882309F403CF3C
:102AE0008BA19CA1680E791E6214730408F05EC06D
:102AF0008EA1882309F4B8CFA6CF1CA21BA29301F4
:102B000040E050E060E070E0CB01D201ED91FC913B
:102B10000280F381E02D8E010F5D1F4F4801AAE076
:102B2000AA2EA8E0BA2E6101C618D708B0E2EB2E93
:102B3000F12C0052110969A63AA74BA75CA76DA713
:102B40007EA78FA798AB40E050E060E070E080E0A7
:102B500090E00995882309F4C6CE8BA19CA1680E4C
:102B6000791E6214730410F58EA1882331F2A12C12
:102B7000B12C6501A394A9AABAAACBAADCAA63CFF7
:102B8000D2018D919C91DC0118968C91D2018B30F1
:102B900009F4B3C05A962D913C915B9792968D9112
:102BA0009C9193971901281A390AD5CE49A95AA997
:102BB0006BA97CA9C2010E94490769AB7AAB8BABB8
:102BC0009CAB672B682B692B99F48EA181113BCFAD
:102BD000A9ADBAAD93964D915D916D917C9196970B
:102BE000FD0143AB54AB65AB76AB10AE17AA7CCE00
:102BF0008EA1612C712CB2CE29A93AA94BA95CA94E
:102C0000232B242B252B09F475C03AC01CA21BA230
:102C1000930140E050E060E070E0CB01E091000003
:102C2000F09101000280F381E02DDE0191964D01CB
:102C3000AAE0AA2EA8E0BA2E6101C618D708B0E211
:102C4000EB2EF12C8E010F5F1F4F69A63AA74BA701
:102C50005CA76DA77EA78FA798AB40E050E060E02F
:102C600070E080E090E00995882309F43CCE8BA1C8
:102C70009CA1680E791E6214730408F097CF8EA190
:102C8000882321F2E0CE930140E050E060E070E064
:102C900080E090E0A2B0B3B0C4B0D5B0E6B0F7B079
:102CA00008B119B10E941D1B1CA21BA2E0910000DB
:102CB000F09101000280F381E02D8E010F5D1F4F26
:102CC0004801AAE0AA2EA8E0BA2E6101C618D708CA
:102CD000B0E2EB2EF12C005211090995882309F47A
:102CE00002CE8BA19CA1680E791E6214730408F0B9
:102CF0005DCF8EA1882339F2A6CE9A96AD90BD9075
:102D0000CD90DC909D97A9AABAAACBAADCAA23CE23
:102D1000FC01892B61F083A194A1A5A1B6A183AB8D
:102D200094ABA5ABB6AB10AE17AA81E0089580E0D6
:102D30000895FC01892B41F1A081B18118968C91F5
:102D40008B30A9F082899389A489B589B695A79516
:102D5000979587959C01AD01225031094109510990
:102D6000608D718D80E090E00E94BB1A0895828989
:102D70009389A489B589B695A79597958795B695B2
:102D8000A79597958795E6CF20E030E040E050E0AA
:102D900060E070E080E090E008952F923F924F92C3
:102DA0005F926F927F928F929F92AF92BF92CF92DB
:102DB000DF92EF92FF920F931F93CF93DF93CDB7E4
:102DC000DEB7E0970FB6F894DEBF0FBECDBF009719
:102DD00009F48EC098AB8FA719A21AA21BA21CA23D
:102DE00080E290E09EA38DA3EFA5F8A9F285FFA352
:102DF000EFA5F8A9F385F8A7EFA5F8A9F485F9A739
:102E0000EFA5F8A9F585FAA7EFA5F8A9F685FBA720
:102E1000EFA5F8A9F785FCA7EFA5F8A9F089FDA70C
:102E2000EFA5F8A9F189FEA7EFA5F8A94288538874
:102E300064887588411451046104710409F046C026
:102E400093C01201EFA5F8A9A081B1811296ED916E
:102E5000FC91139718968C91863009F444C093E442
:102E6000A92E9BE0B92ECE0181964C01610180E232
:102E7000E82EF12C8E010F5F1F4F2FA138A549A519
:102E80005AA56BA57CA58DA59EA50995882381F1E2
:102E9000910140E050E060E070E080E090E0AFA0A1
:102EA000B8A4C9A4DAA4EBA4FCA40DA51EA50E9495
:102EB0001D1B2FA338A749A75AA76BA77CA78DA7CF
:102EC0009EA7421853086108710899F1FEEF4F164A
:102ED000FFEF5F066104710408F4B3CF3EEF232EC9
:102EE00033243A94AFCF28EDA22E27E0B22EBBCFE9
:102EF00020E030E040E050E060E070E080E090E012
:102F0000E0960FB6F894DEBF0FBECDBFDF91CF9134
:102F10001F910F91FF90EF90DF90CF90BF90AF90F7
:102F20009F908F907F906F905F904F903F902F90E9
:102F3000089589A19AA1ABA1BCA19C01AD0160E05B
:102F400070E0CB01EFA5F8A9208C318C59016A0102
:102F50007B018C01910140E050E060E070E080E096
:102F600090E00E94621ACCCF20E030E040E050E0D8
:102F700060E070E080E090E0E7CFE4E1F2E0158A05
:102F8000148A178A168A118E108E089520912C02A9
:102F900030912D022115310519F482E090E0089559
:102FA0004091280250912902FA01EC5EFD4F6081A8
:102FB000FC016083CA010196909329028093280244
:102FC0002150310930932D0220932C02449719F09F
:102FD00080E090E00895109229021092280280E08B
:102FE00090E0089540912C0250912D0244315105FA
:102FF00001F120912A0230912B02F901EC5EFD4F84
:103000008083C901019690932B0280932A024F5F1F
:103010005F4F50932D0240932C02449719F080E0AB
:1030200090E0089510922B0210922A0280E090E026
:10303000089581E090E008958F929F92AF92BF92A1
:10304000CF92DF92EF92FF920F931F93CF93DF9374
:10305000CDB7DEB7CA56D1090FB6F894DEBF0FBEA2
:10306000CDBF0E9428070E9432070E9439070E94A4
:10307000E60100E020E030E040E050E06FEC73E07B
:1030800088EE92E00E946200009709F4B8C10E94A5
:10309000770B6C01AE014E5C5F4F66E171E00E9400
:1030A000FC0DBE016E5C7F4FC6010E94FD137C01CA
:1030B00037E6A32E36E0B32E8E010F5F1F4F8BE84D
:1030C000A81686E0B80621F43CC189A184FF78C126
:1030D000B801C7010E943D148111F7CF03E011E050
:1030E00080911302882309F49DC0813009F4B7C090
:1030F00080918B06813808F0E8C0809166068823AD
:1031000079F3F0905D06F126E091000184E0E80299
:10311000F0011124E959F94F40E060E070E080814E
:1031200091810E949813E091000184E0E802F0018F
:103130001124E959F94F48E050E0BE016D597F4F25
:10314000808191810E94A911E0910101F091020119
:103150009081A4968FADA497981399C0AB968CAD2F
:103160009DADAEADBFADAB978093000090930100D5
:10317000A0930200B0930300AB968CAD9DADAEADB5
:10318000BFADAB97B695A7959795879580935E064B
:1031900090935F06A0936006B0936106109262065A
:1031A00010926306109264061092650640E050E0AB
:1031B000BA01481759076A077B0709F4A3C06F2DA6
:1031C00070E0762F6627770F635A7D4FE0910001FC
:1031D00084E0E802F0011124E959F94F40E052E09F
:1031E000808191810E94A91180916206909163066D
:1031F000A0916406B09165069F5FAF4FBF4F80936B
:10320000620690936306A0936406B093650680916E
:1032100066068111F0925D06109266068091130297
:10322000811163CF8CE592E00E94C617892B91F43F
:1032300080915C02843009F490C048F0853009F434
:1032400088C0863039F4A9981092130251CF823089
:1032500009F47CC080911302813009F049CFCE017E
:103260008D599F4F0E94C617892B09F041CF80913D
:103270005C02823009F475C0843009F039CFA4961D
:103280008FADA497809300011093660631CFAB9663
:103290008CAD9DADAEADBFADAB978093000090936C
:1032A0000100A0930200B0930300E091000184E0CC
:1032B000E802F0011124E959F94F41E060E070E0C3
:1032C000808191810E9498132ECFF0905D06F126A7
:1032D00080916606811118CF409162065091630675
:1032E000609164067091650680915E0690915F061C
:1032F000A0916006B0916106481759076A077B07DD
:1033000009F05DCF10926206109263061092640677
:1033100010926506A99880E090E0C659DF4F0FB67D
:10332000F894DEBF0FBECDBFDF91CF911F910F91FB
:10333000FF90EF90DF90CF90BF90AF909F908F90D5
:103340000895B801C7010E943D14C8CE109313021E
:1033500086CFA99A10921302CBCEA998109313028C
:103360007ECFA496EFADA49784E0E89FF0011124EE
:10337000E959F94F0280F381E02DDF010D90002023
:10338000E9F71197AE1BBF0B3A2F8091C00085FF64
:10339000FCCF0093C6008091C00085FFFCCFA093B6
:1033A000C600332309F4A4CE90E021918091C0009F
:1033B00085FFFCCF2093C6009F5F3913F6CF98CED0
:1033C000F80101900020E9F731974F01801A910A26
:1033D000C40199270E945F1BF50193838283A40196
:1033E0004F5F5F4FB8010E94801CF50160817181C1
:1033F000C6010E946511F4E0AF0EB11C60CE0FEF64
:1034000020E030E040E050E06FEC73E088EE92E0C6
:103410000E9462003CCEDB018F939F930E94571A5B
:10342000BF91AF91A29F800D911DA39F900DB29F60
:10343000900D11240895AA1BBB1B51E107C0AA1FC0
:10344000BB1FA617B70710F0A61BB70B881F991F45
:103450005A95A9F780959095BC01CD010895A1E2F8
:103460001A2EAA1BBB1BFD010DC0AA1FBB1FEE1FFE
:10347000FF1FA217B307E407F50720F0A21BB30B49
:10348000E40BF50B661F771F881F991F1A9469F7C5
:1034900060957095809590959B01AC01BD01CF0121
:1034A0000895EE0FFF1F0590F491E02D09940E94FE
:1034B000501BA59F900DB49F900DA49F800D911D52
:1034C00011240895DF93CF931F930F939A9DF02DAE
:1034D000219FF00D8B9DF00D8A9DE02DF10D039F36
:1034E000F00D029FE00DF11D4E9DE00DF11D5E9D62
:1034F000F00D4F9DF00D7F936F93BF92AF925F934E
:103500004F93D5010E94501B8B01AC01D7010E9443
:10351000501BEB01E80FF91FD6010E94B21A2F9140
:103520003F91D6010E94501BC60FD71FE81FF91FFD
:10353000AF91BF910E94B21A2F913F910E94501BF0
:10354000C60FD71FE81FF91FD6010E94501BE60FB8
:10355000F71F9801BE01CF0111240F911F91CF9148
:10356000DF9108950E94501B460F571FC81FD91F97
:1035700008F431960895E894DF93CF93FC01DB01C2
:103580000E94501B7F936F93E9019A01AC01BF9396
:10359000AF933F932F93DF010E94501B26F46C1BC7
:1035A0007D0B820B930B9E01EB01FC010E94B21A72
:1035B000AF91BF912F913F910E94B21ABE01CF01EE
:1035C000F9012F913F91CF91DF9108950F9308302A
:1035D00090F0982F872F762F652F542F432F322F5F
:1035E00022270850F4CF220F331F441F551F661F98
:1035F000771F881F991F0A95B2F70F91089597FBBF
:1036000010F8169400080F93083098F00850232FF4
:10361000342F452F562F672F782F892F902DF4CFD9
:10362000059497958795779567955795479537951D
:1036300027950A95AAF70F9108952A0D3B1D4C1D59
:103640005D1D6E1D7F1D801F911F08950024A7FD25
:1036500000942A0F301D401D501D601D701D801DDF
:10366000901D08952A193B094C095D096E097F09CF
:10367000800B910B08952A153B054C055D056E05E1
:103680007F058007910708950024A7FD00942A175D
:1036900030054005500560057005800590050895CA
:1036A000A29FB001B39FC001A39F700D811D112483
:1036B000911DB29F700D811D1124911D08950F93CE
:1036C0001F93CF93DF938230910510F482E090E056
:1036D000E0918E06F0918F0620E030E0A0E0B0E0AF
:1036E000309719F1408151810281138148175907A0
:1036F000C8F08417950769F4109731F012960C936F
:10370000129713961C9327C000938E0610938F0672
:1037100022C02115310519F04217530718F49A01F8
:10372000BD01EF01DF01F801DBCF21153105F9F013
:10373000281B390B2430310580F48A819B81611567
:10374000710521F0FB019383828304C090938F065F
:1037500080938E06FE01329644C0FE01E20FF31FF5
:103760008193919322503109398328833AC0209163
:103770008C0630918D06232B41F420910501309168
:10378000060130938D0620938C0620910301309121
:1037900004012115310541F42DB73EB740910701D1
:1037A00050910801241B350BE0918C06F0918D0699
:1037B000E217F307A0F42E1B3F0B2817390778F008
:1037C000AC014E5F5F4F2417350748F04E0F5F1F67
:1037D00050938D0640938C068193919302C0E0E054
:1037E000F0E0CF01DF91CF911F910F910895CF931A
:1037F000DF93009709F481C0FC0132971382128293
:10380000A0918E06B0918F06109781F420813181AE
:10381000820F931F20918C0630918D06281739074F
:1038200051F5F0938D06E0938C0667C0ED0120E022
:1038300030E0CE17DF0740F44A815B819E014115DD
:103840005105F1F0EA01F5CFD383C2834081518164
:10385000840F951FC817D90759F488819981840F5F
:10386000951F0296918380838A819B8193838283B3
:103870002115310529F4F0938F06E0938E063DC0A3
:10388000E901FB83EA8349915991C40FD51FEC17D5
:10389000FD0761F480819181840F951F0296E901F3
:1038A00099838883828193819B838A83E0E0F0E01F
:1038B00012968D919C911397009719F0FD01DC01F0
:1038C000F7CF8D919C9111979D012E5F3F4F820FF5
:1038D000931F20918C0630918D062817390769F4C3
:1038E000309729F410928F0610928E0602C0138230
:1038F0001282B0938D06A0938C06DF91CF9108952C
:10390000FB01DC0102C001900D9241505040D8F7FC
:103910000895FC018191861721F08823D9F7992712
:1039200008953197CF010895FB01DC0141505040CB
:1039300030F08D910190801919F40020B9F7881B9F
:08394000990B0895F894FFCFE4
:10394800FF180100009006200001030507090E106A
:0E395800121416181C1E2F006461746100000A
:00000001FF

899
sd_reader/sd-reader.map Normal file
View File

@ -0,0 +1,899 @@
Archive member included to satisfy reference by file (symbol)
/usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_mulsi3.o)
fat.o (__mulsi3)
/usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_udivmodhi4.o)
fat.o (__udivmodhi4)
/usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_udivmodsi4.o)
fat.o (__udivmodsi4)
/usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_exit.o)
/usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/crtatmega328p.o (exit)
/usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_tablejump2.o)
sd_raw.o (__tablejump2__)
/usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_copy_data.o)
fat.o (__do_copy_data)
/usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_clear_bss.o)
partition.o (__do_clear_bss)
/usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_muluhisi3.o)
/usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_mulsi3.o) (__muluhisi3)
/usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_muldi3.o)
fat.o (__muldi3)
/usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_muldi3_6.o)
/usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_muldi3.o) (__muldi3_6)
/usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_umulsidi3.o)
fat.o (__umulsidi3)
/usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_ashldi3.o)
sd_raw.o (__ashldi3)
/usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_ashrdi3.o)
sd_raw.o (__lshrdi3)
/usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_adddi3.o)
sd_raw.o (__adddi3)
/usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_adddi3_s8.o)
fat.o (__adddi3_s8)
/usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_subdi3.o)
sd_raw.o (__subdi3)
/usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_cmpdi2.o)
fat.o (__cmpdi2)
/usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_cmpdi2_s8.o)
fat.o (__cmpdi2_s8)
/usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_umulhisi3.o)
/usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_muluhisi3.o) (__umulhisi3)
/usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/libc.a(malloc.o)
main.o (malloc)
/usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/libc.a(memcpy.o)
main.o (memcpy)
/usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/libc.a(strchr.o)
fat.o (strchr)
/usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/libc.a(strncmp.o)
fat.o (strncmp)
Allocating common symbols
Common symbol size file
cmd_state 0x1 main.o
song_buf 0x400 main.o
song_buf_select 0x1 main.o
__brkval 0x2 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/libc.a(malloc.o)
song_len 0x4 main.o
ck_fmt_t 0x2a periph.o
song_read_position 0x4 main.o
song_selected 0x1 main.o
ck_master_t 0x4 periph.o
songs 0x24 main.o
song_position 0x1 main.o
__flp 0x2 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/libc.a(malloc.o)
Memory Configuration
Name Origin Length Attributes
text 0x0000000000000000 0x0000000000020000 xr
data 0x0000000000800060 0x000000000000ffa0 rw !x
eeprom 0x0000000000810000 0x0000000000010000 rw !x
fuse 0x0000000000820000 0x0000000000000003 rw !x
lock 0x0000000000830000 0x0000000000000400 rw !x
signature 0x0000000000840000 0x0000000000000400 rw !x
user_signatures 0x0000000000850000 0x0000000000000400 rw !x
*default* 0x0000000000000000 0xffffffffffffffff
Linker script and memory map
Address of section .data set to 0x800100
LOAD /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/crtatmega328p.o
LOAD partition.o
LOAD sd_raw.o
LOAD byteordering.o
LOAD periph.o
LOAD fat.o
LOAD main.o
LOAD fifo.o
START GROUP
LOAD /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a
LOAD /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/libm.a
LOAD /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/libc.a
LOAD /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/libatmega328p.a
END GROUP
0x0000000000020000 __TEXT_REGION_LENGTH__ = DEFINED (__TEXT_REGION_LENGTH__)?__TEXT_REGION_LENGTH__:0x20000
0x000000000000ffa0 __DATA_REGION_LENGTH__ = DEFINED (__DATA_REGION_LENGTH__)?__DATA_REGION_LENGTH__:0xffa0
0x0000000000010000 __EEPROM_REGION_LENGTH__ = DEFINED (__EEPROM_REGION_LENGTH__)?__EEPROM_REGION_LENGTH__:0x10000
[0x0000000000000003] __FUSE_REGION_LENGTH__ = DEFINED (__FUSE_REGION_LENGTH__)?__FUSE_REGION_LENGTH__:0x400
0x0000000000000400 __LOCK_REGION_LENGTH__ = DEFINED (__LOCK_REGION_LENGTH__)?__LOCK_REGION_LENGTH__:0x400
0x0000000000000400 __SIGNATURE_REGION_LENGTH__ = DEFINED (__SIGNATURE_REGION_LENGTH__)?__SIGNATURE_REGION_LENGTH__:0x400
0x0000000000000400 __USER_SIGNATURE_REGION_LENGTH__ = DEFINED (__USER_SIGNATURE_REGION_LENGTH__)?__USER_SIGNATURE_REGION_LENGTH__:0x400
.hash
*(.hash)
.dynsym
*(.dynsym)
.dynstr
*(.dynstr)
.gnu.version
*(.gnu.version)
.gnu.version_d
*(.gnu.version_d)
.gnu.version_r
*(.gnu.version_r)
.rel.init
*(.rel.init)
.rela.init
*(.rela.init)
.rel.text
*(.rel.text)
*(.rel.text.*)
*(.rel.gnu.linkonce.t*)
.rela.text
*(.rela.text)
*(.rela.text.*)
*(.rela.gnu.linkonce.t*)
.rel.fini
*(.rel.fini)
.rela.fini
*(.rela.fini)
.rel.rodata
*(.rel.rodata)
*(.rel.rodata.*)
*(.rel.gnu.linkonce.r*)
.rela.rodata
*(.rela.rodata)
*(.rela.rodata.*)
*(.rela.gnu.linkonce.r*)
.rel.data
*(.rel.data)
*(.rel.data.*)
*(.rel.gnu.linkonce.d*)
.rela.data
*(.rela.data)
*(.rela.data.*)
*(.rela.gnu.linkonce.d*)
.rel.ctors
*(.rel.ctors)
.rela.ctors
*(.rela.ctors)
.rel.dtors
*(.rel.dtors)
.rela.dtors
*(.rela.dtors)
.rel.got
*(.rel.got)
.rela.got
*(.rela.got)
.rel.bss
*(.rel.bss)
.rela.bss
*(.rela.bss)
.rel.plt
*(.rel.plt)
.rela.plt
*(.rela.plt)
.text 0x0000000000000000 0x3948
*(.vectors)
.vectors 0x0000000000000000 0x68 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/crtatmega328p.o
0x0000000000000000 __vectors
0x0000000000000000 __vector_default
*(.vectors)
*(.progmem.gcc*)
.progmem.gcc_sw_table
0x0000000000000068 0x1e sd_raw.o
0x0000000000000086 . = ALIGN (0x2)
0x0000000000000086 __trampolines_start = .
*(.trampolines)
.trampolines 0x0000000000000086 0x0 linker stubs
*(.trampolines*)
0x0000000000000086 __trampolines_end = .
*libprintf_flt.a:*(.progmem.data)
*libc.a:*(.progmem.data)
*(.progmem*)
0x0000000000000086 . = ALIGN (0x2)
*(.jumptables)
*(.jumptables*)
*(.lowtext)
*(.lowtext*)
0x0000000000000086 __ctors_start = .
*(.ctors)
0x0000000000000086 __ctors_end = .
0x0000000000000086 __dtors_start = .
*(.dtors)
0x0000000000000086 __dtors_end = .
SORT(*)(.ctors)
SORT(*)(.dtors)
*(.init0)
.init0 0x0000000000000086 0x0 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/crtatmega328p.o
0x0000000000000086 __init
*(.init0)
*(.init1)
*(.init1)
*(.init2)
.init2 0x0000000000000086 0xc /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/crtatmega328p.o
*(.init2)
*(.init3)
*(.init3)
*(.init4)
.init4 0x0000000000000092 0x16 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_copy_data.o)
0x0000000000000092 __do_copy_data
.init4 0x00000000000000a8 0x10 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_clear_bss.o)
0x00000000000000a8 __do_clear_bss
*(.init4)
*(.init5)
*(.init5)
*(.init6)
*(.init6)
*(.init7)
*(.init7)
*(.init8)
*(.init8)
*(.init9)
.init9 0x00000000000000b8 0x8 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/crtatmega328p.o
*(.init9)
*(.text)
.text 0x00000000000000c0 0x4 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/crtatmega328p.o
0x00000000000000c0 __vector_22
0x00000000000000c0 __vector_1
0x00000000000000c0 __vector_24
0x00000000000000c0 __vector_12
0x00000000000000c0 __bad_interrupt
0x00000000000000c0 __vector_6
0x00000000000000c0 __vector_3
0x00000000000000c0 __vector_23
0x00000000000000c0 __vector_25
0x00000000000000c0 __vector_11
0x00000000000000c0 __vector_13
0x00000000000000c0 __vector_17
0x00000000000000c0 __vector_19
0x00000000000000c0 __vector_7
0x00000000000000c0 __vector_5
0x00000000000000c0 __vector_4
0x00000000000000c0 __vector_9
0x00000000000000c0 __vector_2
0x00000000000000c0 __vector_21
0x00000000000000c0 __vector_15
0x00000000000000c0 __vector_8
0x00000000000000c0 __vector_10
0x00000000000000c0 __vector_16
0x00000000000000c0 __vector_20
.text 0x00000000000000c4 0x16e partition.o
0x00000000000000c4 partition_open
0x0000000000000222 partition_close
.text 0x0000000000000232 0xb18 sd_raw.o
0x00000000000003cc sd_raw_init
0x00000000000005b6 sd_raw_available
0x00000000000005c2 sd_raw_locked
0x00000000000005d0 sd_raw_read
0x000000000000079e sd_raw_read_interval
0x0000000000000aae sd_raw_get_info
.text 0x0000000000000d4a 0x28 byteordering.o
0x0000000000000d4a read16
0x0000000000000d52 read32
0x0000000000000d5e write16
0x0000000000000d66 write32
.text 0x0000000000000d72 0x120 periph.o
0x0000000000000d72 __vector_18
0x0000000000000dc2 __vector_14
0x0000000000000e50 gpio_init
0x0000000000000e64 timer_init
0x0000000000000e72 usart_init
.text 0x0000000000000e92 0x20e8 fat.o
0x00000000000016ee fat_open
0x0000000000001bec fat_close
0x0000000000001bf8 fat_get_dir_entry_of_path
0x00000000000022ca fat_open_file
0x0000000000002346 fat_close_file
0x0000000000002352 fat_read_file
0x0000000000002730 fat_seek_file
0x00000000000027fa fat_open_dir
0x000000000000286e fat_close_dir
0x000000000000287a fat_read_dir
0x0000000000002d10 fat_reset_dir
0x0000000000002d32 fat_get_fs_size
0x0000000000002d9a fat_get_fs_free
.text 0x0000000000002f7a 0x0 main.o
.text 0x0000000000002f7a 0xbe fifo.o
0x0000000000002f7a fifo_init
0x0000000000002f8c fifo_pop
0x0000000000002fe4 fifo_push
.text 0x0000000000003038 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_mulsi3.o)
.text 0x0000000000003038 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_udivmodhi4.o)
.text 0x0000000000003038 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_udivmodsi4.o)
.text 0x0000000000003038 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_exit.o)
.text 0x0000000000003038 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_tablejump2.o)
.text 0x0000000000003038 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_copy_data.o)
.text 0x0000000000003038 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_clear_bss.o)
.text 0x0000000000003038 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_muluhisi3.o)
.text 0x0000000000003038 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_muldi3.o)
.text 0x0000000000003038 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_muldi3_6.o)
.text 0x0000000000003038 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_umulsidi3.o)
.text 0x0000000000003038 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_ashldi3.o)
.text 0x0000000000003038 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_ashrdi3.o)
.text 0x0000000000003038 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_adddi3.o)
.text 0x0000000000003038 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_adddi3_s8.o)
.text 0x0000000000003038 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_subdi3.o)
.text 0x0000000000003038 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_cmpdi2.o)
.text 0x0000000000003038 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_cmpdi2_s8.o)
.text 0x0000000000003038 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_umulhisi3.o)
.text 0x0000000000003038 0x0 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/libc.a(malloc.o)
.text 0x0000000000003038 0x0 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/libc.a(memcpy.o)
.text 0x0000000000003038 0x0 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/libc.a(strchr.o)
.text 0x0000000000003038 0x0 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/libc.a(strncmp.o)
0x0000000000003038 . = ALIGN (0x2)
*(.text.*)
.text.startup 0x0000000000003038 0x3de main.o
0x0000000000003038 main
.text.libgcc.mul
0x0000000000003416 0x20 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_mulsi3.o)
0x0000000000003416 __mulsi3
.text.libgcc.div
0x0000000000003436 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_mulsi3.o)
.text.libgcc 0x0000000000003436 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_mulsi3.o)
.text.libgcc.prologue
0x0000000000003436 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_mulsi3.o)
.text.libgcc.builtins
0x0000000000003436 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_mulsi3.o)
.text.libgcc.fmul
0x0000000000003436 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_mulsi3.o)
.text.libgcc.fixed
0x0000000000003436 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_mulsi3.o)
.text.libgcc.mul
0x0000000000003436 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_udivmodhi4.o)
.text.libgcc.div
0x0000000000003436 0x28 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_udivmodhi4.o)
0x0000000000003436 __udivmodhi4
.text.libgcc 0x000000000000345e 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_udivmodhi4.o)
.text.libgcc.prologue
0x000000000000345e 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_udivmodhi4.o)
.text.libgcc.builtins
0x000000000000345e 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_udivmodhi4.o)
.text.libgcc.fmul
0x000000000000345e 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_udivmodhi4.o)
.text.libgcc.fixed
0x000000000000345e 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_udivmodhi4.o)
.text.libgcc.mul
0x000000000000345e 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_udivmodsi4.o)
.text.libgcc.div
0x000000000000345e 0x44 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_udivmodsi4.o)
0x000000000000345e __udivmodsi4
.text.libgcc 0x00000000000034a2 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_udivmodsi4.o)
.text.libgcc.prologue
0x00000000000034a2 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_udivmodsi4.o)
.text.libgcc.builtins
0x00000000000034a2 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_udivmodsi4.o)
.text.libgcc.fmul
0x00000000000034a2 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_udivmodsi4.o)
.text.libgcc.fixed
0x00000000000034a2 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_udivmodsi4.o)
.text.libgcc.mul
0x00000000000034a2 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_exit.o)
.text.libgcc.div
0x00000000000034a2 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_exit.o)
.text.libgcc 0x00000000000034a2 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_exit.o)
.text.libgcc.prologue
0x00000000000034a2 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_exit.o)
.text.libgcc.builtins
0x00000000000034a2 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_exit.o)
.text.libgcc.fmul
0x00000000000034a2 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_exit.o)
.text.libgcc.fixed
0x00000000000034a2 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_exit.o)
.text.libgcc.mul
0x00000000000034a2 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_tablejump2.o)
.text.libgcc.div
0x00000000000034a2 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_tablejump2.o)
.text.libgcc 0x00000000000034a2 0xc /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_tablejump2.o)
0x00000000000034a2 __tablejump2__
.text.libgcc.prologue
0x00000000000034ae 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_tablejump2.o)
.text.libgcc.builtins
0x00000000000034ae 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_tablejump2.o)
.text.libgcc.fmul
0x00000000000034ae 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_tablejump2.o)
.text.libgcc.fixed
0x00000000000034ae 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_tablejump2.o)
.text.libgcc.mul
0x00000000000034ae 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_copy_data.o)
.text.libgcc.div
0x00000000000034ae 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_copy_data.o)
.text.libgcc 0x00000000000034ae 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_copy_data.o)
.text.libgcc.prologue
0x00000000000034ae 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_copy_data.o)
.text.libgcc.builtins
0x00000000000034ae 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_copy_data.o)
.text.libgcc.fmul
0x00000000000034ae 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_copy_data.o)
.text.libgcc.fixed
0x00000000000034ae 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_copy_data.o)
.text.libgcc.mul
0x00000000000034ae 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_clear_bss.o)
.text.libgcc.div
0x00000000000034ae 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_clear_bss.o)
.text.libgcc 0x00000000000034ae 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_clear_bss.o)
.text.libgcc.prologue
0x00000000000034ae 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_clear_bss.o)
.text.libgcc.builtins
0x00000000000034ae 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_clear_bss.o)
.text.libgcc.fmul
0x00000000000034ae 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_clear_bss.o)
.text.libgcc.fixed
0x00000000000034ae 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_clear_bss.o)
.text.libgcc.mul
0x00000000000034ae 0x16 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_muluhisi3.o)
0x00000000000034ae __muluhisi3
.text.libgcc.div
0x00000000000034c4 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_muluhisi3.o)
.text.libgcc 0x00000000000034c4 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_muluhisi3.o)
.text.libgcc.prologue
0x00000000000034c4 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_muluhisi3.o)
.text.libgcc.builtins
0x00000000000034c4 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_muluhisi3.o)
.text.libgcc.fmul
0x00000000000034c4 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_muluhisi3.o)
.text.libgcc.fixed
0x00000000000034c4 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_muluhisi3.o)
.text.libgcc.mul
0x00000000000034c4 0xa0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_muldi3.o)
0x00000000000034c4 __muldi3
.text.libgcc.div
0x0000000000003564 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_muldi3.o)
.text.libgcc 0x0000000000003564 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_muldi3.o)
.text.libgcc.prologue
0x0000000000003564 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_muldi3.o)
.text.libgcc.builtins
0x0000000000003564 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_muldi3.o)
.text.libgcc.fmul
0x0000000000003564 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_muldi3.o)
.text.libgcc.fixed
0x0000000000003564 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_muldi3.o)
.text.libgcc.mul
0x0000000000003564 0x12 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_muldi3_6.o)
0x0000000000003564 __muldi3_6
.text.libgcc.div
0x0000000000003576 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_muldi3_6.o)
.text.libgcc 0x0000000000003576 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_muldi3_6.o)
.text.libgcc.prologue
0x0000000000003576 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_muldi3_6.o)
.text.libgcc.builtins
0x0000000000003576 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_muldi3_6.o)
.text.libgcc.fmul
0x0000000000003576 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_muldi3_6.o)
.text.libgcc.fixed
0x0000000000003576 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_muldi3_6.o)
.text.libgcc.mul
0x0000000000003576 0x56 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_umulsidi3.o)
0x0000000000003576 __umulsidi3
0x0000000000003578 __umulsidi3_helper
.text.libgcc.div
0x00000000000035cc 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_umulsidi3.o)
.text.libgcc 0x00000000000035cc 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_umulsidi3.o)
.text.libgcc.prologue
0x00000000000035cc 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_umulsidi3.o)
.text.libgcc.builtins
0x00000000000035cc 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_umulsidi3.o)
.text.libgcc.fmul
0x00000000000035cc 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_umulsidi3.o)
.text.libgcc.fixed
0x00000000000035cc 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_umulsidi3.o)
.text.libgcc.mul
0x00000000000035cc 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_ashldi3.o)
.text.libgcc.div
0x00000000000035cc 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_ashldi3.o)
.text.libgcc 0x00000000000035cc 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_ashldi3.o)
.text.libgcc.prologue
0x00000000000035cc 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_ashldi3.o)
.text.libgcc.builtins
0x00000000000035cc 0x32 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_ashldi3.o)
0x00000000000035cc __ashldi3
.text.libgcc.fmul
0x00000000000035fe 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_ashldi3.o)
.text.libgcc.fixed
0x00000000000035fe 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_ashldi3.o)
.text.libgcc.mul
0x00000000000035fe 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_ashrdi3.o)
.text.libgcc.div
0x00000000000035fe 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_ashrdi3.o)
.text.libgcc 0x00000000000035fe 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_ashrdi3.o)
.text.libgcc.prologue
0x00000000000035fe 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_ashrdi3.o)
.text.libgcc.builtins
0x00000000000035fe 0x3c /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_ashrdi3.o)
0x00000000000035fe __ashrdi3
0x0000000000003602 __lshrdi3
.text.libgcc.fmul
0x000000000000363a 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_ashrdi3.o)
.text.libgcc.fixed
0x000000000000363a 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_ashrdi3.o)
.text.libgcc.mul
0x000000000000363a 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_adddi3.o)
.text.libgcc.div
0x000000000000363a 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_adddi3.o)
.text.libgcc 0x000000000000363a 0x12 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_adddi3.o)
0x000000000000363a __adddi3
.text.libgcc.prologue
0x000000000000364c 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_adddi3.o)
.text.libgcc.builtins
0x000000000000364c 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_adddi3.o)
.text.libgcc.fmul
0x000000000000364c 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_adddi3.o)
.text.libgcc.fixed
0x000000000000364c 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_adddi3.o)
.text.libgcc.mul
0x000000000000364c 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_adddi3_s8.o)
.text.libgcc.div
0x000000000000364c 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_adddi3_s8.o)
.text.libgcc 0x000000000000364c 0x18 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_adddi3_s8.o)
0x000000000000364c __adddi3_s8
.text.libgcc.prologue
0x0000000000003664 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_adddi3_s8.o)
.text.libgcc.builtins
0x0000000000003664 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_adddi3_s8.o)
.text.libgcc.fmul
0x0000000000003664 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_adddi3_s8.o)
.text.libgcc.fixed
0x0000000000003664 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_adddi3_s8.o)
.text.libgcc.mul
0x0000000000003664 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_subdi3.o)
.text.libgcc.div
0x0000000000003664 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_subdi3.o)
.text.libgcc 0x0000000000003664 0x12 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_subdi3.o)
0x0000000000003664 __subdi3
.text.libgcc.prologue
0x0000000000003676 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_subdi3.o)
.text.libgcc.builtins
0x0000000000003676 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_subdi3.o)
.text.libgcc.fmul
0x0000000000003676 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_subdi3.o)
.text.libgcc.fixed
0x0000000000003676 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_subdi3.o)
.text.libgcc.mul
0x0000000000003676 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_cmpdi2.o)
.text.libgcc.div
0x0000000000003676 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_cmpdi2.o)
.text.libgcc 0x0000000000003676 0x12 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_cmpdi2.o)
0x0000000000003676 __cmpdi2
.text.libgcc.prologue
0x0000000000003688 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_cmpdi2.o)
.text.libgcc.builtins
0x0000000000003688 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_cmpdi2.o)
.text.libgcc.fmul
0x0000000000003688 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_cmpdi2.o)
.text.libgcc.fixed
0x0000000000003688 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_cmpdi2.o)
.text.libgcc.mul
0x0000000000003688 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_cmpdi2_s8.o)
.text.libgcc.div
0x0000000000003688 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_cmpdi2_s8.o)
.text.libgcc 0x0000000000003688 0x18 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_cmpdi2_s8.o)
0x0000000000003688 __cmpdi2_s8
.text.libgcc.prologue
0x00000000000036a0 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_cmpdi2_s8.o)
.text.libgcc.builtins
0x00000000000036a0 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_cmpdi2_s8.o)
.text.libgcc.fmul
0x00000000000036a0 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_cmpdi2_s8.o)
.text.libgcc.fixed
0x00000000000036a0 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_cmpdi2_s8.o)
.text.libgcc.mul
0x00000000000036a0 0x1e /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_umulhisi3.o)
0x00000000000036a0 __umulhisi3
.text.libgcc.div
0x00000000000036be 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_umulhisi3.o)
.text.libgcc 0x00000000000036be 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_umulhisi3.o)
.text.libgcc.prologue
0x00000000000036be 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_umulhisi3.o)
.text.libgcc.builtins
0x00000000000036be 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_umulhisi3.o)
.text.libgcc.fmul
0x00000000000036be 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_umulhisi3.o)
.text.libgcc.fixed
0x00000000000036be 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_umulhisi3.o)
.text.avr-libc
0x00000000000036be 0x242 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/libc.a(malloc.o)
0x00000000000036be malloc
0x00000000000037ee free
.text.avr-libc
0x0000000000003900 0x12 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/libc.a(memcpy.o)
0x0000000000003900 memcpy
.text.avr-libc
0x0000000000003912 0x16 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/libc.a(strchr.o)
0x0000000000003912 strchr
.text.avr-libc
0x0000000000003928 0x1c /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/libc.a(strncmp.o)
0x0000000000003928 strncmp
0x0000000000003944 . = ALIGN (0x2)
*(.fini9)
.fini9 0x0000000000003944 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_exit.o)
0x0000000000003944 exit
0x0000000000003944 _exit
*(.fini9)
*(.fini8)
*(.fini8)
*(.fini7)
*(.fini7)
*(.fini6)
*(.fini6)
*(.fini5)
*(.fini5)
*(.fini4)
*(.fini4)
*(.fini3)
*(.fini3)
*(.fini2)
*(.fini2)
*(.fini1)
*(.fini1)
*(.fini0)
.fini0 0x0000000000003944 0x4 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_exit.o)
*(.fini0)
0x0000000000003948 _etext = .
.data 0x0000000000800100 0x1e load address 0x0000000000003948
0x0000000000800100 PROVIDE (__data_start, .)
*(.data)
.data 0x0000000000800100 0x0 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/crtatmega328p.o
.data 0x0000000000800100 0x0 partition.o
.data 0x0000000000800100 0x0 sd_raw.o
.data 0x0000000000800100 0x0 byteordering.o
.data 0x0000000000800100 0x0 periph.o
.data 0x0000000000800100 0x0 fat.o
.data 0x0000000000800100 0x3 main.o
0x0000000000800100 song_selection
0x0000000000800101 DATA_CHUNK_ID
.data 0x0000000000800103 0x0 fifo.o
.data 0x0000000000800103 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_mulsi3.o)
.data 0x0000000000800103 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_udivmodhi4.o)
.data 0x0000000000800103 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_udivmodsi4.o)
.data 0x0000000000800103 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_exit.o)
.data 0x0000000000800103 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_tablejump2.o)
.data 0x0000000000800103 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_copy_data.o)
.data 0x0000000000800103 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_clear_bss.o)
.data 0x0000000000800103 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_muluhisi3.o)
.data 0x0000000000800103 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_muldi3.o)
.data 0x0000000000800103 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_muldi3_6.o)
.data 0x0000000000800103 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_umulsidi3.o)
.data 0x0000000000800103 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_ashldi3.o)
.data 0x0000000000800103 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_ashrdi3.o)
.data 0x0000000000800103 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_adddi3.o)
.data 0x0000000000800103 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_adddi3_s8.o)
.data 0x0000000000800103 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_subdi3.o)
.data 0x0000000000800103 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_cmpdi2.o)
.data 0x0000000000800103 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_cmpdi2_s8.o)
.data 0x0000000000800103 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_umulhisi3.o)
.data 0x0000000000800103 0x6 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/libc.a(malloc.o)
0x0000000000800103 __malloc_heap_end
0x0000000000800105 __malloc_heap_start
0x0000000000800107 __malloc_margin
.data 0x0000000000800109 0x0 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/libc.a(memcpy.o)
.data 0x0000000000800109 0x0 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/libc.a(strchr.o)
.data 0x0000000000800109 0x0 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/libc.a(strncmp.o)
*(.data*)
*(.rodata)
.rodata 0x0000000000800109 0xd fat.o
*(.rodata*)
.rodata.str1.1
0x0000000000800116 0x7 main.o
*(.gnu.linkonce.d*)
0x000000000080011e . = ALIGN (0x2)
*fill* 0x000000000080011d 0x1
0x000000000080011e _edata = .
0x000000000080011e PROVIDE (__data_end, .)
.bss 0x000000000080011e 0x572
0x000000000080011e PROVIDE (__bss_start, .)
*(.bss)
.bss 0x000000000080011e 0x0 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/crtatmega328p.o
.bss 0x000000000080011e 0x11 partition.o
.bss 0x000000000080012f 0x1 sd_raw.o
.bss 0x0000000000800130 0x0 byteordering.o
.bss 0x0000000000800130 0x0 periph.o
.bss 0x0000000000800130 0xe3 fat.o
.bss 0x0000000000800213 0x1 main.o
0x0000000000800213 cmd_depth
.bss 0x0000000000800214 0x1a fifo.o
.bss 0x000000000080022e 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_mulsi3.o)
.bss 0x000000000080022e 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_udivmodhi4.o)
.bss 0x000000000080022e 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_udivmodsi4.o)
.bss 0x000000000080022e 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_exit.o)
.bss 0x000000000080022e 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_tablejump2.o)
.bss 0x000000000080022e 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_copy_data.o)
.bss 0x000000000080022e 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_clear_bss.o)
.bss 0x000000000080022e 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_muluhisi3.o)
.bss 0x000000000080022e 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_muldi3.o)
.bss 0x000000000080022e 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_muldi3_6.o)
.bss 0x000000000080022e 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_umulsidi3.o)
.bss 0x000000000080022e 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_ashldi3.o)
.bss 0x000000000080022e 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_ashrdi3.o)
.bss 0x000000000080022e 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_adddi3.o)
.bss 0x000000000080022e 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_adddi3_s8.o)
.bss 0x000000000080022e 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_subdi3.o)
.bss 0x000000000080022e 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_cmpdi2.o)
.bss 0x000000000080022e 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_cmpdi2_s8.o)
.bss 0x000000000080022e 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_umulhisi3.o)
.bss 0x000000000080022e 0x0 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/libc.a(malloc.o)
.bss 0x000000000080022e 0x0 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/libc.a(memcpy.o)
.bss 0x000000000080022e 0x0 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/libc.a(strchr.o)
.bss 0x000000000080022e 0x0 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/libc.a(strncmp.o)
*(.bss*)
*(COMMON)
COMMON 0x000000000080022e 0x2e periph.o
0x000000000080022e ck_fmt_t
0x0000000000800258 ck_master_t
COMMON 0x000000000080025c 0x430 main.o
0x000000000080025c cmd_state
0x000000000080025d song_buf
0x000000000080065d song_buf_select
0x000000000080065e song_len
0x0000000000800662 song_read_position
0x0000000000800666 song_selected
0x0000000000800667 songs
0x000000000080068b song_position
COMMON 0x000000000080068c 0x4 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/libc.a(malloc.o)
0x000000000080068c __brkval
0x000000000080068e __flp
0x0000000000800690 PROVIDE (__bss_end, .)
0x0000000000003948 __data_load_start = LOADADDR (.data)
0x0000000000003966 __data_load_end = (__data_load_start + SIZEOF (.data))
.noinit 0x0000000000800690 0x0
[!provide] PROVIDE (__noinit_start, .)
*(.noinit*)
[!provide] PROVIDE (__noinit_end, .)
0x0000000000800690 _end = .
0x0000000000800690 PROVIDE (__heap_start, .)
.eeprom 0x0000000000810000 0x0
*(.eeprom*)
0x0000000000810000 __eeprom_end = .
.fuse
*(.fuse)
*(.lfuse)
*(.hfuse)
*(.efuse)
.lock
*(.lock*)
.signature
*(.signature*)
.user_signatures
*(.user_signatures*)
.stab 0x0000000000000000 0x5ff4
*(.stab)
.stab 0x0000000000000000 0x720 partition.o
.stab 0x0000000000000720 0x1980 sd_raw.o
0x1b30 (size before relaxing)
.stab 0x00000000000020a0 0x414 byteordering.o
0x594 (size before relaxing)
.stab 0x00000000000024b4 0x75c periph.o
0x9b4 (size before relaxing)
.stab 0x0000000000002c10 0x25f8 fat.o
0x2844 (size before relaxing)
.stab 0x0000000000005208 0x978 main.o
0xd5c (size before relaxing)
.stab 0x0000000000005b80 0x474 fifo.o
0x60c (size before relaxing)
.stabstr 0x0000000000000000 0x2c10
*(.stabstr)
.stabstr 0x0000000000000000 0x2c10 partition.o
.stab.excl
*(.stab.excl)
.stab.exclstr
*(.stab.exclstr)
.stab.index
*(.stab.index)
.stab.indexstr
*(.stab.indexstr)
.comment 0x0000000000000000 0x11
*(.comment)
.comment 0x0000000000000000 0x11 partition.o
0x12 (size before relaxing)
.comment 0x0000000000000011 0x12 sd_raw.o
.comment 0x0000000000000011 0x12 byteordering.o
.comment 0x0000000000000011 0x12 periph.o
.comment 0x0000000000000011 0x12 fat.o
.comment 0x0000000000000011 0x12 main.o
.comment 0x0000000000000011 0x12 fifo.o
.comment 0x0000000000000011 0x12 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/libc.a(malloc.o)
.note.gnu.avr.deviceinfo
0x0000000000000000 0x40
.note.gnu.avr.deviceinfo
0x0000000000000000 0x40 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/crtatmega328p.o
.note.gnu.build-id
*(.note.gnu.build-id)
.debug
*(.debug)
.line
*(.line)
.debug_srcinfo
*(.debug_srcinfo)
.debug_sfnames
*(.debug_sfnames)
.debug_aranges
*(.debug_aranges)
.debug_pubnames
*(.debug_pubnames)
.debug_info 0x0000000000000000 0x5f4
*(.debug_info .gnu.linkonce.wi.*)
.debug_info 0x0000000000000000 0x5f4 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/crtatmega328p.o
.debug_abbrev 0x0000000000000000 0x5a2
*(.debug_abbrev)
.debug_abbrev 0x0000000000000000 0x5a2 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/crtatmega328p.o
.debug_line 0x0000000000000000 0x1a
*(.debug_line .debug_line.* .debug_line_end)
.debug_line 0x0000000000000000 0x1a /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/crtatmega328p.o
.debug_frame
*(.debug_frame)
.debug_str 0x0000000000000000 0x208
*(.debug_str)
.debug_str 0x0000000000000000 0x208 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/crtatmega328p.o
.debug_loc
*(.debug_loc)
.debug_macinfo
*(.debug_macinfo)
.debug_weaknames
*(.debug_weaknames)
.debug_funcnames
*(.debug_funcnames)
.debug_typenames
*(.debug_typenames)
.debug_varnames
*(.debug_varnames)
.debug_pubtypes
*(.debug_pubtypes)
.debug_ranges
*(.debug_ranges)
.debug_macro
*(.debug_macro)
OUTPUT(sd-reader.out elf32-avr)
LOAD linker stubs

BIN
sd_reader/sd-reader.out Executable file

Binary file not shown.

View File

@ -0,0 +1,53 @@
/*
* Copyright (c) 2006-2012 by Roland Riegel <feedback@roland-riegel.de>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of either the GNU General Public License version 2
* or the GNU Lesser General Public License version 2.1, both as
* published by the Free Software Foundation.
*/
#ifndef SD_READER_CONFIG_H
#define SD_READER_CONFIG_H
#ifdef __cplusplus
extern "C"
{
#endif
/**
* \addtogroup config Sd-reader configuration
*
* @{
*/
/**
* \file
* Common sd-reader configuration used by all modules (license: GPLv2 or LGPLv2.1)
*
* \note This file contains only configuration items relevant to
* all sd-reader implementation files. For module specific configuration
* options, please see the files fat_config.h, partition_config.h
* and sd_raw_config.h.
*/
/**
* Controls allocation of memory.
*
* Set to 1 to use malloc()/free() for allocation of structures
* like file and directory handles, set to 0 to use pre-allocated
* fixed-size handle arrays.
*/
#define USE_DYNAMIC_MEMORY 0
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif

998
sd_reader/sd_raw.c Normal file
View File

@ -0,0 +1,998 @@
/*
* Copyright (c) 2006-2012 by Roland Riegel <feedback@roland-riegel.de>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of either the GNU General Public License version 2
* or the GNU Lesser General Public License version 2.1, both as
* published by the Free Software Foundation.
*/
#include <string.h>
#include <avr/io.h>
#include "sd_raw.h"
/**
* \addtogroup sd_raw MMC/SD/SDHC card raw access
*
* This module implements read and write access to MMC, SD
* and SDHC cards. It serves as a low-level driver for the
* higher level modules such as partition and file system
* access.
*
* @{
*/
/**
* \file
* MMC/SD/SDHC raw access implementation (license: GPLv2 or LGPLv2.1)
*
* \author Roland Riegel
*/
/**
* \addtogroup sd_raw_config MMC/SD configuration
* Preprocessor defines to configure the MMC/SD support.
*/
/**
* @}
*/
/* commands available in SPI mode */
/* CMD0: response R1 */
#define CMD_GO_IDLE_STATE 0x00
/* CMD1: response R1 */
#define CMD_SEND_OP_COND 0x01
/* CMD8: response R7 */
#define CMD_SEND_IF_COND 0x08
/* CMD9: response R1 */
#define CMD_SEND_CSD 0x09
/* CMD10: response R1 */
#define CMD_SEND_CID 0x0a
/* CMD12: response R1 */
#define CMD_STOP_TRANSMISSION 0x0c
/* CMD13: response R2 */
#define CMD_SEND_STATUS 0x0d
/* CMD16: arg0[31:0]: block length, response R1 */
#define CMD_SET_BLOCKLEN 0x10
/* CMD17: arg0[31:0]: data address, response R1 */
#define CMD_READ_SINGLE_BLOCK 0x11
/* CMD18: arg0[31:0]: data address, response R1 */
#define CMD_READ_MULTIPLE_BLOCK 0x12
/* CMD24: arg0[31:0]: data address, response R1 */
#define CMD_WRITE_SINGLE_BLOCK 0x18
/* CMD25: arg0[31:0]: data address, response R1 */
#define CMD_WRITE_MULTIPLE_BLOCK 0x19
/* CMD27: response R1 */
#define CMD_PROGRAM_CSD 0x1b
/* CMD28: arg0[31:0]: data address, response R1b */
#define CMD_SET_WRITE_PROT 0x1c
/* CMD29: arg0[31:0]: data address, response R1b */
#define CMD_CLR_WRITE_PROT 0x1d
/* CMD30: arg0[31:0]: write protect data address, response R1 */
#define CMD_SEND_WRITE_PROT 0x1e
/* CMD32: arg0[31:0]: data address, response R1 */
#define CMD_TAG_SECTOR_START 0x20
/* CMD33: arg0[31:0]: data address, response R1 */
#define CMD_TAG_SECTOR_END 0x21
/* CMD34: arg0[31:0]: data address, response R1 */
#define CMD_UNTAG_SECTOR 0x22
/* CMD35: arg0[31:0]: data address, response R1 */
#define CMD_TAG_ERASE_GROUP_START 0x23
/* CMD36: arg0[31:0]: data address, response R1 */
#define CMD_TAG_ERASE_GROUP_END 0x24
/* CMD37: arg0[31:0]: data address, response R1 */
#define CMD_UNTAG_ERASE_GROUP 0x25
/* CMD38: arg0[31:0]: stuff bits, response R1b */
#define CMD_ERASE 0x26
/* ACMD41: arg0[31:0]: OCR contents, response R1 */
#define CMD_SD_SEND_OP_COND 0x29
/* CMD42: arg0[31:0]: stuff bits, response R1b */
#define CMD_LOCK_UNLOCK 0x2a
/* CMD55: arg0[31:0]: stuff bits, response R1 */
#define CMD_APP 0x37
/* CMD58: arg0[31:0]: stuff bits, response R3 */
#define CMD_READ_OCR 0x3a
/* CMD59: arg0[31:1]: stuff bits, arg0[0:0]: crc option, response R1 */
#define CMD_CRC_ON_OFF 0x3b
/* command responses */
/* R1: size 1 byte */
#define R1_IDLE_STATE 0
#define R1_ERASE_RESET 1
#define R1_ILL_COMMAND 2
#define R1_COM_CRC_ERR 3
#define R1_ERASE_SEQ_ERR 4
#define R1_ADDR_ERR 5
#define R1_PARAM_ERR 6
/* R1b: equals R1, additional busy bytes */
/* R2: size 2 bytes */
#define R2_CARD_LOCKED 0
#define R2_WP_ERASE_SKIP 1
#define R2_ERR 2
#define R2_CARD_ERR 3
#define R2_CARD_ECC_FAIL 4
#define R2_WP_VIOLATION 5
#define R2_INVAL_ERASE 6
#define R2_OUT_OF_RANGE 7
#define R2_CSD_OVERWRITE 7
#define R2_IDLE_STATE (R1_IDLE_STATE + 8)
#define R2_ERASE_RESET (R1_ERASE_RESET + 8)
#define R2_ILL_COMMAND (R1_ILL_COMMAND + 8)
#define R2_COM_CRC_ERR (R1_COM_CRC_ERR + 8)
#define R2_ERASE_SEQ_ERR (R1_ERASE_SEQ_ERR + 8)
#define R2_ADDR_ERR (R1_ADDR_ERR + 8)
#define R2_PARAM_ERR (R1_PARAM_ERR + 8)
/* R3: size 5 bytes */
#define R3_OCR_MASK (0xffffffffUL)
#define R3_IDLE_STATE (R1_IDLE_STATE + 32)
#define R3_ERASE_RESET (R1_ERASE_RESET + 32)
#define R3_ILL_COMMAND (R1_ILL_COMMAND + 32)
#define R3_COM_CRC_ERR (R1_COM_CRC_ERR + 32)
#define R3_ERASE_SEQ_ERR (R1_ERASE_SEQ_ERR + 32)
#define R3_ADDR_ERR (R1_ADDR_ERR + 32)
#define R3_PARAM_ERR (R1_PARAM_ERR + 32)
/* Data Response: size 1 byte */
#define DR_STATUS_MASK 0x0e
#define DR_STATUS_ACCEPTED 0x05
#define DR_STATUS_CRC_ERR 0x0a
#define DR_STATUS_WRITE_ERR 0x0c
/* status bits for card types */
#define SD_RAW_SPEC_1 0
#define SD_RAW_SPEC_2 1
#define SD_RAW_SPEC_SDHC 2
#if !SD_RAW_SAVE_RAM
/* static data buffer for acceleration */
static uint8_t raw_block[512];
/* offset where the data within raw_block lies on the card */
static offset_t raw_block_address;
#if SD_RAW_WRITE_BUFFERING
/* flag to remember if raw_block was written to the card */
static uint8_t raw_block_written;
#endif
#endif
/* card type state */
static uint8_t sd_raw_card_type;
/* private helper functions */
static void sd_raw_send_byte(uint8_t b);
static uint8_t sd_raw_rec_byte();
static uint8_t sd_raw_send_command(uint8_t command, uint32_t arg);
/**
* \ingroup sd_raw
* Initializes memory card communication.
*
* \returns 0 on failure, 1 on success.
*/
uint8_t sd_raw_init()
{
/* enable inputs for reading card status */
configure_pin_available();
configure_pin_locked();
/* enable outputs for MOSI, SCK, SS, input for MISO */
configure_pin_mosi();
configure_pin_sck();
configure_pin_ss();
configure_pin_miso();
unselect_card();
/* initialize SPI with lowest frequency; max. 400kHz during identification mode of card */
SPCR = (0 << SPIE) | /* SPI Interrupt Enable */
(1 << SPE) | /* SPI Enable */
(0 << DORD) | /* Data Order: MSB first */
(1 << MSTR) | /* Master mode */
(0 << CPOL) | /* Clock Polarity: SCK low when idle */
(0 << CPHA) | /* Clock Phase: sample on rising SCK edge */
(1 << SPR1) | /* Clock Frequency: f_OSC / 128 */
(1 << SPR0);
SPSR &= ~(1 << SPI2X); /* No doubled clock frequency */
/* initialization procedure */
sd_raw_card_type = 0;
if(!sd_raw_available())
return 0;
/* card needs 74 cycles minimum to start up */
for(uint8_t i = 0; i < 10; ++i)
{
/* wait 8 clock cycles */
sd_raw_rec_byte();
}
/* address card */
select_card();
/* reset card */
uint8_t response;
for(uint16_t i = 0; ; ++i)
{
response = sd_raw_send_command(CMD_GO_IDLE_STATE, 0);
if(response == (1 << R1_IDLE_STATE))
break;
if(i == 0x1ff)
{
unselect_card();
return 0;
}
}
#if SD_RAW_SDHC
/* check for version of SD card specification */
response = sd_raw_send_command(CMD_SEND_IF_COND, 0x100 /* 2.7V - 3.6V */ | 0xaa /* test pattern */);
if((response & (1 << R1_ILL_COMMAND)) == 0)
{
sd_raw_rec_byte();
sd_raw_rec_byte();
if((sd_raw_rec_byte() & 0x01) == 0)
return 0; /* card operation voltage range doesn't match */
if(sd_raw_rec_byte() != 0xaa)
return 0; /* wrong test pattern */
/* card conforms to SD 2 card specification */
sd_raw_card_type |= (1 << SD_RAW_SPEC_2);
}
else
#endif
{
/* determine SD/MMC card type */
sd_raw_send_command(CMD_APP, 0);
response = sd_raw_send_command(CMD_SD_SEND_OP_COND, 0);
if((response & (1 << R1_ILL_COMMAND)) == 0)
{
/* card conforms to SD 1 card specification */
sd_raw_card_type |= (1 << SD_RAW_SPEC_1);
}
else
{
/* MMC card */
}
}
/* wait for card to get ready */
for(uint16_t i = 0; ; ++i)
{
if(sd_raw_card_type & ((1 << SD_RAW_SPEC_1) | (1 << SD_RAW_SPEC_2)))
{
uint32_t arg = 0;
#if SD_RAW_SDHC
if(sd_raw_card_type & (1 << SD_RAW_SPEC_2))
arg = 0x40000000;
#endif
sd_raw_send_command(CMD_APP, 0);
response = sd_raw_send_command(CMD_SD_SEND_OP_COND, arg);
}
else
{
response = sd_raw_send_command(CMD_SEND_OP_COND, 0);
}
if((response & (1 << R1_IDLE_STATE)) == 0)
break;
if(i == 0x7fff)
{
unselect_card();
return 0;
}
}
#if SD_RAW_SDHC
if(sd_raw_card_type & (1 << SD_RAW_SPEC_2))
{
if(sd_raw_send_command(CMD_READ_OCR, 0))
{
unselect_card();
return 0;
}
if(sd_raw_rec_byte() & 0x40)
sd_raw_card_type |= (1 << SD_RAW_SPEC_SDHC);
sd_raw_rec_byte();
sd_raw_rec_byte();
sd_raw_rec_byte();
}
#endif
/* set block size to 512 bytes */
if(sd_raw_send_command(CMD_SET_BLOCKLEN, 512))
{
unselect_card();
return 0;
}
/* deaddress card */
unselect_card();
/* switch to highest SPI frequency possible */
SPCR &= ~((1 << SPR1) | (1 << SPR0)); /* Clock Frequency: f_OSC / 4 */
SPSR |= (1 << SPI2X); /* Doubled Clock Frequency: f_OSC / 2 */
#if !SD_RAW_SAVE_RAM
/* the first block is likely to be accessed first, so precache it here */
raw_block_address = (offset_t) -1;
#if SD_RAW_WRITE_BUFFERING
raw_block_written = 1;
#endif
if(!sd_raw_read(0, raw_block, sizeof(raw_block)))
return 0;
#endif
return 1;
}
/**
* \ingroup sd_raw
* Checks wether a memory card is located in the slot.
*
* \returns 1 if the card is available, 0 if it is not.
*/
uint8_t sd_raw_available()
{
return get_pin_available() == 0x00;
}
/**
* \ingroup sd_raw
* Checks wether the memory card is locked for write access.
*
* \returns 1 if the card is locked, 0 if it is not.
*/
uint8_t sd_raw_locked()
{
return get_pin_locked() == 0x00;
}
/**
* \ingroup sd_raw
* Sends a raw byte to the memory card.
*
* \param[in] b The byte to sent.
* \see sd_raw_rec_byte
*/
void sd_raw_send_byte(uint8_t b)
{
SPDR = b;
/* wait for byte to be shifted out */
while(!(SPSR & (1 << SPIF)));
SPSR &= ~(1 << SPIF);
}
/**
* \ingroup sd_raw
* Receives a raw byte from the memory card.
*
* \returns The byte which should be read.
* \see sd_raw_send_byte
*/
uint8_t sd_raw_rec_byte()
{
/* send dummy data for receiving some */
SPDR = 0xff;
while(!(SPSR & (1 << SPIF)));
SPSR &= ~(1 << SPIF);
return SPDR;
}
/**
* \ingroup sd_raw
* Send a command to the memory card which responses with a R1 response (and possibly others).
*
* \param[in] command The command to send.
* \param[in] arg The argument for command.
* \returns The command answer.
*/
uint8_t sd_raw_send_command(uint8_t command, uint32_t arg)
{
uint8_t response;
/* wait some clock cycles */
sd_raw_rec_byte();
/* send command via SPI */
sd_raw_send_byte(0x40 | command);
sd_raw_send_byte((arg >> 24) & 0xff);
sd_raw_send_byte((arg >> 16) & 0xff);
sd_raw_send_byte((arg >> 8) & 0xff);
sd_raw_send_byte((arg >> 0) & 0xff);
switch(command)
{
case CMD_GO_IDLE_STATE:
sd_raw_send_byte(0x95);
break;
case CMD_SEND_IF_COND:
sd_raw_send_byte(0x87);
break;
default:
sd_raw_send_byte(0xff);
break;
}
/* receive response */
for(uint8_t i = 0; i < 10; ++i)
{
response = sd_raw_rec_byte();
if(response != 0xff)
break;
}
return response;
}
/**
* \ingroup sd_raw
* Reads raw data from the card.
*
* \param[in] offset The offset from which to read.
* \param[out] buffer The buffer into which to write the data.
* \param[in] length The number of bytes to read.
* \returns 0 on failure, 1 on success.
* \see sd_raw_read_interval, sd_raw_write, sd_raw_write_interval
*/
uint8_t sd_raw_read(offset_t offset, uint8_t* buffer, uintptr_t length)
{
offset_t block_address;
uint16_t block_offset;
uint16_t read_length;
while(length > 0)
{
/* determine byte count to read at once */
block_offset = offset & 0x01ff;
block_address = offset - block_offset;
read_length = 512 - block_offset; /* read up to block border */
if(read_length > length)
read_length = length;
#if !SD_RAW_SAVE_RAM
/* check if the requested data is cached */
if(block_address != raw_block_address)
#endif
{
#if SD_RAW_WRITE_BUFFERING
if(!sd_raw_sync())
return 0;
#endif
/* address card */
select_card();
/* send single block request */
#if SD_RAW_SDHC
if(sd_raw_send_command(CMD_READ_SINGLE_BLOCK, (sd_raw_card_type & (1 << SD_RAW_SPEC_SDHC) ? block_address / 512 : block_address)))
#else
if(sd_raw_send_command(CMD_READ_SINGLE_BLOCK, block_address))
#endif
{
unselect_card();
return 0;
}
/* wait for data block (start byte 0xfe) */
while(sd_raw_rec_byte() != 0xfe);
#if SD_RAW_SAVE_RAM
/* read byte block */
uint16_t read_to = block_offset + read_length;
for(uint16_t i = 0; i < 512; ++i)
{
uint8_t b = sd_raw_rec_byte();
if(i >= block_offset && i < read_to)
*buffer++ = b;
}
#else
/* read byte block */
uint8_t* cache = raw_block;
for(uint16_t i = 0; i < 512; ++i)
*cache++ = sd_raw_rec_byte();
raw_block_address = block_address;
memcpy(buffer, raw_block + block_offset, read_length);
buffer += read_length;
#endif
/* read crc16 */
sd_raw_rec_byte();
sd_raw_rec_byte();
/* deaddress card */
unselect_card();
/* let card some time to finish */
sd_raw_rec_byte();
}
#if !SD_RAW_SAVE_RAM
else
{
/* use cached data */
memcpy(buffer, raw_block + block_offset, read_length);
buffer += read_length;
}
#endif
length -= read_length;
offset += read_length;
}
return 1;
}
/**
* \ingroup sd_raw
* Continuously reads units of \c interval bytes and calls a callback function.
*
* This function starts reading at the specified offset. Every \c interval bytes,
* it calls the callback function with the associated data buffer.
*
* By returning zero, the callback may stop reading.
*
* \note Within the callback function, you can not start another read or
* write operation.
* \note This function only works if the following conditions are met:
* - (offset - (offset % 512)) % interval == 0
* - length % interval == 0
*
* \param[in] offset Offset from which to start reading.
* \param[in] buffer Pointer to a buffer which is at least interval bytes in size.
* \param[in] interval Number of bytes to read before calling the callback function.
* \param[in] length Number of bytes to read altogether.
* \param[in] callback The function to call every interval bytes.
* \param[in] p An opaque pointer directly passed to the callback function.
* \returns 0 on failure, 1 on success
* \see sd_raw_write_interval, sd_raw_read, sd_raw_write
*/
uint8_t sd_raw_read_interval(offset_t offset, uint8_t* buffer, uintptr_t interval, uintptr_t length, sd_raw_read_interval_handler_t callback, void* p)
{
if(!buffer || interval == 0 || length < interval || !callback)
return 0;
#if !SD_RAW_SAVE_RAM
while(length >= interval)
{
/* as reading is now buffered, we directly
* hand over the request to sd_raw_read()
*/
if(!sd_raw_read(offset, buffer, interval))
return 0;
if(!callback(buffer, offset, p))
break;
offset += interval;
length -= interval;
}
return 1;
#else
/* address card */
select_card();
uint16_t block_offset;
uint16_t read_length;
uint8_t* buffer_cur;
uint8_t finished = 0;
do
{
/* determine byte count to read at once */
block_offset = offset & 0x01ff;
read_length = 512 - block_offset;
/* send single block request */
#if SD_RAW_SDHC
if(sd_raw_send_command(CMD_READ_SINGLE_BLOCK, (sd_raw_card_type & (1 << SD_RAW_SPEC_SDHC) ? offset / 512 : offset - block_offset)))
#else
if(sd_raw_send_command(CMD_READ_SINGLE_BLOCK, offset - block_offset))
#endif
{
unselect_card();
return 0;
}
/* wait for data block (start byte 0xfe) */
while(sd_raw_rec_byte() != 0xfe);
/* read up to the data of interest */
for(uint16_t i = 0; i < block_offset; ++i)
sd_raw_rec_byte();
/* read interval bytes of data and execute the callback */
do
{
if(read_length < interval || length < interval)
break;
buffer_cur = buffer;
for(uint16_t i = 0; i < interval; ++i)
*buffer_cur++ = sd_raw_rec_byte();
if(!callback(buffer, offset + (512 - read_length), p))
{
finished = 1;
break;
}
read_length -= interval;
length -= interval;
} while(read_length > 0 && length > 0);
/* read rest of data block */
while(read_length-- > 0)
sd_raw_rec_byte();
/* read crc16 */
sd_raw_rec_byte();
sd_raw_rec_byte();
if(length < interval)
break;
offset = offset - block_offset + 512;
} while(!finished);
/* deaddress card */
unselect_card();
/* let card some time to finish */
sd_raw_rec_byte();
return 1;
#endif
}
#if DOXYGEN || SD_RAW_WRITE_SUPPORT
/**
* \ingroup sd_raw
* Writes raw data to the card.
*
* \note If write buffering is enabled, you might have to
* call sd_raw_sync() before disconnecting the card
* to ensure all remaining data has been written.
*
* \param[in] offset The offset where to start writing.
* \param[in] buffer The buffer containing the data to be written.
* \param[in] length The number of bytes to write.
* \returns 0 on failure, 1 on success.
* \see sd_raw_write_interval, sd_raw_read, sd_raw_read_interval
*/
uint8_t sd_raw_write(offset_t offset, const uint8_t* buffer, uintptr_t length)
{
if(sd_raw_locked())
return 0;
offset_t block_address;
uint16_t block_offset;
uint16_t write_length;
while(length > 0)
{
/* determine byte count to write at once */
block_offset = offset & 0x01ff;
block_address = offset - block_offset;
write_length = 512 - block_offset; /* write up to block border */
if(write_length > length)
write_length = length;
/* Merge the data to write with the content of the block.
* Use the cached block if available.
*/
if(block_address != raw_block_address)
{
#if SD_RAW_WRITE_BUFFERING
if(!sd_raw_sync())
return 0;
#endif
if(block_offset || write_length < 512)
{
if(!sd_raw_read(block_address, raw_block, sizeof(raw_block)))
return 0;
}
raw_block_address = block_address;
}
if(buffer != raw_block)
{
memcpy(raw_block + block_offset, buffer, write_length);
#if SD_RAW_WRITE_BUFFERING
raw_block_written = 0;
if(length == write_length)
return 1;
#endif
}
/* address card */
select_card();
/* send single block request */
#if SD_RAW_SDHC
if(sd_raw_send_command(CMD_WRITE_SINGLE_BLOCK, (sd_raw_card_type & (1 << SD_RAW_SPEC_SDHC) ? block_address / 512 : block_address)))
#else
if(sd_raw_send_command(CMD_WRITE_SINGLE_BLOCK, block_address))
#endif
{
unselect_card();
return 0;
}
/* send start byte */
sd_raw_send_byte(0xfe);
/* write byte block */
uint8_t* cache = raw_block;
for(uint16_t i = 0; i < 512; ++i)
sd_raw_send_byte(*cache++);
/* write dummy crc16 */
sd_raw_send_byte(0xff);
sd_raw_send_byte(0xff);
/* wait while card is busy */
while(sd_raw_rec_byte() != 0xff);
sd_raw_rec_byte();
/* deaddress card */
unselect_card();
buffer += write_length;
offset += write_length;
length -= write_length;
#if SD_RAW_WRITE_BUFFERING
raw_block_written = 1;
#endif
}
return 1;
}
#endif
#if DOXYGEN || SD_RAW_WRITE_SUPPORT
/**
* \ingroup sd_raw
* Writes a continuous data stream obtained from a callback function.
*
* This function starts writing at the specified offset. To obtain the
* next bytes to write, it calls the callback function. The callback fills the
* provided data buffer and returns the number of bytes it has put into the buffer.
*
* By returning zero, the callback may stop writing.
*
* \param[in] offset Offset where to start writing.
* \param[in] buffer Pointer to a buffer which is used for the callback function.
* \param[in] length Number of bytes to write in total. May be zero for endless writes.
* \param[in] callback The function used to obtain the bytes to write.
* \param[in] p An opaque pointer directly passed to the callback function.
* \returns 0 on failure, 1 on success
* \see sd_raw_read_interval, sd_raw_write, sd_raw_read
*/
uint8_t sd_raw_write_interval(offset_t offset, uint8_t* buffer, uintptr_t length, sd_raw_write_interval_handler_t callback, void* p)
{
#if SD_RAW_SAVE_RAM
#error "SD_RAW_WRITE_SUPPORT is not supported together with SD_RAW_SAVE_RAM"
#endif
if(!buffer || !callback)
return 0;
uint8_t endless = (length == 0);
while(endless || length > 0)
{
uint16_t bytes_to_write = callback(buffer, offset, p);
if(!bytes_to_write)
break;
if(!endless && bytes_to_write > length)
return 0;
/* as writing is always buffered, we directly
* hand over the request to sd_raw_write()
*/
if(!sd_raw_write(offset, buffer, bytes_to_write))
return 0;
offset += bytes_to_write;
length -= bytes_to_write;
}
return 1;
}
#endif
#if DOXYGEN || SD_RAW_WRITE_SUPPORT
/**
* \ingroup sd_raw
* Writes the write buffer's content to the card.
*
* \note When write buffering is enabled, you should
* call this function before disconnecting the
* card to ensure all remaining data has been
* written.
*
* \returns 0 on failure, 1 on success.
* \see sd_raw_write
*/
uint8_t sd_raw_sync()
{
#if SD_RAW_WRITE_BUFFERING
if(raw_block_written)
return 1;
if(!sd_raw_write(raw_block_address, raw_block, sizeof(raw_block)))
return 0;
raw_block_written = 1;
#endif
return 1;
}
#endif
/**
* \ingroup sd_raw
* Reads informational data from the card.
*
* This function reads and returns the card's registers
* containing manufacturing and status information.
*
* \note: The information retrieved by this function is
* not required in any way to operate on the card,
* but it might be nice to display some of the data
* to the user.
*
* \param[in] info A pointer to the structure into which to save the information.
* \returns 0 on failure, 1 on success.
*/
uint8_t sd_raw_get_info(struct sd_raw_info* info)
{
if(!info || !sd_raw_available())
return 0;
memset(info, 0, sizeof(*info));
select_card();
/* read cid register */
if(sd_raw_send_command(CMD_SEND_CID, 0))
{
unselect_card();
return 0;
}
while(sd_raw_rec_byte() != 0xfe);
for(uint8_t i = 0; i < 18; ++i)
{
uint8_t b = sd_raw_rec_byte();
switch(i)
{
case 0:
info->manufacturer = b;
break;
case 1:
case 2:
info->oem[i - 1] = b;
break;
case 3:
case 4:
case 5:
case 6:
case 7:
info->product[i - 3] = b;
break;
case 8:
info->revision = b;
break;
case 9:
case 10:
case 11:
case 12:
info->serial |= (uint32_t) b << ((12 - i) * 8);
break;
case 13:
info->manufacturing_year = b << 4;
break;
case 14:
info->manufacturing_year |= b >> 4;
info->manufacturing_month = b & 0x0f;
break;
}
}
/* read csd register */
uint8_t csd_read_bl_len = 0;
uint8_t csd_c_size_mult = 0;
#if SD_RAW_SDHC
uint16_t csd_c_size = 0;
#else
uint32_t csd_c_size = 0;
#endif
uint8_t csd_structure = 0;
if(sd_raw_send_command(CMD_SEND_CSD, 0))
{
unselect_card();
return 0;
}
while(sd_raw_rec_byte() != 0xfe);
for(uint8_t i = 0; i < 18; ++i)
{
uint8_t b = sd_raw_rec_byte();
if(i == 0)
{
csd_structure = b >> 6;
}
else if(i == 14)
{
if(b & 0x40)
info->flag_copy = 1;
if(b & 0x20)
info->flag_write_protect = 1;
if(b & 0x10)
info->flag_write_protect_temp = 1;
info->format = (b & 0x0c) >> 2;
}
else
{
#if SD_RAW_SDHC
if(csd_structure == 0x01)
{
switch(i)
{
case 7:
b &= 0x3f;
case 8:
case 9:
csd_c_size <<= 8;
csd_c_size |= b;
break;
}
if(i == 9)
{
++csd_c_size;
info->capacity = (offset_t) csd_c_size * 512 * 1024;
}
}
else if(csd_structure == 0x00)
#endif
{
switch(i)
{
case 5:
csd_read_bl_len = b & 0x0f;
break;
case 6:
csd_c_size = b & 0x03;
csd_c_size <<= 8;
break;
case 7:
csd_c_size |= b;
csd_c_size <<= 2;
break;
case 8:
csd_c_size |= b >> 6;
++csd_c_size;
break;
case 9:
csd_c_size_mult = b & 0x03;
csd_c_size_mult <<= 1;
break;
case 10:
csd_c_size_mult |= b >> 7;
info->capacity = (uint32_t) csd_c_size << (csd_c_size_mult + csd_read_bl_len + 2);
break;
}
}
}
}
unselect_card();
return 1;
}

148
sd_reader/sd_raw.h Normal file
View File

@ -0,0 +1,148 @@
/*
* Copyright (c) 2006-2012 by Roland Riegel <feedback@roland-riegel.de>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of either the GNU General Public License version 2
* or the GNU Lesser General Public License version 2.1, both as
* published by the Free Software Foundation.
*/
#ifndef SD_RAW_H
#define SD_RAW_H
#include <stdint.h>
#include "sd_raw_config.h"
#ifdef __cplusplus
extern "C"
{
#endif
/**
* \addtogroup sd_raw
*
* @{
*/
/**
* \file
* MMC/SD/SDHC raw access header (license: GPLv2 or LGPLv2.1)
*
* \author Roland Riegel
*/
/**
* The card's layout is harddisk-like, which means it contains
* a master boot record with a partition table.
*/
#define SD_RAW_FORMAT_HARDDISK 0
/**
* The card contains a single filesystem and no partition table.
*/
#define SD_RAW_FORMAT_SUPERFLOPPY 1
/**
* The card's layout follows the Universal File Format.
*/
#define SD_RAW_FORMAT_UNIVERSAL 2
/**
* The card's layout is unknown.
*/
#define SD_RAW_FORMAT_UNKNOWN 3
/**
* This struct is used by sd_raw_get_info() to return
* manufacturing and status information of the card.
*/
struct sd_raw_info
{
/**
* A manufacturer code globally assigned by the SD card organization.
*/
uint8_t manufacturer;
/**
* A string describing the card's OEM or content, globally assigned by the SD card organization.
*/
uint8_t oem[3];
/**
* A product name.
*/
uint8_t product[6];
/**
* The card's revision, coded in packed BCD.
*
* For example, the revision value \c 0x32 means "3.2".
*/
uint8_t revision;
/**
* A serial number assigned by the manufacturer.
*/
uint32_t serial;
/**
* The year of manufacturing.
*
* A value of zero means year 2000.
*/
uint8_t manufacturing_year;
/**
* The month of manufacturing.
*/
uint8_t manufacturing_month;
/**
* The card's total capacity in bytes.
*/
offset_t capacity;
/**
* Defines wether the card's content is original or copied.
*
* A value of \c 0 means original, \c 1 means copied.
*/
uint8_t flag_copy;
/**
* Defines wether the card's content is write-protected.
*
* \note This is an internal flag and does not represent the
* state of the card's mechanical write-protect switch.
*/
uint8_t flag_write_protect;
/**
* Defines wether the card's content is temporarily write-protected.
*
* \note This is an internal flag and does not represent the
* state of the card's mechanical write-protect switch.
*/
uint8_t flag_write_protect_temp;
/**
* The card's data layout.
*
* See the \c SD_RAW_FORMAT_* constants for details.
*
* \note This value is not guaranteed to match reality.
*/
uint8_t format;
};
typedef uint8_t (*sd_raw_read_interval_handler_t)(uint8_t* buffer, offset_t offset, void* p);
typedef uintptr_t (*sd_raw_write_interval_handler_t)(uint8_t* buffer, offset_t offset, void* p);
uint8_t sd_raw_init();
uint8_t sd_raw_available();
uint8_t sd_raw_locked();
uint8_t sd_raw_read(offset_t offset, uint8_t* buffer, uintptr_t length);
uint8_t sd_raw_read_interval(offset_t offset, uint8_t* buffer, uintptr_t interval, uintptr_t length, sd_raw_read_interval_handler_t callback, void* p);
uint8_t sd_raw_write(offset_t offset, const uint8_t* buffer, uintptr_t length);
uint8_t sd_raw_write_interval(offset_t offset, uint8_t* buffer, uintptr_t length, sd_raw_write_interval_handler_t callback, void* p);
uint8_t sd_raw_sync();
uint8_t sd_raw_get_info(struct sd_raw_info* info);
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif

BIN
sd_reader/sd_raw.o Normal file

Binary file not shown.

139
sd_reader/sd_raw_config.h Normal file
View File

@ -0,0 +1,139 @@
/*
* Copyright (c) 2006-2012 by Roland Riegel <feedback@roland-riegel.de>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of either the GNU General Public License version 2
* or the GNU Lesser General Public License version 2.1, both as
* published by the Free Software Foundation.
*/
#ifndef SD_RAW_CONFIG_H
#define SD_RAW_CONFIG_H
#include <stdint.h>
#ifdef __cplusplus
extern "C"
{
#endif
/**
* \addtogroup sd_raw
*
* @{
*/
/**
* \file
* MMC/SD support configuration (license: GPLv2 or LGPLv2.1)
*/
/**
* \ingroup sd_raw_config
* Controls MMC/SD write support.
*
* Set to 1 to enable MMC/SD write support, set to 0 to disable it.
*/
#define SD_RAW_WRITE_SUPPORT 0
/**
* \ingroup sd_raw_config
* Controls MMC/SD write buffering.
*
* Set to 1 to buffer write accesses, set to 0 to disable it.
*
* \note This option has no effect when SD_RAW_WRITE_SUPPORT is 0.
*/
#define SD_RAW_WRITE_BUFFERING 1
/**
* \ingroup sd_raw_config
* Controls MMC/SD access buffering.
*
* Set to 1 to save static RAM, but be aware that you will
* lose performance.
*
* \note When SD_RAW_WRITE_SUPPORT is 1, SD_RAW_SAVE_RAM will
* be reset to 0.
*/
#define SD_RAW_SAVE_RAM 1
/**
* \ingroup sd_raw_config
* Controls support for SDHC cards.
*
* Set to 1 to support so-called SDHC memory cards, i.e. SD
* cards with more than 2 gigabytes of memory.
*/
#define SD_RAW_SDHC 1
/**
* @}
*/
/* defines for customisation of sd/mmc port access */
#if defined(__AVR_ATmega8__) || \
defined(__AVR_ATmega48__) || \
defined(__AVR_ATmega48P__) || \
defined(__AVR_ATmega88__) || \
defined(__AVR_ATmega88P__) || \
defined(__AVR_ATmega168__) || \
defined(__AVR_ATmega168P__) || \
defined(__AVR_ATmega328P__)
#define configure_pin_mosi() DDRB |= (1 << DDB3)
#define configure_pin_sck() DDRB |= (1 << DDB5)
#define configure_pin_ss() DDRB |= (1 << DDB2)
#define configure_pin_miso() DDRB &= ~(1 << DDB4)
#define select_card() PORTB &= ~(1 << PORTB2)
#define unselect_card() PORTB |= (1 << PORTB2)
#elif defined(__AVR_ATmega16__) || \
defined(__AVR_ATmega32__)
#define configure_pin_mosi() DDRB |= (1 << DDB5)
#define configure_pin_sck() DDRB |= (1 << DDB7)
#define configure_pin_ss() DDRB |= (1 << DDB4)
#define configure_pin_miso() DDRB &= ~(1 << DDB6)
#define select_card() PORTB &= ~(1 << PORTB4)
#define unselect_card() PORTB |= (1 << PORTB4)
#elif defined(__AVR_ATmega64__) || \
defined(__AVR_ATmega128__) || \
defined(__AVR_ATmega169__)
#define configure_pin_mosi() DDRB |= (1 << DDB2)
#define configure_pin_sck() DDRB |= (1 << DDB1)
#define configure_pin_ss() DDRB |= (1 << DDB0)
#define configure_pin_miso() DDRB &= ~(1 << DDB3)
#define select_card() PORTB &= ~(1 << PORTB0)
#define unselect_card() PORTB |= (1 << PORTB0)
#else
#error "no sd/mmc pin mapping available!"
#endif
#define configure_pin_available() DDRC &= ~(1 << DDC4)
#define configure_pin_locked() DDRC &= ~(1 << DDC5)
#define get_pin_available() (PINC & (1 << PINC4))
#define get_pin_locked() (PINC & (1 << PINC5))
#if SD_RAW_SDHC
typedef uint64_t offset_t;
#else
typedef uint32_t offset_t;
#endif
/* configuration checks */
#if SD_RAW_WRITE_SUPPORT
#undef SD_RAW_SAVE_RAM
#define SD_RAW_SAVE_RAM 0
#else
#undef SD_RAW_WRITE_BUFFERING
#define SD_RAW_WRITE_BUFFERING 0
#endif
#ifdef __cplusplus
}
#endif
#endif

43
sd_reader/wav.h Normal file
View File

@ -0,0 +1,43 @@
#include <stdio.h>
#include <stdint.h>
#include <string.h>
/** @brief Struct to contain chunk header information
*/
typedef struct {
char ckID[4]; //! Chunk type
uint32_t cksize; //! Size of chunk in bytes
} ck_hdr_t;
/** @brief Struct to contain master WAV chunk info
*/
struct {
char WAVEID[4]; //! WAVE ID
} ck_master_t;
/** @brief Types of extension that a fmt type chunk can have
*/
typedef enum {
CK_FMT_STD = 0U,
CK_FMT_NOEXT,
CK_FMT_EXT,
} ck_fmt_ext_t;
/** @brief Struct to hold fmt chunk data
*/
struct {
struct {
uint16_t wFormatTag; //! Type of data format.
uint16_t nChannels; //! Number of channels
uint32_t nSamplesPerSec; //! Sample rate
uint32_t nAvgBytesPerSec; //! Data rate
uint16_t nBlockAlign; //! Block size in bytes for data
uint16_t wBitsPerSample; //! Bits per sample
uint16_t cbSize; //! Size of fmt type extension. Only valid if chunk size is 18 or 40.
uint16_t wValidBitsPerSample; //! Number of valid bits per sample. Only valid if chunk size is 40
uint32_t dwChannelMask; //! Speaker position mask. Only valid if chunk size is 40
uint8_t SubFormat[16]; //! GUID for data format. Only vaid if chunk size is 40
} data;
ck_fmt_ext_t type;
} ck_fmt_t;