OpenCores
URL https://opencores.org/ocsvn/ao486/ao486/trunk

Subversion Repositories ao486

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /ao486/trunk/syn
    from Rev 7 to Rev 8
    Reverse comparison

Rev 7 → Rev 8

/soc/firmware/exe/mem_init/hdl_sim/system_onchip_for_nios2.sym
0,0 → 1,92
w __errno
00010000 A __alt_mem_onchip_for_nios2
00010000 T __reset
0001000c T _exit
00010020 T _start
00010054 t alt_after_alt_main
00010058 T _Z10osd_enableb
00010078 T _Z9osd_printibPKcz
00010114 T _Z21read_byte_if_possiblev
00010134 T _Z8read_intv
0001019c T _Z5crc32PhPj
00010744 T _Z9show_menuhhb
0001094c T _Z20select_and_load_bioshjPKcS0_S0_S0_S0_
00010b1c T _Z22runtime_menu_no_floppyv
00010d24 T _Z19runtime_menu_floppyv
00010edc T _Z12runtime_menuv
00010f60 W _Z9read_bytev
00010f74 T main
00011c98 t _fpadd_parts
00011fec T __adddf3
00012040 T __subdf3
000120a0 T __muldf3
00012384 T __divdf3
00012538 T __floatsidf
0001260c T __fixdfsi
000126d0 t udivmodsi4
00012744 T __divsi3
00012794 T __modsi3
000127f0 T __udivsi3
000127f8 T __umodsi3
00012800 T __mulsi3
00012828 T __muldi3
00012938 T __clzsi2
000129e4 T __pack_d
00012c08 T __unpack_d
00012d0c T __lshrdi3
00012d50 T __ashldi3
00012d94 T memcpy
00012dbc T memset
00012ddc T _printf_r
00012e18 T printf
00012e64 T ___vfprintf_internal_r
00013598 T __vfprintf_internal
000135bc T _vsnprintf_r
00013678 T vsnprintf
000136b8 T __sfvwrite_small_dev
00013798 T __sfvwrite_small_str
0001386c T memmove
000138c8 T strlen
000138f0 T _write_r
0001395c T alt_main
00013988 T usleep
0001398c T write
000139ec T alt_irq_init
00013a0c T alt_sys_init
00013a10 T altera_avalon_jtag_uart_write
00013a44 T alt_busy_sleep
00013ac4 T altera_nios2_qsys_irq_init
00013cf4 R __thenan_df
00013d08 R __clz_tab
00013e08 g impure_data
00013ee8 G floppy_writeprotect
00013ee9 G floppy_is_1_44m
00013eec G hdd_index
00013ef0 G floppy_index
00013ef4 G _global_impure_ptr
00013ef8 G _impure_ptr
00013efc G jtag_uart
00013f00 G alt_errno
00013f04 A __bss_start
00013f04 A _edata
00013f04 B floppy_is_2_88m
00013f05 B floppy_is_1_2m
00013f06 B floppy_is_720k
00013f07 B floppy_is_360k
00013f08 B floppy_is_320k
00013f09 B floppy_is_180k
00013f0a B floppy_is_160k
00013f0c B errno
00013f10 B alt_envp
00013f14 B alt_argv
00013f18 B alt_argc
00013f1c B entries
00014f1c b _ZZ5crc32PhPjE3crc
00014f3c A __alt_stack_base
00014f3c A __bss_end
00014f3c A _end
00014f3c A end
00018000 A __alt_data_end
00018000 A __alt_stack_pointer
0001bee8 A _gp
08000000 A __alt_mem_sdram
/soc/firmware/exe/mem_init/hdl_sim/system_onchip_for_nios2.dat
0,0 → 1,4033
@0000 00400074
@0001 08400814
@0002 0800683A
@0003 00000000
@0004 00000000
@0005 00000000
@0006 00000000
@0007 00000000
@0008 06C00074
@0009 DEE00014
@000A 06800074
@000B D6AFBA14
@000C 00800074
@000D 108FC114
@000E 00C00074
@000F 18D3CF14
@0010 10C00326
@0011 10000015
@0012 10800104
@0013 10FFFD36
@0014 001395C0
@0015 003FFF06
@0016 21003FCC
@0017 20000226
@0018 00B00014
@0019 00000106
@001A 00A00014
@001B 00E80014
@001C 18800035
@001D F800283A
@001E DEFFEB04
@001F DC401115
@0020 2023883A
@0021 DFC01315
@0022 DC801215
@0023 DC001015
@0024 D9C01415
@0025 3025883A
@0026 2821883A
@0027 D809883A
@0028 000B883A
@0029 01801004
@002A 0012DBC0
@002B D809883A
@002C 01401004
@002D 900D883A
@002E D9C01404
@002F 84003FCC
@0030 00136780
@0031 8020C03A
@0032 0007883A
@0033 8C4A0004
@0034 8020923A
@0035 00000806
@0036 D8C9883A
@0037 21000007
@0038 88CD883A
@0039 318D883A
@003A 318D883A
@003B 8108B03A
@003C 31000035
@003D 18C00044
@003E 18BFF716
@003F DFC01317
@0040 DC801217
@0041 DC401117
@0042 DC001017
@0043 DEC01504
@0044 F800283A
@0045 00A22214
@0046 10800037
@0047 10E0000C
@0048 18000226
@0049 10803FCC
@004A F800283A
@004B 00BFFFC4
@004C F800283A
@004D DEFFFC04
@004E DFC00315
@004F DC800215
@0050 DC400115
@0051 DC000015
@0052 0010F600
@0053 1023883A
@0054 0010F600
@0055 1025883A
@0056 0010F600
@0057 10803FCC
@0058 1020943A
@0059 94803FCC
@005A 0010F600
@005B 9024923A
@005C 1004963A
@005D 8C403FCC
@005E 84A0B03A
@005F 1444B03A
@0060 1404B03A
@0061 DFC00317
@0062 DC800217
@0063 DC400117
@0064 DC000017
@0065 DEC00404
@0066 F800283A
@0067 DEFFD304
@0068 DF002C15
@0069 DDC02B15
@006A DD802A15
@006B DD402915
@006C DD002815
@006D DCC02715
@006E DC802615
@006F DC402515
@0070 DC002415
@0071 20000226
@0072 2801531E
@0073 00000B06
@0074 01000074
@0075 2113C704
@0076 2801411E
@0077 0005883A
@0078 01800044
@0079 00C00804
@007A 208B883A
@007B 29800005
@007C 10800044
@007D 10FFFC1E
@007E 00014706
@007F 21800003
@0080 0005883A
@0081 00C00204
@0082 308BD83A
@0083 D889883A
@0084 10800044
@0085 2940004C
@0086 21400005
@0087 10FFFA1E
@0088 00800074
@0089 1093C704
@008A DBC00083
@008B 10C005C3
@008C 13400743
@008D DA0000C3
@008E 1BC6F03A
@008F DC800003
@0090 1B46F03A
@0091 12C007C3
@0092 DB000103
@0093 D8C01415
@0094 10C00583
@0095 14400703
@0096 4488F03A
@0097 20C6F03A
@0098 62C8F03A
@0099 D9000215
@009A D9400217
@009B 1C46F03A
@009C 11000543
@009D 138006C3
@009E 1AC6F03A
@009F DCC00043
@00A0 D8C01515
@00A1 10C00783
@00A2 2908F03A
@00A3 2388F03A
@00A4 9CA0F03A
@00A5 20C8F03A
@00A6 2408F03A
@00A7 DA400143
@00A8 9BD4F03A
@00A9 D9001615
@00AA 11000503
@00AB DA800415
@00AC 12800683
@00AD DD000417
@00AE 2248F03A
@00AF 2288F03A
@00B0 1B6CF03A
@00B1 2508F03A
@00B2 8B78F03A
@00B3 2588F03A
@00B4 D9001715
@00B5 E2C8F03A
@00B6 D9C00183
@00B7 D9000615
@00B8 110004C3
@00B9 11800643
@00BA 93EAF03A
@00BB D9400617
@00BC 21C8F03A
@00BD AA2EF03A
@00BE 2188F03A
@00BF 25C8F03A
@00C0 2148F03A
@00C1 D9001815
@00C2 9A08F03A
@00C3 7468F03A
@00C4 2308F03A
@00C5 DD400815
@00C6 DDC00315
@00C7 DF000515
@00C8 D9000915
@00C9 A0EAF03A
@00CA D94001C3
@00CB DD000A15
@00CC 15000483
@00CD 11000603
@00CE DDC00917
@00CF A168F03A
@00D0 A128F03A
@00D1 A5E8F03A
@00D2 A568F03A
@00D3 DD400B15
@00D4 732AF03A
@00D5 DD001915
@00D6 AA68F03A
@00D7 A2A8F03A
@00D8 DD000C15
@00D9 DF000C17
@00DA 15000443
@00DB 5CAEF03A
@00DC BA6EF03A
@00DD E528F03A
@00DE DD001A15
@00DF BAAEF03A
@00E0 15000403
@00E1 B9EEF03A
@00E2 B9AEF03A
@00E3 BD28F03A
@00E4 1CE6F03A
@00E5 31EEF03A
@00E6 DCC00D15
@00E7 B966F03A
@00E8 9926F03A
@00E9 DCC00715
@00EA DD001B15
@00EB 14C003C3
@00EC DD000717
@00ED DF000D17
@00EE 64A4F03A
@00EF A4E6F03A
@00F0 15000383
@00F1 9F26F03A
@00F2 DCC01C15
@00F3 2166F03A
@00F4 9D28F03A
@00F5 DD001D15
@00F6 6BE8F03A
@00F7 DD000E15
@00F8 DF000E17
@00F9 15000343
@00FA DC800F15
@00FB 72E4F03A
@00FC E528F03A
@00FD 17000303
@00FE DD001E15
@00FF 8A28F03A
@0100 A738F03A
@0101 DF001F15
@0102 DF000F17
@0103 DC801015
@0104 E4B8F03A
@0105 148002C3
@0106 E4A4F03A
@0107 DC802015
@0108 8264F03A
@0109 1AF8F03A
@010A DC801115
@010B DF001215
@010C E2A4F03A
@010D DF001117
@010E DC801315
@010F 5B56F03A
@0110 E4B8F03A
@0111 14800283
@0112 435AF03A
@0113 6C62F03A
@0114 E4A4F03A
@0115 DC802115
@0116 14800243
@0117 DF000517
@0118 88E2F03A
@0119 BCA4F03A
@011A DDC00417
@011B 8A62F03A
@011C 8AA2F03A
@011D 95E4F03A
@011E 95A4F03A
@011F DC802215
@0120 14800203
@0121 43ECF03A
@0122 89E2F03A
@0123 9CA4F03A
@0124 9724F03A
@0125 95A4F03A
@0126 DC802315
@0127 DC800617
@0128 DF000217
@0129 5B16F03A
@012A ACAEF03A
@012B DD400317
@012C 148001C3
@012D 13400103
@012E 89A2F03A
@012F ACA4F03A
@0130 95E4F03A
@0131 E3AAF03A
@0132 DC800315
@0133 A8EAF03A
@0134 14800183
@0135 AA6AF03A
@0136 AAAAF03A
@0137 ACA4F03A
@0138 9424F03A
@0139 9524F03A
@013A 5B9CF03A
@013B 8962F03A
@013C 48D6F03A
@013D 8922F03A
@013E DC800215
@013F 5A96F03A
@0140 14800143
@0141 8B5AF03A
@0142 59D6F03A
@0143 DC400417
@0144 5996F03A
@0145 83DEF03A
@0146 5CA4F03A
@0147 6C78F03A
@0148 93E4F03A
@0149 DC400C17
@014A 93AAF03A
@014B DC800A17
@014C 8968F03A
@014D 219AF03A
@014E 14400083
@014F 6C9AF03A
@0150 DC800E17
@0151 A128F03A
@0152 5252F03A
@0153 A462F03A
@0154 12800043
@0155 8CA2F03A
@0156 DD000517
@0157 49E4F03A
@0158 6218F03A
@0159 91A4F03A
@015A 9294F03A
@015B 61D8F03A
@015C 5514F03A
@015D 6158F03A
@015E 6358F03A
@015F 55ACF03A
@0160 134000C3
@0161 12800003
@0162 DD001217
@0163 635AF03A
@0164 6298F03A
@0165 DA800717
@0166 7A1EF03A
@0167 DA000D17
@0168 5420F03A
@0169 8520F03A
@016A 14000045
@016B DC001117
@016C DD001317
@016D 9A26F03A
@016E 5410F03A
@016F 4510F03A
@0170 14C00005
@0171 12000085
@0172 DA000F17
@0173 DA801017
@0174 38C6F03A
@0175 9224F03A
@0176 1986F03A
@0177 92A4F03A
@0178 DC000917
@0179 1946F03A
@017A 4952F03A
@017B 148000C5
@017C 1906F03A
@017D DC800B17
@017E 4912F03A
@017F 1BC6F03A
@0180 4C10F03A
@0181 1DC6F03A
@0182 DD000617
@0183 DDC00817
@0184 4490F03A
@0185 D9002317
@0186 D9402217
@0187 DA802017
@0188 12000105
@0189 10C00145
@018A DA002117
@018B D8C00317
@018C 14400285
@018D 17000305
@018E DC001F17
@018F DF000217
@0190 DC401E17
@0191 5D16F03A
@0192 4DD2F03A
@0193 DC801D17
@0194 5BDEF03A
@0195 4B9CF03A
@0196 15400345
@0197 17000385
@0198 10C003C5
@0199 11000405
@019A 11400445
@019B 12000485
@019C 128004C5
@019D 13C00185
@019E 138001C5
@019F 13000205
@01A0 15800245
@01A1 134002C5
@01A2 14000505
@01A3 14400545
@01A4 14800585
@01A5 DD001C17
@01A6 DD401B17
@01A7 DDC01A17
@01A8 DF001917
@01A9 D8C01817
@01AA D9001717
@01AB D9401617
@01AC DA001517
@01AD DA801417
@01AE 150005C5
@01AF 15400605
@01B0 15C00645
@01B1 17000685
@01B2 10C006C5
@01B3 11000705
@01B4 11400745
@01B5 12000785
@01B6 128007C5
@01B7 00000E06
@01B8 28000015
@01B9 0007883A
@01BA 0005883A
@01BB 024007C4
@01BC 01800804
@01BD 208F883A
@01BE 3A000003
@01BF 488FC83A
@01C0 10800044
@01C1 41CE983A
@01C2 19C6B03A
@01C3 11BFF91E
@01C4 00C6303A
@01C5 28C00015
@01C6 DF002C17
@01C7 DDC02B17
@01C8 DD802A17
@01C9 DD402917
@01CA DD002817
@01CB DCC02717
@01CC DC802617
@01CD DC402517
@01CE DC002417
@01CF DEC02D04
@01D0 F800283A
@01D1 DEFFF504
@01D2 DD800715
@01D3 DC400215
@01D4 302D883A
@01D5 DFC00A15
@01D6 DF000915
@01D7 DDC00815
@01D8 DD400615
@01D9 DD000515
@01DA DCC00415
@01DB DC800315
@01DC DC000115
@01DD 0023883A
@01DE 00C00074
@01DF 18CFC704
@01E0 29803FCC
@01E1 00802004
@01E2 880E917A
@01E3 05400074
@01E4 AD4FC704
@01E5 38CF883A
@01E6 39C00003
@01E7 390E703A
@01E8 31C00326
@01E9 8C400044
@01EA 88BFF71E
@01EB 00004D06
@01EC 00801FC4
@01ED 29403FCC
@01EE 00FFFFC4
@01EF 100C917A
@01F0 A98D883A
@01F1 31800003
@01F2 310C703A
@01F3 29800226
@01F4 10BFFFC4
@01F5 10FFF91E
@01F6 146FC83A
@01F7 05000044
@01F8 0021883A
@01F9 84FFFEC4
@01FA 04801004
@01FB 07004004
@01FC 98000116
@01FD BCC0060E
@01FE 9009883A
@01FF 000B883A
@0200 01800074
@0201 318EB304
@0202 00100780
@0203 00001106
@0204 9C05003A
@0205 100B883A
@0206 9009883A
@0207 01800074
@0208 318EB304
@0209 D8800015
@020A 00100780
@020B 9C4F883A
@020C 380E917A
@020D D8800017
@020E 9009883A
@020F A9CF883A
@0210 100B883A
@0211 01800074
@0212 318EB804
@0213 39C00044
@0214 00100780
@0215 94800404
@0216 9CC00044
@0217 973FE41E
@0218 04800044
@0219 00A22414
@021A 10C00037
@021B 1900004C
@021C 20002526
@021D 1900008C
@021E 20002126
@021F 1900010C
@0220 20000426
@0221 18C0020C
@0222 18002126
@0223 0025883A
@0224 003FF506
@0225 8C05883A
@0226 00002006
@0227 843FFFC4
@0228 00000106
@0229 84000044
@022A A0803FCC
@022B 10000626
@022C 90803FCC
@022D 10000426
@022E 010000B4
@022F 2121A804
@0230 00139880
@0231 003FC706
@0232 01000174
@0233 2124F804
@0234 00139880
@0235 9029883A
@0236 003FC206
@0237 00BF8304
@0238 00000E06
@0239 01002404
@023A 01400044
@023B 01800074
@023C 318EB904
@023D 00100780
@023E 00BFFFC4
@023F 00000706
@0240 803FE61E
@0241 003FE806
@0242 85FFE616
@0243 003FE606
@0244 B0803FCC
@0245 103FE426
@0246 003FF006
@0247 DFC00A17
@0248 DF000917
@0249 DDC00817
@024A DD800717
@024B DD400617
@024C DD000517
@024D DCC00417
@024E DC800317
@024F DC400217
@0250 DC000117
@0251 DEC00B04
@0252 F800283A
@0253 DEFBF504
@0254 DD040515
@0255 DC440215
@0256 2829883A
@0257 2023883A
@0258 000B883A
@0259 01000C04
@025A DC040115
@025B DFC40A15
@025C DF040915
@025D DDC40815
@025E DD840715
@025F DD440615
@0260 DCC40415
@0261 DC840315
@0262 3821883A
@0263 00100780
@0264 01003FC4
@0265 89403FCC
@0266 000D883A
@0267 00107440
@0268 10005216
@0269 00E83014
@026A 01290014
@026B 18000035
@026C 18C00104
@026D 193FFD1E
@026E A028913A
@026F 800D883A
@0270 000B883A
@0271 A009883A
@0272 D8840015
@0273 00100780
@0274 D8840017
@0275 00C00074
@0276 18CFC704
@0277 05C00104
@0278 1004917A
@0279 05400204
@027A 05800084
@027B 1885883A
@027C 11400643
@027D 11000683
@027E 10C00604
@027F 148006C3
@0280 19800003
@0281 280A923A
@0282 2008943A
@0283 9024963A
@0284 298AB03A
@0285 2148B03A
@0286 11400543
@0287 9124B03A
@0288 11000583
@0289 10C00504
@028A 140005C3
@028B 19800003
@028C 280A923A
@028D 2008943A
@028E 8020963A
@028F 298AB03A
@0290 10800404
@0291 2148B03A
@0292 8120B03A
@0293 11000043
@0294 10C00083
@0295 14C000C3
@0296 11400003
@0297 2008923A
@0298 1806943A
@0299 9826963A
@029A 2148B03A
@029B 1906B03A
@029C 98E6B03A
@029D 07000304
@029E 00001606
@029F 0005883A
@02A0 16C00035
@02A1 BCC00035
@02A2 AD400035
@02A3 E5800035
@02A4 0023883A
@02A5 010000B4
@02A6 2121A804
@02A7 00139880
@02A8 88800037
@02A9 15BFFB1E
@02AA 00840004
@02AB 8023883A
@02AC 1400012E
@02AD 1023883A
@02AE 9009883A
@02AF D80B883A
@02B0 880D883A
@02B1 0012D940
@02B2 9465883A
@02B3 8461C83A
@02B4 9CC00204
@02B5 803FE91E
@02B6 D9840D17
@02B7 A009883A
@02B8 000B883A
@02B9 00100780
@02BA 0005883A
@02BB DFC40A17
@02BC DF040917
@02BD DDC40817
@02BE DD840717
@02BF DD440617
@02C0 DD040517
@02C1 DCC40417
@02C2 DC840317
@02C3 DC440217
@02C4 DC040117
@02C5 DEC40B04
@02C6 F800283A
@02C7 DEFFFC04
@02C8 01000404
@02C9 000B883A
@02CA 01800074
@02CB 318EBE04
@02CC DFC00315
@02CD DC800215
@02CE DC400115
@02CF DC000015
@02D0 00100780
@02D1 01002404
@02D2 000B883A
@02D3 01800074
@02D4 318EC104
@02D5 00100780
@02D6 00A89014
@02D7 00E8A014
@02D8 11000037
@02D9 21003FCC
@02DA 21004014
@02DB 11000035
@02DC 10800104
@02DD 10FFFA1E
@02DE 04400044
@02DF 04A22414
@02E0 04000044
@02E1 90800037
@02E2 00E22414
@02E3 1100004C
@02E4 20005B26
@02E5 1100008C
@02E6 20005926
@02E7 1100010C
@02E8 20000426
@02E9 1080020C
@02EA 0021883A
@02EB 10005726
@02EC 003FF406
@02ED 008003C4
@02EE 19000037
@02EF 210003CC
@02F0 20BFFD1E
@02F1 04000044
@02F2 01003C04
@02F3 01400404
@02F4 800D883A
@02F5 00107440
@02F6 00FF8304
@02F7 10C04B26
@02F8 1000080E
@02F9 010007F4
@02FA 21212004
@02FB DFC00317
@02FC DC800217
@02FD DC400117
@02FE DC000017
@02FF DEC00404
@0300 00139881
@0301 D0A00215
@0302 1004917A
@0303 00C00074
@0304 18CFCB04
@0305 D4200005
@0306 10C5883A
@0307 11400043
@0308 10C00083
@0309 110000C3
@030A 11800003
@030B 280A923A
@030C 1806943A
@030D 2008963A
@030E D0A00883
@030F 298AB03A
@0310 1946B03A
@0311 20C8B03A
@0312 1000121E
@0313 D0A00843
@0314 1000101E
@0315 D0A00803
@0316 10000E1E
@0317 D0A007C3
@0318 10000C1E
@0319 D0A00783
@031A 1000081E
@031B D0A00743
@031C 1000081E
@031D D0A00043
@031E 1000081E
@031F D0A00703
@0320 10000826
@0321 00801004
@0322 00000706
@0323 00803004
@0324 00000506
@0325 0005883A
@0326 00000306
@0327 00802004
@0328 00000106
@0329 00800804
@032A 00E20014
@032B 01400044
@032C 19400035
@032D D1600003
@032E 00E20114
@032F 19400035
@0330 00E20614
@0331 19000035
@0332 00E20C14
@0333 18800035
@0334 00000E06
@0335 80803FCC
@0336 10000426
@0337 010000B4
@0338 2121A804
@0339 00139880
@033A 003FA506
@033B 01000174
@033C 2124F804
@033D 00139880
@033E 8023883A
@033F 003FA006
@0340 88803FCC
@0341 103FF31E
@0342 003FF806
@0343 DFC00317
@0344 DC800217
@0345 DC400117
@0346 DC000017
@0347 DEC00404
@0348 F800283A
@0349 DEFFFB04
@034A 01000404
@034B 000B883A
@034C 01800074
@034D 318ECE04
@034E DCC00315
@034F DC000015
@0350 DFC00415
@0351 DC800215
@0352 DC400115
@0353 04C00044
@0354 00100780
@0355 04000244
@0356 00A82014
@0357 00E90014
@0358 10000035
@0359 10800104
@035A 10FFFD1E
@035B 8008913A
@035C 000B883A
@035D 01800074
@035E 318ED204
@035F 00100780
@0360 D0A00003
@0361 84400044
@0362 8808913A
@0363 10000326
@0364 01800074
@0365 318EC504
@0366 00000206
@0367 01800074
@0368 318EC904
@0369 000B883A
@036A 00100780
@036B 00A89014
@036C 00E8A014
@036D 11000037
@036E 21003FCC
@036F 21004014
@0370 11000035
@0371 10800104
@0372 10FFFA1E
@0373 04800044
@0374 00E22414
@0375 18800037
@0376 1100004C
@0377 20003526
@0378 1100008C
@0379 20003026
@037A 1100010C
@037B 20000426
@037C 1080020C
@037D 0025883A
@037E 10003126
@037F 003FF506
@0380 00800244
@0381 80800D1E
@0382 00BFFFC4
@0383 D0A00215
@0384 00800044
@0385 D0A00005
@0386 00A20014
@0387 10000035
@0388 00A20114
@0389 00C00044
@038A 10C00035
@038B 00A20C14
@038C 00C00804
@038D 10C00035
@038E 00002106
@038F 00800204
@0390 80801F1E
@0391 D0A00003
@0392 00E20114
@0393 1080005C
@0394 D0A00005
@0395 10803FCC
@0396 18800035
@0397 00001806
@0398 8023883A
@0399 00000E06
@039A 04000204
@039B 98803FCC
@039C 10000626
@039D 90803FCC
@039E 10000426
@039F 010000B4
@03A0 2121A804
@03A1 00139880
@03A2 003FB306
@03A3 01000174
@03A4 2124F804
@03A5 00139880
@03A6 9027883A
@03A7 003FAE06
@03A8 8821883A
@03A9 003FF106
@03AA 00800204
@03AB 80BFEC1E
@03AC 003FFB06
@03AD 00800244
@03AE 80BFEC1E
@03AF 003FEA06
@03B0 DFC00417
@03B1 DCC00317
@03B2 DC800217
@03B3 DC400117
@03B4 DC000017
@03B5 DEC00504
@03B6 F800283A
@03B7 DEFFFE04
@03B8 DFC00115
@03B9 DC000015
@03BA 00A81014
@03BB 00E90014
@03BC 10000035
@03BD 10800104
@03BE 10FFFD1E
@03BF 00A80014
@03C0 00F00014
@03C1 10C00035
@03C2 01222414
@03C3 008003C4
@03C4 20C00037
@03C5 04222414
@03C6 18C003CC
@03C7 18BFFC1E
@03C8 D0A00217
@03C9 1000020E
@03CA 0010B1C0
@03CB 00000106
@03CC 0010D240
@03CD 00A80014
@03CE 00E00014
@03CF 10C00035
@03D0 008003C4
@03D1 80C00037
@03D2 18C003CC
@03D3 18BFFD1E
@03D4 DFC00117
@03D5 DC000017
@03D6 DEC00204
@03D7 F800283A
@03D8 01222214
@03D9 20800037
@03DA 10E0000C
@03DB 183FFD26
@03DC F800283A
@03DD DEFE7304
@03DE DFC18C15
@03DF DD818B15
@03E0 DD418A15
@03E1 DD018915
@03E2 DCC18815
@03E3 DC818715
@03E4 DC418615
@03E5 DC018515
@03E6 00A22814
@03E7 00C04034
@03E8 18FC3A84
@03E9 10C00035
@03EA 00A22914
@03EB 00C03C04
@03EC 10C00035
@03ED 00A21814
@03EE 00C00044
@03EF 10C00035
@03F0 04280014
@03F1 00A00014
@03F2 80800035
@03F3 010003F4
@03F4 21109004
@03F5 00139880
@03F6 8005883A
@03F7 8007883A
@03F8 01290014
@03F9 10000035
@03FA 10800104
@03FB 113FFD1E
@03FC 00B00014
@03FD 18800035
@03FE 0009883A
@03FF 000B883A
@0400 01800074
@0401 318ED604
@0402 00100780
@0403 01000404
@0404 000B883A
@0405 01800074
@0406 318EDB04
@0407 00100780
@0408 000B883A
@0409 01800074
@040A 318EE004
@040B 01000804
@040C 00100780
@040D 010003F4
@040E 21109004
@040F 00139880
@0410 0005883A
@0411 14000037
@0412 04800084
@0413 04400304
@0414 00001406
@0415 01400044
@0416 01800074
@0417 318EE504
@0418 800F883A
@0419 00100780
@041A 00000406
@041B 010003F4
@041C 21109004
@041D 00139880
@041E 84000037
@041F 803FFB26
@0420 00800044
@0421 8080071E
@0422 8C000035
@0423 88000035
@0424 010003F4
@0425 21109004
@0426 00139880
@0427 0005883A
@0428 14000037
@0429 01000404
@042A 84BFEA1E
@042B 000B883A
@042C 01800074
@042D 318EEA04
@042E 00100780
@042F 04C00074
@0430 9CCFC704
@0431 0005883A
@0432 14C00035
@0433 00800104
@0434 10000035
@0435 00800204
@0436 10800035
@0437 00800304
@0438 14000035
@0439 0023883A
@043A 04000084
@043B 010000B4
@043C 2121A804
@043D 00139880
@043E 88800037
@043F 143FFB1E
@0440 0005883A
@0441 01001FC4
@0442 00C02004
@0443 1022917A
@0444 9C4B883A
@0445 29400003
@0446 2900221E
@0447 0009883A
@0448 000B883A
@0449 001019C0
@044A 0021883A
@044B 00000406
@044C 9C09883A
@044D 000B883A
@044E 001019C0
@044F 84000044
@0450 847FFB1E
@0451 9C21883A
@0452 0009883A
@0453 D9418304
@0454 84000404
@0455 D8018315
@0456 001019C0
@0457 81000043
@0458 80C00083
@0459 808000C3
@045A 81400003
@045B 2008923A
@045C 1806943A
@045D 1004963A
@045E 2148B03A
@045F 1906B03A
@0460 10C4B03A
@0461 D8C18317
@0462 18800926
@0463 01000804
@0464 01400044
@0465 01800074
@0466 318EEF04
@0467 00100780
@0468 0002B206
@0469 10800044
@046A 10FFD81E
@046B 003FF706
@046C 01000804
@046D 000B883A
@046E 01800074
@046F 318EF404
@0470 00100780
@0471 00A81014
@0472 00E90014
@0473 10000035
@0474 10800104
@0475 10FFFD1E
@0476 00800074
@0477 108F0304
@0478 D8800015
@0479 00800074
@047A 108F0804
@047B D8800115
@047C 01000044
@047D 00800074
@047E 108F0D04
@047F D8800215
@0480 200B883A
@0481 01800074
@0482 318EF904
@0483 01C00074
@0484 39CEFE04
@0485 001094C0
@0486 10029416
@0487 00A82014
@0488 00E90014
@0489 10000035
@048A 10800104
@048B 10FFFD1E
@048C 00800074
@048D 108F1C04
@048E D8800015
@048F 00800074
@0490 108F2104
@0491 D8800115
@0492 01000084
@0493 00800074
@0494 108F2604
@0495 D8800215
@0496 200B883A
@0497 01800074
@0498 318F1204
@0499 01C00074
@049A 39CF1704
@049B 001094C0
@049C 10027E16
@049D 00A81014
@049E 00E90014
@049F 10000035
@04A0 10800104
@04A1 10FFFD1E
@04A2 01003FC4
@04A3 014000C4
@04A4 000D883A
@04A5 00107440
@04A6 10027416
@04A7 D0A00115
@04A8 00E00014
@04A9 00A80014
@04AA 10C00035
@04AB 0021883A
@04AC 04404004
@04AD 80890004
@04AE 8009883A
@04AF 1085883A
@04B0 10A5883A
@04B1 00125380
@04B2 0009883A
@04B3 01501C34
@04B4 100D883A
@04B5 180F883A
@04B6 00120400
@04B7 0009883A
@04B8 01504BF4
@04B9 29612004
@04BA 100D883A
@04BB 180F883A
@04BC 00123840
@04BD 1009883A
@04BE 180B883A
@04BF 01AAAAF4
@04C0 31AAAAC4
@04C1 01D01074
@04C2 39EAAA84
@04C3 00120A00
@04C4 100D883A
@04C5 180F883A
@04C6 0009883A
@04C7 015073B4
@04C8 29735944
@04C9 00123840
@04CA 1009883A
@04CB 180B883A
@04CC 001260C0
@04CD 90800035
@04CE 84000044
@04CF 847FDD1E
@04D0 00A50014
@04D1 00C25804
@04D2 10C00035
@04D3 00A50114
@04D4 00C04E04
@04D5 10C00035
@04D6 00A22014
@04D7 00C00644
@04D8 10C00035
@04D9 D4200703
@04DA 80803FCC
@04DB 10000226
@04DC 05401404
@04DD 00000706
@04DE D0A00043
@04DF 103FFC1E
@04E0 D0A00743
@04E1 103FFA1E
@04E2 D0A00783
@04E3 103FF81E
@04E4 05400A04
@04E5 D5A00883
@04E6 B0803FCC
@04E7 10001D1E
@04E8 D0A00843
@04E9 10001E1E
@04EA D0A00803
@04EB 10C03FCC
@04EC 1802161E
@04ED D0E007C3
@04EE 1802161E
@04EF D0E00783
@04F0 1802141E
@04F1 D0E00743
@04F2 1802141E
@04F3 D0E00043
@04F4 1802141E
@04F5 80C03FCC
@04F6 18021426
@04F7 04400904
@04F8 00021306
@04F9 D0A007C3
@04FA 1002151E
@04FB D0A00783
@04FC 1002151E
@04FD D0A00743
@04FE 1002151E
@04FF D0A00043
@0500 1002151E
@0501 80803FCC
@0502 10021526
@0503 0485A004
@0504 00021406
@0505 04805004
@0506 04400204
@0507 00000206
@0508 04805A04
@0509 04400244
@050A 05000044
@050B 0102FB34
@050C 21308004
@050D 880B883A
@050E 00127440
@050F D0E00217
@0510 18001216
@0511 B5803FCC
@0512 B001E31E
@0513 D0E00843
@0514 1801E11E
@0515 D0E00803
@0516 1801DF1E
@0517 D0E007C3
@0518 1801DD1E
@0519 D0E00783
@051A 1801D91E
@051B D0E00743
@051C 1801D91E
@051D D0E00043
@051E 1801D91E
@051F 84003FCC
@0520 8001D926
@0521 04001004
@0522 0001D806
@0523 04000804
@0524 0007883A
@0525 01220014
@0526 20C00035
@0527 D1200003
@0528 00E20114
@0529 19000035
@052A 00E20214
@052B 1D400035
@052C 00E20314
@052D 1C400035
@052E 00E20414
@052F 1C800035
@0530 00E20514
@0531 1D000035
@0532 00E20614
@0533 18000035
@0534 1009883A
@0535 00125380
@0536 01AAAAF4
@0537 31AAAAC4
@0538 01D01074
@0539 39EAAA84
@053A 1009883A
@053B 180B883A
@053C 00123840
@053D 180B883A
@053E 1009883A
@053F 001260C0
@0540 00E20714
@0541 18800035
@0542 00A20814
@0543 00DD4BC4
@0544 10C00035
@0545 00A20914
@0546 00F0D3D4
@0547 10C00035
@0548 00A20A14
@0549 00FA97D4
@054A 10C00035
@054B 00A20B14
@054C 00CEA5C4
@054D 10C00035
@054E 00A20C14
@054F 14000035
@0550 D0A00117
@0551 1004917A
@0552 98A7883A
@0553 99000543
@0554 98C00583
@0555 98800504
@0556 9C0005C3
@0557 11400003
@0558 2008923A
@0559 1806943A
@055A 8020963A
@055B 2148B03A
@055C 1906B03A
@055D 99000643
@055E 80E0B03A
@055F 98C00683
@0560 98800604
@0561 9C8006C3
@0562 11400003
@0563 2008923A
@0564 1806943A
@0565 9024963A
@0566 2148B03A
@0567 1906B03A
@0568 99000743
@0569 90E4B03A
@056A 98C00783
@056B 98800704
@056C 9C4007C3
@056D 11400003
@056E 2008923A
@056F 1806943A
@0570 8822963A
@0571 2148B03A
@0572 1906B03A
@0573 99000443
@0574 88E2B03A
@0575 98C00483
@0576 98800404
@0577 9CC004C3
@0578 11400003
@0579 2008923A
@057A 1806943A
@057B 9826963A
@057C 2148B03A
@057D 1906B03A
@057E 800B883A
@057F 9009883A
@0580 98E6B03A
@0581 00128000
@0582 1009883A
@0583 880B883A
@0584 1029883A
@0585 00128000
@0586 D9000304
@0587 000B883A
@0588 01810004
@0589 102B883A
@058A 0012DBC0
@058B 00801004
@058C D8800315
@058D 009053C4
@058E D8800D15
@058F D8801E15
@0590 00881204
@0591 00D21104
@0592 D8801F15
@0593 00985C84
@0594 D8C00E15
@0595 D8802015
@0596 00CC0C04
@0597 00991904
@0598 D8C00F15
@0599 D8C01015
@059A 010000C4
@059B 00CC0804
@059C D8802115
@059D 009C9A44
@059E 01408004
@059F D8C01115
@05A0 D9001715
@05A1 00C80804
@05A2 D8802215
@05A3 01000104
@05A4 009D9944
@05A5 D8C01215
@05A6 D8C01315
@05A7 D8C01415
@05A8 D8C01515
@05A9 D8C01615
@05AA D8802315
@05AB D8C02415
@05AC D8C02515
@05AD D8C02615
@05AE D8C02715
@05AF D8C02815
@05B0 D8C02915
@05B1 D8C02A15
@05B2 D8C02B15
@05B3 D8C02C15
@05B4 D8C02D15
@05B5 D8C02E15
@05B6 D8C02F15
@05B7 00800404
@05B8 D9400815
@05B9 D9401815
@05BA D9001915
@05BB D8C03015
@05BC D8803215
@05BD 00800044
@05BE D8803315
@05BF 008001C4
@05C0 D8803815
@05C1 00801F84
@05C2 D8C03115
@05C3 D8805315
@05C4 00C01E04
@05C5 009D0004
@05C6 D8C04415
@05C7 D8C04515
@05C8 D8C04615
@05C9 D8C04715
@05CA D8805615
@05CB 00D00004
@05CC D8805915
@05CD 00980044
@05CE D8C05515
@05CF D8C05715
@05D0 D8C05815
@05D1 D8C05A15
@05D2 D8806015
@05D3 D9403415
@05D4 D9403615
@05D5 D9403715
@05D6 008FFFC4
@05D7 8007883A
@05D8 1400012E
@05D9 1007883A
@05DA 8804927A
@05DB D8C00415
@05DC D8C03915
@05DD 10BFFFCC
@05DE D8800715
@05DF A804D43A
@05E0 A8FFFFCC
@05E1 D8C03C15
@05E2 D8C03F15
@05E3 D8C06715
@05E4 DC800615
@05E5 DC400915
@05E6 DC803A15
@05E7 DC403B15
@05E8 D8803D15
@05E9 D8804015
@05EA D8806815
@05EB 0007883A
@05EC 01621014
@05ED 01010004
@05EE D9800304
@05EF 30C5883A
@05F0 11C00117
@05F1 11800017
@05F2 380E943A
@05F3 3984B03A
@05F4 28800035
@05F5 18C00204
@05F6 193FF71E
@05F7 00A21114
@05F8 14000035
@05F9 00A21214
@05FA 14800035
@05FB 00A21314
@05FC 14400035
@05FD 8809883A
@05FE 900B883A
@05FF 00128000
@0600 00E21414
@0601 18800035
@0602 1009883A
@0603 800B883A
@0604 00128000
@0605 00E21514
@0606 18800035
@0607 00A21614
@0608 14C00035
@0609 00A38014
@060A 00C072B4
@060B 18F0DFC4
@060C 10C00035
@060D 00A38114
@060E 00C39384
@060F 10C00035
@0610 D0A00703
@0611 1000081E
@0612 D0A00043
@0613 1000081E
@0614 D0A00783
@0615 1000081E
@0616 D0A00743
@0617 10000826
@0618 04C00804
@0619 00000706
@061A 04C01404
@061B 00000506
@061C 04C01004
@061D 00000306
@061E 04C00C04
@061F 00000106
@0620 04C00404
@0621 00810004
@0622 1400DA36
@0623 00800404
@0624 1480D836
@0625 00800FC4
@0626 1440DA2E
@0627 0000D506
@0628 05000084
@0629 D9010304
@062A 000B883A
@062B 01808004
@062C 0012DBC0
@062D 00800484
@062E 00C02004
@062F D8810715
@0630 D8810815
@0631 D8C11015
@0632 00800044
@0633 D8C11815
@0634 00C00BC4
@0635 D8810915
@0636 D8C11C15
@0637 008000C4
@0638 00C03FC4
@0639 D8810A15
@063A D8C12115
@063B 00800444
@063C D8C12215
@063D 00C03204
@063E D8810B15
@063F D8C12315
@0640 008004C4
@0641 00C001C4
@0642 D8810C15
@0643 D8C13815
@0644 00800984
@0645 80C03FCC
@0646 8020D23A
@0647 D8810D15
@0648 00800084
@0649 01003C04
@064A D8810E15
@064B D8811915
@064C 00803F04
@064D 84003FCC
@064E D9011515
@064F D8811B15
@0650 01000344
@0651 D8813415
@0652 9CC03FCC
@0653 00800804
@0654 A5003FCC
@0655 D8813515
@0656 D8813A15
@0657 D8C11E15
@0658 D8C12415
@0659 D8813015
@065A D9011715
@065B DCC11315
@065C DC011F15
@065D DC812015
@065E DC012515
@065F DC412615
@0660 DD013C15
@0661 00800404
@0662 0007883A
@0663 01400B84
@0664 1089883A
@0665 2109883A
@0666 D9810304
@0667 3109883A
@0668 21000017
@0669 10800044
@066A 20C7883A
@066B 117FF81E
@066C 18BFFFCC
@066D 1005D23A
@066E 18C03FCC
@066F D8C13215
@0670 D8813115
@0671 017FFFF4
@0672 295D0004
@0673 00A30014
@0674 00E38014
@0675 D9810304
@0676 3089883A
@0677 2149883A
@0678 21000017
@0679 11000035
@067A 10800104
@067B 10FFF91E
@067C 0007303A
@067D 00BFFF84
@067E 1884703A
@067F 1001703A
@0680 0010EDC0
@0681 00A21814
@0682 10000035
@0683 00A22414
@0684 10800037
@0685 1080010C
@0686 1000011E
@0687 0010EDC0
@0688 00101140
@0689 103FF916
@068A 1000401E
@068B 00101340
@068C 1029883A
@068D 04020034
@068E 00101340
@068F 0009883A
@0690 000B883A
@0691 A421883A
@0692 102B883A
@0693 8023883A
@0694 001019C0
@0695 0027883A
@0696 0025883A
@0697 00001206
@0698 0010F600
@0699 88800005
@069A 8809883A
@069B 000B883A
@069C 001019C0
@069D 9080FFCC
@069E 1000081E
@069F 9809883A
@06A0 A80B883A
@06A1 00127F00
@06A2 01000074
@06A3 210F2B04
@06A4 880B883A
@06A5 100D883A
@06A6 0012E180
@06A7 94800044
@06A8 8C400044
@06A9 9CC01904
@06AA 957FED1E
@06AB 00101340
@06AC 0009883A
@06AD D9418404
@06AE 1023883A
@06AF D8018415
@06B0 001019C0
@06B1 0009883A
@06B2 000B883A
@06B3 D8018315
@06B4 001019C0
@06B5 A4A5883A
@06B6 00820034
@06B7 90A5883A
@06B8 00000406
@06B9 8009883A
@06BA 000B883A
@06BB 001019C0
@06BC 84000044
@06BD 84BFFB1E
@06BE 0009883A
@06BF D9418304
@06C0 001019C0
@06C1 D8818417
@06C2 8880041E
@06C3 D8818317
@06C4 8880021E
@06C5 00801644
@06C6 00000106
@06C7 00801384
@06C8 00E22214
@06C9 18800035
@06CA 003FB806
@06CB 00C01CC4
@06CC 10C0061E
@06CD 01000074
@06CE 210F2F04
@06CF 0012E180
@06D0 00A21814
@06D1 10000035
@06D2 00000806
@06D3 00C01904
@06D4 10C0091E
@06D5 01000074
@06D6 210F3404
@06D7 0012E180
@06D8 00A21814
@06D9 00C00044
@06DA 10C00035
@06DB 00A22214
@06DC 00C00284
@06DD 00001406
@06DE 00C01D84
@06DF 10C0031E
@06E0 00A80014
@06E1 00F00014
@06E2 00000F06
@06E3 00C01884
@06E4 10C0031E
@06E5 00A80014
@06E6 00E00014
@06E7 00000A06
@06E8 00C01A84
@06E9 10C0061E
@06EA 00A22314
@06EB 11400037
@06EC 01000074
@06ED 210F3904
@06EE 0012E180
@06EF 003F9306
@06F0 00A22214
@06F1 00C01384
@06F2 10C00035
@06F3 003F8F06
@06F4 04003004
@06F5 00000506
@06F6 0021883A
@06F7 00000306
@06F8 04002004
@06F9 00000106
@06FA 04000804
@06FB 00C00044
@06FC 003E2806
@06FD 008000B4
@06FE 153F2936
@06FF 05000044
@0700 003F2806
@0701 0029883A
@0702 003F2606
@0703 04400204
@0704 00000706
@0705 04400244
@0706 00000506
@0707 044003C4
@0708 00000306
@0709 04400484
@070A 00000106
@070B 0023883A
@070C 10803FCC
@070D 103DEB26
@070E 0480A004
@070F 00000906
@0710 0480B404
@0711 00000706
@0712 04816804
@0713 00000506
@0714 04825804
@0715 00000306
@0716 0482D004
@0717 00000106
@0718 0025883A
@0719 05000084
@071A 003DF006
@071B 0005883A
@071C DFC18C17
@071D DD818B17
@071E DD418A17
@071F DD018917
@0720 DCC18817
@0721 DC818717
@0722 DC418617
@0723 DC018517
@0724 DEC18D04
@0725 F800283A
@0726 2005883A
@0727 21000017
@0728 01C00044
@0729 3900622E
@072A 28C00017
@072B 38C05F2E
@072C 01C00104
@072D 21C0C626
@072E 19C05C26
@072F 01C00084
@0730 19C06B26
@0731 21C05926
@0732 11C00217
@0733 2AC00217
@0734 13000317
@0735 13400417
@0736 3AC9C83A
@0737 2A000317
@0738 2A400417
@0739 2015883A
@073A 20007516
@073B 00C00FC4
@073C 1A805016
@073D 0100870E
@073E 50FFF804
@073F 18009916
@0740 48D6D83A
@0741 001D883A
@0742 18009E16
@0743 01000044
@0744 20C6983A
@0745 0015883A
@0746 513FFFC4
@0747 2295403A
@0748 1A87C83A
@0749 1A52703A
@074A 2210703A
@074B 4250B03A
@074C 4010C03A
@074D 42D0B03A
@074E 7013883A
@074F 11000117
@0750 28800117
@0751 20804126
@0752 20006326
@0753 4305C83A
@0754 4091803A
@0755 4B47C83A
@0756 1A07C83A
@0757 18006316
@0758 30000115
@0759 31C00215
@075A 30800315
@075B 30C00415
@075C 11FFFFC4
@075D 388B403A
@075E 194BC83A
@075F 01040034
@0760 213FFFC4
@0761 21401736
@0762 29008226
@0763 31400217
@0764 02840034
@0765 52BFFFC4
@0766 033FFF84
@0767 297FFFC4
@0768 00000106
@0769 3A804A26
@076A 1089883A
@076B 2091803A
@076C 18C7883A
@076D 227FFFC4
@076E 40D1883A
@076F 490F403A
@0770 41CFC83A
@0771 2817883A
@0772 2005883A
@0773 4007883A
@0774 297FFFC4
@0775 51FFF32E
@0776 31000315
@0777 32000415
@0778 32C00215
@0779 010000C4
@077A 31000015
@077B 01080034
@077C 213FFFC4
@077D 20C00B2E
@077E 180E97FA
@077F 1008D07A
@0780 31400217
@0781 1806D07A
@0782 1080004C
@0783 3908B03A
@0784 1108B03A
@0785 29400044
@0786 31000315
@0787 30C00415
@0788 31400215
@0789 3005883A
@078A F800283A
@078B 2805883A
@078C F800283A
@078D 59C01E0E
@078E 11000117
@078F 28800117
@0790 0011883A
@0791 0013883A
@0792 20BFBF1E
@0793 4305883A
@0794 1207803A
@0795 4B53883A
@0796 1A47883A
@0797 31000115
@0798 31C00215
@0799 30800315
@079A 30C00415
@079B 003FDD06
@079C 20FFEF1E
@079D 31000015
@079E 10C00117
@079F 30C00115
@07A0 10C00217
@07A1 11000117
@07A2 29400117
@07A3 30C00215
@07A4 10C00317
@07A5 2908703A
@07A6 30C00315
@07A7 10C00417
@07A8 31000115
@07A9 3005883A
@07AA 30C00415
@07AB F800283A
@07AC 580F883A
@07AD 0019883A
@07AE 001B883A
@07AF 003F9F06
@07B0 0115C83A
@07B1 00C00FC4
@07B2 1ABFDA16
@07B3 003F8906
@07B4 627FB52E
@07B5 003FC006
@07B6 6205C83A
@07B7 6099803A
@07B8 6A47C83A
@07B9 1B07C83A
@07BA 183F9D0E
@07BB 0085C83A
@07BC 1008C03A
@07BD 00C7C83A
@07BE 1907C83A
@07BF 01000044
@07C0 31000115
@07C1 31C00215
@07C2 30800315
@07C3 30C00415
@07C4 003F9706
@07C5 203F8926
@07C6 50FFF804
@07C7 3A8F883A
@07C8 18002316
@07C9 68D6D83A
@07CA 001D883A
@07CB 18001C16
@07CC 01000044
@07CD 20C6983A
@07CE 0015883A
@07CF 513FFFC4
@07D0 2295403A
@07D1 1A87C83A
@07D2 1B5A703A
@07D3 2318703A
@07D4 6358B03A
@07D5 6018C03A
@07D6 62D8B03A
@07D7 701B883A
@07D8 003F7606
@07D9 4808907A
@07DA 02C007C4
@07DB 5A97C83A
@07DC 22C8983A
@07DD 4296D83A
@07DE 4A9CD83A
@07DF 22D6B03A
@07E0 003F6106
@07E1 00C00044
@07E2 1A94983A
@07E3 0007883A
@07E4 003F6106
@07E5 013FFF84
@07E6 21FF7C2E
@07E7 003F9106
@07E8 00C00044
@07E9 1A94983A
@07EA 0007883A
@07EB 003FE306
@07EC 6816907A
@07ED 010007C4
@07EE 2289C83A
@07EF 5908983A
@07F0 6296D83A
@07F1 6A9CD83A
@07F2 22D6B03A
@07F3 003FD706
@07F4 193F971E
@07F5 11000117
@07F6 28C00117
@07F7 20FF9426
@07F8 00800074
@07F9 108F3D04
@07FA F800283A
@07FB DEFFEC04
@07FC D9001115
@07FD D9401215
@07FE D9001104
@07FF D9400A04
@0800 DFC01315
@0801 D9C01015
@0802 D9800F15
@0803 0012C080
@0804 D9000F04
@0805 D9400504
@0806 0012C080
@0807 D9000A04
@0808 D9400504
@0809 D80D883A
@080A 0011C980
@080B 1009883A
@080C 00129E40
@080D DFC01317
@080E DEC01404
@080F F800283A
@0810 DEFFEC04
@0811 D9001115
@0812 D9401215
@0813 D9001104
@0814 D9400A04
@0815 DFC01315
@0816 D9C01015
@0817 D9800F15
@0818 0012C080
@0819 D9000F04
@081A D9400504
@081B 0012C080
@081C D8800617
@081D D9000A04
@081E D9400504
@081F D80D883A
@0820 1080005C
@0821 D8800615
@0822 0011C980
@0823 1009883A
@0824 00129E40
@0825 DFC01317
@0826 DEC01404
@0827 F800283A
@0828 DEFFE404
@0829 D9001115
@082A D9401215
@082B D9001104
@082C D9400A04
@082D DFC01B15
@082E D9800F15
@082F D9C01015
@0830 DDC01A15
@0831 DD801915
@0832 DD401815
@0833 DD001715
@0834 DCC01615
@0835 DC801515
@0836 DC401415
@0837 DC001315
@0838 0012C080
@0839 D9000F04
@083A D9400504
@083B 0012C080
@083C D8C00A17
@083D 00800044
@083E 10C01136
@083F D8C00B17
@0840 D8800617
@0841 D9000A04
@0842 1884C03A
@0843 D8800B15
@0844 00129E40
@0845 DFC01B17
@0846 DDC01A17
@0847 DD801917
@0848 DD401817
@0849 DD001717
@084A DCC01617
@084B DC801517
@084C DC401417
@084D DC001317
@084E DEC01C04
@084F F800283A
@0850 D9000517
@0851 11000636
@0852 D8800617
@0853 D8C00B17
@0854 D9000504
@0855 1884C03A
@0856 D8800615
@0857 003FEC06
@0858 00800104
@0859 1880051E
@085A 00800084
@085B 20BFE31E
@085C 01000074
@085D 210F3D04
@085E 003FE506
@085F 2080031E
@0860 00800084
@0861 18BFFA26
@0862 003FEF06
@0863 00800084
@0864 18BFDA26
@0865 20BFEC26
@0866 DC000D17
@0867 DD000817
@0868 DC800917
@0869 8009883A
@086A 000B883A
@086B A00D883A
@086C 000F883A
@086D 00128280
@086E DC400E17
@086F 9009883A
@0870 800D883A
@0871 000B883A
@0872 000F883A
@0873 102F883A
@0874 1827883A
@0875 00128280
@0876 900D883A
@0877 8809883A
@0878 000B883A
@0879 000F883A
@087A 102B883A
@087B 1821883A
@087C 00128280
@087D 8809883A
@087E 000B883A
@087F A00D883A
@0880 000F883A
@0881 102D883A
@0882 1825883A
@0883 00128280
@0884 154B883A
@0885 2889803A
@0886 1C07883A
@0887 20C9883A
@0888 24004B36
@0889 8100011E
@088A 2D404936
@088B 0011883A
@088C 0007883A
@088D 2CCB883A
@088E B80D883A
@088F 2CC0012E
@0890 02000044
@0891 258F883A
@0892 3909803A
@0893 DA400C17
@0894 2489883A
@0895 D8800717
@0896 20C9883A
@0897 DA800B17
@0898 D8C00617
@0899 3A11883A
@089A 4885883A
@089B 50C6C03A
@089C 41CF803A
@089D 12400104
@089E D8C00115
@089F 3909883A
@08A0 DA400215
@08A1 03480034
@08A2 6B7FFFC4
@08A3 4007883A
@08A4 6900102E
@08A5 10800144
@08A6 180ED07A
@08A7 18C0004C
@08A8 201097FA
@08A9 281697FA
@08AA 2008D07A
@08AB 3014D07A
@08AC 2812D07A
@08AD 1019883A
@08AE 18000226
@08AF 5A8CB03A
@08B0 49600034
@08B1 41C6B03A
@08B2 10800044
@08B3 693FF236
@08B4 DB000215
@08B5 03440034
@08B6 6B7FFFC4
@08B7 69001336
@08B8 D8800217
@08B9 10BFFFC4
@08BA 18D3883A
@08BB 48C7803A
@08BC 2109883A
@08BD 190F883A
@08BE 3191883A
@08BF 4197803A
@08C0 2955883A
@08C1 1019883A
@08C2 4807883A
@08C3 3809883A
@08C4 2800010E
@08C5 48C00054
@08C6 400D883A
@08C7 5A8B883A
@08C8 10BFFFC4
@08C9 69FFF02E
@08CA DB000215
@08CB 18803FCC
@08CC 01C02004
@08CD 11C00926
@08CE 008000C4
@08CF D9000415
@08D0 D8C00315
@08D1 D8800015
@08D2 D809883A
@08D3 003F7006
@08D4 0011883A
@08D5 00C00044
@08D6 003FB606
@08D7 19C0400C
@08D8 383FF51E
@08D9 314AB03A
@08DA 283FF326
@08DB 1885883A
@08DC 10CB803A
@08DD 00FFC004
@08DE 10C6703A
@08DF 2909883A
@08E0 003FED06
@08E1 DEFFF104
@08E2 D9000C15
@08E3 D9400D15
@08E4 D9000C04
@08E5 D9400504
@08E6 DFC00E15
@08E7 D9800A15
@08E8 D9C00B15
@08E9 0012C080
@08EA D9000A04
@08EB D80B883A
@08EC 0012C080
@08ED D8C00517
@08EE 00800044
@08EF 10C00536
@08F0 D9000504
@08F1 00129E40
@08F2 DFC00E17
@08F3 DEC00F04
@08F4 F800283A
@08F5 D9000017
@08F6 11000536
@08F7 D809883A
@08F8 00129E40
@08F9 DFC00E17
@08FA DEC00F04
@08FB F800283A
@08FC D9800617
@08FD D9400117
@08FE 00800104
@08FF 314AF03A
@0900 D9400615
@0901 18800226
@0902 01400084
@0903 1940041E
@0904 193FEB1E
@0905 01000074
@0906 210F3D04
@0907 003FE906
@0908 20803326
@0909 21403726
@090A D8800217
@090B D9000717
@090C D8C00917
@090D DA000417
@090E 2089C83A
@090F D9000715
@0910 D8800817
@0911 DBC00317
@0912 1A000236
@0913 40C0081E
@0914 13C0072E
@0915 108B883A
@0916 288D803A
@0917 18C7883A
@0918 213FFFC4
@0919 2805883A
@091A 30C7883A
@091B D9000715
@091C 01400F44
@091D 000F883A
@091E 01040034
@091F 0019883A
@0920 001B883A
@0921 201697FA
@0922 3814D07A
@0923 297FFFC4
@0924 1A000936
@0925 13CDC83A
@0926 1193803A
@0927 1A1DC83A
@0928 40C0011E
@0929 13C00436
@092A 3005883A
@092B 7247C83A
@092C 61D8B03A
@092D 691AB03A
@092E 108D883A
@092F 3093803A
@0930 18C7883A
@0931 5A8EB03A
@0932 2008D07A
@0933 3005883A
@0934 48C7883A
@0935 283FEB1E
@0936 61003FCC
@0937 01402004
@0938 21400B26
@0939 DB000815
@093A DB400915
@093B 003FB406
@093C D8000815
@093D D8000915
@093E D8000715
@093F D9000504
@0940 003FB006
@0941 D8800515
@0942 D9000504
@0943 003FAD06
@0944 6140400C
@0945 283FF31E
@0946 30C4B03A
@0947 103FF126
@0948 6109883A
@0949 2305803A
@094A 033FC004
@094B 2318703A
@094C 135B883A
@094D 003FEB06
@094E 2004D7FA
@094F DEFFF904
@0950 00C000C4
@0951 DFC00615
@0952 DC000515
@0953 D8C00015
@0954 D8800115
@0955 2000081E
@0956 00800084
@0957 D8800015
@0958 D809883A
@0959 00129E40
@095A DFC00617
@095B DC000517
@095C DEC00704
@095D F800283A
@095E 00C00F04
@095F D8C00215
@0960 10000F1E
@0961 2021883A
@0962 8009883A
@0963 00129380
@0964 11000744
@0965 0100110E
@0966 10FFFF44
@0967 18001216
@0968 80C6983A
@0969 0009883A
@096A 014007C4
@096B 2885C83A
@096C D9000315
@096D D8C00415
@096E D8800215
@096F 003FE806
@0970 00A00034
@0971 20800E26
@0972 0121C83A
@0973 8009883A
@0974 00129380
@0975 11000744
@0976 013FEF16
@0977 DC000315
@0978 D8000415
@0979 003FDE06
@097A 800AD07A
@097B 00C007C4
@097C 1907C83A
@097D 28C6D83A
@097E 8108983A
@097F 003FEA06
@0980 0005883A
@0981 00F07834
@0982 003FD706
@0983 DEFFF804
@0984 D9000515
@0985 D9400615
@0986 D9000504
@0987 D80B883A
@0988 DFC00715
@0989 0012C080
@098A D8800017
@098B 00C00084
@098C 10C01C26
@098D 00C00044
@098E 18801A2E
@098F 00C00104
@0990 10C01126
@0991 D8800217
@0992 10001616
@0993 00C00784
@0994 18800D16
@0995 00C00F04
@0996 1885C83A
@0997 10FFF804
@0998 D9400317
@0999 D9000417
@099A 18001216
@099B 20C4D83A
@099C D8C00117
@099D 18000826
@099E 0085C83A
@099F DFC00717
@09A0 DEC00804
@09A1 F800283A
@09A2 D8800117
@09A3 00E00034
@09A4 1005003A
@09A5 1885C83A
@09A6 DFC00717
@09A7 DEC00804
@09A8 F800283A
@09A9 0005883A
@09AA DFC00717
@09AB DEC00804
@09AC F800283A
@09AD 2008907A
@09AE 018007C4
@09AF 308DC83A
@09B0 2188983A
@09B1 2884D83A
@09B2 2084B03A
@09B3 003FE806
@09B4 2005883A
@09B5 2900182E
@09B6 28001716
@09B7 01000804
@09B8 00C00044
@09B9 00000206
@09BA 20001126
@09BB 28000516
@09BC 294B883A
@09BD 213FFFC4
@09BE 18C7883A
@09BF 28BFFA36
@09C0 18000B26
@09C1 0009883A
@09C2 11400236
@09C3 1145C83A
@09C4 20C8B03A
@09C5 1806D07A
@09C6 280AD07A
@09C7 183FFA1E
@09C8 3000021E
@09C9 2005883A
@09CA F800283A
@09CB F800283A
@09CC 0009883A
@09CD 003FFA06
@09CE 00C00044
@09CF 0009883A
@09D0 003FF106
@09D1 DEFFFE04
@09D2 DFC00115
@09D3 DC000015
@09D4 20000A16
@09D5 0021883A
@09D6 28000B16
@09D7 000D883A
@09D8 00126D00
@09D9 80000126
@09DA 0085C83A
@09DB DFC00117
@09DC DC000017
@09DD DEC00204
@09DE F800283A
@09DF 0109C83A
@09E0 04000044
@09E1 283FF50E
@09E2 014BC83A
@09E3 8400005C
@09E4 003FF206
@09E5 DEFFFF04
@09E6 DFC00015
@09E7 20000516
@09E8 28000C16
@09E9 01800044
@09EA DFC00017
@09EB DEC00104
@09EC 00126D01
@09ED 0109C83A
@09EE 28000B16
@09EF 01800044
@09F0 00126D00
@09F1 0085C83A
@09F2 DFC00017
@09F3 DEC00104
@09F4 F800283A
@09F5 014BC83A
@09F6 01800044
@09F7 DFC00017
@09F8 DEC00104
@09F9 00126D01
@09FA 014BC83A
@09FB 003FF306
@09FC 000D883A
@09FD 00126D01
@09FE 01800044
@09FF 00126D01
@0A00 0005883A
@0A01 20000726
@0A02 20C0004C
@0A03 2008D07A
@0A04 18000126
@0A05 1145883A
@0A06 294B883A
@0A07 203FFA1E
@0A08 F800283A
@0A09 F800283A
@0A0A DEFFF604
@0A0B DD400515
@0A0C DD000415
@0A0D 257FFFCC
@0A0E 353FFFCC
@0A0F DCC00315
@0A10 3026D43A
@0A11 DD800615
@0A12 DC800215
@0A13 DC400115
@0A14 2024D43A
@0A15 2023883A
@0A16 282D883A
@0A17 A009883A
@0A18 A80B883A
@0A19 DFC00915
@0A1A DF000815
@0A1B DDC00715
@0A1C 3839883A
@0A1D DC000015
@0A1E 3021883A
@0A1F 00128000
@0A20 A80B883A
@0A21 9809883A
@0A22 102F883A
@0A23 00128000
@0A24 A009883A
@0A25 900B883A
@0A26 102B883A
@0A27 00128000
@0A28 9809883A
@0A29 900B883A
@0A2A 1029883A
@0A2B 00128000
@0A2C 1007883A
@0A2D B804D43A
@0A2E A549883A
@0A2F 2089883A
@0A30 2500022E
@0A31 00800074
@0A32 1887883A
@0A33 200CD43A
@0A34 2004943A
@0A35 E00B883A
@0A36 8809883A
@0A37 BDFFFFCC
@0A38 19A3883A
@0A39 15EF883A
@0A3A 00128000
@0A3B 8009883A
@0A3C B00B883A
@0A3D 1025883A
@0A3E 00128000
@0A3F 9085883A
@0A40 1447883A
@0A41 B805883A
@0A42 DFC00917
@0A43 DF000817
@0A44 DDC00717
@0A45 DD800617
@0A46 DD400517
@0A47 DD000417
@0A48 DCC00317
@0A49 DC800217
@0A4A DC400117
@0A4B DC000017
@0A4C DEC00A04
@0A4D F800283A
@0A4E 00BFFFD4
@0A4F 11000B36
@0A50 00803FC4
@0A51 11001E2E
@0A52 00C00204
@0A53 20C8D83A
@0A54 00C00074
@0A55 18CF4204
@0A56 00800604
@0A57 1909883A
@0A58 20C00003
@0A59 10C5C83A
@0A5A F800283A
@0A5B 00804034
@0A5C 10BFFFC4
@0A5D 11000936
@0A5E 00800404
@0A5F 1007883A
@0A60 20C8D83A
@0A61 00C00074
@0A62 18CF4204
@0A63 1909883A
@0A64 20C00003
@0A65 10C5C83A
@0A66 F800283A
@0A67 00C00604
@0A68 20C8D83A
@0A69 00C00074
@0A6A 18CF4204
@0A6B 00800204
@0A6C 1909883A
@0A6D 20C00003
@0A6E 10C5C83A
@0A6F F800283A
@0A70 0007883A
@0A71 20C8D83A
@0A72 00C00074
@0A73 18CF4204
@0A74 00800804
@0A75 1909883A
@0A76 20C00003
@0A77 10C5C83A
@0A78 F800283A
@0A79 20800017
@0A7A DEFFF804
@0A7B DCC00315
@0A7C DC800215
@0A7D DFC00715
@0A7E DD800615
@0A7F DD400515
@0A80 DD000415
@0A81 DC400115
@0A82 DC000015
@0A83 04800044
@0A84 24400317
@0A85 24000417
@0A86 24C00117
@0A87 9080422E
@0A88 00C00104
@0A89 10C03C26
@0A8A 00C00084
@0A8B 10C01926
@0A8C 8C04B03A
@0A8D 10001726
@0A8E 21000217
@0A8F 00BF0084
@0A90 20804016
@0A91 0080FFC4
@0A92 11003316
@0A93 88803FCC
@0A94 00C02004
@0A95 10C02926
@0A96 88801FC4
@0A97 1463803A
@0A98 8C21883A
@0A99 1023883A
@0A9A 00880034
@0A9B 10BFFFC4
@0A9C 14001C36
@0A9D 2100FFC4
@0A9E 8006963A
@0A9F 8804D23A
@0AA0 8020913A
@0AA1 2101FFCC
@0AA2 1884B03A
@0AA3 8020D33A
@0AA4 00000306
@0AA5 0009883A
@0AA6 0005883A
@0AA7 0021883A
@0AA8 2008953A
@0AA9 982697FA
@0AAA 00C00434
@0AAB 18FFFFC4
@0AAC 80E0703A
@0AAD 8106B03A
@0AAE 1CC6B03A
@0AAF DFC00717
@0AB0 DD800617
@0AB1 DD400517
@0AB2 DD000417
@0AB3 DCC00317
@0AB4 DC800217
@0AB5 DC400117
@0AB6 DC000017
@0AB7 DEC00804
@0AB8 F800283A
@0AB9 800697FA
@0ABA 8804D07A
@0ABB 21010004
@0ABC 8020D07A
@0ABD 18A2B03A
@0ABE 003FDF06
@0ABF 88C0400C
@0AC0 183FD926
@0AC1 8885883A
@0AC2 1463803A
@0AC3 8C21883A
@0AC4 1023883A
@0AC5 003FD406
@0AC6 0101FFC4
@0AC7 0005883A
@0AC8 0021883A
@0AC9 003FDE06
@0ACA 84000234
@0ACB 00C00434
@0ACC 18FFFFC4
@0ACD 8805883A
@0ACE 80E0703A
@0ACF 0101FFC4
@0AD0 003FD706
@0AD1 1129C83A
@0AD2 00800E04
@0AD3 15002716
@0AD4 800B883A
@0AD5 A00D883A
@0AD6 8809883A
@0AD7 0012D0C0
@0AD8 9009883A
@0AD9 000B883A
@0ADA A00D883A
@0ADB 102D883A
@0ADC 182B883A
@0ADD 0012D500
@0ADE 1009003A
@0ADF 1907C83A
@0AE0 10BFFFC4
@0AE1 1C20703A
@0AE2 1444703A
@0AE3 1404B03A
@0AE4 1004C03A
@0AE5 1584B03A
@0AE6 11003FCC
@0AE7 01402004
@0AE8 A807883A
@0AE9 2140131E
@0AEA 1140400C
@0AEB 28000426
@0AEC 1109883A
@0AED 2085803A
@0AEE 1547883A
@0AEF 2005883A
@0AF0 1808963A
@0AF1 1004D23A
@0AF2 1820913A
@0AF3 01440034
@0AF4 297FFFC4
@0AF5 2084B03A
@0AF6 8020D33A
@0AF7 01000044
@0AF8 28FFAF36
@0AF9 0009883A
@0AFA 003FAD06
@0AFB 0005883A
@0AFC 0007883A
@0AFD 11001FC4
@0AFE 2085803A
@0AFF 10C7883A
@0B00 2005883A
@0B01 003FEE06
@0B02 21800117
@0B03 20C00017
@0B04 3004D7FA
@0B05 3008D53A
@0B06 28800115
@0B07 2101FFCC
@0B08 00800434
@0B09 10BFFFC4
@0B0A 3084703A
@0B0B 20001A1E
@0B0C 1888B03A
@0B0D 20002626
@0B0E 1808D63A
@0B0F 1004923A
@0B10 01BF0084
@0B11 29800215
@0B12 2084B03A
@0B13 010000C4
@0B14 29000015
@0B15 02040034
@0B16 423FFFC4
@0B17 1806923A
@0B18 40801836
@0B19 013F0044
@0B1A 18CD883A
@0B1B 30C7803A
@0B1C 1085883A
@0B1D 1885883A
@0B1E 200F883A
@0B1F 3007883A
@0B20 213FFFC4
@0B21 40BFF82E
@0B22 29C00215
@0B23 28C00315
@0B24 28800415
@0B25 F800283A
@0B26 01C1FFC4
@0B27 21C00F26
@0B28 180CD63A
@0B29 1004923A
@0B2A 213F0044
@0B2B 1806923A
@0B2C 3084B03A
@0B2D 29000215
@0B2E 010000C4
@0B2F 10840034
@0B30 29000015
@0B31 28C00315
@0B32 28800415
@0B33 F800283A
@0B34 00800084
@0B35 28800015
@0B36 F800283A
@0B37 1888B03A
@0B38 20000526
@0B39 3180022C
@0B3A 30000626
@0B3B 01000044
@0B3C 29000015
@0B3D 003FF306
@0B3E 00800104
@0B3F 28800015
@0B40 F800283A
@0B41 28000015
@0B42 003FEE06
@0B43 2005883A
@0B44 2807883A
@0B45 30000826
@0B46 01000804
@0B47 2189C83A
@0B48 0100060E
@0B49 1184D83A
@0B4A 2908983A
@0B4B 298CD83A
@0B4C 2084B03A
@0B4D 3007883A
@0B4E F800283A
@0B4F 0105C83A
@0B50 000D883A
@0B51 2884D83A
@0B52 3007883A
@0B53 003FFA06
@0B54 2005883A
@0B55 2807883A
@0B56 30000826
@0B57 01000804
@0B58 2189C83A
@0B59 0100060E
@0B5A 1108D83A
@0B5B 2986983A
@0B5C 118C983A
@0B5D 20C6B03A
@0B5E 3005883A
@0B5F F800283A
@0B60 0107C83A
@0B61 000D883A
@0B62 10C6983A
@0B63 3005883A
@0B64 003FFA06
@0B65 2005883A
@0B66 30000726
@0B67 218D883A
@0B68 2007883A
@0B69 29C00003
@0B6A 18C00044
@0B6B 29400044
@0B6C 19FFFFC5
@0B6D 19BFFB1E
@0B6E F800283A
@0B6F 2005883A
@0B70 30000526
@0B71 218D883A
@0B72 2007883A
@0B73 19400005
@0B74 18C00044
@0B75 19BFFD1E
@0B76 F800283A
@0B77 DEFFFD04
@0B78 DFC00015
@0B79 D9800115
@0B7A D9C00215
@0B7B 20800217
@0B7C 00C00074
@0B7D 18CDAE04
@0B7E 280D883A
@0B7F 10C00115
@0B80 100B883A
@0B81 D9C00104
@0B82 0012E640
@0B83 DFC00017
@0B84 DEC00304
@0B85 F800283A
@0B86 DEFFFC04
@0B87 DFC00015
@0B88 D9400115
@0B89 D9800215
@0B8A D9C00315
@0B8B 00800074
@0B8C 108FBE04
@0B8D 10800017
@0B8E 00C00074
@0B8F 18CDAE04
@0B90 200B883A
@0B91 10800217
@0B92 D9800104
@0B93 10C00115
@0B94 1009883A
@0B95 00135980
@0B96 DFC00017
@0B97 DEC00404
@0B98 F800283A
@0B99 DEFFE004
@0B9A D8C00804
@0B9B DDC01D15
@0B9C DD401B15
@0B9D DD001A15
@0B9E DCC01915
@0B9F DC801815
@0BA0 DC001615
@0BA1 DFC01F15
@0BA2 DF001E15
@0BA3 DD801C15
@0BA4 DC401715
@0BA5 D9000F15
@0BA6 D9C00E15
@0BA7 3021883A
@0BA8 0025883A
@0BA9 D8001415
@0BAA D8000D15
@0BAB 0029883A
@0BAC D8000B15
@0BAD D8000C15
@0BAE D8001315
@0BAF D8001015
@0BB0 002B883A
@0BB1 04C00044
@0BB2 D8C00A15
@0BB3 282F883A
@0BB4 80C00003
@0BB5 84000044
@0BB6 18803FCC
@0BB7 1080201C
@0BB8 10BFE004
@0BB9 10001426
@0BBA ACC03026
@0BBB 9D401F16
@0BBC A83FF71E
@0BBD 01000944
@0BBE 1100D926
@0BBF B8800117
@0BC0 D9000F17
@0BC1 D8C00905
@0BC2 B80B883A
@0BC3 D9800904
@0BC4 01C00044
@0BC5 103EE83A
@0BC6 1000A31E
@0BC7 80C00003
@0BC8 94800044
@0BC9 84000044
@0BCA 18803FCC
@0BCB 1080201C
@0BCC 10BFE004
@0BCD 103FEC1E
@0BCE 9005883A
@0BCF DFC01F17
@0BD0 DF001E17
@0BD1 DDC01D17
@0BD2 DD801C17
@0BD3 DD401B17
@0BD4 DD001A17
@0BD5 DCC01917
@0BD6 DC801817
@0BD7 DC401717
@0BD8 DC001617
@0BD9 DEC02004
@0BDA F800283A
@0BDB 01000084
@0BDC A9001226
@0BDD 010000C4
@0BDE A93FD51E
@0BDF 1C7FF404
@0BE0 8C403FCC
@0BE1 01000244
@0BE2 24401B36
@0BE3 D9000B17
@0BE4 00BFFFC4
@0BE5 2080EA26
@0BE6 01400284
@0BE7 00128000
@0BE8 88A3883A
@0BE9 DC400B15
@0BEA 003FC906
@0BEB 01000C04
@0BEC 1100DE26
@0BED 01000944
@0BEE 1100FD26
@0BEF 1C7FF404
@0BF0 8C403FCC
@0BF1 01000244
@0BF2 24400936
@0BF3 D9000C17
@0BF4 00BFFFC4
@0BF5 2080D826
@0BF6 01400284
@0BF7 00128000
@0BF8 88A3883A
@0BF9 DC400C15
@0BFA 05400084
@0BFB 003FB806
@0BFC 01000B84
@0BFD 1100A726
@0BFE 01401B04
@0BFF 1140A326
@0C00 D9000B17
@0C01 00BFFFC4
@0C02 2080E626
@0C03 D8001015
@0C04 18FFEA04
@0C05 18C03FCC
@0C06 00800804
@0C07 10C0022E
@0C08 002B883A
@0C09 003FAA06
@0C0A 18C7883A
@0C0B 18C7883A
@0C0C 01400074
@0C0D 294C1104
@0C0E 1947883A
@0C0F 18800017
@0C10 1000683A
@0C11 000133DC
@0C12 00013020
@0C13 00013020
@0C14 00013020
@0C15 00013020
@0C16 00013020
@0C17 00013020
@0C18 00013020
@0C19 00013020
@0C1A 00013020
@0C1B 00013020
@0C1C 000133EC
@0C1D 000130C8
@0C1E 00013020
@0C1F 00013020
@0C20 00013020
@0C21 00013020
@0C22 000130C8
@0C23 00013020
@0C24 00013020
@0C25 00013020
@0C26 00013020
@0C27 00013020
@0C28 000131B0
@0C29 00013020
@0C2A 00013020
@0C2B 00013020
@0C2C 00013438
@0C2D 00013020
@0C2E 000131B4
@0C2F 00013020
@0C30 00013020
@0C31 000133E4
@0C32 D8C00D17
@0C33 18003926
@0C34 D9000E17
@0C35 00C00044
@0C36 25400017
@0C37 21000104
@0C38 D9000E15
@0C39 D8C00D15
@0C3A A8012116
@0C3B D8001215
@0C3C D823883A
@0C3D A800371E
@0C3E D9400B17
@0C3F D809883A
@0C40 01400B0E
@0C41 D8800B17
@0C42 D823883A
@0C43 00C00C04
@0C44 00000206
@0C45 D9400A17
@0C46 89400426
@0C47 88C00005
@0C48 10BFFFC4
@0C49 8C400044
@0C4A 103FFA1E
@0C4B 892BC83A
@0C4C D8C01217
@0C4D D9000C17
@0C4E A8C5883A
@0C4F D8C01017
@0C50 2085C83A
@0C51 D8801115
@0C52 18007F26
@0C53 D8C01217
@0C54 1800FA1E
@0C55 D8C01117
@0C56 00C0620E
@0C57 00800C04
@0C58 D88008C5
@0C59 B805883A
@0C5A DC001215
@0C5B 882F883A
@0C5C 1F3FFFC4
@0C5D 05BFFFC4
@0C5E DC000F17
@0C5F 1023883A
@0C60 00000206
@0C61 E73FFFC4
@0C62 E580FC26
@0C63 88800117
@0C64 8009883A
@0C65 880B883A
@0C66 D98008C4
@0C67 01C00044
@0C68 103EE83A
@0C69 103FF726
@0C6A 04BFFFC4
@0C6B 003F6206
@0C6C 05000204
@0C6D D9400E17
@0C6E 2D400017
@0C6F 29400104
@0C70 D9400E15
@0C71 D8000D15
@0C72 D8001215
@0C73 D823883A
@0C74 A83FC926
@0C75 05800244
@0C76 DC001115
@0C77 DF001417
@0C78 00000506
@0C79 15400C04
@0C7A 8D400005
@0C7B 802B883A
@0C7C 8C400044
@0C7D 80000F26
@0C7E A809883A
@0C7F A00B883A
@0C80 00127F00
@0C81 A009883A
@0C82 100B883A
@0C83 1021883A
@0C84 00128000
@0C85 A885C83A
@0C86 B0BFF20E
@0C87 E0000E26
@0C88 15400DC4
@0C89 8D400005
@0C8A 802B883A
@0C8B 8C400044
@0C8C 803FF11E
@0C8D D9000B17
@0C8E 8EEBC83A
@0C8F DC001117
@0C90 2545C83A
@0C91 D809883A
@0C92 00BFB90E
@0C93 D8C00A17
@0C94 88FFAE36
@0C95 003FB606
@0C96 154015C4
@0C97 003FE206
@0C98 00C00044
@0C99 013FFFC4
@0C9A D8C00D15
@0C9B D9000B15
@0C9C D8001415
@0C9D 05000284
@0C9E D9000C15
@0C9F D8001315
@0CA0 D8001015
@0CA1 182B883A
@0CA2 003F1106
@0CA3 00C00044
@0CA4 D8C01315
@0CA5 054000C4
@0CA6 003F0D06
@0CA7 D8C01117
@0CA8 DC001517
@0CA9 8805883A
@0CAA 90E5883A
@0CAB B823883A
@0CAC 102F883A
@0CAD D8C01217
@0CAE 18000A26
@0CAF B8800117
@0CB0 D9000F17
@0CB1 00C00B44
@0CB2 D8C00905
@0CB3 B80B883A
@0CB4 D9800904
@0CB5 01C00044
@0CB6 103EE83A
@0CB7 103FB21E
@0CB8 94800044
@0CB9 8D6DC83A
@0CBA 057F4D0E
@0CBB DD400F17
@0CBC 00000206
@0CBD 94800044
@0CBE 8DBF4926
@0CBF 8C7FFFC4
@0CC0 88C00003
@0CC1 B8800117
@0CC2 A809883A
@0CC3 D8C00905
@0CC4 B80B883A
@0CC5 D9800904
@0CC6 01C00044
@0CC7 103EE83A
@0CC8 103FF426
@0CC9 04BFFFC4
@0CCA 003F0306
@0CCB DD401015
@0CCC 05400084
@0CCD 003EE606
@0CCE 0005883A
@0CCF 003F2806
@0CD0 0005883A
@0CD1 003F1606
@0CD2 D8C01117
@0CD3 00FFD90E
@0CD4 00800804
@0CD5 D8800885
@0CD6 B805883A
@0CD7 DC001515
@0CD8 882F883A
@0CD9 1F3FFFC4
@0CDA 05BFFFC4
@0CDB DC000F17
@0CDC 1023883A
@0CDD 00000206
@0CDE E73FFFC4
@0CDF E5BFC726
@0CE0 88800117
@0CE1 8009883A
@0CE2 880B883A
@0CE3 D9800884
@0CE4 01C00044
@0CE5 103EE83A
@0CE6 103FF726
@0CE7 04BFFFC4
@0CE8 003EE506
@0CE9 01000044
@0CEA D9000B15
@0CEB 003F1806
@0CEC B8C00117
@0CED D9000F17
@0CEE D8800905
@0CEF B80B883A
@0CF0 D9800904
@0CF1 A80F883A
@0CF2 183EE83A
@0CF3 103F761E
@0CF4 94800044
@0CF5 002B883A
@0CF6 003EBD06
@0CF7 00C00044
@0CF8 D8C01415
@0CF9 05000404
@0CFA 003F7206
@0CFB D9000C17
@0CFC 9900420E
@0CFD DF000F17
@0CFE 25BFFFC4
@0CFF 00800804
@0D00 D8800845
@0D01 B023883A
@0D02 057FFFC4
@0D03 8C7FFFC4
@0D04 8D403926
@0D05 B8800117
@0D06 E009883A
@0D07 B80B883A
@0D08 D9800844
@0D09 01C00044
@0D0A 103EE83A
@0D0B 103FF726
@0D0C 04BFFFC4
@0D0D 003EC006
@0D0E D9000E17
@0D0F D8C00E17
@0D10 21000017
@0D11 18C00104
@0D12 D8C00E15
@0D13 D9001215
@0D14 00138C80
@0D15 D9000C17
@0D16 102D883A
@0D17 20B9C83A
@0D18 07001B0E
@0D19 00800804
@0D1A D8800805
@0D1B B805883A
@0D1C DC001115
@0D1D B02F883A
@0D1E E47FFFC4
@0D1F 902D883A
@0D20 057FFFC4
@0D21 DC000F17
@0D22 1025883A
@0D23 00000206
@0D24 8C7FFFC4
@0D25 8D400826
@0D26 90800117
@0D27 8009883A
@0D28 900B883A
@0D29 D9800804
@0D2A 01C00044
@0D2B 103EE83A
@0D2C 103FF726
@0D2D 003F3C06
@0D2E DC001117
@0D2F 9005883A
@0D30 B025883A
@0D31 9725883A
@0D32 B82D883A
@0D33 102F883A
@0D34 B8800117
@0D35 D9000F17
@0D36 D9801217
@0D37 B80B883A
@0D38 B00F883A
@0D39 103EE83A
@0D3A 103F2F1E
@0D3B 95A5883A
@0D3C 002B883A
@0D3D 003E7606
@0D3E 95A5883A
@0D3F D9400E17
@0D40 B8800117
@0D41 D9000F17
@0D42 28C00017
@0D43 D9800904
@0D44 B80B883A
@0D45 D8C00905
@0D46 D8C00E17
@0D47 01C00044
@0D48 1C400104
@0D49 103EE83A
@0D4A 103F1F1E
@0D4B 94800044
@0D4C DC400E15
@0D4D 002B883A
@0D4E 003E6506
@0D4F B8800117
@0D50 D9000F17
@0D51 00C00B44
@0D52 D8C00905
@0D53 B80B883A
@0D54 D9800904
@0D55 01C00044
@0D56 103EE83A
@0D57 103F121E
@0D58 D8C01117
@0D59 94800044
@0D5A 00FEFC16
@0D5B 003F5D06
@0D5C 056BC83A
@0D5D D8C01215
@0D5E 003F1406
@0D5F D8C01117
@0D60 8805883A
@0D61 DC001217
@0D62 B823883A
@0D63 90E5883A
@0D64 102F883A
@0D65 003F5306
@0D66 00800074
@0D67 108FBE04
@0D68 2007883A
@0D69 11000017
@0D6A 2805883A
@0D6B 300F883A
@0D6C 180B883A
@0D6D 100D883A
@0D6E 0012E641
@0D6F DEFFF604
@0D70 DC400815
@0D71 DC000715
@0D72 DFC00915
@0D73 3021883A
@0D74 2023883A
@0D75 30002416
@0D76 00808204
@0D77 D880000D
@0D78 D9400415
@0D79 D9400215
@0D7A 30001A1E
@0D7B 0005883A
@0D7C 00C00074
@0D7D 18CFBE04
@0D7E 19000017
@0D7F 380D883A
@0D80 D9C00A17
@0D81 D8800515
@0D82 D8800315
@0D83 00BFFFC4
@0D84 D880008D
@0D85 D80B883A
@0D86 00800074
@0D87 108DE604
@0D88 D8800115
@0D89 D8000615
@0D8A 0012E640
@0D8B 00FFFFC4
@0D8C 10C00A16
@0D8D 80000226
@0D8E D8C00417
@0D8F 18000005
@0D90 DFC00917
@0D91 DC400817
@0D92 DC000717
@0D93 DEC00A04
@0D94 F800283A
@0D95 30BFFFC4
@0D96 003FE506
@0D97 00C022C4
@0D98 88C00015
@0D99 003FF306
@0D9A 008022C4
@0D9B 20800015
@0D9C 00BFFFC4
@0D9D 003FF206
@0D9E 00800074
@0D9F 108FBE04
@0DA0 2011883A
@0DA1 11000017
@0DA2 DEFFFE04
@0DA3 2807883A
@0DA4 3005883A
@0DA5 D9C00015
@0DA6 400B883A
@0DA7 180D883A
@0DA8 100F883A
@0DA9 DFC00115
@0DAA 00135BC0
@0DAB DFC00117
@0DAC DEC00204
@0DAD F800283A
@0DAE 2880000B
@0DAF DEFFFA04
@0DB0 DCC00315
@0DB1 10C0020C
@0DB2 18FFFFCC
@0DB3 18E0001C
@0DB4 DC800215
@0DB5 DC400115
@0DB6 DFC00515
@0DB7 DD000415
@0DB8 DC000015
@0DB9 18E00004
@0DBA 2825883A
@0DBB 2027883A
@0DBC 3023883A
@0DBD 18002626
@0DBE 2940008F
@0DBF 28001016
@0DC0 01C01A0E
@0DC1 3821883A
@0DC2 05010004
@0DC3 00000306
@0DC4 88A3883A
@0DC5 0400150E
@0DC6 9140008F
@0DC7 880D883A
@0DC8 9809883A
@0DC9 800F883A
@0DCA A400010E
@0DCB 01C10004
@0DCC 00138F00
@0DCD 80A1C83A
@0DCE 00BFF516
@0DCF 9080000B
@0DD0 10801014
@0DD1 9080000D
@0DD2 00BFFFC4
@0DD3 DFC00517
@0DD4 DD000417
@0DD5 DCC00317
@0DD6 DC800217
@0DD7 DC400117
@0DD8 DC000017
@0DD9 DEC00604
@0DDA F800283A
@0DDB 0005883A
@0DDC DFC00517
@0DDD DD000417
@0DDE DCC00317
@0DDF DC800217
@0DE0 DC400117
@0DE1 DC000017
@0DE2 DEC00604
@0DE3 F800283A
@0DE4 00BFFFC4
@0DE5 003FED06
@0DE6 2880000B
@0DE7 DEFFFD04
@0DE8 DC000015
@0DE9 10C0020C
@0DEA 18FFFFCC
@0DEB 18E0001C
@0DEC DFC00215
@0DED DC400115
@0DEE 18E00004
@0DEF 2821883A
@0DF0 18002826
@0DF1 28C0008F
@0DF2 18001E0E
@0DF3 10C0800C
@0DF4 18FFFFCC
@0DF5 18E0001C
@0DF6 18E00004
@0DF7 18001926
@0DF8 2C400517
@0DF9 89C01216
@0DFA 3C40010E
@0DFB 3823883A
@0DFC 81000417
@0DFD 300B883A
@0DFE 880D883A
@0DFF 001386C0
@0E00 80C00517
@0E01 81000417
@0E02 0005883A
@0E03 1C47C83A
@0E04 2463883A
@0E05 80C00515
@0E06 84400415
@0E07 DFC00217
@0E08 DC400117
@0E09 DC000017
@0E0A DEC00304
@0E0B F800283A
@0E0C 10C0200C
@0E0D 18FFFFCC
@0E0E 18E0001C
@0E0F 18E00004
@0E10 183FEB26
@0E11 10801014
@0E12 8080000D
@0E13 00BFFFC4
@0E14 DFC00217
@0E15 DC400117
@0E16 DC000017
@0E17 DEC00304
@0E18 F800283A
@0E19 00BFFFC4
@0E1A 003FEC06
@0E1B 2005883A
@0E1C 29000B2E
@0E1D 2987883A
@0E1E 20C0092E
@0E1F 218B883A
@0E20 30000F26
@0E21 198DC83A
@0E22 18FFFFC4
@0E23 19000003
@0E24 297FFFC4
@0E25 29000005
@0E26 19BFFB1E
@0E27 F800283A
@0E28 30000826
@0E29 118D883A
@0E2A 1007883A
@0E2B 29C00003
@0E2C 18C00044
@0E2D 29400044
@0E2E 19FFFFC5
@0E2F 19BFFB1E
@0E30 F800283A
@0E31 F800283A
@0E32 20800007
@0E33 10000626
@0E34 2005883A
@0E35 10800044
@0E36 10C00007
@0E37 183FFD1E
@0E38 1105C83A
@0E39 F800283A
@0E3A 0005883A
@0E3B F800283A
@0E3C DEFFFD04
@0E3D DC400115
@0E3E DC000015
@0E3F 2023883A
@0E40 04000074
@0E41 840FC304
@0E42 2809883A
@0E43 300B883A
@0E44 380D883A
@0E45 DFC00215
@0E46 80000015
@0E47 001398C0
@0E48 00FFFFC4
@0E49 10C00526
@0E4A DFC00217
@0E4B DC400117
@0E4C DC000017
@0E4D DEC00304
@0E4E F800283A
@0E4F 80C00017
@0E50 183FF926
@0E51 88C00015
@0E52 DFC00217
@0E53 DC400117
@0E54 DC000017
@0E55 DEC00304
@0E56 F800283A
@0E57 DEFFFF04
@0E58 0009883A
@0E59 DFC00015
@0E5A 00139EC0
@0E5B 0013A0C0
@0E5C D1200C17
@0E5D D1600B17
@0E5E D1A00A17
@0E5F DFC00017
@0E60 DEC00104
@0E61 0010F741
@0E62 0013A441
@0E63 DEFFFF04
@0E64 DFC00015
@0E65 00800044
@0E66 2080061E
@0E67 01000074
@0E68 210FBF04
@0E69 000F883A
@0E6A DFC00017
@0E6B DEC00104
@0E6C 0013A101
@0E6D 00800074
@0E6E 108FC004
@0E6F 10800017
@0E70 10000226
@0E71 103EE83A
@0E72 00000206
@0E73 00800074
@0E74 108FC304
@0E75 00C01444
@0E76 10C00015
@0E77 00BFFFC4
@0E78 DFC00017
@0E79 DEC00104
@0E7A F800283A
@0E7B DEFFFF04
@0E7C DFC00015
@0E7D 0013AC40
@0E7E 00800044
@0E7F 1001703A
@0E80 DFC00017
@0E81 DEC00104
@0E82 F800283A
@0E83 F800283A
@0E84 20C00017
@0E85 3005883A
@0E86 2989883A
@0E87 19800104
@0E88 00000606
@0E89 31C00037
@0E8A 39FFFFEC
@0E8B 383FFD26
@0E8C 29C00007
@0E8D 29400044
@0E8E 19C00035
@0E8F 293FF936
@0E90 F800283A
@0E91 DEFFFE04
@0E92 014AAAF4
@0E93 296AAA84
@0E94 DC000015
@0E95 DFC00115
@0E96 2021883A
@0E97 00127F00
@0E98 10000F26
@0E99 0007883A
@0E9A 01600034
@0E9B 297FFFC4
@0E9C 01355574
@0E9D 21155584
@0E9E 297FFFC4
@0E9F 283FFE1E
@0EA0 18C00044
@0EA1 8121883A
@0EA2 18BFFB16
@0EA3 8405883A
@0EA4 1421883A
@0EA5 843FFFC4
@0EA6 803FFE1E
@0EA7 00000406
@0EA8 8405883A
@0EA9 1421883A
@0EAA 843FFFC4
@0EAB 043FFE16
@0EAC 0005883A
@0EAD DFC00117
@0EAE DC000017
@0EAF DEC00204
@0EB0 F800283A
@0EB1 000170FA
@0EB2 F800283A
@0EB3 20202020
@0EB4 20202020
@0EB5 20202020
@0EB6 20202020
@0EB7 00000000
@0EB8 00732520
@0EB9 65646E49
@0EBA 74732078
@0EBB 20747261
@0EBC 20727265
@0EBD 00000000
@0EBE 66206F4E
@0EBF 70706F6C
@0EC0 00000079
@0EC1 65736E49
@0EC2 66207472
@0EC3 70706F6C
@0EC4 00000079
@0EC5 61656C43
@0EC6 72772072
@0EC7 70657469
@0EC8 00746F72
@0EC9 20746553
@0ECA 74697277
@0ECB 6F727065
@0ECC 74636574
@0ECD 00000000
@0ECE 706F6C46
@0ECF 69207970
@0ED0 7265736E
@0ED1 00646574
@0ED2 63656A45
@0ED3 6C662074
@0ED4 7970706F
@0ED5 00000000
@0ED6 38346F61
@0ED7 6F532036
@0ED8 65762043
@0ED9 302E3172
@0EDA 00000000
@0EDB 69204453
@0EDC 2E74696E
@0EDD 20202E2E
@0EDE 20202020
@0EDF 00000000
@0EE0 68204453
@0EE1 65646165
@0EE2 68632072
@0EE3 2E2E2E6B
@0EE4 00000000
@0EE5 72204453
@0EE6 696E6965
@0EE7 25203A74
@0EE8 20202064
@0EE9 00000020
@0EEA 4F204453
@0EEB 2020204B
@0EEC 20202020
@0EED 20202020
@0EEE 00000000
@0EEF 68204453
@0EF0 65646165
@0EF1 6E692072
@0EF2 646C6176
@0EF3 00000000
@0EF4 68204453
@0EF5 65646165
@0EF6 4B4F2072
@0EF7 20202020
@0EF8 00000000
@0EF9 65532D2D
@0EFA 7463656C
@0EFB 4F494220
@0EFC 2D2D3A53
@0EFD 00000000
@0EFE 64616F4C
@0EFF 20676E69
@0F00 534F4942
@0F01 202E2E2E
@0F02 00000000
@0F03 69726556
@0F04 6E697966
@0F05 49422067
@0F06 2E2E534F
@0F07 00000000
@0F08 534F4942
@0F09 66727620
@0F0A 61662079
@0F0B 64656C69
@0F0C 00000000
@0F0D 534F4942
@0F0E 72657620
@0F0F 20796669
@0F10 20204B4F
@0F11 00000000
@0F12 6C65532D
@0F13 20746365
@0F14 42414756
@0F15 3A534F49
@0F16 00000000
@0F17 64616F4C
@0F18 20676E69
@0F19 4F494256
@0F1A 2E2E2E53
@0F1B 00000000
@0F1C 66726556
@0F1D 676E6979
@0F1E 49425620
@0F1F 2E2E534F
@0F20 00000000
@0F21 4F494256
@0F22 72762053
@0F23 66207966
@0F24 206C6961
@0F25 00000000
@0F26 4F494256
@0F27 65762053
@0F28 79666972
@0F29 204B4F20
@0F2A 00000000
@0F2B 78383025
@0F2C 25202D20
@0F2D 0A252564
@0F2E 00000000
@0F2F 6174530A
@0F30 6E697472
@0F31 6F612067
@0F32 2E363834
@0F33 00002E2E
@0F34 6F74530A
@0F35 6E697070
@0F36 6F612067
@0F37 2E363834
@0F38 00002E2E
@0F39 41544A0A
@0F3A 25203A47
@0F3B 0A783830
@0F3C 00000000
@0F3D 00000000
@0F3E 00000000
@0F3F 00000000
@0F40 00000000
@0F41 00000000
@0F42 02020100
@0F43 03030303
@0F44 04040404
@0F45 04040404
@0F46 05050505
@0F47 05050505
@0F48 05050505
@0F49 05050505
@0F4A 06060606
@0F4B 06060606
@0F4C 06060606
@0F4D 06060606
@0F4E 06060606
@0F4F 06060606
@0F50 06060606
@0F51 06060606
@0F52 07070707
@0F53 07070707
@0F54 07070707
@0F55 07070707
@0F56 07070707
@0F57 07070707
@0F58 07070707
@0F59 07070707
@0F5A 07070707
@0F5B 07070707
@0F5C 07070707
@0F5D 07070707
@0F5E 07070707
@0F5F 07070707
@0F60 07070707
@0F61 07070707
@0F62 08080808
@0F63 08080808
@0F64 08080808
@0F65 08080808
@0F66 08080808
@0F67 08080808
@0F68 08080808
@0F69 08080808
@0F6A 08080808
@0F6B 08080808
@0F6C 08080808
@0F6D 08080808
@0F6E 08080808
@0F6F 08080808
@0F70 08080808
@0F71 08080808
@0F72 08080808
@0F73 08080808
@0F74 08080808
@0F75 08080808
@0F76 08080808
@0F77 08080808
@0F78 08080808
@0F79 08080808
@0F7A 08080808
@0F7B 08080808
@0F7C 08080808
@0F7D 08080808
@0F7E 08080808
@0F7F 08080808
@0F80 08080808
@0F81 08080808
@0F82 00000000
@0F83 00013EC8
@0F84 00013ED0
@0F85 00013ED8
@0F86 00000000
@0F87 00000000
@0F88 00000000
@0F89 00000000
@0F8A 00000000
@0F8B 00000000
@0F8C 00000000
@0F8D 00000000
@0F8E 00000000
@0F8F 00000000
@0F90 00000000
@0F91 00000000
@0F92 00000000
@0F93 00000000
@0F94 00000000
@0F95 00000000
@0F96 00000000
@0F97 00000000
@0F98 00000000
@0F99 00000000
@0F9A 00000000
@0F9B 00000000
@0F9C 00000000
@0F9D 00000000
@0F9E 00000000
@0F9F 00000000
@0FA0 00000000
@0FA1 00000000
@0FA2 00000000
@0FA3 00000000
@0FA4 00000000
@0FA5 00000000
@0FA6 00000000
@0FA7 00000000
@0FA8 00000000
@0FA9 00000000
@0FAA 00000000
@0FAB 00000000
@0FAC 00000000
@0FAD 00000000
@0FAE 00000000
@0FAF 00000000
@0FB0 00000000
@0FB1 00000000
@0FB2 00000004
@0FB3 00000000
@0FB4 0001000A
@0FB5 00000000
@0FB6 0002000A
@0FB7 00000000
@0FB8 00000000
@0FB9 00000000
@0FBA 00000101
@0FBB FFFFFFFF
@0FBC FFFFFFFF
@0FBD 00013E08
@0FBE 00013E08
@0FBF 00008888
@0FC0 00000000
/soc/firmware/exe/mem_init/hdl_sim/sdram.dat --- soc/firmware/exe/mem_init/hdl_sim/sdram.sym (nonexistent) +++ soc/firmware/exe/mem_init/hdl_sim/sdram.sym (revision 8) @@ -0,0 +1,92 @@ + w __errno +00010000 A __alt_mem_onchip_for_nios2 +00010000 T __reset +0001000c T _exit +00010020 T _start +00010054 t alt_after_alt_main +00010058 T _Z10osd_enableb +00010078 T _Z9osd_printibPKcz +00010114 T _Z21read_byte_if_possiblev +00010134 T _Z8read_intv +0001019c T _Z5crc32PhPj +00010744 T _Z9show_menuhhb +0001094c T _Z20select_and_load_bioshjPKcS0_S0_S0_S0_ +00010b1c T _Z22runtime_menu_no_floppyv +00010d24 T _Z19runtime_menu_floppyv +00010edc T _Z12runtime_menuv +00010f60 W _Z9read_bytev +00010f74 T main +00011c98 t _fpadd_parts +00011fec T __adddf3 +00012040 T __subdf3 +000120a0 T __muldf3 +00012384 T __divdf3 +00012538 T __floatsidf +0001260c T __fixdfsi +000126d0 t udivmodsi4 +00012744 T __divsi3 +00012794 T __modsi3 +000127f0 T __udivsi3 +000127f8 T __umodsi3 +00012800 T __mulsi3 +00012828 T __muldi3 +00012938 T __clzsi2 +000129e4 T __pack_d +00012c08 T __unpack_d +00012d0c T __lshrdi3 +00012d50 T __ashldi3 +00012d94 T memcpy +00012dbc T memset +00012ddc T _printf_r +00012e18 T printf +00012e64 T ___vfprintf_internal_r +00013598 T __vfprintf_internal +000135bc T _vsnprintf_r +00013678 T vsnprintf +000136b8 T __sfvwrite_small_dev +00013798 T __sfvwrite_small_str +0001386c T memmove +000138c8 T strlen +000138f0 T _write_r +0001395c T alt_main +00013988 T usleep +0001398c T write +000139ec T alt_irq_init +00013a0c T alt_sys_init +00013a10 T altera_avalon_jtag_uart_write +00013a44 T alt_busy_sleep +00013ac4 T altera_nios2_qsys_irq_init +00013cf4 R __thenan_df +00013d08 R __clz_tab +00013e08 g impure_data +00013ee8 G floppy_writeprotect +00013ee9 G floppy_is_1_44m +00013eec G hdd_index +00013ef0 G floppy_index +00013ef4 G _global_impure_ptr +00013ef8 G _impure_ptr +00013efc G jtag_uart +00013f00 G alt_errno +00013f04 A __bss_start +00013f04 A _edata +00013f04 B floppy_is_2_88m +00013f05 B floppy_is_1_2m +00013f06 B floppy_is_720k +00013f07 B floppy_is_360k +00013f08 B floppy_is_320k +00013f09 B floppy_is_180k +00013f0a B floppy_is_160k +00013f0c B errno +00013f10 B alt_envp +00013f14 B alt_argv +00013f18 B alt_argc +00013f1c B entries +00014f1c b _ZZ5crc32PhPjE3crc +00014f3c A __alt_stack_base +00014f3c A __bss_end +00014f3c A _end +00014f3c A end +00018000 A __alt_data_end +00018000 A __alt_stack_pointer +0001bee8 A _gp +08000000 A __alt_mem_sdram
/soc/firmware/exe/mem_init/meminit.spd Cannot display: file marked as a binary type. svn:mime-type = application/xml
soc/firmware/exe/mem_init/meminit.spd Property changes : Added: svn:mime-type ## -0,0 +1 ## +application/xml \ No newline at end of property Index: soc/firmware/exe/mem_init/system_onchip_for_nios2.hex =================================================================== --- soc/firmware/exe/mem_init/system_onchip_for_nios2.hex (nonexistent) +++ soc/firmware/exe/mem_init/system_onchip_for_nios2.hex (revision 8) @@ -0,0 +1,1026 @@ +:020000020000FC +:2000000000400074084008140800683A00000000000000000000000000000000000000001E +:2000080006C00074DEE0001406800074D6AFBA1400800074108FC11400C0007418D3CF1415 +:2000100010C00326100000151080010410FFFD36001395C0003FFF0621003FCC20000226BB +:2000180000B000140000010600A0001400E8001418800035F800283ADEFFEB04DC40111518 +:200020002023883ADFC01315DC801215DC001015D9C014153025883A2821883AD809883AE9 +:20002800000B883A018010040012DBC0D809883A01401004900D883AD9C0140484003FCC12 +:20003000001367808020C03A0007883A8C4A00048020923A00000806D8C9883A2100000774 +:2000380088CD883A318D883A318D883A8108B03A3100003518C0004418BFF716DFC01317EF +:20004000DC801217DC401117DC001017DEC01504F800283A00A222141080003710E0000C28 +:200048001800022610803FCCF800283A00BFFFC4F800283ADEFFFC04DFC00315DC80021580 +:20005000DC400115DC0000150010F6001023883A0010F6001025883A0010F60010803FCCD4 +:200058001020943A94803FCC0010F6009024923A1004963A8C403FCC84A0B03A1444B03ADA +:200060001404B03ADFC00317DC800217DC400117DC000017DEC00404F800283ADEFFD30475 +:20006800DF002C15DDC02B15DD802A15DD402915DD002815DCC02715DC802615DC402515A5 +:20007000DC002415200002262801531E00000B06010000742113C7042801411E0005883AA5 +:200078000180004400C00804208B883A298000051080004410FFFC1E0001470621800003CD +:200080000005883A00C00204308BD83AD889883A108000442940004C2140000510FFFA1ECD +:20008800008000741093C704DBC0008310C005C313400743DA0000C31BC6F03ADC8000039C +:200090001B46F03A12C007C3DB000103D8C0141510C00583144007034488F03A20C6F03ACD +:2000980062C8F03AD9000215D94002171C46F03A11000543138006C31AC6F03ADCC00043A8 +:2000A000D8C0151510C007832908F03A2388F03A9CA0F03A20C8F03A2408F03ADA400143C8 +:2000A8009BD4F03AD900161511000503DA80041512800683DD0004172248F03A2288F03A94 +:2000B0001B6CF03A2508F03A8B78F03A2588F03AD9001715E2C8F03AD9C00183D90006153A +:2000B800110004C31180064393EAF03AD940061721C8F03AAA2EF03A2188F03A25C8F03A9A +:2000C0002148F03AD90018159A08F03A7468F03A2308F03ADD400815DDC00315DF00051578 +:2000C800D9000915A0EAF03AD94001C3DD000A151500048311000603DDC00917A168F03AEE +:2000D000A128F03AA5E8F03AA568F03ADD400B15732AF03ADD001915AA68F03AA2A8F03A70 +:2000D800DD000C15DF000C17150004435CAEF03ABA6EF03AE528F03ADD001A15BAAEF03A51 +:2000E00015000403B9EEF03AB9AEF03ABD28F03A1CE6F03A31EEF03ADCC00D15B966F03AF7 +:2000E8009926F03ADCC00715DD001B1514C003C3DD000717DF000D1764A4F03AA4E6F03ACC +:2000F000150003839F26F03ADCC01C152166F03A9D28F03ADD001D156BE8F03ADD000E156D +:2000F800DF000E1715000343DC800F1572E4F03AE528F03A17000303DD001E158A28F03A49 +:20010000A738F03ADF001F15DF000F17DC801015E4B8F03A148002C3E4A4F03ADC802015DB +:200108008264F03A1AF8F03ADC801115DF001215E2A4F03ADF001117DC8013155B56F03AED +:20011000E4B8F03A14800283435AF03A6C62F03AE4A4F03ADC80211514800243DF00051719 +:2001180088E2F03ABCA4F03ADDC004178A62F03A8AA2F03A95E4F03A95A4F03ADC802215EC +:200120001480020343ECF03A89E2F03A9CA4F03A9724F03A95A4F03ADC802315DC80061779 +:20012800DF0002175B16F03AACAEF03ADD400317148001C31340010389A2F03AACA4F03AEB +:2001300095E4F03AE3AAF03ADC800315A8EAF03A14800183AA6AF03AAAAAF03AACA4F03AD7 +:200138009424F03A9524F03A5B9CF03A8962F03A48D6F03A8922F03ADC8002155A96F03A02 +:20014000148001438B5AF03A59D6F03ADC4004175996F03A83DEF03A5CA4F03A6C78F03A4C +:2001480093E4F03ADC400C1793AAF03ADC800A178968F03A219AF03A144000836C9AF03ACC +:20015000DC800E17A128F03A5252F03AA462F03A128000438CA2F03ADD00051749E4F03AA0 +:200158006218F03A91A4F03A9294F03A61D8F03A5514F03A6158F03A6358F03A55ACF03A4B +:20016000134000C312800003DD001217635AF03A6298F03ADA8007177A1EF03ADA000D178B +:200168005420F03A8520F03A14000045DC001117DD0013179A26F03A5410F03A4510F03AAF +:2001700014C0000512000085DA000F17DA80101738C6F03A9224F03A1986F03A92A4F03A4D +:20017800DC0009171946F03A4952F03A148000C51906F03ADC800B174912F03A1BC6F03A6D +:200180004C10F03A1DC6F03ADD000617DDC008174490F03AD9002317D9402217DA80201722 +:200188001200010510C00145DA002117D8C003171440028517000305DC001F17DF00021761 +:20019000DC401E175D16F03A4DD2F03ADC801D175BDEF03A4B9CF03A1540034517000385D8 +:2001980010C003C5110004051140044512000485128004C513C00185138001C51300020539 +:2001A00015800245134002C5140005051440054514800585DD001C17DD401B17DDC01A1742 +:2001A800DF001917D8C01817D9001717D9401617DA001517DA801417150005C5154006054A +:2001B00015C006451700068510C006C5110007051140074512000785128007C500000E0608 +:2001B800280000150007883A0005883A024007C401800804208F883A3A000003488FC83A39 +:2001C0001080004441CE983A19C6B03A11BFF91E00C6303A28C00015DF002C17DDC02B178C +:2001C800DD802A17DD402917DD002817DCC02717DC802617DC402517DC002417DEC02D044F +:2001D000F800283ADEFFF504DD800715DC400215302D883ADFC00A15DF000915DDC008159F +:2001D800DD400615DD000515DCC00415DC800315DC0001150023883A00C0007418CFC704F2 +:2001E00029803FCC00802004880E917A05400074AD4FC70438CF883A39C00003390E703AD0 +:2001E80031C003268C40004488BFF71E00004D0600801FC429403FCC00FFFFC4100C917A5E +:2001F000A98D883A31800003310C703A2980022610BFFFC410FFF91E146FC83A0500004405 +:2001F8000021883A84FFFEC4048010040700400498000116BCC0060E9009883A000B883A75 +:2002000001800074318EB30400100780000011069C05003A100B883A9009883A01800074BD +:20020800318EB304D8800015001007809C4F883A380E917AD88000179009883AA9CF883A5A +:20021000100B883A01800074318EB80439C0004400100780948004049CC00044973FE41E19 +:200218000480004400A2241410C000371900004C200025261900008C200021261900010C1B +:200220002000042618C0020C180021260025883A003FF5068C05883A00002006843FFFC40F +:200228000000010684000044A0803FCC1000062690803FCC10000426010000B42121A80488 +:2002300000139880003FC706010001742124F804001398809029883A003FC20600BF8304CD +:2002380000000E06010024040140004401800074318EB9040010078000BFFFC4000007064D +:20024000803FE61E003FE80685FFE616003FE606B0803FCC103FE426003FF006DFC00A177A +:20024800DF000917DDC00817DD800717DD400617DD000517DCC00417DC800317DC400217CB +:20025000DC000117DEC00B04F800283ADEFBF504DD040515DC4402152829883A2023883A77 +:20025800000B883A01000C04DC040115DFC40A15DF040915DDC40815DD840715DD44061578 +:20026000DCC40415DC8403153821883A0010078001003FC489403FCC000D883A0010744030 +:200268001000521600E83014012900141800003518C00104193FFD1EA028913A800D883A15 +:20027000000B883AA009883AD884001500100780D884001700C0007418CFC70405C001040B +:200278001004917A05400204058000841885883A114006431100068310C00604148006C329 +:2002800019800003280A923A2008943A9024963A298AB03A2148B03A114005439124B03A22 +:200288001100058310C00504140005C319800003280A923A2008943A8020963A298AB03A6B +:20029000108004042148B03A8120B03A1100004310C0008314C000C3114000032008923A52 +:200298001806943A9826963A2148B03A1906B03A98E6B03A07000304000016060005883A17 +:2002A00016C00035BCC00035AD400035E58000350023883A010000B42121A8040013988013 +:2002A8008880003715BFFB1E008400048023883A1400012E1023883A9009883AD80B883AE5 +:2002B000880D883A0012D9409465883A8461C83A9CC00204803FE91ED9840D17A009883AF6 +:2002B800000B883A001007800005883ADFC40A17DF040917DDC40817DD840717DD440617B7 +:2002C000DD040517DCC40417DC840317DC440217DC040117DEC40B04F800283ADEFFFC04D3 +:2002C80001000404000B883A01800074318EBE04DFC00315DC800215DC400115DC0000157D +:2002D0000010078001002404000B883A01800074318EC1040010078000A8901400E8A01489 +:2002D8001100003721003FCC21004014110000351080010410FFFA1E0440004404A22414B5 +:2002E000040000449080003700E224141100004C20005B261100008C200059261100010CFD +:2002E800200004261080020C0021883A10005726003FF406008003C419000037210003CCDE +:2002F00020BFFD1E0400004401003C0401400404800D883A0010744000FF830410C04B2648 +:2002F8001000080E010007F421212004DFC00317DC800217DC400117DC000017DEC0040463 +:2003000000139881D0A002151004917A00C0007418CFCB04D420000510C5883A11400043FD +:2003080010C00083110000C311800003280A923A1806943A2008963AD0A00883298AB03AA0 +:200310001946B03A20C8B03A1000121ED0A008431000101ED0A0080310000E1ED0A007C388 +:2003180010000C1ED0A007831000081ED0A007431000081ED0A000431000081ED0A0070308 +:2003200010000826008010040000070600803004000005060005883A0000030600802004AB +:20032800000001060080080400E200140140004419400035D160000300E201141940003560 +:2003300000E206141900003500E20C141880003500000E0680803FCC10000426010000B486 +:200338002121A80400139880003FA506010001742124F804001398808023883A003FA00676 +:2003400088803FCC103FF31E003FF806DFC00317DC800217DC400117DC000017DEC00404F2 +:20034800F800283ADEFFFB0401000404000B883A01800074318ECE04DCC00315DC0000155E +:20035000DFC00415DC800215DC40011504C00044001007800400024400A8201400E900146E +:20035800100000351080010410FFFD1E8008913A000B883A01800074318ED2040010078040 +:20036000D0A00003844000448808913A1000032601800074318EC5040000020601800074F4 +:20036800318EC904000B883A0010078000A8901400E8A0141100003721003FCC21004014B4 +:20037000110000351080010410FFFA1E0480004400E22414188000371100004C20003526E2 +:200378001100008C200030261100010C200004261080020C0025883A10003126003FF506C4 +:200380000080024480800D1E00BFFFC4D0A0021500800044D0A0000500A20014100000352F +:2003880000A2011400C0004410C0003500A20C1400C0080410C00035000021060080020455 +:2003900080801F1ED0A0000300E201141080005CD0A0000510803FCC1880003500001806BF +:200398008023883A00000E060400020498803FCC1000062690803FCC10000426010000B459 +:2003A0002121A80400139880003FB306010001742124F804001398809027883A003FAE06DE +:2003A8008821883A003FF1060080020480BFEC1E003FFB060080024480BFEC1E003FEA0647 +:2003B000DFC00417DCC00317DC800217DC400117DC000017DEC00504F800283ADEFFFE0441 +:2003B800DFC00115DC00001500A8101400E90014100000351080010410FFFD1E00A80014F6 +:2003C00000F0001410C0003501222414008003C420C000370422241418C003CC18BFFC1E65 +:2003C800D0A002171000020E0010B1C0000001060010D24000A8001400E0001410C000350D +:2003D000008003C480C0003718C003CC18BFFD1EDFC00117DC000017DEC00204F800283A0E +:2003D800012222142080003710E0000C183FFD26F800283ADEFE7304DFC18C15DD818B1573 +:2003E000DD418A15DD018915DCC18815DC818715DC418615DC01851500A2281400C0403450 +:2003E80018FC3A8410C0003500A2291400C03C0410C0003500A2181400C0004410C0003563 +:2003F0000428001400A0001480800035010003F421109004001398808005883A8007883A4C +:2003F800012900141000003510800104113FFD1E00B00014188000350009883A000B883A39 +:2004000001800074318ED6040010078001000404000B883A01800074318EDB0400100780B7 +:20040800000B883A01800074318EE0040100080400100780010003F42110900400139880E3 +:200410000005883A140000370480008404400304000014060140004401800074318EE5042B +:20041800800F883A0010078000000406010003F4211090040013988084000037803FFB264F +:20042000008000448080071E8C00003588000035010003F421109004001398800005883AA6 +:20042800140000370100040484BFEA1E000B883A01800074318EEA040010078004C00074D7 +:200430009CCFC7040005883A14C0003500800104100000350080020410800035008003040A +:20043800140000350023883A04000084010000B42121A8040013988088800037143FFB1E75 +:200440000005883A01001FC400C020041022917A9C4B883A294000032900221E0009883A87 +:20044800000B883A001019C00021883A000004069C09883A000B883A001019C0840000440C +:20045000847FFB1E9C21883A0009883AD941830484000404D8018315001019C081000043DB +:2004580080C00083808000C3814000032008923A1806943A1004963A2148B03A1906B03A1A +:2004600010C4B03AD8C1831718800926010008040140004401800074318EEF0400100780F4 +:200468000002B2061080004410FFD81E003FF70601000804000B883A01800074318EF4041F +:200470000010078000A8101400E90014100000351080010410FFFD1E00800074108F03046E +:20047800D880001500800074108F0804D88001150100004400800074108F0D04D880021592 +:20048000200B883A01800074318EF90401C0007439CEFE04001094C01002941600A8201484 +:2004880000E90014100000351080010410FFFD1E00800074108F1C04D8800015008000743F +:20049000108F2104D88001150100008400800074108F2604D8800215200B883A0180007487 +:20049800318F120401C0007439CF1704001094C010027E1600A8101400E9001410000035FE +:2004A0001080010410FFFD1E01003FC4014000C4000D883A0010744010027416D0A00115BF +:2004A80000E0001400A8001410C000350021883A04404004808900048009883A1085883A65 +:2004B00010A5883A001253800009883A01501C34100D883A180F883A001204000009883ABB +:2004B80001504BF429612004100D883A180F883A001238401009883A180B883A01AAAAF48B +:2004C00031AAAAC401D0107439EAAA8400120A00100D883A180F883A0009883A015073B406 +:2004C80029735944001238401009883A180B883A001260C09080003584000044847FDD1E54 +:2004D00000A5001400C2580410C0003500A5011400C04E0410C0003500A2201400C006447F +:2004D80010C00035D420070380803FCC100002260540140400000706D0A00043103FFC1E38 +:2004E000D0A00743103FFA1ED0A00783103FF81E05400A04D5A00883B0803FCC10001D1EA3 +:2004E800D0A0084310001E1ED0A0080310C03FCC1802161ED0E007C31802161ED0E0078347 +:2004F0001802141ED0E007431802141ED0E000431802141E80C03FCC18021426044009042B +:2004F80000021306D0A007C31002151ED0A007831002151ED0A007431002151ED0A0004359 +:200500001002151E80803FCC100215260485A00400021406048050040440020400000206CB +:2005080004805A0404400244050000440102FB3421308004880B883A00127440D0E0021733 +:2005100018001216B5803FCCB001E31ED0E008431801E11ED0E008031801DF1ED0E007C33B +:200518001801DD1ED0E007831801D91ED0E007431801D91ED0E000431801D91E84003FCCC9 +:200520008001D926040010040001D806040008040007883A0122001420C00035D12000032B +:2005280000E201141900003500E202141D40003500E203141C40003500E204141C8000358F +:2005300000E205141D00003500E20614180000351009883A0012538001AAAAF431AAAAC4C3 +:2005380001D0107439EAAA841009883A180B883A00123840180B883A1009883A001260C0C1 +:2005400000E207141880003500A2081400DD4BC410C0003500A2091400F0D3D410C00035C7 +:2005480000A20A1400FA97D410C0003500A20B1400CEA5C410C0003500A20C141400003561 +:20055000D0A001171004917A98A7883A9900054398C00583988005049C0005C31140000349 +:200558002008923A1806943A8020963A2148B03A1906B03A9900064380E0B03A98C00683CA +:20056000988006049C8006C3114000032008923A1806943A9024963A2148B03A1906B03A60 +:200568009900074390E4B03A98C00783988007049C4007C3114000032008923A1806943A53 +:200570008822963A2148B03A1906B03A9900044388E2B03A98C00483988004049CC004C33F +:20057800114000032008923A1806943A9826963A2148B03A1906B03A800B883A9009883A9D +:2005800098E6B03A001280001009883A880B883A1029883A00128000D9000304000B883AF7 +:2005880001810004102B883A0012DBC000801004D8800315009053C4D8800D15D8801E1573 +:200590000088120400D21104D8801F1500985C84D8C00E15D880201500CC0C0400991904E8 +:20059800D8C00F15D8C01015010000C400CC0804D8802115009C9A4401408004D8C01115A2 +:2005A000D900171500C80804D880221501000104009D9944D8C01215D8C01315D8C0141513 +:2005A800D8C01515D8C01615D8802315D8C02415D8C02515D8C02615D8C02715D8C02815FF +:2005B000D8C02915D8C02A15D8C02B15D8C02C15D8C02D15D8C02E15D8C02F1500800404B4 +:2005B800D9400815D9401815D9001915D8C03015D880321500800044D8803315008001C47B +:2005C000D880381500801F84D8C03115D880531500C01E04009D0004D8C04415D8C045154F +:2005C800D8C04615D8C04715D880561500D00004D880591500980044D8C05515D8C05715ED +:2005D000D8C05815D8C05A15D8806015D9403415D9403615D9403715008FFFC48007883A6C +:2005D8001400012E1007883A8804927AD8C00415D8C0391510BFFFCCD8800715A804D43AF0 +:2005E000A8FFFFCCD8C03C15D8C03F15D8C06715DC800615DC400915DC803A15DC403B15D8 +:2005E800D8803D15D8804015D88068150007883A0162101401010004D980030430C5883A5A +:2005F00011C0011711800017380E943A3984B03A2880003518C00204193FF71E00A21114B0 +:2005F8001400003500A212141480003500A21314144000358809883A900B883A0012800075 +:2006000000E21414188000351009883A800B883A0012800000E215141880003500A21614A5 +:2006080014C0003500A3801400C072B418F0DFC410C0003500A3811400C3938410C00035E5 +:20061000D0A007031000081ED0A000431000081ED0A007831000081ED0A007431000082609 +:2006180004C008040000070604C014040000050604C010040000030604C00C040000010642 +:2006200004C00404008100041400DA36008004041480D83600800FC41440DA2E0000D50691 +:2006280005000084D9010304000B883A018080040012DBC00080048400C02004D881071568 +:20063000D8810815D8C1101500800044D8C1181500C00BC4D8810915D8C11C15008000C4D8 +:2006380000C03FC4D8810A15D8C1211500800444D8C1221500C03204D8810B15D8C12315C0 +:20064000008004C400C001C4D8810C15D8C138150080098480C03FCC8020D23AD8810D15EE +:200648000080008401003C04D8810E15D881191500803F0484003FCCD9011515D8811B156B +:2006500001000344D88134159CC03FCC00800804A5003FCCD8813515D8813A15D8C11E15E6 +:20065800D8C12415D8813015D9011715DCC11315DC011F15DC812015DC012515DC41261535 +:20066000DD013C15008004040007883A01400B841089883A2109883AD98103043109883A86 +:20066800210000171080004420C7883A117FF81E18BFFFCC1005D23A18C03FCCD8C1321591 +:20067000D8813115017FFFF4295D000400A3001400E38014D98103043089883A2149883A98 +:2006780021000017110000351080010410FFF91E0007303A00BFFF841884703A1001703A75 +:200680000010EDC000A218141000003500A22414108000371080010C1000011E0010EDC060 +:2006880000101140103FF9161000401E001013401029883A04020034001013400009883A5F +:20069000000B883AA421883A102B883A8023883A001019C00027883A0025883A00001206C3 +:200698000010F600888000058809883A000B883A001019C09080FFCC1000081E9809883AB2 +:2006A000A80B883A00127F0001000074210F2B04880B883A100D883A0012E1809480004461 +:2006A8008C4000449CC01904957FED1E001013400009883AD94184041023883AD801841553 +:2006B000001019C00009883A000B883AD8018315001019C0A4A5883A0082003490A5883A97 +:2006B800000004068009883A000B883A001019C08400004484BFFB1E0009883AD941830487 +:2006C000001019C0D88184178880041ED88183178880021E00801644000001060080138400 +:2006C80000E2221418800035003FB80600C01CC410C0061E01000074210F2F040012E18051 +:2006D00000A21814100000350000080600C0190410C0091E01000074210F34040012E180C5 +:2006D80000A2181400C0004410C0003500A2221400C002840000140600C01D8410C0031EA1 +:2006E00000A8001400F0001400000F0600C0188410C0031E00A8001400E0001400000A0618 +:2006E80000C01A8410C0061E00A223141140003701000074210F39040012E180003F930612 +:2006F00000A2221400C0138410C00035003F8F0604003004000005060021883A00000306B3 +:2006F80004002004000001060400080400C00044003E2806008000B4153F29360500004403 +:20070000003F28060029883A003F260604400204000007060440024400000506044003C41F +:200708000000030604400484000001060023883A10803FCC103DEB260480A00400000906E0 +:200710000480B40400000706048168040000050604825804000003060482D0040000010638 +:200718000025883A05000084003DF0060005883ADFC18C17DD818B17DD418A17DD018917D7 +:20072000DCC18817DC818717DC418617DC018517DEC18D04F800283A2005883A21000017A6 +:2007280001C000443900622E28C0001738C05F2E01C0010421C0C62619C05C2601C000842C +:2007300019C06B2621C0592611C002172AC0021713000317134004173AC9C83A2A0003170E +:200738002A4004172015883A2000751600C00FC41A8050160100870E50FFF804180099163F +:2007400048D6D83A001D883A18009E160100004420C6983A0015883A513FFFC42295403A66 +:200748001A87C83A1A52703A2210703A4250B03A4010C03A42D0B03A7013883A11000117CC +:200750002880011720804126200063264305C83A4091803A4B47C83A1A07C83A18006316FC +:200758003000011531C002153080031530C0041511FFFFC4388B403A194BC83A01040034B3 +:20076000213FFFC42140173629008226314002170284003452BFFFC4033FFF84297FFFC48F +:20076800000001063A804A261089883A2091803A18C7883A227FFFC440D1883A490F403AD0 +:2007700041CFC83A2817883A2005883A4007883A297FFFC451FFF32E3100031532000415F6 +:2007780032C00215010000C43100001501080034213FFFC420C00B2E180E97FA1008D07ABB +:20078000314002171806D07A1080004C3908B03A1108B03A294000443100031530C004155E +:20078800314002153005883AF800283A2805883AF800283A59C01E0E110001172880011701 +:200790000011883A0013883A20BFBF1E4305883A1207803A4B53883A1A47883A310001153E +:2007980031C002153080031530C00415003FDD0620FFEF1E3100001510C0011730C00115E6 +:2007A00010C00217110001172940011730C0021510C003172908703A30C0031510C00417E7 +:2007A800310001153005883A30C00415F800283A580F883A0019883A001B883A003F9F06CB +:2007B0000115C83A00C00FC41ABFDA16003F8906627FB52E003FC0066205C83A6099803A02 +:2007B8006A47C83A1B07C83A183F9D0E0085C83A1008C03A00C7C83A1907C83A010000447F +:2007C0003100011531C002153080031530C00415003F9706203F892650FFF8043A8F883A39 +:2007C8001800231668D6D83A001D883A18001C160100004420C6983A0015883A513FFFC420 +:2007D0002295403A1A87C83A1B5A703A2318703A6358B03A6018C03A62D8B03A701B883AA9 +:2007D800003F76064808907A02C007C45A97C83A22C8983A4296D83A4A9CD83A22D6B03AEC +:2007E000003F610600C000441A94983A0007883A003F6106013FFF8421FF7C2E003F9106FD +:2007E80000C000441A94983A0007883A003FE3066816907A010007C42289C83A5908983A48 +:2007F0006296D83A6A9CD83A22D6B03A003FD706193F971E1100011728C0011720FF9426BA +:2007F80000800074108F3D04F800283ADEFFEC04D9001115D9401215D9001104D9400A0492 +:20080000DFC01315D9C01015D9800F150012C080D9000F04D94005040012C080D9000A043D +:20080800D9400504D80D883A0011C9801009883A00129E40DFC01317DEC01404F800283A09 +:20081000DEFFEC04D9001115D9401215D9001104D9400A04DFC01315D9C01015D9800F15A5 +:200818000012C080D9000F04D94005040012C080D8800617D9000A04D9400504D80D883AE9 +:200820001080005CD88006150011C9801009883A00129E40DFC01317DEC01404F800283A5B +:20082800DEFFE404D9001115D9401215D9001104D9400A04DFC01B15D9800F15D9C010158D +:20083000DDC01A15DD801915DD401815DD001715DCC01615DC801515DC401415DC00131568 +:200838000012C080D9000F04D94005040012C080D8C00A170080004410C01136D8C00B17A0 +:20084000D8800617D9000A041884C03AD8800B1500129E40DFC01B17DDC01A17DD80191712 +:20084800DD401817DD001717DCC01617DC801517DC401417DC001317DEC01C04F800283A83 +:20085000D900051711000636D8800617D8C00B17D90005041884C03AD8800615003FEC06FB +:20085800008001041880051E0080008420BFE31E01000074210F3D04003FE5062080031E8B +:200860000080008418BFFA26003FEF060080008418BFDA2620BFEC26DC000D17DD00081781 +:20086800DC8009178009883A000B883AA00D883A000F883A00128280DC400E179009883AEC +:20087000800D883A000B883A000F883A102F883A1827883A00128280900D883A8809883AB3 +:20087800000B883A000F883A102B883A1821883A001282808809883A000B883AA00D883A27 +:20088000000F883A102D883A1825883A00128280154B883A2889803A1C07883A20C9883A58 +:2008880024004B368100011E2D4049360011883A0007883A2CCB883AB80D883A2CC0012E28 +:2008900002000044258F883A3909803ADA400C172489883AD880071720C9883ADA800B1747 +:20089800D8C006173A11883A4885883A50C6C03A41CF803A12400104D8C001153909883A0C +:2008A000DA400215034800346B7FFFC44007883A6900102E10800144180ED07A18C0004CC2 +:2008A800201097FA281697FA2008D07A3014D07A2812D07A1019883A180002265A8CB03A21 +:2008B0004960003441C6B03A10800044693FF236DB000215034400346B7FFFC469001336EA +:2008B800D880021710BFFFC418D3883A48C7803A2109883A190F883A3191883A4197803ABB +:2008C0002955883A1019883A4807883A3809883A2800010E48C00054400D883A5A8B883A90 +:2008C80010BFFFC469FFF02EDB00021518803FCC01C0200411C00926008000C4D900041548 +:2008D000D8C00315D8800015D809883A003F70060011883A00C00044003FB60619C0400C9C +:2008D800383FF51E314AB03A283FF3261885883A10CB803A00FFC00410C6703A2909883A66 +:2008E000003FED06DEFFF104D9000C15D9400D15D9000C04D9400504DFC00E15D9800A157A +:2008E800D9C00B150012C080D9000A04D80B883A0012C080D8C005170080004410C0053684 +:2008F000D900050400129E40DFC00E17DEC00F04F800283AD900001711000536D809883A68 +:2008F80000129E40DFC00E17DEC00F04F800283AD9800617D940011700800104314AF03A50 +:20090000D940061518800226014000841940041E193FEB1E01000074210F3D04003FE9062E +:200908002080332621403726D8800217D9000717D8C00917DA0004172089C83AD900071563 +:20091000D8800817DBC003171A00023640C0081E13C0072E108B883A288D803A18C7883AAE +:20091800213FFFC42805883A30C7883AD900071501400F44000F883A010400340019883A86 +:20092000001B883A201697FA3814D07A297FFFC41A00093613CDC83A1193803A1A1DC83A40 +:2009280040C0011E13C004363005883A7247C83A61D8B03A691AB03A108D883A3093803A65 +:2009300018C7883A5A8EB03A2008D07A3005883A48C7883A283FEB1E61003FCC01402004B9 +:2009380021400B26DB000815DB400915003FB406D8000815D8000915D8000715D900050422 +:20094000003FB006D8800515D9000504003FAD066140400C283FF31E30C4B03A103FF126B3 +:200948006109883A2305803A033FC0042318703A135B883A003FEB062004D7FADEFFF90467 +:2009500000C000C4DFC00615DC000515D8C00015D88001152000081E00800084D880001581 +:20095800D809883A00129E40DFC00617DC000517DEC00704F800283A00C00F04D8C00215B3 +:2009600010000F1E2021883A8009883A00129380110007440100110E10FFFF4418001216B9 +:2009680080C6983A0009883A014007C42885C83AD9000315D8C00415D8800215003FE80693 +:2009700000A0003420800E260121C83A8009883A0012938011000744013FEF16DC00031596 +:20097800D8000415003FDE06800AD07A00C007C41907C83A28C6D83A8108983A003FEA0640 +:200980000005883A00F07834003FD706DEFFF804D9000515D9400615D9000504D80B883A51 +:20098800DFC007150012C080D880001700C0008410C01C2600C0004418801A2E00C00104D4 +:2009900010C01126D88002171000161600C0078418800D1600C00F041885C83A10FFF80410 +:20099800D9400317D90004171800121620C4D83AD8C00117180008260085C83ADFC00717A8 +:2009A000DEC00804F800283AD880011700E000341005003A1885C83ADFC00717DEC008045A +:2009A800F800283A0005883ADFC00717DEC00804F800283A2008907A018007C4308DC83A10 +:2009B0002188983A2884D83A2084B03A003FE8062005883A2900182E28001716010008047B +:2009B80000C00044000002062000112628000516294B883A213FFFC418C7883A28BFFA3668 +:2009C00018000B260009883A114002361145C83A20C8B03A1806D07A280AD07A183FFA1EFD +:2009C8003000021E2005883AF800283AF800283A0009883A003FFA0600C000440009883A4B +:2009D000003FF106DEFFFE04DFC00115DC00001520000A160021883A28000B16000D883A11 +:2009D80000126D00800001260085C83ADFC00117DC000017DEC00204F800283A0109C83A9E +:2009E00004000044283FF50E014BC83A8400005C003FF206DEFFFF04DFC000152000051611 +:2009E80028000C1601800044DFC00017DEC0010400126D010109C83A28000B1601800044ED +:2009F00000126D000085C83ADFC00017DEC00104F800283A014BC83A01800044DFC0001765 +:2009F800DEC0010400126D01014BC83A003FF306000D883A00126D010180004400126D01A2 +:200A00000005883A2000072620C0004C2008D07A180001261145883A294B883A203FFA1E20 +:200A0800F800283AF800283ADEFFF604DD400515DD000415257FFFCC353FFFCCDCC00315B4 +:200A10003026D43ADD800615DC800215DC4001152024D43A2023883A282D883AA009883A6C +:200A1800A80B883ADFC00915DF000815DDC007153839883ADC0000153021883A001280000E +:200A2000A80B883A9809883A102F883A00128000A009883A900B883A102B883A00128000F4 +:200A28009809883A900B883A1029883A001280001007883AB804D43AA549883A2089883AA3 +:200A30002500022E008000741887883A200CD43A2004943AE00B883A8809883ABDFFFFCC49 +:200A380019A3883A15EF883A001280008009883AB00B883A1025883A001280009085883AA0 +:200A40001447883AB805883ADFC00917DF000817DDC00717DD800617DD400517DD000417D7 +:200A4800DCC00317DC800217DC400117DC000017DEC00A04F800283A00BFFFD411000B3652 +:200A500000803FC411001E2E00C0020420C8D83A00C0007418CF4204008006041909883A17 +:200A580020C0000310C5C83AF800283A0080403410BFFFC411000936008004041007883A33 +:200A600020C8D83A00C0007418CF42041909883A20C0000310C5C83AF800283A00C0060459 +:200A680020C8D83A00C0007418CF4204008002041909883A20C0000310C5C83AF800283A95 +:200A70000007883A20C8D83A00C0007418CF4204008008041909883A20C0000310C5C83A18 +:200A7800F800283A20800017DEFFF804DCC00315DC800215DFC00715DD800615DD400515E3 +:200A8000DD000415DC400115DC00001504800044244003172400041724C001179080422E3C +:200A880000C0010410C03C2600C0008410C019268C04B03A100017262100021700BF0084C0 +:200A9000208040160080FFC41100331688803FCC00C0200410C0292688801FC41463803A81 +:200A98008C21883A1023883A0088003410BFFFC414001C362100FFC48006963A8804D23A54 +:200AA0008020913A2101FFCC1884B03A8020D33A000003060009883A0005883A0021883A2D +:200AA8002008953A982697FA00C0043418FFFFC480E0703A8106B03A1CC6B03ADFC0071712 +:200AB000DD800617DD400517DD000417DCC00317DC800217DC400117DC000017DEC008047F +:200AB800F800283A800697FA8804D07A210100048020D07A18A2B03A003FDF0688C0400C6B +:200AC000183FD9268885883A1463803A8C21883A1023883A003FD4060101FFC40005883AB7 +:200AC8000021883A003FDE068400023400C0043418FFFFC48805883A80E0703A0101FFC45E +:200AD000003FD7061129C83A00800E0415002716800B883AA00D883A8809883A0012D0C019 +:200AD8009009883A000B883AA00D883A102D883A182B883A0012D5001009003A1907C83A07 +:200AE00010BFFFC41C20703A1444703A1404B03A1004C03A1584B03A11003FCC0140200468 +:200AE800A807883A2140131E1140400C280004261109883A2085803A1547883A2005883ABC +:200AF0001808963A1004D23A1820913A01440034297FFFC42084B03A8020D33A010000446F +:200AF80028FFAF360009883A003FAD060005883A0007883A11001FC42085803A10C7883A99 +:200B00002005883A003FEE062180011720C000173004D7FA3008D53A288001152101FFCC14 +:200B08000080043410BFFFC43084703A20001A1E1888B03A200026261808D63A1004923AC7 +:200B100001BF0084298002152084B03A010000C42900001502040034423FFFC41806923AC8 +:200B180040801836013F004418CD883A30C7803A1085883A1885883A200F883A3007883A33 +:200B2000213FFFC440BFF82E29C0021528C0031528800415F800283A01C1FFC421C00F26B7 +:200B2800180CD63A1004923A213F00441806923A3084B03A29000215010000C410840034A0 +:200B30002900001528C0031528800415F800283A0080008428800015F800283A1888B03AA7 +:200B3800200005263180022C300006260100004429000015003FF30600800104288000151A +:200B4000F800283A28000015003FEE062005883A2807883A30000826010008042189C83ADC +:200B48000100060E1184D83A2908983A298CD83A2084B03A3007883AF800283A0105C83A1E +:200B5000000D883A2884D83A3007883A003FFA062005883A2807883A30000826010008047D +:200B58002189C83A0100060E1108D83A2986983A118C983A20C6B03A3005883AF800283A80 +:200B60000107C83A000D883A10C6983A3005883A003FFA062005883A30000726218D883A0A +:200B68002007883A29C0000318C000442940004419FFFFC519BFFB1EF800283A2005883AC1 +:200B700030000526218D883A2007883A1940000518C0004419BFFD1EF800283ADEFFFD040C +:200B7800DFC00015D9800115D9C002152080021700C0007418CDAE04280D883A10C0011529 +:200B8000100B883AD9C001040012E640DFC00017DEC00304F800283ADEFFFC04DFC000155C +:200B8800D9400115D9800215D9C0031500800074108FBE041080001700C0007418CDAE0436 +:200B9000200B883A10800217D980010410C001151009883A00135980DFC00017DEC0040448 +:200B9800F800283ADEFFE004D8C00804DDC01D15DD401B15DD001A15DCC01915DC80181503 +:200BA000DC001615DFC01F15DF001E15DD801C15DC401715D9000F15D9C00E153021883AA7 +:200BA8000025883AD8001415D8000D150029883AD8000B15D8000C15D8001315D800101572 +:200BB000002B883A04C00044D8C00A15282F883A80C000038400004418803FCC1080201CE6 +:200BB80010BFE00410001426ACC030269D401F16A83FF71E010009441100D926B8800117A2 +:200BC000D9000F17D8C00905B80B883AD980090401C00044103EE83A1000A31E80C00003FC +:200BC800948000448400004418803FCC1080201C10BFE004103FEC1E9005883ADFC01F1746 +:200BD000DF001E17DDC01D17DD801C17DD401B17DD001A17DCC01917DC801817DC40171792 +:200BD800DC001617DEC02004F800283A01000084A9001226010000C4A93FD51E1C7FF4043F +:200BE0008C403FCC0100024424401B36D9000B1700BFFFC42080EA2601400284001280009C +:200BE80088A3883ADC400B15003FC90601000C041100DE26010009441100FD261C7FF4047B +:200BF0008C403FCC0100024424400936D9000C1700BFFFC42080D8260140028400128000AF +:200BF80088A3883ADC400C1505400084003FB80601000B841100A72601401B041140A32605 +:200C0000D9000B1700BFFFC42080E626D800101518FFEA0418C03FCC0080080410C0022E3A +:200C0800002B883A003FAA0618C7883A18C7883A01400074294C11041947883A188000179E +:200C10001000683A000133DC0001302000013020000130200001302000013020000130201C +:200C180000013020000130200001302000013020000133EC000130C80001302000013020BD +:200C20000001302000013020000130C8000130200001302000013020000130200001302084 +:200C2800000131B00001302000013020000130200001343800013020000131B400013020E2 +:200C300000013020000133E4D8C00D1718003926D9000E1700C00044254000172100010464 +:200C3800D9000E15D8C00D15A8012116D8001215D823883AA800371ED9400B17D809883A6F +:200C400001400B0ED8800B17D823883A00C00C0400000206D9400A178940042688C00005B1 +:200C480010BFFFC48C400044103FFA1E892BC83AD8C01217D9000C17A8C5883AD8C0101722 +:200C50002085C83AD880111518007F26D8C012171800FA1ED8C0111700C0620E00800C0431 +:200C5800D88008C5B805883ADC001215882F883A1F3FFFC405BFFFC4DC000F171023883ABD +:200C600000000206E73FFFC4E580FC26888001178009883A880B883AD98008C401C0004412 +:200C6800103EE83A103FF72604BFFFC4003F620605000204D9400E172D4000172940010428 +:200C7000D9400E15D8000D15D8001215D823883AA83FC92605800244DC001115DF001417C5 +:200C78000000050615400C048D400005802B883A8C40004480000F26A809883AA00B883A08 +:200C800000127F00A009883A100B883A1021883A00128000A885C83AB0BFF20EE0000E2644 +:200C880015400DC48D400005802B883A8C400044803FF11ED9000B178EEBC83ADC0011178F +:200C90002545C83AD809883A00BFB90ED8C00A1788FFAE36003FB606154015C4003FE2063B +:200C980000C00044013FFFC4D8C00D15D9000B15D800141505000284D9000C15D8001315FC +:200CA000D8001015182B883A003F110600C00044D8C01315054000C4003F0D06D8C01117FD +:200CA800DC0015178805883A90E5883AB823883A102F883AD8C0121718000A26B8800117A7 +:200CB000D9000F1700C00B44D8C00905B80B883AD980090401C00044103EE83A103FB21EF1 +:200CB800948000448D6DC83A057F4D0EDD400F1700000206948000448DBF49268C7FFFC4BD +:200CC00088C00003B8800117A809883AD8C00905B80B883AD980090401C00044103EE83A00 +:200CC800103FF42604BFFFC4003F0306DD40101505400084003EE6060005883A003F28066C +:200CD0000005883A003F1606D8C0111700FFD90E00800804D8800885B805883ADC00151546 +:200CD800882F883A1F3FFFC405BFFFC4DC000F171023883A00000206E73FFFC4E5BFC72662 +:200CE000888001178009883A880B883AD980088401C00044103EE83A103FF72604BFFFC4E8 +:200CE800003EE50601000044D9000B15003F1806B8C00117D9000F17D8800905B80B883AAE +:200CF000D9800904A80F883A183EE83A103F761E94800044002B883A003EBD0600C0004460 +:200CF800D8C0141505000404003F7206D9000C179900420EDF000F1725BFFFC4008008043A +:200D0000D8800845B023883A057FFFC48C7FFFC48D403926B8800117E009883AB80B883AD8 +:200D0800D980084401C00044103EE83A103FF72604BFFFC4003EC006D9000E17D8C00E1700 +:200D10002100001718C00104D8C00E15D900121500138C80D9000C17102D883A20B9C83AFE +:200D180007001B0E00800804D8800805B805883ADC001115B02F883AE47FFFC4902D883AD3 +:200D2000057FFFC4DC000F171025883A000002068C7FFFC48D400826908001178009883A2F +:200D2800900B883AD980080401C00044103EE83A103FF726003F3C06DC0011179005883A2C +:200D3000B025883A9725883AB82D883A102F883AB8800117D9000F17D9801217B80B883A90 +:200D3800B00F883A103EE83A103F2F1E95A5883A002B883A003E760695A5883AD9400E1731 +:200D4000B8800117D9000F1728C00017D9800904B80B883AD8C00905D8C00E1701C00044F2 +:200D48001C400104103EE83A103F1F1E94800044DC400E15002B883A003E6506B8800117B1 +:200D5000D9000F1700C00B44D8C00905B80B883AD980090401C00044103EE83A103F121EF0 +:200D5800D8C011179480004400FEFC16003F5D06056BC83AD8C01215003F1406D8C0111767 +:200D60008805883ADC001217B823883A90E5883A102F883A003F530600800074108FBE045D +:200D68002007883A110000172805883A300F883A180B883A100D883A0012E641DEFFF60496 +:200D7000DC400815DC000715DFC009153021883A2023883A3000241600808204D880000D88 +:200D7800D9400415D940021530001A1E0005883A00C0007418CFBE0419000017380D883AB6 +:200D8000D9C00A17D8800515D880031500BFFFC4D880008DD80B883A00800074108DE60430 +:200D8800D8800115D80006150012E64000FFFFC410C00A1680000226D8C004171800000588 +:200D9000DFC00917DC400817DC000717DEC00A04F800283A30BFFFC4003FE50600C022C4C7 +:200D980088C00015003FF306008022C42080001500BFFFC4003FF20600800074108FBE047D +:200DA0002011883A11000017DEFFFE042807883A3005883AD9C00015400B883A180D883AAF +:200DA800100F883ADFC0011500135BC0DFC00117DEC00204F800283A2880000BDEFFFA0424 +:200DB000DCC0031510C0020C18FFFFCC18E0001CDC800215DC400115DFC00515DD00041547 +:200DB800DC00001518E000042825883A2027883A3023883A180026262940008F2800101657 +:200DC00001C01A0E3821883A050100040000030688A3883A0400150E9140008F880D883A31 +:200DC8009809883A800F883AA400010E01C1000400138F0080A1C83A00BFF5169080000B34 +:200DD000108010149080000D00BFFFC4DFC00517DD000417DCC00317DC800217DC4001179E +:200DD800DC000017DEC00604F800283A0005883ADFC00517DD000417DCC00317DC80021761 +:200DE000DC400117DC000017DEC00604F800283A00BFFFC4003FED062880000BDEFFFD0485 +:200DE800DC00001510C0020C18FFFFCC18E0001CDFC00215DC40011518E000042821883A37 +:200DF0001800282628C0008F18001E0E10C0800C18FFFFCC18E0001C18E00004180019261D +:200DF8002C40051789C012163C40010E3823883A81000417300B883A880D883A001386C0F1 +:200E000080C00517810004170005883A1C47C83A2463883A80C0051584400415DFC0021776 +:200E0800DC400117DC000017DEC00304F800283A10C0200C18FFFFCC18E0001C18E00004B6 +:200E1000183FEB26108010148080000D00BFFFC4DFC00217DC400117DC000017DEC0030493 +:200E1800F800283A00BFFFC4003FEC062005883A29000B2E2987883A20C0092E218B883A6D +:200E200030000F26198DC83A18FFFFC419000003297FFFC42900000519BFFB1EF800283ACB +:200E280030000826118D883A1007883A29C0000318C000442940004419FFFFC519BFFB1E91 +:200E3000F800283AF800283A20800007100006262005883A1080004410C00007183FFD1E07 +:200E38001105C83AF800283A0005883AF800283ADEFFFD04DC400115DC0000152023883A01 +:200E400004000074840FC3042809883A300B883A380D883ADFC0021580000015001398C013 +:200E480000FFFFC410C00526DFC00217DC400117DC000017DEC00304F800283A80C0001798 +:200E5000183FF92688C00015DFC00217DC400117DC000017DEC00304F800283ADEFFFF04F1 +:200E58000009883ADFC0001500139EC00013A0C0D1200C17D1600B17D1A00A17DFC0001768 +:200E6000DEC001040010F7410013A441DEFFFF04DFC00015008000442080061E01000074FE +:200E6800210FBF04000F883ADFC00017DEC001040013A10100800074108FC004108000179A +:200E700010000226103EE83A0000020600800074108FC30400C0144410C0001500BFFFC4D9 +:200E7800DFC00017DEC00104F800283ADEFFFF04DFC000150013AC40008000441001703A95 +:200E8000DFC00017DEC00104F800283AF800283A20C000173005883A2989883A1980010445 +:200E88000000060631C0003739FFFFEC383FFD2629C000072940004419C00035293FF93617 +:200E9000F800283ADEFFFE04014AAAF4296AAA84DC000015DFC001152021883A00127F0025 +:200E980010000F260007883A01600034297FFFC40135557421155584297FFFC4283FFE1E30 +:200EA00018C000448121883A18BFFB168405883A1421883A843FFFC4803FFE1E000004061D +:200EA8008405883A1421883A843FFFC4043FFE160005883ADFC00117DC000017DEC00204F6 +:200EB000F800283A000170FAF800283A202020202020202020202020202020200000000003 +:200EB8000073252065646E497473207820747261207272650000000066206F4E70706F6C95 +:200EC0000000007965736E496620747270706F6C0000007961656C437277207270657469C8 +:200EC80000746F7220746553746972776F7270657463657400000000706F6C46692079703A +:200ED0007265736E0064657463656A456C6620747970706F0000000038346F616F53203614 +:200ED80065762043302E317200000000692044532E74696E20202E2E202020200000000006 +:200EE0006820445365646165686320722E2E2E6B0000000072204453696E696525203A7431 +:200EE80020202064000000204F2044532020204B2020202020202020000000006820445336 +:200EF000656461656E692072646C61760000000068204453656461654B4F207220202020E9 +:200EF8000000000065532D2D7463656C4F4942202D2D3A530000000064616F4C20676E6961 +:200F0000534F4942202E2E2E00000000697265566E697966494220672E2E534F000000009E +:200F0800534F4942667276206166207964656C6900000000534F494272657620207966692E +:200F100020204B4F000000006C65532D20746365424147563A534F490000000064616F4C75 +:200F180020676E694F4942562E2E2E530000000066726556676E6979494256202E2E534F05 +:200F2000000000004F4942567276205366207966206C6961000000004F49425665762053ED +:200F280079666972204B4F20000000007838302525202D200A252564000000006174530A94 +:200F30006E6974726F6120672E36383400002E2E6F74530A6E6970706F6120672E36383443 +:200F380000002E2E41544A0A25203A470A78383000000000000000000000000000000000A4 +:200F4000000000000000000002020100030303030404040404040404050505050505050538 +:200F48000505050505050505060606060606060606060606060606060606060606060606D1 +:200F50000606060606060606070707070707070707070707070707070707070707070707A9 +:200F5800070707070707070707070707070707070707070707070707070707070707070799 +:200F6000070707070707070708080808080808080808080808080808080808080808080879 +:200F6800080808080808080808080808080808080808080808080808080808080808080869 +:200F7000080808080808080808080808080808080808080808080808080808080808080861 +:200F7800080808080808080808080808080808080808080808080808080808080808080859 +:200F800008080808080808080000000000013EC800013ED000013ED80000000000000000E4 +:200F8800000000000000000000000000000000000000000000000000000000000000000049 +:200F9000000000000000000000000000000000000000000000000000000000000000000041 +:200F9800000000000000000000000000000000000000000000000000000000000000000039 +:200FA000000000000000000000000000000000000000000000000000000000000000000031 +:200FA800000000000000000000000000000000000000000000000000000000000000000029 +:200FB000000000000000000000000004000000000001000A000000000002000A0000000006 +:200FB800000000000000000000000101FFFFFFFFFFFFFFFF00013E0800013E080000888881 +:200FC000000000000000000000000000000000000000000000000000000000000000000011 +:200FC800000000000000000000000000000000000000000000000000000000000000000009 +:200FD000000000000000000000000000000000000000000000000000000000000000000001 +:200FD8000000000000000000000000000000000000000000000000000000000000000000F9 +:200FE0000000000000000000000000000000000000000000000000000000000000000000F1 +:200FE8000000000000000000000000000000000000000000000000000000000000000000E9 +:200FF0000000000000000000000000000000000000000000000000000000000000000000E1 +:200FF8000000000000000000000000000000000000000000000000000000000000000000D9 +:201000000000000000000000000000000000000000000000000000000000000000000000D0 +:201008000000000000000000000000000000000000000000000000000000000000000000C8 +:201010000000000000000000000000000000000000000000000000000000000000000000C0 +:201018000000000000000000000000000000000000000000000000000000000000000000B8 +:201020000000000000000000000000000000000000000000000000000000000000000000B0 +:201028000000000000000000000000000000000000000000000000000000000000000000A8 +:201030000000000000000000000000000000000000000000000000000000000000000000A0 +:20103800000000000000000000000000000000000000000000000000000000000000000098 +:20104000000000000000000000000000000000000000000000000000000000000000000090 +:20104800000000000000000000000000000000000000000000000000000000000000000088 +:20105000000000000000000000000000000000000000000000000000000000000000000080 +:20105800000000000000000000000000000000000000000000000000000000000000000078 +:20106000000000000000000000000000000000000000000000000000000000000000000070 +:20106800000000000000000000000000000000000000000000000000000000000000000068 +:20107000000000000000000000000000000000000000000000000000000000000000000060 +:20107800000000000000000000000000000000000000000000000000000000000000000058 +:20108000000000000000000000000000000000000000000000000000000000000000000050 +:20108800000000000000000000000000000000000000000000000000000000000000000048 +:20109000000000000000000000000000000000000000000000000000000000000000000040 +:20109800000000000000000000000000000000000000000000000000000000000000000038 +:2010A000000000000000000000000000000000000000000000000000000000000000000030 +:2010A800000000000000000000000000000000000000000000000000000000000000000028 +:2010B000000000000000000000000000000000000000000000000000000000000000000020 +:2010B800000000000000000000000000000000000000000000000000000000000000000018 +:2010C000000000000000000000000000000000000000000000000000000000000000000010 +:2010C800000000000000000000000000000000000000000000000000000000000000000008 +:2010D000000000000000000000000000000000000000000000000000000000000000000000 +:2010D8000000000000000000000000000000000000000000000000000000000000000000F8 +:2010E0000000000000000000000000000000000000000000000000000000000000000000F0 +:2010E8000000000000000000000000000000000000000000000000000000000000000000E8 +:2010F0000000000000000000000000000000000000000000000000000000000000000000E0 +:2010F8000000000000000000000000000000000000000000000000000000000000000000D8 +:201100000000000000000000000000000000000000000000000000000000000000000000CF +:201108000000000000000000000000000000000000000000000000000000000000000000C7 +:201110000000000000000000000000000000000000000000000000000000000000000000BF +:201118000000000000000000000000000000000000000000000000000000000000000000B7 +:201120000000000000000000000000000000000000000000000000000000000000000000AF +:201128000000000000000000000000000000000000000000000000000000000000000000A7 +:2011300000000000000000000000000000000000000000000000000000000000000000009F +:20113800000000000000000000000000000000000000000000000000000000000000000097 +:2011400000000000000000000000000000000000000000000000000000000000000000008F +:20114800000000000000000000000000000000000000000000000000000000000000000087 +:2011500000000000000000000000000000000000000000000000000000000000000000007F +:20115800000000000000000000000000000000000000000000000000000000000000000077 +:2011600000000000000000000000000000000000000000000000000000000000000000006F +:20116800000000000000000000000000000000000000000000000000000000000000000067 +:2011700000000000000000000000000000000000000000000000000000000000000000005F +:20117800000000000000000000000000000000000000000000000000000000000000000057 +:2011800000000000000000000000000000000000000000000000000000000000000000004F +:20118800000000000000000000000000000000000000000000000000000000000000000047 +:2011900000000000000000000000000000000000000000000000000000000000000000003F +:20119800000000000000000000000000000000000000000000000000000000000000000037 +:2011A00000000000000000000000000000000000000000000000000000000000000000002F +:2011A800000000000000000000000000000000000000000000000000000000000000000027 +:2011B00000000000000000000000000000000000000000000000000000000000000000001F +:2011B800000000000000000000000000000000000000000000000000000000000000000017 +:2011C00000000000000000000000000000000000000000000000000000000000000000000F +:2011C800000000000000000000000000000000000000000000000000000000000000000007 +:2011D0000000000000000000000000000000000000000000000000000000000000000000FF +:2011D8000000000000000000000000000000000000000000000000000000000000000000F7 +:2011E0000000000000000000000000000000000000000000000000000000000000000000EF +:2011E8000000000000000000000000000000000000000000000000000000000000000000E7 +:2011F0000000000000000000000000000000000000000000000000000000000000000000DF +:2011F8000000000000000000000000000000000000000000000000000000000000000000D7 +:201200000000000000000000000000000000000000000000000000000000000000000000CE +:201208000000000000000000000000000000000000000000000000000000000000000000C6 +:201210000000000000000000000000000000000000000000000000000000000000000000BE +:201218000000000000000000000000000000000000000000000000000000000000000000B6 +:201220000000000000000000000000000000000000000000000000000000000000000000AE +:201228000000000000000000000000000000000000000000000000000000000000000000A6 +:2012300000000000000000000000000000000000000000000000000000000000000000009E +:20123800000000000000000000000000000000000000000000000000000000000000000096 +:2012400000000000000000000000000000000000000000000000000000000000000000008E +:20124800000000000000000000000000000000000000000000000000000000000000000086 +:2012500000000000000000000000000000000000000000000000000000000000000000007E +:20125800000000000000000000000000000000000000000000000000000000000000000076 +:2012600000000000000000000000000000000000000000000000000000000000000000006E +:20126800000000000000000000000000000000000000000000000000000000000000000066 +:2012700000000000000000000000000000000000000000000000000000000000000000005E +:20127800000000000000000000000000000000000000000000000000000000000000000056 +:2012800000000000000000000000000000000000000000000000000000000000000000004E +:20128800000000000000000000000000000000000000000000000000000000000000000046 +:2012900000000000000000000000000000000000000000000000000000000000000000003E +:20129800000000000000000000000000000000000000000000000000000000000000000036 +:2012A00000000000000000000000000000000000000000000000000000000000000000002E +:2012A800000000000000000000000000000000000000000000000000000000000000000026 +:2012B00000000000000000000000000000000000000000000000000000000000000000001E +:2012B800000000000000000000000000000000000000000000000000000000000000000016 +:2012C00000000000000000000000000000000000000000000000000000000000000000000E +:2012C800000000000000000000000000000000000000000000000000000000000000000006 +:2012D0000000000000000000000000000000000000000000000000000000000000000000FE +:2012D8000000000000000000000000000000000000000000000000000000000000000000F6 +:2012E0000000000000000000000000000000000000000000000000000000000000000000EE +:2012E8000000000000000000000000000000000000000000000000000000000000000000E6 +:2012F0000000000000000000000000000000000000000000000000000000000000000000DE +:2012F8000000000000000000000000000000000000000000000000000000000000000000D6 +:201300000000000000000000000000000000000000000000000000000000000000000000CD +:201308000000000000000000000000000000000000000000000000000000000000000000C5 +:201310000000000000000000000000000000000000000000000000000000000000000000BD +:201318000000000000000000000000000000000000000000000000000000000000000000B5 +:201320000000000000000000000000000000000000000000000000000000000000000000AD +:201328000000000000000000000000000000000000000000000000000000000000000000A5 +:2013300000000000000000000000000000000000000000000000000000000000000000009D +:20133800000000000000000000000000000000000000000000000000000000000000000095 +:2013400000000000000000000000000000000000000000000000000000000000000000008D +:20134800000000000000000000000000000000000000000000000000000000000000000085 +:2013500000000000000000000000000000000000000000000000000000000000000000007D +:20135800000000000000000000000000000000000000000000000000000000000000000075 +:2013600000000000000000000000000000000000000000000000000000000000000000006D +:20136800000000000000000000000000000000000000000000000000000000000000000065 +:2013700000000000000000000000000000000000000000000000000000000000000000005D +:20137800000000000000000000000000000000000000000000000000000000000000000055 +:2013800000000000000000000000000000000000000000000000000000000000000000004D +:20138800000000000000000000000000000000000000000000000000000000000000000045 +:2013900000000000000000000000000000000000000000000000000000000000000000003D +:20139800000000000000000000000000000000000000000000000000000000000000000035 +:2013A00000000000000000000000000000000000000000000000000000000000000000002D +:2013A800000000000000000000000000000000000000000000000000000000000000000025 +:2013B00000000000000000000000000000000000000000000000000000000000000000001D +:2013B800000000000000000000000000000000000000000000000000000000000000000015 +:2013C00000000000000000000000000000000000000000000000000000000000000000000D +:2013C800000000000000000000000000000000000000000000000000000000000000000005 +:2013D0000000000000000000000000000000000000000000000000000000000000000000FD +:2013D8000000000000000000000000000000000000000000000000000000000000000000F5 +:2013E0000000000000000000000000000000000000000000000000000000000000000000ED +:2013E8000000000000000000000000000000000000000000000000000000000000000000E5 +:2013F0000000000000000000000000000000000000000000000000000000000000000000DD +:2013F8000000000000000000000000000000000000000000000000000000000000000000D5 +:201400000000000000000000000000000000000000000000000000000000000000000000CC +:201408000000000000000000000000000000000000000000000000000000000000000000C4 +:201410000000000000000000000000000000000000000000000000000000000000000000BC +:201418000000000000000000000000000000000000000000000000000000000000000000B4 +:201420000000000000000000000000000000000000000000000000000000000000000000AC +:201428000000000000000000000000000000000000000000000000000000000000000000A4 +:2014300000000000000000000000000000000000000000000000000000000000000000009C +:20143800000000000000000000000000000000000000000000000000000000000000000094 +:2014400000000000000000000000000000000000000000000000000000000000000000008C +:20144800000000000000000000000000000000000000000000000000000000000000000084 +:2014500000000000000000000000000000000000000000000000000000000000000000007C +:20145800000000000000000000000000000000000000000000000000000000000000000074 +:2014600000000000000000000000000000000000000000000000000000000000000000006C +:20146800000000000000000000000000000000000000000000000000000000000000000064 +:2014700000000000000000000000000000000000000000000000000000000000000000005C +:20147800000000000000000000000000000000000000000000000000000000000000000054 +:2014800000000000000000000000000000000000000000000000000000000000000000004C +:20148800000000000000000000000000000000000000000000000000000000000000000044 +:2014900000000000000000000000000000000000000000000000000000000000000000003C +:20149800000000000000000000000000000000000000000000000000000000000000000034 +:2014A00000000000000000000000000000000000000000000000000000000000000000002C +:2014A800000000000000000000000000000000000000000000000000000000000000000024 +:2014B00000000000000000000000000000000000000000000000000000000000000000001C +:2014B800000000000000000000000000000000000000000000000000000000000000000014 +:2014C00000000000000000000000000000000000000000000000000000000000000000000C +:2014C800000000000000000000000000000000000000000000000000000000000000000004 +:2014D0000000000000000000000000000000000000000000000000000000000000000000FC +:2014D8000000000000000000000000000000000000000000000000000000000000000000F4 +:2014E0000000000000000000000000000000000000000000000000000000000000000000EC +:2014E8000000000000000000000000000000000000000000000000000000000000000000E4 +:2014F0000000000000000000000000000000000000000000000000000000000000000000DC +:2014F8000000000000000000000000000000000000000000000000000000000000000000D4 +:201500000000000000000000000000000000000000000000000000000000000000000000CB +:201508000000000000000000000000000000000000000000000000000000000000000000C3 +:201510000000000000000000000000000000000000000000000000000000000000000000BB +:201518000000000000000000000000000000000000000000000000000000000000000000B3 +:201520000000000000000000000000000000000000000000000000000000000000000000AB +:201528000000000000000000000000000000000000000000000000000000000000000000A3 +:2015300000000000000000000000000000000000000000000000000000000000000000009B +:20153800000000000000000000000000000000000000000000000000000000000000000093 +:2015400000000000000000000000000000000000000000000000000000000000000000008B +:20154800000000000000000000000000000000000000000000000000000000000000000083 +:2015500000000000000000000000000000000000000000000000000000000000000000007B +:20155800000000000000000000000000000000000000000000000000000000000000000073 +:2015600000000000000000000000000000000000000000000000000000000000000000006B +:20156800000000000000000000000000000000000000000000000000000000000000000063 +:2015700000000000000000000000000000000000000000000000000000000000000000005B +:20157800000000000000000000000000000000000000000000000000000000000000000053 +:2015800000000000000000000000000000000000000000000000000000000000000000004B +:20158800000000000000000000000000000000000000000000000000000000000000000043 +:2015900000000000000000000000000000000000000000000000000000000000000000003B +:20159800000000000000000000000000000000000000000000000000000000000000000033 +:2015A00000000000000000000000000000000000000000000000000000000000000000002B +:2015A800000000000000000000000000000000000000000000000000000000000000000023 +:2015B00000000000000000000000000000000000000000000000000000000000000000001B +:2015B800000000000000000000000000000000000000000000000000000000000000000013 +:2015C00000000000000000000000000000000000000000000000000000000000000000000B +:2015C800000000000000000000000000000000000000000000000000000000000000000003 +:2015D0000000000000000000000000000000000000000000000000000000000000000000FB +:2015D8000000000000000000000000000000000000000000000000000000000000000000F3 +:2015E0000000000000000000000000000000000000000000000000000000000000000000EB +:2015E8000000000000000000000000000000000000000000000000000000000000000000E3 +:2015F0000000000000000000000000000000000000000000000000000000000000000000DB +:2015F8000000000000000000000000000000000000000000000000000000000000000000D3 +:201600000000000000000000000000000000000000000000000000000000000000000000CA +:201608000000000000000000000000000000000000000000000000000000000000000000C2 +:201610000000000000000000000000000000000000000000000000000000000000000000BA +:201618000000000000000000000000000000000000000000000000000000000000000000B2 +:201620000000000000000000000000000000000000000000000000000000000000000000AA +:201628000000000000000000000000000000000000000000000000000000000000000000A2 +:2016300000000000000000000000000000000000000000000000000000000000000000009A +:20163800000000000000000000000000000000000000000000000000000000000000000092 +:2016400000000000000000000000000000000000000000000000000000000000000000008A +:20164800000000000000000000000000000000000000000000000000000000000000000082 +:2016500000000000000000000000000000000000000000000000000000000000000000007A +:20165800000000000000000000000000000000000000000000000000000000000000000072 +:2016600000000000000000000000000000000000000000000000000000000000000000006A +:20166800000000000000000000000000000000000000000000000000000000000000000062 +:2016700000000000000000000000000000000000000000000000000000000000000000005A +:20167800000000000000000000000000000000000000000000000000000000000000000052 +:2016800000000000000000000000000000000000000000000000000000000000000000004A +:20168800000000000000000000000000000000000000000000000000000000000000000042 +:2016900000000000000000000000000000000000000000000000000000000000000000003A +:20169800000000000000000000000000000000000000000000000000000000000000000032 +:2016A00000000000000000000000000000000000000000000000000000000000000000002A +:2016A800000000000000000000000000000000000000000000000000000000000000000022 +:2016B00000000000000000000000000000000000000000000000000000000000000000001A +:2016B800000000000000000000000000000000000000000000000000000000000000000012 +:2016C00000000000000000000000000000000000000000000000000000000000000000000A +:2016C800000000000000000000000000000000000000000000000000000000000000000002 +:2016D0000000000000000000000000000000000000000000000000000000000000000000FA +:2016D8000000000000000000000000000000000000000000000000000000000000000000F2 +:2016E0000000000000000000000000000000000000000000000000000000000000000000EA +:2016E8000000000000000000000000000000000000000000000000000000000000000000E2 +:2016F0000000000000000000000000000000000000000000000000000000000000000000DA +:2016F8000000000000000000000000000000000000000000000000000000000000000000D2 +:201700000000000000000000000000000000000000000000000000000000000000000000C9 +:201708000000000000000000000000000000000000000000000000000000000000000000C1 +:201710000000000000000000000000000000000000000000000000000000000000000000B9 +:201718000000000000000000000000000000000000000000000000000000000000000000B1 +:201720000000000000000000000000000000000000000000000000000000000000000000A9 +:201728000000000000000000000000000000000000000000000000000000000000000000A1 +:20173000000000000000000000000000000000000000000000000000000000000000000099 +:20173800000000000000000000000000000000000000000000000000000000000000000091 +:20174000000000000000000000000000000000000000000000000000000000000000000089 +:20174800000000000000000000000000000000000000000000000000000000000000000081 +:20175000000000000000000000000000000000000000000000000000000000000000000079 +:20175800000000000000000000000000000000000000000000000000000000000000000071 +:20176000000000000000000000000000000000000000000000000000000000000000000069 +:20176800000000000000000000000000000000000000000000000000000000000000000061 +:20177000000000000000000000000000000000000000000000000000000000000000000059 +:20177800000000000000000000000000000000000000000000000000000000000000000051 +:20178000000000000000000000000000000000000000000000000000000000000000000049 +:20178800000000000000000000000000000000000000000000000000000000000000000041 +:20179000000000000000000000000000000000000000000000000000000000000000000039 +:20179800000000000000000000000000000000000000000000000000000000000000000031 +:2017A000000000000000000000000000000000000000000000000000000000000000000029 +:2017A800000000000000000000000000000000000000000000000000000000000000000021 +:2017B000000000000000000000000000000000000000000000000000000000000000000019 +:2017B800000000000000000000000000000000000000000000000000000000000000000011 +:2017C000000000000000000000000000000000000000000000000000000000000000000009 +:2017C800000000000000000000000000000000000000000000000000000000000000000001 +:2017D0000000000000000000000000000000000000000000000000000000000000000000F9 +:2017D8000000000000000000000000000000000000000000000000000000000000000000F1 +:2017E0000000000000000000000000000000000000000000000000000000000000000000E9 +:2017E8000000000000000000000000000000000000000000000000000000000000000000E1 +:2017F0000000000000000000000000000000000000000000000000000000000000000000D9 +:2017F8000000000000000000000000000000000000000000000000000000000000000000D1 +:201800000000000000000000000000000000000000000000000000000000000000000000C8 +:201808000000000000000000000000000000000000000000000000000000000000000000C0 +:201810000000000000000000000000000000000000000000000000000000000000000000B8 +:201818000000000000000000000000000000000000000000000000000000000000000000B0 +:201820000000000000000000000000000000000000000000000000000000000000000000A8 +:201828000000000000000000000000000000000000000000000000000000000000000000A0 +:20183000000000000000000000000000000000000000000000000000000000000000000098 +:20183800000000000000000000000000000000000000000000000000000000000000000090 +:20184000000000000000000000000000000000000000000000000000000000000000000088 +:20184800000000000000000000000000000000000000000000000000000000000000000080 +:20185000000000000000000000000000000000000000000000000000000000000000000078 +:20185800000000000000000000000000000000000000000000000000000000000000000070 +:20186000000000000000000000000000000000000000000000000000000000000000000068 +:20186800000000000000000000000000000000000000000000000000000000000000000060 +:20187000000000000000000000000000000000000000000000000000000000000000000058 +:20187800000000000000000000000000000000000000000000000000000000000000000050 +:20188000000000000000000000000000000000000000000000000000000000000000000048 +:20188800000000000000000000000000000000000000000000000000000000000000000040 +:20189000000000000000000000000000000000000000000000000000000000000000000038 +:20189800000000000000000000000000000000000000000000000000000000000000000030 +:2018A000000000000000000000000000000000000000000000000000000000000000000028 +:2018A800000000000000000000000000000000000000000000000000000000000000000020 +:2018B000000000000000000000000000000000000000000000000000000000000000000018 +:2018B800000000000000000000000000000000000000000000000000000000000000000010 +:2018C000000000000000000000000000000000000000000000000000000000000000000008 +:2018C800000000000000000000000000000000000000000000000000000000000000000000 +:2018D0000000000000000000000000000000000000000000000000000000000000000000F8 +:2018D8000000000000000000000000000000000000000000000000000000000000000000F0 +:2018E0000000000000000000000000000000000000000000000000000000000000000000E8 +:2018E8000000000000000000000000000000000000000000000000000000000000000000E0 +:2018F0000000000000000000000000000000000000000000000000000000000000000000D8 +:2018F8000000000000000000000000000000000000000000000000000000000000000000D0 +:201900000000000000000000000000000000000000000000000000000000000000000000C7 +:201908000000000000000000000000000000000000000000000000000000000000000000BF +:201910000000000000000000000000000000000000000000000000000000000000000000B7 +:201918000000000000000000000000000000000000000000000000000000000000000000AF +:201920000000000000000000000000000000000000000000000000000000000000000000A7 +:2019280000000000000000000000000000000000000000000000000000000000000000009F +:20193000000000000000000000000000000000000000000000000000000000000000000097 +:2019380000000000000000000000000000000000000000000000000000000000000000008F +:20194000000000000000000000000000000000000000000000000000000000000000000087 +:2019480000000000000000000000000000000000000000000000000000000000000000007F +:20195000000000000000000000000000000000000000000000000000000000000000000077 +:2019580000000000000000000000000000000000000000000000000000000000000000006F +:20196000000000000000000000000000000000000000000000000000000000000000000067 +:2019680000000000000000000000000000000000000000000000000000000000000000005F +:20197000000000000000000000000000000000000000000000000000000000000000000057 +:2019780000000000000000000000000000000000000000000000000000000000000000004F +:20198000000000000000000000000000000000000000000000000000000000000000000047 +:2019880000000000000000000000000000000000000000000000000000000000000000003F +:20199000000000000000000000000000000000000000000000000000000000000000000037 +:2019980000000000000000000000000000000000000000000000000000000000000000002F +:2019A000000000000000000000000000000000000000000000000000000000000000000027 +:2019A80000000000000000000000000000000000000000000000000000000000000000001F +:2019B000000000000000000000000000000000000000000000000000000000000000000017 +:2019B80000000000000000000000000000000000000000000000000000000000000000000F +:2019C000000000000000000000000000000000000000000000000000000000000000000007 +:2019C8000000000000000000000000000000000000000000000000000000000000000000FF +:2019D0000000000000000000000000000000000000000000000000000000000000000000F7 +:2019D8000000000000000000000000000000000000000000000000000000000000000000EF +:2019E0000000000000000000000000000000000000000000000000000000000000000000E7 +:2019E8000000000000000000000000000000000000000000000000000000000000000000DF +:2019F0000000000000000000000000000000000000000000000000000000000000000000D7 +:2019F8000000000000000000000000000000000000000000000000000000000000000000CF +:201A00000000000000000000000000000000000000000000000000000000000000000000C6 +:201A08000000000000000000000000000000000000000000000000000000000000000000BE +:201A10000000000000000000000000000000000000000000000000000000000000000000B6 +:201A18000000000000000000000000000000000000000000000000000000000000000000AE +:201A20000000000000000000000000000000000000000000000000000000000000000000A6 +:201A280000000000000000000000000000000000000000000000000000000000000000009E +:201A3000000000000000000000000000000000000000000000000000000000000000000096 +:201A380000000000000000000000000000000000000000000000000000000000000000008E +:201A4000000000000000000000000000000000000000000000000000000000000000000086 +:201A480000000000000000000000000000000000000000000000000000000000000000007E +:201A5000000000000000000000000000000000000000000000000000000000000000000076 +:201A580000000000000000000000000000000000000000000000000000000000000000006E +:201A6000000000000000000000000000000000000000000000000000000000000000000066 +:201A680000000000000000000000000000000000000000000000000000000000000000005E +:201A7000000000000000000000000000000000000000000000000000000000000000000056 +:201A780000000000000000000000000000000000000000000000000000000000000000004E +:201A8000000000000000000000000000000000000000000000000000000000000000000046 +:201A880000000000000000000000000000000000000000000000000000000000000000003E +:201A9000000000000000000000000000000000000000000000000000000000000000000036 +:201A980000000000000000000000000000000000000000000000000000000000000000002E +:201AA000000000000000000000000000000000000000000000000000000000000000000026 +:201AA80000000000000000000000000000000000000000000000000000000000000000001E +:201AB000000000000000000000000000000000000000000000000000000000000000000016 +:201AB80000000000000000000000000000000000000000000000000000000000000000000E +:201AC000000000000000000000000000000000000000000000000000000000000000000006 +:201AC8000000000000000000000000000000000000000000000000000000000000000000FE +:201AD0000000000000000000000000000000000000000000000000000000000000000000F6 +:201AD8000000000000000000000000000000000000000000000000000000000000000000EE +:201AE0000000000000000000000000000000000000000000000000000000000000000000E6 +:201AE8000000000000000000000000000000000000000000000000000000000000000000DE +:201AF0000000000000000000000000000000000000000000000000000000000000000000D6 +:201AF8000000000000000000000000000000000000000000000000000000000000000000CE +:201B00000000000000000000000000000000000000000000000000000000000000000000C5 +:201B08000000000000000000000000000000000000000000000000000000000000000000BD +:201B10000000000000000000000000000000000000000000000000000000000000000000B5 +:201B18000000000000000000000000000000000000000000000000000000000000000000AD +:201B20000000000000000000000000000000000000000000000000000000000000000000A5 +:201B280000000000000000000000000000000000000000000000000000000000000000009D +:201B3000000000000000000000000000000000000000000000000000000000000000000095 +:201B380000000000000000000000000000000000000000000000000000000000000000008D +:201B4000000000000000000000000000000000000000000000000000000000000000000085 +:201B480000000000000000000000000000000000000000000000000000000000000000007D +:201B5000000000000000000000000000000000000000000000000000000000000000000075 +:201B580000000000000000000000000000000000000000000000000000000000000000006D +:201B6000000000000000000000000000000000000000000000000000000000000000000065 +:201B680000000000000000000000000000000000000000000000000000000000000000005D +:201B7000000000000000000000000000000000000000000000000000000000000000000055 +:201B780000000000000000000000000000000000000000000000000000000000000000004D +:201B8000000000000000000000000000000000000000000000000000000000000000000045 +:201B880000000000000000000000000000000000000000000000000000000000000000003D +:201B9000000000000000000000000000000000000000000000000000000000000000000035 +:201B980000000000000000000000000000000000000000000000000000000000000000002D +:201BA000000000000000000000000000000000000000000000000000000000000000000025 +:201BA80000000000000000000000000000000000000000000000000000000000000000001D +:201BB000000000000000000000000000000000000000000000000000000000000000000015 +:201BB80000000000000000000000000000000000000000000000000000000000000000000D +:201BC000000000000000000000000000000000000000000000000000000000000000000005 +:201BC8000000000000000000000000000000000000000000000000000000000000000000FD +:201BD0000000000000000000000000000000000000000000000000000000000000000000F5 +:201BD8000000000000000000000000000000000000000000000000000000000000000000ED +:201BE0000000000000000000000000000000000000000000000000000000000000000000E5 +:201BE8000000000000000000000000000000000000000000000000000000000000000000DD +:201BF0000000000000000000000000000000000000000000000000000000000000000000D5 +:201BF8000000000000000000000000000000000000000000000000000000000000000000CD +:201C00000000000000000000000000000000000000000000000000000000000000000000C4 +:201C08000000000000000000000000000000000000000000000000000000000000000000BC +:201C10000000000000000000000000000000000000000000000000000000000000000000B4 +:201C18000000000000000000000000000000000000000000000000000000000000000000AC +:201C20000000000000000000000000000000000000000000000000000000000000000000A4 +:201C280000000000000000000000000000000000000000000000000000000000000000009C +:201C3000000000000000000000000000000000000000000000000000000000000000000094 +:201C380000000000000000000000000000000000000000000000000000000000000000008C +:201C4000000000000000000000000000000000000000000000000000000000000000000084 +:201C480000000000000000000000000000000000000000000000000000000000000000007C +:201C5000000000000000000000000000000000000000000000000000000000000000000074 +:201C580000000000000000000000000000000000000000000000000000000000000000006C +:201C6000000000000000000000000000000000000000000000000000000000000000000064 +:201C680000000000000000000000000000000000000000000000000000000000000000005C +:201C7000000000000000000000000000000000000000000000000000000000000000000054 +:201C780000000000000000000000000000000000000000000000000000000000000000004C +:201C8000000000000000000000000000000000000000000000000000000000000000000044 +:201C880000000000000000000000000000000000000000000000000000000000000000003C +:201C9000000000000000000000000000000000000000000000000000000000000000000034 +:201C980000000000000000000000000000000000000000000000000000000000000000002C +:201CA000000000000000000000000000000000000000000000000000000000000000000024 +:201CA80000000000000000000000000000000000000000000000000000000000000000001C +:201CB000000000000000000000000000000000000000000000000000000000000000000014 +:201CB80000000000000000000000000000000000000000000000000000000000000000000C +:201CC000000000000000000000000000000000000000000000000000000000000000000004 +:201CC8000000000000000000000000000000000000000000000000000000000000000000FC +:201CD0000000000000000000000000000000000000000000000000000000000000000000F4 +:201CD8000000000000000000000000000000000000000000000000000000000000000000EC +:201CE0000000000000000000000000000000000000000000000000000000000000000000E4 +:201CE8000000000000000000000000000000000000000000000000000000000000000000DC +:201CF0000000000000000000000000000000000000000000000000000000000000000000D4 +:201CF8000000000000000000000000000000000000000000000000000000000000000000CC +:201D00000000000000000000000000000000000000000000000000000000000000000000C3 +:201D08000000000000000000000000000000000000000000000000000000000000000000BB +:201D10000000000000000000000000000000000000000000000000000000000000000000B3 +:201D18000000000000000000000000000000000000000000000000000000000000000000AB +:201D20000000000000000000000000000000000000000000000000000000000000000000A3 +:201D280000000000000000000000000000000000000000000000000000000000000000009B +:201D3000000000000000000000000000000000000000000000000000000000000000000093 +:201D380000000000000000000000000000000000000000000000000000000000000000008B +:201D4000000000000000000000000000000000000000000000000000000000000000000083 +:201D480000000000000000000000000000000000000000000000000000000000000000007B +:201D5000000000000000000000000000000000000000000000000000000000000000000073 +:201D580000000000000000000000000000000000000000000000000000000000000000006B +:201D6000000000000000000000000000000000000000000000000000000000000000000063 +:201D680000000000000000000000000000000000000000000000000000000000000000005B +:201D7000000000000000000000000000000000000000000000000000000000000000000053 +:201D780000000000000000000000000000000000000000000000000000000000000000004B +:201D8000000000000000000000000000000000000000000000000000000000000000000043 +:201D880000000000000000000000000000000000000000000000000000000000000000003B +:201D9000000000000000000000000000000000000000000000000000000000000000000033 +:201D980000000000000000000000000000000000000000000000000000000000000000002B +:201DA000000000000000000000000000000000000000000000000000000000000000000023 +:201DA80000000000000000000000000000000000000000000000000000000000000000001B +:201DB000000000000000000000000000000000000000000000000000000000000000000013 +:201DB80000000000000000000000000000000000000000000000000000000000000000000B +:201DC000000000000000000000000000000000000000000000000000000000000000000003 +:201DC8000000000000000000000000000000000000000000000000000000000000000000FB +:201DD0000000000000000000000000000000000000000000000000000000000000000000F3 +:201DD8000000000000000000000000000000000000000000000000000000000000000000EB +:201DE0000000000000000000000000000000000000000000000000000000000000000000E3 +:201DE8000000000000000000000000000000000000000000000000000000000000000000DB +:201DF0000000000000000000000000000000000000000000000000000000000000000000D3 +:201DF8000000000000000000000000000000000000000000000000000000000000000000CB +:201E00000000000000000000000000000000000000000000000000000000000000000000C2 +:201E08000000000000000000000000000000000000000000000000000000000000000000BA +:201E10000000000000000000000000000000000000000000000000000000000000000000B2 +:201E18000000000000000000000000000000000000000000000000000000000000000000AA +:201E20000000000000000000000000000000000000000000000000000000000000000000A2 +:201E280000000000000000000000000000000000000000000000000000000000000000009A +:201E3000000000000000000000000000000000000000000000000000000000000000000092 +:201E380000000000000000000000000000000000000000000000000000000000000000008A +:201E4000000000000000000000000000000000000000000000000000000000000000000082 +:201E480000000000000000000000000000000000000000000000000000000000000000007A +:201E5000000000000000000000000000000000000000000000000000000000000000000072 +:201E580000000000000000000000000000000000000000000000000000000000000000006A +:201E6000000000000000000000000000000000000000000000000000000000000000000062 +:201E680000000000000000000000000000000000000000000000000000000000000000005A +:201E7000000000000000000000000000000000000000000000000000000000000000000052 +:201E780000000000000000000000000000000000000000000000000000000000000000004A +:201E8000000000000000000000000000000000000000000000000000000000000000000042 +:201E880000000000000000000000000000000000000000000000000000000000000000003A +:201E9000000000000000000000000000000000000000000000000000000000000000000032 +:201E980000000000000000000000000000000000000000000000000000000000000000002A +:201EA000000000000000000000000000000000000000000000000000000000000000000022 +:201EA80000000000000000000000000000000000000000000000000000000000000000001A +:201EB000000000000000000000000000000000000000000000000000000000000000000012 +:201EB80000000000000000000000000000000000000000000000000000000000000000000A +:201EC000000000000000000000000000000000000000000000000000000000000000000002 +:201EC8000000000000000000000000000000000000000000000000000000000000000000FA +:201ED0000000000000000000000000000000000000000000000000000000000000000000F2 +:201ED8000000000000000000000000000000000000000000000000000000000000000000EA +:201EE0000000000000000000000000000000000000000000000000000000000000000000E2 +:201EE8000000000000000000000000000000000000000000000000000000000000000000DA +:201EF0000000000000000000000000000000000000000000000000000000000000000000D2 +:201EF8000000000000000000000000000000000000000000000000000000000000000000CA +:201F00000000000000000000000000000000000000000000000000000000000000000000C1 +:201F08000000000000000000000000000000000000000000000000000000000000000000B9 +:201F10000000000000000000000000000000000000000000000000000000000000000000B1 +:201F18000000000000000000000000000000000000000000000000000000000000000000A9 +:201F20000000000000000000000000000000000000000000000000000000000000000000A1 +:201F2800000000000000000000000000000000000000000000000000000000000000000099 +:201F3000000000000000000000000000000000000000000000000000000000000000000091 +:201F3800000000000000000000000000000000000000000000000000000000000000000089 +:201F4000000000000000000000000000000000000000000000000000000000000000000081 +:201F4800000000000000000000000000000000000000000000000000000000000000000079 +:201F5000000000000000000000000000000000000000000000000000000000000000000071 +:201F5800000000000000000000000000000000000000000000000000000000000000000069 +:201F6000000000000000000000000000000000000000000000000000000000000000000061 +:201F6800000000000000000000000000000000000000000000000000000000000000000059 +:201F7000000000000000000000000000000000000000000000000000000000000000000051 +:201F7800000000000000000000000000000000000000000000000000000000000000000049 +:201F8000000000000000000000000000000000000000000000000000000000000000000041 +:201F8800000000000000000000000000000000000000000000000000000000000000000039 +:201F9000000000000000000000000000000000000000000000000000000000000000000031 +:201F9800000000000000000000000000000000000000000000000000000000000000000029 +:201FA000000000000000000000000000000000000000000000000000000000000000000021 +:201FA800000000000000000000000000000000000000000000000000000000000000000019 +:201FB000000000000000000000000000000000000000000000000000000000000000000011 +:201FB800000000000000000000000000000000000000000000000000000000000000000009 +:201FC000000000000000000000000000000000000000000000000000000000000000000001 +:201FC8000000000000000000000000000000000000000000000000000000000000000000F9 +:201FD0000000000000000000000000000000000000000000000000000000000000000000F1 +:201FD8000000000000000000000000000000000000000000000000000000000000000000E9 +:201FE0000000000000000000000000000000000000000000000000000000000000000000E1 +:201FE8000000000000000000000000000000000000000000000000000000000000000000D9 +:201FF0000000000000000000000000000000000000000000000000000000000000000000D1 +:201FF8000000000000000000000000000000000000000000000000000000000000000000C9 +:00000001FF Index: soc/firmware/exe/mem_init/meminit.qip =================================================================== --- soc/firmware/exe/mem_init/meminit.qip (nonexistent) +++ soc/firmware/exe/mem_init/meminit.qip (revision 8) @@ -0,0 +1 @@ +set_global_assignment -name SEARCH_PATH $::quartus(qip_path) Index: components/sd_card/sd.qws =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: components/sd_card/sd.qws =================================================================== --- components/sd_card/sd.qws (nonexistent) +++ components/sd_card/sd.qws (revision 8)
components/sd_card/sd.qws Property changes : Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: components/sd_card/system.qsys =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/xml Index: components/sd_card/system.qsys =================================================================== --- components/sd_card/system.qsys (nonexistent) +++ components/sd_card/system.qsys (revision 8)
components/sd_card/system.qsys Property changes : Added: svn:mime-type ## -0,0 +1 ## +application/xml \ No newline at end of property Index: components/sd_card/slow_mem/slow_mem.v =================================================================== --- components/sd_card/slow_mem/slow_mem.v (nonexistent) +++ components/sd_card/slow_mem/slow_mem.v (revision 8) @@ -0,0 +1,38 @@ + +module slow_mem( + input clk, + input rst_n, + + input [9:0] avs_address, + input avs_read, + output [7:0] avs_readdata, + input avs_write, + input [7:0] avs_writedata, + output avs_waitrequest +); + +reg [5:0] wait_cnt; +always @(posedge clk or negedge rst_n) begin + if(rst_n == 1'b0) wait_cnt <= 6'd0; + else wait_cnt <= wait_cnt + 6'd1; +end + +assign avs_waitrequest = ~(wait_cnt == 4'd0); + +altsyncram line_ram_inst( + .clock0 (clk), + .address_a (avs_address), + .wren_a (avs_write && ~(avs_waitrequest)), + .data_a (avs_writedata), + + .clock1 (clk), + .address_b (avs_address), + .q_b (avs_readdata) +); +defparam line_ram_inst.operation_mode = "DUAL_PORT", + line_ram_inst.width_a = 8, + line_ram_inst.widthad_a = 10, + line_ram_inst.width_b = 8, + line_ram_inst.widthad_b = 10; + +endmodule Index: components/sd_card/.qsys_edit/preferences.xml =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/xml Index: components/sd_card/.qsys_edit/preferences.xml =================================================================== --- components/sd_card/.qsys_edit/preferences.xml (nonexistent) +++ components/sd_card/.qsys_edit/preferences.xml (revision 8)
components/sd_card/.qsys_edit/preferences.xml Property changes : Added: svn:mime-type ## -0,0 +1 ## +application/xml \ No newline at end of property Index: components/sd_card/.qsys_edit/system.xml =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/xml Index: components/sd_card/.qsys_edit/system.xml =================================================================== --- components/sd_card/.qsys_edit/system.xml (nonexistent) +++ components/sd_card/.qsys_edit/system.xml (revision 8)
components/sd_card/.qsys_edit/system.xml Property changes : Added: svn:mime-type ## -0,0 +1 ## +application/xml \ No newline at end of property Index: components/sd_card/.qsys_edit/filters.xml =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/xml Index: components/sd_card/.qsys_edit/filters.xml =================================================================== --- components/sd_card/.qsys_edit/filters.xml (nonexistent) +++ components/sd_card/.qsys_edit/filters.xml (revision 8)
components/sd_card/.qsys_edit/filters.xml Property changes : Added: svn:mime-type ## -0,0 +1 ## +application/xml \ No newline at end of property Index: components/sd_card/pll/pll.qip =================================================================== --- components/sd_card/pll/pll.qip (nonexistent) +++ components/sd_card/pll/pll.qip (revision 8) @@ -0,0 +1,5 @@ +set_global_assignment -name IP_TOOL_NAME "ALTPLL" +set_global_assignment -name IP_TOOL_VERSION "14.0" +set_global_assignment -name IP_GENERATED_DEVICE_FAMILY "{Cyclone IV E}" +set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) "pll.v"] +set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "pll.ppf"] Index: components/sd_card/pll/pll.ppf =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/xml Index: components/sd_card/pll/pll.ppf =================================================================== --- components/sd_card/pll/pll.ppf (nonexistent) +++ components/sd_card/pll/pll.ppf (revision 8)
components/sd_card/pll/pll.ppf Property changes : Added: svn:mime-type ## -0,0 +1 ## +application/xml \ No newline at end of property Index: components/sd_card/pll/pll.v =================================================================== --- components/sd_card/pll/pll.v (nonexistent) +++ components/sd_card/pll/pll.v (revision 8) @@ -0,0 +1,310 @@ +// megafunction wizard: %ALTPLL% +// GENERATION: STANDARD +// VERSION: WM1.0 +// MODULE: altpll + +// ============================================================ +// File Name: pll.v +// Megafunction Name(s): +// altpll +// +// Simulation Library Files(s): +// altera_mf +// ============================================================ +// ************************************************************ +// THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE! +// +// 14.0.0 Build 200 06/17/2014 SJ Web Edition +// ************************************************************ + + +//Copyright (C) 1991-2014 Altera Corporation. All rights reserved. +//Your use of Altera Corporation's design tools, logic functions +//and other software and tools, and its AMPP partner logic +//functions, and any output files from any of the foregoing +//(including device programming or simulation files), and any +//associated documentation or information are expressly subject +//to the terms and conditions of the Altera Program License +//Subscription Agreement, the Altera Quartus II License Agreement, +//the Altera MegaCore Function License Agreement, or other +//applicable license agreement, including, without limitation, +//that your use is for the sole purpose of programming logic +//devices manufactured by Altera and sold by Altera or its +//authorized distributors. Please refer to the applicable +//agreement for further details. + + +// synopsys translate_off +`timescale 1 ps / 1 ps +// synopsys translate_on +module pll ( + inclk0, + c0, + locked); + + input inclk0; + output c0; + output locked; + + wire [0:0] sub_wire2 = 1'h0; + wire [4:0] sub_wire3; + wire sub_wire5; + wire sub_wire0 = inclk0; + wire [1:0] sub_wire1 = {sub_wire2, sub_wire0}; + wire [0:0] sub_wire4 = sub_wire3[0:0]; + wire c0 = sub_wire4; + wire locked = sub_wire5; + + altpll altpll_component ( + .inclk (sub_wire1), + .clk (sub_wire3), + .locked (sub_wire5), + .activeclock (), + .areset (1'b0), + .clkbad (), + .clkena ({6{1'b1}}), + .clkloss (), + .clkswitch (1'b0), + .configupdate (1'b0), + .enable0 (), + .enable1 (), + .extclk (), + .extclkena ({4{1'b1}}), + .fbin (1'b1), + .fbmimicbidir (), + .fbout (), + .fref (), + .icdrclk (), + .pfdena (1'b1), + .phasecounterselect ({4{1'b1}}), + .phasedone (), + .phasestep (1'b1), + .phaseupdown (1'b1), + .pllena (1'b1), + .scanaclr (1'b0), + .scanclk (1'b0), + .scanclkena (1'b1), + .scandata (1'b0), + .scandataout (), + .scandone (), + .scanread (1'b0), + .scanwrite (1'b0), + .sclkout0 (), + .sclkout1 (), + .vcooverrange (), + .vcounderrange ()); + defparam + altpll_component.bandwidth_type = "AUTO", + altpll_component.clk0_divide_by = 1, + altpll_component.clk0_duty_cycle = 50, + altpll_component.clk0_multiply_by = 1, + altpll_component.clk0_phase_shift = "0", + altpll_component.compensate_clock = "CLK0", + altpll_component.inclk0_input_frequency = 20000, + altpll_component.intended_device_family = "Cyclone IV E", + altpll_component.lpm_hint = "CBX_MODULE_PREFIX=pll", + altpll_component.lpm_type = "altpll", + altpll_component.operation_mode = "NORMAL", + altpll_component.pll_type = "AUTO", + altpll_component.port_activeclock = "PORT_UNUSED", + altpll_component.port_areset = "PORT_UNUSED", + altpll_component.port_clkbad0 = "PORT_UNUSED", + altpll_component.port_clkbad1 = "PORT_UNUSED", + altpll_component.port_clkloss = "PORT_UNUSED", + altpll_component.port_clkswitch = "PORT_UNUSED", + altpll_component.port_configupdate = "PORT_UNUSED", + altpll_component.port_fbin = "PORT_UNUSED", + altpll_component.port_inclk0 = "PORT_USED", + altpll_component.port_inclk1 = "PORT_UNUSED", + altpll_component.port_locked = "PORT_USED", + altpll_component.port_pfdena = "PORT_UNUSED", + altpll_component.port_phasecounterselect = "PORT_UNUSED", + altpll_component.port_phasedone = "PORT_UNUSED", + altpll_component.port_phasestep = "PORT_UNUSED", + altpll_component.port_phaseupdown = "PORT_UNUSED", + altpll_component.port_pllena = "PORT_UNUSED", + altpll_component.port_scanaclr = "PORT_UNUSED", + altpll_component.port_scanclk = "PORT_UNUSED", + altpll_component.port_scanclkena = "PORT_UNUSED", + altpll_component.port_scandata = "PORT_UNUSED", + altpll_component.port_scandataout = "PORT_UNUSED", + altpll_component.port_scandone = "PORT_UNUSED", + altpll_component.port_scanread = "PORT_UNUSED", + altpll_component.port_scanwrite = "PORT_UNUSED", + altpll_component.port_clk0 = "PORT_USED", + altpll_component.port_clk1 = "PORT_UNUSED", + altpll_component.port_clk2 = "PORT_UNUSED", + altpll_component.port_clk3 = "PORT_UNUSED", + altpll_component.port_clk4 = "PORT_UNUSED", + altpll_component.port_clk5 = "PORT_UNUSED", + altpll_component.port_clkena0 = "PORT_UNUSED", + altpll_component.port_clkena1 = "PORT_UNUSED", + altpll_component.port_clkena2 = "PORT_UNUSED", + altpll_component.port_clkena3 = "PORT_UNUSED", + altpll_component.port_clkena4 = "PORT_UNUSED", + altpll_component.port_clkena5 = "PORT_UNUSED", + altpll_component.port_extclk0 = "PORT_UNUSED", + altpll_component.port_extclk1 = "PORT_UNUSED", + altpll_component.port_extclk2 = "PORT_UNUSED", + altpll_component.port_extclk3 = "PORT_UNUSED", + altpll_component.self_reset_on_loss_lock = "OFF", + altpll_component.width_clock = 5; + + +endmodule + +// ============================================================ +// CNX file retrieval info +// ============================================================ +// Retrieval info: PRIVATE: ACTIVECLK_CHECK STRING "0" +// Retrieval info: PRIVATE: BANDWIDTH STRING "1.000" +// Retrieval info: PRIVATE: BANDWIDTH_FEATURE_ENABLED STRING "1" +// Retrieval info: PRIVATE: BANDWIDTH_FREQ_UNIT STRING "MHz" +// Retrieval info: PRIVATE: BANDWIDTH_PRESET STRING "Low" +// Retrieval info: PRIVATE: BANDWIDTH_USE_AUTO STRING "1" +// Retrieval info: PRIVATE: BANDWIDTH_USE_PRESET STRING "0" +// Retrieval info: PRIVATE: CLKBAD_SWITCHOVER_CHECK STRING "0" +// Retrieval info: PRIVATE: CLKLOSS_CHECK STRING "0" +// Retrieval info: PRIVATE: CLKSWITCH_CHECK STRING "0" +// Retrieval info: PRIVATE: CNX_NO_COMPENSATE_RADIO STRING "0" +// Retrieval info: PRIVATE: CREATE_CLKBAD_CHECK STRING "0" +// Retrieval info: PRIVATE: CREATE_INCLK1_CHECK STRING "0" +// Retrieval info: PRIVATE: CUR_DEDICATED_CLK STRING "c0" +// Retrieval info: PRIVATE: CUR_FBIN_CLK STRING "c0" +// Retrieval info: PRIVATE: DEVICE_SPEED_GRADE STRING "Any" +// Retrieval info: PRIVATE: DIV_FACTOR0 NUMERIC "1" +// Retrieval info: PRIVATE: DUTY_CYCLE0 STRING "50.00000000" +// Retrieval info: PRIVATE: EFF_OUTPUT_FREQ_VALUE0 STRING "50.000000" +// Retrieval info: PRIVATE: EXPLICIT_SWITCHOVER_COUNTER STRING "0" +// Retrieval info: PRIVATE: EXT_FEEDBACK_RADIO STRING "0" +// Retrieval info: PRIVATE: GLOCKED_COUNTER_EDIT_CHANGED STRING "1" +// Retrieval info: PRIVATE: GLOCKED_FEATURE_ENABLED STRING "0" +// Retrieval info: PRIVATE: GLOCKED_MODE_CHECK STRING "0" +// Retrieval info: PRIVATE: GLOCK_COUNTER_EDIT NUMERIC "1048575" +// Retrieval info: PRIVATE: HAS_MANUAL_SWITCHOVER STRING "1" +// Retrieval info: PRIVATE: INCLK0_FREQ_EDIT STRING "50.000" +// Retrieval info: PRIVATE: INCLK0_FREQ_UNIT_COMBO STRING "MHz" +// Retrieval info: PRIVATE: INCLK1_FREQ_EDIT STRING "100.000" +// Retrieval info: PRIVATE: INCLK1_FREQ_EDIT_CHANGED STRING "1" +// Retrieval info: PRIVATE: INCLK1_FREQ_UNIT_CHANGED STRING "1" +// Retrieval info: PRIVATE: INCLK1_FREQ_UNIT_COMBO STRING "MHz" +// Retrieval info: PRIVATE: INTENDED_DEVICE_FAMILY STRING "Cyclone IV E" +// Retrieval info: PRIVATE: INT_FEEDBACK__MODE_RADIO STRING "1" +// Retrieval info: PRIVATE: LOCKED_OUTPUT_CHECK STRING "1" +// Retrieval info: PRIVATE: LONG_SCAN_RADIO STRING "1" +// Retrieval info: PRIVATE: LVDS_MODE_DATA_RATE STRING "Not Available" +// Retrieval info: PRIVATE: LVDS_MODE_DATA_RATE_DIRTY NUMERIC "0" +// Retrieval info: PRIVATE: LVDS_PHASE_SHIFT_UNIT0 STRING "deg" +// Retrieval info: PRIVATE: MIG_DEVICE_SPEED_GRADE STRING "Any" +// Retrieval info: PRIVATE: MIRROR_CLK0 STRING "0" +// Retrieval info: PRIVATE: MULT_FACTOR0 NUMERIC "1" +// Retrieval info: PRIVATE: NORMAL_MODE_RADIO STRING "1" +// Retrieval info: PRIVATE: OUTPUT_FREQ0 STRING "50.00000000" +// Retrieval info: PRIVATE: OUTPUT_FREQ_MODE0 STRING "1" +// Retrieval info: PRIVATE: OUTPUT_FREQ_UNIT0 STRING "MHz" +// Retrieval info: PRIVATE: PHASE_RECONFIG_FEATURE_ENABLED STRING "1" +// Retrieval info: PRIVATE: PHASE_RECONFIG_INPUTS_CHECK STRING "0" +// Retrieval info: PRIVATE: PHASE_SHIFT0 STRING "0.00000000" +// Retrieval info: PRIVATE: PHASE_SHIFT_STEP_ENABLED_CHECK STRING "0" +// Retrieval info: PRIVATE: PHASE_SHIFT_UNIT0 STRING "deg" +// Retrieval info: PRIVATE: PLL_ADVANCED_PARAM_CHECK STRING "0" +// Retrieval info: PRIVATE: PLL_ARESET_CHECK STRING "0" +// Retrieval info: PRIVATE: PLL_AUTOPLL_CHECK NUMERIC "1" +// Retrieval info: PRIVATE: PLL_ENHPLL_CHECK NUMERIC "0" +// Retrieval info: PRIVATE: PLL_FASTPLL_CHECK NUMERIC "0" +// Retrieval info: PRIVATE: PLL_FBMIMIC_CHECK STRING "0" +// Retrieval info: PRIVATE: PLL_LVDS_PLL_CHECK NUMERIC "0" +// Retrieval info: PRIVATE: PLL_PFDENA_CHECK STRING "0" +// Retrieval info: PRIVATE: PLL_TARGET_HARCOPY_CHECK NUMERIC "0" +// Retrieval info: PRIVATE: PRIMARY_CLK_COMBO STRING "inclk0" +// Retrieval info: PRIVATE: RECONFIG_FILE STRING "pll.mif" +// Retrieval info: PRIVATE: SACN_INPUTS_CHECK STRING "0" +// Retrieval info: PRIVATE: SCAN_FEATURE_ENABLED STRING "1" +// Retrieval info: PRIVATE: SELF_RESET_LOCK_LOSS STRING "0" +// Retrieval info: PRIVATE: SHORT_SCAN_RADIO STRING "0" +// Retrieval info: PRIVATE: SPREAD_FEATURE_ENABLED STRING "0" +// Retrieval info: PRIVATE: SPREAD_FREQ STRING "50.000" +// Retrieval info: PRIVATE: SPREAD_FREQ_UNIT STRING "KHz" +// Retrieval info: PRIVATE: SPREAD_PERCENT STRING "0.500" +// Retrieval info: PRIVATE: SPREAD_USE STRING "0" +// Retrieval info: PRIVATE: SRC_SYNCH_COMP_RADIO STRING "0" +// Retrieval info: PRIVATE: STICKY_CLK0 STRING "1" +// Retrieval info: PRIVATE: SWITCHOVER_COUNT_EDIT NUMERIC "1" +// Retrieval info: PRIVATE: SWITCHOVER_FEATURE_ENABLED STRING "1" +// Retrieval info: PRIVATE: SYNTH_WRAPPER_GEN_POSTFIX STRING "0" +// Retrieval info: PRIVATE: USE_CLK0 STRING "1" +// Retrieval info: PRIVATE: USE_CLKENA0 STRING "0" +// Retrieval info: PRIVATE: USE_MIL_SPEED_GRADE NUMERIC "0" +// Retrieval info: PRIVATE: ZERO_DELAY_RADIO STRING "0" +// Retrieval info: LIBRARY: altera_mf altera_mf.altera_mf_components.all +// Retrieval info: CONSTANT: BANDWIDTH_TYPE STRING "AUTO" +// Retrieval info: CONSTANT: CLK0_DIVIDE_BY NUMERIC "1" +// Retrieval info: CONSTANT: CLK0_DUTY_CYCLE NUMERIC "50" +// Retrieval info: CONSTANT: CLK0_MULTIPLY_BY NUMERIC "1" +// Retrieval info: CONSTANT: CLK0_PHASE_SHIFT STRING "0" +// Retrieval info: CONSTANT: COMPENSATE_CLOCK STRING "CLK0" +// Retrieval info: CONSTANT: INCLK0_INPUT_FREQUENCY NUMERIC "20000" +// Retrieval info: CONSTANT: INTENDED_DEVICE_FAMILY STRING "Cyclone IV E" +// Retrieval info: CONSTANT: LPM_TYPE STRING "altpll" +// Retrieval info: CONSTANT: OPERATION_MODE STRING "NORMAL" +// Retrieval info: CONSTANT: PLL_TYPE STRING "AUTO" +// Retrieval info: CONSTANT: PORT_ACTIVECLOCK STRING "PORT_UNUSED" +// Retrieval info: CONSTANT: PORT_ARESET STRING "PORT_UNUSED" +// Retrieval info: CONSTANT: PORT_CLKBAD0 STRING "PORT_UNUSED" +// Retrieval info: CONSTANT: PORT_CLKBAD1 STRING "PORT_UNUSED" +// Retrieval info: CONSTANT: PORT_CLKLOSS STRING "PORT_UNUSED" +// Retrieval info: CONSTANT: PORT_CLKSWITCH STRING "PORT_UNUSED" +// Retrieval info: CONSTANT: PORT_CONFIGUPDATE STRING "PORT_UNUSED" +// Retrieval info: CONSTANT: PORT_FBIN STRING "PORT_UNUSED" +// Retrieval info: CONSTANT: PORT_INCLK0 STRING "PORT_USED" +// Retrieval info: CONSTANT: PORT_INCLK1 STRING "PORT_UNUSED" +// Retrieval info: CONSTANT: PORT_LOCKED STRING "PORT_USED" +// Retrieval info: CONSTANT: PORT_PFDENA STRING "PORT_UNUSED" +// Retrieval info: CONSTANT: PORT_PHASECOUNTERSELECT STRING "PORT_UNUSED" +// Retrieval info: CONSTANT: PORT_PHASEDONE STRING "PORT_UNUSED" +// Retrieval info: CONSTANT: PORT_PHASESTEP STRING "PORT_UNUSED" +// Retrieval info: CONSTANT: PORT_PHASEUPDOWN STRING "PORT_UNUSED" +// Retrieval info: CONSTANT: PORT_PLLENA STRING "PORT_UNUSED" +// Retrieval info: CONSTANT: PORT_SCANACLR STRING "PORT_UNUSED" +// Retrieval info: CONSTANT: PORT_SCANCLK STRING "PORT_UNUSED" +// Retrieval info: CONSTANT: PORT_SCANCLKENA STRING "PORT_UNUSED" +// Retrieval info: CONSTANT: PORT_SCANDATA STRING "PORT_UNUSED" +// Retrieval info: CONSTANT: PORT_SCANDATAOUT STRING "PORT_UNUSED" +// Retrieval info: CONSTANT: PORT_SCANDONE STRING "PORT_UNUSED" +// Retrieval info: CONSTANT: PORT_SCANREAD STRING "PORT_UNUSED" +// Retrieval info: CONSTANT: PORT_SCANWRITE STRING "PORT_UNUSED" +// Retrieval info: CONSTANT: PORT_clk0 STRING "PORT_USED" +// Retrieval info: CONSTANT: PORT_clk1 STRING "PORT_UNUSED" +// Retrieval info: CONSTANT: PORT_clk2 STRING "PORT_UNUSED" +// Retrieval info: CONSTANT: PORT_clk3 STRING "PORT_UNUSED" +// Retrieval info: CONSTANT: PORT_clk4 STRING "PORT_UNUSED" +// Retrieval info: CONSTANT: PORT_clk5 STRING "PORT_UNUSED" +// Retrieval info: CONSTANT: PORT_clkena0 STRING "PORT_UNUSED" +// Retrieval info: CONSTANT: PORT_clkena1 STRING "PORT_UNUSED" +// Retrieval info: CONSTANT: PORT_clkena2 STRING "PORT_UNUSED" +// Retrieval info: CONSTANT: PORT_clkena3 STRING "PORT_UNUSED" +// Retrieval info: CONSTANT: PORT_clkena4 STRING "PORT_UNUSED" +// Retrieval info: CONSTANT: PORT_clkena5 STRING "PORT_UNUSED" +// Retrieval info: CONSTANT: PORT_extclk0 STRING "PORT_UNUSED" +// Retrieval info: CONSTANT: PORT_extclk1 STRING "PORT_UNUSED" +// Retrieval info: CONSTANT: PORT_extclk2 STRING "PORT_UNUSED" +// Retrieval info: CONSTANT: PORT_extclk3 STRING "PORT_UNUSED" +// Retrieval info: CONSTANT: SELF_RESET_ON_LOSS_LOCK STRING "OFF" +// Retrieval info: CONSTANT: WIDTH_CLOCK NUMERIC "5" +// Retrieval info: USED_PORT: @clk 0 0 5 0 OUTPUT_CLK_EXT VCC "@clk[4..0]" +// Retrieval info: USED_PORT: c0 0 0 0 0 OUTPUT_CLK_EXT VCC "c0" +// Retrieval info: USED_PORT: inclk0 0 0 0 0 INPUT_CLK_EXT GND "inclk0" +// Retrieval info: USED_PORT: locked 0 0 0 0 OUTPUT GND "locked" +// Retrieval info: CONNECT: @inclk 0 0 1 1 GND 0 0 0 0 +// Retrieval info: CONNECT: @inclk 0 0 1 0 inclk0 0 0 0 0 +// Retrieval info: CONNECT: c0 0 0 0 0 @clk 0 0 1 0 +// Retrieval info: CONNECT: locked 0 0 0 0 @locked 0 0 0 0 +// Retrieval info: GEN_FILE: TYPE_NORMAL pll.v TRUE +// Retrieval info: GEN_FILE: TYPE_NORMAL pll.ppf TRUE +// Retrieval info: GEN_FILE: TYPE_NORMAL pll.inc FALSE +// Retrieval info: GEN_FILE: TYPE_NORMAL pll.cmp FALSE +// Retrieval info: GEN_FILE: TYPE_NORMAL pll.bsf FALSE +// Retrieval info: GEN_FILE: TYPE_NORMAL pll_inst.v FALSE +// Retrieval info: GEN_FILE: TYPE_NORMAL pll_bb.v FALSE +// Retrieval info: LIB_FILE: altera_mf +// Retrieval info: CBX_MODULE_PREFIX: ON Index: components/sd_card/sim/main.cpp =================================================================== --- components/sd_card/sim/main.cpp (nonexistent) +++ components/sd_card/sim/main.cpp (revision 8) @@ -0,0 +1,93 @@ +#include +#include + +#include +#include +#include +#include +#include + +#include "Vdriver_sd.h" +#include "verilated.h" +#include "verilated_vcd_c.h" + +//------------------------------------------------------------------------------ + +typedef unsigned long long uint64; + +//------------------------------------------------------------------------------ + +int main(int argc, char **argv) { + + //-------------------------------------------------------------------------- + + Verilated::commandArgs(argc, argv); + + Verilated::traceEverOn(true); + VerilatedVcdC* tracer = new VerilatedVcdC; + + Vdriver_sd *top = new Vdriver_sd(); + top->trace (tracer, 99); + //tracer->rolloverMB(1000000); + tracer->open("main.vcd"); + + //reset + bool dump_enabled = true; + vluint64_t halfcycle = 0; + + top->clk = 0; top->rst_n = 1; top->eval(); if(dump_enabled) { tracer->dump(halfcycle); } halfcycle++; + top->clk = 0; top->rst_n = 0; top->eval(); if(dump_enabled) { tracer->dump(halfcycle); } halfcycle++; + top->rst_n = 1; + + //-------------------------------------------------------------------------- + + while(!Verilated::gotFinish()) { + + + //---------------------------------------------------------------------- + top->clk = 0; + top->eval(); + + if(dump_enabled) tracer->dump(halfcycle); halfcycle++; + + top->clk = 1; + top->eval(); + + if(dump_enabled) tracer->dump(halfcycle); halfcycle++; + + + tracer->flush(); + //usleep(1); + + if(halfcycle > 1000) break; + } + top->final(); + delete top; + return 0; +} + +/* + input clk, + input rst_n, + + // + input [1:0] avs_address, + input avs_read, + output [31:0] avs_readdata, + input avs_write, + input [31:0] avs_writedata, + + // + output [31:0] avm_address, + input avm_waitrequest, + output avm_read, + input [31:0] avm_readdata, + input avm_readdatavalid, + output avm_write, + output [31:0] avm_writedata, + + // + output reg sd_clk, + inout sd_cmd, + inout [3:0] sd_dat +*/ Index: components/sd_card/sim/Makefile =================================================================== --- components/sd_card/sim/Makefile (nonexistent) +++ components/sd_card/sim/Makefile (revision 8) @@ -0,0 +1,3 @@ +all: + verilator --trace -Wall -CFLAGS "-O3" -LDFLAGS "-O3" --cc ./../../../../rtl/soc/driver_sd/driver_sd.v --exe main.cpp -I./../../../../rtl/soc/driver_sd/ + cd obj_dir && make -f Vdriver_sd.mk Index: components/sd_card/sd.qpf =================================================================== --- components/sd_card/sd.qpf (nonexistent) +++ components/sd_card/sd.qpf (revision 8) @@ -0,0 +1,31 @@ +# -------------------------------------------------------------------------- # +# +# Copyright (C) 1991-2014 Altera Corporation. All rights reserved. +# Your use of Altera Corporation's design tools, logic functions +# and other software and tools, and its AMPP partner logic +# functions, and any output files from any of the foregoing +# (including device programming or simulation files), and any +# associated documentation or information are expressly subject +# to the terms and conditions of the Altera Program License +# Subscription Agreement, the Altera Quartus II License Agreement, +# the Altera MegaCore Function License Agreement, or other +# applicable license agreement, including, without limitation, +# that your use is for the sole purpose of programming logic +# devices manufactured by Altera and sold by Altera or its +# authorized distributors. Please refer to the applicable +# agreement for further details. +# +# -------------------------------------------------------------------------- # +# +# Quartus II 64-Bit +# Version 14.0.0 Build 200 06/17/2014 SJ Web Edition +# Date created = 20:57:06 August 13, 2014 +# +# -------------------------------------------------------------------------- # + +QUARTUS_VERSION = "14.0" +DATE = "20:57:06 August 13, 2014" + +# Revisions + +PROJECT_REVISION = "sd" Index: components/sd_card/sd.qsf =================================================================== --- components/sd_card/sd.qsf (nonexistent) +++ components/sd_card/sd.qsf (revision 8) @@ -0,0 +1,198 @@ +# -------------------------------------------------------------------------- # +# +# Copyright (C) 1991-2014 Altera Corporation. All rights reserved. +# Your use of Altera Corporation's design tools, logic functions +# and other software and tools, and its AMPP partner logic +# functions, and any output files from any of the foregoing +# (including device programming or simulation files), and any +# associated documentation or information are expressly subject +# to the terms and conditions of the Altera Program License +# Subscription Agreement, the Altera Quartus II License Agreement, +# the Altera MegaCore Function License Agreement, or other +# applicable license agreement, including, without limitation, +# that your use is for the sole purpose of programming logic +# devices manufactured by Altera and sold by Altera or its +# authorized distributors. Please refer to the applicable +# agreement for further details. +# +# -------------------------------------------------------------------------- # +# +# Quartus II 64-Bit +# Version 14.0.0 Build 200 06/17/2014 SJ Web Edition +# Date created = 20:57:06 August 13, 2014 +# +# -------------------------------------------------------------------------- # +# +# Notes: +# +# 1) The default values for assignments are stored in the file: +# sd_assignment_defaults.qdf +# If this file doesn't exist, see file: +# assignment_defaults.qdf +# +# 2) Altera recommends that you do not modify this file. This +# file is updated automatically by the Quartus II software +# and any changes you make may be lost or overwritten. +# +# -------------------------------------------------------------------------- # + + +set_global_assignment -name FAMILY "Cyclone IV E" +set_global_assignment -name DEVICE EP4CE115F29C7 +set_global_assignment -name TOP_LEVEL_ENTITY sd +set_global_assignment -name ORIGINAL_QUARTUS_VERSION 14.0 +set_global_assignment -name PROJECT_CREATION_TIME_DATE "20:57:06 AUGUST 13, 2014" +set_global_assignment -name LAST_QUARTUS_VERSION 14.0 +set_global_assignment -name PROJECT_OUTPUT_DIRECTORY output_files +set_global_assignment -name MIN_CORE_JUNCTION_TEMP 0 +set_global_assignment -name MAX_CORE_JUNCTION_TEMP 85 +set_global_assignment -name ERROR_CHECK_FREQUENCY_DIVISOR 1 +set_global_assignment -name NOMINAL_CORE_SUPPLY_VOLTAGE 1.2V +set_global_assignment -name POWER_PRESET_COOLING_SOLUTION "23 MM HEAT SINK WITH 200 LFPM AIRFLOW" +set_global_assignment -name POWER_BOARD_THERMAL_MODEL "NONE (CONSERVATIVE)" + +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to CLOCK_50 +set_location_assignment PIN_Y2 -to CLOCK_50 + +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_BA[0] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_BA[1] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQM[0] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQM[1] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQM[2] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQM[3] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_RAS_N +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_CAS_N +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_CKE +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_CLK +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_WE_N +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_CS_N +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[0] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[1] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[2] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[3] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[4] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[5] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[6] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[7] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[8] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[9] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[10] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[11] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[12] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[13] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[14] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[15] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[16] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[17] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[18] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[19] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[20] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[21] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[22] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[23] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[24] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[25] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[26] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[27] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[28] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[29] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[30] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[31] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_ADDR[0] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_ADDR[1] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_ADDR[2] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_ADDR[3] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_ADDR[4] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_ADDR[5] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_ADDR[6] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_ADDR[7] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_ADDR[8] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_ADDR[9] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_ADDR[10] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_ADDR[11] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_ADDR[12] +set_location_assignment PIN_U1 -to DRAM_DQ[31] +set_location_assignment PIN_U4 -to DRAM_DQ[30] +set_location_assignment PIN_T3 -to DRAM_DQ[29] +set_location_assignment PIN_R3 -to DRAM_DQ[28] +set_location_assignment PIN_R2 -to DRAM_DQ[27] +set_location_assignment PIN_R1 -to DRAM_DQ[26] +set_location_assignment PIN_R7 -to DRAM_DQ[25] +set_location_assignment PIN_U5 -to DRAM_DQ[24] +set_location_assignment PIN_M8 -to DRAM_DQ[16] +set_location_assignment PIN_L8 -to DRAM_DQ[17] +set_location_assignment PIN_P2 -to DRAM_DQ[18] +set_location_assignment PIN_N3 -to DRAM_DQ[19] +set_location_assignment PIN_N4 -to DRAM_DQ[20] +set_location_assignment PIN_M4 -to DRAM_DQ[21] +set_location_assignment PIN_M7 -to DRAM_DQ[22] +set_location_assignment PIN_L7 -to DRAM_DQ[23] +set_location_assignment PIN_Y3 -to DRAM_DQ[8] +set_location_assignment PIN_Y4 -to DRAM_DQ[9] +set_location_assignment PIN_AB1 -to DRAM_DQ[10] +set_location_assignment PIN_AA3 -to DRAM_DQ[11] +set_location_assignment PIN_AB2 -to DRAM_DQ[12] +set_location_assignment PIN_AC1 -to DRAM_DQ[13] +set_location_assignment PIN_AB3 -to DRAM_DQ[14] +set_location_assignment PIN_AC2 -to DRAM_DQ[15] +set_location_assignment PIN_W3 -to DRAM_DQ[0] +set_location_assignment PIN_W2 -to DRAM_DQ[1] +set_location_assignment PIN_V4 -to DRAM_DQ[2] +set_location_assignment PIN_W1 -to DRAM_DQ[3] +set_location_assignment PIN_V3 -to DRAM_DQ[4] +set_location_assignment PIN_V2 -to DRAM_DQ[5] +set_location_assignment PIN_V1 -to DRAM_DQ[6] +set_location_assignment PIN_U3 -to DRAM_DQ[7] +set_location_assignment PIN_W4 -to DRAM_DQM[1] +set_location_assignment PIN_K8 -to DRAM_DQM[2] +set_location_assignment PIN_U2 -to DRAM_DQM[0] +set_location_assignment PIN_N8 -to DRAM_DQM[3] +set_location_assignment PIN_U6 -to DRAM_RAS_N +set_location_assignment PIN_V7 -to DRAM_CAS_N +set_location_assignment PIN_AA6 -to DRAM_CKE +set_location_assignment PIN_V6 -to DRAM_WE_N +set_location_assignment PIN_T4 -to DRAM_CS_N +set_location_assignment PIN_U7 -to DRAM_BA[0] +set_location_assignment PIN_R4 -to DRAM_BA[1] +set_location_assignment PIN_Y7 -to DRAM_ADDR[12] +set_location_assignment PIN_AA5 -to DRAM_ADDR[11] +set_location_assignment PIN_R5 -to DRAM_ADDR[10] +set_location_assignment PIN_Y6 -to DRAM_ADDR[9] +set_location_assignment PIN_Y5 -to DRAM_ADDR[8] +set_location_assignment PIN_AA7 -to DRAM_ADDR[7] +set_location_assignment PIN_W7 -to DRAM_ADDR[6] +set_location_assignment PIN_W8 -to DRAM_ADDR[5] +set_location_assignment PIN_V5 -to DRAM_ADDR[4] +set_location_assignment PIN_R6 -to DRAM_ADDR[0] +set_location_assignment PIN_V8 -to DRAM_ADDR[1] +set_location_assignment PIN_U8 -to DRAM_ADDR[2] +set_location_assignment PIN_P1 -to DRAM_ADDR[3] +set_location_assignment PIN_AE5 -to DRAM_CLK + +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to SD_CMD +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to SD_CLK +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to SD_WP_N +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to SD_DAT[0] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to SD_DAT[1] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to SD_DAT[2] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to SD_DAT[3] + +set_location_assignment PIN_AE14 -to SD_DAT[0] +set_location_assignment PIN_AF13 -to SD_DAT[1] +set_location_assignment PIN_AB14 -to SD_DAT[2] +set_location_assignment PIN_AC14 -to SD_DAT[3] +set_location_assignment PIN_AE13 -to SD_CLK +set_location_assignment PIN_AD14 -to SD_CMD +set_location_assignment PIN_AF14 -to SD_WP_N + +set_global_assignment -name PARTITION_NETLIST_TYPE SOURCE -section_id Top +set_global_assignment -name PARTITION_FITTER_PRESERVATION_LEVEL PLACEMENT_AND_ROUTING -section_id Top +set_global_assignment -name PARTITION_COLOR 16764057 -section_id Top +set_global_assignment -name ENABLE_SIGNALTAP OFF +set_global_assignment -name USE_SIGNALTAP_FILE stp1.stp +set_global_assignment -name QIP_FILE system/synthesis/system.qip +set_global_assignment -name VERILOG_FILE sd.v +set_global_assignment -name QIP_FILE pll/pll.qip +set_global_assignment -name SDC_FILE sd.sdc +set_global_assignment -name CDF_FILE output_files/Chain1.cdf +set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top \ No newline at end of file Index: components/sd_card/driver_sd_hw.tcl =================================================================== --- components/sd_card/driver_sd_hw.tcl (nonexistent) +++ components/sd_card/driver_sd_hw.tcl (revision 8) @@ -0,0 +1,207 @@ +# TCL File Generated by Component Editor 14.0 +# Sat Aug 16 23:15:43 CEST 2014 +# DO NOT MODIFY + + +# +# driver_sd "driver_sd" v1.0 +# 2014.08.16.23:15:43 +# +# + +# +# request TCL package from ACDS 14.0 +# +package require -exact qsys 14.0 + + +# +# module driver_sd +# +set_module_property DESCRIPTION "" +set_module_property NAME driver_sd +set_module_property VERSION 1.0 +set_module_property INTERNAL false +set_module_property OPAQUE_ADDRESS_MAP true +set_module_property AUTHOR "" +set_module_property DISPLAY_NAME driver_sd +set_module_property INSTANTIATE_IN_SYSTEM_MODULE true +set_module_property EDITABLE true +set_module_property REPORT_TO_TALKBACK false +set_module_property ALLOW_GREYBOX_GENERATION false +set_module_property REPORT_HIERARCHY false + + +# +# file sets +# +add_fileset QUARTUS_SYNTH QUARTUS_SYNTH "" "" +set_fileset_property QUARTUS_SYNTH TOP_LEVEL driver_sd +set_fileset_property QUARTUS_SYNTH ENABLE_RELATIVE_INCLUDE_PATHS false +set_fileset_property QUARTUS_SYNTH ENABLE_FILE_OVERWRITE_MODE false +add_fileset_file avalon_master.v VERILOG PATH ./../../../rtl/soc/driver_sd/avalon_master.v +add_fileset_file avalon_slave.v VERILOG PATH ./../../../rtl/soc/driver_sd/avalon_slave.v +add_fileset_file card_init.v VERILOG PATH ./../../../rtl/soc/driver_sd/card_init.v +add_fileset_file card_read.v VERILOG PATH ./../../../rtl/soc/driver_sd/card_read.v +add_fileset_file card_write.v VERILOG PATH ./../../../rtl/soc/driver_sd/card_write.v +add_fileset_file cmd.v VERILOG PATH ./../../../rtl/soc/driver_sd/cmd.v +add_fileset_file dat.v VERILOG PATH ./../../../rtl/soc/driver_sd/dat.v +add_fileset_file driver_sd.v VERILOG PATH ./../../../rtl/soc/driver_sd/driver_sd.v TOP_LEVEL_FILE + + +# +# parameters +# + + +# +# display items +# + + +# +# connection point clock +# +add_interface clock clock end +set_interface_property clock clockRate 0 +set_interface_property clock ENABLED true +set_interface_property clock EXPORT_OF "" +set_interface_property clock PORT_NAME_MAP "" +set_interface_property clock CMSIS_SVD_VARIABLES "" +set_interface_property clock SVD_ADDRESS_GROUP "" + +add_interface_port clock clk clk Input 1 + + +# +# connection point avalon_slave_0 +# +add_interface avalon_slave_0 avalon end +set_interface_property avalon_slave_0 addressUnits WORDS +set_interface_property avalon_slave_0 associatedClock clock +set_interface_property avalon_slave_0 associatedReset reset_sink +set_interface_property avalon_slave_0 bitsPerSymbol 8 +set_interface_property avalon_slave_0 burstOnBurstBoundariesOnly false +set_interface_property avalon_slave_0 burstcountUnits WORDS +set_interface_property avalon_slave_0 explicitAddressSpan 0 +set_interface_property avalon_slave_0 holdTime 0 +set_interface_property avalon_slave_0 linewrapBursts false +set_interface_property avalon_slave_0 maximumPendingReadTransactions 0 +set_interface_property avalon_slave_0 maximumPendingWriteTransactions 0 +set_interface_property avalon_slave_0 readLatency 0 +set_interface_property avalon_slave_0 readWaitTime 1 +set_interface_property avalon_slave_0 setupTime 0 +set_interface_property avalon_slave_0 timingUnits Cycles +set_interface_property avalon_slave_0 writeWaitTime 0 +set_interface_property avalon_slave_0 ENABLED true +set_interface_property avalon_slave_0 EXPORT_OF "" +set_interface_property avalon_slave_0 PORT_NAME_MAP "" +set_interface_property avalon_slave_0 CMSIS_SVD_VARIABLES "" +set_interface_property avalon_slave_0 SVD_ADDRESS_GROUP "" + +add_interface_port avalon_slave_0 avs_address address Input 2 +add_interface_port avalon_slave_0 avs_read read Input 1 +add_interface_port avalon_slave_0 avs_readdata readdata Output 32 +add_interface_port avalon_slave_0 avs_write write Input 1 +add_interface_port avalon_slave_0 avs_writedata writedata Input 32 +set_interface_assignment avalon_slave_0 embeddedsw.configuration.isFlash 0 +set_interface_assignment avalon_slave_0 embeddedsw.configuration.isMemoryDevice 0 +set_interface_assignment avalon_slave_0 embeddedsw.configuration.isNonVolatileStorage 0 +set_interface_assignment avalon_slave_0 embeddedsw.configuration.isPrintableDevice 0 + + +# +# connection point avalon_master_0 +# +add_interface avalon_master_0 avalon start +set_interface_property avalon_master_0 addressUnits SYMBOLS +set_interface_property avalon_master_0 associatedClock clock +set_interface_property avalon_master_0 associatedReset reset_sink +set_interface_property avalon_master_0 bitsPerSymbol 8 +set_interface_property avalon_master_0 burstOnBurstBoundariesOnly false +set_interface_property avalon_master_0 burstcountUnits WORDS +set_interface_property avalon_master_0 doStreamReads false +set_interface_property avalon_master_0 doStreamWrites false +set_interface_property avalon_master_0 holdTime 0 +set_interface_property avalon_master_0 linewrapBursts false +set_interface_property avalon_master_0 maximumPendingReadTransactions 0 +set_interface_property avalon_master_0 maximumPendingWriteTransactions 0 +set_interface_property avalon_master_0 readLatency 0 +set_interface_property avalon_master_0 readWaitTime 1 +set_interface_property avalon_master_0 setupTime 0 +set_interface_property avalon_master_0 timingUnits Cycles +set_interface_property avalon_master_0 writeWaitTime 0 +set_interface_property avalon_master_0 ENABLED true +set_interface_property avalon_master_0 EXPORT_OF "" +set_interface_property avalon_master_0 PORT_NAME_MAP "" +set_interface_property avalon_master_0 CMSIS_SVD_VARIABLES "" +set_interface_property avalon_master_0 SVD_ADDRESS_GROUP "" + +add_interface_port avalon_master_0 avm_waitrequest waitrequest Input 1 +add_interface_port avalon_master_0 avm_read read Output 1 +add_interface_port avalon_master_0 avm_readdata readdata Input 32 +add_interface_port avalon_master_0 avm_readdatavalid readdatavalid Input 1 +add_interface_port avalon_master_0 avm_write write Output 1 +add_interface_port avalon_master_0 avm_writedata writedata Output 32 +add_interface_port avalon_master_0 avm_address address Output 32 + + +# +# connection point reset_sink +# +add_interface reset_sink reset end +set_interface_property reset_sink associatedClock clock +set_interface_property reset_sink synchronousEdges DEASSERT +set_interface_property reset_sink ENABLED true +set_interface_property reset_sink EXPORT_OF "" +set_interface_property reset_sink PORT_NAME_MAP "" +set_interface_property reset_sink CMSIS_SVD_VARIABLES "" +set_interface_property reset_sink SVD_ADDRESS_GROUP "" + +add_interface_port reset_sink rst_n reset_n Input 1 + + +# +# connection point conduit_cmd +# +add_interface conduit_cmd conduit end +set_interface_property conduit_cmd associatedClock clock +set_interface_property conduit_cmd associatedReset reset_sink +set_interface_property conduit_cmd ENABLED true +set_interface_property conduit_cmd EXPORT_OF "" +set_interface_property conduit_cmd PORT_NAME_MAP "" +set_interface_property conduit_cmd CMSIS_SVD_VARIABLES "" +set_interface_property conduit_cmd SVD_ADDRESS_GROUP "" + +add_interface_port conduit_cmd sd_cmd export Bidir 1 + + +# +# connection point conduit_dat +# +add_interface conduit_dat conduit end +set_interface_property conduit_dat associatedClock clock +set_interface_property conduit_dat associatedReset reset_sink +set_interface_property conduit_dat ENABLED true +set_interface_property conduit_dat EXPORT_OF "" +set_interface_property conduit_dat PORT_NAME_MAP "" +set_interface_property conduit_dat CMSIS_SVD_VARIABLES "" +set_interface_property conduit_dat SVD_ADDRESS_GROUP "" + +add_interface_port conduit_dat sd_dat export Bidir 4 + + +# +# connection point conduit_clk +# +add_interface conduit_clk conduit end +set_interface_property conduit_clk associatedClock clock +set_interface_property conduit_clk associatedReset reset_sink +set_interface_property conduit_clk ENABLED true +set_interface_property conduit_clk EXPORT_OF "" +set_interface_property conduit_clk PORT_NAME_MAP "" +set_interface_property conduit_clk CMSIS_SVD_VARIABLES "" +set_interface_property conduit_clk SVD_ADDRESS_GROUP "" + +add_interface_port conduit_clk sd_clk export Output 1 + Index: components/sd_card/slow_mem_hw.tcl =================================================================== --- components/sd_card/slow_mem_hw.tcl (nonexistent) +++ components/sd_card/slow_mem_hw.tcl (revision 8) @@ -0,0 +1,120 @@ +# TCL File Generated by Component Editor 14.0 +# Sun Aug 17 21:40:44 CEST 2014 +# DO NOT MODIFY + + +# +# slow_mem "slow_mem" v1.0 +# 2014.08.17.21:40:44 +# +# + +# +# request TCL package from ACDS 14.0 +# +package require -exact qsys 14.0 + + +# +# module slow_mem +# +set_module_property DESCRIPTION "" +set_module_property NAME slow_mem +set_module_property VERSION 1.0 +set_module_property INTERNAL false +set_module_property OPAQUE_ADDRESS_MAP true +set_module_property AUTHOR "" +set_module_property DISPLAY_NAME slow_mem +set_module_property INSTANTIATE_IN_SYSTEM_MODULE true +set_module_property EDITABLE true +set_module_property REPORT_TO_TALKBACK false +set_module_property ALLOW_GREYBOX_GENERATION false +set_module_property REPORT_HIERARCHY false + + +# +# file sets +# +add_fileset QUARTUS_SYNTH QUARTUS_SYNTH "" "" +set_fileset_property QUARTUS_SYNTH TOP_LEVEL slow_mem +set_fileset_property QUARTUS_SYNTH ENABLE_RELATIVE_INCLUDE_PATHS false +set_fileset_property QUARTUS_SYNTH ENABLE_FILE_OVERWRITE_MODE false +add_fileset_file slow_mem.v VERILOG PATH slow_mem/slow_mem.v TOP_LEVEL_FILE + + +# +# parameters +# + + +# +# display items +# + + +# +# connection point clock +# +add_interface clock clock end +set_interface_property clock clockRate 0 +set_interface_property clock ENABLED true +set_interface_property clock EXPORT_OF "" +set_interface_property clock PORT_NAME_MAP "" +set_interface_property clock CMSIS_SVD_VARIABLES "" +set_interface_property clock SVD_ADDRESS_GROUP "" + +add_interface_port clock clk clk Input 1 + + +# +# connection point avalon_slave_0 +# +add_interface avalon_slave_0 avalon end +set_interface_property avalon_slave_0 addressUnits SYMBOLS +set_interface_property avalon_slave_0 associatedClock clock +set_interface_property avalon_slave_0 associatedReset reset_sink +set_interface_property avalon_slave_0 bitsPerSymbol 8 +set_interface_property avalon_slave_0 burstOnBurstBoundariesOnly false +set_interface_property avalon_slave_0 burstcountUnits SYMBOLS +set_interface_property avalon_slave_0 explicitAddressSpan 0 +set_interface_property avalon_slave_0 holdTime 0 +set_interface_property avalon_slave_0 linewrapBursts false +set_interface_property avalon_slave_0 maximumPendingReadTransactions 0 +set_interface_property avalon_slave_0 maximumPendingWriteTransactions 0 +set_interface_property avalon_slave_0 readLatency 0 +set_interface_property avalon_slave_0 readWaitTime 1 +set_interface_property avalon_slave_0 setupTime 0 +set_interface_property avalon_slave_0 timingUnits Cycles +set_interface_property avalon_slave_0 writeWaitTime 0 +set_interface_property avalon_slave_0 ENABLED true +set_interface_property avalon_slave_0 EXPORT_OF "" +set_interface_property avalon_slave_0 PORT_NAME_MAP "" +set_interface_property avalon_slave_0 CMSIS_SVD_VARIABLES "" +set_interface_property avalon_slave_0 SVD_ADDRESS_GROUP "" + +add_interface_port avalon_slave_0 avs_address address Input 10 +add_interface_port avalon_slave_0 avs_read read Input 1 +add_interface_port avalon_slave_0 avs_readdata readdata Output 8 +add_interface_port avalon_slave_0 avs_write write Input 1 +add_interface_port avalon_slave_0 avs_writedata writedata Input 8 +add_interface_port avalon_slave_0 avs_waitrequest waitrequest Output 1 +set_interface_assignment avalon_slave_0 embeddedsw.configuration.isFlash 0 +set_interface_assignment avalon_slave_0 embeddedsw.configuration.isMemoryDevice 0 +set_interface_assignment avalon_slave_0 embeddedsw.configuration.isNonVolatileStorage 0 +set_interface_assignment avalon_slave_0 embeddedsw.configuration.isPrintableDevice 0 + + +# +# connection point reset_sink +# +add_interface reset_sink reset end +set_interface_property reset_sink associatedClock clock +set_interface_property reset_sink synchronousEdges DEASSERT +set_interface_property reset_sink ENABLED true +set_interface_property reset_sink EXPORT_OF "" +set_interface_property reset_sink PORT_NAME_MAP "" +set_interface_property reset_sink CMSIS_SVD_VARIABLES "" +set_interface_property reset_sink SVD_ADDRESS_GROUP "" + +add_interface_port reset_sink rst_n reset_n Input 1 + Index: components/sd_card/system.sopcinfo =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/xml Index: components/sd_card/system.sopcinfo =================================================================== --- components/sd_card/system.sopcinfo (nonexistent) +++ components/sd_card/system.sopcinfo (revision 8)
components/sd_card/system.sopcinfo Property changes : Added: svn:mime-type ## -0,0 +1 ## +application/xml \ No newline at end of property Index: components/sd_card/sd.v =================================================================== --- components/sd_card/sd.v (nonexistent) +++ components/sd_card/sd.v (revision 8) @@ -0,0 +1,61 @@ + +module sd( + input CLOCK_50, + + //SDRAM + output [12:0] DRAM_ADDR, + output [1:0] DRAM_BA, + output DRAM_CAS_N, + output DRAM_CKE, + output DRAM_CLK, + output DRAM_CS_N, + inout [31:0] DRAM_DQ, + output [3:0] DRAM_DQM, + output DRAM_RAS_N, + output DRAM_WE_N, + + //SD + output SD_CLK, + inout SD_CMD, + inout [3:0] SD_DAT, + input SD_WP_N +); + +//------------------------------------------------------------------------------ + +assign DRAM_CLK = clk_sys; + +//------------------------------------------------------------------------------ + +wire clk_sys; + +wire rst_n; + +pll pll_inst( + .inclk0 (CLOCK_50), + .c0 (clk_sys), + .locked (rst_n) +); + +system u0 ( + .clk_clk (clk_sys), + .reset_reset_n (rst_n), + + .sdram_wire_addr (DRAM_ADDR), + .sdram_wire_ba (DRAM_BA), + .sdram_wire_cas_n (DRAM_CAS_N), + .sdram_wire_cke (DRAM_CKE), + .sdram_wire_cs_n (DRAM_CS_N), + .sdram_wire_dq (DRAM_DQ), + .sdram_wire_dqm (DRAM_DQM), + .sdram_wire_ras_n (DRAM_RAS_N), + .sdram_wire_we_n (DRAM_WE_N), + + .conduit_clk_export (SD_CLK), + .conduit_cmd_export (SD_CMD), + .conduit_dat_export (SD_DAT) +); + +//------------------------------------------------------------------------------ + +endmodule Index: components/sd_card/firmware/exe/.force_rebuild =================================================================== Index: components/sd_card/firmware/exe/.project =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/xml Index: components/sd_card/firmware/exe/.project =================================================================== --- components/sd_card/firmware/exe/.project (nonexistent) +++ components/sd_card/firmware/exe/.project (revision 8)
components/sd_card/firmware/exe/.project Property changes : Added: svn:mime-type ## -0,0 +1 ## +application/xml \ No newline at end of property Index: components/sd_card/firmware/exe/main.cpp =================================================================== --- components/sd_card/firmware/exe/main.cpp (nonexistent) +++ components/sd_card/firmware/exe/main.cpp (revision 8) @@ -0,0 +1,150 @@ +/* + * This file is subject to the terms and conditions of the BSD License. See + * the file "LICENSE" in the main directory of this archive for more details. + * + * Copyright (C) 2014 Aleksander Osman + */ + +#include +#include + +#include +#include + +int tst_0() { + volatile unsigned char buf[512]; + + int status = IORD(DRIVER_SD_0_BASE, 0); + + printf("SD card status: %d\n", status); + + memset((void *)buf, 0, sizeof(buf)); + + IOWR(DRIVER_SD_0_BASE, 0, (int)buf); + IOWR(DRIVER_SD_0_BASE, 1, 0); + IOWR(DRIVER_SD_0_BASE, 2, 1); + IOWR(DRIVER_SD_0_BASE, 3, 2); //read + + while(1) { + status = IORD(DRIVER_SD_0_BASE, 0); + printf("SD card status for read: %d\n", status); + + if(status == 2) break; + } + + int i; + for(i=0; i<512; i++) { + if(i > 0 && (i%32) == 0) printf("\n"); + + printf("%02x ", buf[i]); + } + printf("\n"); + + for(i=0; i<512; i++) if(buf[i] != (unsigned char)i) printf("Not Equal: %d\n", i); + + for(i=0; i<512; i++) buf[i] = i; + + IOWR(DRIVER_SD_0_BASE, 0, (int)buf); + IOWR(DRIVER_SD_0_BASE, 1, 0); + IOWR(DRIVER_SD_0_BASE, 2, 1); + IOWR(DRIVER_SD_0_BASE, 3, 3); //write + + while(1) { + status = IORD(DRIVER_SD_0_BASE, 0); + printf("SD card status for write: %d\n", status); + + if(status == 2) break; + } + + return 0; +} + +int tst_1() { + + unsigned char buf[1024]; + + //IOWR(DRIVER_SD_0_BASE, 3, 1); + + while(IORD(DRIVER_SD_0_BASE, 0) != 2); + + printf("card init\n"); + + unsigned char *slow_mem = (unsigned char *)0x08011000; + for(int i=0; i<1024; i++) slow_mem[i] = i*3; + + /* + for(int i=0; i<1024; i++) { + if(i > 0 && (i%16) == 0) printf("\n"); + printf("%02x ", slow_mem[i]); + } + printf("\n----------\n"); + */ + + IOWR(DRIVER_SD_0_BASE, 0, (int)slow_mem); + IOWR(DRIVER_SD_0_BASE, 1, 5859380); + IOWR(DRIVER_SD_0_BASE, 2, 2); + IOWR(DRIVER_SD_0_BASE, 3, 3); + + while(IORD(DRIVER_SD_0_BASE, 0) != 2); + + memset((void *)slow_mem, 0, sizeof(buf)); + memset((void *)buf, 0, sizeof(buf)); + + for(int i=0; i<2; i++) { + IOWR(DRIVER_SD_0_BASE, 0, (i==0)? (int)buf : (int)slow_mem); + IOWR(DRIVER_SD_0_BASE, 1, 5859380); + IOWR(DRIVER_SD_0_BASE, 2, 2); + IOWR(DRIVER_SD_0_BASE, 3, 2); + + while(IORD(DRIVER_SD_0_BASE, 0) != 2); + } + + if(memcmp((const void*)slow_mem, (const void *)buf, sizeof(buf)) != 0) printf("read mismatch !\n"); + + int mismatched = 0; + for(int i=0; i<1024; i++) { + if(buf[i] != ((i*3) & 0xFF)) mismatched++; + } + printf("\nmismatched: %d\n", mismatched); + + if(mismatched > 0) { + for(int i=0; i<1024; i++) { + if(i > 0 && (i%16) == 0) printf("\n"); + printf("%02x ", slow_mem[i]); + } + printf("\n"); + for(int i=0; i<1024; i++) { + if(i > 0 && (i%16) == 0) printf("\n"); + printf("%02x ", buf[i]); + } + } + printf("\n"); + + return 0; +} + +int main() { + + while(IORD(DRIVER_SD_0_BASE, 0) != 2); + + printf("card init\n"); + + tst_0(); + + printf("filling memory from sd card...\n"); + + unsigned char *sdram_ptr = (unsigned char *)0x00000000; + + IOWR(DRIVER_SD_0_BASE, 0, (int)sdram_ptr); + IOWR(DRIVER_SD_0_BASE, 1, 0); + IOWR(DRIVER_SD_0_BASE, 2, 262144); + IOWR(DRIVER_SD_0_BASE, 3, 2); //read + + while(IORD(DRIVER_SD_0_BASE, 0) != 2); + + printf("done\n"); + + return 0; +} + + Index: components/sd_card/firmware/exe/.cproject =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/xml Index: components/sd_card/firmware/exe/.cproject =================================================================== --- components/sd_card/firmware/exe/.cproject (nonexistent) +++ components/sd_card/firmware/exe/.cproject (revision 8)
components/sd_card/firmware/exe/.cproject Property changes : Added: svn:mime-type ## -0,0 +1 ## +application/xml \ No newline at end of property Index: components/sd_card/firmware/exe/Makefile =================================================================== --- components/sd_card/firmware/exe/Makefile (nonexistent) +++ components/sd_card/firmware/exe/Makefile (revision 8) @@ -0,0 +1,1082 @@ +#------------------------------------------------------------------------------ +# VARIABLES APPENDED TO BY INCLUDED MAKEFILE FRAGMENTS +#------------------------------------------------------------------------------ + +# List of include directories for -I compiler option (-I added when used). +# Includes the BSP. +ALT_INCLUDE_DIRS := + +# List of library directories for -L linker option (-L added when used). +# Includes the BSP. +ALT_LIBRARY_DIRS := + +# List of library names for -l linker option (-l added when used). +# Includes the BSP. +ALT_LIBRARY_NAMES := + +# List of library names for -msys-lib linker option (-msys-lib added when used). +# These are libraries that might be located in the BSP and depend on the BSP +# library, or vice versa +ALT_BSP_DEP_LIBRARY_NAMES := + +# List of dependencies for the linker. This is usually the full pathname +# of each library (*.a) file. +# Includes the BSP. +ALT_LDDEPS := + +# List of root library directories that support running make to build them. +# Includes the BSP and any ALT libraries. +MAKEABLE_LIBRARY_ROOT_DIRS := + +# Generic flags passed to the compiler for different types of input files. +ALT_CFLAGS := +ALT_CXXFLAGS := +ALT_CPPFLAGS := +ALT_ASFLAGS := +ALT_LDFLAGS := + + +#------------------------------------------------------------------------------ +# The adjust-path macro +# +# If COMSPEC/ComSpec is defined, Make is launched from Windows through +# Cygwin. The adjust-path macro converts absolute windows paths into +# unix style paths (Example: c:/dir -> /c/dir). This will ensture +# paths are readable by GNU Make. +# +# If COMSPEC/ComSpec is not defined, Make is launched from linux, and no +# adjustment is necessary +# +#------------------------------------------------------------------------------ + +ifndef COMSPEC +ifdef ComSpec +COMSPEC = $(ComSpec) +endif # ComSpec +endif # COMSPEC + +ifdef COMSPEC # if Windows OS + +ifeq ($(MAKE_VERSION),3.81) +# +# adjust-path/adjust-path-mixed for Mingw Gnu Make on Windows +# +# Example Usage: +# $(call adjust-path,c:/aaa/bbb) => /c/aaa/bbb +# $(call adjust-path-mixed,/c/aaa/bbb) => c:/aaa/bbb +# $(call adjust-path-mixed,/cygdrive/c/aaa/bbb) => c:/aaa/bbb +# + +# +# adjust-path +# - converts back slash characters into forward slashes +# - if input arg ($1) is an empty string then return the empty string +# - if input arg ($1) does not contain the string ":/", then return input arg +# - using sed, convert mixed path [c:/...] into mingw path [/c/...] +define adjust-path +$(strip \ +$(if $1,\ +$(if $(findstring :/,$(subst \,/,$1)),\ +$(shell echo $(subst \,/,$1) | sed -e 's,^\([a-zA-Z]\):/,/\1/,'),\ +$(subst \,/,$1)))) +endef + +# +# adjust-path-mixed +# - converts back slash characters into forward slashes +# - if input arg ($1) is an empty string then return the empty string +# - if input arg ($1) does not begin with a forward slash '/' char, then +# return input arg +# - using sed, convert mingw path [/c/...] or cygwin path [/c/cygdrive/...] +# into a mixed path [c:/...] +define adjust-path-mixed +$(strip \ +$(if $1,\ +$(if $(findstring $(subst \,/,$1),$(patsubst /%,%,$(subst \,/,$1))),\ +$(subst \,/,$1),\ +$(shell echo $(subst \,/,$1) | sed -e 's,^/cygdrive/\([a-zA-Z]\)/,\1:/,' -e 's,^/\([a-zA-Z]\)/,\1:/,')))) +endef + +else # MAKE_VERSION != 3.81 (MAKE_VERSION == 3.80 or MAKE_VERSION == 3.79) +# +# adjust-path for Cygwin Gnu Make +# $(call adjust-path,c:/aaa/bbb) = /cygdrive/c/aaa/bbb +# $(call adjust-path-mixed,/cygdrive/c/aaa/bbb) = c:/aaa/bbb +# +adjust-path = $(if $1,$(shell cygpath -u "$1"),) +adjust-path-mixed = $(if $1,$(shell cygpath -m "$1"),) +endif + +else # !COMSPEC + +adjust-path = $1 +adjust-path-mixed = $1 + +endif # COMSPEC + + +#vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv +# GENERATED SETTINGS START v +#vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv + +#START GENERATED +ACTIVE_BUILD_CONFIG := default +BUILD_CONFIGS := default + +# The following TYPE comment allows tools to identify the 'type' of target this +# makefile is associated with. +# TYPE: APP_MAKEFILE + +# This following VERSION comment indicates the version of the tool used to +# generate this makefile. A makefile variable is provided for VERSION as well. +# ACDS_VERSION: 14.0 +ACDS_VERSION := 14.0 + +# This following BUILD_NUMBER comment indicates the build number of the tool +# used to generate this makefile. +# BUILD_NUMBER: 200 + +# Define path to the application ELF. +# It may be used by the makefile fragments so is defined before including them. +# +ELF := exe.elf + +# Paths to C, C++, and assembly source files. +C_SRCS := +CXX_SRCS := main.cpp +ASM_SRCS := + + +# Path to root of object file tree. +OBJ_ROOT_DIR := obj + +# Options to control objdump. +CREATE_OBJDUMP := 1 +OBJDUMP_INCLUDE_SOURCE := 0 +OBJDUMP_FULL_CONTENTS := 0 + +# Options to enable/disable optional files. +CREATE_ELF_DERIVED_FILES := 0 +CREATE_LINKER_MAP := 1 + +# Common arguments for ALT_CFLAGSs +APP_CFLAGS_DEFINED_SYMBOLS := +APP_CFLAGS_UNDEFINED_SYMBOLS := +APP_CFLAGS_OPTIMIZATION := -Os +APP_CFLAGS_DEBUG_LEVEL := -g +APP_CFLAGS_WARNINGS := -Wall +APP_CFLAGS_USER_FLAGS := + +APP_ASFLAGS_USER := +APP_LDFLAGS_USER := + +# Linker options that have default values assigned later if not +# assigned here. +LINKER_SCRIPT := +CRT0 := +SYS_LIB := + +# Define path to the root of the BSP. +BSP_ROOT_DIR := ../bsp/ + +# List of application specific include directories, library directories and library names +APP_INCLUDE_DIRS := +APP_LIBRARY_DIRS := +APP_LIBRARY_NAMES := + +# Pre- and post- processor settings. +BUILD_PRE_PROCESS := +BUILD_POST_PROCESS := + + + +#END GENERATED + +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +# GENERATED SETTINGS END ^ +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + +#------------------------------------------------------------------------------ +# DEFAULT TARGET +#------------------------------------------------------------------------------ + +# Define the variable used to echo output if not already defined. +ifeq ($(ECHO),) +ECHO := echo +endif + +# Put "all" rule before included makefile fragments because they may +# define rules and we don't want one of those to become the default rule. +.PHONY : all + +all: + @$(ECHO) [$(APP_NAME) build complete] + +all : build_pre_process libs app build_post_process + + +#------------------------------------------------------------------------------ +# VARIABLES DEPENDENT ON GENERATED CONTENT +#------------------------------------------------------------------------------ + +# Define object file directory per build configuration +CONFIG_OBJ_DIR := $(OBJ_ROOT_DIR)/$(ACTIVE_BUILD_CONFIG) + +ifeq ($(BSP_ROOT_DIR),) +$(error Edit Makefile and provide a value for BSP_ROOT_DIR) +endif + +ifeq ($(wildcard $(BSP_ROOT_DIR)),) +$(error BSP directory does not exist: $(BSP_ROOT_DIR)) +endif + +# Define absolute path to the root of the BSP. +ABS_BSP_ROOT_DIR := $(call adjust-path-mixed,$(shell cd "$(BSP_ROOT_DIR)"; pwd)) + +# Include makefile fragments. Define variable ALT_LIBRARY_ROOT_DIR before +# including each makefile fragment so that it knows the path to itself. +BSP_INCLUDE_FILE := $(BSP_ROOT_DIR)/public.mk +ALT_LIBRARY_ROOT_DIR := $(BSP_ROOT_DIR) +include $(BSP_INCLUDE_FILE) +# C2H will need this to touch the BSP public.mk and avoid the sopc file +# out-of-date error during a BSP make +ABS_BSP_INCLUDE_FILE := $(ABS_BSP_ROOT_DIR)/public.mk + + +ifneq ($(WARNING.SMALL_STACK_SIZE),) +# This WARNING is here to protect you from unknowingly using a very small stack +# If the warning is set, increase your stack size or enable the BSP small stack +# setting to eliminate the warning +$(warning WARNING: $(WARNING.SMALL_STACK_SIZE)) +endif + +# If the BSP public.mk indicates that ALT_SIM_OPTIMIZE is set, rename the ELF +# by prefixing it with RUN_ON_HDL_SIMULATOR_ONLY_. +ifneq ($(filter -DALT_SIM_OPTIMIZE,$(ALT_CPPFLAGS)),) +ELF := RUN_ON_HDL_SIMULATOR_ONLY_$(ELF) +endif + +# If the BSP public.mk indicates that ALT_PROVIDE_GMON is set, add option to +# download_elf target +ifneq ($(filter -DALT_PROVIDE_GMON,$(ALT_CPPFLAGS)),) +GMON_OUT_FILENAME := gmon.out +WRITE_GMON_OPTION := --write-gmon $(GMON_OUT_FILENAME) +endif + +# Name of ELF application. +APP_NAME := $(basename $(ELF)) + +# Set to defaults if variables not already defined in settings. +ifeq ($(LINKER_SCRIPT),) +LINKER_SCRIPT := $(BSP_LINKER_SCRIPT) +endif +ifeq ($(CRT0),) +CRT0 := $(BSP_CRT0) +endif +ifeq ($(SYS_LIB),) +SYS_LIB := $(BSP_SYS_LIB) +endif + +OBJDUMP_NAME := $(APP_NAME).objdump +OBJDUMP_FLAGS := --disassemble --syms --all-header +ifeq ($(OBJDUMP_INCLUDE_SOURCE),1) +OBJDUMP_FLAGS += --source +endif +ifeq ($(OBJDUMP_FULL_CONTENTS),1) +OBJDUMP_FLAGS += --full-contents +endif + +# Create list of linker dependencies (*.a files). +APP_LDDEPS := $(ALT_LDDEPS) $(LDDEPS) + +# Take lists and add required prefixes. +APP_INC_DIRS := $(addprefix -I, $(ALT_INCLUDE_DIRS) $(APP_INCLUDE_DIRS) $(INC_DIRS)) +ASM_INC_PREFIX := -Wa,-I +APP_ASM_INC_DIRS := $(addprefix $(ASM_INC_PREFIX), $(ALT_INCLUDE_DIRS) $(APP_INCLUDE_DIRS) $(INC_DIRS)) +APP_LIB_DIRS := $(addprefix -L, $(ALT_LIBRARY_DIRS) $(APP_LIBRARY_DIRS) $(LIB_DIRS)) +APP_LIBS := $(addprefix -l, $(ALT_LIBRARY_NAMES) $(APP_LIBRARY_NAMES) $(LIBS)) + +ifneq ($(AVOID_NIOS2_GCC3_OPTIONS),) + +# +# Avoid Nios II GCC 3.X options. +# + +# Detect if small newlib C library is requested. +# If yes, remove the -msmallc option because it is +# now handled by other means. +ifneq ($(filter -msmallc,$(ALT_LDFLAGS)),) + ALT_LDFLAGS := $(filter-out -msmallc,$(ALT_LDFLAGS)) + ALT_C_LIBRARY := smallc +else + ALT_C_LIBRARY := c +endif + +# Put each BSP dependent library in a group to avoid circular dependencies. +APP_BSP_DEP_LIBS := $(foreach l,$(ALT_BSP_DEP_LIBRARY_NAMES),-Wl,--start-group -l$(ALT_C_LIBRARY) -lgcc -l$(l) -Wl,--end-group) + +else # !AVOID_NIOS2_GCC3_OPTIONS + +# +# Use Nios II GCC 3.X options. +# +APP_BSP_DEP_LIBS := $(addprefix -msys-lib=, $(ALT_BSP_DEP_LIBRARY_NAMES)) + +endif # !AVOID_NIOS2_GCC3_OPTIONS + +# Arguments for the C preprocessor, C/C++ compiler, assembler, and linker. +APP_CFLAGS := $(APP_CFLAGS_DEFINED_SYMBOLS) \ + $(APP_CFLAGS_UNDEFINED_SYMBOLS) \ + $(APP_CFLAGS_OPTIMIZATION) \ + $(APP_CFLAGS_DEBUG_LEVEL) \ + $(APP_CFLAGS_WARNINGS) \ + $(APP_CFLAGS_USER_FLAGS) \ + $(ALT_CFLAGS) \ + $(CFLAGS) + +# Arguments only for the C++ compiler. +APP_CXXFLAGS := $(ALT_CXXFLAGS) $(CXXFLAGS) + +# Arguments only for the C preprocessor. +# Prefix each include directory with -I. +APP_CPPFLAGS := $(APP_INC_DIRS) \ + $(ALT_CPPFLAGS) \ + $(CPPFLAGS) + +# Arguments only for the assembler. +APP_ASFLAGS := $(APP_ASM_INC_DIRS) \ + $(ALT_ASFLAGS) \ + $(APP_ASFLAGS_USER) \ + $(ASFLAGS) + +# Arguments only for the linker. +APP_LDFLAGS := $(APP_LDFLAGS_USER) + +ifneq ($(LINKER_SCRIPT),) +APP_LDFLAGS += -T'$(LINKER_SCRIPT)' +endif + +ifneq ($(AVOID_NIOS2_GCC3_OPTIONS),) + +# Avoid Nios II GCC 3.x options. +ifneq ($(CRT0),) +APP_LDFLAGS += $(CRT0) +endif + +# The equivalent of the -msys-lib option is provided +# by the GROUP() command in the linker script. +# Note this means the SYS_LIB variable is now ignored. + +else # !AVOID_NIOS2_GCC3_OPTIONS + +# Use Nios II GCC 3.x options. +ifneq ($(CRT0),) +APP_LDFLAGS += -msys-crt0='$(CRT0)' +endif +ifneq ($(SYS_LIB),) +APP_LDFLAGS += -msys-lib=$(SYS_LIB) +endif + +endif # !AVOID_NIOS2_GCC3_OPTIONS + +APP_LDFLAGS += \ + $(APP_LIB_DIRS) \ + $(ALT_LDFLAGS) \ + $(LDFLAGS) + +LINKER_MAP_NAME := $(APP_NAME).map +ifeq ($(CREATE_LINKER_MAP), 1) +APP_LDFLAGS += -Wl,-Map=$(LINKER_MAP_NAME) +endif + +# QUARTUS_PROJECT_DIR and SOPC_NAME need to be defined if you want the +# mem_init_install target of the mem_init.mk (located in the associated BSP) +# to know how to copy memory initialization files (e.g. .dat, .hex) into +# directories required for Quartus compilation or RTL simulation. + +# Defining QUARTUS_PROJECT_DIR causes mem_init_install to copy memory +# initialization files into your Quartus project directory. This is required +# to provide the initial memory contents of FPGA memories that can be +# initialized by the programming file (.sof) or Hardcopy ROMs. It is also used +# for VHDL simulation of on-chip memories. + +# Defining SOPC_NAME causes the mem_init_install target to copy memory +# initialization files into your RTL simulation directory. This is required +# to provide the initial memory contents of all memories that can be +# initialized by RTL simulation. This variable should be set to the same name +# as your SOPC Builder system name. For example, if you have a system called +# "foo.sopc", this variable should be set to "foo". + +# If SOPC_NAME is not set and QUARTUS_PROJECT_DIR is set, then derive SOPC_NAME. +ifeq ($(SOPC_NAME),) +ifneq ($(QUARTUS_PROJECT_DIR),) +SOPC_NAME := $(basename $(notdir $(wildcard $(QUARTUS_PROJECT_DIR)/*.sopcinfo))) +endif +endif + +# Defining JDI_FILE is required to specify the JTAG Debug Information File +# path. This file is generated by Quartus, and is needed along with the +# .sopcinfo file to resolve processor instance ID's from names in a multi-CPU +# systems. For multi-CPU systems, the processor instance ID is used to select +# from multiple CPU's during ELF download. + +# Both JDI_FILE and SOPCINFO_FILE are provided by the BSP if they found during +# BSP creation. If JDI_FILE is not set and QUARTUS_PROJECT_DIR is set, then +# derive JDI_FILE. We do not attempt to derive SOPCINFO_FILE since there may be +# multiple .sopcinfo files in a Quartus project. +ifeq ($(JDI_FILE),) +ifneq ($(QUARTUS_PROJECT_DIR),) +JDI_FILE := $(wildcard $(QUARTUS_PROJECT_DIR)/*.jdi) +endif +endif + +# Path to root runtime directory used for hdl simulation +RUNTIME_ROOT_DIR := $(CONFIG_OBJ_DIR)/runtime + + + +#------------------------------------------------------------------------------ +# MAKEFILE INCLUDES DEPENDENT ON GENERATED CONTENT +#------------------------------------------------------------------------------ +# mem_init.mk is a generated makefile fragment. This file defines all targets +# used to generate HDL initialization simulation files and pre-initialized +# onchip memory files. +MEM_INIT_FILE := $(BSP_ROOT_DIR)/mem_init.mk +include $(MEM_INIT_FILE) + +# Create list of object files to be built using the list of source files. +# The source file hierarchy is preserved in the object tree. +# The supported file extensions are: +# +# .c - for C files +# .cxx .cc .cpp - for C++ files +# .S .s - for assembler files +# +# Handle source files specified by --src-dir & --src-rdir differently, to +# save some processing time in calling the adjust-path macro. + +OBJ_LIST_C := $(patsubst %.c,%.o,$(filter %.c,$(C_SRCS))) +OBJ_LIST_CPP := $(patsubst %.cpp,%.o,$(filter %.cpp,$(CXX_SRCS))) +OBJ_LIST_CXX := $(patsubst %.cxx,%.o,$(filter %.cxx,$(CXX_SRCS))) +OBJ_LIST_CC := $(patsubst %.cc,%.o,$(filter %.cc,$(CXX_SRCS))) +OBJ_LIST_S := $(patsubst %.S,%.o,$(filter %.S,$(ASM_SRCS))) +OBJ_LIST_SS := $(patsubst %.s,%.o,$(filter %.s,$(ASM_SRCS))) + +OBJ_LIST := $(sort $(OBJ_LIST_C) $(OBJ_LIST_CPP) $(OBJ_LIST_CXX) \ + $(OBJ_LIST_CC) $(OBJ_LIST_S) $(OBJ_LIST_SS)) + +SDIR_OBJ_LIST_C := $(patsubst %.c,%.o,$(filter %.c,$(SDIR_C_SRCS))) +SDIR_OBJ_LIST_CPP := $(patsubst %.cpp,%.o,$(filter %.cpp,$(SDIR_CXX_SRCS))) +SDIR_OBJ_LIST_CXX := $(patsubst %.cxx,%.o,$(filter %.cxx,$(SDIR_CXX_SRCS))) +SDIR_OBJ_LIST_CC := $(patsubst %.cc,%.o,$(filter %.cc,$(SDIR_CXX_SRCS))) +SDIR_OBJ_LIST_S := $(patsubst %.S,%.o,$(filter %.S,$(SDIR_ASM_SRCS))) +SDIR_OBJ_LIST_SS := $(patsubst %.s,%.o,$(filter %.s,$(SDIR_ASM_SRCS))) + +SDIR_OBJ_LIST := $(sort $(SDIR_OBJ_LIST_C) $(SDIR_OBJ_LIST_CPP) \ + $(SDIR_OBJ_LIST_CXX) $(SDIR_OBJ_LIST_CC) $(SDIR_OBJ_LIST_S) \ + $(SDIR_OBJ_LIST_SS)) + +# Relative-pathed objects that being with "../" are handled differently. +# +# Regular objects are created as +# $(CONFIG_OBJ_DIR)//.o +# where the path structure is maintained under the obj directory. This +# applies for both absolute and relative paths; in the absolute path +# case this means the entire source path will be recreated under the obj +# directory. This is done to allow two source files with the same name +# to be included as part of the project. +# +# Note: On Cygwin, the path recreated under the obj directory will be +# the cygpath -u output path. +# +# Relative-path objects that begin with "../" cause problems under this +# scheme, as $(CONFIG_OBJ_DIR)/..// can potentially put the object +# files anywhere in the system, creating clutter and polluting the source tree. +# As such, their paths are flattened - the object file created will be +# $(CONFIG_OBJ_DIR)/.o. Due to this, two files specified with +# "../" in the beginning cannot have the same name in the project. VPATH +# will be set for these sources to allow make to relocate the source file +# via %.o rules. +# +# The following lines separate the object list into the flatten and regular +# lists, and then handles them as appropriate. + +FLATTEN_OBJ_LIST := $(filter ../%,$(OBJ_LIST)) +FLATTEN_APP_OBJS := $(addprefix $(CONFIG_OBJ_DIR)/,$(notdir $(FLATTEN_OBJ_LIST))) + +REGULAR_OBJ_LIST := $(filter-out $(FLATTEN_OBJ_LIST),$(OBJ_LIST)) +REGULAR_OBJ_LIST_C := $(filter $(OBJ_LIST_C),$(REGULAR_OBJ_LIST)) +REGULAR_OBJ_LIST_CPP := $(filter $(OBJ_LIST_CPP),$(REGULAR_OBJ_LIST)) +REGULAR_OBJ_LIST_CXX := $(filter $(OBJ_LIST_CXX),$(REGULAR_OBJ_LIST)) +REGULAR_OBJ_LIST_CC := $(filter $(OBJ_LIST_CC),$(REGULAR_OBJ_LIST)) +REGULAR_OBJ_LIST_S := $(filter $(OBJ_LIST_S),$(REGULAR_OBJ_LIST)) +REGULAR_OBJ_LIST_SS := $(filter $(OBJ_LIST_SS),$(REGULAR_OBJ_LIST)) + +FLATTEN_SDIR_OBJ_LIST := $(filter ../%,$(SDIR_OBJ_LIST)) +FLATTEN_SDIR_APP_OBJS := $(addprefix $(CONFIG_OBJ_DIR)/,$(notdir $(FLATTEN_SDIR_OBJ_LIST))) + +REGULAR_SDIR_OBJ_LIST := $(filter-out $(FLATTEN_SDIR_OBJ_LIST),$(SDIR_OBJ_LIST)) +REGULAR_SDIR_OBJ_LIST_C := $(filter $(SDIR_OBJ_LIST_C),$(REGULAR_SDIR_OBJ_LIST)) +REGULAR_SDIR_OBJ_LIST_CPP := $(filter $(SDIR_OBJ_LIST_CPP),$(REGULAR_SDIR_OBJ_LIST)) +REGULAR_SDIR_OBJ_LIST_CXX := $(filter $(SDIR_OBJ_LIST_CXX),$(REGULAR_SDIR_OBJ_LIST)) +REGULAR_SDIR_OBJ_LIST_CC := $(filter $(SDIR_OBJ_LIST_CC),$(REGULAR_SDIR_OBJ_LIST)) +REGULAR_SDIR_OBJ_LIST_S := $(filter $(SDIR_OBJ_LIST_S),$(REGULAR_SDIR_OBJ_LIST)) +REGULAR_SDIR_OBJ_LIST_SS := $(filter $(SDIR_OBJ_LIST_SS),$(REGULAR_SDIR_OBJ_LIST)) + +VPATH := $(sort $(dir $(FLATTEN_OBJ_LIST)) $(dir $(FLATTEN_SDIR_OBJ_LIST))) + +APP_OBJS_C := $(addprefix $(CONFIG_OBJ_DIR)/,\ + $(REGULAR_SDIR_OBJ_LIST_C) \ + $(foreach s,$(REGULAR_OBJ_LIST_C),$(call adjust-path,$s))) + +APP_OBJS_CPP := $(addprefix $(CONFIG_OBJ_DIR)/,\ + $(REGULAR_SDIR_OBJ_LIST_CPP) \ + $(foreach s,$(REGULAR_OBJ_LIST_CPP),$(call adjust-path,$s))) + +APP_OBJS_CXX := $(addprefix $(CONFIG_OBJ_DIR)/,\ + $(REGULAR_SDIR_OBJ_LIST_CXX) \ + $(foreach s,$(REGULAR_OBJ_LIST_CXX),$(call adjust-path,$s))) + +APP_OBJS_CC := $(addprefix $(CONFIG_OBJ_DIR)/,\ + $(REGULAR_SDIR_OBJ_LIST_CC) \ + $(foreach s,$(REGULAR_OBJ_LIST_CC),$(call adjust-path,$s))) + +APP_OBJS_S := $(addprefix $(CONFIG_OBJ_DIR)/,\ + $(REGULAR_SDIR_OBJ_LIST_S) \ + $(foreach s,$(REGULAR_OBJ_LIST_S),$(call adjust-path,$s))) + +APP_OBJS_SS := $(addprefix $(CONFIG_OBJ_DIR)/,\ + $(REGULAR_SDIR_OBJ_LIST_SS) \ + $(foreach s,$(REGULAR_OBJ_LIST_SS),$(call adjust-path,$s))) + +APP_OBJS := $(APP_OBJS_C) $(APP_OBJS_CPP) $(APP_OBJS_CXX) $(APP_OBJS_CC) \ + $(APP_OBJS_S) $(APP_OBJS_SS) \ + $(FLATTEN_APP_OBJS) $(FLATTEN_SDIR_APP_OBJS) + +# Add any extra user-provided object files. +APP_OBJS += $(OBJS) + +# Create list of dependancy files for each object file. +APP_DEPS := $(APP_OBJS:.o=.d) + +# Patch the Elf file with system specific information + +# Patch the Elf with the name of the sopc system +ifneq ($(SOPC_NAME),) +ELF_PATCH_FLAG += --sopc_system_name $(SOPC_NAME) +endif + +# Patch the Elf with the absolute path to the Quartus Project Directory +ifneq ($(QUARTUS_PROJECT_DIR),) +ABS_QUARTUS_PROJECT_DIR := $(call adjust-path-mixed,$(shell cd "$(QUARTUS_PROJECT_DIR)"; pwd)) +ELF_PATCH_FLAG += --quartus_project_dir "$(ABS_QUARTUS_PROJECT_DIR)" +endif + +# Patch the Elf and download args with the JDI_FILE if specified +ifneq ($(wildcard $(JDI_FILE)),) +ELF_PATCH_FLAG += --jdi $(JDI_FILE) +DOWNLOAD_JDI_FLAG := --jdi $(JDI_FILE) +endif + +# Patch the Elf with the SOPCINFO_FILE if specified +ifneq ($(wildcard $(SOPCINFO_FILE)),) +ELF_PATCH_FLAG += --sopcinfo $(SOPCINFO_FILE) +endif + +# Use the DOWNLOAD_CABLE variable to specify which JTAG cable to use. +# This is not needed if you only have one cable. +ifneq ($(DOWNLOAD_CABLE),) +DOWNLOAD_CABLE_FLAG := --cable '$(DOWNLOAD_CABLE)' +endif + + +#------------------------------------------------------------------------------ +# BUILD PRE/POST PROCESS +#------------------------------------------------------------------------------ +build_pre_process : + $(BUILD_PRE_PROCESS) + +build_post_process : + $(BUILD_POST_PROCESS) + +.PHONY: build_pre_process build_post_process + + +#------------------------------------------------------------------------------ +# TOOLS +#------------------------------------------------------------------------------ + +# +# Set tool default variables if not already defined. +# If these are defined, they would typically be defined in an +# included makefile fragment. +# +ifeq ($(DEFAULT_CROSS_COMPILE),) +DEFAULT_CROSS_COMPILE := nios2-elf- +endif + +ifeq ($(DEFAULT_STACKREPORT),) +DEFAULT_STACKREPORT := nios2-stackreport +endif + +ifeq ($(DEFAULT_DOWNLOAD),) +DEFAULT_DOWNLOAD := nios2-download +endif + +ifeq ($(DEFAULT_FLASHPROG),) +DEFAULT_FLASHPROG := nios2-flash-programmer +endif + +ifeq ($(DEFAULT_ELFPATCH),) +DEFAULT_ELFPATCH := nios2-elf-insert +endif + +ifeq ($(DEFAULT_RM),) +DEFAULT_RM := rm -f +endif + +ifeq ($(DEFAULT_CP),) +DEFAULT_CP := cp -f +endif + +ifeq ($(DEFAULT_MKDIR),) +DEFAULT_MKDIR := mkdir -p +endif + +# +# Set tool variables to defaults if not already defined. +# If these are defined, they would typically be defined by a +# setting in the generated portion of this makefile. +# +ifeq ($(CROSS_COMPILE),) +CROSS_COMPILE := $(DEFAULT_CROSS_COMPILE) +endif + +ifeq ($(origin CC),default) +CC := $(CROSS_COMPILE)gcc -xc +endif + +ifeq ($(origin CXX),default) +CXX := $(CROSS_COMPILE)gcc -xc++ +endif + +ifeq ($(origin AS),default) +AS := $(CROSS_COMPILE)gcc +endif + +ifeq ($(origin AR),default) +AR := $(CROSS_COMPILE)ar +endif + +ifeq ($(origin LD),default) +LD := $(CROSS_COMPILE)g++ +endif + +ifeq ($(origin RM),default) +RM := $(DEFAULT_RM) +endif + +ifeq ($(NM),) +NM := $(CROSS_COMPILE)nm +endif + +ifeq ($(CP),) +CP := $(DEFAULT_CP) +endif + +ifeq ($(OBJDUMP),) +OBJDUMP := $(CROSS_COMPILE)objdump +endif + +ifeq ($(OBJCOPY),) +OBJCOPY := $(CROSS_COMPILE)objcopy +endif + +ifeq ($(STACKREPORT),) +STACKREPORT := $(DEFAULT_STACKREPORT) --prefix $(CROSS_COMPILE) +else +DISABLE_STACKREPORT := 1 +endif + +ifeq ($(DOWNLOAD),) +DOWNLOAD := $(DEFAULT_DOWNLOAD) +endif + +ifeq ($(FLASHPROG),) +FLASHPROG := $(DEFAULT_FLASHPROG) +endif + +ifeq ($(ELFPATCH),) +ELFPATCH := $(DEFAULT_ELFPATCH) +endif + +ifeq ($(MKDIR),) +MKDIR := $(DEFAULT_MKDIR) +endif + +#------------------------------------------------------------------------------ +# PATTERN RULES TO BUILD OBJECTS +#------------------------------------------------------------------------------ + +define compile.c +@$(ECHO) Info: Compiling $< to $@ +@$(MKDIR) $(@D) +$(CC) -MP -MMD -c $(APP_CPPFLAGS) $(APP_CFLAGS) -o $@ $< +$(CC_POST_PROCESS) +endef + +define compile.cpp +@$(ECHO) Info: Compiling $< to $@ +@$(MKDIR) $(@D) +$(CXX) -MP -MMD -c $(APP_CPPFLAGS) $(APP_CXXFLAGS) $(APP_CFLAGS) -o $@ $< +$(CXX_POST_PROCESS) +endef + +# If assembling with the compiler, ensure "-Wa," is prepended to all APP_ASFLAGS +ifeq ($(AS),$(patsubst %as,%,$(AS))) +COMMA := , +APP_ASFLAGS := $(filter-out $(APP_CFLAGS),$(addprefix -Wa$(COMMA),$(patsubst -Wa$(COMMA)%,%,$(APP_ASFLAGS)))) +endif + +define compile.s +@$(ECHO) Info: Assembling $< to $@ +@$(MKDIR) $(@D) +$(AS) -MP -MMD -c $(APP_CPPFLAGS) $(APP_CFLAGS) $(APP_ASFLAGS) -o $@ $< +$(AS_POST_PROCESS) +endef + +ifeq ($(MAKE_VERSION),3.81) +.SECONDEXPANSION: + +$(APP_OBJS_C): $(CONFIG_OBJ_DIR)/%.o: $$(call adjust-path-mixed,%.c) + $(compile.c) + +$(APP_OBJS_CPP): $(CONFIG_OBJ_DIR)/%.o: $$(call adjust-path-mixed,%.cpp) + $(compile.cpp) + +$(APP_OBJS_CC): $(CONFIG_OBJ_DIR)/%.o: $$(call adjust-path-mixed,%.cc) + $(compile.cpp) + +$(APP_OBJS_CXX): $(CONFIG_OBJ_DIR)/%.o: $$(call adjust-path-mixed,%.cxx) + $(compile.cpp) + +$(APP_OBJS_S): $(CONFIG_OBJ_DIR)/%.o: $$(call adjust-path-mixed,%.S) + $(compile.s) + +$(APP_OBJS_SS): $(CONFIG_OBJ_DIR)/%.o: $$(call adjust-path-mixed,%.s) + $(compile.s) + +endif # MAKE_VERSION != 3.81 + +$(CONFIG_OBJ_DIR)/%.o: %.c + $(compile.c) + +$(CONFIG_OBJ_DIR)/%.o: %.cpp + $(compile.cpp) + +$(CONFIG_OBJ_DIR)/%.o: %.cc + $(compile.cpp) + +$(CONFIG_OBJ_DIR)/%.o: %.cxx + $(compile.cpp) + +$(CONFIG_OBJ_DIR)/%.o: %.S + $(compile.s) + +$(CONFIG_OBJ_DIR)/%.o: %.s + $(compile.s) + + +#------------------------------------------------------------------------------ +# PATTERN RULES TO INTERMEDIATE FILES +#------------------------------------------------------------------------------ + +$(CONFIG_OBJ_DIR)/%.s: %.c + @$(ECHO) Info: Compiling $< to $@ + @$(MKDIR) $(@D) + $(CC) -S $(APP_CPPFLAGS) $(APP_CFLAGS) -o $@ $< + +$(CONFIG_OBJ_DIR)/%.s: %.cpp + @$(ECHO) Info: Compiling $< to $@ + @$(MKDIR) $(@D) + $(CXX) -S $(APP_CPPFLAGS) $(APP_CXXFLAGS) $(APP_CFLAGS) -o $@ $< + +$(CONFIG_OBJ_DIR)/%.s: %.cc + @$(ECHO) Info: Compiling $< to $@ + @$(MKDIR) $(@D) + $(CXX) -S $(APP_CPPFLAGS) $(APP_CXXFLAGS) $(APP_CFLAGS) -o $@ $< + +$(CONFIG_OBJ_DIR)/%.s: %.cxx + @$(ECHO) Info: Compiling $< to $@ + @$(MKDIR) $(@D) + $(CXX) -S $(APP_CPPFLAGS) $(APP_CXXFLAGS) $(APP_CFLAGS) -o $@ $< + +$(CONFIG_OBJ_DIR)/%.i: %.c + @$(ECHO) Info: Compiling $< to $@ + @$(MKDIR) $(@D) + $(CC) -E $(APP_CPPFLAGS) $(APP_CFLAGS) -o $@ $< + +$(CONFIG_OBJ_DIR)/%.i: %.cpp + @$(ECHO) Info: Compiling $< to $@ + @$(MKDIR) $(@D) + $(CXX) -E $(APP_CPPFLAGS) $(APP_CXXFLAGS) $(APP_CFLAGS) -o $@ $< + +$(CONFIG_OBJ_DIR)/%.i: %.cc + @$(ECHO) Info: Compiling $< to $@ + @$(MKDIR) $(@D) + $(CXX) -E $(APP_CPPFLAGS) $(APP_CXXFLAGS) $(APP_CFLAGS) -o $@ $< + +$(CONFIG_OBJ_DIR)/%.i: %.cxx + @$(ECHO) Info: Compiling $< to $@ + @$(MKDIR) $(@D) + $(CXX) -E $(APP_CPPFLAGS) $(APP_CXXFLAGS) $(APP_CFLAGS) -o $@ $< + + +#------------------------------------------------------------------------------ +# TARGET RULES +#------------------------------------------------------------------------------ + +.PHONY : help +help : + @$(ECHO) "Summary of Makefile targets" + @$(ECHO) " Build targets:" + @$(ECHO) " all (default) - Application and all libraries (including BSP)" + @$(ECHO) " bsp - Just the BSP" + @$(ECHO) " libs - All libraries (including BSP)" + @$(ECHO) " flash - All flash files" + @$(ECHO) " mem_init_generate - All memory initialization files" +ifeq ($(QSYS),1) + @$(ECHO) " mem_init_install - This target is deprecated for QSys Systems" + @$(ECHO) " --> Use the mem_init_generate target and then" + @$(ECHO) " add the generated meminit.qip file to your" + @$(ECHO) " Quartus II Project." +else # if QSYS != 1 + @$(ECHO) " mem_init_install - Copy memory initialization files to Quartus II project" +endif # QSYS == 1 + @$(ECHO) + @$(ECHO) " Clean targets:" + @$(ECHO) " clean_all - Application and all libraries (including BSP)" + @$(ECHO) " clean - Just the application" + @$(ECHO) " clean_bsp - Just the BSP" + @$(ECHO) " clean_libs - All libraries (including BSP)" + @$(ECHO) + @$(ECHO) " Run targets:" + @$(ECHO) " download-elf - Download and run your elf executable" + @$(ECHO) " program-flash - Program flash contents to the board" + +# Handy rule to skip making libraries and just make application. +.PHONY : app +app : $(ELF) + +ifeq ($(CREATE_OBJDUMP), 1) +app : $(OBJDUMP_NAME) +endif + +ifeq ($(CREATE_ELF_DERIVED_FILES),1) +app : elf_derived_files +endif + +.PHONY: elf_derived_files +elf_derived_files: default_mem_init + +# Handy rule for making just the BSP. +.PHONY : bsp +bsp : + @$(ECHO) Info: Building $(BSP_ROOT_DIR) + @$(MAKE) --no-print-directory -C $(BSP_ROOT_DIR) + + +# Make sure all makeable libraries (including the BSP) are up-to-date. +LIB_TARGETS := $(patsubst %,%-recurs-make-lib,$(MAKEABLE_LIBRARY_ROOT_DIRS)) + +.PHONY : libs +libs : $(LIB_TARGETS) + +ifneq ($(strip $(LIB_TARGETS)),) +$(LIB_TARGETS): %-recurs-make-lib: + @$(ECHO) Info: Building $* + $(MAKE) --no-print-directory -C $* +endif + +ifneq ($(strip $(APP_LDDEPS)),) +$(APP_LDDEPS): libs + @true +endif + +# Rules to force your project to rebuild or relink +# .force_relink file will cause any application that depends on this project to relink +# .force_rebuild file will cause this project to rebuild object files +# .force_rebuild_all file will cause this project and any project that depends on this project to rebuild object files + +FORCE_RELINK_DEP := .force_relink +FORCE_REBUILD_DEP := .force_rebuild +FORCE_REBUILD_ALL_DEP := .force_rebuild_all +FORCE_REBUILD_DEP_LIST := $(CONFIG_OBJ_DIR)/$(FORCE_RELINK_DEP) $(CONFIG_OBJ_DIR)/$(FORCE_REBUILD_DEP) $(FORCE_REBUILD_ALL_DEP) + +$(FORCE_REBUILD_DEP_LIST): + +$(APP_OBJS): $(wildcard $(CONFIG_OBJ_DIR)/$(FORCE_REBUILD_DEP)) $(wildcard $(addsuffix /$(FORCE_REBUILD_ALL_DEP), . $(ALT_LIBRARY_DIRS))) + +$(ELF): $(wildcard $(addsuffix /$(FORCE_RELINK_DEP), $(CONFIG_OBJ_DIR) $(ALT_LIBRARY_DIRS))) + + +# Clean just the application. +.PHONY : clean +ifeq ($(CREATE_ELF_DERIVED_FILES),1) +clean : clean_elf_derived_files +endif + +clean : + @$(RM) -r $(ELF) $(OBJDUMP_NAME) $(LINKER_MAP_NAME) $(OBJ_ROOT_DIR) $(RUNTIME_ROOT_DIR) $(FORCE_REBUILD_DEP_LIST) + @$(ECHO) [$(APP_NAME) clean complete] + +# Clean just the BSP. +.PHONY : clean_bsp +clean_bsp : + @$(ECHO) Info: Cleaning $(BSP_ROOT_DIR) + @$(MAKE) --no-print-directory -C $(BSP_ROOT_DIR) clean + +# Clean all makeable libraries including the BSP. +LIB_CLEAN_TARGETS := $(patsubst %,%-recurs-make-clean-lib,$(MAKEABLE_LIBRARY_ROOT_DIRS)) + +.PHONY : clean_libs +clean_libs : $(LIB_CLEAN_TARGETS) + +ifneq ($(strip $(LIB_CLEAN_TARGETS)),) +$(LIB_CLEAN_TARGETS): %-recurs-make-clean-lib: + @$(ECHO) Info: Cleaning $* + $(MAKE) --no-print-directory -C $* clean +endif + +.PHONY: clean_elf_derived_files +clean_elf_derived_files: mem_init_clean + +# Clean application and all makeable libraries including the BSP. +.PHONY : clean_all +clean_all : clean mem_init_clean clean_libs + +# Include the dependency files unless the make goal is performing a clean +# of the application. +ifneq ($(firstword $(MAKECMDGOALS)),clean) +ifneq ($(firstword $(MAKECMDGOALS)),clean_all) +-include $(APP_DEPS) +endif +endif + +.PHONY : download-elf +download-elf : $(ELF) + @if [ "$(DOWNLOAD)" = "none" ]; \ + then \ + $(ECHO) Downloading $(ELF) not supported; \ + else \ + $(ECHO) Info: Downloading $(ELF); \ + $(DOWNLOAD) --go --cpu_name=$(CPU_NAME) $(DOWNLOAD_CABLE_FLAG) $(SOPC_SYSID_FLAG) $(DOWNLOAD_JDI_FLAG) $(WRITE_GMON_OPTION) $(ELF); \ + fi + +# Delete the target of a rule if it has changed and its commands exit +# with a nonzero exit status. +.DELETE_ON_ERROR: + +# Rules for flash programming commands +PROGRAM_FLASH_SUFFIX := -program +PROGRAM_FLASH_TARGET := $(addsuffix $(PROGRAM_FLASH_SUFFIX), $(FLASH_FILES)) + +.PHONY : program-flash +program-flash : $(PROGRAM_FLASH_TARGET) + +.PHONY : $(PROGRAM_FLASH_TARGET) +$(PROGRAM_FLASH_TARGET) : flash + @if [ "$(FLASHPROG)" = "none" ]; \ + then \ + $(ECHO) Programming flash not supported; \ + else \ + $(ECHO) Info: Programming $(basename $@).flash; \ + if [ -z "$($(basename $@)_EPCS_FLAGS)" ]; \ + then \ + $(ECHO) $(FLASHPROG) $(SOPC_SYSID_FLAG) --base=$($(basename $@)_START) $(basename $@).flash; \ + $(FLASHPROG) $(DOWNLOAD_CABLE_FLAG) $(SOPC_SYSID_FLAG) --base=$($(basename $@)_START) $(basename $@).flash; \ + else \ + $(ECHO) $(FLASHPROG) $(SOPC_SYSID_FLAG) --epcs --base=$($(basename $@)_START) $(basename $@).flash; \ + $(FLASHPROG) $(DOWNLOAD_CABLE_FLAG) $(SOPC_SYSID_FLAG) --epcs --base=$($(basename $@)_START) $(basename $@).flash; \ + fi \ + fi + + +# Rules for simulating with an HDL Simulator [QSYS only] +ifeq ($(QSYS),1) +IP_MAKE_SIMSCRIPT := ip-make-simscript + +ifeq ($(VSIM),) +VSIM_EXE := "$(if $(VSIM_DIR),$(VSIM_DIR)/,)vsim" +ifeq ($(ENABLE_VSIM_GUI),1) +VSIM := $(VSIM_EXE) -gui +else +VSIM := $(VSIM_EXE) -c +endif # ENABLE_VSIM_GUI == 1 +endif # VSIM not set + +ifeq ($(SPD),) +ifneq ($(ABS_QUARTUS_PROJECT_DIR),) +ifneq ($(SOPC_NAME),) +SPD := $(ABS_QUARTUS_PROJECT_DIR)/$(SOPC_NAME)_tb.spd +endif # SOPC_NAME set +endif # ABS_QUARTUS_PROJECT_DIR set +endif # SPD == empty string + +ifeq ($(MSIM_SCRIPT),) +SIM_SCRIPT_DIR := $(RUNTIME_ROOT_DIR)/sim +MSIM_SCRIPT := $(SIM_SCRIPT_DIR)/mentor/msim_setup.tcl +endif # MSIM_SCRIPT == empty string + +ifeq ($(MAKE_VERSION),3.81) +ABS_MEM_INIT_DESCRIPTOR_FILE := $(abspath $(MEM_INIT_DESCRIPTOR_FILE)) +else +ABS_MEM_INIT_DESCRIPTOR_FILE := $(call adjust-path-mixed,$(shell pwd))/$(MEM_INIT_DESCRIPTOR_FILE) +endif + +$(MSIM_SCRIPT): $(SPD) $(MEM_INIT_DESCRIPTOR_FILE) +ifeq ($(SPD),) + $(error No SPD file specified. Ensure QUARTUS_PROJECT_DIR variable is set) +endif + @$(MKDIR) $(SIM_SCRIPT_DIR) + $(IP_MAKE_SIMSCRIPT) --spd=$(SPD) --spd=$(MEM_INIT_DESCRIPTOR_FILE) --output-directory=$(SIM_SCRIPT_DIR) + +VSIM_COMMAND = \ + cd $(dir $(MSIM_SCRIPT)) && \ + $(VSIM) -do "do $(notdir $(MSIM_SCRIPT)); ld; $(if $(VSIM_RUN_TIME),run ${VSIM_RUN_TIME};quit;)" + +.PHONY: sim +sim: $(MSIM_SCRIPT) mem_init_generate +ifeq ($(MSIM_SCRIPT),) + $(error MSIM_SCRIPT not set) +endif + $(VSIM_COMMAND) + +endif # QSYS == 1 + + +#------------------------------------------------------------------------------ +# ELF TARGET RULE +#------------------------------------------------------------------------------ +# Rule for constructing the executable elf file. +$(ELF) : $(APP_OBJS) $(LINKER_SCRIPT) $(APP_LDDEPS) + @$(ECHO) Info: Linking $@ + $(LD) $(APP_LDFLAGS) $(APP_CFLAGS) -o $@ $(filter-out $(CRT0),$(APP_OBJS)) $(APP_LIBS) $(APP_BSP_DEP_LIBS) +ifneq ($(DISABLE_ELFPATCH),1) + $(ELFPATCH) $@ $(ELF_PATCH_FLAG) +endif +ifneq ($(DISABLE_STACKREPORT),1) + @bash -c "$(STACKREPORT) $@" +endif + +$(OBJDUMP_NAME) : $(ELF) + @$(ECHO) Info: Creating $@ + $(OBJDUMP) $(OBJDUMP_FLAGS) $< >$@ + +# Rule for printing the name of the elf file +.PHONY: print-elf-name +print-elf-name: + @$(ECHO) $(ELF) + + Index: components/sd_card/firmware/bsp/summary.html =================================================================== --- components/sd_card/firmware/bsp/summary.html (nonexistent) +++ components/sd_card/firmware/bsp/summary.html (revision 8) @@ -0,0 +1,2011 @@ + +Altera Nios II BSP Summary + +

BSP Description

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
BSP Type:hal
SOPC Design File:../../system.sopcinfo
Quartus JDI File:default
CPU:nios2_qsys_0
BSP Settings File:settings.bsp
BSP Version:default
BSP Generated On:Aug 18, 2014 9:42:39 PM
BSP Generated Timestamp:1408390959802
BSP Generated Location:/home/alek/aktualne/github/ao486/syn/components/sd_card/firmware/bsp
+
+

Nios II Memory Map

+ + + + + + + + + + + + + + + + + + + +
Slave DescriptorAddress RangeSizeAttributes
jtag_uart0x08011410 - 0x080114178printable
driver_sd_00x08011400 - 0x0801140F16 
slow_mem_00x08011000 - 0x080113FF1024 
onchip_memory2_00x08008000 - 0x0800FFFF32768memory
sdram0x00000000 - 0x07FFFFFF134217728memory
+
+
+

Linker Regions

+ + + + +
RegionAddress RangeSizeMemoryOffset
+
+
+

Linker Section Mappings

+ + + + + + + + + + + + + + + + + + + + + + +
SectionRegion
.textonchip_memory2_0
.rodataonchip_memory2_0
.rwdataonchip_memory2_0
.bssonchip_memory2_0
.heaponchip_memory2_0
.stackonchip_memory2_0
+

Settings

+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:altera_avalon_jtag_uart_driver.enable_jtag_uart_ignore_fifo_full_error
Identifier:ALTERA_AVALON_JTAG_UART_IGNORE_FIFO_FULL_ERROR
Default Value:false
Value:false
Type:BooleanDefineOnly
Destination:public_mk_define
Description:Enable JTAG UART driver to recover when host is inactive causing buffer to full without returning error. Printf will not fail with this recovery.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:altera_avalon_jtag_uart_driver.enable_small_driver
Identifier:ALTERA_AVALON_JTAG_UART_SMALL
Default Value:false
Value:false
Type:BooleanDefineOnly
Destination:public_mk_define
Description:Small-footprint (polled mode) driver
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.custom_newlib_flags
Identifier:CUSTOM_NEWLIB_FLAGS
Default Value:none
Value:none
Type:UnquotedString
Destination:public_mk_define
Description:Build a custom version of newlib with the specified space-separated compiler flags.
Restrictions:The custom newlib build will be placed in the <bsp root>/newlib directory, and will be used only for applications that utilize this BSP.
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.enable_c_plus_plus
Identifier:ALT_NO_C_PLUS_PLUS
Default Value:1
Value:0
Type:Boolean
Destination:public_mk_define
Description:Enable support for a subset of the C++ language. This option increases code footprint by adding support for C++ constructors. Certain features, such as multiple inheritance and exceptions are not supported. If false, adds -DALT_NO_C_PLUS_PLUS to ALT_CPPFLAGS in public.mk, and reduces code footprint.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.enable_clean_exit
Identifier:ALT_NO_CLEAN_EXIT
Default Value:1
Value:1
Type:Boolean
Destination:public_mk_define
Description:When your application exits, close file descriptors, call C++ destructors, etc. Code footprint can be reduced by disabling clean exit. If disabled, adds -DALT_NO_CLEAN_EXIT to ALT_CPPFLAGS -D'exit(a)=_exit(a)' in public.mk.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.enable_exit
Identifier:ALT_NO_EXIT
Default Value:1
Value:1
Type:Boolean
Destination:public_mk_define
Description:Add exit() support. This option increases code footprint if your "main()" routine does "return" or call "exit()". If false, adds -DALT_NO_EXIT to ALT_CPPFLAGS in public.mk, and reduces footprint
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.enable_gprof
Identifier:ALT_PROVIDE_GMON
Default Value:0
Value:0
Type:Boolean
Destination:public_mk_define
Description:Causes code to be compiled with gprof profiling enabled and the application ELF to be linked with the GPROF library. If true, adds -DALT_PROVIDE_GMON to ALT_CPPFLAGS and -pg to ALT_CFLAGS in public.mk.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.enable_instruction_related_exceptions_api
Identifier:ALT_INCLUDE_INSTRUCTION_RELATED_EXCEPTION_API
Default Value:false
Value:false
Type:BooleanDefineOnly
Destination:system_h_define
Description:Enables API for registering handlers to service instruction-related exceptions. Enabling this setting increases the size of the exception entry code.
Restrictions:These exception types can be generated if various processor options are enabled, such as the MMU, MPU, or other advanced exception types.
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.enable_lightweight_device_driver_api
Identifier:ALT_USE_DIRECT_DRIVERS
Default Value:0
Value:0
Type:Boolean
Destination:public_mk_define
Description:Enables lightweight device driver API. This reduces code and data footprint by removing the HAL layer that maps device names (e.g. /dev/uart0) to file descriptors. Instead, driver routines are called directly. The open(), close(), and lseek() routines will always fail if called. The read(), write(), fstat(), ioctl(), and isatty() routines only work for the stdio devices. If true, adds -DALT_USE_DIRECT_DRIVERS to ALT_CPPFLAGS in public.mk.
Restrictions:The Altera Host and read-only ZIP file systems can't be used if hal.enable_lightweight_device_driver_api is true.
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.enable_mul_div_emulation
Identifier:ALT_NO_INSTRUCTION_EMULATION
Default Value:0
Value:0
Type:Boolean
Destination:public_mk_define
Description:Adds code to emulate multiply and divide instructions in case they are executed but aren't present in the CPU. Normally this isn't required because the compiler won't use multiply and divide instructions that aren't present in the CPU. If false, adds -DALT_NO_INSTRUCTION_EMULATION to ALT_CPPFLAGS in public.mk.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.enable_reduced_device_drivers
Identifier:ALT_USE_SMALL_DRIVERS
Default Value:0
Value:0
Type:Boolean
Destination:public_mk_define
Description:Certain drivers are compiled with reduced functionality to reduce code footprint. Not all drivers observe this setting. The altera_avalon_uart and altera_avalon_jtag_uart drivers switch from interrupt-driven to polled operation. CAUTION: Several device drivers are disabled entirely. These include the altera_avalon_cfi_flash, altera_avalon_epcs_flash_controller, and altera_avalon_lcd_16207 drivers. This can result in certain API (HAL flash access routines) to fail. You can define a symbol provided by each driver to prevent it from being removed. If true, adds -DALT_USE_SMALL_DRIVERS to ALT_CPPFLAGS in public.mk.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.enable_runtime_stack_checking
Identifier:ALT_STACK_CHECK
Default Value:0
Value:0
Type:Boolean
Destination:public_mk_define
Description:Turns on HAL runtime stack checking feature. Enabling this setting causes additional code to be placed into each subroutine call to generate an exception if a stack collision occurs with the heap or statically allocated data. If true, adds -DALT_STACK_CHECK and -fstack-limit-register=et to ALT_CPPFLAGS in public.mk.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.enable_sim_optimize
Identifier:ALT_SIM_OPTIMIZE
Default Value:0
Value:0
Type:Boolean
Destination:public_mk_define
Description:The BSP is compiled with optimizations to speedup HDL simulation such as initializing the cache, clearing the .bss section, and skipping long delay loops. If true, adds -DALT_SIM_OPTIMIZE to ALT_CPPFLAGS in public.mk.
Restrictions:When this setting is true, the BSP shouldn't be used to build applications that are expected to run real hardware.
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.enable_small_c_library
Identifier:NONE
Default Value:0
Value:1
Type:Boolean
Destination:public_mk_define
Description:Causes the small newlib (C library) to be used. This reduces code and data footprint at the expense of reduced functionality. Several newlib features are removed such as floating-point support in printf(), stdin input routines, and buffered I/O. The small C library is not compatible with Micrium MicroC/OS-II. If true, adds -msmallc to ALT_LDFLAGS in public.mk.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.enable_sopc_sysid_check
Identifier:NONE
Default Value:1
Value:0
Type:Boolean
Destination:public_mk_define
Description:Enable SOPC Builder System ID. If a System ID SOPC Builder component is connected to the CPU associated with this BSP, it will be enabled in the creation of command-line arguments to download an ELF to the target. Otherwise, system ID and timestamp values are left out of public.mk for application Makefile "download-elf" target definition. With the system ID check disabled, the Nios II EDS tools will not automatically ensure that the application .elf file (and BSP it is linked against) corresponds to the hardware design on the target. If false, adds --accept-bad-sysid to SOPC_SYSID_FLAG in public.mk.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.linker.allow_code_at_reset
Identifier:ALT_ALLOW_CODE_AT_RESET
Default Value:0
Value:1
Type:Boolean
Destination:none
Description:Indicates if initialization code is allowed at the reset address. If true, defines the macro ALT_ALLOW_CODE_AT_RESET in linker.h.
Restrictions:If true, defines the macro ALT_ALLOW_CODE_AT_RESET in linker.h. This setting is typically false if an external bootloader (e.g. flash bootloader) is present.
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.linker.enable_alt_load
Identifier:NONE
Default Value:0
Value:0
Type:Boolean
Destination:none
Description:Enables the alt_load() facility. The alt_load() facility copies sections from the .text memory into RAM. If true, this setting sets up the VMA/LMA of sections in linker.x to allow them to be loaded into the .text memory.
Restrictions:This setting is typically false if an external bootloader (e.g. flash bootloader) is present.
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.linker.enable_alt_load_copy_exceptions
Identifier:NONE
Default Value:0
Value:0
Type:Boolean
Destination:none
Description:Causes the alt_load() facility to copy the .exceptions section. If true, this setting defines the macro ALT_LOAD_COPY_EXCEPTIONS in linker.h.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.linker.enable_alt_load_copy_rodata
Identifier:NONE
Default Value:0
Value:0
Type:Boolean
Destination:none
Description:Causes the alt_load() facility to copy the .rodata section. If true, this setting defines the macro ALT_LOAD_COPY_RODATA in linker.h.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.linker.enable_alt_load_copy_rwdata
Identifier:NONE
Default Value:0
Value:0
Type:Boolean
Destination:none
Description:Causes the alt_load() facility to copy the .rwdata section. If true, this setting defines the macro ALT_LOAD_COPY_RWDATA in linker.h.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.linker.enable_exception_stack
Identifier:NONE
Default Value:0
Value:0
Type:Boolean
Destination:none
Description:Enables use of a separate exception stack. If true, defines the macro ALT_EXCEPTION_STACK in linker.h, adds a memory region called exception_stack to linker.x, and provides the symbols __alt_exception_stack_pointer and __alt_exception_stack_limit in linker.x.
Restrictions:The hal.linker.exception_stack_size and hal.linker.exception_stack_memory_region_name settings must also be valid. This setting must be false for MicroC/OS-II BSPs. The exception stack can be used to improve interrupt and other exception performance if the EIC is *not* used.
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.linker.enable_interrupt_stack
Identifier:NONE
Default Value:0
Value:0
Type:Boolean
Destination:none
Description:Enables use of a separate interrupt stack. If true, defines the macro ALT_INTERRUPT_STACK in linker.h, adds a memory region called interrupt_stack to linker.x, and provides the symbols __alt_interrupt_stack_pointer and __alt_interrupt_stack_limit in linker.x.
Restrictions:The hal.linker.interrupt_stack_size and hal.linker.interrupt_stack_memory_region_name settings must also be valid. This setting must be false for MicroC/OS-II BSPs. Only enable if the EIC is used exclusively. The exception stack can be used to improve interrupt and other exception performance if the EIC is *not* used.
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.linker.exception_stack_memory_region_name
Identifier:NONE
Default Value:none
Value:sdram
Type:UnquotedString
Destination:none
Description:Name of the existing memory region that will be divided up to create the 'exception_stack' memory region. The selected region name will be adjusted automatically when the BSP is generated to create the 'exception_stack' memory region.
Restrictions:Only used if hal.linker.enable_exception_stack is true.
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.linker.exception_stack_size
Identifier:NONE
Default Value:1024
Value:1024
Type:DecimalNumber
Destination:none
Description:Size of the exception stack in bytes.
Restrictions:Only used if hal.linker.enable_exception_stack is true.
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.linker.interrupt_stack_memory_region_name
Identifier:NONE
Default Value:none
Value:sdram
Type:UnquotedString
Destination:none
Description:Name of the existing memory region that will be divided up to create the 'interrupt_stack' memory region. The selected region name will be adjusted automatically when the BSP is generated to create the 'interrupt_stack' memory region.
Restrictions:Only used if hal.linker.enable_interrupt_stack is true.
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.linker.interrupt_stack_size
Identifier:NONE
Default Value:1024
Value:1024
Type:DecimalNumber
Destination:none
Description:Size of the interrupt stack in bytes.
Restrictions:Only used if hal.linker.enable_interrupt_stack is true.
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.log_flags
Identifier:ALT_LOG_FLAGS
Default Value:0
Value:0
Type:DecimalNumber
Destination:public_mk_define
Description:The value is assigned to ALT_LOG_FLAGS in the generated public.mk. See hal.log_port setting description. Values can be -1 through 3.
Restrictions:hal.log_port must be set for this to be used.
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.log_port
Identifier:NONE
Default Value:none
Value:none
Type:UnquotedString
Destination:public_mk_define
Description:Slave descriptor of debug logging character-mode device. If defined, it enables extra debug messages in the HAL source. This setting is used by the ALT_LOG_PORT family of defines in system.h.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.make.ar
Identifier:AR
Default Value:nios2-elf-ar
Value:nios2-elf-ar
Type:UnquotedString
Destination:makefile_variable
Description:Archiver command. Creates library files.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.make.ar_post_process
Identifier:AR_POST_PROCESS
Default Value:none
Value:none
Type:UnquotedString
Destination:makefile_variable
Description:Command executed after archiver execution.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.make.ar_pre_process
Identifier:AR_PRE_PROCESS
Default Value:none
Value:none
Type:UnquotedString
Destination:makefile_variable
Description:Command executed before archiver execution.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.make.as
Identifier:AS
Default Value:nios2-elf-gcc
Value:nios2-elf-gcc
Type:UnquotedString
Destination:makefile_variable
Description:Assembler command. Note that CC is used for .S files.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.make.as_post_process
Identifier:AS_POST_PROCESS
Default Value:none
Value:none
Type:UnquotedString
Destination:makefile_variable
Description:Command executed after each assembly file is compiled.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.make.as_pre_process
Identifier:AS_PRE_PROCESS
Default Value:none
Value:none
Type:UnquotedString
Destination:makefile_variable
Description:Command executed before each assembly file is compiled.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.make.bsp_arflags
Identifier:BSP_ARFLAGS
Default Value:-src
Value:-src
Type:UnquotedString
Destination:makefile_variable
Description:Custom flags only passed to the archiver. This content of this variable is directly passed to the archiver rather than the more standard "ARFLAGS". The reason for this is that GNU Make assumes some default content in ARFLAGS. This setting defines the value of BSP_ARFLAGS in Makefile.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.make.bsp_asflags
Identifier:BSP_ASFLAGS
Default Value:-Wa,-gdwarf2
Value:-Wa,-gdwarf2
Type:UnquotedString
Destination:makefile_variable
Description:Custom flags only passed to the assembler. This setting defines the value of BSP_ASFLAGS in Makefile.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.make.bsp_cflags_debug
Identifier:BSP_CFLAGS_DEBUG
Default Value:-g
Value:-g
Type:UnquotedString
Destination:makefile_variable
Description:C/C++ compiler debug level. '-g' provides the default set of debug symbols typically required to debug a typical application. Omitting '-g' removes debug symbols from the ELF. This setting defines the value of BSP_CFLAGS_DEBUG in Makefile.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.make.bsp_cflags_defined_symbols
Identifier:BSP_CFLAGS_DEFINED_SYMBOLS
Default Value:none
Value:none
Type:UnquotedString
Destination:makefile_variable
Description:Preprocessor macros to define. A macro definition in this setting has the same effect as a "#define" in source code. Adding "-DALT_DEBUG" to this setting has the same effect as "#define ALT_DEBUG" in a souce file. Adding "-DFOO=1" to this setting is equivalent to the macro "#define FOO 1" in a source file. Macros defined with this setting are applied to all .S, .c, and C++ files in the BSP. This setting defines the value of BSP_CFLAGS_DEFINED_SYMBOLS in the BSP Makefile.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.make.bsp_cflags_optimization
Identifier:BSP_CFLAGS_OPTIMIZATION
Default Value:-O0
Value:-Os
Type:UnquotedString
Destination:makefile_variable
Description:C/C++ compiler optimization level. "-O0" = no optimization,"-O2" = "normal" optimization, etc. "-O0" is recommended for code that you want to debug since compiler optimization can remove variables and produce non-sequential execution of code while debugging. This setting defines the value of BSP_CFLAGS_OPTIMIZATION in Makefile.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.make.bsp_cflags_undefined_symbols
Identifier:BSP_CFLAGS_UNDEFINED_SYMBOLS
Default Value:none
Value:none
Type:UnquotedString
Destination:makefile_variable
Description:Preprocessor macros to undefine. Undefined macros are similar to defined macros, but replicate the "#undef" directive in source code. To undefine the macro FOO use the syntax "-u FOO" in this setting. This is equivalent to "#undef FOO" in a source file. Note: the syntax differs from macro definition (there is a space, i.e. "-u FOO" versus "-DFOO"). Macros defined with this setting are applied to all .S, .c, and C++ files in the BSP. This setting defines the value of BSP_CFLAGS_UNDEFINED_SYMBOLS in the BSP Makefile.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.make.bsp_cflags_user_flags
Identifier:BSP_CFLAGS_USER_FLAGS
Default Value:none
Value:none
Type:UnquotedString
Destination:makefile_variable
Description:Custom flags passed to the compiler when compiling C, C++, and .S files. This setting defines the value of BSP_CFLAGS_USER_FLAGS in Makefile.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.make.bsp_cflags_warnings
Identifier:BSP_CFLAGS_WARNINGS
Default Value:-Wall
Value:-Wall
Type:UnquotedString
Destination:makefile_variable
Description:C/C++ compiler warning level. "-Wall" is commonly used.This setting defines the value of BSP_CFLAGS_WARNINGS in Makefile.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.make.bsp_cxx_flags
Identifier:BSP_CXXFLAGS
Default Value:none
Value:none
Type:UnquotedString
Destination:makefile_variable
Description:Custom flags only passed to the C++ compiler. This setting defines the value of BSP_CXXFLAGS in Makefile.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.make.bsp_inc_dirs
Identifier:BSP_INC_DIRS
Default Value:none
Value:none
Type:UnquotedString
Destination:makefile_variable
Description:Space separated list of extra include directories to scan for header files. Directories are relative to the top-level BSP directory. The -I prefix's added by the makefile so don't add it here. This setting defines the value of BSP_INC_DIRS in Makefile.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.make.build_post_process
Identifier:BUILD_POST_PROCESS
Default Value:none
Value:none
Type:UnquotedString
Destination:makefile_variable
Description:Command executed after BSP built.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.make.build_pre_process
Identifier:BUILD_PRE_PROCESS
Default Value:none
Value:none
Type:UnquotedString
Destination:makefile_variable
Description:Command executed before BSP built.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.make.cc
Identifier:CC
Default Value:nios2-elf-gcc -xc
Value:nios2-elf-gcc -xc
Type:UnquotedString
Destination:makefile_variable
Description:C compiler command.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.make.cc_post_process
Identifier:CC_POST_PROCESS
Default Value:none
Value:none
Type:UnquotedString
Destination:makefile_variable
Description:Command executed after each .c/.S file is compiled.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.make.cc_pre_process
Identifier:CC_PRE_PROCESS
Default Value:none
Value:none
Type:UnquotedString
Destination:makefile_variable
Description:Command executed before each .c/.S file is compiled.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.make.cxx
Identifier:CXX
Default Value:nios2-elf-gcc -xc++
Value:nios2-elf-gcc -xc++
Type:UnquotedString
Destination:makefile_variable
Description:C++ compiler command.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.make.cxx_post_process
Identifier:CXX_POST_PROCESS
Default Value:none
Value:none
Type:UnquotedString
Destination:makefile_variable
Description:Command executed before each C++ file is compiled.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.make.cxx_pre_process
Identifier:CXX_PRE_PROCESS
Default Value:none
Value:none
Type:UnquotedString
Destination:makefile_variable
Description:Command executed before each C++ file is compiled.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.make.ignore_system_derived.big_endian
Identifier:NONE
Default Value:0
Value:0
Type:Boolean
Destination:public_mk_define
Description:Enable BSP generation to query if SOPC system is big endian. If true ignores export of 'ALT_CFLAGS += -meb' to public.mk if big endian system.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.make.ignore_system_derived.debug_core_present
Identifier:NONE
Default Value:0
Value:0
Type:Boolean
Destination:public_mk_define
Description:Enable BSP generation to query if SOPC system has a debug core present. If true ignores export of 'CPU_HAS_DEBUG_CORE = 1' to public.mk if a debug core is found in the system. If true ignores export of 'CPU_HAS_DEBUG_CORE = 0' if no debug core is found in the system.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.make.ignore_system_derived.fpu_present
Identifier:NONE
Default Value:0
Value:0
Type:Boolean
Destination:public_mk_define
Description:Enable BSP generation to query if SOPC system has FPU present. If true ignores export of 'ALT_CFLAGS += -mhard-float' to public.mk if FPU is found in the system. If true ignores export of 'ALT_CFLAGS += -mhard-soft' if FPU is not found in the system.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.make.ignore_system_derived.hardware_divide_present
Identifier:NONE
Default Value:0
Value:0
Type:Boolean
Destination:public_mk_define
Description:Enable BSP generation to query if SOPC system has hardware divide present. If true ignores export of 'ALT_CFLAGS += -mno-hw-div' to public.mk if no division is found in system. If true ignores export of 'ALT_CFLAGS += -mhw-div' if division is found in the system.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.make.ignore_system_derived.hardware_fp_cust_inst_divider_present
Identifier:NONE
Default Value:0
Value:0
Type:Boolean
Destination:public_mk_define
Description:Enable BSP generation to query if SOPC system floating point custom instruction with a divider is present. If true ignores export of 'ALT_CFLAGS += -mcustom-fpu-cfg=60-2' and 'ALT_LDFLAGS += -mcustom-fpu-cfg=60-2' to public.mk if the custom instruction is found in the system.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.make.ignore_system_derived.hardware_fp_cust_inst_no_divider_present
Identifier:NONE
Default Value:0
Value:0
Type:Boolean
Destination:public_mk_define
Description:Enable BSP generation to query if SOPC system floating point custom instruction without a divider is present. If true ignores export of 'ALT_CFLAGS += -mcustom-fpu-cfg=60-1' and 'ALT_LDFLAGS += -mcustom-fpu-cfg=60-1' to public.mk if the custom instruction is found in the system.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.make.ignore_system_derived.hardware_multiplier_present
Identifier:NONE
Default Value:0
Value:0
Type:Boolean
Destination:public_mk_define
Description:Enable BSP generation to query if SOPC system has multiplier present. If true ignores export of 'ALT_CFLAGS += -mno-hw-mul' to public.mk if no multiplier is found in the system. If true ignores export of 'ALT_CFLAGS += -mhw-mul' if multiplier is found in the system.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.make.ignore_system_derived.hardware_mulx_present
Identifier:NONE
Default Value:0
Value:0
Type:Boolean
Destination:public_mk_define
Description:Enable BSP generation to query if SOPC system has hardware mulx present. If true ignores export of 'ALT_CFLAGS += -mno-hw-mulx' to public.mk if no mulx is found in the system. If true ignores export of 'ALT_CFLAGS += -mhw-mulx' if mulx is found in the system.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.make.ignore_system_derived.sopc_simulation_enabled
Identifier:NONE
Default Value:0
Value:0
Type:Boolean
Destination:public_mk_define
Description:Enable BSP generation to query if SOPC system has simulation enabled. If true ignores export of 'ELF_PATCH_FLAG += --simulation_enabled' to public.mk.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.make.ignore_system_derived.sopc_system_base_address
Identifier:NONE
Default Value:0
Value:0
Type:Boolean
Destination:public_mk_define
Description:Enable BSP generation to query SOPC system for system ID base address. If true ignores export of 'SOPC_SYSID_FLAG += --sidp=<address>' and 'ELF_PATCH_FLAG += --sidp=<address>' to public.mk.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.make.ignore_system_derived.sopc_system_id
Identifier:NONE
Default Value:0
Value:0
Type:Boolean
Destination:public_mk_define
Description:Enable BSP generation to query SOPC system for system ID. If true ignores export of 'SOPC_SYSID_FLAG += --id=<sysid>' and 'ELF_PATCH_FLAG += --id=<sysid>' to public.mk.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.make.ignore_system_derived.sopc_system_timestamp
Identifier:NONE
Default Value:0
Value:0
Type:Boolean
Destination:public_mk_define
Description:Enable BSP generation to query SOPC system for system timestamp. If true ignores export of 'SOPC_SYSID_FLAG += --timestamp=<timestamp>' and 'ELF_PATCH_FLAG += --timestamp=<timestamp>' to public.mk.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.make.rm
Identifier:RM
Default Value:rm -f
Value:rm -f
Type:UnquotedString
Destination:makefile_variable
Description:Command used to remove files during 'clean' target.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.max_file_descriptors
Identifier:ALT_MAX_FD
Default Value:32
Value:32
Type:DecimalNumber
Destination:system_h_define
Description:Determines the number of file descriptors statically allocated. This setting defines the value of ALT_MAX_FD in system.h.
Restrictions:If hal.enable_lightweight_device_driver_api is true, there are no file descriptors so this setting is ignored. If hal.enable_lightweight_device_driver_api is false, this setting must be at least 4 because HAL needs a file descriptor for /dev/null, /dev/stdin, /dev/stdout, and /dev/stderr.
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.stderr
Identifier:NONE
Default Value:none
Value:jtag_uart
Type:UnquotedString
Destination:system_h_define
Description:Slave descriptor of STDERR character-mode device. This setting is used by the ALT_STDERR family of defines in system.h.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.stdin
Identifier:NONE
Default Value:none
Value:jtag_uart
Type:UnquotedString
Destination:system_h_define
Description:Slave descriptor of STDIN character-mode device. This setting is used by the ALT_STDIN family of defines in system.h.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.stdout
Identifier:NONE
Default Value:none
Value:jtag_uart
Type:UnquotedString
Destination:system_h_define
Description:Slave descriptor of STDOUT character-mode device. This setting is used by the ALT_STDOUT family of defines in system.h.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.sys_clk_timer
Identifier:ALT_SYS_CLK
Default Value:none
Value:none
Type:UnquotedString
Destination:system_h_define
Description:Slave descriptor of the system clock timer device. This device provides a periodic interrupt ("tick") and is typically required for RTOS use. This setting defines the value of ALT_SYS_CLK in system.h.
Restrictions:none
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Setting Name:hal.timestamp_timer
Identifier:ALT_TIMESTAMP_CLK
Default Value:none
Value:none
Type:UnquotedString
Destination:system_h_define
Description:Slave descriptor of timestamp timer device. This device is used by Altera HAL timestamp drivers for high-resolution time measurement. This setting defines the value of ALT_TIMESTAMP_CLK in system.h.
Restrictions:none
+
+
+
+ + Index: components/sd_card/firmware/bsp/alt_sys_init.c =================================================================== --- components/sd_card/firmware/bsp/alt_sys_init.c (nonexistent) +++ components/sd_card/firmware/bsp/alt_sys_init.c (revision 8) @@ -0,0 +1,93 @@ +/* + * alt_sys_init.c - HAL initialization source + * + * Machine generated for CPU 'nios2_qsys_0' in SOPC Builder design 'system' + * SOPC Builder design path: ../../system.sopcinfo + * + * Generated: Sat Aug 16 22:37:16 CEST 2014 + */ + +/* + * DO NOT MODIFY THIS FILE + * + * Changing this file will have subtle consequences + * which will almost certainly lead to a nonfunctioning + * system. If you do modify this file, be aware that your + * changes will be overwritten and lost when this file + * is generated again. + * + * DO NOT MODIFY THIS FILE + */ + +/* + * License Agreement + * + * Copyright (c) 2008 + * Altera Corporation, San Jose, California, USA. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * This agreement shall be governed in all respects by the laws of the State + * of California and by the laws of the United States of America. + */ + +#include "system.h" +#include "sys/alt_irq.h" +#include "sys/alt_sys_init.h" + +#include + +/* + * Device headers + */ + +#include "altera_nios2_qsys_irq.h" +#include "altera_avalon_jtag_uart.h" + +/* + * Allocate the device storage + */ + +ALTERA_NIOS2_QSYS_IRQ_INSTANCE ( NIOS2_QSYS_0, nios2_qsys_0); +ALTERA_AVALON_JTAG_UART_INSTANCE ( JTAG_UART, jtag_uart); + +/* + * Initialize the interrupt controller devices + * and then enable interrupts in the CPU. + * Called before alt_sys_init(). + * The "base" parameter is ignored and only + * present for backwards-compatibility. + */ + +void alt_irq_init ( const void* base ) +{ + ALTERA_NIOS2_QSYS_IRQ_INIT ( NIOS2_QSYS_0, nios2_qsys_0); + alt_irq_cpu_enable_interrupts(); +} + +/* + * Initialize the non-interrupt controller devices. + * Called after alt_irq_init(). + */ + +void alt_sys_init( void ) +{ + ALTERA_AVALON_JTAG_UART_INIT ( JTAG_UART, jtag_uart); +} Index: components/sd_card/firmware/bsp/settings.bsp =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/xml Index: components/sd_card/firmware/bsp/settings.bsp =================================================================== --- components/sd_card/firmware/bsp/settings.bsp (nonexistent) +++ components/sd_card/firmware/bsp/settings.bsp (revision 8)
components/sd_card/firmware/bsp/settings.bsp Property changes : Added: svn:mime-type ## -0,0 +1 ## +application/xml \ No newline at end of property Index: components/sd_card/firmware/bsp/memory.gdb =================================================================== --- components/sd_card/firmware/bsp/memory.gdb (nonexistent) +++ components/sd_card/firmware/bsp/memory.gdb (revision 8) @@ -0,0 +1,53 @@ +# memory.gdb - GDB memory region definitions +# +# Machine generated for CPU 'nios2_qsys_0' in SOPC Builder design 'system' +# SOPC Builder design path: ../../system.sopcinfo +# +# Generated: Sat Aug 16 22:37:16 CEST 2014 + +# DO NOT MODIFY THIS FILE +# +# Changing this file will have subtle consequences +# which will almost certainly lead to a nonfunctioning +# system. If you do modify this file, be aware that your +# changes will be overwritten and lost when this file +# is generated again. +# +# DO NOT MODIFY THIS FILE + +# License Agreement +# +# Copyright (c) 2008 +# Altera Corporation, San Jose, California, USA. +# All rights reserved. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# +# This agreement shall be governed in all respects by the laws of the State +# of California and by the laws of the United States of America. + +# Define memory regions for each memory connected to the CPU. +# The cache attribute is specified which improves GDB performance +# by allowing GDB to cache memory contents on the host. + +# sdram +memory 0x0 0x8000000 cache + +# onchip_memory2_0 +memory 0x8008000 0x8010000 cache Index: components/sd_card/firmware/bsp/HAL/src/alt_irq_register.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_irq_register.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_irq_register.c (revision 8) @@ -0,0 +1,102 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2009 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ +#include +#include "system.h" + +/* + * This interrupt registry mechanism works with the Nios II internal interrupt + * controller (IIC) only. Systems with an external interrupt controller (EIC), + * or those with the IIC who are using the enhanced interrupt API will + * utilize the alt_ic_isr_register() routine to register an interrupt. + */ +#ifndef NIOS2_EIC_PRESENT + +#include "sys/alt_irq.h" +#include "priv/alt_legacy_irq.h" +#include "os/alt_hooks.h" + +#include "alt_types.h" + +/* + * The header, alt_irq_entry.h, contains the exception entry point, and is + * provided by the processor component. It is included here, so that the code + * will be added to the executable only if alt_irq_register() is present, i.e. + * if no interrupts are registered - there's no need to provide any + * interrupt handling. + */ + +#include "sys/alt_irq_entry.h" + +/* + * The header, alt_irq_table.h contains a table describing which function + * handles each interrupt. + */ + +#include "priv/alt_irq_table.h" + +/* + * alt_irq_handler() is called to register an interrupt handler. If the + * function is succesful, then the requested interrupt will be enabled upon + * return. Registering a NULL handler will disable the interrupt. + * + * The return value is 0 if the interrupt handler was registered and the + * interrupt was enabled, otherwise it is negative. + */ + +int alt_irq_register (alt_u32 id, + void* context, + alt_isr_func handler) +{ + int rc = -EINVAL; + alt_irq_context status; + + if (id < ALT_NIRQ) + { + /* + * interrupts are disabled while the handler tables are updated to ensure + * that an interrupt doesn't occur while the tables are in an inconsistant + * state. + */ + + status = alt_irq_disable_all (); + + alt_irq[id].handler = handler; + alt_irq[id].context = context; + + rc = (handler) ? alt_irq_enable (id): alt_irq_disable (id); + + alt_irq_enable_all(status); + } + return rc; +} +#endif /* NIOS2_EIC_PRESENT */ + Index: components/sd_card/firmware/bsp/HAL/src/alt_dcache_flush_no_writeback.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_dcache_flush_no_writeback.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_dcache_flush_no_writeback.c (revision 8) @@ -0,0 +1,88 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2007 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +******************************************************************************/ + +#include "nios2.h" +#include "system.h" + +#include "alt_types.h" +#include "sys/alt_cache.h" + +/* + * The INITDA instruction was added to Nios II in the 8.0 release. + * + * The INITDA instruction has one of the following possible behaviors + * depending on the processor configuration: + * 1) Flushes a line by address but does NOT write back dirty data. + * Occurs when a data cache is present that supports INITDA. + * The macro NIOS2_INITDA_SUPPORTED is defined in system.h. + * 2) Takes an unimplemented instruction exception. + * Occurs when a data cache is present that doesn't support INITDA. + * 3) Performs no operation + * Occurs when there is no data cache present. + * The macro NIOS2_DCACHE_SIZE is 0 in system.h. + */ + +#define ALT_FLUSH_DATA_NO_WRITEBACK(i) \ + __asm__ volatile ("initda (%0)" :: "r" (i)); + +/* + * alt_dcache_flush_no_writeback() is called to flush the data cache for a + * memory region of length "len" bytes, starting at address "start". + * + * Any dirty lines in the data cache are NOT written back to memory. + * Make sure you really want this behavior. If you aren't 100% sure, + * use the alt_dcache_flush() routine instead. + */ + +void alt_dcache_flush_no_writeback (void* start, alt_u32 len) +{ +#if defined(NIOS2_INITDA_SUPPORTED) + + char* i; + char* end = ((char*) start) + len; + + for (i = start; i < end; i+= NIOS2_DCACHE_LINE_SIZE) + { + ALT_FLUSH_DATA_NO_WRITEBACK(i); + } + + /* + * For an unaligned flush request, we've got one more line left. + * Note that this is dependent on NIOS2_DCACHE_LINE_SIZE to be a + * multiple of 2 (which it always is). + */ + + if (((alt_u32) start) & (NIOS2_DCACHE_LINE_SIZE - 1)) + { + ALT_FLUSH_DATA_NO_WRITEBACK(i); + } + +#endif /* NIOS2_INITDA_SUPPORTED */ +} Index: components/sd_card/firmware/bsp/HAL/src/alt_dcache_flush_all.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_dcache_flush_all.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_dcache_flush_all.c (revision 8) @@ -0,0 +1,51 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2003-2005 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +******************************************************************************/ + +#include "nios2.h" +#include "system.h" + +#include "alt_types.h" +#include "sys/alt_cache.h" + +/* + * alt_dcache_flush_all() is called to flush the entire data cache. + */ + +void alt_dcache_flush_all (void) +{ +#if NIOS2_DCACHE_SIZE > 0 + char* i; + + for (i = (char*) 0; i < (char*) NIOS2_DCACHE_SIZE; i+= NIOS2_DCACHE_LINE_SIZE) + { + __asm__ volatile ("flushd (%0)" :: "r" (i)); + } +#endif /* NIOS2_DCACHE_SIZE > 0 */ +} Index: components/sd_card/firmware/bsp/HAL/src/alt_gmon.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_gmon.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_gmon.c (revision 8) @@ -0,0 +1,272 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2003-2005 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +******************************************************************************/ + +#include +#include +#include + +#include "priv/nios2_gmon_data.h" + +#include "sys/alt_irq.h" +#include "sys/alt_alarm.h" + + +/* Macros */ + +/* How large should the bins be which we use to generate the histogram */ +#define PCSAMPLE_BYTES_PER_BUCKET 32 + +#define NIOS2_READ_EA(dest) __asm__ ("mov %0, ea" : "=r" (dest)) + +/* The compiler inserts calls to mcount() at the start of + * every function call. The structure mcount_fn_arc records t + * he return address of the function called (in from_pc) + * and the return address of the mcount function + * (in self_pc). The number of times this arc is executed is + * recorded in the field count. + */ +struct mcount_fn_arc +{ + struct mcount_fn_arc * next; + void * from_pc; + unsigned int count; +}; + +/* We need to maintain a list of pointers to the heads of each adjacency + * list so that we can find them when writing out the gmon.out file. Since + * we don't know at the start of program execution how many functions will + * be called we use a list structure to do this. + */ +struct mcount_fn_entry +{ + struct mcount_fn_entry * next; + void * self_pc; + struct mcount_fn_arc * arc_head; +}; + +/* function prototypes */ + +void __mcount_record(void * self_pc, void * from_pc, struct mcount_fn_entry * fn_entry, struct mcount_fn_entry * * fn_head) __attribute__ ((no_instrument_function)); + +static __inline__ void * mcount_allocate(unsigned int size) __attribute__ ((no_instrument_function)); +static int nios2_pcsample_init(void) __attribute__ ((no_instrument_function)); +static alt_u32 nios2_pcsample(void* alarm) __attribute__ ((no_instrument_function)); + +/* global variables */ + +/* stext and etext are defined in the linker script */ +extern char stext[]; +extern char etext[]; + +/* Is the PC sampling stuff enabled yet? */ +static int pcsample_need_init = 1; + +#define HASH_BUCKETS 64 /* Must be a power of 2 */ + +/* This points to the list of adjacency list pointers. */ +struct mcount_fn_entry * __mcount_fn_head[HASH_BUCKETS]; + +/* pointer to the in-memory buffer containing the histogram */ +static unsigned short* s_pcsamples = 0; + +/* the address of the start and end of text section */ +static const unsigned int s_low_pc = (unsigned int)stext; +static const unsigned int s_high_pc = (unsigned int)etext; + +/* the alarm structure to register for pc sampling */ +static alt_alarm s_nios2_pcsample_alarm; + +unsigned int alt_gmon_data[GMON_DATA_SIZE] = +{ + 0x6e6f6d67, /* "gmon" */ + GMON_DATA_SIZE, + 0, + (unsigned int)stext, + (unsigned int)etext, + PCSAMPLE_BYTES_PER_BUCKET, + 0, + (unsigned int)__mcount_fn_head, + (unsigned int)(__mcount_fn_head + HASH_BUCKETS) +}; + +/* This holds the current slab of memory we're allocating out of */ +static char * mcount_slab_ptr = 0; +static int mcount_slab_size = 0; + +#define MCOUNT_SLAB_INCREMENT 1020 + + +/* + * We can't use malloc to allocate memory because that's too complicated, and + * can't be called at interrupt time. Use the lower level allocator instead + * because that's interrupt safe (and because we never free anything). + * + * For speed, we allocate a block of data at once. + */ +static __inline__ void * mcount_allocate(unsigned int size) +{ + void * data; + + if (size > mcount_slab_size) + { + mcount_slab_ptr = sbrk(MCOUNT_SLAB_INCREMENT); + mcount_slab_size = MCOUNT_SLAB_INCREMENT; + } + + data = mcount_slab_ptr; + mcount_slab_ptr += size; + mcount_slab_size -= size; + + return data; +} + + +/* + * Add the arc with the values of frompc and topc given to the graph. + * This function might be called at interrupt time so must be able to + * cope with reentrancy. + * + * The fast case, where we have already allocated a function arc, has been + * handled by the assmebler code. + */ +void __mcount_record(void * self_pc, void * from_pc, struct mcount_fn_entry * fn_entry, struct mcount_fn_entry * * fn_head) +{ + alt_irq_context context; + struct mcount_fn_arc * arc_entry; + + /* Keep trying to start up the PC sampler until it is running. + * (It can't start until the timer is going). + */ + if (pcsample_need_init) + { + pcsample_need_init = 0; + pcsample_need_init = nios2_pcsample_init(); + } + + /* + * We must disable interrupts around the allocation and the list update to + * prevent corruption if the instrumented function is re-entrant. + * + * It's safe for the code above to be stepping through the chain and be + * interrupted by this code modifying it - there is an edge case which will + * leave two copies of the same arc on the list (both with count=1), but + * this is dealt with on the host. + */ + context = alt_irq_disable_all(); + + if (fn_entry == NULL) + { + /* Add it to the list of functions we must output later. */ + fn_entry = (struct mcount_fn_entry *)mcount_allocate(sizeof(struct mcount_fn_entry)); + + fn_entry->self_pc = self_pc; + fn_entry->arc_head = NULL; + + fn_entry->next = *fn_head; + *fn_head = fn_entry; + } + + /* We will need a new list entry - if there was a list entry before + * then the assembler code would have handled it. */ + arc_entry = (struct mcount_fn_arc *)mcount_allocate(sizeof(struct mcount_fn_arc)); + + arc_entry->from_pc = from_pc; + arc_entry->count = 1; + + arc_entry->next = fn_entry->arc_head; + fn_entry->arc_head = arc_entry; + + alt_irq_enable_all(context); +} + + +/* + * nios2_pcsample_init starts profiling. + * It is called the first time mcount is called, and on subsequent calls to + * mcount until it returns zero. It initializes the pc histogram and turns on + * timer driven pc sampling. + */ +static int nios2_pcsample_init(void) +{ + unsigned int pcsamples_size; + + /* We sample the PC every tick */ + unsigned int prof_rate = alt_ticks_per_second(); + if (prof_rate == 0) + return 1; + + /* allocate the histogram buffer s_pcsamples */ + pcsamples_size = (s_high_pc - s_low_pc)/PCSAMPLE_BYTES_PER_BUCKET; + s_pcsamples = (unsigned short*)sbrk(pcsamples_size * sizeof(unsigned short)); + + if (s_pcsamples != 0) + { + /* initialize the buffer to zero */ + memset(s_pcsamples, 0, pcsamples_size * sizeof(unsigned short)); + + alt_gmon_data[GMON_DATA_PROFILE_DATA] = (int)s_pcsamples; + alt_gmon_data[GMON_DATA_PROFILE_RATE] = prof_rate; + + /* Sample every tick (it's cheap) */ + alt_alarm_start(&s_nios2_pcsample_alarm, 1, nios2_pcsample, 0); + } + + return 0; +} + + +/* + * Sample the PC value and store it in the histogram + */ +static alt_u32 nios2_pcsample(void* context) +{ + unsigned int pc; + unsigned int bucket; + + /* read the exception return address - this will be + * inaccurate if there are nested interrupts but we + * assume that this is rare and the inaccuracy will + * not be great */ + NIOS2_READ_EA(pc); + + /* + * If we're within the profilable range then increment the relevant + * bucket in the histogram + */ + if (pc >= s_low_pc && pc < s_high_pc && s_pcsamples != 0) + { + bucket = (pc - s_low_pc)/PCSAMPLE_BYTES_PER_BUCKET; + s_pcsamples[bucket]++; + } + + /* Sample every tick */ + return 1; +} + Index: components/sd_card/firmware/bsp/HAL/src/alt_printf.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_printf.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_printf.c (revision 8) @@ -0,0 +1,127 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2006 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +/* + * This file provides a very minimal printf implementation for use with very + * small applications. Only the following format strings are supported: + * %x + * %s + * %c + * %% + */ + +#include +#include "sys/alt_stdio.h" + +/* + * ALT printf function + */ +void +alt_printf(const char* fmt, ... ) +{ + va_list args; + va_start(args, fmt); + const char *w; + char c; + + /* Process format string. */ + w = fmt; + while ((c = *w++) != 0) + { + /* If not a format escape character, just print */ + /* character. Otherwise, process format string. */ + if (c != '%') + { + alt_putchar(c); + } + else + { + /* Get format character. If none */ + /* available, processing is complete. */ + if ((c = *w++) != 0) + { + if (c == '%') + { + /* Process "%" escape sequence. */ + alt_putchar(c); + } + else if (c == 'c') + { + int v = va_arg(args, int); + alt_putchar(v); + } + else if (c == 'x') + { + /* Process hexadecimal number format. */ + unsigned long v = va_arg(args, unsigned long); + unsigned long digit; + int digit_shift; + + /* If the number value is zero, just print and continue. */ + if (v == 0) + { + alt_putchar('0'); + continue; + } + + /* Find first non-zero digit. */ + digit_shift = 28; + while (!(v & (0xF << digit_shift))) + digit_shift -= 4; + + /* Print digits. */ + for (; digit_shift >= 0; digit_shift -= 4) + { + digit = (v & (0xF << digit_shift)) >> digit_shift; + if (digit <= 9) + c = '0' + digit; + else + c = 'a' + digit - 10; + alt_putchar(c); + } + } + else if (c == 's') + { + /* Process string format. */ + char *s = va_arg(args, char *); + + while(*s) + alt_putchar(*s++); + } + } + else + { + break; + } + } + } +} Index: components/sd_card/firmware/bsp/HAL/src/alt_close.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_close.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_close.c (revision 8) @@ -0,0 +1,103 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include + +#include "sys/alt_errno.h" +#include "sys/alt_warning.h" +#include "priv/alt_file.h" +#include "os/alt_syscall.h" + +#ifdef ALT_USE_DIRECT_DRIVERS + +int ALT_CLOSE (int fildes) +{ + /* Generate a link time warning, should this function ever be called. */ + + ALT_STUB_WARNING(close); + + /* Indicate an error */ + + ALT_ERRNO = ENOSYS; + return -1; +} + +#else /* !ALT_USE_DIRECT_DRIVERS */ + +/* + * close() is called by an application to release a file descriptor. If the + * associated file system/device has a close() callback function registered + * then this called. The file descriptor is then marked as free. + * + * ALT_CLOSE is mapped onto the close() system call in alt_syscall.h + */ + +int ALT_CLOSE (int fildes) +{ + alt_fd* fd; + int rval; + + /* + * A common error case is that when the file descriptor was created, the call + * to open() failed resulting in a negative file descriptor. This is trapped + * below so that we don't try and process an invalid file descriptor. + */ + + fd = (fildes < 0) ? NULL : &alt_fd_list[fildes]; + + if (fd) + { + /* + * If the associated file system/device has a close function, call it so + * that any necessary cleanup code can run. + */ + + rval = (fd->dev->close) ? fd->dev->close(fd) : 0; + + /* Free the file descriptor structure and return. */ + + alt_release_fd (fildes); + if (rval < 0) + { + ALT_ERRNO = -rval; + return -1; + } + return 0; + } + else + { + ALT_ERRNO = EBADFD; + return -1; + } +} + +#endif /* ALT_USE_DIRECT_DRIVERS */ Index: components/sd_card/firmware/bsp/HAL/src/alt_dcache_flush.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_dcache_flush.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_dcache_flush.c (revision 8) @@ -0,0 +1,97 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2003-2005 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +******************************************************************************/ + +#include "nios2.h" +#include "system.h" + +#include "alt_types.h" +#include "sys/alt_cache.h" + +/* + * Nios II version 1.2 and newer supports the "flush by address" instruction, in + * addition to the "flush by line" instruction provided by older versions of + * the core. This newer instruction is used by preference when it is + * available. + */ + +#ifdef NIOS2_FLUSHDA_SUPPORTED +#define ALT_FLUSH_DATA(i) __asm__ volatile ("flushda (%0)" :: "r" (i)); +#else +#define ALT_FLUSH_DATA(i) __asm__ volatile ("flushd (%0)" :: "r" (i)); +#endif /* NIOS2_FLUSHDA_SUPPORTED */ + +/* + * alt_dcache_flush() is called to flush the data cache for a memory + * region of length "len" bytes, starting at address "start". + * + * Any dirty lines in the data cache are written back to memory. + */ + +void alt_dcache_flush (void* start, alt_u32 len) +{ +#if NIOS2_DCACHE_SIZE > 0 + + char* i; + char* end; + + /* + * This is the most we would ever need to flush. + * + * SPR 196942, 2006.01.13: The cache flush loop below will use the + * 'flushda' instruction if its available; in that case each line + * must be flushed individually, and thus 'len' cannot be trimmed. + */ + #ifndef NIOS2_FLUSHDA_SUPPORTED + if (len > NIOS2_DCACHE_SIZE) + { + len = NIOS2_DCACHE_SIZE; + } + #endif + + end = ((char*) start) + len; + + for (i = start; i < end; i+= NIOS2_DCACHE_LINE_SIZE) + { + ALT_FLUSH_DATA(i); + } + + /* + * For an unaligned flush request, we've got one more line left. + * Note that this is dependent on NIOS2_DCACHE_LINE_SIZE to be a + * multiple of 2 (which it always is). + */ + + if (((alt_u32) start) & (NIOS2_DCACHE_LINE_SIZE - 1)) + { + ALT_FLUSH_DATA(i); + } + +#endif /* NIOS2_DCACHE_SIZE > 0 */ +} Index: components/sd_card/firmware/bsp/HAL/src/alt_alarm_start.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_alarm_start.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_alarm_start.c (revision 8) @@ -0,0 +1,112 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include + +#include "sys/alt_alarm.h" +#include "sys/alt_irq.h" + +/* + * alt_alarm_start is called to register an alarm with the system. The + * "alarm" structure passed as an input argument does not need to be + * initialised by the user. This is done within this function. + * + * The remaining input arguments are: + * + * nticks - The time to elapse until the alarm executes. This is specified in + * system clock ticks. + * callback - The function to run when the indicated time has elapsed. + * context - An opaque value, passed to the callback function. +* + * Care should be taken when defining the callback function since it is + * likely to execute in interrupt context. In particular, this mean that + * library calls like printf() should not be made, since they can result in + * deadlock. + * + * The interval to be used for the next callback is the return + * value from the callback function. A return value of zero indicates that the + * alarm should be unregistered. + * + * alt_alarm_start() will fail if the timer facility has not been enabled + * (i.e. there is no system clock). Failure is indicated by a negative return + * value. + */ + +int alt_alarm_start (alt_alarm* alarm, alt_u32 nticks, + alt_u32 (*callback) (void* context), + void* context) +{ + alt_irq_context irq_context; + alt_u32 current_nticks = 0; + + if (alt_ticks_per_second ()) + { + if (alarm) + { + alarm->callback = callback; + alarm->context = context; + + irq_context = alt_irq_disable_all (); + + current_nticks = alt_nticks(); + + alarm->time = nticks + current_nticks + 1; + + /* + * If the desired alarm time causes a roll-over, set the rollover + * flag. This will prevent the subsequent tick event from causing + * an alarm too early. + */ + if(alarm->time < current_nticks) + { + alarm->rollover = 1; + } + else + { + alarm->rollover = 0; + } + + alt_llist_insert (&alt_alarm_list, &alarm->llist); + alt_irq_enable_all (irq_context); + + return 0; + } + else + { + return -EINVAL; + } + } + else + { + return -ENOTSUP; + } +} Index: components/sd_card/firmware/bsp/HAL/src/alt_exit.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_exit.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_exit.c (revision 8) @@ -0,0 +1,71 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include "sys/alt_irq.h" +#include "sys/alt_sim.h" +#include "os/alt_hooks.h" +#include "os/alt_syscall.h" + +#include "alt_types.h" +#include "sys/alt_log_printf.h" +/* + * _exit() is called by exit() in order to terminate the current process. + * Typically this is called when main() completes. It should never return. + * Since there is nowhere to go once this process completes, this + * implementation simply blocks forever. + * + * Note that interrupts are not disabled so that execution outside of this + * thread is allowed to continue. + * + * ALT_EXIT is mapped onto the _exit() system call in alt_syscall.h + */ + +void ALT_EXIT (int exit_code) +{ + /* ALT_LOG - please see HAL/inc/alt_log_printf.h for details */ + ALT_LOG_PRINT_BOOT("[alt_exit.c] Entering _exit() function.\r\n"); + ALT_LOG_PRINT_BOOT("[alt_exit.c] Exit code from main was %d.\r\n",exit_code); + /* Stop all other threads */ + + ALT_LOG_PRINT_BOOT("[alt_exit.c] Calling ALT_OS_STOP().\r\n"); + ALT_OS_STOP(); + + /* Provide notification to the simulator that we've stopped */ + + ALT_LOG_PRINT_BOOT("[alt_exit.c] Calling ALT_SIM_HALT().\r\n"); + ALT_SIM_HALT(exit_code); + + /* spin forever, since there's no where to go back to */ + + ALT_LOG_PRINT_BOOT("[alt_exit.c] Spinning forever.\r\n"); + while (1); +} Index: components/sd_card/firmware/bsp/HAL/src/alt_ioctl.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_ioctl.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_ioctl.c (revision 8) @@ -0,0 +1,170 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2006 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include + +#include "sys/ioctl.h" +#include "sys/alt_errno.h" +#include "sys/alt_warning.h" +#include "priv/alt_file.h" +#include "os/alt_syscall.h" + +/* + * The ioctl() system call is provided so that application code can manipulate + * the i/o capabilities of a device in device specific ways. This is identical + * to the standard posix ioctl() function. + * + * In general this implementation simply vectors ioctl requests to the + * apropriate drivers ioctl function (as registered in the drivers alt_dev + * structure). + * + * However in the case of devices (as oposed to filesystem), the TIOCEXCL and + * TIOCNXCL requests are handled without reference to the driver. These + * requests are used to lock/release a device for exclusive access. + * + * Handling these requests centrally eases the task of device driver + * development. + * + * ALT_IOCTL is mapped onto the ioctl() system call in alt_syscall.h + */ + +#ifdef ALT_USE_DIRECT_DRIVERS + +#include "system.h" +#include "sys/alt_driver.h" + +/* + * Provide minimal version that calls ioctl routine of provided stdio devices. + */ +int ALT_IOCTL (int file, int req, void* arg) +{ +#ifdef ALT_STDIN_PRESENT + ALT_DRIVER_IOCTL_EXTERNS(ALT_STDIN_DEV); +#endif +#ifdef ALT_STDOUT_PRESENT + ALT_DRIVER_IOCTL_EXTERNS(ALT_STDOUT_DEV); +#endif +#ifdef ALT_STDERR_PRESENT + ALT_DRIVER_IOCTL_EXTERNS(ALT_STDERR_DEV); +#endif + +#if !defined(ALT_STDIN_PRESENT) && !defined(ALT_STDOUT_PRESENT) && !defined(ALT_STDERR_PRESENT) + /* Generate a link time warning, should this function ever be called. */ + ALT_STUB_WARNING(ioctl); +#endif + + switch (file) { +#ifdef ALT_STDIN_PRESENT + case 0: /* stdin file descriptor */ + return ALT_DRIVER_IOCTL(ALT_STDIN_DEV, req, arg); +#endif /* ALT_STDIN_PRESENT */ +#ifdef ALT_STDOUT_PRESENT + case 1: /* stdout file descriptor */ + return ALT_DRIVER_IOCTL(ALT_STDOUT_DEV, req, arg); +#endif /* ALT_STDOUT_PRESENT */ +#ifdef ALT_STDERR_PRESENT + case 2: /* stderr file descriptor */ + return ALT_DRIVER_IOCTL(ALT_STDERR_DEV, req, arg); +#endif /* ALT_STDERR_PRESENT */ + default: + ALT_ERRNO = EBADFD; + return -1; + } +} + +#else /* !ALT_USE_DIRECT_DRIVERS */ + +int ALT_IOCTL (int file, int req, void* arg) +{ + alt_fd* fd; + int rc; + + /* + * A common error case is that when the file descriptor was created, the call + * to open() failed resulting in a negative file descriptor. This is trapped + * below so that we don't try and process an invalid file descriptor. + */ + + fd = (file < 0) ? NULL : &alt_fd_list[file]; + + if (fd) + { + + /* + * In the case of device drivers (not file systems) handle the TIOCEXCL + * and TIOCNXCL requests as special cases. + */ + + if (fd->fd_flags & ALT_FD_DEV) + { + if (req == TIOCEXCL) + { + rc = alt_fd_lock (fd); + goto ioctl_done; + } + else if (req == TIOCNXCL) + { + rc = alt_fd_unlock (fd); + goto ioctl_done; + } + } + + /* + * If the driver provides an ioctl() function, call that to handle the + * request, otherwise set the return code to indicate that the request + * could not be processed. + */ + + if (fd->dev->ioctl) + { + rc = fd->dev->ioctl(fd, req, arg); + } + else + { + rc = -ENOTTY; + } + } + else + { + rc = -EBADFD; + } + +ioctl_done: + + if (rc < 0) + { + ALT_ERRNO = -rc; + } + return rc; +} + +#endif /* ALT_USE_DIRECT_DRIVERS */ Index: components/sd_card/firmware/bsp/HAL/src/alt_read.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_read.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_read.c (revision 8) @@ -0,0 +1,125 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2006 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include +#include + +#include "sys/alt_errno.h" +#include "sys/alt_warning.h" +#include "priv/alt_file.h" +#include "os/alt_syscall.h" + +/* + * The read() system call is used to read a block of data from a file or device. + * This function simply vectors the request to the device driver associated + * with the input file descriptor "file". + * + * ALT_READ is mapped onto the read() system call in alt_syscall.h + */ + +#ifdef ALT_USE_DIRECT_DRIVERS + +#include "system.h" +#include "sys/alt_driver.h" + +/* + * Provide minimal version that just reads from the stdin device when provided. + */ + +int ALT_READ (int file, void *ptr, size_t len) +{ +#ifdef ALT_STDIN_PRESENT + ALT_DRIVER_READ_EXTERNS(ALT_STDIN_DEV); +#endif + +#if !defined(ALT_STDIN_PRESENT) + /* Generate a link time warning, should this function ever be called. */ + ALT_STUB_WARNING(read); +#endif + + switch (file) { +#ifdef ALT_STDIN_PRESENT + case 0: /* stdin file descriptor */ + return ALT_DRIVER_READ(ALT_STDIN_DEV, ptr, len, 0); +#endif /* ALT_STDIN_PRESENT */ + default: + ALT_ERRNO = EBADFD; + return -1; + } +} + +#else /* !ALT_USE_DIRECT_DRIVERS */ + +int ALT_READ (int file, void *ptr, size_t len) +{ + alt_fd* fd; + int rval; + + /* + * A common error case is that when the file descriptor was created, the call + * to open() failed resulting in a negative file descriptor. This is trapped + * below so that we don't try and process an invalid file descriptor. + */ + + fd = (file < 0) ? NULL : &alt_fd_list[file]; + + if (fd) + { + /* + * If the file has not been opened with read access, or if the driver does + * not provide an implementation of read(), generate an error. Otherwise + * call the drivers read() function to process the request. + */ + + if (((fd->fd_flags & O_ACCMODE) != O_WRONLY) && + (fd->dev->read)) + { + if ((rval = fd->dev->read(fd, ptr, len)) < 0) + { + ALT_ERRNO = -rval; + return -1; + } + return rval; + } + else + { + ALT_ERRNO = EACCES; + } + } + else + { + ALT_ERRNO = EBADFD; + } + return -1; +} + +#endif /* ALT_USE_DIRECT_DRIVERS */ Index: components/sd_card/firmware/bsp/HAL/src/alt_do_ctors.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_do_ctors.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_do_ctors.c (revision 8) @@ -0,0 +1,64 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +/****************************************************************************** +* * +* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT IT DIRECTLY. * +* * +* Overriding HAL Functions * +* * +* To provide your own implementation of a HAL function, include the file in * +* your Nios II IDE application project. When building the executable, the * +* Nios II IDE finds your function first, and uses it in place of the HAL * +* version. * +* * +******************************************************************************/ + +/* + * + */ + +typedef void (*constructor) (void); +extern constructor __CTOR_LIST__[]; +extern constructor __CTOR_END__[]; + +/* + * Run the C++ static constructors. + */ + +void _do_ctors(void) +{ + constructor* ctor; + + for (ctor = &__CTOR_END__[-1]; ctor >= __CTOR_LIST__; ctor--) + (*ctor) (); +} Index: components/sd_card/firmware/bsp/HAL/src/alt_getpid.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_getpid.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_getpid.c (revision 8) @@ -0,0 +1,47 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include "os/alt_syscall.h" + +/* + * The getpid() system call is used by newlib to obtain the current process + * id. Since there is only ever a single process in the HAL environment, + * this just returns a constant. + * + * ALT_GETPID is mapped onto the getpid() system call in alt_syscall.h + */ + +int ALT_GETPID (void) +{ + return 0; +} + Index: components/sd_card/firmware/bsp/HAL/src/alt_instruction_exception_entry.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_instruction_exception_entry.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_instruction_exception_entry.c (revision 8) @@ -0,0 +1,206 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2008 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ +#include "sys/alt_exceptions.h" +#include "nios2.h" +#include "alt_types.h" +#include "system.h" + +/* + * This file implements support for calling user-registered handlers for + * instruction-generated exceptions. This handler could also be reached + * in the event of a spurious interrupt. + * + * The handler code is optionally enabled through the "Enable + * Instruction-related Exception API" HAL BSP setting, which will + * define the macro below. + */ +#ifdef ALT_INCLUDE_INSTRUCTION_RELATED_EXCEPTION_API + +/* Function pointer to exception callback routine */ +alt_exception_result (*alt_instruction_exception_handler) + (alt_exception_cause, alt_u32, alt_u32) = 0x0; + +/* Link entry routine to .exceptions section */ +int alt_instruction_exception_entry (alt_u32 exception_pc) + __attribute__ ((section (".exceptions"))); + +/* + * This is the entry point for instruction-generated exceptions handling. + * This routine will be called by alt_exceptions_entry.S, after it determines + * that an exception could not be handled by handlers that preceed that + * of instruction-generated exceptions (such as interrupts). + * + * For this to function properly, you must register an exception handler + * using alt_instruction_exception_register(). This routine will call + * that handler if it has been registered. Absent a handler, it will + * break break or hang as discussed below. + */ +int +alt_instruction_exception_entry (alt_u32 exception_pc) +{ + alt_u32 cause, badaddr; + +/* + * If the processor hardware has the optional EXCEPTIONS & BADADDR registers, + * read them and pass their content to the user handler. These are always + * present if the MMU or MPU is enabled, and optionally for other advanced + * exception types via the "Extra exceptions information" setting in the + * processor (hardware) configuration. + * + * If these registers are not present, the cause field will be set to + * NIOS2_EXCEPTION_CAUSE_NOT_PRESENT. Your handling routine should + * check the validity of the cause argument before proceeding. + */ +#ifdef NIOS2_HAS_EXTRA_EXCEPTION_INFO + /* Get exception cause & "badaddr" */ + NIOS2_READ_EXCEPTION(cause); + cause = ( (cause & NIOS2_EXCEPTION_REG_CAUSE_MASK) >> + NIOS2_EXCEPTION_REG_CAUSE_OFST ); + + NIOS2_READ_BADADDR(badaddr); +#else + cause = NIOS2_EXCEPTION_CAUSE_NOT_PRESENT; + badaddr = 0; +#endif /* NIOS2_HAS_EXTRA_EXCEPTION_INFO */ + + if(alt_instruction_exception_handler) { + /* + * Call handler. Its return value indicates whether the exception-causing + * instruction should be re-issued. The code that called us, + * alt_eceptions_entry.S, will look at this value and adjust the ea + * register as necessary + */ + return alt_instruction_exception_handler(cause, exception_pc, badaddr); + } + /* + * We got here because an instruction-generated exception occured, but no + * handler is present. We do not presume to know how to handle it. If the + * debugger is present, break, otherwise hang. + * + * If you've reached here in the debugger, consider examining the + * EXCEPTIONS register cause bit-field, which was read into the 'cause' + * variable above, and compare it against the exceptions-type enumeration + * in alt_exceptions.h. This register is availabe if the MMU or MPU is + * present, or if the "Extra exceptions information" hardware option is + * selected. + * + * If you get here then one of the following could have happened: + * + * - An instruction-generated exception occured, and the processor + * does not have the extra exceptions feature enabled, or you + * have not registered a handler using + * alt_instruction_exception_register() + * + * Some examples of instruction-generated exceptions and why they + * might occur: + * + * - Your program could have been compiled for a full-featured + * Nios II core, but it is running on a smaller core, and + * instruction emulation has been disabled by defining + * ALT_NO_INSTRUCTION_EMULATION. + * + * You can work around the problem by re-enabling instruction + * emulation, or you can figure out why your program is being + * compiled for a system other than the one that it is running on. + * + * - Your program has executed a trap instruction, but has not + * implemented a handler for this instruction. + * + * - Your program has executed an illegal instruction (one which is + * not defined in the instruction set). + * + * - Your processor includes an MMU or MPU, and you have enabled it + * before registering an exception handler to service exceptions it + * generates. + * + * The problem could also be hardware related: + * - If your hardware is broken and is generating spurious interrupts + * (a peripheral which negates its interrupt output before its + * interrupt handler has been executed will cause spurious interrupts) + */ + else { +#ifdef NIOS2_HAS_DEBUG_STUB + NIOS2_BREAK(); +#else + while(1) + ; +#endif /* NIOS2_HAS_DEBUG_STUB */ + } + + /* We should not get here. Remove compiler warning. */ + return NIOS2_EXCEPTION_RETURN_REISSUE_INST; +} + +#endif /* ALT_INCLUDE_INSTRUCTION_RELATED_EXCEPTION_API */ + +/* + * This routine indicates whether a particular exception cause will have + * set a valid address into the BADADDR register, which is included + * in the arguments to a user-registered instruction-generated exception + * handler. Many exception types do not set valid contents in BADADDR; + * this is a convenience routine to easily test the validity of that + * argument in your handler. + * + * Note that this routine will return false (0) for causes + * NIOS2_EXCEPTION_TLB_MISS and NIOS2_EXCEPTION_ECC_TLB_ERR. + * You must read the TLBMISC.D field to determine if BADADDR + * is valid for these (valid if TLBMISC.D = 1). + * + * Arguments: + * cause: The 5-bit exception cause field of the EXCEPTIONS register, + * shifted to the LSB position. You may pass the 'cause' argument + * in a handler you registered directy to this routine. + * + * Return: 1: BADADDR (bad_addr argument to handler) is valid + * 0: BADADDR is not valid + */ +int +alt_exception_cause_generated_bad_addr(alt_exception_cause cause) +{ + switch (cause) { + case NIOS2_EXCEPTION_SUPERVISOR_ONLY_DATA_ADDR: + case NIOS2_EXCEPTION_MISALIGNED_DATA_ADDR: + case NIOS2_EXCEPTION_MISALIGNED_TARGET_PC: + case NIOS2_EXCEPTION_TLB_READ_PERM_VIOLATION: + case NIOS2_EXCEPTION_TLB_WRITE_PERM_VIOLATION: + case NIOS2_EXCEPTION_MPU_DATA_REGION_VIOLATION: + case NIOS2_EXCEPTION_ECC_DATA_ERR: + return 1; + + case NIOS2_EXCEPTION_TLB_MISS: + case NIOS2_EXCEPTION_ECC_TLB_ERR: + return 0; + + default: + return 0; + } +} Index: components/sd_card/firmware/bsp/HAL/src/alt_mcount.S =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_mcount.S (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_mcount.S (revision 8) @@ -0,0 +1,198 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2003-2010 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +******************************************************************************/ + +/* mcount or _mcount is inserted by GCC before the function prologue of every + * function when a program is compiled for profiling. At the start of mcount, + * we guarantee that: + * ra = self_pc (an address in the function which called mcount) + * r8 = from_pc (an address in the function which called mcount's caller) + * + * Because this is always called at the start of a function we can corrupt + * r2,r3 and r11-r15. We must not corrupt r4-r7 (because they might contain + * function arguments for the instrumented function) or r8 (which holds ra + * for the instrumented function). + */ + + .global __mcount_fn_head + + .global mcount + + /* _mcount is used by gcc4 */ + .global _mcount + +_mcount: +mcount: + /* Use a hash to speed up locating fn_entry. We use bits 5 upwards to choose + * the bucket because bits 1:0 will always be 0, and because the distribution + * of values for bits 4:2 won't be even (aligning on cache line boundaries + * will skew it). Higher bits should be fairly random. + */ + /* fn_head = mcount_fn_head + (((unsigned int)self_pc >> 5) & (HASH_BUCKETS - 1)); */ + + srli r2, ra, 3 + movhi r3, %hiadj(__mcount_fn_head) + addi r3, r3, %lo(__mcount_fn_head) + andi r2, r2, 0xFC + add r11, r2, r3 + + /* The fast case is where we have already allocated a function arc, and so + * also a function pointer. + */ + + /* First find the function being called (using self_pc) */ + mov r10, r11 +0: + ldw r10, 0(r10) + beq r10, zero, .Lnew_arc + ldw r2, 4(r10) + bne r2, ra, 0b + + /* Found a function entry for this PC. Now look for an arc with a matching + * from_pc value. There will always be at least one arc. */ + ldw r3, 8(r10) +0: + ldw r2, 4(r3) + beq r2, r8, .Lfound_arc + ldw r3, 0(r3) + bne r3, zero, 0b + +.Lnew_arc: + addi sp, sp, -24 + +.LCFI0: + stw ra, 0(sp) + stw r4, 4(sp) + stw r5, 8(sp) + stw r6, 12(sp) + stw r7, 16(sp) + stw r8, 20(sp) + +.LCFI1: + /* __mcount_record(orig_ra, orig_r8, fn_entry, *fn_head); */ + mov r4, ra + mov r5, r8 + mov r6, r10 + mov r7, r11 + call __mcount_record + + /* restore registers from the stack */ + ldw ra, 0(sp) + ldw r4, 4(sp) + ldw r5, 8(sp) + ldw r6, 12(sp) + ldw r7, 16(sp) + ldw r8, 20(sp) + + addi sp, sp, 24 + +.LCFI2: + ret + +.Lfound_arc: + /* We've found the correct arc record. Increment the count and return */ + ldw r2, 8(r3) + addi r2, r2, 1 + stw r2, 8(r3) + ret + +.Lmcount_end: + + + +/* + * Dwarf2 debug information for the function. This provides GDB with the + * information it needs to backtrace out of this function. + */ + + .section .debug_frame,"",@progbits +.LCIE: + .4byte 2f - 1f /* Length */ +1: + .4byte 0xffffffff /* CIE id */ + .byte 0x1 /* Version */ + .string "" /* Augmentation */ + .uleb128 0x1 /* Code alignment factor */ + .sleb128 -4 /* Data alignment factor */ + .byte 0x1f /* Return address register */ + + .byte 0xc /* Define CFA */ + .uleb128 0x1b /* Register 27 (sp) */ + .uleb128 0x0 /* Offset 0 */ + + .align 2 /* Padding */ +2: + +.LFDE_mcount: + .4byte 2f - 1f /* Length */ +1: + .4byte .LCIE /* Pointer to CIE */ + .4byte mcount /* Start of table entry */ + .4byte .Lmcount_end - mcount /* Size of table entry */ + + .byte 0x4 /* Advance location */ + .4byte .LCFI0 - mcount /* to .LCFI0 */ + .byte 0xe /* Define CFA offset */ + .uleb128 24 /* to 24 */ + + .byte 0x4 /* Advance location */ + .4byte .LCFI1 - .LCFI0 /* to .LCFI1 */ + .byte 0x9f /* Store ra */ + .uleb128 0x6 /* at CFA-24 */ + .byte 0x84 /* Store r4 */ + .uleb128 0x5 /* at CFA-20 */ + .byte 0x85 /* Store r5 */ + .uleb128 0x4 /* at CFA-16 */ + .byte 0x86 /* Store r6 */ + .uleb128 0x3 /* at CFA-12 */ + .byte 0x87 /* Store r7 */ + .uleb128 0x2 /* at CFA-8 */ + .byte 0x88 /* Store r8 */ + .uleb128 0x1 /* at CFA-4 */ + + .byte 0x4 /* Advance location */ + .4byte .LCFI2 - .LCFI1 /* to .LCFI2 */ + .byte 0xe /* Define CFA offset */ + .uleb128 0 /* to 0 */ + .byte 0x8 /* Same value */ + .uleb128 31 /* for ra */ + .byte 0x8 /* Same value */ + .uleb128 4 /* for r4 */ + .byte 0x8 /* Same value */ + .uleb128 5 /* for r5 */ + .byte 0x8 /* Same value */ + .uleb128 6 /* for r6 */ + .byte 0x8 /* Same value */ + .uleb128 7 /* for r7 */ + .byte 0x8 /* Same value */ + .uleb128 8 /* for r8 */ + + .align 2 +2: + Index: components/sd_card/firmware/bsp/HAL/src/crt0.S =================================================================== --- components/sd_card/firmware/bsp/HAL/src/crt0.S (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/crt0.S (revision 8) @@ -0,0 +1,518 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2006 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +******************************************************************************/ + +#include "system.h" +#include "nios2.h" + +/* Setup header files to work with assembler code. */ +#define ALT_ASM_SRC + +/* Debug logging facility */ +#include "sys/alt_log_printf.h" + +/*************************************************************************\ +| MACROS | +\*************************************************************************/ + +/* + * The new build tools explicitly define macros when alt_load() + * must be called. The define ALT_LOAD_EXPLICITLY_CONTROLLED tells us that + * those macros are controlling if alt_load() needs to be called. + */ +#ifdef ALT_LOAD_EXPLICITLY_CONTROLLED + +/* Need to call alt_load() if any of these sections are being copied. */ +#if defined(ALT_LOAD_COPY_RODATA) || defined(ALT_LOAD_COPY_RWDATA) || defined(ALT_LOAD_COPY_EXCEPTIONS) +#define CALL_ALT_LOAD +#endif + +#else /* !ALT_LOAD_EXPLICITLY_CONTROLLED */ + +/* + * The legacy build tools use the following macros to detect when alt_load() + * needs to be called. + */ + +#define __ALT_LOAD_SECTIONS(res, text, rodata, exc) \ + ((res##_BASE != rodata##_BASE) || \ + (res##_BASE != rwdata##_BASE) || \ + (res##_BASE != exc##_BASE)) + +#define _ALT_LOAD_SECTIONS(res, text, rodata, exc) \ + __ALT_LOAD_SECTIONS(res, text, rodata, exc) + +#define ALT_LOAD_SECTIONS _ALT_LOAD_SECTIONS(ALT_RESET_DEVICE, \ + ALT_RODATA_DEVICE, \ + ALT_RWDATA_DEVICE, \ + ALT_EXCEPTIONS_DEVICE) + +/* Call alt_load() if there is no bootloader and ALT_LOAD_SECTIONS isn't 0. */ +#if defined(ALT_NO_BOOTLOADER) && ALT_LOAD_SECTIONS +#define CALL_ALT_LOAD +#endif + +#endif /* !ALT_LOAD_EXPLICITLY_CONTROLLED */ + +/* + * When the legacy build tools define a macro called ALT_NO_BOOTLOADER, + * it indicates that initialization code is allowed at the reset address. + * The new build tools define a macro called ALT_ALLOW_CODE_AT_RESET for + * the same purpose. + */ +#ifdef ALT_NO_BOOTLOADER +#define ALT_ALLOW_CODE_AT_RESET +#endif + +/*************************************************************************\ +| EXTERNAL REFERENCES | +\*************************************************************************/ + +/* + * The entry point for user code is either "main" in hosted mode, or + * "alt_main" in standalone mode. These are explicitly referenced here, + * to ensure they are built into the executable. This allows the user + * to build them into libraries, rather than supplying them in object + * files at link time. + */ + .globl main + .globl alt_main + +/* + * Create a reference to the software multiply/divide and trap handers, + * so that if they are provided, they will appear in the executable. + */ +#ifndef ALT_NO_INSTRUCTION_EMULATION + .globl alt_exception_muldiv +#endif +#ifdef ALT_TRAP_HANDLER + .globl alt_exception_trap +#endif + +/* + * Linker defined symbols used to initialize bss. + */ +.globl __bss_start +.globl __bss_end + +/*************************************************************************\ +| RESET SECTION (.entry) | +\*************************************************************************/ + +/* + * This is the reset entry point for Nios II. + * + * At reset, only the cache line which contain the reset vector is + * initialized by the hardware. The code within the first cache line + * initializes the remainder of the instruction cache. + */ + + .section .entry, "xa" + .align 5 + +/* + * Explicitly allow the use of r1 (the assembler temporary register) + * within this code. This register is normally reserved for the use of + * the assembler. + */ + .set noat + +/* + * Some tools want to know where the reset vector is. + * Code isn't always provided at the reset vector but at least the + * __reset label always contains the reset vector address because + * it is defined at the start of the .entry section. + */ + + .globl __reset + .type __reset, @function +__reset: + +/* + * Initialize the instruction cache if present (i.e. size > 0) and + * reset code is allowed unless optimizing for RTL simulation. + * RTL simulations can ensure the instruction cache is already initialized + * so skipping this loop speeds up RTL simulation. + */ + +#if NIOS2_ICACHE_SIZE > 0 && defined(ALT_ALLOW_CODE_AT_RESET) && !defined(ALT_SIM_OPTIMIZE) + /* Assume the instruction cache size is always a power of two. */ +#if NIOS2_ICACHE_SIZE > 0x8000 + movhi r2, %hi(NIOS2_ICACHE_SIZE) +#else + movui r2, NIOS2_ICACHE_SIZE +#endif + +0: + initi r2 + addi r2, r2, -NIOS2_ICACHE_LINE_SIZE + bgt r2, zero, 0b +1: + + /* + * The following debug information tells the ISS not to run the loop above + * but to perform its actions using faster internal code. + */ + .pushsection .debug_alt_sim_info + .int 1, 1, 0b, 1b + .popsection +#endif /* Initialize Instruction Cache */ + +/* + * Jump to the _start entry point in the .text section if reset code + * is allowed or if optimizing for RTL simulation. + */ +#if defined(ALT_ALLOW_CODE_AT_RESET) || defined(ALT_SIM_OPTIMIZE) + /* Jump to the _start entry point in the .text section. */ + movhi r1, %hi(_start) + ori r1, r1, %lo(_start) + jmp r1 + + .size __reset, . - __reset +#endif /* Jump to _start */ + +/* + * When not using exit, provide an _exit symbol to prevent unresolved + * references to _exit from the linker script. + */ +#ifdef ALT_NO_EXIT + .globl _exit +_exit: +#endif + +/*************************************************************************\ +| TEXT SECTION (.text) | +\*************************************************************************/ + +/* + * Start of the .text section, and also the code entry point when + * the code is executed by a bootloader rather than directly from reset. + */ + .section .text + .align 2 + + .globl _start + .type _start, @function +_start: + +#if (NIOS2_NUM_OF_SHADOW_REG_SETS > 0) + /* + * Ensure that the current register set is 0 upon + * entry to this code. Switch register set to 0 by + * writing zero to SSTATUS register and executing an ERET instruction + * to set STATUS.CRS to 0. + */ + + /* Get the current register set number (STATUS.CRS). */ + rdctl r2, status + andi r2, r2, NIOS2_STATUS_CRS_MSK + + /* Skip switching register set if STATUS.CRS is 0. */ + beq r2, zero, 0f + + /* Set SSTATUS to 0 to get to set SSTATUS.PRS to 0. */ + .set nobreak + movui sstatus, 0 + .set break + + /* Switch to register set 0 and jump to label. */ + movhi ea, %hi(0f) + ori ea, ea, %lo(0f) + eret + +0: +#endif /* NIOS2_NUM_OF_SHADOW_REG_SETS > 0 */ + +/* + * Initialize the data cache if present (i.e. size > 0). + * Skip initialization if optimizing for RTL simulation and ECC isn't present. + * RTL simulations can ensure the data cache tag RAM is already initialized + * (but not the data RAM for ECC) so skipping this speeds up RTL simulation. + * + * When ECC is present, need to execute initd for each word address + * to ensure ECC parity bits in data RAM get initialized. + * Otherwise, only need to execute initd for each line address. + */ + +#if NIOS2_DCACHE_SIZE > 0 && (!defined(ALT_SIM_OPTIMIZE) || defined(NIOS2_ECC_PRESENT)) + + /* Assume the data cache size is always a power of two. */ +#if NIOS2_DCACHE_SIZE > 0x8000 + movhi r2, %hi(NIOS2_DCACHE_SIZE) +#else + movui r2, NIOS2_DCACHE_SIZE +#endif + +0: + initd 0(r2) +#ifdef NIOS2_ECC_PRESENT + addi r2, r2, -4 +#else + addi r2, r2, -NIOS2_DCACHE_LINE_SIZE +#endif + bgt r2, zero, 0b +1: + + /* + * The following debug information tells the ISS not to run the loop above + * but to perform its actions using faster internal code. + */ + .pushsection .debug_alt_sim_info + .int 2, 1, 0b, 1b + .popsection +#endif /* Initialize Data Cache */ + + /* Log that caches have been initialized. */ + ALT_LOG_PUTS(alt_log_msg_cache) + + /* Log that the stack pointer is about to be setup. */ + ALT_LOG_PUTS(alt_log_msg_stackpointer) + + /* + * Now that the caches are initialized, set up the stack pointer and global pointer. + * The values provided by the linker are assumed to be correctly aligned. + */ + movhi sp, %hi(__alt_stack_pointer) + ori sp, sp, %lo(__alt_stack_pointer) + movhi gp, %hi(_gp) + ori gp, gp, %lo(_gp) + +#ifdef NIOS2_ECC_PRESENT + /* + * Initialize all general-purpose registers so that ECC can be enabled + * later without accidentally triggering a spurious ECC error. + */ + movui r1, 0 + movui r2, 0 + movui r3, 0 + movui r4, 0 + movui r5, 0 + movui r6, 0 + movui r7, 0 + movui r8, 0 + movui r9, 0 + movui r10, 0 + movui r11, 0 + movui r12, 0 + movui r13, 0 + movui r14, 0 + movui r15, 0 + movui r16, 0 + movui r17, 0 + movui r18, 0 + movui r19, 0 + movui r20, 0 + movui r21, 0 + movui r22, 0 + movui r23, 0 + /* Skip r24 (et) because only exception handler should write it. */ + /* Skip r25 (bt) because only debugger should write it. */ + /* Skip r26 (gp) because it is already been initialized. */ + /* Skip r27 (sp) because it is already been initialized. */ + movui r28, 0 /* fp */ + movui r29, 0 /* ea */ + .set nobreak + movui r30, 0 /* sstatus */ + .set break + movui r31, 0 /* ra */ + +#endif /* NIOS2_ECC_PRESENT */ + +#if (NIOS2_NUM_OF_SHADOW_REG_SETS > 0) + /* + * Setup registers in shadow register sets + * from 1 to NIOS2_NUM_OF_SHADOW_REG_SETS. + */ + + movui r2, 0 /* Contains value written into STATUS */ + movui r3, NIOS2_NUM_OF_SHADOW_REG_SETS /* counter */ + movhi r4, 1 /* Constant to increment STATUS.PRS */ + +.Linitialize_shadow_registers: + /* Increment STATUS.PRS */ + add r2, r2, r4 + wrctl status, r2 + + /* Clear r0 in the shadow register set (not done by hardware) */ + wrprs r0, r0 + + /* Write the GP in previous register set */ + wrprs gp, gp + + /* + * Only write the SP in previous register set + * if using the separate exception stack. For normal case (single stack), + * funnel code would read the SP from previous register set with a RDPRS. + */ +#ifdef ALT_INTERRUPT_STACK + movhi et, %hiadj(__alt_interrupt_stack_pointer) + addi et, et, %lo(__alt_interrupt_stack_pointer) + wrprs sp, et +#endif /* ALT_INTERRUPT_STACK */ + +#ifdef NIOS2_ECC_PRESENT + /* + * Initialize all general-purpose registers so that ECC can be enabled + * later without accidentally triggering a spurious ECC error. + */ + wrprs r1, r0 + wrprs r2, r0 + wrprs r3, r0 + wrprs r4, r0 + wrprs r5, r0 + wrprs r6, r0 + wrprs r7, r0 + wrprs r8, r0 + wrprs r9, r0 + wrprs r10, r0 + wrprs r11, r0 + wrprs r12, r0 + wrprs r13, r0 + wrprs r14, r0 + wrprs r15, r0 + wrprs r16, r0 + wrprs r17, r0 + wrprs r18, r0 + wrprs r19, r0 + wrprs r20, r0 + wrprs r21, r0 + wrprs r22, r0 + wrprs r23, r0 + /* Skip r24 (et) because only exception handler should write it. */ + /* Skip r25 (bt) because only debugger should write it. */ + /* Skip r26 (gp) because it is already been initialized. */ + /* Skip r27 (sp) because it was initialized above or will be by a rdprs if not above */ + wrprs r28, r0 /* fp */ + wrprs r29, r0 /* ea */ + wrprs r30, r0 /* ba */ + wrprs r31, r0 /* ra */ +#endif /* NIOS2_ECC_PRESENT */ + + /* Decrement shadow register set counter */ + addi r3, r3, -1 + + /* Done if index is 0. */ + bne r3, zero, .Linitialize_shadow_registers +#endif /* (NIOS2_NUM_OF_SHADOW_REG_SETS > 0) */ + +/* + * Clear the BSS if not optimizing for RTL simulation. + * + * This uses the symbols: __bss_start and __bss_end, which are defined + * by the linker script. They mark the begining and the end of the bss + * region. The linker script guarantees that these values are word aligned. + */ +#ifndef ALT_SIM_OPTIMIZE + /* Log that the BSS is about to be cleared. */ + ALT_LOG_PUTS(alt_log_msg_bss) + + movhi r2, %hi(__bss_start) + ori r2, r2, %lo(__bss_start) + + movhi r3, %hi(__bss_end) + ori r3, r3, %lo(__bss_end) + + beq r2, r3, 1f + +0: + stw zero, (r2) + addi r2, r2, 4 + bltu r2, r3, 0b + +1: + + /* + * The following debug information tells the ISS not to run the loop above + * but to perform its actions using faster internal code. + */ + .pushsection .debug_alt_sim_info + .int 3, 1, 0b, 1b + .popsection +#endif /* ALT_SIM_OPTIMIZE */ + +/* + * Turn off the use of r1 (the assembler temporary register) + * so that call instructions can be safely relaxed across a + * 256MB boundary if needed + */ + .set at + +/* + * The alt_load() facility is normally used when there is no bootloader. + * It copies some sections into RAM so it acts like a mini-bootloader. + */ +#ifdef CALL_ALT_LOAD + +#ifdef ALT_STACK_CHECK + /* + * If the user has selected stack checking then we need to set up a safe + * value in the stack limit register so that the relocation functions + * don't think the stack has overflowed (the contents of the rwdata + * section aren't defined until alt_load() has been called). + */ + mov et, zero +#endif + + call alt_load + +#endif /* CALL_ALT_LOAD */ + +#ifdef ALT_STACK_CHECK + /* + * Set up the stack limit (if required). The linker has set up the + * copy of the variable which is in memory. + */ + + ldw et, %gprel(alt_stack_limit_value)(gp) +#endif + + /* Log that alt_main is about to be called. */ + ALT_LOG_PUTS(alt_log_msg_alt_main) + + /* Call the C entry point. It should never return. */ + call alt_main + + /* Wait in infinite loop in case alt_main does return. */ +alt_after_alt_main: + br alt_after_alt_main + + .size _start, . - _start + +/* + * Add information about the stack base if stack overflow checking is enabled. + */ +#ifdef ALT_STACK_CHECK + .globl alt_stack_limit_value + .section .sdata,"aws",@progbits + .align 2 + .type alt_stack_limit_value, @object + .size alt_stack_limit_value, 4 +alt_stack_limit_value: + .long __alt_stack_limit +#endif Index: components/sd_card/firmware/bsp/HAL/src/alt_io_redirect.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_io_redirect.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_io_redirect.c (revision 8) @@ -0,0 +1,98 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include +#include +#include +#include + +#include "sys/alt_dev.h" +#include "priv/alt_file.h" + + +/* + * alt_open_fd() is similar to open() in that it is used to obtain a file + * descriptor for the file named "name". The "flags" and "mode" arguments are + * identical to the "flags" and "mode" arguments of open(). + * + * The distinction between the two functions is that the file descriptor + * structure to use is passed in as an argument, rather than allocated from the + * list of free file descriptors. + * + * This is used by alt_io_redirect() to redirect the stdin, stdout and stderr + * file descriptors to point to new devices. + * + * If the device can not be succesfully opened, then the input file descriptor + * remains unchanged. + */ + +static void alt_open_fd(alt_fd* fd, const char* name, int flags, int mode) +{ + int old; + + old = open (name, flags, mode); + + if (old >= 0) + { + fd->dev = alt_fd_list[old].dev; + fd->priv = alt_fd_list[old].priv; + fd->fd_flags = alt_fd_list[old].fd_flags; + + alt_release_fd (old); + } +} + +/* + * alt_io_redirect() is called once the device/filesystem lists have been + * initialised, but before main(). Its function is to redirect standard in, + * standard out and standard error so that they point to the devices selected by + * the user (as defined in system.h). + * + * Prior to the call to this function, io is directed towards /dev/null. If + * i/o can not be redirected to the requested device, for example if the device + * does not exist, then it remains directed at /dev/null. + */ + +void alt_io_redirect(const char* stdout_dev, + const char* stdin_dev, + const char* stderr_dev) +{ + /* Redirect the channels */ + + alt_open_fd (&alt_fd_list[STDOUT_FILENO], stdout_dev, O_WRONLY, 0777); + alt_open_fd (&alt_fd_list[STDIN_FILENO], stdin_dev, O_RDONLY, 0777); + alt_open_fd (&alt_fd_list[STDERR_FILENO], stderr_dev, O_WRONLY, 0777); +} + + + + Index: components/sd_card/firmware/bsp/HAL/src/alt_remap_cached.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_remap_cached.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_remap_cached.c (revision 8) @@ -0,0 +1,50 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2003,2007 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +******************************************************************************/ + +#include "sys/alt_cache.h" +#include "system.h" + +#ifdef NIOS2_MMU_PRESENT +/* Convert KERNEL region address to IO region address */ +#define BYPASS_DCACHE_MASK (0x1 << 29) +#else +/* Set bit 31 of address to bypass D-cache */ +#define BYPASS_DCACHE_MASK (0x1 << 31) +#endif + +/* + * Convert a pointer to a block of uncached memory, into a block of + * cached memory. + */ + +void* alt_remap_cached (volatile void* ptr, alt_u32 len) +{ + return (void*) (((alt_u32) ptr) & ~BYPASS_DCACHE_MASK); +} Index: components/sd_card/firmware/bsp/HAL/src/alt_remap_uncached.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_remap_uncached.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_remap_uncached.c (revision 8) @@ -0,0 +1,51 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2003,2007 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +******************************************************************************/ + +#include "sys/alt_cache.h" +#include "system.h" + +#ifdef NIOS2_MMU_PRESENT +/* Convert KERNEL region address to IO region address */ +#define BYPASS_DCACHE_MASK (0x1 << 29) +#else +/* Set bit 31 of address to bypass D-cache */ +#define BYPASS_DCACHE_MASK (0x1 << 31) +#endif + +/* + * Convert a pointer to a block of cached memory, into a block of + * uncached memory. + */ + +volatile void* alt_remap_uncached (void* ptr, alt_u32 len) +{ + alt_dcache_flush (ptr, len); + return (volatile void*) (((alt_u32) ptr) | BYPASS_DCACHE_MASK); +} Index: components/sd_card/firmware/bsp/HAL/src/alt_env_lock.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_env_lock.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_env_lock.c (revision 8) @@ -0,0 +1,53 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include + +/* + * These are the empty env lock/unlock stubs required by newlib. These are + * used to make accesses to environment variables thread safe. The default HAL + * configuration is single threaded, so there is nothing to do here. Note that + * this requires that environment variables are never manipulated by an interrupt + * service routine. + */ + +void __env_lock ( struct _reent *_r ) +{ +} + +/* + * + */ + +void __env_unlock ( struct _reent *_r ) +{ +} Index: components/sd_card/firmware/bsp/HAL/src/alt_iic.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_iic.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_iic.c (revision 8) @@ -0,0 +1,106 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2009 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +******************************************************************************/ +#include "system.h" + +/* + * This file implements the HAL Enhanced interrupt API for Nios II processors + * with an internal interrupt controller (IIC). For most routines, this serves + * as a wrapper layer over the legacy interrupt API (which must be used with + * the IIC only). + * + * Use of the enhanced API is recommended so that application and device + * drivers are compatible with a Nios II system configured with an external + * interrupt controller (EIC), or IIC. This will afford maximum portability. + * + * If an EIC is present, the EIC device driver must provide these routines, + * because their operation will be specific to that EIC type. + */ +#ifndef NIOS2_EIC_PRESENT +#ifdef ALT_ENHANCED_INTERRUPT_API_PRESENT + +#include "sys/alt_irq.h" +#include "priv/alt_iic_isr_register.h" +#include "priv/alt_legacy_irq.h" + +/** @Function Description: This function registers an interrupt handler. + * If the function is succesful, then the requested interrupt will be enabled upon + * return. Registering a NULL handler will disable the interrupt. + * @API Type: External + * @param ic_id Ignored. + * @param irq IRQ number + * @return 0 if successful, else error (-1) + */ +int alt_ic_isr_register(alt_u32 ic_id, alt_u32 irq, alt_isr_func isr, + void *isr_context, void *flags) +{ + return alt_iic_isr_register(ic_id, irq, isr, isr_context, flags); +} + +/** @Function Description: This function enables a single interrupt. + * @API Type: External + * @param ic_id Ignored. + * @param irq IRQ number + * @return 0 if successful, else error (-1) + */ +int alt_ic_irq_enable (alt_u32 ic_id, alt_u32 irq) +{ + return alt_irq_enable(irq); +} + +/** @Function Description: This function disables a single interrupt. + * @API Type: External + * @param ic_id Ignored. + * @param irq IRQ number + * @return 0 if successful, else error (-1) + */ +int alt_ic_irq_disable(alt_u32 ic_id, alt_u32 irq) +{ + return alt_irq_disable(irq); +} + +/** @Function Description: This function to determine if corresponding + * interrupt is enabled. + * @API Type: External + * @param ic_id Ignored. + * @param irq IRQ number + * @return Zero if corresponding interrupt is disabled and + * non-zero otherwise. + */ +alt_u32 alt_ic_irq_enabled(alt_u32 ic_id, alt_u32 irq) +{ + alt_u32 irq_enabled; + + NIOS2_READ_IENABLE(irq_enabled); + + return (irq_enabled & (1 << irq)) ? 1: 0; +} + +#endif /* ALT_ENHANCED_INTERRUPT_API_PRESENT */ +#endif /* NIOS2_EIC_PRESENT */ Index: components/sd_card/firmware/bsp/HAL/src/alt_icache_flush_all.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_icache_flush_all.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_icache_flush_all.c (revision 8) @@ -0,0 +1,46 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2003 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +******************************************************************************/ + +#include "nios2.h" +#include "system.h" + +#include "alt_types.h" +#include "sys/alt_cache.h" + +/* + * alt_icache_flush_all() is called to flush the entire instruction cache. + */ + +void alt_icache_flush_all (void) +{ +#if NIOS2_ICACHE_SIZE > 0 + alt_icache_flush (0, NIOS2_ICACHE_SIZE); +#endif +} Index: components/sd_card/firmware/bsp/HAL/src/alt_rename.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_rename.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_rename.c (revision 8) @@ -0,0 +1,55 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include "sys/alt_errno.h" +#include "sys/alt_warning.h" +#include "os/alt_syscall.h" + +/* + * _rename() is used by newlib to rename an existing file. This is unsupported + * in the HAL environment. However a "do-nothing" implementation is still + * provied for newlib compatability. + * + * ALT_RENAME is mapped onto the _rename() system call in alt_syscall.h + */ + +int ALT_RENAME (char *existing, char *new) +{ + /* Generate a link time warning, should this function ever be called. */ + + ALT_STUB_WARNING(_rename); + + /* Indicate an error */ + + ALT_ERRNO = ENOSYS; + return -1; +} Index: components/sd_card/firmware/bsp/HAL/src/alt_dev_llist_insert.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_dev_llist_insert.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_dev_llist_insert.c (revision 8) @@ -0,0 +1,59 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include "priv/alt_dev_llist.h" +#include "sys/alt_errno.h" + +/* + * + */ + +int alt_dev_llist_insert (alt_dev_llist* dev, alt_llist* list) +{ + /* + * check that the device exists, and that it has a valid name. + */ + + if (!dev || !dev->name) + { + ALT_ERRNO = EINVAL; + return -EINVAL; + } + + /* + * register the device. + */ + + alt_llist_insert(list, &dev->llist); + + return 0; +} Index: components/sd_card/firmware/bsp/HAL/src/alt_busy_sleep.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_busy_sleep.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_busy_sleep.c (revision 8) @@ -0,0 +1,133 @@ +/* + * Copyright (c) 2003-2004 Altera Corporation, San Jose, California, USA. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * ------------ + * + * Altera does not recommend, suggest or require that this reference design + * file be used in conjunction or combination with any other product. + * + * alt_busy_sleep.c - Microsecond delay routine which uses a calibrated busy + * loop to perform the delay. This is used to implement + * usleep for both uC/OS-II and the standalone HAL. + * + * Author PRR + * + * Calibrated delay with no timer required + * + * The ASM instructions in the routine are equivalent to + * + * for (i=0;i +#include + +#include "system.h" +#include "alt_types.h" + +#include "priv/alt_busy_sleep.h" + +unsigned int alt_busy_sleep (unsigned int us) +{ +/* + * Only delay if ALT_SIM_OPTIMIZE is not defined; i.e., if software + * is built targetting ModelSim RTL simulation, the delay will be + * skipped to speed up simulation. + */ +#ifndef ALT_SIM_OPTIMIZE + int i; + int big_loops; + alt_u32 cycles_per_loop; + + if (!strcmp(NIOS2_CPU_IMPLEMENTATION,"tiny")) + { + cycles_per_loop = 9; + } + else + { + cycles_per_loop = 3; + } + + + big_loops = us / (INT_MAX/ + (ALT_CPU_FREQ/(cycles_per_loop * 1000000))); + + if (big_loops) + { + for(i=0;i 0 + + char* i; + char* end; + + /* + * This is the most we would ever need to flush. + */ + + if (len > NIOS2_ICACHE_SIZE) + { + len = NIOS2_ICACHE_SIZE; + } + + end = ((char*) start) + len; + + for (i = start; i < end; i+= NIOS2_ICACHE_LINE_SIZE) + { + __asm__ volatile ("flushi %0" :: "r" (i)); + } + + /* + * For an unaligned flush request, we've got one more line left. + * Note that this is dependent on NIOS2_ICACHE_LINE_SIZE to be a + * multiple of 2 (which it always is). + */ + + if (((alt_u32) start) & (NIOS2_ICACHE_LINE_SIZE - 1)) + { + __asm__ volatile ("flushi %0" :: "r" (i)); + } + + /* + * Having flushed the cache, flush any stale instructions in the + * pipeline + */ + + __asm__ volatile ("flushp"); + +#endif /* NIOS2_ICACHE_SIZE > 0 */ +} Index: components/sd_card/firmware/bsp/HAL/src/alt_ecc_fatal_exception.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_ecc_fatal_exception.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_ecc_fatal_exception.c (revision 8) @@ -0,0 +1,73 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2013 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ +#include "io.h" +#include "sys/alt_exceptions.h" + +/* + * This file implements support for calling a user-registered handler + * when a likely fatal ECC error exception occurs. + */ + +/* + * Global variable containing address to jump to when likely fatal + * ECC error exception occurs. + */ +alt_u32 alt_exception_ecc_fatal_handler = 0x0; + +/* + * Pull in the exception entry assembly code. This will not be linked in + * unless this object is linked into the executable (i.e. only if + * alt_ecc_fatal_exception_register() is called). + */ +__asm__( "\n\t.globl alt_exception" ); + +/* + * alt_ecc_fatal_exception_register() is called to register a handler to + * service likely fatal ECC error exceptions. + * + * Passing null (0x0) in the handler argument will disable a previously- + * registered handler. + * + * Note that if no handler is registered, just normal exception processing + * occurs on a likely fatal ECC exception and the exception processing + * code might trigger an infinite exception loop. + */ +void +alt_ecc_fatal_exception_register(alt_u32 handler) +{ + /* + * Use IOWR to make sure this bypasses the data cache. + * This is required because the exception handler uses ldwio + * to read this value. + */ + IOWR(&alt_exception_ecc_fatal_handler, 0, handler); +} Index: components/sd_card/firmware/bsp/HAL/src/alt_fstat.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_fstat.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_fstat.c (revision 8) @@ -0,0 +1,128 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2006 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include +#include + +#include "sys/alt_dev.h" +#include "sys/alt_warning.h" +#include "sys/alt_errno.h" +#include "priv/alt_file.h" +#include "os/alt_syscall.h" + +/* + * The fstat() system call is used to obtain information about the capabilities + * of an open file descriptor. By default file descriptors are marked as + * being character devices. If a device or file system wishes to advertise + * alternative capabilities then they can register an fstat() function within + * their associated alt_dev structure. This will be called to fill in the + * entries in the imput "st" structure. + * + * This function is provided for compatability with newlib. + * + * ALT_FSTAT is mapped onto the fstat() system call in alt_syscall.h + */ + +#ifdef ALT_USE_DIRECT_DRIVERS + +#include "system.h" + +/* + * Provide minimal version that just describes all file descriptors + * as character devices for provided stdio devices. + */ +int ALT_FSTAT (int file, struct stat *st) +{ + switch (file) { +#ifdef ALT_STDIN_PRESENT + case 0: /* stdin file descriptor */ +#endif /* ALT_STDIN_PRESENT */ +#ifdef ALT_STDOUT_PRESENT + case 1: /* stdout file descriptor */ +#endif /* ALT_STDOUT_PRESENT */ +#ifdef ALT_STDERR_PRESENT + case 2: /* stderr file descriptor */ +#endif /* ALT_STDERR_PRESENT */ + st->st_mode = _IFCHR; + return 0; + default: + return -1; + } + +#if !defined(ALT_STDIN_PRESENT) && !defined(ALT_STDOUT_PRESENT) && !defined(ALT_STDERR_PRESENT) + /* Generate a link time warning, should this function ever be called. */ + ALT_STUB_WARNING(fstat); +#endif +} + +#else /* !ALT_USE_DIRECT_DRIVERS */ + +int ALT_FSTAT (int file, struct stat *st) +{ + alt_fd* fd; + + /* + * A common error case is that when the file descriptor was created, the call + * to open() failed resulting in a negative file descriptor. This is trapped + * below so that we don't try and process an invalid file descriptor. + */ + + fd = (file < 0) ? NULL : &alt_fd_list[file]; + + if (fd) + { + /* Call the drivers fstat() function to fill out the "st" structure. */ + + if (fd->dev->fstat) + { + return fd->dev->fstat(fd, st); + } + + /* + * If no function is provided, mark the fd as belonging to a character + * device. + */ + + else + { + st->st_mode = _IFCHR; + return 0; + } + } + else + { + ALT_ERRNO = EBADFD; + return -1; + } +} + +#endif /* ALT_USE_DIRECT_DRIVERS */ Index: components/sd_card/firmware/bsp/HAL/src/alt_times.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_times.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_times.c (revision 8) @@ -0,0 +1,71 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include + +#include "sys/alt_errno.h" +#include "sys/alt_alarm.h" +#include "os/alt_syscall.h" + +/* + * The times() function is used by newlib to obtain elapsed time information. + * The return value is the elapsed time since reset in system clock ticks. Note + * that this is distinct from the strict Posix version of times(), which should + * return the time since: 0 hours, 0 minutes, 0 seconds, January 1, 1970, GMT. + * + * The input structure is filled in with time accounting information. This + * implementation attributes all cpu time to the system. + * + * ALT_TIMES is mapped onto the times() system call in alt_syscall.h + */ + +clock_t ALT_TIMES (struct tms *buf) +{ + clock_t ticks = alt_nticks(); + + /* If there is no system clock present, generate an error */ + + if (!alt_ticks_per_second()) + { + ALT_ERRNO = ENOSYS; + return 0; + } + + /* Otherwise return the elapsed time */ + + buf->tms_utime = 0; + buf->tms_stime = ticks; + buf->tms_cutime = 0; + buf->tms_cstime = 0; + + return ticks; +} Index: components/sd_card/firmware/bsp/HAL/src/alt_irq_vars.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_irq_vars.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_irq_vars.c (revision 8) @@ -0,0 +1,47 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2003 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +******************************************************************************/ + +#include "alt_types.h" + +#include "system.h" + +/* + * These global variables are used to save the current list of enabled + * interrupts. See alt_irq.h for further details. + */ + +volatile alt_u32 alt_irq_active = 0; + +#ifndef ALT_EXCEPTION_STACK + +volatile alt_u32 alt_priority_mask = (alt_u32) -1; + +#endif + Index: components/sd_card/firmware/bsp/HAL/src/alt_write.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_write.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_write.c (revision 8) @@ -0,0 +1,138 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2006 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include +#include + +#include "sys/alt_errno.h" +#include "sys/alt_warning.h" +#include "priv/alt_file.h" +#include "os/alt_syscall.h" + +#include "sys/alt_log_printf.h" + +/* + * The write() system call is used to write a block of data to a file or + * device. This function simply vectors the request to the device driver + * associated with the input file descriptor "file". + * + * ALT_WRITE is mapped onto the write() system call in alt_syscall.h + */ + +#ifdef ALT_USE_DIRECT_DRIVERS + +#include "system.h" +#include "sys/alt_driver.h" + +/* + * Provide minimal version that just writes to the stdout/stderr devices + * when provided. + */ + +int ALT_WRITE (int file, const void *ptr, size_t len) +{ +#ifdef ALT_STDOUT_PRESENT + ALT_DRIVER_WRITE_EXTERNS(ALT_STDOUT_DEV); +#endif +#ifdef ALT_STDERR_PRESENT + ALT_DRIVER_WRITE_EXTERNS(ALT_STDERR_DEV); +#endif + +#if !defined(ALT_STDOUT_PRESENT) && !defined(ALT_STDERR_PRESENT) + /* Generate a link time warning, should this function ever be called. */ + ALT_STUB_WARNING(write); +#endif + + switch (file) { +#ifdef ALT_STDOUT_PRESENT + case 1: /* stdout file descriptor */ + return ALT_DRIVER_WRITE(ALT_STDOUT_DEV, ptr, len, 0); +#endif /* ALT_STDOUT_PRESENT */ +#ifdef ALT_STDERR_PRESENT + case 2: /* stderr file descriptor */ + return ALT_DRIVER_WRITE(ALT_STDERR_DEV, ptr, len, 0); +#endif /* ALT_STDERR_PRESENT */ + default: + ALT_ERRNO = EBADFD; + return -1; + } +} + +#else /* !ALT_USE_DIRECT_DRIVERS */ + +int ALT_WRITE (int file, const void *ptr, size_t len) +{ + alt_fd* fd; + int rval; + + /* + * A common error case is that when the file descriptor was created, the call + * to open() failed resulting in a negative file descriptor. This is trapped + * below so that we don't try and process an invalid file descriptor. + */ + + fd = (file < 0) ? NULL : &alt_fd_list[file]; + + if (fd) + { + /* + * If the file has not been opened with write access, or if the driver does + * not provide an implementation of write(), generate an error. Otherwise + * call the drivers write() function to process the request. + */ + + if (((fd->fd_flags & O_ACCMODE) != O_RDONLY) && fd->dev->write) + { + + /* ALT_LOG - see altera_hal/HAL/inc/sys/alt_log_printf.h */ + ALT_LOG_WRITE_FUNCTION(ptr,len); + + if ((rval = fd->dev->write(fd, ptr, len)) < 0) + { + ALT_ERRNO = -rval; + return -1; + } + return rval; + } + else + { + ALT_ERRNO = EACCES; + } + } + else + { + ALT_ERRNO = EBADFD; + } + return -1; +} + +#endif /* ALT_USE_DIRECT_DRIVERS */ Index: components/sd_card/firmware/bsp/HAL/src/alt_irq_entry.S =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_irq_entry.S (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_irq_entry.S (revision 8) @@ -0,0 +1,108 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2003-2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +******************************************************************************/ + +#include "system.h" + +/* + * This is the interrupt exception entry point code, which saves all the + * registers and calls the interrupt handler. It should be pulled in using + * a .globl from alt_irq_register.c. This scheme is used so that if an + * interrupt is never registered, then this code will not appear in the + * generated executable, thereby improving code footprint. + */ + + /* + * Explicitly allow the use of r1 (the assembler temporary register) + * within this code. This register is normally reserved for the use of + * the compiler. + */ + .set noat + + /* + * Pull in the exception handler register save code. + */ + .globl alt_exception + + .globl alt_irq_entry + .section .exceptions.entry.label, "xa" +alt_irq_entry: + + /* + * Section .exceptions.entry is in alt_exception_entry.S + * This saves all the caller saved registers and reads estatus into r5 + */ + + .section .exceptions.irqtest, "xa" + +#ifdef ALT_CI_INTERRUPT_VECTOR_N + /* + * Use the interrupt vector custom instruction if present to accelerate + * this code. + * If the interrupt vector custom instruction returns a negative + * value, there are no interrupts active (estatus.pie is 0 + * or ipending is 0) so assume it is a software exception. + */ + custom ALT_CI_INTERRUPT_VECTOR_N, r4, r0, r0 + blt r4, r0, .Lnot_irq +#else + /* + * Test to see if the exception was a software exception or caused + * by an external interrupt, and vector accordingly. + */ + rdctl r4, ipending + andi r2, r5, 1 + beq r2, zero, .Lnot_irq + beq r4, zero, .Lnot_irq +#endif /* ALT_CI_INTERRUPT_VECTOR_N */ + + .section .exceptions.irqhandler, "xa" + /* + * Now that all necessary registers have been preserved, call + * alt_irq_handler() to process the interrupts. + */ + + call alt_irq_handler + + .section .exceptions.irqreturn, "xa" + + br .Lexception_exit + + .section .exceptions.notirq.label, "xa" + +.Lnot_irq: + + /* + * Section .exceptions.exit is in alt_exception_entry.S + * This restores all the caller saved registers + */ + + .section .exceptions.exit.label +.Lexception_exit: + Index: components/sd_card/firmware/bsp/HAL/src/alt_exception_entry.S =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_exception_entry.S (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_exception_entry.S (revision 8) @@ -0,0 +1,367 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2003-2008 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +******************************************************************************/ + +#include "system.h" + +/* + * This is the exception entry point code, which saves all the caller saved + * registers and then handles the appropriate exception. It should be pulled + * in using a .globl from all the exception handler routines. This scheme is + * used so that if an interrupt is never registered, then this code will not + * appear in the generated executable, thereby improving code footprint. + * + * If an external interrpt controller (EIC) is present, it will supply an + * interrupt vector address to the processor when an interrupt occurs. For + * The Altera Vectored Interrupt Controller (VIC) driver will establish a + * vector table and the processor will jump directly to the appropriate + * table entry, funnel routine, and then user ISR. This will bypass this code + * in entirety. This code might still be linked into a system with an EIC, + * but would then be used only for non-interrupt exceptions. + */ + + /* + * Explicitly allow the use of r1 (the assembler temporary register) + * within this code. This register is normally reserved for the use of + * the assembler. + */ + .set noat + + /* + * The top and bottom of the exception stack. + */ +#ifdef ALT_EXCEPTION_STACK + .globl __alt_exception_stack_pointer + +#ifdef ALT_STACK_CHECK + .globl __alt_exception_stack_limit + + /* + * Store the value of the stack limit after interrupt somewhere. + */ + .globl alt_exception_old_stack_limit +#endif /* ALT_STACK_CHECK */ +#endif /* ALT_EXCEPTION_STACK */ + +/* + * The code at alt_exception is located at the Nios II exception + * handler address. + */ + .section .exceptions.entry.label, "xa" + .globl alt_exception + .type alt_exception, @function +alt_exception: + + /* + * The code for detecting a likely fatal ECC exception is + * linked here before the normal exception handler code if required. + * This is handled by the linker script and putting that code + * in the .exceptions.entry.ecc_fatal section. + */ + + /* + * Now start the normal exception handler code. + */ + .section .exceptions.entry, "xa" + +#ifdef ALT_EXCEPTION_STACK +#ifdef ALT_STACK_CHECK + /* + * When runtime stack checking is enabled, the et register + * contains the stack limit. Save this in memory before + * overwriting the et register. + */ + stw et, %gprel(alt_exception_old_stack_limit)(gp) +#endif /* ALT_STACK_CHECK */ + + /* + * Switch to the exception stack and save the current stack pointer + * in memory. Uses the et register as a scratch register. + */ + movhi et, %hi(__alt_exception_stack_pointer - 80) + ori et, et, %lo(__alt_exception_stack_pointer - 80) + stw sp, 76(et) + mov sp, et + +#ifdef ALT_STACK_CHECK + /* + * Restore the stack limit from memory to the et register. + */ + movhi et, %hi(__alt_exception_stack_limit) + ori et, et, %lo(__alt_exception_stack_limit) + stw et, %gprel(alt_stack_limit_value)(gp) +#endif /* ALT_STACK_CHECK */ + +#else /* ALT_EXCEPTION_STACK disabled */ + /* + * Reserve space on normal stack for registers about to be pushed. + */ + addi sp, sp, -76 + +#ifdef ALT_STACK_CHECK + /* Ensure stack didn't just overflow. */ + bltu sp, et, .Lstack_overflow +#endif /* ALT_STACK_CHECK */ + +#endif /* ALT_EXCEPTION_STACK */ + + /* + * Process an exception. For all exceptions we must preserve all + * caller saved registers on the stack (See the Nios II ABI + * documentation for details). + * + * Leave a gap in the stack frame at 4(sp) for the muldiv handler to + * store zero into. + */ + stw ra, 0(sp) + stw r1, 8(sp) + stw r2, 12(sp) + stw r3, 16(sp) + stw r4, 20(sp) + stw r5, 24(sp) + stw r6, 28(sp) + stw r7, 32(sp) + rdctl r5, estatus /* Read early to avoid usage stall */ + stw r8, 36(sp) + stw r9, 40(sp) + stw r10, 44(sp) + stw r11, 48(sp) + stw r12, 52(sp) + stw r13, 56(sp) + stw r14, 60(sp) + stw r15, 64(sp) + + /* + * ea-4 contains the address of the instruction being executed + * when the exception occured. For interrupt exceptions, we will + * will be re-issue the isntruction. Store it in 72(sp) + */ + stw r5, 68(sp) /* estatus */ + addi r15, ea, -4 /* instruction that caused exception */ + stw r15, 72(sp) + + /* + * The interrupt testing code (.exceptions.irqtest) will be + * linked here. If the Internal Interrupt Controller (IIC) is + * present (an EIC is not present), the presense of an interrupt + * is determined by examining CPU control registers or an interrupt + * custom instruction, if present. + * + * If the IIC is used and an interrupt is active, the code linked + * here will call the HAL IRQ handler (alt_irq_handler()) which + * successively calls registered interrupt handler(s) until no + * interrupts remain pending. It then jumps to .exceptions.exit. If + * there is no interrupt then it continues to .exception.notirq, below. + */ + + .section .exceptions.notirq, "xa" + + /* + * Prepare to service unimplemtned instructions or traps, + * each of which is optionally inked into section .exceptions.soft, + * which will preceed .exceptions.unknown below. + * + * Unlike interrupts, we want to skip the exception-causing instructon + * upon completion, so we write ea (address of instruction *after* + * the one where the exception occured) into 72(sp). The actual + * instruction that caused the exception is written in r2, which these + * handlers will utilize. + */ + stw ea, 72(sp) /* Don't re-issue */ + ldw r2, -4(ea) /* Instruction that caused exception */ + + /* + * Other exception handling code, if enabled, will be linked here. + * This includes unimplemted (multiply/divide) instruction support + * (a BSP generaton option), and a trap handler (that would typically + * be augmented with user-specific code). These are not linked in by + * default. + */ + + /* + * In the context of linker sections, "unknown" are all exceptions + * not handled by the built-in handlers above (interupt, and trap or + * unimplemented instruction decoding, if enabled). + * + * Advanced exception types can be serviced by registering a handler. + * To do so, enable the "Enable Instruction-related Exception API" HAL + * BSP setting. If this setting is disabled, this handler code will + * either break (if the debug core is present) or enter an infinite + * loop because we don't how how to handle the exception. + */ + .section .exceptions.unknown +#ifdef ALT_INCLUDE_INSTRUCTION_RELATED_EXCEPTION_API + /* + * The C-based HAL routine alt_instruction_exception_entry() will + * attempt to service the exception by calling a user-registered + * exception handler using alt_instruction_exception_register(). + * If no handler was registered it will either break (if the + * debugger is present) or go into an infinite loop since the + * handling behavior is undefined; in that case we will not return here. + */ + + /* Load exception-causing address as first argument (r4) */ + addi r4, ea, -4 + + /* Call the instruction-exception entry */ + call alt_instruction_exception_entry + + /* + * If alt_instruction_exception_entry() returned, the exception was + * serviced by a user-registered routine. Its return code (now in r2) + * indicates whether to re-issue or skip the exception-causing + * instruction + * + * Return code was 0: Skip. The instruction after the exception is + * already stored in 72(sp). + */ + bne r2, r0, .Lexception_exit + + /* + * Otherwise, modify 72(sp) to re-issue the instruction that caused the + * exception. + */ + addi r15, ea, -4 /* instruction that caused exception */ + stw r15, 72(sp) + +#else /* ALT_INCLUDE_INSTRUCTION_RELATED_EXCEPTION_API disabled */ + + /* + * We got here because an instruction-related exception occured, but the + * handler API was not compiled in. We do not presume to know how to + * handle it. If the debugger is present, break, otherwise hang. + * + * If you get here then one of the following could have happened: + * + * - An instruction-generated exception occured, and the processor + * does not have the extra exceptions feature enabled, or you + * have not registered a handler using + * alt_instruction_exception_register() + * + * Some examples of instruction-generated exceptions and why they + * might occur: + * + * - Your program could have been compiled for a full-featured + * Nios II core, but it is running on a smaller core, and + * instruction emulation has been disabled by defining + * ALT_NO_INSTRUCTION_EMULATION. + * + * You can work around the problem by re-enabling instruction + * emulation, or you can figure out why your program is being + * compiled for a system other than the one that it is running on. + * + * - Your program has executed a trap instruction, but has not + * implemented a handler for this instruction. + * + * - Your program has executed an illegal instruction (one which is + * not defined in the instruction set). + * + * - Your processor includes an MMU or MPU, and you have enabled it + * before registering an exception handler to service exceptions it + * generates. + * + * The problem could also be hardware related: + * - If your hardware is broken and is generating spurious interrupts + * (a peripheral which negates its interrupt output before its + * interrupt handler has been executed will cause spurious + * interrupts) + */ +alt_exception_unknown: +#ifdef NIOS2_HAS_DEBUG_STUB + /* + * Either tell the user now (if there is a debugger attached) or go into + * the debug monitor which will loop until a debugger is attached. + */ + break +#else /* NIOS2_HAS_DEBUG_STUB disabled */ + /* + * If there is no debug stub, an infinite loop is more useful. + */ + br alt_exception_unknown +#endif /* NIOS2_HAS_DEBUG_STUB */ +#endif /* ALT_INCLUDE_INSTRUCTION_RELATED_EXCEPTION_API */ + + .section .exceptions.exit.label +.Lexception_exit: + + .section .exceptions.exit, "xa" + + /* + * Restore the saved registers, so that all general purpose registers + * have been restored to their state at the time the interrupt occured. + */ + + ldw r5, 68(sp) + ldw ea, 72(sp) /* This becomes the PC once eret is executed */ + ldw ra, 0(sp) + + wrctl estatus, r5 + + ldw r1, 8(sp) + ldw r2, 12(sp) + ldw r3, 16(sp) + ldw r4, 20(sp) + ldw r5, 24(sp) + ldw r6, 28(sp) + ldw r7, 32(sp) + +#if defined(ALT_EXCEPTION_STACK) && defined(ALT_STACK_CHECK) + ldw et, %gprel(alt_exception_old_stack_limit)(gp) +#endif + + ldw r8, 36(sp) + ldw r9, 40(sp) + ldw r10, 44(sp) + ldw r11, 48(sp) + ldw r12, 52(sp) + ldw r13, 56(sp) + ldw r14, 60(sp) + ldw r15, 64(sp) + +#ifdef ALT_EXCEPTION_STACK +#ifdef ALT_STACK_CHECK + stw et, %gprel(alt_stack_limit_value)(gp) + stw zero, %gprel(alt_exception_old_stack_limit)(gp) +#endif /* ALT_STACK_CHECK */ + ldw sp, 76(sp) +#else /* ALT_EXCEPTION_STACK disabled */ + addi sp, sp, 76 +#endif /* ALT_EXCEPTION_STACK */ + + /* + * Return to the interrupted instruction. + */ + + eret + +#ifdef ALT_STACK_CHECK +.Lstack_overflow: + break 3 +#endif /* ALT_STACK_CHECK */ + Index: components/sd_card/firmware/bsp/HAL/src/alt_unlink.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_unlink.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_unlink.c (revision 8) @@ -0,0 +1,55 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include "sys/alt_errno.h" +#include "sys/alt_warning.h" +#include "os/alt_syscall.h" + +/* + * unlink() is used by newlib to delete an existing link to a file. This is + * unsupported in the HAL environment. However a "do-nothing" implementation + * is still provied for newlib compatability. + * + * ALT_UNLINK is mapped onto the unlink() system call in alt_syscall.h + */ + +int ALT_UNLINK (char *name) +{ + /* Generate a link time warning, should this function ever be called. */ + + ALT_STUB_WARNING(unlink); + + /* Indicate an error */ + + ALT_ERRNO = ENOSYS; + return -1; +} Index: components/sd_card/firmware/bsp/HAL/src/alt_putstr.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_putstr.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_putstr.c (revision 8) @@ -0,0 +1,55 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2006 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include + +#ifdef ALT_USE_DIRECT_DRIVERS +#include +#include "system.h" +#include "sys/alt_driver.h" +#include "sys/alt_stdio.h" +#endif + +/* + * Uses the ALT_DRIVER_WRITE() macro to call directly to driver if available. + * Otherwise, uses newlib provided fputs() routine. + */ +int +alt_putstr(const char* str) +{ +#ifdef ALT_USE_DIRECT_DRIVERS + ALT_DRIVER_WRITE_EXTERNS(ALT_STDOUT_DEV); + return ALT_DRIVER_WRITE(ALT_STDOUT_DEV, str, strlen(str), 0); +#else + return fputs(str, stdout); +#endif +} Index: components/sd_card/firmware/bsp/HAL/src/alt_fd_lock.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_fd_lock.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_fd_lock.c (revision 8) @@ -0,0 +1,75 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include + +#include "priv/alt_file.h" + +/* + * alt_fd_lock() is called as a consequence of an ioctl call to gain exclusive + * access to a device, i.e.: + * + * ioctl (fd, TIOCEXCL, NULL); + * + * If there are no other open file descriptors which reference the same + * device, then alt_fd_lock() will grant the lock. Further calls to open() + * for this device will fail until the lock is released. + * + * This is done by calling close() for this file descriptor, or by calling: + * + * ioctl (fd, TIOCNXCL, NULL); + * + * The return value is zero for success, or negative in the case of failure. + */ + +int alt_fd_lock (alt_fd* fd) +{ + int i; + int rc = 0; + + ALT_SEM_PEND(alt_fd_list_lock, 0); + + for (i = 0; i < alt_max_fd; i++) + { + if ((&alt_fd_list[i] != fd) && (alt_fd_list[i].dev == fd->dev)) + { + rc = -EACCES; + goto alt_fd_lock_exit; + } + } + fd->fd_flags |= ALT_FD_EXCL; + + alt_fd_lock_exit: + + ALT_SEM_POST(alt_fd_list_lock); + return rc; +} Index: components/sd_card/firmware/bsp/HAL/src/alt_uncached_malloc.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_uncached_malloc.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_uncached_malloc.c (revision 8) @@ -0,0 +1,55 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2003,2007 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +******************************************************************************/ + +#include "sys/alt_cache.h" +#include "system.h" + +#ifdef NIOS2_MMU_PRESENT +/* Convert KERNEL region address to IO region address */ +#define BYPASS_DCACHE_MASK (0x1 << 29) +#else +/* Set bit 31 of address to bypass D-cache */ +#define BYPASS_DCACHE_MASK (0x1 << 31) +#endif + +/* + * Allocate a block of uncached memory. + */ + +volatile void* alt_uncached_malloc (size_t size) +{ + void* ptr; + + ptr = malloc (size); + + alt_dcache_flush (ptr, size); + + return ptr ? (volatile void*) (((alt_u32) ptr) | BYPASS_DCACHE_MASK) : NULL; +} Index: components/sd_card/firmware/bsp/HAL/src/alt_open.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_open.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_open.c (revision 8) @@ -0,0 +1,173 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include "sys/alt_errno.h" +#include "sys/alt_warning.h" +#include "priv/alt_file.h" +#include "alt_types.h" +#include "os/alt_syscall.h" + +#ifdef ALT_USE_DIRECT_DRIVERS + +int ALT_OPEN (const char* file, int flags, int mode) +{ + /* Generate a link time warning, should this function ever be called. */ + + ALT_STUB_WARNING(open); + + /* Indicate an error */ + + ALT_ERRNO = ENOSYS; + return -1; +} + +#else /* !ALT_USE_DIRECT_DRIVERS */ + +extern alt_llist alt_dev_list; + +/* + * alt_file_locked() is used by open() to ensure that a device has not been + * previously locked for exclusive access using ioctl(). This test is only + * performed for devices. Filesystems are required to handle the ioctl() call + * themselves, and report the error from the filesystems open() function. + */ + +static int alt_file_locked (alt_fd* fd) +{ + alt_u32 i; + + /* + * Mark the file descriptor as belonging to a device. + */ + + fd->fd_flags |= ALT_FD_DEV; + + /* + * Loop through all current file descriptors searching for one that's locked + * for exclusive access. If a match is found, generate an error. + */ + + for (i = 0; i <= alt_max_fd; i++) + { + if ((alt_fd_list[i].dev == fd->dev) && + (alt_fd_list[i].fd_flags & ALT_FD_EXCL) && + (&alt_fd_list[i] != fd)) + { + return -EACCES; + } + } + + /* The device is not locked */ + + return 0; +} + +/* + * open() is called in order to get a file descriptor that reference the file + * or device named "name". This descriptor can then be used to manipulate the + * file/device using the standard system calls, e.g. write(), read(), ioctl() + * etc. + * + * This is equivalent to the standard open() system call. + * + * ALT_OPEN is mapped onto the open() system call in alt_syscall.h + */ + +int ALT_OPEN (const char* file, int flags, int mode) +{ + alt_dev* dev; + alt_fd* fd; + int index = -1; + int status = -ENODEV; + int isafs = 0; + + /* + * Check the device list, to see if a device with a matching name is + * registered. + */ + + if (!(dev = alt_find_dev (file, &alt_dev_list))) + { + /* No matching device, so try the filesystem list */ + + dev = alt_find_file (file); + isafs = 1; + } + + /* + * If a matching device or filesystem is found, allocate a file descriptor. + */ + + if (dev) + { + if ((index = alt_get_fd (dev)) < 0) + { + status = index; + } + else + { + fd = &alt_fd_list[index]; + fd->fd_flags = (flags & ~ALT_FD_FLAGS_MASK); + + /* If this is a device, ensure it isn't already locked */ + + if (isafs || ((status = alt_file_locked (fd)) >= 0)) + { + /* + * If the device or filesystem provides an open() callback function, + * call it now to perform any device/filesystem specific operations. + */ + + status = (dev->open) ? dev->open(fd, file, flags, mode): 0; + } + } + } + else + { + status = -ENODEV; + } + + /* Allocation failed, so clean up and return an error */ + + if (status < 0) + { + alt_release_fd (index); + ALT_ERRNO = -status; + return -1; + } + + /* return the reference upon success */ + + return index; +} + +#endif /* ALT_USE_DIRECT_DRIVERS */ Index: components/sd_card/firmware/bsp/HAL/src/alt_fork.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_fork.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_fork.c (revision 8) @@ -0,0 +1,57 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include "sys/alt_warning.h" +#include "sys/alt_errno.h" +#include "os/alt_syscall.h" + +/* + * The fork() system call is used by newlib to create a duplicate copy of the + * curent process. This is unsupported in the HAL environment. However a + * "do-nothing" implementation is still provied for newlib compatability. + * + * ALT_FORK is mapped onto the fork() system call in alt_syscall.h + */ + +int ALT_FORK (void) +{ + /* Generate a link time warning, should this function ever be called. */ + + ALT_STUB_WARNING(fork); + + /* Indicate an error */ + + ALT_ERRNO = ENOSYS; + return -1; +} + + Index: components/sd_card/firmware/bsp/HAL/src/alt_ecc_fatal_entry.S =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_ecc_fatal_entry.S (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_ecc_fatal_entry.S (revision 8) @@ -0,0 +1,102 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2013 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +******************************************************************************/ + +/* + * This is the code called at the beginning of the exception handler + * to detect a likely fatal ECC error exception and then jump to + * user-provided code to handle it. + * + * This code is pulled in from a .globl in alt_ecc_fatal_exception.c. + * This scheme is used so that if a handler is never registered, then this + * code will not appear in the generated executable, thereby improving + * code footprint. + * + * This code is located in its own section that the linker script + * explicitly mentions and ensures it gets linked at the beginning + * of the exception handler. + */ + + /* + * Pull in the exception handler register save code. + */ + .globl alt_exception + + .section .exceptions.entry.ecc_fatal, "xa" + + /* + * This might be handling an unrecoverable ECC error exception + * in the register file and/or data cache. + * Must avoid reading registers or performing load/store instructions + * before this is determined because they could trigger another + * unrecoverable ECC error exception and create an infinite loop. + * + * The EXCEPTION register is always present when ECC is present. + * Bit 31 of this register indicates that there was an unrecoverable + * ECC error exception in the register file and/or data cache. + * Test this (using blt to check sign bit) to determine if this is + * what we are dealing with. Otherwise, just do normal processing. + * + * Jump to an application-provided routine to handle this condition. + * Pass in the return address in the et register in case this code + * can clean up the ECC error and then return here (unlikely). + * + * Runtime stack checking can't be enabled when ECC is present + * because they both want to use the et register. + */ + rdctl et, exception + bge et, r0, alt_exception_not_ecc_fatal /* Not ECCFTL if bit 31 is 0 */ + + /* + * Load ECC fatal handler pointer into et register. + * Using a ldwio is safe because it completely bypasses the data cache. + */ + movhi et, %hi(alt_exception_ecc_fatal_handler) + ori et, et, %lo(alt_exception_ecc_fatal_handler) + ldwio et, 0(et) + + /* + * If ECC fatal handler pointer is not 0, assume a handler + * has been provided by the application. + */ + beq et, r0, alt_exception_not_ecc_fatal + + /* + * The et register contains the address of the ECC fatal handler. + * Jump to this address to invoke the handler. + */ + jmp et + + /* + * An ECC fatal handler can jump to this label if it able + * to recover from the fatal error (rare) and wants to continue + * with normal exception processing. + */ +.globl alt_exception_not_ecc_fatal +alt_exception_not_ecc_fatal: Index: components/sd_card/firmware/bsp/HAL/src/alt_instruction_exception_register.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_instruction_exception_register.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_instruction_exception_register.c (revision 8) @@ -0,0 +1,82 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2008 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ +#include "sys/alt_exceptions.h" +#include "alt_types.h" +#include "system.h" + +/* + * This file implements support for calling user-registered handlers for + * instruction-generated exceptions. + * + * The registry API is optionally enabled through the "Enable + * Instruction-related Exception API" HAL BSP setting, which will + * define the macro below. + */ +#ifdef ALT_INCLUDE_INSTRUCTION_RELATED_EXCEPTION_API + +/* + * The header, alt_exception_handler_registry.h contains a struct describing + * the registered exception handler + */ +#include "priv/alt_exception_handler_registry.h" + +/* + * Pull in the exception entry assembly code. This will not be linked in + * unless this object is linked into the executable (i.e. only if + * alt_instruction_exception_register() is called). + */ +__asm__( "\n\t.globl alt_exception" ); + +/* + * alt_instruction_exception_register() is called to register a handler to + * service instruction-generated exceptions that are not handled by the + * default exception handler code (interrupts, and optionally unimplemented + * instructions and traps). + * + * Passing null (0x0) in the handler argument will disable a previously- + * registered handler. + * + * Note that if no handler is registered, exceptions that are not processed + * using the built-in handler (interrupts, and optionally unimplemented + * instructions and traps) are treated as unknown exceptions, resulting + * in either a break or an infinite loop. + */ +void alt_instruction_exception_register ( + alt_exception_result (*exception_handler)( + alt_exception_cause cause, + alt_u32 exception_pc, + alt_u32 bad_addr) ) +{ + alt_instruction_exception_handler = exception_handler; +} + +#endif /* ALT_INCLUDE_INSTRUCTION_RELATED_EXCEPTION_API */ Index: components/sd_card/firmware/bsp/HAL/src/alt_log_printf.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_log_printf.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_log_printf.c (revision 8) @@ -0,0 +1,479 @@ + +/* alt_log_printf.c + * + * This file implements the various C functions used for the + * alt_log logging/debugging print functions. The functions + * sit as is here - the job of hiding them from the compiler + * if logging is disabled is accomplished in the .h file. + * + * All the global variables for alt_log are defined here. + * These include the various flags that turn on additional + * logging options; the strings for assembly printing; and + * other globals needed by different logging options. + * + * There are 4 functions that handle the actual printing: + * alt_log_txchar: Actual function that puts 1 char to UART/JTAG UART. + * alt_log_repchar: Calls alt_log_txchar 'n' times - used by + * alt_log_private_printf for formatting. + * alt_log_private_printf: + * Stripped down implementation of printf - no floats. + * alt_log_printf_proc: + * Wrapper function for private_printf. + * + * The rest of the functions are called by the macros which + * were called by code in the other components. Each function + * is preceded by a comment, about which file it gets called + * in, and what its purpose is. + * + * author: gkwan + */ + +/* skip all code if enable is off */ +#ifdef ALT_LOG_ENABLE + +#include +#include +#include +#ifdef __ALTERA_AVALON_JTAG_UART + #include "altera_avalon_jtag_uart.h" + #include +#endif +#include "sys/alt_log_printf.h" + +/* strings for assembly puts */ +char alt_log_msg_bss[] = "[crt0.S] Clearing BSS \r\n";; +char alt_log_msg_alt_main[] = "[crt0.S] Calling alt_main.\r\n"; +char alt_log_msg_stackpointer[] \ + = "[crt0.S] Setting up stack and global pointers.\r\n"; +char alt_log_msg_cache[] = "[crt0.S] Inst & Data Cache Initialized.\r\n"; +/* char array allocation for alt_write */ +char alt_log_write_buf[ALT_LOG_WRITE_ECHO_LEN+2]; + +/* global variables for all 'on' flags */ + +/* + * The boot message flag is linked into the data (rwdata) section + * because if it is zero, it would otherwise be placed in the bss section. + * alt_log examines this variable before the BSS is cleared in the boot-up + * process. + */ +volatile alt_u32 alt_log_boot_on_flag \ + __attribute__ ((section (".data"))) = ALT_LOG_BOOT_ON_FLAG_SETTING; + +volatile alt_u8 alt_log_write_on_flag = ALT_LOG_WRITE_ON_FLAG_SETTING; + +volatile alt_u8 alt_log_sys_clk_on_flag = ALT_LOG_SYS_CLK_ON_FLAG_SETTING; + +volatile alt_u8 alt_log_jtag_uart_alarm_on_flag = \ + ALT_LOG_JTAG_UART_ALARM_ON_FLAG_SETTING; + +volatile alt_u8 alt_log_jtag_uart_isr_on_flag = \ + ALT_LOG_JTAG_UART_ISR_ON_FLAG_SETTING; + +volatile alt_u8 alt_log_jtag_uart_startup_info_on_flag = \ + ALT_LOG_JTAG_UART_STARTUP_INFO_ON_FLAG_SETTING; + +/* Global alarm object for recurrent JTAG UART status printing */ +alt_alarm alt_log_jtag_uart_alarm_1; + +/* Global ints for system clock printing and count */ +volatile int alt_log_sys_clk_count; +volatile int alt_system_clock_in_sec; + +/* enum used by alt_log_private_printf */ +enum +{ + pfState_chars, + pfState_firstFmtChar, + pfState_otherFmtChar +}; + + + + +/* Function to put one char onto the UART/JTAG UART txdata register. */ +void alt_log_txchar(int c,char *base) +{ + /* Wait until the device is ready for a character */ + while((ALT_LOG_PRINT_REG_RD(base) & ALT_LOG_PRINT_MSK) == 0) + ; + /* And pop the character into the register */ + ALT_LOG_PRINT_TXDATA_WR(base,c); +} + + +/* Called by alt_log_private_printf to print out characters repeatedly */ +void alt_log_repchar(char c,int r,int base) +{ + while(r-- > 0) + alt_log_txchar(c,(char*) base); +} + + +/* Stripped down printf function */ +void alt_log_private_printf(const char *fmt,int base,va_list args) + { + const char *w; + char c; + int state; + int fmtLeadingZero = 0; /* init these all to 0 for -W warnings. */ + int fmtLong = 0; + int fmtBeforeDecimal = 0; + int fmtAfterDecimal = 0; + int fmtBase = 0; + int fmtSigned = 0; + int fmtCase = 0; /* For hex format, if 1, A-F, else a-f. */ + + w = fmt; + state = pfState_chars; + + while(0 != (c = *w++)) + { + switch(state) + { + case pfState_chars: + if(c == '%') + { + fmtLeadingZero = 0; + fmtLong = 0; + fmtBase = 10; + fmtSigned = 1; + fmtCase = 0; /* Only %X sets this. */ + fmtBeforeDecimal = -1; + fmtAfterDecimal = -1; + state = pfState_firstFmtChar; + } + else + { + alt_log_txchar(c,(char*)base); + } + break; + + case pfState_firstFmtChar: + if(c == '0') + { + fmtLeadingZero = 1; + state = pfState_otherFmtChar; + } + else if(c == '%') + { + alt_log_txchar(c,(char*)base); + state = pfState_chars; + } + else + { + state = pfState_otherFmtChar; + goto otherFmtChar; + } + break; + + case pfState_otherFmtChar: +otherFmtChar: + if(c == '.') + { + fmtAfterDecimal = 0; + } + else if('0' <= c && c <= '9') + { + c -= '0'; + if(fmtAfterDecimal < 0) /* still before decimal */ + { + if(fmtBeforeDecimal < 0) + { + fmtBeforeDecimal = 0; + } + else + { + fmtBeforeDecimal *= 10; + } + fmtBeforeDecimal += c; + } + else + { + fmtAfterDecimal = (fmtAfterDecimal * 10) + c; + } + } + else if(c == 'l') + { + fmtLong = 1; + } + else /* we're up to the letter which determines type */ + { + switch(c) + { + case 'd': + case 'i': +doIntegerPrint: + { + unsigned long v; + unsigned long p; /* biggest power of fmtBase */ + unsigned long vShrink; /* used to count digits */ + int sign; + int digitCount; + + /* Get the value */ + if(fmtLong) + { + if (fmtSigned) + { + v = va_arg(args,long); + } + else + { + v = va_arg(args,unsigned long); + } + } + else + { + if (fmtSigned) + { + v = va_arg(args,int); + } + else + { + v = va_arg(args,unsigned int); + } + } + + /* Strip sign */ + sign = 0; + /* (assumes sign bit is #31) */ + if( fmtSigned && (v & (0x80000000)) ) + { + v = ~v + 1; + sign = 1; + } + + /* Count digits, and get largest place value */ + vShrink = v; + p = 1; + digitCount = 1; + while( (vShrink = vShrink / fmtBase) > 0 ) + { + digitCount++; + p *= fmtBase; + } + + /* Print leading characters & sign */ + fmtBeforeDecimal -= digitCount; + if(fmtLeadingZero) + { + if(sign) + { + alt_log_txchar('-',(char*)base); + fmtBeforeDecimal--; + } + alt_log_repchar('0',fmtBeforeDecimal,base); + } + else + { + if(sign) + { + fmtBeforeDecimal--; + } + alt_log_repchar(' ',fmtBeforeDecimal,base); + if(sign) + { + alt_log_txchar('-',(char*)base); + } + } + + /* Print numbery parts */ + while(p) + { + unsigned char d; + + d = v / p; + d += '0'; + if(d > '9') + { + d += (fmtCase ? 'A' : 'a') - '0' - 10; + } + alt_log_txchar(d,(char*)base); + + v = v % p; + p = p / fmtBase; + } + } + + state = pfState_chars; + break; + + case 'u': + fmtSigned = 0; + goto doIntegerPrint; + case 'o': + fmtSigned = 0; + fmtBase = 8; + goto doIntegerPrint; + case 'x': + fmtSigned = 0; + fmtBase = 16; + goto doIntegerPrint; + case 'X': + fmtSigned = 0; + fmtBase = 16; + fmtCase = 1; + goto doIntegerPrint; + + case 'c': + alt_log_repchar(' ',fmtBeforeDecimal-1,base); + alt_log_txchar(va_arg(args,int),(char*)base); + break; + + case 's': + { + char *s; + + s = va_arg(args,char *); + alt_log_repchar(' ',fmtBeforeDecimal-strlen(s),base); + + while(*s) + alt_log_txchar(*s++,(char*)base); + } + break; + } /* switch last letter of fmt */ + state=pfState_chars; + } + break; + } /* switch */ + } /* while chars left */ + } /* printf */ + +/* Main logging printf function */ +int alt_log_printf_proc(const char *fmt, ... ) +{ + va_list args; + + va_start (args, fmt); + alt_log_private_printf(fmt,ALT_LOG_PORT_BASE,args); + return (0); +} + +/* Below are the functions called by different macros in various components. */ + +/* If the system has a JTAG_UART, include JTAG_UART debugging functions */ +#ifdef __ALTERA_AVALON_JTAG_UART + +/* The alarm function in altera_avalon_jtag_uart.c. + * This function, when turned on, prints out the status + * of the JTAG UART Control register, every ALT_LOG_JTAG_UART_TICKS. + * If the flag is off, the alarm should never be registered, and this + * function should never run */ +alt_u32 altera_avalon_jtag_uart_report_log(void * context) +{ + if (alt_log_jtag_uart_alarm_on_flag) { + altera_avalon_jtag_uart_state* dev = (altera_avalon_jtag_uart_state*) context; + const char* header="JTAG Alarm:"; + alt_log_jtag_uart_print_control_reg(dev, dev->base, header); + return ALT_LOG_JTAG_UART_TICKS; + } + else + { + /* If flag is not on, return 0 to disable future alarms. + * Should never be here, alarm should not be enabled at all. */ + return 0; + } +} + +void alt_log_jtag_uart_print_control_reg(altera_avalon_jtag_uart_state* dev, int base, const char* header) +{ + unsigned int control, space, ac, wi, ri, we, re; + control = IORD_ALTERA_AVALON_JTAG_UART_CONTROL(base); + space = (control & ALTERA_AVALON_JTAG_UART_CONTROL_WSPACE_MSK) >> + ALTERA_AVALON_JTAG_UART_CONTROL_WSPACE_OFST; + we= (control & ALTERA_AVALON_JTAG_UART_CONTROL_WE_MSK) >> + ALTERA_AVALON_JTAG_UART_CONTROL_WE_OFST; + re= (control & ALTERA_AVALON_JTAG_UART_CONTROL_RE_MSK) >> + ALTERA_AVALON_JTAG_UART_CONTROL_RE_OFST; + ri= (control & ALTERA_AVALON_JTAG_UART_CONTROL_RI_MSK) >> + ALTERA_AVALON_JTAG_UART_CONTROL_RI_OFST; + wi= (control & ALTERA_AVALON_JTAG_UART_CONTROL_WI_MSK) >> + ALTERA_AVALON_JTAG_UART_CONTROL_WI_OFST; + ac= (control & ALTERA_AVALON_JTAG_UART_CONTROL_AC_MSK) >> + ALTERA_AVALON_JTAG_UART_CONTROL_AC_OFST; + +#ifdef ALTERA_AVALON_JTAG_UART_SMALL + ALT_LOG_PRINTF( + "%s HW FIFO wspace=%d AC=%d WI=%d RI=%d WE=%d RE=%d\r\n", + header,space,ac,wi,ri,we,re); +#else + ALT_LOG_PRINTF( + "%s SW CirBuf = %d, HW FIFO wspace=%d AC=%d WI=%d RI=%d WE=%d RE=%d\r\n", + header,(dev->tx_out-dev->tx_in),space,ac,wi,ri,we,re); +#endif + + return; + +} + +/* In altera_avalon_jtag_uart.c + * Same output as the alarm function above, but this is called in the driver + * init function. Hence, it gives the status of the JTAG UART control register + * right at the initialization of the driver */ +void alt_log_jtag_uart_startup_info(altera_avalon_jtag_uart_state* dev, int base) +{ + const char* header="JTAG Startup Info:"; + alt_log_jtag_uart_print_control_reg(dev, base, header); + return; +} + +/* In altera_avalon_jtag_uart.c + * When turned on, this function will print out the status of the jtag uart + * control register every time there is a jtag uart "almost-empty" interrupt. */ +void alt_log_jtag_uart_isr_proc(int base, altera_avalon_jtag_uart_state* dev) +{ + if (alt_log_jtag_uart_isr_on_flag) { + const char* header="JTAG IRQ:"; + alt_log_jtag_uart_print_control_reg(dev, base, header); + } + return; +} + +#endif /* __ALTERA_AVALON_JTAG_UART */ + +/* In alt_write.c + * When the alt_log_write_on_flag is turned on, this function gets called + * every time alt_write gets called. The first + * ALT_LOG_WRITE_ECHO_LEN characters of every printf command (or any command + * that eventually calls write()) gets echoed to the alt_log output. */ +void alt_log_write(const void *ptr, size_t len) +{ + if (alt_log_write_on_flag) { + int temp_cnt; + int length=(ALT_LOG_WRITE_ECHO_LEN>len) ? len : ALT_LOG_WRITE_ECHO_LEN; + + if (length < 2) return; + + strncpy (alt_log_write_buf,ptr,length); + alt_log_write_buf[length-1]='\n'; + alt_log_write_buf[length]='\r'; + alt_log_write_buf[length+1]='\0'; + + /* Escape Ctrl-D's. If the Ctrl-D gets sent it might kill the terminal + * connection of alt_log. It will get replaced by 'D'. */ + for (temp_cnt=0;temp_cnt < length; temp_cnt++) { + if (alt_log_write_buf[temp_cnt]== 0x4) { + alt_log_write_buf[temp_cnt]='D'; + } + } + ALT_LOG_PRINTF("Write Echo: %s",alt_log_write_buf); + } +} + +/* In altera_avalon_timer_sc + * This function prints out a system clock is alive message + * every ALT_LOG_SYS_CLK_INTERVAL (in ticks). */ +void alt_log_system_clock() +{ + if (alt_log_sys_clk_on_flag) { + alt_log_sys_clk_count++; + if (alt_log_sys_clk_count > ALT_LOG_SYS_CLK_INTERVAL) { + alt_log_sys_clk_count = 0; + ALT_LOG_PRINTF("System Clock On %u\r\n",alt_system_clock_in_sec++); + } + } +} + + +#endif Index: components/sd_card/firmware/bsp/HAL/src/alt_fd_unlock.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_fd_unlock.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_fd_unlock.c (revision 8) @@ -0,0 +1,56 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include + +#include "priv/alt_file.h" + +/* + * alt_fd_unlock() is the inverse of alt_fd_lock(). It is called as a + * consequence of a TIOCNXCL ioctl request, e.g: + * + * ioctl (fd, TIOCNXCL, NULL); + * + * It enables multiple file descriptors to exist for the same device. This + * is normally the case, but it may have been disabled by a previous call to + * alt_fd_lock(). + * + * Return zero on sucess, and a negative value on failure. + * + * The current implementation always succeeds. + */ + +int alt_fd_unlock (alt_fd* fd) +{ + fd->fd_flags &= ~ALT_FD_EXCL; + return 0; +} Index: components/sd_card/firmware/bsp/HAL/src/alt_wait.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_wait.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_wait.c (revision 8) @@ -0,0 +1,52 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include "sys/alt_errno.h" +#include "os/alt_syscall.h" + +/* + * wait() is used by newlib to wait for all child processes to exit. Since the + * HAL does not support spawning child processes, this returns immediately as + * there can't be anythign to wait for. + * + * ALT_WAIT is mapped onto the wait() system call in alt_syscall.h + */ + +int ALT_WAIT (int *status) +{ + *status = 0; + + ALT_ERRNO = ECHILD; + + return -1; +} + Index: components/sd_card/firmware/bsp/HAL/src/alt_fs_reg.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_fs_reg.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_fs_reg.c (revision 8) @@ -0,0 +1,75 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include + +#include "sys/alt_dev.h" +#include "priv/alt_file.h" + +/* + * The alt_fs_reg() function is used to register a file system. Once registered + * a device can be accessed using the standard posix calls: open(), read(), + * write() etc. + * + * System behaviour is undefined in the event that a file system is registered + * with a name that conflicts with an existing device or file system. + * + * alt_fs_reg() is not thread safe in the sense that there should be no other + * thread using the file system list at the time that alt_dev_reg() is called. In + * practice this means that alt_fs_reg() should only be called while operating + * in a single threaded mode. The expectation is that it will only be called + * by the file system initilisation functions invoked by alt_sys_init(), which in + * turn should only be called by the single threaded C startup code. + * + * A return value of zero indicates success. A negative return value indicates + * failure. + */ + +int alt_fs_reg (alt_dev* dev) +{ + /* + * check that the device has a name. + */ + + if (!dev->name) + { + return -ENODEV; + } + + /* + * register the file system. + */ + + alt_llist_insert(&alt_fs_list, &dev->llist); + + return 0; +} Index: components/sd_card/firmware/bsp/HAL/src/alt_fcntl.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_fcntl.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_fcntl.c (revision 8) @@ -0,0 +1,101 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include +#include + +#include +#include + +#include "sys/alt_errno.h" +#include "priv/alt_file.h" +#include "alt_types.h" +#include "os/alt_syscall.h" + +#define ALT_FCNTL_FLAGS_MASK ((alt_u32) (O_APPEND | O_NONBLOCK)) + +/* + * fcntl() is a limited implementation of the standard fcntl() system call. + * It can be used to change the state of the flags associated with an open + * file descriptor. Normally these flags are set during the call to + * open(). It is anticipated that the main use of this function will be to + * change the state of a device from blocking to non-blocking (where this is + * supported). + * + * The input argument "fd" is the file descriptor to be manipulated. "cmd" + * is the command to execute. This can be either F_GETFL (return the + * current value of the flags) or F_SETFL (set the value of the flags). + * + * If "cmd" is F_SETFL then the argument "arg" is the new value of flags, + * otherwise "arg" is ignored. Only the flags: O_APPEND and O_NONBLOCK + * can be updated by a call to fcntl(). All other flags remain + * unchanged. + * + * ALT_FCNTL is mapped onto the fcntl() system call in alt_syscall.h + */ + +int ALT_FCNTL (int file, int cmd, ...) +{ + alt_fd* fd; + long flags; + va_list argp; + + /* + * A common error case is that when the file descriptor was created, the call + * to open() failed resulting in a negative file descriptor. This is trapped + * below so that we don't try and process an invalid file descriptor. + */ + + fd = (file < 0) ? NULL : &alt_fd_list[file]; + + if (fd) + { + switch (cmd) + { + case F_GETFL: + return fd->fd_flags & ~((alt_u32) ALT_FD_FLAGS_MASK); + case F_SETFL: + va_start(argp, cmd); + flags = va_arg(argp, long); + fd->fd_flags &= ~ALT_FCNTL_FLAGS_MASK; + fd->fd_flags |= (flags & ALT_FCNTL_FLAGS_MASK); + va_end(argp); + return 0; + default: + ALT_ERRNO = EINVAL; + return -1; + } + } + + ALT_ERRNO = EBADFD; + return -1; +} Index: components/sd_card/firmware/bsp/HAL/src/alt_uncached_free.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_uncached_free.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_uncached_free.c (revision 8) @@ -0,0 +1,49 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2003,2007 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +******************************************************************************/ + +#include "sys/alt_cache.h" +#include "system.h" + +#ifdef NIOS2_MMU_PRESENT +/* Convert KERNEL region address to IO region address */ +#define BYPASS_DCACHE_MASK (0x1 << 29) +#else +/* Set bit 31 of address to bypass D-cache */ +#define BYPASS_DCACHE_MASK (0x1 << 31) +#endif + +/* + * Free a block of uncached memory. + */ + +void alt_uncached_free (volatile void* ptr) +{ + free ((void*) (((alt_u32) ptr) & ~BYPASS_DCACHE_MASK)); +} Index: components/sd_card/firmware/bsp/HAL/src/alt_stat.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_stat.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_stat.c (revision 8) @@ -0,0 +1,59 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include +#include +#include +#include + +#include "os/alt_syscall.h" + +/* + * The stat() function is similar to the fstat() function in that it is used to + * obtain status information about a file. Instead of using an open file + * descriptor (like fstat()), stat() takes the name of a file as an input + * argument. + * + * ALT_STAT is mapped onto the stat() system call in alt_syscall.h + */ + +int ALT_STAT (const char *file, struct stat *st) +{ + int fd; + int rc; + + fd = open (file, 0); + rc = fstat (fd, st); + close (fd); + + return rc; +} Index: components/sd_card/firmware/bsp/HAL/src/alt_do_dtors.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_do_dtors.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_do_dtors.c (revision 8) @@ -0,0 +1,64 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +/****************************************************************************** +* * +* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT IT DIRECTLY. * +* * +* Overriding HAL Functions * +* * +* To provide your own implementation of a HAL function, include the file in * +* your Nios II IDE application project. When building the executable, the * +* Nios II IDE finds your function first, and uses it in place of the HAL * +* version. * +* * +******************************************************************************/ + +/* + * + */ + +typedef void (*destructor) (void); +extern destructor __DTOR_LIST__[]; +extern destructor __DTOR_END__[]; + +/* + * Run the C++ static destructors. + */ + +void _do_dtors(void) +{ + destructor* dtor; + + for (dtor = &__DTOR_END__[-1]; dtor >= __DTOR_LIST__; dtor--) + (*dtor) (); +} Index: components/sd_card/firmware/bsp/HAL/src/alt_getchar.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_getchar.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_getchar.c (revision 8) @@ -0,0 +1,61 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2006 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include + +#ifdef ALT_USE_DIRECT_DRIVERS +#include "system.h" +#include "sys/alt_driver.h" +#include "sys/alt_stdio.h" +#include "priv/alt_file.h" +#include "unistd.h" +#endif + +/* + * Uses the ALT_DRIVER_READ() macro to call directly to driver if available. + * Otherwise, uses newlib provided getchar() routine. + */ +int +alt_getchar(void) +{ +#ifdef ALT_USE_DIRECT_DRIVERS + ALT_DRIVER_READ_EXTERNS(ALT_STDIN_DEV); + char c; + + if (ALT_DRIVER_READ(ALT_STDIN_DEV, &c, 1, alt_fd_list[STDIN_FILENO].fd_flags) <= 0) { + return -1; + } + return c; +#else + return getchar(); +#endif +} Index: components/sd_card/firmware/bsp/HAL/src/alt_find_dev.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_find_dev.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_find_dev.c (revision 8) @@ -0,0 +1,88 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include +#include +#include + +#include "sys/alt_dev.h" +#include "priv/alt_file.h" + +#include "alt_types.h" + +/* + * alt_find_dev() is used by open() in order to locate a previously registered + * device with the name "name". The input argument "llist" is a pointer to the + * head of the device list to search. + * + * The return value is a pointer to the matching device, or NULL if there is + * no match. + * + * "name" must be an exact match for the devices registered name for a match to + * be found. + */ + +alt_dev* alt_find_dev(const char* name, alt_llist* llist) +{ + alt_dev* next = (alt_dev*) llist->next; + alt_32 len; + + len = strlen(name) + 1; + + /* + * Check each list entry in turn, until a match is found, or we reach the + * end of the list (i.e. next winds up pointing back to the list head). + */ + + while (next != (alt_dev*) llist) + { + + /* + * memcmp() is used here rather than strcmp() in order to reduce the size + * of the executable. + */ + + if (!memcmp (next->name, name, len)) + { + /* match found */ + + return next; + } + next = (alt_dev*) next->llist.next; + } + + /* No match found */ + + return NULL; +} + + Index: components/sd_card/firmware/bsp/HAL/src/alt_find_file.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_find_file.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_find_file.c (revision 8) @@ -0,0 +1,89 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include +#include +#include + +#include "sys/alt_dev.h" +#include "priv/alt_file.h" + +#include "alt_types.h" + +/* + * alt_find_file() is used by open() in order to locate a previously registered + * filesystem that owns that mount point that contains the file named "name". + * + * The return value is a pointer to the matching filesystem, or NULL if there is + * no match. + * + * A match is considered to have been found if the filesystem name followed by + * either '/' or '\0' is the prefix of the filename. For example the filename: + * "/myfilesystem/junk.txt" would match: "/myfilesystem", but not: "/myfile". + */ + +alt_dev* alt_find_file (const char* name) +{ + alt_dev* next = (alt_dev*) alt_fs_list.next; + + alt_32 len; + + /* + * Check each list entry in turn, until a match is found, or we reach the + * end of the list (i.e. next winds up pointing back to the list head). + */ + + while (next != (alt_dev*) &alt_fs_list) + { + len = strlen(next->name); + + if (next->name[len-1] == '/') + { + len -= 1; + } + + if (((name[len] == '/') || (name[len] == '\0')) && + !memcmp (next->name, name, len)) + { + /* match found */ + + return next; + } + next = (alt_dev*) next->llist.next; + } + + /* No match found */ + + return NULL; +} + + Index: components/sd_card/firmware/bsp/HAL/src/alt_load.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_load.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_load.c (revision 8) @@ -0,0 +1,88 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004-2005 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include "sys/alt_load.h" +#include "sys/alt_cache.h" + +/* + * Linker defined symbols. + */ + +extern alt_u32 __flash_rwdata_start; +extern alt_u32 __ram_rwdata_start; +extern alt_u32 __ram_rwdata_end; +extern alt_u32 __flash_rodata_start; +extern alt_u32 __ram_rodata_start; +extern alt_u32 __ram_rodata_end; +extern alt_u32 __flash_exceptions_start; +extern alt_u32 __ram_exceptions_start; +extern alt_u32 __ram_exceptions_end; + +/* + * alt_load() is called when the code is executing from flash. In this case + * there is no bootloader, so this application is responsible for loading to + * RAM any sections that are required. + */ + +void alt_load (void) +{ + /* + * Copy the .rwdata section. + */ + + alt_load_section (&__flash_rwdata_start, + &__ram_rwdata_start, + &__ram_rwdata_end); + + /* + * Copy the exception handler. + */ + + alt_load_section (&__flash_exceptions_start, + &__ram_exceptions_start, + &__ram_exceptions_end); + + /* + * Copy the .rodata section. + */ + + alt_load_section (&__flash_rodata_start, + &__ram_rodata_start, + &__ram_rodata_end); + + /* + * Now ensure that the caches are in synch. + */ + + alt_dcache_flush_all(); + alt_icache_flush_all(); +} Index: components/sd_card/firmware/bsp/HAL/src/alt_execve.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_execve.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_execve.c (revision 8) @@ -0,0 +1,55 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include "sys/alt_errno.h" +#include "sys/alt_warning.h" +#include "os/alt_syscall.h" + +/* + * execve() is used by newlib to launch new processes. This is unsupported in + * the HAL environment. However a "do-nothing" implementation is still + * provied for newlib compatability. + * + * ALT_EXECVE is mapped onto the execve() system call in alt_syscall.h + */ + +int ALT_EXECVE (char *name, char ** argv, char** env) +{ + /* Generate a link time warning, should this function ever be called. */ + + ALT_STUB_WARNING(execve); + + /* Indicate an error */ + + ALT_ERRNO = ENOSYS; + return -1; +} Index: components/sd_card/firmware/bsp/HAL/src/alt_environ.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_environ.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_environ.c (revision 8) @@ -0,0 +1,42 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include "os/alt_syscall.h" + +/* + * These are the environment variables passed to the C code. By default there + * are no variables registered. An application can manipulate this list using + * getenv() and setenv(). + */ + +char *__env[1] = { 0 }; +char **ALT_ENVIRON = __env; Index: components/sd_card/firmware/bsp/HAL/src/alt_log_macro.S =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_log_macro.S (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_log_macro.S (revision 8) @@ -0,0 +1,56 @@ +/* alt_log_macro.S + * + * Implements the function tx_log_str, called by the assembly macro + * ALT_LOG_PUTS(). The macro will be empty when logging is turned off, + * and this function will not be compiled. When logging is on, + * this function is used to print out the strings defined in the beginning + * of alt_log_printf.c, using port information taken from system.h and + * alt_log_printf.h. + * + * This routine only handles strings, and sends a character into the defined + * output device's output buffer when the device is ready. It's intended for + * debugging purposes, where messages can be set to print out at certain + * points in the boot code to indicate the progress of the program. + * + */ + +#ifndef __ALT_LOG_MACROS__ +#define __ALT_LOG_MACROS__ + +/* define this flag to skip assembly-incompatible parts + * of various include files. */ +#define ALT_ASM_SRC + +#ifdef ALT_LOG_ENABLE // only compile this function if this flag is defined. + + #include "system.h" + #include "sys/alt_log_printf.h" + + .global tx_log_str +tx_log_str: + /* load base uart / jtag uart address into r6 */ + movhi r6, %hiadj(ALT_LOG_PORT_BASE) + addi r6, r6, %lo(ALT_LOG_PORT_BASE) +tx_next_char: + /* if pointer points to null, return + * r4 is the pointer to the str to be printed, set by ALT_LOG_PUTS */ + ldb r7, (r4) + beq r0, r7, end_tx + + /* check device transmit ready */ +wait_tx_ready_loop: + ldwio r5, ALT_LOG_PRINT_REG_OFFSET(r6) + andi r5, r5, ALT_LOG_PRINT_MSK + beq r5, r0, wait_tx_ready_loop + /* write char */ + stwio r7, ALT_LOG_PRINT_TXDATA_REG_OFFSET (r6) + /* advance string pointer */ + addi r4, r4, 1 + br tx_next_char +end_tx: + ret + +#endif + +#endif /* __ALT_LOG_MACROS__ */ + Index: components/sd_card/firmware/bsp/HAL/src/alt_gettod.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_gettod.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_gettod.c (revision 8) @@ -0,0 +1,125 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include +#include +#include + +#include "sys/alt_alarm.h" +#include "alt_types.h" +#include "os/alt_syscall.h" + +/* + * Macro defining the number of micoseconds in a second. + */ + +#define ALT_US (1000000) + +/* + * "alt_timezone" and "alt_resettime" are the values of the the reset time and + * time zone set through the last call to settimeofday(). By default they are + * zero initialised. + */ + +struct timezone alt_timezone = {0, 0}; +struct timeval alt_resettime = {0, 0}; + +/* + * gettimeofday() can be called to obtain a time structure which indicates the + * current "wall clock" time. This is calculated using the elapsed number of + * system clock ticks, and the value of "alt_resettime" and "alt_timezone" set + * through the last call to settimeofday(). + * + * Warning: if this function is called concurrently with a call to + * settimeofday(), the value returned by gettimeofday() will be unreliable. + * + * ALT_GETTIMEOFDAY is mapped onto the gettimeofday() system call in + * alt_syscall.h + */ + + +#if defined (__GNUC__) && (__GNUC__ >= 4) +int ALT_GETTIMEOFDAY (struct timeval *ptimeval, void *ptimezone_vptr) +{ + struct timezone *ptimezone = (struct timezone*)ptimezone_vptr; +#else +int ALT_GETTIMEOFDAY (struct timeval *ptimeval, struct timezone *ptimezone) +{ +#endif + + alt_u32 nticks = alt_nticks (); + alt_u32 tick_rate = alt_ticks_per_second (); + + /* + * Check to see if the system clock is running. This is indicated by a + * non-zero system clock rate. If the system clock is not running, an error + * is generated and the contents of "ptimeval" and "ptimezone" are not + * updated. + */ + + if (tick_rate) + { + ptimeval->tv_sec = alt_resettime.tv_sec + nticks/tick_rate; + ptimeval->tv_usec = alt_resettime.tv_usec + + (alt_u32)(((alt_u64)nticks*(ALT_US/tick_rate))%ALT_US); + + while(ptimeval->tv_usec < 0) { + if (ptimeval->tv_sec <= 0) + { + ptimeval->tv_sec = 0; + ptimeval->tv_usec = 0; + break; + } + else + { + ptimeval->tv_sec--; + ptimeval->tv_usec += ALT_US; + } + } + + while(ptimeval->tv_usec >= ALT_US) { + ptimeval->tv_sec++; + ptimeval->tv_usec -= ALT_US; + } + + if (ptimezone) + { + ptimezone->tz_minuteswest = alt_timezone.tz_minuteswest; + ptimezone->tz_dsttime = alt_timezone.tz_dsttime; + } + + return 0; + } + + return -ENOTSUP; +} + Index: components/sd_card/firmware/bsp/HAL/src/alt_get_fd.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_get_fd.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_get_fd.c (revision 8) @@ -0,0 +1,105 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include +#include +#include + +#include "sys/alt_dev.h" +#include "priv/alt_file.h" + +#include "alt_types.h" + +#include "system.h" + +/* + * alt_get_fd() is called to allocate a new file descriptor from the file + * descriptor pool. If a file descriptor is succesfully allocated, it is + * configured to refer to device "dev". + * + * The return value is the index of the file descriptor structure (i.e. + * the offset of the file descriptor within the file descriptor array). A + * negative value indicates failure. + */ + +int alt_get_fd (alt_dev* dev) +{ + alt_32 i; + int rc = -EMFILE; + + /* + * Take the alt_fd_list_lock semaphore in order to avoid races when + * accessing the file descriptor pool. + */ + + ALT_SEM_PEND(alt_fd_list_lock, 0); + + /* + * Search through the list of file descriptors, and allocate the first + * free descriptor that's found. + * + * If a free descriptor is found, then the value of "alt_max_fd" is + * updated accordingly. "alt_max_fd" is a 'highwater mark' which + * indicates the highest file descriptor ever allocated. This is used to + * improve efficency when searching the file descriptor list, and + * therefore reduce contention on the alt_fd_list_lock semaphore. + */ + + for (i = 0; i < ALT_MAX_FD; i++) + { + if (!alt_fd_list[i].dev) + { + alt_fd_list[i].dev = dev; + if (i > alt_max_fd) + { + alt_max_fd = i; + } + rc = i; + goto alt_get_fd_exit; + } + } + + alt_get_fd_exit: + + /* + * Release the alt_fd_list_lock semaphore now that we are done with the + * file descriptor pool. + */ + + ALT_SEM_POST(alt_fd_list_lock); + + return rc; +} + + + + Index: components/sd_card/firmware/bsp/HAL/src/alt_release_fd.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_release_fd.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_release_fd.c (revision 8) @@ -0,0 +1,54 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include "sys/alt_dev.h" +#include "priv/alt_file.h" + +/* + * alt_release_fd() is called to free an allocated file descriptor. This is + * done by setting the device pointer in the file descriptor structure to zero. + * + * File descriptors correcponding to standard in, standard out and standard + * error cannont be released backed to the pool. They are always reserved. + */ + +void alt_release_fd (int fd) +{ + if (fd > 2) + { + alt_fd_list[fd].fd_flags = 0; + alt_fd_list[fd].dev = 0; + } +} + + + Index: components/sd_card/firmware/bsp/HAL/src/alt_tick.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_tick.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_tick.c (revision 8) @@ -0,0 +1,149 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include "sys/alt_irq.h" +#include "sys/alt_alarm.h" +#include "os/alt_hooks.h" +#include "alt_types.h" + +/* + * "_alt_tick_rate" is used to store the value of the system clock frequency + * in ticks per second. It is initialised to zero, which corresponds to there + * being no system clock facility available. + */ + +alt_u32 _alt_tick_rate = 0; + +/* + * "_alt_nticks" is the number of system clock ticks that have elapsed since + * reset. + */ + +volatile alt_u32 _alt_nticks = 0; + +/* + * "alt_alarm_list" is the head of a linked list of registered alarms. This is + * initialised to be an empty list. + */ + +ALT_LLIST_HEAD(alt_alarm_list); + +/* + * alt_alarm_stop() is called to remove an alarm from the list of registered + * alarms. Alternatively an alarm can unregister itself by returning zero when + * the alarm executes. + */ + +void alt_alarm_stop (alt_alarm* alarm) +{ + alt_irq_context irq_context; + + irq_context = alt_irq_disable_all(); + alt_llist_remove (&alarm->llist); + alt_irq_enable_all (irq_context); +} + +/* + * alt_tick() is periodically called by the system clock driver in order to + * process the registered list of alarms. Each alarm is registed with a + * callback interval, and a callback function, "callback". + * + * The return value of the callback function indicates how many ticks are to + * elapse until the next callback. A return value of zero indicates that the + * alarm should be deactivated. + * + * alt_tick() is expected to run at interrupt level. + */ + +void alt_tick (void) +{ + alt_alarm* next; + alt_alarm* alarm = (alt_alarm*) alt_alarm_list.next; + + alt_u32 next_callback; + + /* update the tick counter */ + + _alt_nticks++; + + /* process the registered callbacks */ + + while (alarm != (alt_alarm*) &alt_alarm_list) + { + next = (alt_alarm*) alarm->llist.next; + + /* + * Upon the tick-counter rolling over it is safe to clear the + * roll-over flag; once the flag is cleared this (or subsequnt) + * tick events are enabled to generate an alarm event. + */ + if ((alarm->rollover) && (_alt_nticks == 0)) + { + alarm->rollover = 0; + } + + /* if the alarm period has expired, make the callback */ + if ((alarm->time <= _alt_nticks) && (alarm->rollover == 0)) + { + next_callback = alarm->callback (alarm->context); + + /* deactivate the alarm if the return value is zero */ + + if (next_callback == 0) + { + alt_alarm_stop (alarm); + } + else + { + alarm->time += next_callback; + + /* + * If the desired alarm time causes a roll-over, set the rollover + * flag. This will prevent the subsequent tick event from causing + * an alarm too early. + */ + if(alarm->time < _alt_nticks) + { + alarm->rollover = 1; + } + } + } + alarm = next; + } + + /* + * Update the operating system specific timer facilities. + */ + + ALT_OS_TIME_TICK(); +} + Index: components/sd_card/firmware/bsp/HAL/src/alt_flash_dev.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_flash_dev.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_flash_dev.c (revision 8) @@ -0,0 +1,69 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +/****************************************************************************** +* * +* Alt_flash.c - Functions to register a flash device to the "generic" flash * +* interface * +* * +* Author PRR * +* * +******************************************************************************/ + +#include +#include "sys/alt_llist.h" +#include "sys/alt_flash_dev.h" +#include "priv/alt_file.h" + +ALT_LLIST_HEAD(alt_flash_dev_list); + +alt_flash_fd* alt_flash_open_dev(const char* name) +{ + alt_flash_dev* dev = (alt_flash_dev*)alt_find_dev(name, &alt_flash_dev_list); + + if ((dev) && dev->open) + { + return dev->open(dev, name); + } + + return dev; +} + +void alt_flash_close_dev(alt_flash_fd* fd) +{ + if (fd && fd->close) + { + fd->close(fd); + } + return; +} + Index: components/sd_card/firmware/bsp/HAL/src/alt_kill.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_kill.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_kill.c (revision 8) @@ -0,0 +1,121 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include +#include + +#include "sys/alt_errno.h" +#include "os/alt_syscall.h" + + +/* + * kill() is used by newlib in order to send signals to processes. Since there + * is only a single process in the HAL, the only valid values for pid are + * either the current process id, or the broadcast values, i.e. pid must be + * less than or equal to zero. + * + * ALT_KILL is mapped onto the kill() system call in alt_syscall.h + */ + +int ALT_KILL (int pid, int sig) +{ + int status = 0; + + if (pid <= 0) + { + switch (sig) + { + case 0: + + /* The null signal is used to check that a pid is valid. */ + + break; + + case SIGABRT: + case SIGALRM: + case SIGFPE: + case SIGILL: + case SIGKILL: + case SIGPIPE: + case SIGQUIT: + case SIGSEGV: + case SIGTERM: + case SIGUSR1: + case SIGUSR2: + case SIGBUS: + case SIGPOLL: + case SIGPROF: + case SIGSYS: + case SIGTRAP: + case SIGVTALRM: + case SIGXCPU: + case SIGXFSZ: + + /* + * The Posix standard defines the default behaviour for all these signals + * as being eqivalent to a call to _exit(). No mechanism is provided to + * change this behaviour. + */ + + _exit(0); + case SIGCHLD: + case SIGURG: + + /* + * The Posix standard defines these signals to be ignored by default. No + * mechanism is provided to change this behaviour. + */ + + break; + default: + + /* Tried to send an unsupported signal */ + + status = EINVAL; + } + } + + else if (pid > 0) + { + /* Attempted to signal a non-existant process */ + + status = ESRCH; + } + + if (status) + { + ALT_ERRNO = status; + return -1; + } + + return 0; +} Index: components/sd_card/firmware/bsp/HAL/src/alt_usleep.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_usleep.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_usleep.c (revision 8) @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2003 Altera Corporation, San Jose, California, USA. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * ------------ + * + * Altera does not recommend, suggest or require that this reference design + * file be used in conjunction or combination with any other product. + * + * usleep.c - Microsecond delay routine + */ + +#include + +#include "priv/alt_busy_sleep.h" +#include "os/alt_syscall.h" + +/* + * This function simply calls alt_busy_sleep() to perform the delay. This + * function implements the delay as a calibrated "busy loop". + * + * ALT_USLEEP is mapped onto the usleep() system call in alt_syscall.h + */ + + + +#if defined (__GNUC__) && __GNUC__ >= 4 +int ALT_USLEEP (useconds_t us) +#else +unsigned int ALT_USLEEP (unsigned int us) +#endif +{ + return alt_busy_sleep(us); +} Index: components/sd_card/firmware/bsp/HAL/src/alt_exception_muldiv.S =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_exception_muldiv.S (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_exception_muldiv.S (revision 8) @@ -0,0 +1,583 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2003-2005 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +******************************************************************************/ + + /* + * This is the software multiply/divide handler for Nios2. + */ + + /* + * Provide a label which can be used to pull this file in. + */ + + .section .exceptions.start + .globl alt_exception_muldiv +alt_exception_muldiv: + + /* + * Pull in the entry/exit code. + */ + .globl alt_exception + + + .section .exceptions.soft, "xa" + + + /* INSTRUCTION EMULATION + * --------------------- + * + * Nios II processors generate exceptions for unimplemented instructions. + * The routines below emulate these instructions. Depending on the + * processor core, the only instructions that might need to be emulated + * are div, divu, mul, muli, mulxss, mulxsu, and mulxuu. + * + * The emulations match the instructions, except for the following + * limitations: + * + * 1) The emulation routines do not emulate the use of the exception + * temporary register (et) as a source operand because the exception + * handler already has modified it. + * + * 2) The routines do not emulate the use of the stack pointer (sp) or the + * exception return address register (ea) as a destination because + * modifying these registers crashes the exception handler or the + * interrupted routine. + * + * 3) To save code size, the routines do not emulate the use of the + * breakpoint registers (ba and bt) as operands. + * + * Detailed Design + * --------------- + * + * The emulation routines expect the contents of integer registers r0-r31 + * to be on the stack at addresses sp, 4(sp), 8(sp), ... 124(sp). The + * routines retrieve source operands from the stack and modify the + * destination register's value on the stack prior to the end of the + * exception handler. Then all registers except the destination register + * are restored to their previous values. + * + * The instruction that causes the exception is found at address -4(ea). + * The instruction's OP and OPX fields identify the operation to be + * performed. + * + * One instruction, muli, is an I-type instruction that is identified by + * an OP field of 0x24. + * + * muli AAAAA,BBBBB,IIIIIIIIIIIIIIII,-0x24- + * 27 22 6 0 <-- LSB of field + * + * The remaining emulated instructions are R-type and have an OP field + * of 0x3a. Their OPX fields identify them. + * + * R-type AAAAA,BBBBB,CCCCC,XXXXXX,NNNNN,-0x3a- + * 27 22 17 11 6 0 <-- LSB of field + * + * + */ + + + /* + * Split the instruction into its fields. We need 4*A, 4*B, and 4*C as + * offsets to the stack pointer for access to the stored register values. + */ + /* r2 = AAAAA,BBBBB,IIIIIIIIIIIIIIII,PPPPPP */ + roli r3, r2, 7 /* r3 = BBB,IIIIIIIIIIIIIIII,PPPPPP,AAAAA,BB */ + roli r4, r3, 3 /* r4 = IIIIIIIIIIIIIIII,PPPPPP,AAAAA,BBBBB */ + roli r6, r4, 2 /* r6 = IIIIIIIIIIIIII,PPPPPP,AAAAA,BBBBB,II */ + srai r4, r4, 16 /* r4 = (sign-extended) IMM16 */ + xori r6, r6, 0x42 /* r6 = CCC,XXXXXX,NNNNN,PPPPPP,AAAAA,bBBBB,cC */ + roli r7, r6, 5 /* r7 = XXXX,NNNNN,PPPPPP,AAAAA,bBBBB,cCCCC,XX */ + andi r5, r2, 0x3f /* r5 = 00000000000000000000000000,PPPPPP */ + xori r3, r3, 0x40 + andi r3, r3, 0x7c /* r3 = 0000000000000000000000000,aAAAA,00 */ + andi r6, r6, 0x7c /* r6 = 0000000000000000000000000,bBBBB,00 */ + andi r7, r7, 0x7c /* r7 = 0000000000000000000000000,cCCCC,00 */ + + /* Now either + * r5 = OP + * r3 = 4*(A^16) + * r4 = IMM16 (sign extended) + * r6 = 4*(B^16) + * r7 = 4*(C^16) + * or + * r5 = OP + */ + + + /* + * Save everything on the stack to make it easy for the emulation routines + * to retrieve the source register operands. The exception entry code has + * already saved some of this so we don't need to do it all again. + */ + + addi sp, sp, -60 + stw zero, 64(sp) /* Save zero on stack to avoid special case for r0. */ + /* Register at and r2-r15 have already been saved. */ + + stw r16, 0(sp) + stw r17, 4(sp) + stw r18, 8(sp) + stw r19, 12(sp) + stw r20, 16(sp) + stw r21, 20(sp) + stw r22, 24(sp) + stw r23, 28(sp) + /* et @ 32 - Has already been changed.*/ + /* bt @ 36 - Usually isn't an operand. */ + stw gp, 40(sp) + stw sp, 44(sp) + stw fp, 48(sp) + /* ea @ 52 - Don't bother to save - it's already been changed */ + /* ba @ 56 - Breakpoint register usually isn't an operand */ + /* ra @ 60 - Has already been saved */ + + + /* + * Prepare for either multiplication or division loop. + * They both loop 32 times. + */ + movi r14, 32 + + + /* + * Get the operands. + * + * It is necessary to check for muli because it uses an I-type instruction + * format, while the other instructions are have an R-type format. + */ + add r3, r3, sp /* r3 = address of A-operand. */ + ldw r3, 0(r3) /* r3 = A-operand. */ + movi r15, 0x24 /* muli opcode (I-type instruction format) */ + beq r5, r15, .Lmul_immed /* muli doesn't use the B register as a source */ + + add r6, r6, sp /* r6 = address of B-operand. */ + ldw r6, 0(r6) /* r6 = B-operand. */ + /* r4 = SSSSSSSSSSSSSSSS,-----IMM16------ */ + /* IMM16 not needed, align OPX portion */ + /* r4 = SSSSSSSSSSSSSSSS,CCCCC,-OPX--,00000 */ + srli r4, r4, 5 /* r4 = 00000,SSSSSSSSSSSSSSSS,CCCCC,-OPX-- */ + andi r4, r4, 0x3f /* r4 = 00000000000000000000000000,-OPX-- */ + + /* Now + * r5 = OP + * r3 = src1 + * r6 = src2 + * r4 = OPX (no longer can be muli) + * r7 = 4*(C^16) + * r14 = loop counter + */ + + /* ILLEGAL-INSTRUCTION EXCEPTION + * ----------------------------- + * + * This code is for Nios II cores that generate exceptions when attempting + * to execute illegal instructions. Nios II cores that support an + * illegal-instruction exception are identified by the presence of the + * macro definition NIOS2_HAS_ILLEGAL_INSTRUCTION_EXCEPTION in system.h . + * + * Remember that illegal instructions are different than unimplemented + * instructions. Illegal instructions are instruction encodings that + * have not been defined by the Nios II ISA. Unimplemented instructions + * are legal instructions that must be emulated by some Nios II cores. + * + * If we get here, all instructions except multiplies and divides + * are illegal. + * + * This code assumes that OP is not muli (because muli was tested above). + * All other multiplies and divides are legal. Anything else is illegal. + */ + + movi r8, 0x3a /* OP for R-type mul* and div* */ + bne r5, r8, .Lnot_muldiv + + /* r15 already is 0x24 */ /* OPX of divu */ + beq r4, r15, .Ldivide + + movi r15,0x27 /* OPX of mul */ + beq r4, r15, .Lmultiply + + movi r15,0x07 /* OPX of mulxuu */ + beq r4, r15, .Lmultiply + + movi r15,0x17 /* OPX of mulxsu */ + beq r4, r15, .Lmultiply + + movi r15,0x1f /* OPX of mulxss */ + beq r4, r15, .Lmultiply + + movi r15,0x25 /* OPX of div */ + bne r4, r15, .Lnot_muldiv + + + /* DIVISION + * + * Divide an unsigned dividend by an unsigned divisor using + * a shift-and-subtract algorithm. The example below shows + * 43 div 7 = 6 for 8-bit integers. This classic algorithm uses a + * single register to store both the dividend and the quotient, + * allowing both values to be shifted with a single instruction. + * + * remainder dividend:quotient + * --------- ----------------- + * initialize 00000000 00101011: + * shift 00000000 0101011:_ + * remainder >= divisor? no 00000000 0101011:0 + * shift 00000000 101011:0_ + * remainder >= divisor? no 00000000 101011:00 + * shift 00000001 01011:00_ + * remainder >= divisor? no 00000001 01011:000 + * shift 00000010 1011:000_ + * remainder >= divisor? no 00000010 1011:0000 + * shift 00000101 011:0000_ + * remainder >= divisor? no 00000101 011:00000 + * shift 00001010 11:00000_ + * remainder >= divisor? yes 00001010 11:000001 + * remainder -= divisor - 00000111 + * ---------- + * 00000011 11:000001 + * shift 00000111 1:000001_ + * remainder >= divisor? yes 00000111 1:0000011 + * remainder -= divisor - 00000111 + * ---------- + * 00000000 1:0000011 + * shift 00000001 :0000011_ + * remainder >= divisor? no 00000001 :00000110 + * + * The quotient is 00000110. + */ + +.Ldivide: + /* + * Prepare for division by assuming the result + * is unsigned, and storing its "sign" as 0. + */ + movi r17, 0 + + + /* Which division opcode? */ + xori r15, r4, 0x25 /* OPX of div */ + bne r15, zero, .Lunsigned_division + + + /* + * OPX is div. Determine and store the sign of the quotient. + * Then take the absolute value of both operands. + */ + xor r17, r3, r6 /* MSB contains sign of quotient */ + bge r3, zero, 0f + sub r3, zero, r3 /* -r3 */ +0: + bge r6, zero, 0f + sub r6, zero, r6 /* -r6 */ +0: + + +.Lunsigned_division: + /* Initialize the unsigned-division loop. */ + movi r13, 0 /* remainder = 0 */ + + /* Now + * r3 = dividend : quotient + * r4 = 0x25 for div, 0x24 for divu + * r6 = divisor + * r13 = remainder + * r14 = loop counter (already initialized to 32) + * r17 = MSB contains sign of quotient + */ + + + /* + * for (count = 32; count > 0; --count) + * { + */ +.Ldivide_loop: + + /* + * Division: + * + * (remainder:dividend:quotient) <<= 1; + */ + slli r13, r13, 1 + cmplt r15, r3, zero /* r15 = MSB of r3 */ + or r13, r13, r15 + slli r3, r3, 1 + + + /* + * if (remainder >= divisor) + * { + * set LSB of quotient + * remainder -= divisor; + * } + */ + bltu r13, r6, .Ldiv_skip + ori r3, r3, 1 + sub r13, r13, r6 +.Ldiv_skip: + + /* + * } + */ + subi r14, r14, 1 + bne r14, zero, .Ldivide_loop + + mov r9, r3 + + + /* Now + * r9 = quotient + * r4 = 0x25 for div, 0x24 for divu + * r7 = 4*(C^16) + * r17 = MSB contains sign of quotient + */ + + + /* + * Conditionally negate signed quotient. If quotient is unsigned, + * the sign already is initialized to 0. + */ + bge r17, zero, .Lstore_result + sub r9, zero, r9 /* -r9 */ + + br .Lstore_result + + + + + /* MULTIPLICATION + * + * A "product" is the number that one gets by summing a "multiplicand" + * several times. The "multiplier" specifies the number of copies of the + * multiplicand that are summed. + * + * Actual multiplication algorithms don't use repeated addition, however. + * Shift-and-add algorithms get the same answer as repeated addition, and + * they are faster. To compute the lower half of a product (pppp below) + * one shifts the product left before adding in each of the partial products + * (a * mmmm) through (d * mmmm). + * + * To compute the upper half of a product (PPPP below), one adds in the + * partial products (d * mmmm) through (a * mmmm), each time following the + * add by a right shift of the product. + * + * mmmm + * * abcd + * ------ + * #### = d * mmmm + * #### = c * mmmm + * #### = b * mmmm + * #### = a * mmmm + * -------- + * PPPPpppp + * + * The example above shows 4 partial products. Computing actual Nios II + * products requires 32 partials. + * + * It is possible to compute the result of mulxsu from the result of mulxuu + * because the only difference between the results of these two opcodes is + * the value of the partial product associated with the sign bit of rA. + * + * mulxsu = mulxuu - ((rA < 0) ? rB : 0); + * + * It is possible to compute the result of mulxss from the result of mulxsu + * because the only difference between the results of these two opcodes is + * the value of the partial product associated with the sign bit of rB. + * + * mulxss = mulxsu - ((rB < 0) ? rA : 0); + * + */ + +.Lmul_immed: + /* Opcode is muli. Change it into mul for remainder of algorithm. */ + mov r7, r6 /* Field B is dest register, not field C. */ + mov r6, r4 /* Field IMM16 is src2, not field B. */ + movi r4, 0x27 /* OPX of mul is 0x27 */ + +.Lmultiply: + /* Initialize the multiplication loop. */ + movi r9, 0 /* mul_product = 0 */ + movi r10, 0 /* mulxuu_product = 0 */ + mov r11, r6 /* save original multiplier for mulxsu and mulxss */ + mov r12, r6 /* mulxuu_multiplier (will be shifted) */ + movi r16, 1 /* used to create "rori B,A,1" from "ror B,A,r16" */ + + /* Now + * r3 = multiplicand + * r6 = mul_multiplier + * r7 = 4 * dest_register (used later as offset to sp) + * r9 = mul_product + * r10 = mulxuu_product + * r11 = original multiplier + * r12 = mulxuu_multiplier + * r14 = loop counter (already initialized) + * r15 = temp + * r16 = 1 + */ + + + /* + * for (count = 32; count > 0; --count) + * { + */ +.Lmultiply_loop: + + /* + * mul_product <<= 1; + * lsb = multiplier & 1; + */ + slli r9, r9, 1 + andi r15, r12, 1 + + /* + * if (lsb == 1) + * { + * mulxuu_product += multiplicand; + * } + */ + beq r15, zero, .Lmulx_skip + add r10, r10, r3 + cmpltu r15, r10, r3 /* Save the carry from the MSB of mulxuu_product. */ + ror r15, r15, r16 /* r15 = 0x80000000 on carry, or else 0x00000000 */ +.Lmulx_skip: + + /* + * if (MSB of mul_multiplier == 1) + * { + * mul_product += multiplicand; + * } + */ + bge r6, zero, .Lmul_skip + add r9, r9, r3 +.Lmul_skip: + + /* + * mulxuu_product >>= 1; logical shift + * mul_multiplier <<= 1; done with MSB + * mulx_multiplier >>= 1; done with LSB + */ + srli r10, r10, 1 + or r10, r10, r15 /* OR in the saved carry bit. */ + slli r6, r6, 1 + srli r12, r12, 1 + + + /* + * } + */ + subi r14, r14, 1 + bne r14, zero, .Lmultiply_loop + + + /* + * Multiply emulation loop done. + */ + + /* Now + * r3 = multiplicand + * r4 = OPX + * r7 = 4 * dest_register (used later as offset to sp) + * r9 = mul_product + * r10 = mulxuu_product + * r11 = original multiplier + * r15 = temp + */ + + + /* + * Select/compute the result based on OPX. + */ + + + /* OPX == mul? Then store. */ + xori r15, r4, 0x27 + beq r15, zero, .Lstore_result + + /* It's one of the mulx.. opcodes. Move over the result. */ + mov r9, r10 + + /* OPX == mulxuu? Then store. */ + xori r15, r4, 0x07 + beq r15, zero, .Lstore_result + + /* Compute mulxsu + * + * mulxsu = mulxuu - ((rA < 0) ? rB : 0); + */ + bge r3, zero, .Lmulxsu_skip + sub r9, r9, r11 +.Lmulxsu_skip: + + /* OPX == mulxsu? Then store. */ + xori r15, r4, 0x17 + beq r15, zero, .Lstore_result + + /* Compute mulxss + * + * mulxss = mulxsu - ((rB < 0) ? rA : 0); + */ + bge r11, zero, .Lmulxss_skip + sub r9, r9, r3 +.Lmulxss_skip: + /* At this point, assume that OPX is mulxss, so store */ + + +.Lstore_result: + add r7, r7, sp + stw r9, 0(r7) + + ldw r16, 0(sp) + ldw r17, 4(sp) + ldw r18, 8(sp) + ldw r19, 12(sp) + ldw r20, 16(sp) + ldw r21, 20(sp) + ldw r22, 24(sp) + ldw r23, 28(sp) + + /* bt @ 32 - Breakpoint register usually isn't an operand. */ + /* et @ 36 - Don't corrupt et. */ + /* gp @ 40 - Don't corrupt gp. */ + /* sp @ 44 - Don't corrupt sp. */ + ldw fp, 48(sp) + /* ea @ 52 - Don't corrupt ea. */ + /* ba @ 56 - Breakpoint register usually isn't an operand. */ + + addi sp, sp, 60 + + br .Lexception_exit + + +.Lnot_muldiv: + + addi sp, sp, 60 + + + .section .exceptions.exit.label +.Lexception_exit: + Index: components/sd_card/firmware/bsp/HAL/src/alt_sbrk.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_sbrk.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_sbrk.c (revision 8) @@ -0,0 +1,136 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include + +#include "os/alt_syscall.h" + +#include "sys/alt_irq.h" +#include "sys/alt_stack.h" + +#include "system.h" + +/* + * sbrk() is called to dynamically extend the data segment for the application. + * Thie input argument "incr" is the size of the block to allocate. + * + * This simple implementation does not perform any bounds checking. Memory will + * be allocated, even if the request region colides with the stack or overflows + * the available physical memory. + * + * ALT_SBRK is mapped onto the sbrk() system call in alt_syscall.h + * + * This function is called by the profiling code to allocate memory so must be + * safe if called from an interrupt context. It must also not be instrumented + * because that would lead to an infinate loop. + */ + +extern char __alt_heap_start[]; /* set by linker */ +extern char __alt_heap_limit[]; /* set by linker */ + +static char *heap_end = __alt_heap_start; + +#if defined(ALT_EXCEPTION_STACK) && defined(ALT_STACK_CHECK) +char * alt_exception_old_stack_limit = NULL; +#endif + +caddr_t ALT_SBRK (int incr) __attribute__ ((no_instrument_function )); + +caddr_t ALT_SBRK (int incr) +{ + alt_irq_context context; + char *prev_heap_end; + + context = alt_irq_disable_all(); + + /* Always return data aligned on a word boundary */ + heap_end = (char *)(((unsigned int)heap_end + 3) & ~3); + +#ifdef ALT_MAX_HEAP_BYTES + /* + * User specified a maximum heap size. Return -1 if it would + * be exceeded by this sbrk call. + */ + if (((heap_end + incr) - __alt_heap_start) > ALT_MAX_HEAP_BYTES) { + alt_irq_enable_all(context); + return (caddr_t)-1; + } +#else + if ((heap_end + incr) > __alt_heap_limit) { + alt_irq_enable_all(context); + return (caddr_t)-1; + } +#endif + + prev_heap_end = heap_end; + heap_end += incr; + +#ifdef ALT_STACK_CHECK + /* + * If the stack and heap are contiguous then extending the heap reduces the + * space available for the stack. If we are still using the default stack + * then adjust the stack limit to note this, while checking for stack + * pointer overflow. + * If the stack limit isn't pointing at the top of the heap then the code + * is using a different stack so none of this needs to be done. + */ + + if (alt_stack_limit() == prev_heap_end) + { + if (alt_stack_pointer() <= heap_end) + alt_report_stack_overflow(); + + alt_set_stack_limit(heap_end); + } + +#ifdef ALT_EXCEPTION_STACK + /* + * If we are executing from the exception stack then compare against the + * stack we switched away from as well. The exception stack is a fixed + * size so doesn't need to be checked. + */ + + if (alt_exception_old_stack_limit == prev_heap_end) + { + if (alt_exception_old_stack_limit <= heap_end) + alt_report_stack_overflow(); + + alt_exception_old_stack_limit = heap_end; + } +#endif + +#endif + + alt_irq_enable_all(context); + + return (caddr_t) prev_heap_end; +} Index: components/sd_card/firmware/bsp/HAL/src/alt_settod.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_settod.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_settod.c (revision 8) @@ -0,0 +1,96 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include +#include + +#include "sys/alt_errno.h" +#include "sys/alt_alarm.h" +#include "os/alt_syscall.h" + +/* + * "alt_timezone" and "alt_resettime" are the values of the the reset time and + * time zone set through the last call to settimeofday(). By default they are + * zero initialised. + */ + +extern struct timezone alt_timezone; +extern struct timeval alt_resettime; + +/* + * Macro defining the number of micoseconds in a second. + */ + +#define ALT_US (1000000) + + +/* + * settimeofday() can be called to calibrate the system clock, so that + * subsequent calls to gettimeofday() will return the elapsed "wall clock" + * time. + * + * This is done by updating the global structures "alt_resettime" and + * "alt_timezone" so that an immediate call to gettimeofday() would return + * the value specified by "t" and "tz". + * + * Warning: if this function is called concurrently with a call to + * gettimeofday(), the value returned by gettimeofday() will be unreliable. + * + * ALT_SETTIMEOFDAY is mapped onto the settimeofday() system call in + * alt_syscall.h + */ + +int ALT_SETTIMEOFDAY (const struct timeval *t, + const struct timezone *tz) +{ + alt_u32 nticks = alt_nticks (); + alt_u32 tick_rate = alt_ticks_per_second (); + + /* If there is a system clock available, update the current time */ + + if (tick_rate) + { + alt_resettime.tv_sec = t->tv_sec - nticks/tick_rate; + alt_resettime.tv_usec = t->tv_usec - + ((nticks*(ALT_US/tick_rate))%ALT_US); + + alt_timezone.tz_minuteswest = tz->tz_minuteswest; + alt_timezone.tz_dsttime = tz->tz_dsttime; + + return 0; + } + + /* There's no system clock available */ + + ALT_ERRNO = ENOSYS; + return -1; +} Index: components/sd_card/firmware/bsp/HAL/src/alt_lseek.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_lseek.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_lseek.c (revision 8) @@ -0,0 +1,117 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004-2005 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include + +#include "sys/alt_errno.h" +#include "sys/alt_warning.h" +#include "priv/alt_file.h" +#include "os/alt_syscall.h" + +#ifdef ALT_USE_DIRECT_DRIVERS + +off_t ALT_LSEEK (int file, off_t ptr, int dir) +{ + /* Generate a link time warning, should this function ever be called. */ + + ALT_STUB_WARNING(lseek); + + /* Indicate an error */ + + ALT_ERRNO = ENOSYS; + return -1; +} + +#else /* !ALT_USE_DIRECT_DRIVERS */ + +/* + * lseek() can be called to move the read/write pointer associated with the + * file descriptor "file". This function simply vectors the call to the lseek() + * function provided by the driver associated with the file descriptor. + * + * If the driver does not provide an implementation of lseek() an error is + * indicated. + * + * lseek() corresponds to the standard lseek() function. + * + * ALT_LSEEK is mapped onto the lseek() system call in alt_syscall.h + * + */ + +off_t ALT_LSEEK (int file, off_t ptr, int dir) +{ + alt_fd* fd; + off_t rc = 0; + + /* + * A common error case is that when the file descriptor was created, the call + * to open() failed resulting in a negative file descriptor. This is trapped + * below so that we don't try and process an invalid file descriptor. + */ + + fd = (file < 0) ? NULL : &alt_fd_list[file]; + + if (fd) + { + /* + * If the device driver provides an implementation of the lseek() function, + * then call that to process the request. + */ + + if (fd->dev->lseek) + { + rc = fd->dev->lseek(fd, ptr, dir); + } + /* + * Otherwise return an error. + */ + + else + { + rc = -ENOTSUP; + } + } + else + { + rc = -EBADFD; + } + + if (rc < 0) + { + ALT_ERRNO = -rc; + rc = -1; + } + + return rc; +} + +#endif /* ALT_USE_DIRECT_DRIVERS */ Index: components/sd_card/firmware/bsp/HAL/src/alt_exception_trap.S =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_exception_trap.S (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_exception_trap.S (revision 8) @@ -0,0 +1,81 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2003-2005 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +******************************************************************************/ + + /* + * This is the trap exception handler for Nios2. + */ + + /* + * Provide a label which can be used to pull this file in. + */ + + .section .exceptions.start + .globl alt_exception_trap +alt_exception_trap: + + /* + * Pull in the entry/exit code. + */ + .globl alt_exception + + .section .exceptions.soft, "xa" + +.Ltrap_handler: + + /* + * Did a trap instruction cause the exception? + * + * The instruction which the exception occurred on has been loaded + * into r2 by code in alt_exception_entry.S + * + */ + + movhi r3,0x003b /* upper half of trap opcode */ + ori r3,r3,0x683a /* lower half of trap opcode */ + bne r2,r3,.Lnot_trap + + /* + * There is no trap handler defined here, and so executing a trap + * instruction causes a software break. If you provide a trap handler, + * then you must replace the break instruction below with your handler. + * Your handler must preserve ea and the usual callee saved registers. + */ + + break + + br .Lexception_exit + +.Lnot_trap: + + + .section .exceptions.exit.label +.Lexception_exit: + + Index: components/sd_card/firmware/bsp/HAL/src/alt_putchar.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_putchar.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_putchar.c (revision 8) @@ -0,0 +1,59 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2006 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include + +#ifdef ALT_USE_DIRECT_DRIVERS +#include "system.h" +#include "sys/alt_driver.h" +#include "sys/alt_stdio.h" +#endif + +/* + * Uses the ALT_DRIVER_WRITE() macro to call directly to driver if available. + * Otherwise, uses newlib provided putchar() routine. + */ +int +alt_putchar(int c) +{ +#ifdef ALT_USE_DIRECT_DRIVERS + ALT_DRIVER_WRITE_EXTERNS(ALT_STDOUT_DEV); + char c1 = (char)(c & 0xff); + + if (ALT_DRIVER_WRITE(ALT_STDOUT_DEV, &c1, 1, 0) == -1) { + return -1; + } + return c; +#else + return putchar(c); +#endif +} Index: components/sd_card/firmware/bsp/HAL/src/alt_isatty.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_isatty.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_isatty.c (revision 8) @@ -0,0 +1,125 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2006 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include +#include + +#include "sys/alt_dev.h" +#include "sys/alt_errno.h" +#include "sys/alt_warning.h" +#include "priv/alt_file.h" +#include "os/alt_syscall.h" + +#ifdef ALT_USE_DIRECT_DRIVERS + +#include "system.h" + +/* + * Provide minimal version that just describes all file descriptors + * as tty devices for provided stdio devices. + */ +int ALT_ISATTY (int file) +{ + switch (file) { +#ifdef ALT_STDIN_PRESENT + case 0: /* stdin file descriptor */ +#endif /* ALT_STDIN_PRESENT */ +#ifdef ALT_STDOUT_PRESENT + case 1: /* stdout file descriptor */ +#endif /* ALT_STDOUT_PRESENT */ +#ifdef ALT_STDERR_PRESENT + case 2: /* stderr file descriptor */ +#endif /* ALT_STDERR_PRESENT */ + return 1; + default: + return 0; + } + +#if !defined(ALT_STDIN_PRESENT) && !defined(ALT_STDOUT_PRESENT) && !defined(ALT_STDERR_PRESENT) + /* Generate a link time warning, should this function ever be called. */ + ALT_STUB_WARNING(isatty); +#endif +} + +#else /* !ALT_USE_DIRECT_DRIVERS */ +/* + * isatty() can be used to determine whether the input file descriptor "file" + * refers to a terminal device or not. If it is a terminal device then the + * return value is one, otherwise it is zero. + * + * ALT_ISATTY is mapped onto the isatty() system call in alt_syscall.h + */ + +int ALT_ISATTY (int file) +{ + alt_fd* fd; + struct stat stat; + + /* + * A common error case is that when the file descriptor was created, the call + * to open() failed resulting in a negative file descriptor. This is trapped + * below so that we don't try and process an invalid file descriptor. + */ + + fd = (file < 0) ? NULL : &alt_fd_list[file]; + + if (fd) + { + /* + * If a device driver does not provide an fstat() function, then it is + * treated as a terminal device by default. + */ + + if (!fd->dev->fstat) + { + return 1; + } + + /* + * If a driver does provide an implementation of the fstat() function, then + * this is called so that the device can identify itself. + */ + + else + { + fstat (file, &stat); + return (stat.st_mode == _IFCHR) ? 1 : 0; + } + } + else + { + ALT_ERRNO = EBADFD; + return 0; + } +} + +#endif /* ALT_USE_DIRECT_DRIVERS */ Index: components/sd_card/firmware/bsp/HAL/src/alt_dev.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_dev.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_dev.c (revision 8) @@ -0,0 +1,149 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include +#include +#include +#include +#include + +#include "sys/alt_dev.h" +#include "priv/alt_file.h" + +#include "alt_types.h" + +#include "system.h" + +/* + * This file contains the data constructs used to control access to device and + * filesytems. + */ + +/* + * "alt_fs_list" is the head of a linked list of registered filesystems. It is + * initialised as an empty list. New entries can be added using the + * alt_fs_reg() function. + */ + +ALT_LLIST_HEAD(alt_fs_list); + + +/* + * "alt_dev_list" is the head of a linked list of registered devices. It is + * configured at startup to include a single device, "alt_dev_null". This + * device is discussed below. + */ + +extern alt_dev alt_dev_null; /* forward declaration */ + +alt_llist alt_dev_list = {&alt_dev_null.llist, &alt_dev_null.llist}; + +/* + * alt_dev_null_write() is the implementation of the write() function used + * by the alt_dev_null device. It simple discards all data passed to it, and + * indicates that the data has been successfully transmitted. + */ + +static int alt_dev_null_write (alt_fd* fd, const char* ptr, int len) +{ + return len; +} + +/* + * "alt_dev_null" is used to allow output to be redirected to nowhere. It is + * the only device registered before the call to alt_sys_init(). At startup + * stin, stdout & stderr are all directed towards this device so that library + * calls like printf() will be safe but inefectual. + */ + +alt_dev alt_dev_null = { + { + &alt_dev_list, + &alt_dev_list + }, + "/dev/null", + NULL, /* open */ + NULL, /* close */ + NULL, /* write */ + alt_dev_null_write, /* write */ + NULL, /* lseek */ + NULL, /* fstat */ + NULL /* ioctl */ + }; + +/* + * "alt_fd_list_lock" is a semaphore used to control access to the file + * descriptor list. This is used to ensure that access to the list is thread + * safe. + */ + +ALT_SEM(alt_fd_list_lock) + +/* + * "alt_max_fd" is used to make access to the file descriptor list more + * efficent. It is set to be the value of the highest allocated file + * descriptor. This saves having to search the entire pool of unallocated + * file descriptors when looking for a match. + */ + +alt_32 alt_max_fd = -1; + +/* + * "alt_fd_list" is the file descriptor pool. The first three entries in the + * array are configured as standard in, standard out, and standard error. These + * are all initialised so that accesses are directed to the alt_dev_null + * device. The remaining file descriptors are initialised as unallocated. + * + * The maximum number of file descriptors within the system is specified by the + * user defined macro "ALT_MAX_FD". This is defined in "system.h", which is + * auto-genereated using the projects PTF and STF files. + */ + +alt_fd alt_fd_list[ALT_MAX_FD] = + { + { + &alt_dev_null, /* standard in */ + 0, + 0 + }, + { + &alt_dev_null, /* standard out */ + 0, + 0 + }, + { + &alt_dev_null, /* standard error */ + 0, + 0 + } + /* all other elements are set to zero */ + }; Index: components/sd_card/firmware/bsp/HAL/src/alt_malloc_lock.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_malloc_lock.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_malloc_lock.c (revision 8) @@ -0,0 +1,52 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include + +/* + * These are the empty malloc lock/unlock stubs required by newlib. These are + * used to make newlib's malloc() function thread safe. The default HAL + * configuration is single threaded, so there is nothing to do here. Note that + * this requires that malloc is never called by an interrupt service routine. + */ + +void __malloc_lock ( struct _reent *_r ) +{ +} + +/* + * + */ + +void __malloc_unlock ( struct _reent *_r ) +{ +} Index: components/sd_card/firmware/bsp/HAL/src/alt_main.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_main.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_main.c (revision 8) @@ -0,0 +1,161 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2007 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include +#include +#include +#include +#include +#include + +#include "sys/alt_dev.h" +#include "sys/alt_sys_init.h" +#include "sys/alt_irq.h" +#include "sys/alt_dev.h" + +#include "os/alt_hooks.h" + +#include "priv/alt_file.h" +#include "alt_types.h" + +#include "system.h" + +#include "sys/alt_log_printf.h" + +extern void _do_ctors(void); +extern void _do_dtors(void); + +/* + * Standard arguments for main. By default, no arguments are passed to main. + * However a device driver may choose to configure these arguments by calling + * alt_set_args(). The expectation is that this facility will only be used by + * the iclient/ihost utility. + */ + +int alt_argc = 0; +char** alt_argv = {NULL}; +char** alt_envp = {NULL}; + +/* + * Prototype for the entry point to the users application. + */ + +extern int main (int, char **, char **); + +/* + * alt_main is the C entry point for the HAL. It is called by the assembler + * startup code in the processor specific crt0.S. It is responsible for: + * completing the C runtime configuration; configuring all the + * devices/filesystems/components in the system; and call the entry point for + * the users application, i.e. main(). + */ + +void alt_main (void) +{ +#ifndef ALT_NO_EXIT + int result; +#endif + + /* ALT LOG - please see HAL/sys/alt_log_printf.h for details */ + ALT_LOG_PRINT_BOOT("[alt_main.c] Entering alt_main, calling alt_irq_init.\r\n"); + /* Initialize the interrupt controller. */ + alt_irq_init (NULL); + + /* Initialize the operating system */ + ALT_LOG_PRINT_BOOT("[alt_main.c] Done alt_irq_init, calling alt_os_init.\r\n"); + ALT_OS_INIT(); + + /* + * Initialize the semaphore used to control access to the file descriptor + * list. + */ + + ALT_LOG_PRINT_BOOT("[alt_main.c] Done OS Init, calling alt_sem_create.\r\n"); + ALT_SEM_CREATE (&alt_fd_list_lock, 1); + + /* Initialize the device drivers/software components. */ + ALT_LOG_PRINT_BOOT("[alt_main.c] Calling alt_sys_init.\r\n"); + alt_sys_init(); + ALT_LOG_PRINT_BOOT("[alt_main.c] Done alt_sys_init.\r\n"); + +#if !defined(ALT_USE_DIRECT_DRIVERS) && (defined(ALT_STDIN_PRESENT) || defined(ALT_STDOUT_PRESENT) || defined(ALT_STDERR_PRESENT)) + + /* + * Redirect stdio to the apropriate devices now that the devices have + * been initialized. This is only done if the user has requested these + * devices be present (not equal to /dev/null) and if direct drivers + * aren't being used. + */ + + ALT_LOG_PRINT_BOOT("[alt_main.c] Redirecting IO.\r\n"); + alt_io_redirect(ALT_STDOUT, ALT_STDIN, ALT_STDERR); +#endif + +#ifndef ALT_NO_C_PLUS_PLUS + /* + * Call the C++ constructors + */ + + ALT_LOG_PRINT_BOOT("[alt_main.c] Calling C++ constructors.\r\n"); + _do_ctors (); +#endif /* ALT_NO_C_PLUS_PLUS */ + +#if !defined(ALT_NO_C_PLUS_PLUS) && !defined(ALT_NO_CLEAN_EXIT) && !defined(ALT_NO_EXIT) + /* + * Set the C++ destructors to be called at system shutdown. This is only done + * if a clean exit has been requested (i.e. the exit() function has not been + * redefined as _exit()). This is in the interest of reducing code footprint, + * in that the atexit() overhead is removed when it's not needed. + */ + + ALT_LOG_PRINT_BOOT("[alt_main.c] Calling atexit.\r\n"); + atexit (_do_dtors); +#endif + + /* + * Finally, call main(). The return code is then passed to a subsequent + * call to exit() unless the application is never supposed to exit. + */ + + ALT_LOG_PRINT_BOOT("[alt_main.c] Calling main.\r\n"); + +#ifdef ALT_NO_EXIT + main (alt_argc, alt_argv, alt_envp); +#else + result = main (alt_argc, alt_argv, alt_envp); + close(STDOUT_FILENO); + exit (result); +#endif + + ALT_LOG_PRINT_BOOT("[alt_main.c] After main - we should not be here?.\r\n"); +} + Index: components/sd_card/firmware/bsp/HAL/src/alt_errno.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_errno.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_errno.c (revision 8) @@ -0,0 +1,44 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +/* + * This file defines the alt_errno global variable. See comments in + * alt_errno.h for the use of this variable. + */ + + +#include "sys/alt_errno.h" +#include "alt_types.h" + +extern int ALT_WEAK *__errno (void); + +int* (*alt_errno) (void) = __errno; Index: components/sd_card/firmware/bsp/HAL/src/alt_iic_isr_register.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_iic_isr_register.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_iic_isr_register.c (revision 8) @@ -0,0 +1,104 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2009 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ +#include +#include "system.h" + +/* + * Provides an interrupt registry mechanism for the any CPUs internal interrupt + * controller (IIC) when the enhanced interrupt API is active. + */ +#ifndef ALT_CPU_EIC_PRESENT +#ifdef ALT_ENHANCED_INTERRUPT_API_PRESENT + +#include "alt_types.h" +#include "sys/alt_irq.h" +#include "priv/alt_iic_isr_register.h" + +/* + * The header, alt_irq_entry.h, contains the exception entry point, and is + * provided by the processor component. It is included here, so that the code + * will be added to the executable only if alt_irq_register() is present, i.e. + * if no interrupts are registered - there's no need to provide any + * interrupt handling. + */ + +#include "sys/alt_irq_entry.h" + +/* + * The header, alt_irq_table.h contains a table describing which function + * handles each interrupt. + */ + +#include "priv/alt_irq_table.h" + +/** @Function Description: This function registers an interrupt handler. + * If the function is succesful, then the requested interrupt will be enabled + * upon return. Registering a NULL handler will disable the interrupt. + * + * @API Type: External + * @param ic_id Interrupt controller ID + * @param irq IRQ ID number + * @param isr Pointer to interrupt service routine + * @param isr_context Opaque pointer passed to ISR + * @param flags + * @return 0 if successful, else error (-1) + */ +int alt_iic_isr_register(alt_u32 ic_id, alt_u32 irq, alt_isr_func isr, + void *isr_context, void *flags) +{ + int rc = -EINVAL; + int id = irq; /* IRQ interpreted as the interrupt ID. */ + alt_irq_context status; + + if (id < ALT_NIRQ) + { + /* + * interrupts are disabled while the handler tables are updated to ensure + * that an interrupt doesn't occur while the tables are in an inconsistant + * state. + */ + + status = alt_irq_disable_all(); + + alt_irq[id].handler = isr; + alt_irq[id].context = isr_context; + + rc = (isr) ? alt_ic_irq_enable(ic_id, id) : alt_ic_irq_disable(ic_id, id); + + alt_irq_enable_all(status); + } + + return rc; +} + +#endif /* ALT_ENHANCED_INTERRUPT_API_PRESENT */ +#endif /* ALT_CPU_EIC_PRESENT */ Index: components/sd_card/firmware/bsp/HAL/src/alt_dma_rxchan_open.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_dma_rxchan_open.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_dma_rxchan_open.c (revision 8) @@ -0,0 +1,63 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include "sys/alt_dma.h" +#include "sys/alt_errno.h" +#include "priv/alt_file.h" + +/* + * The list of registered DMA receive channels. + */ + +ALT_LLIST_HEAD(alt_dma_rxchan_list); + +/* + * alt_dma_txchan_open() is used to obtain an "alt_dma_txchan" descriptor for + * a DMA transmit device. The name is the name of the associated physical + * device (e.g. "/dev/dma_0"). + * + * The return value will be NULL on failure, and non-NULL otherwise. + */ + +alt_dma_rxchan alt_dma_rxchan_open (const char* name) +{ + alt_dma_rxchan dev; + + dev = (alt_dma_rxchan) alt_find_dev (name, &alt_dma_rxchan_list); + + if (!dev) + { + ALT_ERRNO = ENODEV; + } + + return dev; +} Index: components/sd_card/firmware/bsp/HAL/src/alt_dma_txchan_open.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_dma_txchan_open.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_dma_txchan_open.c (revision 8) @@ -0,0 +1,63 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include "sys/alt_dma.h" +#include "sys/alt_errno.h" +#include "priv/alt_file.h" + +/* + * The list of registered receive channels. + */ + +ALT_LLIST_HEAD(alt_dma_txchan_list); + +/* + * alt_dma_txchan_open() is used to obtain an "alt_dma_txchan" descriptor for + * a DMA transmit device. The name is the name of the associated physical + * device (e.g. "/dev/dma_0"). + * + * The return value will be NULL on failure, and non-NULL otherwise. + */ + +alt_dma_txchan alt_dma_txchan_open (const char* name) +{ + alt_dma_txchan dev; + + dev = (alt_dma_txchan) alt_find_dev (name, &alt_dma_txchan_list); + + if (!dev) + { + ALT_ERRNO = ENODEV; + } + + return dev; +} Index: components/sd_card/firmware/bsp/HAL/src/alt_software_exception.S =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_software_exception.S (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_software_exception.S (revision 8) @@ -0,0 +1,53 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2003-2005 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +******************************************************************************/ + + /* + * This file provides the global symbol: software_exception. It is provided to + * support legacy code, and should not be used by new software. + * + * It is used by legacy code to invoke the software exception handler as + * defined by version 1.0 of the Nios II kit. It should only be used when you + * are providing your own interrupt entry point, i.e. you are not using + * alt_irq_entry. + */ + +#include "system.h" + + /* + * Pull in the exception handler. + */ + + .globl alt_exception + + .section .exceptions.entry.label, "xa" + + .globl software_exception + .type software_exception, @function +software_exception: Index: components/sd_card/firmware/bsp/HAL/src/alt_irq_handler.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_irq_handler.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_irq_handler.c (revision 8) @@ -0,0 +1,169 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2009 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include +#include "system.h" + +/* + * This interrupt handler only works with an internal interrupt controller + * (IIC). Processors with an external interrupt controller (EIC) use an + * implementation provided by an EIC driver. + */ +#ifndef ALT_CPU_EIC_PRESENT + +#include "sys/alt_irq.h" +#include "os/alt_hooks.h" + +#include "alt_types.h" + +/* + * A table describing each interrupt handler. The index into the array is the + * interrupt id associated with the handler. + * + * When an interrupt occurs, the associated handler is called with + * the argument stored in the context member. + */ +struct ALT_IRQ_HANDLER +{ +#ifdef ALT_ENHANCED_INTERRUPT_API_PRESENT + void (*handler)(void*); +#else + void (*handler)(void*, alt_u32); +#endif + void *context; +} alt_irq[ALT_NIRQ]; + +/* + * alt_irq_handler() is called by the interrupt exception handler in order to + * process any outstanding interrupts. + * + * It is defined here since it is linked in using weak linkage. + * This means that if there is never a call to alt_irq_register() (above) then + * this function will not get linked in to the executable. This is acceptable + * since if no handler is ever registered, then an interrupt can never occur. + * + * If Nios II interrupt vector custom instruction exists, use it to accelerate + * the dispatch of interrupt handlers. The Nios II interrupt vector custom + * instruction is present if the macro ALT_CI_INTERRUPT_VECTOR defined. + */ + +void alt_irq_handler (void) __attribute__ ((section (".exceptions"))); +void alt_irq_handler (void) +{ +#ifdef ALT_CI_INTERRUPT_VECTOR + alt_32 offset; + char* alt_irq_base = (char*)alt_irq; +#else + alt_u32 active; + alt_u32 mask; + alt_u32 i; +#endif /* ALT_CI_INTERRUPT_VECTOR */ + + /* + * Notify the operating system that we are at interrupt level. + */ + + ALT_OS_INT_ENTER(); + +#ifdef ALT_CI_INTERRUPT_VECTOR + /* + * Call the interrupt vector custom instruction using the + * ALT_CI_INTERRUPT_VECTOR macro. + * It returns the offset into the vector table of the lowest-valued pending + * interrupt (corresponds to highest priority) or a negative value if none. + * The custom instruction assumes that each table entry is eight bytes. + */ + while ((offset = ALT_CI_INTERRUPT_VECTOR) >= 0) { + struct ALT_IRQ_HANDLER* handler_entry = + (struct ALT_IRQ_HANDLER*)(alt_irq_base + offset); +#ifdef ALT_ENHANCED_INTERRUPT_API_PRESENT + handler_entry->handler(handler_entry->context); +#else + handler_entry->handler(handler_entry->context, offset >> 3); +#endif + } +#else /* ALT_CI_INTERRUPT_VECTOR */ + /* + * Obtain from the interrupt controller a bit list of pending interrupts, + * and then process the highest priority interrupt. This process loops, + * loading the active interrupt list on each pass until alt_irq_pending() + * return zero. + * + * The maximum interrupt latency for the highest priority interrupt is + * reduced by finding out which interrupts are pending as late as possible. + * Consider the case where the high priority interupt is asserted during + * the interrupt entry sequence for a lower priority interrupt to see why + * this is the case. + */ + + active = alt_irq_pending (); + + do + { + i = 0; + mask = 1; + + /* + * Test each bit in turn looking for an active interrupt. Once one is + * found, the interrupt handler asigned by a call to alt_irq_register() is + * called to clear the interrupt condition. + */ + + do + { + if (active & mask) + { +#ifdef ALT_ENHANCED_INTERRUPT_API_PRESENT + alt_irq[i].handler(alt_irq[i].context); +#else + alt_irq[i].handler(alt_irq[i].context, i); +#endif + break; + } + mask <<= 1; + i++; + + } while (1); + + active = alt_irq_pending (); + + } while (active); +#endif /* ALT_CI_INTERRUPT_VECTOR */ + + /* + * Notify the operating system that interrupt processing is complete. + */ + + ALT_OS_INT_EXIT(); +} + +#endif /* ALT_CPU_EIC_PRESENT */ Index: components/sd_card/firmware/bsp/HAL/src/alt_link.c =================================================================== --- components/sd_card/firmware/bsp/HAL/src/alt_link.c (nonexistent) +++ components/sd_card/firmware/bsp/HAL/src/alt_link.c (revision 8) @@ -0,0 +1,56 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include "sys/alt_warning.h" +#include "sys/alt_errno.h" +#include "os/alt_syscall.h" + +/* + * link() is used by newlib to create a new link to an existing file. This is + * unsupported in the HAL environment. However a "do-nothing" implementation + * is still provied for newlib compatability. + * + * ALT_LINK is mapped onto the link() system call in alt_syscall.h + */ + +int ALT_LINK ( char *existing, char *new) +{ + /* Generate a link time warning, should this function ever be called. */ + + ALT_STUB_WARNING(link); + + /* Indicate an error */ + + ALT_ERRNO = ENOSYS; + return -1; +} + Index: components/sd_card/firmware/bsp/HAL/inc/priv/alt_busy_sleep.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/priv/alt_busy_sleep.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/priv/alt_busy_sleep.h (revision 8) @@ -0,0 +1,35 @@ +#ifndef __ALT_BUSY_SLEEP_H +#define __ALT_BUSY_SLEEP_H + +/* + * Copyright (c) 2003 Altera Corporation, San Jose, California, USA. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/* + * The function alt_busy_sleep provides a busy loop implementation of usleep. + * This is used to provide usleep for the standalone HAL, or when the timer is + * unavailable in uC/OS-II. + */ + +extern unsigned int alt_busy_sleep (unsigned int us); + +#endif /* __ALT_BUSY_SLEEP_H */ Index: components/sd_card/firmware/bsp/HAL/inc/priv/alt_alarm.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/priv/alt_alarm.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/priv/alt_alarm.h (revision 8) @@ -0,0 +1,101 @@ +#ifndef __ALT_PRIV_ALARM_H__ +#define __ALT_PRIV_ALARM_H__ + +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +/****************************************************************************** +* * +* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. * +* * +******************************************************************************/ + +#include "alt_types.h" + +/* + * This header provides the internal defenitions required by the public + * interface alt_alarm.h. These variables and structures are not guaranteed to + * exist in future implementations of the HAL. + */ + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +/* + * "alt_alarm_s" is a structure type used to maintain lists of alarm callback + * functions. + */ + +struct alt_alarm_s +{ + alt_llist llist; /* linked list */ + alt_u32 time; /* time in system ticks of the callback */ + alt_u32 (*callback) (void* context); /* callback function. The return + * value is the period for the next callback; where + * zero indicates that the alarm should be removed + * from the list. + */ + alt_u8 rollover; /* set when desired alarm time + current time causes + overflow, to prevent premature alarm */ + void* context; /* Argument for the callback */ +}; + +/* + * "_alt_tick_rate" is a global variable used to store the system clock rate + * in ticks per second. This is initialised to zero, which coresponds to there + * being no system clock available. + * + * It is then set to it's final value by the system clock driver through a call + * to alt_sysclk_init(). + */ + +extern alt_u32 _alt_tick_rate; + +/* + * "_alt_nticks" is a global variable which records the elapsed number of + * system clock ticks since the last call to settimeofday() or since reset if + * settimeofday() has not been called. + */ + +extern volatile alt_u32 _alt_nticks; + +/* The list of registered alarms. */ + +extern alt_llist alt_alarm_list; + +#ifdef __cplusplus +} +#endif + +#endif /* __ALT_PRIV_ALARM_H__ */ Index: components/sd_card/firmware/bsp/HAL/inc/priv/alt_file.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/priv/alt_file.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/priv/alt_file.h (revision 8) @@ -0,0 +1,179 @@ +#ifndef __ALT_FILE_H__ +#define __ALT_FILE_H__ + +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +/****************************************************************************** +* * +* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. * +* * +******************************************************************************/ + +#include "sys/alt_dev.h" +#include "sys/alt_llist.h" +#include "os/alt_sem.h" + +#include "alt_types.h" + +/* + * This header provides the internal defenitions required to control file + * access. These variables and functions are not guaranteed to exist in + * future implementations of the HAL. + */ + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +/* + * The function alt_find_dev() is used to search the device list "list" to + * locate a device named "name". If a match is found, then a pointer to the + * device is returned, otherwise NULL is returned. + */ + +extern alt_dev* alt_find_dev (const char* name, alt_llist* list); + +/* + * alt_find_file() is used to search the list of registered file systems to + * find the filesystem that the file named "name" belongs to. If a match is + * found, then a pointer to the filesystems alt_dev structure is returned, + * otherwise NULL is returned. + * + * Note that a match does not indicate that the file exists, only that a + * filesystem exists that is registered for a partition that could contain + * the file. The filesystems open() function would need to be called in order + * to determine if the file exists. + */ + +extern alt_dev* alt_find_file (const char* name); + +/* + * alt_get_fd() is used to allocate a file descriptor for the device or + * filesystem "dev". A negative return value indicates an error, otherwise the + * return value is the index of the file descriptor within the file descriptor + * pool. + */ + +extern int alt_get_fd (alt_dev* dev); + +/* + * alt_release_fd() is called to free the file descriptor with index "fd". + */ + +extern void alt_release_fd (int fd); + +/* + * alt_fd_lock() is called by ioctl() to mark the file descriptor "fd" as + * being open for exclusive access. Subsequent calls to open() for the device + * associated with "fd" will fail. A device is unlocked by either calling + * close() for "fd", or by an alternate call to ioctl() (see ioctl.c for + * details). + */ + +extern int alt_fd_lock (alt_fd* fd); + +/* + * alt_fd_unlock() is called by ioctl() to unlock a descriptor previously + * locked by a call to alt_fd_lock(). + */ + +extern int alt_fd_unlock (alt_fd* fd); + +/* + * "alt_fd_list" is the pool of file descriptors. + */ + +extern alt_fd alt_fd_list[]; + +/* + * flags used by alt_fd. + * + * ALT_FD_EXCL is used to mark a file descriptor as locked for exclusive + * access, i.e. further calls to open() for the associated device should + * fail. + * + * ALT_FD_DEV marks a dile descriptor as belonging to a device as oposed to a + * filesystem. + */ + +#define ALT_FD_EXCL 0x80000000 +#define ALT_FD_DEV 0x40000000 + +#define ALT_FD_FLAGS_MASK (ALT_FD_EXCL | ALT_FD_DEV) + +/* + * "alt_dev_list" is the head of the linked list of registered devices. + */ + +extern alt_llist alt_dev_list; + +/* + * "alt_fs_list" is the head of the linked list of registered filesystems. + */ + +extern alt_llist alt_fs_list; + +/* + * "alt_fd_list_lock" is a semaphore used to ensure that access to the pool + * of file descriptors is thread safe. + */ + +ALT_EXTERN_SEM(alt_fd_list_lock) + +/* + * "alt_max_fd" is a 'high water mark'. It indicates the highest file + * descriptor allocated. Use of this can save searching the entire pool + * for active file descriptors, which helps avoid contention on access + * to the file descriptor pool. + */ + +extern alt_32 alt_max_fd; + +/* + * alt_io_redirect() is called at startup to redirect stdout, stdin, and + * stderr to the devices named in the input arguments. By default these streams + * are directed at /dev/null, and are then redirected using this function once + * all of the devices have been registered within the system. + */ + +extern void alt_io_redirect(const char* stdout_dev, + const char* stdin_dev, + const char* stderr_dev); + + +#ifdef __cplusplus +} +#endif + +#endif /* __ALT_FILE_H__ */ Index: components/sd_card/firmware/bsp/HAL/inc/priv/alt_legacy_irq.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/priv/alt_legacy_irq.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/priv/alt_legacy_irq.h (revision 8) @@ -0,0 +1,158 @@ +#ifndef __ALT_LEGACY_IRQ_H__ +#define __ALT_LEGACY_IRQ_H__ + +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2009 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +******************************************************************************/ + +/* + * This file provides prototypes and inline implementations of certain routines + * used by the legacy interrupt API. Do not include this in your driver or + * application source files, use "sys/alt_irq.h" instead to access the proper + * public API. + */ + +#include +#include "system.h" + +#ifndef NIOS2_EIC_PRESENT + +#include "nios2.h" +#include "alt_types.h" + +#include "sys/alt_irq.h" + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +/* + * alt_irq_register() can be used to register an interrupt handler. If the + * function is succesful, then the requested interrupt will be enabled upon + * return. + */ +extern int alt_irq_register (alt_u32 id, + void* context, + alt_isr_func handler); + +/* + * alt_irq_disable() disables the individual interrupt indicated by "id". + */ +static ALT_INLINE int ALT_ALWAYS_INLINE alt_irq_disable (alt_u32 id) +{ + alt_irq_context status; + extern volatile alt_u32 alt_irq_active; + + status = alt_irq_disable_all (); + + alt_irq_active &= ~(1 << id); + NIOS2_WRITE_IENABLE (alt_irq_active); + + alt_irq_enable_all(status); + + return 0; +} + +/* + * alt_irq_enable() enables the individual interrupt indicated by "id". + */ +static ALT_INLINE int ALT_ALWAYS_INLINE alt_irq_enable (alt_u32 id) +{ + alt_irq_context status; + extern volatile alt_u32 alt_irq_active; + + status = alt_irq_disable_all (); + + alt_irq_active |= (1 << id); + NIOS2_WRITE_IENABLE (alt_irq_active); + + alt_irq_enable_all(status); + + return 0; +} + +#ifndef ALT_EXCEPTION_STACK +/* + * alt_irq_initerruptable() should only be called from within an ISR. It is used + * to allow higer priority interrupts to interrupt the current ISR. The input + * argument, "priority", is the priority, i.e. interrupt number of the current + * interrupt. + * + * If this function is called, then the ISR is required to make a call to + * alt_irq_non_interruptible() before returning. The input argument to + * alt_irq_non_interruptible() is the return value from alt_irq_interruptible(). + * + * Care should be taken when using this pair of functions, since they increasing + * the system overhead associated with interrupt handling. + * + * If you are using an exception stack then nested interrupts won't work, so + * these functions are not available in that case. + */ +static ALT_INLINE alt_u32 ALT_ALWAYS_INLINE alt_irq_interruptible (alt_u32 priority) +{ + extern volatile alt_u32 alt_priority_mask; + extern volatile alt_u32 alt_irq_active; + + alt_u32 old_priority; + + old_priority = alt_priority_mask; + alt_priority_mask = (1 << priority) - 1; + + NIOS2_WRITE_IENABLE (alt_irq_active & alt_priority_mask); + + NIOS2_WRITE_STATUS (1); + + return old_priority; +} + +/* + * See Comments above for alt_irq_interruptible() for an explanation of the use of this + * function. + */ +static ALT_INLINE void ALT_ALWAYS_INLINE alt_irq_non_interruptible (alt_u32 mask) +{ + extern volatile alt_u32 alt_priority_mask; + extern volatile alt_u32 alt_irq_active; + + NIOS2_WRITE_STATUS (0); + + alt_priority_mask = mask; + + NIOS2_WRITE_IENABLE (mask & alt_irq_active); +} +#endif /* ALT_EXCEPTION_STACK */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* NIOS2_EIC_PRESENT */ + +#endif /* __ALT_LEGACY_IRQ_H__ */ Index: components/sd_card/firmware/bsp/HAL/inc/priv/alt_irq_table.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/priv/alt_irq_table.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/priv/alt_irq_table.h (revision 8) @@ -0,0 +1,59 @@ +#ifndef __ALT_IRQ_TABLE_H__ +#define __ALT_IRQ_TABLE_H__ + +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2009 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +******************************************************************************/ + +/****************************************************************************** +* * +* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. * +* * +******************************************************************************/ + +/* + * Definition of a table describing each interrupt handler. The index into + * the array is the interrupt id associated with the handler. + * + * When an interrupt occurs, the associated handler is called with + * the argument stored in the context member. + * + * The table is physically created in alt_irq_handler.c + */ +extern struct ALT_IRQ_HANDLER +{ +#ifdef ALT_ENHANCED_INTERRUPT_API_PRESENT + void (*handler)(void*); +#else + void (*handler)(void*, alt_u32); +#endif + void *context; +} alt_irq[ALT_NIRQ]; + +#endif Index: components/sd_card/firmware/bsp/HAL/inc/priv/alt_exception_handler_registry.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/priv/alt_exception_handler_registry.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/priv/alt_exception_handler_registry.h (revision 8) @@ -0,0 +1,39 @@ +#ifndef __ALT_EXCEPTION_HANDLER_REGISTRY_H__ +#define __ALT_EXCEPTION_HANDLER_REGISTRY_H__ + +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2008 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +******************************************************************************/ +#include "sys/alt_exceptions.h" + +/* Function pointer to exception callback routine */ +extern alt_exception_result (*alt_instruction_exception_handler) + (alt_exception_cause, alt_u32, alt_u32); + +#endif /* __ALT_EXCEPTION_HANDLER_REGISTRY_H__ */ Index: components/sd_card/firmware/bsp/HAL/inc/priv/nios2_gmon_data.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/priv/nios2_gmon_data.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/priv/nios2_gmon_data.h (revision 8) @@ -0,0 +1,47 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2003 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +******************************************************************************/ +#ifndef NIOS2_GMON_DATA_H +#define NIOS2_GMON_DATA_H + +#define GMON_DATA_SIG 0 +#define GMON_DATA_WORDS 1 +#define GMON_DATA_PROFILE_DATA 2 +#define GMON_DATA_PROFILE_LOWPC 3 +#define GMON_DATA_PROFILE_HIGHPC 4 +#define GMON_DATA_PROFILE_BUCKET 5 +#define GMON_DATA_PROFILE_RATE 6 +#define GMON_DATA_MCOUNT_START 7 +#define GMON_DATA_MCOUNT_LIMIT 8 + +#define GMON_DATA_SIZE 9 + +extern unsigned int alt_gmon_data[GMON_DATA_SIZE]; + +#endif Index: components/sd_card/firmware/bsp/HAL/inc/priv/alt_dev_llist.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/priv/alt_dev_llist.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/priv/alt_dev_llist.h (revision 8) @@ -0,0 +1,77 @@ +#ifndef __ALT_DEV_LLIST_H__ +#define __ALT_DEV_LLIST_H__ + +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +/****************************************************************************** +* * +* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. * +* * +******************************************************************************/ + +#include "sys/alt_llist.h" +#include "alt_types.h" + +/* + * This header provides the internal defenitions required to control file + * access. These variables and functions are not guaranteed to exist in + * future implementations of the HAL. + */ + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +/* + * The alt_dev_llist is an internal structure used to form a common base + * class for all device types. The use of this structure allows common code + * to be used to manipulate the various device lists. + */ + +typedef struct { + alt_llist llist; + const char* name; +} alt_dev_llist; + +/* + * + */ + +extern int alt_dev_llist_insert (alt_dev_llist* dev, alt_llist* list); + +#ifdef __cplusplus +} +#endif + +#endif /* __ALT_DEV_LLIST_H__ */ Index: components/sd_card/firmware/bsp/HAL/inc/priv/alt_no_error.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/priv/alt_no_error.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/priv/alt_no_error.h (revision 8) @@ -0,0 +1,77 @@ +#ifndef __ALT_NO_ERROR_H__ +#define __ALT_NO_ERROR_H__ + +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +/****************************************************************************** +* * +* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. * +* * +******************************************************************************/ + +#include "alt_types.h" + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +/* + * alt_no_error() is a dummy function used by alt_sem.h and alt_flag.h. It + * substitutes for functions that have a return code by creating a function + * that always returns zero. + * + * This may seem a little obscure, but what happens is that the compiler can + * then optomise away the call to this function, and any code written which + * handles the error path (i.e. non zero return values). + * + * This allows code to be written which correctly use the uC/OS-II semaphore + * and flag utilities, without the use of those utilities impacting on + * excutables built for a single threaded HAL environment. + * + * This function is considered to be part of the internal implementation of + * the HAL, and should not be called directly by application code or device + * drivers. It is not guaranteed to be preserved in future versions of the + * HAL. + */ + +static ALT_INLINE int ALT_ALWAYS_INLINE alt_no_error (void) +{ + return 0; +} + +#ifdef __cplusplus +} +#endif + +#endif /* __ALT_NO_ERROR_H__ */ Index: components/sd_card/firmware/bsp/HAL/inc/priv/alt_iic_isr_register.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/priv/alt_iic_isr_register.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/priv/alt_iic_isr_register.h (revision 8) @@ -0,0 +1,39 @@ +#ifndef __ALT_IIC_ISR_REGISTER_H_ +#define __ALT_IIC_ISR_REGISTER_H_ + +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2009 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +******************************************************************************/ +#include "alt_types.h" +#include "sys/alt_irq.h" + +extern int alt_iic_isr_register(alt_u32 ic_id, alt_u32 irq, alt_isr_func isr, + void *isr_context, void *flags); + +#endif /* __ALT_IIC_ISR_REGISTER_H_ */ Index: components/sd_card/firmware/bsp/HAL/inc/nios2.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/nios2.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/nios2.h (revision 8) @@ -0,0 +1,300 @@ +#ifndef __NIOS2_H__ +#define __NIOS2_H__ + +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2008 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +******************************************************************************/ + +/* + * This header provides processor specific macros for accessing the Nios2 + * control registers. + */ + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +/* + * Number of available IRQs in internal interrupt controller. + */ +#define NIOS2_NIRQ 32 + +/* + * Macros for accessing select Nios II general-purpose registers. + */ + +/* ET (Exception Temporary) register */ +#define NIOS2_READ_ET(et) \ + do { __asm ("mov %0, et" : "=r" (et) ); } while (0) + +#define NIOS2_WRITE_ET(et) \ + do { __asm volatile ("mov et, %z0" : : "rM" (et)); } while (0) + +/* SP (Stack Pointer) register */ +#define NIOS2_READ_SP(sp) \ + do { __asm ("mov %0, sp" : "=r" (sp) ); } while (0) + +/* + * Macros for useful processor instructions. + */ +#define NIOS2_BREAK() \ + do { __asm volatile ("break"); } while (0) + +#define NIOS2_REPORT_STACK_OVERFLOW() \ + do { __asm volatile("break 3"); } while (0) + +/* + * Macros for accessing Nios II control registers. + */ +#define NIOS2_READ_STATUS(dest) \ + do { dest = __builtin_rdctl(0); } while (0) + +#define NIOS2_WRITE_STATUS(src) \ + do { __builtin_wrctl(0, src); } while (0) + +#define NIOS2_READ_ESTATUS(dest) \ + do { dest = __builtin_rdctl(1); } while (0) + +#define NIOS2_READ_BSTATUS(dest) \ + do { dest = __builtin_rdctl(2); } while (0) + +#define NIOS2_READ_IENABLE(dest) \ + do { dest = __builtin_rdctl(3); } while (0) + +#define NIOS2_WRITE_IENABLE(src) \ + do { __builtin_wrctl(3, src); } while (0) + +#define NIOS2_READ_IPENDING(dest) \ + do { dest = __builtin_rdctl(4); } while (0) + +#define NIOS2_READ_CPUID(dest) \ + do { dest = __builtin_rdctl(5); } while (0) + +#define NIOS2_READ_EXCEPTION(dest) \ + do { dest = __builtin_rdctl(7); } while (0) + +#define NIOS2_READ_PTEADDR(dest) \ + do { dest = __builtin_rdctl(8); } while (0) + +#define NIOS2_WRITE_PTEADDR(src) \ + do { __builtin_wrctl(8, src); } while (0) + +#define NIOS2_READ_TLBACC(dest) \ + do { dest = __builtin_rdctl(9); } while (0) + +#define NIOS2_WRITE_TLBACC(src) \ + do { __builtin_wrctl(9, src); } while (0) + +#define NIOS2_READ_TLBMISC(dest) \ + do { dest = __builtin_rdctl(10); } while (0) + +#define NIOS2_WRITE_TLBMISC(src) \ + do { __builtin_wrctl(10, src); } while (0) + +#define NIOS2_READ_ECCINJ(dest) \ + do { dest = __builtin_rdctl(11); } while (0) + +#define NIOS2_WRITE_ECCINJ(src) \ + do { __builtin_wrctl(11, src); } while (0) + +#define NIOS2_READ_BADADDR(dest) \ + do { dest = __builtin_rdctl(12); } while (0) + +#define NIOS2_WRITE_CONFIG(src) \ + do { __builtin_wrctl(13, src); } while (0) + +#define NIOS2_READ_CONFIG(dest) \ + do { dest = __builtin_rdctl(13); } while (0) + +#define NIOS2_WRITE_MPUBASE(src) \ + do { __builtin_wrctl(14, src); } while (0) + +#define NIOS2_READ_MPUBASE(dest) \ + do { dest = __builtin_rdctl(14); } while (0) + +#define NIOS2_WRITE_MPUACC(src) \ + do { __builtin_wrctl(15, src); } while (0) + +#define NIOS2_READ_MPUACC(dest) \ + do { dest = __builtin_rdctl(15); } while (0) + +/* + * Nios II control registers that are always present + */ +#define NIOS2_STATUS status +#define NIOS2_ESTATUS estatus +#define NIOS2_BSTATUS bstatus +#define NIOS2_IENABLE ienable +#define NIOS2_IPENDING ipending +#define NIOS2_CPUID cpuid + +/* + * Bit masks & offsets for Nios II control registers. + * The presence and size of a field is sometimes dependent on the Nios II + * configuration. Bit masks for every possible field and the maximum size of + * that field are defined. + * + * All bit-masks are expressed relative to the position + * of the data with a register. To read data that is LSB- + * aligned, the register read data should be masked, then + * right-shifted by the designated "OFST" macro value. The + * opposite should be used for register writes when starting + * with LSB-aligned data. + */ + +/* STATUS, ESTATUS, BSTATUS, and SSTATUS registers */ +#define NIOS2_STATUS_PIE_MSK (0x00000001) +#define NIOS2_STATUS_PIE_OFST (0) +#define NIOS2_STATUS_U_MSK (0x00000002) +#define NIOS2_STATUS_U_OFST (1) +#define NIOS2_STATUS_EH_MSK (0x00000004) +#define NIOS2_STATUS_EH_OFST (2) +#define NIOS2_STATUS_IH_MSK (0x00000008) +#define NIOS2_STATUS_IH_OFST (3) +#define NIOS2_STATUS_IL_MSK (0x000003f0) +#define NIOS2_STATUS_IL_OFST (4) +#define NIOS2_STATUS_CRS_MSK (0x0000fc00) +#define NIOS2_STATUS_CRS_OFST (10) +#define NIOS2_STATUS_PRS_MSK (0x003f0000) +#define NIOS2_STATUS_PRS_OFST (16) +#define NIOS2_STATUS_NMI_MSK (0x00400000) +#define NIOS2_STATUS_NMI_OFST (22) +#define NIOS2_STATUS_RSIE_MSK (0x00800000) +#define NIOS2_STATUS_RSIE_OFST (23) +#define NIOS2_STATUS_SRS_MSK (0x80000000) +#define NIOS2_STATUS_SRS_OFST (31) + +/* EXCEPTION register */ +#define NIOS2_EXCEPTION_REG_CAUSE_MASK (0x0000007c) +#define NIOS2_EXCEPTION_REG_CAUSE_OFST (2) +#define NIOS2_EXCEPTION_REG_ECCFTL_MASK (0x80000000) +#define NIOS2_EXCEPTION_REG_ECCFTL_OFST (31) + +/* PTEADDR (Page Table Entry Address) register */ +#define NIOS2_PTEADDR_REG_VPN_OFST 2 +#define NIOS2_PTEADDR_REG_VPN_MASK 0x3ffffc +#define NIOS2_PTEADDR_REG_PTBASE_OFST 22 +#define NIOS2_PTEADDR_REG_PTBASE_MASK 0xffc00000 + +/* TLBACC (TLB Access) register */ +#define NIOS2_TLBACC_REG_PFN_OFST 0 +#define NIOS2_TLBACC_REG_PFN_MASK 0xfffff +#define NIOS2_TLBACC_REG_G_OFST 20 +#define NIOS2_TLBACC_REG_G_MASK 0x100000 +#define NIOS2_TLBACC_REG_X_OFST 21 +#define NIOS2_TLBACC_REG_X_MASK 0x200000 +#define NIOS2_TLBACC_REG_W_OFST 22 +#define NIOS2_TLBACC_REG_W_MASK 0x400000 +#define NIOS2_TLBACC_REG_R_OFST 23 +#define NIOS2_TLBACC_REG_R_MASK 0x800000 +#define NIOS2_TLBACC_REG_C_OFST 24 +#define NIOS2_TLBACC_REG_C_MASK 0x1000000 +#define NIOS2_TLBACC_REG_IG_OFST 25 +#define NIOS2_TLBACC_REG_IG_MASK 0xfe000000 + +/* TLBMISC (TLB Miscellaneous) register */ +#define NIOS2_TLBMISC_REG_D_OFST 0 +#define NIOS2_TLBMISC_REG_D_MASK 0x1 +#define NIOS2_TLBMISC_REG_PERM_OFST 1 +#define NIOS2_TLBMISC_REG_PERM_MASK 0x2 +#define NIOS2_TLBMISC_REG_BAD_OFST 2 +#define NIOS2_TLBMISC_REG_BAD_MASK 0x4 +#define NIOS2_TLBMISC_REG_DBL_OFST 3 +#define NIOS2_TLBMISC_REG_DBL_MASK 0x8 +#define NIOS2_TLBMISC_REG_PID_OFST 4 +#define NIOS2_TLBMISC_REG_PID_MASK 0x3fff0 +#define NIOS2_TLBMISC_REG_WE_OFST 18 +#define NIOS2_TLBMISC_REG_WE_MASK 0x40000 +#define NIOS2_TLBMISC_REG_RD_OFST 19 +#define NIOS2_TLBMISC_REG_RD_MASK 0x80000 +#define NIOS2_TLBMISC_REG_WAY_OFST 20 +#define NIOS2_TLBMISC_REG_WAY_MASK 0xf00000 +#define NIOS2_TLBMISC_REG_EE_OFST 24 +#define NIOS2_TLBMISC_REG_EE_MASK 0x1000000 + +/* ECCINJ (ECC Inject) register */ +#define NIOS2_ECCINJ_REG_RF_OFST 0 +#define NIOS2_ECCINJ_REG_RF_MASK 0x3 +#define NIOS2_ECCINJ_REG_ICTAG_OFST 2 +#define NIOS2_ECCINJ_REG_ICTAG_MASK 0xc +#define NIOS2_ECCINJ_REG_ICDAT_OFST 4 +#define NIOS2_ECCINJ_REG_ICDAT_MASK 0x30 +#define NIOS2_ECCINJ_REG_DCTAG_OFST 6 +#define NIOS2_ECCINJ_REG_DCTAG_MASK 0xc0 +#define NIOS2_ECCINJ_REG_DCDAT_OFST 8 +#define NIOS2_ECCINJ_REG_DCDAT_MASK 0x300 +#define NIOS2_ECCINJ_REG_TLB_OFST 10 +#define NIOS2_ECCINJ_REG_TLB_MASK 0xc00 +#define NIOS2_ECCINJ_REG_DTCM0_OFST 12 +#define NIOS2_ECCINJ_REG_DTCM0_MASK 0x3000 +#define NIOS2_ECCINJ_REG_DTCM1_OFST 14 +#define NIOS2_ECCINJ_REG_DTCM1_MASK 0xc000 +#define NIOS2_ECCINJ_REG_DTCM2_OFST 16 +#define NIOS2_ECCINJ_REG_DTCM2_MASK 0x30000 +#define NIOS2_ECCINJ_REG_DTCM3_OFST 18 +#define NIOS2_ECCINJ_REG_DTCM3_MASK 0xc0000 + +/* CONFIG register */ +#define NIOS2_CONFIG_REG_PE_MASK (0x00000001) +#define NIOS2_CONFIG_REG_PE_OFST (0) +#define NIOS2_CONFIG_REG_ANI_MASK (0x00000002) +#define NIOS2_CONFIG_REG_ANI_OFST (1) +#define NIOS2_CONFIG_REG_ECCEN_MASK (0x00000004) +#define NIOS2_CONFIG_REG_ECCEN_OFST (2) +#define NIOS2_CONFIG_REG_ECCEXC_MASK (0x00000008) +#define NIOS2_CONFIG_REG_ECCEXC_OFST (3) + +/* MPUBASE (MPU Base Address) Register */ +#define NIOS2_MPUBASE_D_MASK (0x00000001) +#define NIOS2_MPUBASE_D_OFST (0) +#define NIOS2_MPUBASE_INDEX_MASK (0x0000003e) +#define NIOS2_MPUBASE_INDEX_OFST (1) +#define NIOS2_MPUBASE_BASE_ADDR_MASK (0xffffffc0) +#define NIOS2_MPUBASE_BASE_ADDR_OFST (6) + +/* MPUACC (MPU Access) Register */ +#define NIOS2_MPUACC_LIMIT_MASK (0xffffffc0) +#define NIOS2_MPUACC_LIMIT_OFST (6) +#define NIOS2_MPUACC_MASK_MASK (0xffffffc0) +#define NIOS2_MPUACC_MASK_OFST (6) +#define NIOS2_MPUACC_C_MASK (0x00000020) +#define NIOS2_MPUACC_C_OFST (5) +#define NIOS2_MPUACC_PERM_MASK (0x0000001c) +#define NIOS2_MPUACC_PERM_OFST (2) +#define NIOS2_MPUACC_RD_MASK (0x00000002) +#define NIOS2_MPUACC_RD_OFST (1) +#define NIOS2_MPUACC_WR_MASK (0x00000001) +#define NIOS2_MPUACC_WR_OFST (0) + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __NIOS2_H__ */ Index: components/sd_card/firmware/bsp/HAL/inc/os/alt_flag.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/os/alt_flag.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/os/alt_flag.h (revision 8) @@ -0,0 +1,98 @@ +#ifndef __ALT_FLAG_H__ +#define __ALT_FLAG_H__ + +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +/****************************************************************************** +* * +* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. * +* * +******************************************************************************/ + +/* + * This header provides macro definitions that can be used to create and use + * uc/OS-II style event flags. These macros can be used in both a uC/OS-II based + * environment, and a single threaded HAL based environment. + * + * The motivation for these macros is to allow code to be developed which is + * thread safe under uC/OS-II, but incurs no additional overhead when used in a + * single threaded HAL environment. + * + * In the case of a single threaded HAL environment, they compile to + * "do nothing" directives, which ensures they do not contribute to the final + * executable. + * + * The following macros are available: + * + * ALT_FLAG_GRP - Create a flag group instance. + * ALT_EXTERN_FLAG_GRP - Create a reference to an external flag group instance. + * ALT_STATIC_FLAG_GRP - Create a static flag group instance. + * ALT_FLAG_CREATE - Initialise a flag group. + * ALT_FLAG_PEND - Pend on a flag group. + * ALT_FLAG_POST - Set a flag condition. + + * + * Input arguments and return codes are all consistant with the equivalent + * uC/OS-II function. + * + * It's important to be careful in the use of the macros: ALT_FLAG_GRP, + * ALT_EXTERN_FLAG_GRP, and ALT_STATIC_FLAG_GRP. In these three cases the + * semi-colon is included in the macro definition; so, for example, you should + * use: + * + * ALT_FLAG_GRP(mygroup) + * + * not: + * + * ALT_FLAG_GRP(mygroup); + * + * The inclusion of the semi-colon has been necessary to ensure the macros can + * compile with no warnings when used in a single threaded HAL environment. + * + */ + +#include "priv/alt_no_error.h" + +#define ALT_FLAG_GRP(group) +#define ALT_EXTERN_FLAG_GRP(group) +#define ALT_STATIC_FLAG_GRP(group) + +#define ALT_FLAG_CREATE(group, flags) alt_no_error () +#define ALT_FLAG_PEND(group, flags, wait_type, timeout) alt_no_error () +#define ALT_FLAG_POST(group, flags, opt) alt_no_error () + +#ifndef ALT_SINGLE_THREADED +#define ALT_SINGLE_THREADED +#endif + +#endif /* __ALT_FLAG_H__ */ Index: components/sd_card/firmware/bsp/HAL/inc/os/alt_syscall.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/os/alt_syscall.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/os/alt_syscall.h (revision 8) @@ -0,0 +1,75 @@ +#ifndef __ALT_SYSCALL_H__ +#define __ALT_SYSCALL_H__ + +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2003 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +******************************************************************************/ + +/* + * The macros defined in this file are used to provide the function names used + * for the HAL 'UNIX style' interface, e.g. read(), write() etc. + * + * Operating systems which are ported to the HAL can provide their own + * version of this file, which will be used in preference. This allows + * the operating system to provide it's own implementation of the top level + * system calls, while retaining the HAL functions under a different name, + * for example, alt_read(), alt_write() etc. + */ + +#define ALT_CLOSE close +#define ALT_ENVIRON environ +#define ALT_EXECVE execve +#define ALT_EXIT _exit +#define ALT_FCNTL fcntl +#define ALT_FORK fork +#define ALT_FSTAT fstat +#define ALT_GETPID getpid +#define ALT_GETTIMEOFDAY gettimeofday +#define ALT_IOCTL ioctl +#define ALT_ISATTY isatty +#define ALT_KILL kill +#define ALT_LINK link +#define ALT_LSEEK lseek +#define ALT_OPEN open +#define ALT_READ read +#define ALT_RENAME _rename +#define ALT_SBRK sbrk +#define ALT_SETTIMEOFDAY settimeofday +#define ALT_STAT stat +#define ALT_UNLINK unlink +#define ALT_USLEEP usleep +#define ALT_WAIT wait +#define ALT_WRITE write +#define ALT_TIMES times + +/* + * + */ + +#endif /* __ALT_SYSCALL_H__ */ Index: components/sd_card/firmware/bsp/HAL/inc/os/alt_hooks.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/os/alt_hooks.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/os/alt_hooks.h (revision 8) @@ -0,0 +1,61 @@ +#ifndef __ALT_HOOKS_H__ +#define __ALT_HOOKS_H__ + +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +/****************************************************************************** +* * +* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. * +* * +******************************************************************************/ + +/* + * This header provides "do-nothing" macro definitions for operating system + * hooks within the HAL. The O/S component can override these to provide it's + * own implementation. + */ + +#define ALT_OS_TIME_TICK() while(0) +#define ALT_OS_INIT() while(0) +#define ALT_OS_STOP() while(0) + +/* Call from assembly code */ +#define ALT_OS_INT_ENTER_ASM +#define ALT_OS_INT_EXIT_ASM + +/* Call from C code */ +#define ALT_OS_INT_ENTER() while(0) +#define ALT_OS_INT_EXIT() while(0) + + +#endif /* __ALT_HOOKS_H__ */ Index: components/sd_card/firmware/bsp/HAL/inc/os/alt_sem.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/os/alt_sem.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/os/alt_sem.h (revision 8) @@ -0,0 +1,96 @@ +#ifndef __ALT_SEM_H__ +#define __ALT_SEM_H__ + +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +/****************************************************************************** +* * +* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. * +* * +******************************************************************************/ + +/* + * This header provides macro definitions that can be used to create and use + * semaphores. These macros can be used in both a uC/OS-II based environment, + * and a single threaded HAL based environment. + * + * The motivation for these macros is to allow code to be developed which is + * thread safe under uC/OS-II, but incurs no additional overhead when used in a + * single threaded HAL environment. + * + * In the case of a single threaded HAL environment, they compile to + * "do nothing" directives, which ensures they do not contribute to the final + * executable. + * + * The following macros are available: + * + * ALT_SEM - Create a semaphore instance. + * ALT_EXTERN_SEM - Create a reference to an external semaphore instance. + * ALT_STATIC_SEM - Create a static semaphore instance. + * ALT_SEM_CREATE - Initialise a semaphore. + * ALT_SEM_PEND - Pend on a semaphore. + * ALT_SEM_POST - Increment a semaphore. + * + * Input arguments and return codes are all consistant with the equivalent + * uC/OS-II function. + * + * It's important to be careful in the use of the macros: ALT_SEM, + * ALT_EXTERN_SEM, and ALT_STATIC_SEM. In these three cases the semi-colon is + * included in the macro definition; so, for example, you should use: + * + * ALT_SEM(mysem) + * + * not: + * + * ALT_SEM(mysem); + * + * The inclusion of the semi-colon has been necessary to ensure the macros can + * compile with no warnings when used in a single threaded HAL environment. + * + */ + +#include "priv/alt_no_error.h" + +#define ALT_SEM(sem) +#define ALT_EXTERN_SEM(sem) +#define ALT_STATIC_SEM(sem) + +#define ALT_SEM_CREATE(sem, value) alt_no_error () +#define ALT_SEM_PEND(sem, timeout) alt_no_error () +#define ALT_SEM_POST(sem) alt_no_error () + +#ifndef ALT_SINGLE_THREADED +#define ALT_SINGLE_THREADED +#endif + +#endif /* __ALT_SEM_H__ */ Index: components/sd_card/firmware/bsp/HAL/inc/altera_nios2_qsys_irq.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/altera_nios2_qsys_irq.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/altera_nios2_qsys_irq.h (revision 8) @@ -0,0 +1,80 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2009 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +******************************************************************************/ + +/* + * Support for the Nios II internal interrupt controller. + */ + +#ifndef __ALT_NIOS2_QSYS_IRQ_H__ +#define __ALT_NIOS2_QSYS_IRQ_H__ + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +/* + * The macro ALTERA_NIOS2_IRQ_INSTANCE is used by the alt_irq_init() + * function in the auto-generated file alt_sys_init.c to create an + * instance of this interrupt controller device driver state if this + * module contains an interrupt controller. + * Only one instance of a Nios II is allowed so this macro is just empty. + */ + +#define ALTERA_NIOS2_QSYS_IRQ_INSTANCE(name, state) + +/* + * altera_nios2_irq_init() is called by the auto-generated function + * alt_irq_init() once for the Nios II if it contains an interrupt controller. + * The altera_nios2_irq_init() routine is called using the + * ALTERA_NIOS2_IRQ_INIT macro given below. + * + * This function initializes the internal interrupt controller + * so is not called if the Nios II contains an external interrupt + * controller port (because the internal interrupt controller + * is removed if this port is present). + */ + +extern void altera_nios2_qsys_irq_init( void ); + +/* + * The macro ALTERA_NIOS2_IRQ_INIT is used by the alt_irq_init() routine + * in the auto-generated file alt_sys_init.c to initialize an instance + * of the interrupt controller device driver state. + */ + +#define ALTERA_NIOS2_QSYS_IRQ_INIT(name, state) altera_nios2_qsys_irq_init() + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __ALT_NIOS2_QSYS_IRQ_H__ */ + Index: components/sd_card/firmware/bsp/HAL/inc/alt_types.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/alt_types.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/alt_types.h (revision 8) @@ -0,0 +1,54 @@ +#ifndef __ALT_TYPES_H__ +#define __ALT_TYPES_H__ + +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2003 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +/* + * Don't declare these typedefs if this file is included by assembly source. + */ +#ifndef ALT_ASM_SRC +typedef signed char alt_8; +typedef unsigned char alt_u8; +typedef signed short alt_16; +typedef unsigned short alt_u16; +typedef signed long alt_32; +typedef unsigned long alt_u32; +typedef long long alt_64; +typedef unsigned long long alt_u64; +#endif + +#define ALT_INLINE __inline__ +#define ALT_ALWAYS_INLINE __attribute__ ((always_inline)) +#define ALT_WEAK __attribute__((weak)) + +#endif /* __ALT_TYPES_H__ */ Index: components/sd_card/firmware/bsp/HAL/inc/io.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/io.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/io.h (revision 8) @@ -0,0 +1,81 @@ +#ifndef __IO_H__ +#define __IO_H__ + +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2003 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +/* IO Header file for Nios II Toolchain */ + +#include "alt_types.h" +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifndef SYSTEM_BUS_WIDTH +#error SYSTEM_BUS_WIDTH undefined +#endif + +/* Dynamic bus access functions */ + +#define __IO_CALC_ADDRESS_DYNAMIC(BASE, OFFSET) \ + ((void *)(((alt_u8*)BASE) + (OFFSET))) + +#define IORD_32DIRECT(BASE, OFFSET) \ + __builtin_ldwio (__IO_CALC_ADDRESS_DYNAMIC ((BASE), (OFFSET))) +#define IORD_16DIRECT(BASE, OFFSET) \ + __builtin_ldhuio (__IO_CALC_ADDRESS_DYNAMIC ((BASE), (OFFSET))) +#define IORD_8DIRECT(BASE, OFFSET) \ + __builtin_ldbuio (__IO_CALC_ADDRESS_DYNAMIC ((BASE), (OFFSET))) + +#define IOWR_32DIRECT(BASE, OFFSET, DATA) \ + __builtin_stwio (__IO_CALC_ADDRESS_DYNAMIC ((BASE), (OFFSET)), (DATA)) +#define IOWR_16DIRECT(BASE, OFFSET, DATA) \ + __builtin_sthio (__IO_CALC_ADDRESS_DYNAMIC ((BASE), (OFFSET)), (DATA)) +#define IOWR_8DIRECT(BASE, OFFSET, DATA) \ + __builtin_stbio (__IO_CALC_ADDRESS_DYNAMIC ((BASE), (OFFSET)), (DATA)) + +/* Native bus access functions */ + +#define __IO_CALC_ADDRESS_NATIVE(BASE, REGNUM) \ + ((void *)(((alt_u8*)BASE) + ((REGNUM) * (SYSTEM_BUS_WIDTH/8)))) + +#define IORD(BASE, REGNUM) \ + __builtin_ldwio (__IO_CALC_ADDRESS_NATIVE ((BASE), (REGNUM))) +#define IOWR(BASE, REGNUM, DATA) \ + __builtin_stwio (__IO_CALC_ADDRESS_NATIVE ((BASE), (REGNUM)), (DATA)) + +#ifdef __cplusplus +} +#endif + +#endif /* __IO_H__ */ Index: components/sd_card/firmware/bsp/HAL/inc/sys/alt_irq.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/sys/alt_irq.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/sys/alt_irq.h (revision 8) @@ -0,0 +1,245 @@ +#ifndef __ALT_IRQ_H__ +#define __ALT_IRQ_H__ + +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2009 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +******************************************************************************/ + +/* + * alt_irq.h is the Nios II specific implementation of the interrupt controller + * interface. + * + * Nios II includes optional support for an external interrupt controller. + * When an external controller is present, the "Enhanced" interrupt API + * must be used to manage individual interrupts. The enhanced API also + * supports the processor's internal interrupt controller. Certain API + * members are accessible from either the "legacy" or "enhanced" interrpt + * API. + * + * Regardless of which API is in use, this file should be included by + * application code and device drivers that register ISRs or manage interrpts. + */ +#include + +#include "nios2.h" +#include "alt_types.h" +#include "system.h" + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +/* + * Macros used by alt_irq_enabled + */ +#define ALT_IRQ_ENABLED 1 +#define ALT_IRQ_DISABLED 0 + +/* + * Number of available interrupts in internal interrupt controller. + */ +#define ALT_NIRQ NIOS2_NIRQ + +/* + * Used by alt_irq_disable_all() and alt_irq_enable_all(). + */ +typedef int alt_irq_context; + +/* ISR Prototype */ +#ifdef ALT_ENHANCED_INTERRUPT_API_PRESENT +typedef void (*alt_isr_func)(void* isr_context); +#else +typedef void (*alt_isr_func)(void* isr_context, alt_u32 id); +#endif + +/* + * The following protypes and routines are supported by both + * the enhanced and legacy interrupt APIs + */ + +/* + * alt_irq_enabled can be called to determine if the processor's global + * interrupt enable is asserted. The return value is zero if interrupts + * are disabled, and non-zero otherwise. + * + * Whether the internal or external interrupt controller is present, + * individual interrupts may still be disabled. Use the other API to query + * a specific interrupt. + */ +static ALT_INLINE int ALT_ALWAYS_INLINE alt_irq_enabled (void) +{ + int status; + + NIOS2_READ_STATUS (status); + + return status & NIOS2_STATUS_PIE_MSK; +} + +/* + * alt_irq_disable_all() + * + * This routine inhibits all interrupts by negating the status register PIE + * bit. It returns the previous contents of the CPU status register (IRQ + * context) which can be used to restore the status register PIE bit to its + * state before this routine was called. + */ +static ALT_INLINE alt_irq_context ALT_ALWAYS_INLINE + alt_irq_disable_all (void) +{ + alt_irq_context context; + + NIOS2_READ_STATUS (context); + + NIOS2_WRITE_STATUS (context & ~NIOS2_STATUS_PIE_MSK); + + return context; +} + +/* + * alt_irq_enable_all() + * + * Enable all interrupts that were previously disabled by alt_irq_disable_all() + * + * This routine accepts a context to restore the CPU status register PIE bit + * to the state prior to a call to alt_irq_disable_all(). + + * In the case of nested calls to alt_irq_disable_all()/alt_irq_enable_all(), + * this means that alt_irq_enable_all() does not necessarily re-enable + * interrupts. + * + * This routine will perform a read-modify-write sequence to restore only + * status.PIE if the processor is configured with options that add additional + * writeable status register bits. These include the MMU, MPU, the enhanced + * interrupt controller port, and shadow registers. Otherwise, as a performance + * enhancement, status is overwritten with the prior context. + */ +static ALT_INLINE void ALT_ALWAYS_INLINE + alt_irq_enable_all (alt_irq_context context) +{ +#if (NIOS2_NUM_OF_SHADOW_REG_SETS > 0) || (defined NIOS2_EIC_PRESENT) || \ + (defined NIOS2_MMU_PRESENT) || (defined NIOS2_MPU_PRESENT) + alt_irq_context status; + + NIOS2_READ_STATUS (status); + + status &= ~NIOS2_STATUS_PIE_MSK; + status |= (context & NIOS2_STATUS_PIE_MSK); + + NIOS2_WRITE_STATUS (status); +#else + NIOS2_WRITE_STATUS (context); +#endif +} + +/* + * The function alt_irq_init() is defined within the auto-generated file + * alt_sys_init.c. This function calls the initilization macros for all + * interrupt controllers in the system at config time, before any other + * non-interrupt controller driver is initialized. + * + * The "base" parameter is ignored and only present for backwards-compatibility. + * It is recommended that NULL is passed in for the "base" parameter. + */ +extern void alt_irq_init (const void* base); + +/* + * alt_irq_cpu_enable_interrupts() enables the CPU to start taking interrupts. + */ +static ALT_INLINE void ALT_ALWAYS_INLINE + alt_irq_cpu_enable_interrupts () +{ + NIOS2_WRITE_STATUS(NIOS2_STATUS_PIE_MSK +#if defined(NIOS2_EIC_PRESENT) && (NIOS2_NUM_OF_SHADOW_REG_SETS > 0) + | NIOS2_STATUS_RSIE_MSK +#endif + ); +} + + +/* + * Prototypes for the enhanced interrupt API. + */ +#ifdef ALT_ENHANCED_INTERRUPT_API_PRESENT +/* + * alt_ic_isr_register() can be used to register an interrupt handler. If the + * function is succesful, then the requested interrupt will be enabled upon + * return. + */ +extern int alt_ic_isr_register(alt_u32 ic_id, + alt_u32 irq, + alt_isr_func isr, + void *isr_context, + void *flags); + +/* + * alt_ic_irq_enable() and alt_ic_irq_disable() enable/disable a specific + * interrupt by using IRQ port and interrupt controller instance. + */ +int alt_ic_irq_enable (alt_u32 ic_id, alt_u32 irq); +int alt_ic_irq_disable(alt_u32 ic_id, alt_u32 irq); + + /* + * alt_ic_irq_enabled() indicates whether a specific interrupt, as + * specified by IRQ port and interrupt controller instance is enabled. + */ +alt_u32 alt_ic_irq_enabled(alt_u32 ic_id, alt_u32 irq); + +#else +/* + * Prototypes for the legacy interrupt API. + */ +#include "priv/alt_legacy_irq.h" +#endif + + +/* + * alt_irq_pending() returns a bit list of the current pending interrupts. + * This is used by alt_irq_handler() to determine which registered interrupt + * handlers should be called. + * + * This routine is only available for the Nios II internal interrupt + * controller. + */ +#ifndef NIOS2_EIC_PRESENT +static ALT_INLINE alt_u32 ALT_ALWAYS_INLINE alt_irq_pending (void) +{ + alt_u32 active; + + NIOS2_READ_IPENDING (active); + + return active; +} +#endif + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __ALT_IRQ_H__ */ Index: components/sd_card/firmware/bsp/HAL/inc/sys/alt_flash_dev.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/sys/alt_flash_dev.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/sys/alt_flash_dev.h (revision 8) @@ -0,0 +1,98 @@ +#ifndef __ALT_FLASH_DEV_H__ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +/****************************************************************************** +* * +* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. * +* * +******************************************************************************/ + +/****************************************************************************** +* * +* Alt_flash_dev.h - Generic Flash device interfaces * +* * +* Author PRR * +* * +******************************************************************************/ +#define __ALT_FLASH_DEV_H__ + +#include "alt_flash_types.h" +#include "sys/alt_llist.h" +#include "priv/alt_dev_llist.h" + +#include "alt_types.h" + +typedef struct alt_flash_dev alt_flash_dev; +typedef alt_flash_dev alt_flash_fd; + +static ALT_INLINE int alt_flash_device_register( alt_flash_fd* fd) +{ + extern alt_llist alt_flash_dev_list; + + return alt_dev_llist_insert ((alt_dev_llist*) fd, &alt_flash_dev_list); +} + +typedef alt_flash_dev* (*alt_flash_open)(alt_flash_dev* flash, + const char* name ); +typedef int (*alt_flash_close)(alt_flash_dev* flash_info); + +typedef int (*alt_flash_write)( alt_flash_dev* flash, int offset, + const void* src_addr, int length ); + +typedef int (*alt_flash_get_flash_info)( alt_flash_dev* flash, flash_region** info, + int* number_of_regions); +typedef int (*alt_flash_write_block)( alt_flash_dev* flash, int block_offset, + int data_offset, const void* data, + int length); +typedef int (*alt_flash_erase_block)( alt_flash_dev* flash, int offset); +typedef int (*alt_flash_read)(alt_flash_dev* flash, int offset, + void* dest_addr, int length ); + +struct alt_flash_dev +{ + alt_llist llist; + const char* name; + alt_flash_open open; + alt_flash_close close; + alt_flash_write write; + alt_flash_read read; + alt_flash_get_flash_info get_info; + alt_flash_erase_block erase_block; + alt_flash_write_block write_block; + void* base_addr; + int length; + int number_of_regions; + flash_region region_info[ALT_MAX_NUMBER_OF_FLASH_REGIONS]; +}; + +#endif /* __ALT_FLASH_DEV_H__ */ Index: components/sd_card/firmware/bsp/HAL/inc/sys/alt_driver.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/sys/alt_driver.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/sys/alt_driver.h (revision 8) @@ -0,0 +1,168 @@ +#ifndef __ALT_DRIVER_H__ +#define __ALT_DRIVER_H__ + +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2006 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +/* + * Macros used to access a driver without HAL file descriptors. + */ + +/* + * ALT_MODULE_CLASS + * + * This macro returns the module class name for the specified module instance. + * It uses information in the system.h file. + * Neither the instance name or class name are quoted (so that they can + * be used with other pre-processor macros). + * + * Example: + * Assume the design has an instance of an altera_avalon_uart called uart1. + * Calling ALT_MODULE_CLASS(uart1) returns altera_avalon_uart. + */ + +#define ALT_MODULE_CLASS(instance) ALT_MODULE_CLASS_ ## instance + + +/* + * ALT_DRIVER_FUNC_NAME + * + * --> instance Instance name. + * --> func Function name. + * + * This macro returns the device driver function name of the specified + * module instance for the specified function name. + * + * Example: + * Assume the design has an instance of an altera_avalon_uart called uart1. + * Calling ALT_DRIVER_FUNC_NAME(uart1, write) returns + * altera_avalon_uart_write. + */ + +#define ALT_DRIVER_FUNC_NAME(instance, func) \ + ALT_DRIVER_FUNC_NAME1(ALT_MODULE_CLASS(instance), func) +#define ALT_DRIVER_FUNC_NAME1(module_class, func) \ + ALT_DRIVER_FUNC_NAME2(module_class, func) +#define ALT_DRIVER_FUNC_NAME2(module_class, func) \ + module_class ## _ ## func + +/* + * ALT_DRIVER_STATE_STRUCT + * + * --> instance Instance name. + * + * This macro returns the device driver state type name of the specified + * module instance. + * + * Example: + * Assume the design has an instance of an altera_avalon_uart called uart1. + * Calling ALT_DRIVER_STATE_STRUCT(uart1) returns: + * struct altera_avalon_uart_state_s + * + * Note that the ALT_DRIVER_FUNC_NAME macro is used even though "state" isn't + * really a function but it does match the required naming convention. + */ +#define ALT_DRIVER_STATE_STRUCT(instance) \ + struct ALT_DRIVER_FUNC_NAME(instance, state_s) + +/* + * ALT_DRIVER_STATE + * + * --> instance Instance name. + * + * This macro returns the device driver state name of the specified + * module instance. + * + * Example: + * Assume the design has an instance of an altera_avalon_uart called uart1. + * Calling ALT_DRIVER_STATE(uart1) returns uart1. + */ +#define ALT_DRIVER_STATE(instance) instance + +/* + * ALT_DRIVER_WRITE + * + * --> instance Instance name. + * --> buffer Write buffer. + * --> len Length of write buffer data. + * --> flags Control flags (e.g. O_NONBLOCK) + * + * This macro calls the "write" function of the specified driver instance. + */ + +#define ALT_DRIVER_WRITE_EXTERNS(instance) \ + extern ALT_DRIVER_STATE_STRUCT(instance) ALT_DRIVER_STATE(instance); \ + extern int ALT_DRIVER_FUNC_NAME(instance, write) \ + (ALT_DRIVER_STATE_STRUCT(instance) *, const char *, int, int); + +#define ALT_DRIVER_WRITE(instance, buffer, len, flags) \ + ALT_DRIVER_FUNC_NAME(instance, write)(&ALT_DRIVER_STATE(instance), buffer, len, flags) + + +/* + * ALT_DRIVER_READ + * + * --> instance Instance name. + * <-- buffer Read buffer. + * --> len Length of read buffer. + * --> flags Control flags (e.g. O_NONBLOCK) + * + * This macro calls the "read" function of the specified driver instance. + */ + +#define ALT_DRIVER_READ_EXTERNS(instance) \ + extern ALT_DRIVER_STATE_STRUCT(instance) ALT_DRIVER_STATE(instance); \ + extern int ALT_DRIVER_FUNC_NAME(instance, read) \ + (ALT_DRIVER_STATE_STRUCT(instance) *, const char *, int, int); + +#define ALT_DRIVER_READ(instance, buffer, len, flags) \ + ALT_DRIVER_FUNC_NAME(instance, read)(&ALT_DRIVER_STATE(instance), buffer, len, flags) + +/* + * ALT_DRIVER_IOCTL + * + * --> instance Instance name. + * --> req ioctl request (e.g. TIOCSTIMEOUT) + * --> arg Optional argument (void*) + * + * This macro calls the "ioctl" function of the specified driver instance + */ + +#define ALT_DRIVER_IOCTL_EXTERNS(instance) \ + extern ALT_DRIVER_STATE_STRUCT(instance) ALT_DRIVER_STATE(instance); \ + extern int ALT_DRIVER_FUNC_NAME(instance, ioctl) \ + (ALT_DRIVER_STATE_STRUCT(instance) *, int, void*); + +#define ALT_DRIVER_IOCTL(instance, req, arg) \ + ALT_DRIVER_FUNC_NAME(instance, ioctl)(&ALT_DRIVER_STATE(instance), req, arg) + +#endif /* __ALT_DRIVER_H__ */ Index: components/sd_card/firmware/bsp/HAL/inc/sys/alt_alarm.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/sys/alt_alarm.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/sys/alt_alarm.h (revision 8) @@ -0,0 +1,126 @@ +#ifndef __ALT_ALARM_H__ +#define __ALT_ALARM_H__ + +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +/****************************************************************************** +* * +* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. * +* * +******************************************************************************/ + +#include "alt_llist.h" +#include "alt_types.h" + +#include "priv/alt_alarm.h" + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +/* + * "alt_alarm" is a structure type used by applications to register an alarm + * callback function. An instance of this type must be passed as an input + * argument to alt_alarm_start(). The user is not responsible for initialising + * the contents of the instance. This is done by alt_alarm_start(). + */ + +typedef struct alt_alarm_s alt_alarm; + +/* + * alt_alarm_start() can be called by an application/driver in order to register + * a function for periodic callback at the system clock frequency. Be aware that + * this callback is likely to occur in interrupt context. + */ + +extern int alt_alarm_start (alt_alarm* the_alarm, + alt_u32 nticks, + alt_u32 (*callback) (void* context), + void* context); + +/* + * alt_alarm_stop() is used to unregister a callback. Alternatively the callback + * can return zero to unregister. + */ + +extern void alt_alarm_stop (alt_alarm* the_alarm); + +/* + * Obtain the system clock rate in ticks/s. + */ + +static ALT_INLINE alt_u32 ALT_ALWAYS_INLINE alt_ticks_per_second (void) +{ + return _alt_tick_rate; +} + +/* + * alt_sysclk_init() is intended to be only used by the system clock driver + * in order to initialise the value of the clock frequency. + */ + +static ALT_INLINE int ALT_ALWAYS_INLINE alt_sysclk_init (alt_u32 nticks) +{ + if (! _alt_tick_rate) + { + _alt_tick_rate = nticks; + return 0; + } + else + { + return -1; + } +} + +/* + * alt_nticks() returns the elapsed number of system clock ticks since reset. + */ + +static ALT_INLINE alt_u32 ALT_ALWAYS_INLINE alt_nticks (void) +{ + return _alt_nticks; +} + +/* + * alt_tick() should only be called by the system clock driver. This is used + * to notify the system that the system timer period has expired. + */ + +extern void alt_tick (void); + +#ifdef __cplusplus +} +#endif + +#endif /* __ALT_ALARM_H__ */ Index: components/sd_card/firmware/bsp/HAL/inc/sys/alt_flash.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/sys/alt_flash.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/sys/alt_flash.h (revision 8) @@ -0,0 +1,166 @@ +#ifndef __ALT_FLASH_H__ +#define __ALT_FLASH_H__ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +/****************************************************************************** +* * +* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. * +* * +******************************************************************************/ + +/****************************************************************************** +* * +* Alt_flash.h - User interface for flash code * +* * +* Use this interface to avoid being exposed to the internals of the device * +* driver architecture. If you chose to use the flash driver internal * +* structures we don't guarantee not to change them * +* * +* Author PRR * +* * +******************************************************************************/ + + + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#include "alt_types.h" +#include "alt_flash_types.h" +#include "alt_flash_dev.h" +#include "sys/alt_cache.h" + +alt_flash_fd* alt_flash_open_dev(const char* name); +void alt_flash_close_dev(alt_flash_fd* fd ); + +/* + * alt_write_flash + * + * Program a buffer into flash. + * + * This routine erases all the affected erase blocks (if necessary) + * and then programs the data. However it does not read the data out first + * and preserve and none overwritten data, because this would require very + * large buffers on the target. If you need + * that functionality use the functions below. + */ +static __inline__ int __attribute__ ((always_inline)) alt_write_flash( + alt_flash_fd* fd, + int offset, + const void* src_addr, + int length ) +{ + return fd->write( fd, offset, src_addr, length ); +} + +/* + * alt_read_flash + * + * Read a block of flash for most flashes this is just memcpy + * it's here for completeness in case we need it for some serial flash device + * + */ +static __inline__ int __attribute__ ((always_inline)) alt_read_flash( + alt_flash_fd* fd, int offset, + void* dest_addr, int length ) +{ + return fd->read( fd, offset, dest_addr, length ); +} + +/* + * alt_get_flash_info + * + * Return the information on the flash sectors. + * + */ +static __inline__ int __attribute__ ((always_inline)) alt_get_flash_info( + alt_flash_fd* fd, flash_region** info, + int* number_of_regions) +{ + return fd->get_info( fd, info, number_of_regions); +} + +/* + * alt_erase_flash_block + * + * Erase a particular erase block, pass in the offset to the start of + * the block and it's size + */ +static __inline__ int __attribute__ ((always_inline)) alt_erase_flash_block( + alt_flash_fd* fd, int offset, int length) +{ + int ret_code; + ret_code = fd->erase_block( fd, offset ); + + if(!ret_code) + alt_dcache_flush((alt_u8*)fd->base_addr + offset, length); + + return ret_code; +} + +/* + * alt_write_flash_block + * + * Write a particular flash block, block_offset is the offset + * (from the base of flash) to start of the block + * data_offset is the offset (from the base of flash) + * where you wish to start programming + * + * NB this function DOES NOT check that you are only writing a single + * block of data as that would slow down this function. + * + * Use alt_write_flash if you want that level of error checking. + */ + +static __inline__ int __attribute__ ((always_inline)) alt_write_flash_block( + alt_flash_fd* fd, int block_offset, + int data_offset, + const void *data, int length) +{ + + int ret_code; + ret_code = fd->write_block( fd, block_offset, data_offset, data, length ); + + if(!ret_code) + alt_dcache_flush((alt_u8*)fd->base_addr + data_offset, length); + + return ret_code; +} + +#ifdef __cplusplus +} +#endif + +#endif /* __ALT_FLASH_H__ */ Index: components/sd_card/firmware/bsp/HAL/inc/sys/alt_dma_dev.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/sys/alt_dma_dev.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/sys/alt_dma_dev.h (revision 8) @@ -0,0 +1,200 @@ +#ifndef __ALT_DMA_DEV_H__ +#define __ALT_DMA_DEV_H__ + +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004-2005 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +/****************************************************************************** +* * +* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. * +* * +******************************************************************************/ + +#include "priv/alt_dev_llist.h" + +#include "alt_types.h" + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +/* + * This header contains the device driver interface for accessing DMA + * resources. See alt_dma.h for the DMA application side interface. + * + * The interface model treats a DMA transaction as being composed of two + * halves (read and write). + * + * An "alt_dma_txchan_dev" is used to describe the device associated with a + * DMA transmit channel. An "alt_dma_rxchan_dev" is used to describe the + * device associated with a DMA receive channel. + */ + +/* + * List of generic ioctl requests that may be supported by a DMA device. + * + * ALT_DMA_RX_ONLY_ON: This causes a DMA channel to operate in a mode + * where only the receiver is under software control. + * The other side reads continously from a single + * location. The address to read is the argument to + * this request. + * ALT_DMA_RX_ONLY_OFF: Return to the default mode where both the receive + * and transmit sides of the DMA can be under software + * control. + * ALT_DMA_TX_ONLY_ON: This causes a DMA channel to operate in a mode + * where only the transmitter is under software control. + * The other side writes continously to a single + * location. The address to write to is the argument to + * this request. + * ALT_DMA_TX_ONLY_OFF: Return to the default mode where both the receive + * and transmit sides of the DMA can be under software + * control. + * ALT_DMA_SET_MODE_8: Transfer data in units of 8 bits. + * ALT_DMA_SET_MODE_16: Transfer data in units of 16 bits. + * ALT_DMA_SET_MODE_32: Transfer data in units of 32 bits. + * ALT_DMA_SET_MODE_64: Transfer data in units of 64 bits. + * ALT_DMA_SET_MODE_128: Transfer data in units of 128 bits. + * ALT_DMA_GET_MODE: Get the current transfer mode. + * + * The use of the macros: ALT_DMA_TX_STREAM_ON, ALT_DMA_TX_STREAM_OFF + * ALT_DMA_RX_STREAM_OFF and ALT_DMA_RX_STREAM_ON are depreciated. You should + * instead use the macros: ALT_DMA_RX_ONLY_ON, ALT_DMA_RX_ONLY_OFF, + * ALT_DMA_TX_ONLY_ON and ALT_DMA_TX_ONLY_OFF. + */ + +#define ALT_DMA_TX_STREAM_ON (0x1) +#define ALT_DMA_TX_STREAM_OFF (0x2) +#define ALT_DMA_RX_STREAM_ON (0x3) +#define ALT_DMA_RX_STREAM_OFF (0x4) +#define ALT_DMA_SET_MODE_8 (0x5) +#define ALT_DMA_SET_MODE_16 (0x6) +#define ALT_DMA_SET_MODE_32 (0x7) +#define ALT_DMA_SET_MODE_64 (0x8) +#define ALT_DMA_SET_MODE_128 (0x9) +#define ALT_DMA_GET_MODE (0xa) + +#define ALT_DMA_RX_ONLY_ON ALT_DMA_TX_STREAM_ON +#define ALT_DMA_RX_ONLY_OFF ALT_DMA_TX_STREAM_OFF +#define ALT_DMA_TX_ONLY_ON ALT_DMA_RX_STREAM_ON +#define ALT_DMA_TX_ONLY_OFF ALT_DMA_RX_STREAM_OFF + +/* + * + */ + +typedef struct alt_dma_txchan_dev_s alt_dma_txchan_dev; +typedef struct alt_dma_rxchan_dev_s alt_dma_rxchan_dev; + +typedef alt_dma_txchan_dev* alt_dma_txchan; +typedef alt_dma_rxchan_dev* alt_dma_rxchan; + +typedef void (alt_txchan_done)(void* handle); +typedef void (alt_rxchan_done)(void* handle, void* data); + +/* + * devices that provide a DMA transmit channel are required to provide an + * instance of the "alt_dma_txchan_dev" structure. + */ + +struct alt_dma_txchan_dev_s { + alt_llist llist; /* for internal use */ + const char* name; /* name of the device instance + * (e.g. "/dev/dma_0"). + */ + int (*space) (alt_dma_txchan dma); /* returns the maximum number of + * transmit requests that can be posted + */ + int (*dma_send) (alt_dma_txchan dma, + const void* from, + alt_u32 len, + alt_txchan_done* done, + void* handle); /* post a transmit request */ + int (*ioctl) (alt_dma_txchan dma, int req, void* arg); /* perform device + * specific I/O control. + */ +}; + +/* + * devices that provide a DMA receive channel are required to provide an + * instance of the "alt_dma_rxchan_dev" structure. + */ + +struct alt_dma_rxchan_dev_s { + alt_llist list; /* for internal use */ + const char* name; /* name of the device instance + * (e.g. "/dev/dma_0"). + */ + alt_u32 depth; /* maximum number of receive requests that + * can be posted. + */ + int (*prepare) (alt_dma_rxchan dma, + void* data, + alt_u32 len, + alt_rxchan_done* done, + void* handle); /* post a receive request */ + int (*ioctl) (alt_dma_rxchan dma, int req, void* arg); /* perform device + * specific I/O control. + */ +}; + +/* + * Register a DMA transmit channel with the system. + */ + +static ALT_INLINE int alt_dma_txchan_reg (alt_dma_txchan_dev* dev) +{ + extern alt_llist alt_dma_txchan_list; + + return alt_dev_llist_insert((alt_dev_llist*) dev, &alt_dma_txchan_list); +} + +/* + * Register a DMA receive channel with the system. + */ + +static ALT_INLINE int alt_dma_rxchan_reg (alt_dma_rxchan_dev* dev) +{ + extern alt_llist alt_dma_rxchan_list; + + return alt_dev_llist_insert((alt_dev_llist*) dev, &alt_dma_rxchan_list); +} + +/* + * + */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __ALT_DMA_DEV_H__ */ Index: components/sd_card/firmware/bsp/HAL/inc/sys/alt_dma.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/sys/alt_dma.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/sys/alt_dma.h (revision 8) @@ -0,0 +1,226 @@ +#ifndef __ALT_DMA_H__ +#define __ALT_DMA_H__ + +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004-2005 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +/****************************************************************************** +* * +* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. * +* * +******************************************************************************/ + +#include "sys/alt_dma_dev.h" +#include "alt_types.h" + +#include + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +/* + * This header contains the application side interface for accessing DMA + * resources. See alt_dma_dev.h for the dma device driver interface. + * + * The interface model treats a DMA transaction as being composed of two + * halves (read and write). + * + * The application can supply data for transmit using an "alt_dma_txchan" + * descriptor. Alternatively an "alt_dma_rxchan" descriptor can be used to + * receive data. + */ + +/* + * alt_dma_txchan_open() is used to obtain an "alt_dma_txchan" descriptor for + * a DMA transmit device. The name is the name of the associated physical + * device (e.g. "/dev/dma_0"). + * + * The return value will be NULL on failure, and non-NULL otherwise. + */ + +extern alt_dma_txchan alt_dma_txchan_open (const char* name); + +/* + * alt_dma_txchan_close() is provided so that an application can notify the + * system that it has finished with a given DMA transmit channel. This is only + * provided for completness. + */ + +static ALT_INLINE int alt_dma_txchan_close (alt_dma_txchan dma) +{ + return 0; +} + +/* + * alt_dma_txchan_send() posts a transmit request to a DMA transmit channel. + * The input arguments are: + * + * dma: the channel to use. + * from: a pointer to the start of the data to send. + * length: the length of the data to send in bytes. + * done: callback function that will be called once the data has been sent. + * handle: opaque value passed to "done". + * + * The return value will be negative if the request cannot be posted, and + * zero otherwise. + */ + +static ALT_INLINE int alt_dma_txchan_send (alt_dma_txchan dma, + const void* from, + alt_u32 length, + alt_txchan_done* done, + void* handle) +{ + return dma ? dma->dma_send (dma, + from, + length, + done, + handle) : -ENODEV; +} + +/* + * alt_dma_txchan_space() returns the number of tranmit requests that can be + * posted to the specified DMA transmit channel. + * + * A negative value indicates that the value could not be determined. + */ + +static ALT_INLINE int alt_dma_txchan_space (alt_dma_txchan dma) +{ + return dma ? dma->space (dma) : -ENODEV; +} + +/* + * alt_dma_txchan_ioctl() can be used to perform device specific I/O + * operations on the indicated DMA transmit channel. For example some drivers + * support options to control the width of the transfer operations. See + * alt_dma_dev.h for the list of generic requests. + * + * A negative return value indicates failure, otherwise the interpretation + * of the return value is request specific. + */ + +static ALT_INLINE int alt_dma_txchan_ioctl (alt_dma_txchan dma, + int req, + void* arg) +{ + return dma ? dma->ioctl (dma, req, arg) : -ENODEV; +} + +/* + * alt_dma_rxchan_open() is used to obtain an "alt_dma_rxchan" descriptor for + * a DMA receive channel. The name is the name of the associated physical + * device (e.g. "/dev/dma_0"). + * + * The return value will be NULL on failure, and non-NULL otherwise. + */ + +extern alt_dma_rxchan alt_dma_rxchan_open (const char* dev); + +/* + * alt_dma_rxchan_close() is provided so that an application can notify the + * system that it has finished with a given DMA receive channel. This is only + * provided for completness. + */ + +static ALT_INLINE int alt_dma_rxchan_close (alt_dma_rxchan dma) +{ + return 0; +} + +/* + * + */ + +/* + * alt_dma_rxchan_prepare() posts a receive request to a DMA receive channel. + * + * The input arguments are: + * + * dma: the channel to use. + * data: a pointer to the location that data is to be received to. + * len: the maximum length of the data to receive. + * done: callback function that will be called once the data has been + * received. + * handle: opaque value passed to "done". + * + * The return value will be negative if the request cannot be posted, and + * zero otherwise. + */ + +static ALT_INLINE int alt_dma_rxchan_prepare (alt_dma_rxchan dma, + void* data, + alt_u32 len, + alt_rxchan_done* done, + void* handle) +{ + return dma ? dma->prepare (dma, data, len, done, handle) : -ENODEV; +} + +/* + * alt_dma_rxchan_ioctl() can be used to perform device specific I/O + * operations on the indicated DMA receive channel. For example some drivers + * support options to control the width of the transfer operations. See + * alt_dma_dev.h for the list of generic requests. + * + * A negative return value indicates failure, otherwise the interpretation + * of the return value is request specific. + */ + +static ALT_INLINE int alt_dma_rxchan_ioctl (alt_dma_rxchan dma, + int req, + void* arg) +{ + return dma ? dma->ioctl (dma, req, arg) : -ENODEV; +} + +/* + * alt_dma_rxchan_depth() returns the depth of the receive FIFO used to store + * receive requests. + */ + +static ALT_INLINE alt_u32 alt_dma_rxchan_depth(alt_dma_rxchan dma) +{ + return dma->depth; +} + +/* + * + */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __ALT_DMA_H__ */ Index: components/sd_card/firmware/bsp/HAL/inc/sys/alt_sys_init.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/sys/alt_sys_init.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/sys/alt_sys_init.h (revision 8) @@ -0,0 +1,62 @@ +#ifndef __ALT_SYS_INIT_H__ +#define __ALT_SYS_INIT_H__ + +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +/****************************************************************************** +* * +* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. * +* * +******************************************************************************/ + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +/* + * The function alt_sys_init() is defined within the auto-generated file: + * alt_sys_init.c. This function calls the initilisation macros for all + * devices, file systems, and software components within the system. + * + * The list of initilisation macros to use is constructed using the PTF and + * STF files associated with the system. + */ + +extern void alt_sys_init (void); + +#ifdef __cplusplus +} +#endif + +#endif /* __ALT_SYS_INIT_H__ */ Index: components/sd_card/firmware/bsp/HAL/inc/sys/alt_sys_wrappers.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/sys/alt_sys_wrappers.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/sys/alt_sys_wrappers.h (revision 8) @@ -0,0 +1,100 @@ +#ifndef __ALT_SYS_WRAPPERS_H__ +#define __ALT_SYS_WRAPPERS_H__ + +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2003 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +******************************************************************************/ + +/* + * This file provides the prototypes for the HAL 'UNIX style functions. The + * names of these functions are defined in alt_syscall.h. THese are defined to + * be the standard names when running the standalone HAL, e.g. open(), close() + * etc., but the names may be redefined as a part of an operating system port + * in order to avoid name clashes. + */ + +#include "os/alt_syscall.h" + +#include +#include +#include +#include +#include +#include + +extern int ALT_CLOSE (int __fd); +extern int ALT_EXECVE (const char *__path, + char * const __argv[], + char * const __envp[]); +extern void ALT_EXIT (int __status); +extern int ALT_FSTAT (int file, struct stat *st); +extern int ALT_FCNTL (int file, int cmd, ...); +extern pid_t ALT_FORK (void); +extern pid_t ALT_GETPID (void); + +#if defined (__GNUC__) && __GNUC__ >= 4 +extern int ALT_GETTIMEOFDAY (struct timeval *ptimeval, + void *ptimezone); +#else +extern int ALT_GETTIMEOFDAY (struct timeval *ptimeval, + struct timezone *ptimezone); +#endif + +extern int ALT_IOCTL (int file, int req, void* arg); +extern int ALT_ISATTY (int file); +extern int ALT_KILL (int pid, int sig); +extern int ALT_LINK (const char *existing, const char *new); +extern off_t ALT_LSEEK (int file, off_t ptr, int dir); +extern int ALT_OPEN (const char* file, int flags, ...); +extern int ALT_READ (int file, void *ptr, size_t len); +extern int ALT_RENAME (char *existing, char *new); +extern void* ALT_SBRK (ptrdiff_t incr); +extern int ALT_SETTIMEOFDAY (const struct timeval *t, + const struct timezone *tz); +extern int ALT_STAT (const char *file, struct stat *st); +extern clock_t ALT_TIMES (struct tms *buf); +extern int ALT_UNLINK (const char *name); + +#if defined (__GNUC__) && __GNUC__ >= 4 +int ALT_USLEEP (useconds_t us); +#else +unsigned int ALT_USLEEP (unsigned int us); +#endif + +extern int ALT_WAIT (int *status); +extern int ALT_WRITE (int file, const void *ptr, size_t len); + + +extern char** ALT_ENVIRON; + +/* + * + */ + +#endif /* __ALT_SYS_WRAPPERS_H__ */ Index: components/sd_card/firmware/bsp/HAL/inc/sys/alt_cache.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/sys/alt_cache.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/sys/alt_cache.h (revision 8) @@ -0,0 +1,117 @@ +#ifndef __ALT_CACHE_H__ +#define __ALT_CACHE_H__ + +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2003, 2007 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +******************************************************************************/ + +#include + +#include "alt_types.h" + +/* + * alt_cache.h defines the processor specific functions for manipulating the + * cache. + */ + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +/* + * alt_icache_flush() is called to flush the instruction cache for a memory + * region of length "len" bytes, starting at address "start". + */ + +extern void alt_icache_flush (void* start, alt_u32 len); + +/* + * alt_dcache_flush() is called to flush the data cache for a memory + * region of length "len" bytes, starting at address "start". + * Any dirty lines in the data cache are written back to memory. + */ + +extern void alt_dcache_flush (void* start, alt_u32 len); + +/* + * alt_dcache_flush() is called to flush the data cache for a memory + * region of length "len" bytes, starting at address "start". + * Any dirty lines in the data cache are NOT written back to memory. + */ + +extern void alt_dcache_flush_no_writeback (void* start, alt_u32 len); + +/* + * Flush the entire instruction cache. + */ + +extern void alt_icache_flush_all (void); + +/* + * Flush the entire data cache. + */ + +extern void alt_dcache_flush_all (void); + +/* + * Allocate a block of uncached memory. + */ + +extern volatile void* alt_uncached_malloc (size_t size); + +/* + * Free a block of uncached memory. + */ + +extern void alt_uncached_free (volatile void* ptr); + +/* + * Convert a pointer to a block of cached memory, into a block of + * uncached memory. + */ + +extern volatile void* alt_remap_uncached (void* ptr, alt_u32 len); + +/* + * Convert a pointer to a block of uncached memory, into a block of + * cached memory. + */ + +extern void* alt_remap_cached (volatile void* ptr, alt_u32 len); + +/* + * + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __ALT_CACHE_H__ */ Index: components/sd_card/firmware/bsp/HAL/inc/sys/alt_timestamp.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/sys/alt_timestamp.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/sys/alt_timestamp.h (revision 8) @@ -0,0 +1,60 @@ +#ifndef __ALT_TIMESTAMP_H__ +#define __ALT_TIMESTAMP_H__ + +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +/****************************************************************************** +* * +* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. * +* * +******************************************************************************/ + +#include "alt_types.h" +#include "altera_avalon_timer.h" + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +extern int alt_timestamp_start (void); + +extern alt_timestamp_type alt_timestamp (void); + +extern alt_u32 alt_timestamp_freq (void); + +#ifdef __cplusplus +} +#endif + +#endif /* __ALT_TIMESTAMP_H__ */ Index: components/sd_card/firmware/bsp/HAL/inc/sys/alt_log_printf.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/sys/alt_log_printf.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/sys/alt_log_printf.h (revision 8) @@ -0,0 +1,349 @@ +/* alt_log_printf.h + * + * ALT_LOG is designed to provide extra logging/debugging messages from HAL + * through a different port than stdout. It is enabled by the ALT_LOG_ENABLE + * define, which needs to supplied at compile time. When logging is turned off, + * code size is unaffected. Thus, this should be transparent to the user + * when it is not actively turned on, and should not affect projects in any way. + * + * There are macros sprinkled within different components, such as the jtag uart + * and timer, in the HAL code. They are always named ALT_LOG_, and can be + * safely ignored if ALT_LOG is turned off. + * + * To turn on ALT_LOG, ALT_LOG_ENABLE must be defined, and ALT_LOG_PORT_TYPE and + * ALT_LOG_PORT_BASE must be set in system.h. This is done through editing + * .ptf, by editing the alt_log_port_type & alt_log_port_base settings. + * See the documentation html file for examples. + * + * When it is turned on, it will output extra HAL messages to a port specified + * in system.h. This can be a UART or JTAG UART port. By default it will + * output boot messages, detailing every step of the boot process. + * + * Extra logging is designed to be enabled by flags, which are defined in + * alt_log_printf.c. The default value is that all flags are off, so only the + * boot up logging messages show up. ALT_LOG_FLAGS can be set to enable certain + * groupings of flags, and that grouping is done in this file. Each flag can + * also be overridden with a -D at compile time. + * + * This header file includes the necessary prototypes for using the alt_log + * functions. It also contains all the macros that are used to remove the code + * from alt log is turned off. Also, the macros in other HAL files are defined + * here at the bottom. These macros all call some C function that is in + * alt_log_printf.c. + * + * The logging has functions for printing in C (ALT_LOG_PRINTF) and in assembly + * (ALT_LOG_PUTS). This was needed because the assembly printing occurs before + * the device is initialized. The assembly function corrupts register R4-R7, + * which are not used in the normal boot process. For this reason, do not call + * the assembly function in C. + * + * author: gkwan + */ + + +#ifndef __ALT_LOG_PRINTF_H__ +#define __ALT_LOG_PRINTF_H__ + +#include + +/* Global switch to turn on logging functions */ +#ifdef ALT_LOG_ENABLE + + /* ALT_LOG_PORT_TYPE values as defined in system.h. They are defined as + * numbers here first becasue the C preprocessor does not handle string + * comparisons. */ + #define ALTERA_AVALON_JTAG_UART 1 + #define ALTERA_AVALON_UART 0 + + /* If this .h file is included by an assembly file, skip over include files + * that won't compile in assembly. */ + #ifndef ALT_ASM_SRC + #include + #include "sys/alt_alarm.h" + #include "sys/alt_dev.h" + #ifdef __ALTERA_AVALON_JTAG_UART + #include "altera_avalon_jtag_uart.h" + #endif + #endif /* ALT_ASM_SRC */ + + /* These are included for the port register offsets and masks, needed + * to write to the port. Only include if the port type is set correctly, + * otherwise error. If alt_log is turned on and the port to output to is + * incorrect or does not exist, then should exit. */ + #if ALT_LOG_PORT_TYPE == ALTERA_AVALON_JTAG_UART + #ifdef __ALTERA_AVALON_JTAG_UART + #include + #else + #error ALT_LOG: JTAG_UART port chosen, but no JTAG_UART in system. + #endif + #elif ALT_LOG_PORT_TYPE == ALTERA_AVALON_UART + #ifdef __ALTERA_AVALON_UART + #include + #else + #error ALT_LOG: UART Port chosen, but no UART in system. + #endif + #else + #error ALT_LOG: alt_log_port_type declaration invalid! + #endif + + /* ALT_LOG_ENABLE turns on the basic printing function */ + #define ALT_LOG_PRINTF(...) do {alt_log_printf_proc(__VA_ARGS__);} while (0) + + /* Assembly macro for printing in assembly, calls tx_log_str + * which is in alt_log_macro.S. + * If alt_log_boot_on_flag is 0, skips the printing */ + #define ALT_LOG_PUTS(str) movhi r4, %hiadj(alt_log_boot_on_flag) ; \ + addi r4, r4, %lo(alt_log_boot_on_flag) ; \ + ldwio r5, 0(r4) ; \ + beq r0, r5, 0f ; \ + movhi r4, %hiadj(str) ; \ + addi r4, r4, %lo(str) ; \ + call tx_log_str ; \ + 0: + + /* These defines are here to faciliate the use of one output function + * (alt_log_txchar) to print to both the JTAG UART or the UART. Depending + * on the port type, the status register, read mask, and output register + * are set to the appropriate value for the port. */ + #if ALT_LOG_PORT_TYPE == ALTERA_AVALON_JTAG_UART + #define ALT_LOG_PRINT_REG_RD IORD_ALTERA_AVALON_JTAG_UART_CONTROL + #define ALT_LOG_PRINT_MSK ALTERA_AVALON_JTAG_UART_CONTROL_WSPACE_MSK + #define ALT_LOG_PRINT_TXDATA_WR IOWR_ALTERA_AVALON_JTAG_UART_DATA + #define ALT_LOG_PRINT_REG_OFFSET (ALTERA_AVALON_JTAG_UART_CONTROL_REG*0x4) + #define ALT_LOG_PRINT_TXDATA_REG_OFFSET (ALTERA_AVALON_JTAG_UART_DATA_REG*0x4) + #elif ALT_LOG_PORT_TYPE == ALTERA_AVALON_UART + #define ALT_LOG_PRINT_REG_RD IORD_ALTERA_AVALON_UART_STATUS + #define ALT_LOG_PRINT_MSK ALTERA_AVALON_UART_STATUS_TRDY_MSK + #define ALT_LOG_PRINT_TXDATA_WR IOWR_ALTERA_AVALON_UART_TXDATA + #define ALT_LOG_PRINT_REG_OFFSET (ALTERA_AVALON_UART_STATUS_REG*0x4) + #define ALT_LOG_PRINT_TXDATA_REG_OFFSET (ALTERA_AVALON_UART_TXDATA_REG*0x4) + #endif /* ALT_LOG_PORT */ + + /* Grouping of flags via ALT_LOG_FLAGS. Each specific flag can be set via + * -D at compile time, or else they'll be set to a default value according + * to ALT_LOG_FLAGS. ALT_LOG_FLAGS = 0 or not set is the default, where + * only the boot messages will be printed. As ALT_LOG_FLAGS increase, they + * increase in intrusiveness to the program, and will affect performance. + * + * Flag Level 1 - turns on system clock and JTAG UART startup status + * 2 - turns on write echo and JTAG_UART alarm (periodic report) + * 3 - turns on JTAG UART ISR logging - will slow performance + * significantly. + * -1 - All logging output is off, but if ALT_LOG_ENABLE is + * defined all logging function is built and code size + * remains constant + * + * Flag settings - 1 = on, 0 = off. */ + + /* This flag turns on "boot" messages for printing. This includes messages + * during crt0.S, then alt_main, and finally alt_exit. */ + #ifndef ALT_LOG_BOOT_ON_FLAG_SETTING + #if ALT_LOG_FLAGS == 1 + #define ALT_LOG_BOOT_ON_FLAG_SETTING 0x1 + #elif ALT_LOG_FLAGS == 2 + #define ALT_LOG_BOOT_ON_FLAG_SETTING 0x1 + #elif ALT_LOG_FLAGS == 3 + #define ALT_LOG_BOOT_ON_FLAG_SETTING 0x1 + #elif ALT_LOG_FLAGS == -1 /* silent mode */ + #define ALT_LOG_BOOT_ON_FLAG_SETTING 0x0 + #else /* default setting */ + #define ALT_LOG_BOOT_ON_FLAG_SETTING 0x1 + #endif + #endif /* ALT_LOG_BOOT_ON_FLAG_SETTING */ + + #ifndef ALT_LOG_SYS_CLK_ON_FLAG_SETTING + #if ALT_LOG_FLAGS == 1 + #define ALT_LOG_SYS_CLK_ON_FLAG_SETTING 0x1 + #elif ALT_LOG_FLAGS == 2 + #define ALT_LOG_SYS_CLK_ON_FLAG_SETTING 0x1 + #elif ALT_LOG_FLAGS == 3 + #define ALT_LOG_SYS_CLK_ON_FLAG_SETTING 0x1 + #elif ALT_LOG_FLAGS == -1 /* silent mode */ + #define ALT_LOG_SYS_CLK_ON_FLAG_SETTING 0x0 + #else /* default setting */ + #define ALT_LOG_SYS_CLK_ON_FLAG_SETTING 0x0 + #endif + #endif /* ALT_LOG_SYS_CLK_ON_FLAG_SETTING */ + + #ifndef ALT_LOG_WRITE_ON_FLAG_SETTING + #if ALT_LOG_FLAGS == 1 + #define ALT_LOG_WRITE_ON_FLAG_SETTING 0x0 + #elif ALT_LOG_FLAGS == 2 + #define ALT_LOG_WRITE_ON_FLAG_SETTING 0x1 + #elif ALT_LOG_FLAGS == 3 + #define ALT_LOG_WRITE_ON_FLAG_SETTING 0x1 + #elif ALT_LOG_FLAGS == -1 /* silent mode */ + #define ALT_LOG_WRITE_ON_FLAG_SETTING 0x0 + #else /* default setting */ + #define ALT_LOG_WRITE_ON_FLAG_SETTING 0x0 + #endif + #endif /* ALT_LOG_WRITE_ON_FLAG_SETTING */ + + #ifndef ALT_LOG_JTAG_UART_ALARM_ON_FLAG_SETTING + #ifndef __ALTERA_AVALON_JTAG_UART + #define ALT_LOG_JTAG_UART_ALARM_ON_FLAG_SETTING 0x0 + #elif ALT_LOG_FLAGS == 1 + #define ALT_LOG_JTAG_UART_ALARM_ON_FLAG_SETTING 0x0 + #elif ALT_LOG_FLAGS == 2 + #define ALT_LOG_JTAG_UART_ALARM_ON_FLAG_SETTING 0x1 + #elif ALT_LOG_FLAGS == 3 + #define ALT_LOG_JTAG_UART_ALARM_ON_FLAG_SETTING 0x1 + #elif ALT_LOG_FLAGS == -1 /* silent mode */ + #define ALT_LOG_JTAG_UART_ALARM_ON_FLAG_SETTING 0x0 + #else /* default setting */ + #define ALT_LOG_JTAG_UART_ALARM_ON_FLAG_SETTING 0x0 + #endif + #endif /* ALT_LOG_JTAG_UART_ALARM_ON_FLAG_SETTING */ + + #ifndef ALT_LOG_JTAG_UART_STARTUP_INFO_ON_FLAG_SETTING + #ifndef __ALTERA_AVALON_JTAG_UART + #define ALT_LOG_JTAG_UART_STARTUP_INFO_ON_FLAG_SETTING 0x0 + #elif ALT_LOG_FLAGS == 1 + #define ALT_LOG_JTAG_UART_STARTUP_INFO_ON_FLAG_SETTING 0x1 + #elif ALT_LOG_FLAGS == 2 + #define ALT_LOG_JTAG_UART_STARTUP_INFO_ON_FLAG_SETTING 0x1 + #elif ALT_LOG_FLAGS == 3 + #define ALT_LOG_JTAG_UART_STARTUP_INFO_ON_FLAG_SETTING 0x1 + #elif ALT_LOG_FLAGS == -1 /* silent mode */ + #define ALT_LOG_JTAG_UART_STARTUP_INFO_ON_FLAG_SETTING 0x0 + #else /* default setting */ + #define ALT_LOG_JTAG_UART_STARTUP_INFO_ON_FLAG_SETTING 0x0 + #endif + #endif /* ALT_LOG_JTAG_UART_STARTUP_INFO_FLAG_SETTING */ + + #ifndef ALT_LOG_JTAG_UART_ISR_ON_FLAG_SETTING + #ifndef __ALTERA_AVALON_JTAG_UART + #define ALT_LOG_JTAG_UART_ISR_ON_FLAG_SETTING 0x0 + #elif ALT_LOG_FLAGS == 1 + #define ALT_LOG_JTAG_UART_ISR_ON_FLAG_SETTING 0x0 + #elif ALT_LOG_FLAGS == 2 + #define ALT_LOG_JTAG_UART_ISR_ON_FLAG_SETTING 0x0 + #elif ALT_LOG_FLAGS == 3 + #define ALT_LOG_JTAG_UART_ISR_ON_FLAG_SETTING 0x1 + #elif ALT_LOG_FLAGS == -1 /* silent mode */ + #define ALT_LOG_JTAG_UART_ISR_ON_FLAG_SETTING 0x0 + #else /* default setting */ + #define ALT_LOG_JTAG_UART_ISR_ON_FLAG_SETTING 0x0 + #endif + #endif /* ALT_LOG_JTAG_UART_ISR_ON_FLAG_SETTING */ + +#ifndef ALT_ASM_SRC + /* Function Prototypes */ + void alt_log_txchar(int c,char *uartBase); + void alt_log_private_printf(const char *fmt,int base,va_list args); + void alt_log_repchar(char c,int r,int base); + int alt_log_printf_proc(const char *fmt, ... ); + void alt_log_system_clock(); + #ifdef __ALTERA_AVALON_JTAG_UART + alt_u32 altera_avalon_jtag_uart_report_log(void * context); + void alt_log_jtag_uart_startup_info(altera_avalon_jtag_uart_state* dev, int base); + void alt_log_jtag_uart_print_control_reg(altera_avalon_jtag_uart_state* dev, \ + int base, const char* header); + void alt_log_jtag_uart_isr_proc(int base, altera_avalon_jtag_uart_state* dev); + #endif + void alt_log_write(const void *ptr, size_t len); + + /* extern all global variables */ + extern volatile alt_u32 alt_log_boot_on_flag; + extern volatile alt_u8 alt_log_write_on_flag; + extern volatile alt_u8 alt_log_sys_clk_on_flag; + extern volatile alt_u8 alt_log_jtag_uart_alarm_on_flag; + extern volatile alt_u8 alt_log_jtag_uart_isr_on_flag; + extern volatile alt_u8 alt_log_jtag_uart_startup_info_on_flag; + extern volatile int alt_log_sys_clk_count; + extern volatile int alt_system_clock_in_sec; + extern alt_alarm alt_log_jtag_uart_alarm_1; +#endif /* ALT_ASM_SRC */ + + + /* Below are the MACRO defines used in various HAL files. They check + * if their specific flag is turned on; if it is, then it executes its + * code. + * + * To keep this file reasonable, most of these macros calls functions, + * which are defined in alt_log_printf.c. Look there for implementation + * details. */ + + /* Boot Messages Logging */ + #define ALT_LOG_PRINT_BOOT(...) \ + do { if (alt_log_boot_on_flag==1) {ALT_LOG_PRINTF(__VA_ARGS__);} \ + } while (0) + + /* JTAG UART Logging */ + /* number of ticks before alarm runs logging function */ + #ifndef ALT_LOG_JTAG_UART_TICKS_DIVISOR + #define ALT_LOG_JTAG_UART_TICKS_DIVISOR 10 + #endif + #ifndef ALT_LOG_JTAG_UART_TICKS + #define ALT_LOG_JTAG_UART_TICKS \ + (alt_ticks_per_second()/ALT_LOG_JTAG_UART_TICKS_DIVISOR) + #endif + + /* if there's a JTAG UART defined, then enable these macros */ + #ifdef __ALTERA_AVALON_JTAG_UART + + /* Macro in altera_avalon_jtag_uart.c, to register the alarm function. + * Also, the startup register info is also printed here, as this is + * called within the device driver initialization. */ + #define ALT_LOG_JTAG_UART_ALARM_REGISTER(dev, base) \ + do { if (alt_log_jtag_uart_alarm_on_flag==1) { \ + alt_alarm_start(&alt_log_jtag_uart_alarm_1, \ + ALT_LOG_JTAG_UART_TICKS, &altera_avalon_jtag_uart_report_log,\ + dev);} \ + if (alt_log_jtag_uart_startup_info_on_flag==1) {\ + alt_log_jtag_uart_startup_info(dev, base);} \ + } while (0) + + /* JTAG UART IRQ Logging (when buffer is empty) + * Inserted in the ISR in altera_avalon_jtag_uart.c */ + #define ALT_LOG_JTAG_UART_ISR_FUNCTION(base, dev) \ + do { alt_log_jtag_uart_isr_proc(base, dev); } while (0) + /* else, define macros to nothing. Or else the jtag_uart specific types + * will throw compiler errors */ + #else + #define ALT_LOG_JTAG_UART_ALARM_REGISTER(dev, base) + #define ALT_LOG_JTAG_UART_ISR_FUNCTION(base, dev) + #endif + + /* System clock logging + * How often (in seconds) the system clock logging prints. + * The default value is every 1 second */ + #ifndef ALT_LOG_SYS_CLK_INTERVAL_MULTIPLIER + #define ALT_LOG_SYS_CLK_INTERVAL_MULTIPLIER 1 + #endif + #ifndef ALT_LOG_SYS_CLK_INTERVAL + #define ALT_LOG_SYS_CLK_INTERVAL \ + (alt_ticks_per_second()*ALT_LOG_SYS_CLK_INTERVAL_MULTIPLIER) + #endif + + /* System clock logging - prints a message every interval (set above) + * to show that the system clock is alive. + * This macro is used in altera_avalon_timer_sc.c */ + #define ALT_LOG_SYS_CLK_HEARTBEAT() \ + do { alt_log_system_clock(); } while (0) + + /* alt_write_logging - echos a message every time write() is called, + * displays the first ALT_LOG_WRITE_ECHO_LEN characters. + * This macro is used in alt_write.c */ + #ifndef ALT_LOG_WRITE_ECHO_LEN + #define ALT_LOG_WRITE_ECHO_LEN 15 + #endif + + #define ALT_LOG_WRITE_FUNCTION(ptr,len) \ + do { alt_log_write(ptr,len); } while (0) + +#else /* ALT_LOG_ENABLE not defined */ + + /* logging is off, set all relevant macros to null */ + #define ALT_LOG_PRINT_BOOT(...) + #define ALT_LOG_PRINTF(...) + #define ALT_LOG_JTAG_UART_ISR_FUNCTION(base, dev) + #define ALT_LOG_JTAG_UART_ALARM_REGISTER(dev, base) + #define ALT_LOG_SYS_CLK_HEARTBEAT() + #define ALT_LOG_PUTS(str) + #define ALT_LOG_WRITE_FUNCTION(ptr,len) + +#endif /* ALT_LOG_ENABLE */ + +#endif /* __ALT_LOG_PRINTF_H__ */ + Index: components/sd_card/firmware/bsp/HAL/inc/sys/alt_stack.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/sys/alt_stack.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/sys/alt_stack.h (revision 8) @@ -0,0 +1,126 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +******************************************************************************/ + +#ifndef __ALT_STACK_H__ +#define __ALT_STACK_H__ + +/* + * alt_stack.h is the nios2 specific implementation of functions used by the + * stack overflow code. + */ + +#include "nios2.h" + +#include "alt_types.h" + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + + +extern char * alt_stack_limit_value; + +#ifdef ALT_EXCEPTION_STACK +extern char __alt_exception_stack_pointer[]; /* set by the linker */ +#endif /* ALT_EXCEPTION_STACK */ + + +/* + * alt_stack_limit can be called to determine the current value of the stack + * limit register. + */ + +static ALT_INLINE char * ALT_ALWAYS_INLINE alt_stack_limit (void) +{ + char * limit; + NIOS2_READ_ET(limit); + + return limit; +} + +/* + * alt_stack_pointer can be called to determine the current value of the stack + * pointer register. + */ + +static ALT_INLINE char * ALT_ALWAYS_INLINE alt_stack_pointer (void) +{ + char * pointer; + NIOS2_READ_SP(pointer); + + return pointer; +} + + +#ifdef ALT_EXCEPTION_STACK + +/* + * alt_exception_stack_pointer returns the normal stack pointer from + * where it is stored on the exception stack (uppermost 4 bytes). This + * is really only useful during exception processing, and is only + * available if a separate exception stack has been configured. + */ + +static ALT_INLINE char * ALT_ALWAYS_INLINE alt_exception_stack_pointer (void) +{ + return (char *) *(alt_u32 *)(__alt_exception_stack_pointer - sizeof(alt_u32)); +} + +#endif /* ALT_EXCEPTION_STACK */ + + +/* + * alt_set_stack_limit can be called to update the current value of the stack + * limit register. + */ + +static ALT_INLINE void ALT_ALWAYS_INLINE alt_set_stack_limit (char * limit) +{ + alt_stack_limit_value = limit; + NIOS2_WRITE_ET(limit); +} + +/* + * alt_report_stack_overflow reports that a stack overflow happened. + */ + +static ALT_INLINE void ALT_ALWAYS_INLINE alt_report_stack_overflow (void) +{ + NIOS2_REPORT_STACK_OVERFLOW(); +} + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __ALT_STACK_H__ */ + Index: components/sd_card/firmware/bsp/HAL/inc/sys/alt_warning.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/sys/alt_warning.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/sys/alt_warning.h (revision 8) @@ -0,0 +1,75 @@ +#ifndef __WARNING_H__ +#define __WARNING_H__ + +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2003 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +******************************************************************************/ + +/* + * alt_warning.h provides macro definitions that can be used to generate link + * time warnings. + */ + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +/* + * The symbol "__alt_invalid" is used to force a link error. There should be + * no corresponding implementation of this function. + */ + +extern void __alt_invalid (void); + +#define ALT_LINK_WARNING(symbol, msg) \ + __asm__(".ifndef __evoke_link_warning_" #symbol \ + "\n\t .section .gnu.warning." #symbol \ + "\n__evoke_link_warning_" #symbol ":\n\t .string \x22" msg "\x22 \n\t .previous" \ + "\n .endif"); + +/* A canned warning for sysdeps/stub functions. */ + +#define ALT_STUB_WARNING(name) \ + ALT_LINK_WARNING (name, \ + "warning: " #name " is not implemented and will always fail") + +#define ALT_OBSOLETE_FUNCTION_WARNING(name) \ + ALT_LINK_WARNING (name, \ + "warning: " #name " is a deprecated function") + +#define ALT_LINK_ERROR(msg) \ + ALT_LINK_WARNING (__alt_invalid, msg); \ + __alt_invalid() + +#ifdef __cplusplus +} +#endif + +#endif /* __WARNING_H__ */ Index: components/sd_card/firmware/bsp/HAL/inc/sys/alt_set_args.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/sys/alt_set_args.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/sys/alt_set_args.h (revision 8) @@ -0,0 +1,71 @@ +#ifndef __ALT_SET_ARGS_H__ +#define __ALT_SET_ARGS_H__ + +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +/****************************************************************************** +* * +* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. * +* * +******************************************************************************/ + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +/* + * The function alt_set_args() is provided in order to define the input + * arguments to main(). If this function is not called before main() then the + * argument list passed to main() will be empty. + * + * It is expected that this function will only be used by the ihost/iclient + * utility. + */ + +static inline void alt_set_args (int argc, char** argv, char** envp) +{ + extern int alt_argc; + extern char** alt_argv; + extern char** alt_envp; + + alt_argc = argc; + alt_argv = argv; + alt_envp = envp; +} + +#ifdef __cplusplus +} +#endif + +#endif /* __ALT_SET_ARGS_H__ */ Index: components/sd_card/firmware/bsp/HAL/inc/sys/ioctl.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/sys/ioctl.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/sys/ioctl.h (revision 8) @@ -0,0 +1,90 @@ +#ifndef __IOCTL_H__ +#define __IOCTL_H__ + +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +/****************************************************************************** +* * +* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. * +* * +******************************************************************************/ + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +/* + * The ioctl() system call be used to initiate a variety of control operations + * on a file descriptor. For the most part this simply translates to a call to + * the ioctl() function of the associated device driver (TIOCEXCL and + * TIOCNXCL are notable exceptions - see ioctl.c for details). + * + * The interpretation of the ioctl requests are therefore device specific. + * + * This function is equivalent to the standard Posix ioctl() call. + */ + +extern int ioctl (int fd, int req, void* arg); + +/* + * list of ioctl calls handled by the system ioctl implementation. + */ + +#define TIOCEXCL 0x740d /* exclusive use of the device */ +#define TIOCNXCL 0x740e /* allow multiple use of the device */ + +/* + * ioctl calls which can be handled by device drivers. + */ + +#define TIOCOUTQ 0x7472 /* get output queue size */ +#define TIOCMGET 0x741d /* get termios flags */ +#define TIOCMSET 0x741a /* set termios flags */ + +/* + * ioctl calls specific to JTAG UART. + */ + +#define TIOCSTIMEOUT 0x6a01 /* Set Timeout before assuming no host present */ +#define TIOCGCONNECTED 0x6a02 /* Get indication of whether host is connected */ + +/* + * + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __IOCTL_H__ */ Index: components/sd_card/firmware/bsp/HAL/inc/sys/alt_irq_entry.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/sys/alt_irq_entry.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/sys/alt_irq_entry.h (revision 8) @@ -0,0 +1,39 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2003 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +******************************************************************************/ + +/* + * This file pulls in the IRQ entry assembler and C code, which is only + * required if there are any interruptes in the system. + */ + +__asm__( "\n\t.globl alt_irq_entry" ); + +__asm__( "\n\t.globl alt_irq_handler" ); + Index: components/sd_card/firmware/bsp/HAL/inc/sys/alt_dev.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/sys/alt_dev.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/sys/alt_dev.h (revision 8) @@ -0,0 +1,115 @@ +#ifndef __ALT_DEV_H__ +#define __ALT_DEV_H__ + +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +/****************************************************************************** +* * +* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. * +* * +******************************************************************************/ + +#include "system.h" +#include "sys/alt_llist.h" +#include "priv/alt_dev_llist.h" + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +/* + * The value ALT_IRQ_NOT_CONNECTED is used to represent an unconnected + * interrupt line. It cannot evaluate to a valid interrupt number. + */ + +#define ALT_IRQ_NOT_CONNECTED (-1) + +typedef struct alt_dev_s alt_dev; + +struct stat; + +/* + * The file descriptor structure definition. + */ + +typedef struct alt_fd_s +{ + alt_dev* dev; + alt_u8* priv; + int fd_flags; +} alt_fd; + +/* + * The device structure definition. + */ + +struct alt_dev_s { + alt_llist llist; /* for internal use */ + const char* name; + int (*open) (alt_fd* fd, const char* name, int flags, int mode); + int (*close) (alt_fd* fd); + int (*read) (alt_fd* fd, char* ptr, int len); + int (*write) (alt_fd* fd, const char* ptr, int len); + int (*lseek) (alt_fd* fd, int ptr, int dir); + int (*fstat) (alt_fd* fd, struct stat* buf); + int (*ioctl) (alt_fd* fd, int req, void* arg); +}; + +/* + * Functions used to register device for access through the C standard + * library. + * + * The only difference between alt_dev_reg() and alt_fs_reg() is the + * interpretation that open() places on the device name. In the case of + * alt_dev_reg the device is assumed to be a particular character device, + * and so there must be an exact match in the name for open to succeed. + * In the case of alt_fs_reg() the name of the device is treated as the + * mount point for a directory, and so any call to open() where the name + * is the root of the device filename will succeed. + */ + +extern int alt_fs_reg (alt_dev* dev); + +static ALT_INLINE int alt_dev_reg (alt_dev* dev) +{ + extern alt_llist alt_dev_list; + + return alt_dev_llist_insert ((alt_dev_llist*) dev, &alt_dev_list); +} + +#ifdef __cplusplus +} +#endif + +#endif /* __ALT_DEV_H__ */ Index: components/sd_card/firmware/bsp/HAL/inc/sys/alt_load.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/sys/alt_load.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/sys/alt_load.h (revision 8) @@ -0,0 +1,78 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2005 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +#include "alt_types.h" + +/* + * This macro is used to load code/data from its load address to its + * execution address for a given section. The section name is the input + * argument. Note that a leading '.' is assumed in the name. For example + * to load the section .onchip_ram, use: + * + * ALT_LOAD_SECTION_BY_NAME(onchip_ram); + * + * This requires that the apropriate linker symbols have been generated + * for the section in question. This will be the case if you are using the + * default linker script. + */ + +#define ALT_LOAD_SECTION_BY_NAME(name) \ + { \ + extern void _alt_partition_##name##_start; \ + extern void _alt_partition_##name##_end; \ + extern void _alt_partition_##name##_load_addr; \ + \ + alt_load_section(&_alt_partition_##name##_load_addr, \ + &_alt_partition_##name##_start, \ + &_alt_partition_##name##_end); \ + } + +/* + * Function used to load an individual section from flash to RAM. + * + * There is an implicit assumption here that the linker script will ensure + * that all sections are word aligned. + * + */ + +static void ALT_INLINE alt_load_section (alt_u32* from, + alt_u32* to, + alt_u32* end) +{ + if (to != from) + { + while( to != end ) + { + *to++ = *from++; + } + } +} Index: components/sd_card/firmware/bsp/HAL/inc/sys/alt_flash_types.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/sys/alt_flash_types.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/sys/alt_flash_types.h (revision 8) @@ -0,0 +1,64 @@ +#ifndef __ALT_FLASH_TYPES_H__ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +/****************************************************************************** +* * +* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. * +* * +******************************************************************************/ + +/****************************************************************************** +* * +* Alt_flash_types.h - Some generic types and defines used by the flash code * +* * +* Author PRR * +* * +******************************************************************************/ +#define __ALT_FLASH_TYPES_H__ + +#ifndef ALT_MAX_NUMBER_OF_FLASH_REGIONS +#define ALT_MAX_NUMBER_OF_FLASH_REGIONS 8 +#endif /* ALT_MAX_NUMBER_OF_FLASH_REGIONS */ + +/* + * Description of a single Erase region + */ +typedef struct flash_region +{ + int offset; + int region_size; + int number_of_blocks; + int block_size; +}flash_region; + +#endif /* __ALT_FLASH_TYPES_H__ */ Index: components/sd_card/firmware/bsp/HAL/inc/sys/alt_exceptions.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/sys/alt_exceptions.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/sys/alt_exceptions.h (revision 8) @@ -0,0 +1,166 @@ +#ifndef __ALT_EXCEPTIONS_H__ +#define __ALT_EXCEPTIONS_H__ + +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2008 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +******************************************************************************/ +#include "alt_types.h" +#include "system.h" + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +/* + * This file defines instruction-generated exception handling and registry + * API, exception type enumeration, and handler return value enumeration for + * Nios II. + */ + +/* + * The following enumeration describes the value in the CPU EXCEPTION + * register CAUSE bit field. + */ +enum alt_exception_cause_e { + /* + * This value is passed to an exception handler's cause argument if + * "extra exceptions" information (EXECPTION) register is not + * present in the processor hardware configuration. + */ + NIOS2_EXCEPTION_CAUSE_NOT_PRESENT = -1, + + /* + * Real values + */ + NIOS2_EXCEPTION_RESET = 0, + NIOS2_EXCEPTION_CPU_ONLY_RESET_REQUEST = 1, + NIOS2_EXCEPTION_INTERRUPT = 2, + NIOS2_EXCEPTION_TRAP_INST = 3, + NIOS2_EXCEPTION_UNIMPLEMENTED_INST = 4, + NIOS2_EXCEPTION_ILLEGAL_INST = 5, + NIOS2_EXCEPTION_MISALIGNED_DATA_ADDR = 6, + NIOS2_EXCEPTION_MISALIGNED_TARGET_PC = 7, + NIOS2_EXCEPTION_DIVISION_ERROR = 8, + NIOS2_EXCEPTION_SUPERVISOR_ONLY_INST_ADDR = 9, + NIOS2_EXCEPTION_SUPERVISOR_ONLY_INST = 10, + NIOS2_EXCEPTION_SUPERVISOR_ONLY_DATA_ADDR = 11, + NIOS2_EXCEPTION_TLB_MISS = 12, + NIOS2_EXCEPTION_TLB_EXECUTE_PERM_VIOLATION = 13, + NIOS2_EXCEPTION_TLB_READ_PERM_VIOLATION = 14, + NIOS2_EXCEPTION_TLB_WRITE_PERM_VIOLATION = 15, + NIOS2_EXCEPTION_MPU_INST_REGION_VIOLATION = 16, + NIOS2_EXCEPTION_MPU_DATA_REGION_VIOLATION = 17, + NIOS2_EXCEPTION_ECC_TLB_ERR = 18, + NIOS2_EXCEPTION_ECC_FETCH_ERR = 19, + NIOS2_EXCEPTION_ECC_REGISTER_FILE_ERR = 20, + NIOS2_EXCEPTION_ECC_DATA_ERR = 21, + NIOS2_EXCEPTION_ECC_DATA_CACHE_WRITEBACK_ERR = 22 +}; +typedef enum alt_exception_cause_e alt_exception_cause; + +/* + * These define valid return values for a user-defined instruction-generated + * exception handler. The handler should return one of these to indicate + * whether to re-issue the instruction that triggered the exception, or to + * skip it. + */ +enum alt_exception_result_e { + NIOS2_EXCEPTION_RETURN_REISSUE_INST = 0, + NIOS2_EXCEPTION_RETURN_SKIP_INST = 1 +}; +typedef enum alt_exception_result_e alt_exception_result; + +/* + * alt_instruction_exception_register() can be used to register an exception + * handler for instruction-generated exceptions that are not handled by the + * built-in exception handler (i.e. for interrupts). + * + * The registry API is optionally enabled through the "Enable + * Instruction-related Exception API" HAL BSP setting, which will + * define the macro below. + */ +#ifdef ALT_INCLUDE_INSTRUCTION_RELATED_EXCEPTION_API +void alt_instruction_exception_register ( + alt_exception_result (*exception_handler)( + alt_exception_cause cause, + alt_u32 exception_pc, + alt_u32 bad_addr) ); +#endif /*ALT_INCLUDE_INSTRUCTION_RELATED_EXCEPTION_API */ + +/* + * alt_exception_cause_generated_bad_addr() indicates whether a particular + * exception cause value was from an exception-type that generated a valid + * address in the BADADDR register. The contents of BADADDR is passed to + * a user-registered exception handler in all cases, whether valid or not. + * This routine should be called to validate the bad_addr argument to + * your exception handler. + * + * Note that this routine will return false (0) for causes + * NIOS2_EXCEPTION_TLB_MISS and NIOS2_EXCEPTION_ECC_TLB_ERR. + * You must read the TLBMISC.D field to determine if BADADDR + * is valid for these (valid if TLBMISC.D = 1). + */ +int alt_exception_cause_generated_bad_addr(alt_exception_cause cause); + +/* + * alt_ecc_fatal_exception_register() is called to register a handler to + * service likely fatal ECC error exceptions. Likely the handler will + * assume that correct execution of the running software is not possible + * and re-initialize the processor (e.g. jump to reset address). + * + * Passing null (0x0) in the handler argument will disable a previously- + * registered handler. + * + * Note that if no handler is registered, just normal exception processing + * occurs on a likely fatal ECC exception and the exception processing + * code might trigger an infinite exception loop. + * + * Note that the handler isn't a C function: it must be written in + * assembly-code because it doesn't support C language calling conventions + * and it can't return. + * + * The handler code must be carefully written to avoid triggering + * another fatal ECC exception and creating an infinite exception loop. + * The handler must avoid reading registers in case the fatal ECC + * error is a register file ECC error. + * If a data cache is present, the handler must avoid instructions that + * access the data cache in case the fatal ECC error is a data cache + * related ECC error. This includes cacheable load, cacheable store, + * non-cacheable store (because it looks in the data cache to update the + * data cache if it hits), and all data cache management instructions except + * for INITD. + */ +void alt_ecc_fatal_exception_register(alt_u32 handler); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __ALT_EXCEPTIONS_H__ */ Index: components/sd_card/firmware/bsp/HAL/inc/sys/alt_license_reminder_ucosii.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/sys/alt_license_reminder_ucosii.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/sys/alt_license_reminder_ucosii.h (revision 8) @@ -0,0 +1,77 @@ +#ifndef __ALT_LICENSE_REMINDER_UCOSII_H__ +#define __ALT_LICENSE_REMINDER_UCOSII_H__ + +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2006 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +/****************************************************************************** +* * +* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. * +* * +******************************************************************************/ + +#include + +#define ALT_LICENSE_REMINDER_UCOSII_STRING \ + "============== Software License Reminder ===============\n" \ + "\n" \ + "uC/OS-II is provided in source form for FREE evaluation,\n" \ + "for educational use, or for peaceful research. If you\n" \ + "plan on using uC/OS-II in a commercial product you need\n" \ + "to contact Micrium to properly license its use in your\n" \ + "product. Micrium provides ALL the source code on the\n" \ + "Altera distribution for your convenience and to help you\n" \ + "experience uC/OS-II. The fact that the source is provided\n" \ + "does NOT mean that you can use it without paying a\n" \ + "licensing fee. Please help us continue to provide the\n" \ + "Embedded community with the finest software available.\n" \ + "Your honesty is greatly appreciated.\n" \ + "\n" \ + "Please contact:\n" \ + "\n" \ + "M I C R I U M\n" \ + "949 Crestview Circle\n" \ + "Weston, FL 33327-1848\n" \ + "U.S.A.\n" \ + "\n" \ + "Phone : +1 954 217 2036\n" \ + "FAX : +1 954 217 2037\n" \ + "WEB : www.micrium.com\n" \ + "E-mail: Sales@Micrium.com\n" \ + "\n" \ + "========================================================\n" + +#define alt_license_reminder_ucosii() puts(ALT_LICENSE_REMINDER_UCOSII_STRING) + + +#endif /* __ALT_LICENSE_REMINDER_UCOSII_H__ */ + Index: components/sd_card/firmware/bsp/HAL/inc/sys/alt_stdio.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/sys/alt_stdio.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/sys/alt_stdio.h (revision 8) @@ -0,0 +1,62 @@ +#ifndef __ALT_STDIO_H__ +#define __ALT_STDIO_H__ + +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2006 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +/****************************************************************************** +* * +* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. * +* * +******************************************************************************/ + +/* + * Definitions for ALT stdio routines. + */ + +#include + + +#ifdef __cplusplus +extern "C" { +#endif + +int alt_getchar(); +int alt_putchar(int c); +int alt_putstr(const char* str); +void alt_printf(const char *fmt, ...); + +#ifdef __cplusplus +} +#endif + +#endif /* __ALT_STDIO_H__ */ Index: components/sd_card/firmware/bsp/HAL/inc/sys/termios.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/sys/termios.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/sys/termios.h (revision 8) @@ -0,0 +1,181 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +/****************************************************************************** +* * +* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. * +* * +******************************************************************************/ + +/* + * This is the termios.h file provided with newlib. The only modification has + * been to the baud rate macro definitions, and an increase in the size of the + * termios structure to accomodate this. + */ + + +#ifndef _SYS_TERMIOS_H +# define _SYS_TERMIOS_H + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +# define _XCGETA (('x'<<8)|1) +# define _XCSETA (('x'<<8)|2) +# define _XCSETAW (('x'<<8)|3) +# define _XCSETAF (('x'<<8)|4) +# define _TCSBRK (('T'<<8)|5) +# define _TCFLSH (('T'<<8)|7) +# define _TCXONC (('T'<<8)|6) + +# define TCOOFF 0 +# define TCOON 1 +# define TCIOFF 2 +# define TCION 3 + +# define TCIFLUSH 0 +# define TCOFLUSH 1 +# define TCIOFLUSH 2 + +# define NCCS 13 + +# define TCSAFLUSH _XCSETAF +# define TCSANOW _XCSETA +# define TCSADRAIN _XCSETAW +# define TCSADFLUSH _XCSETAF + +# define IGNBRK 000001 +# define BRKINT 000002 +# define IGNPAR 000004 +# define INPCK 000020 +# define ISTRIP 000040 +# define INLCR 000100 +# define IGNCR 000200 +# define ICRNL 000400 +# define IXON 002000 +# define IXOFF 010000 + +# define OPOST 000001 +# define OCRNL 000004 +# define ONLCR 000010 +# define ONOCR 000020 +# define TAB3 014000 + +# define CLOCAL 004000 +# define CREAD 000200 +# define CSIZE 000060 +# define CS5 0 +# define CS6 020 +# define CS7 040 +# define CS8 060 +# define CSTOPB 000100 +# define HUPCL 002000 +# define PARENB 000400 +# define PAODD 001000 + +#define CCTS_OFLOW 010000 +#define CRTS_IFLOW 020000 +#define CRTSCTS (CCTS_OFLOW | CRTS_IFLOW) + +# define ECHO 0000010 +# define ECHOE 0000020 +# define ECHOK 0000040 +# define ECHONL 0000100 +# define ICANON 0000002 +# define IEXTEN 0000400 /* anybody know *what* this does?! */ +# define ISIG 0000001 +# define NOFLSH 0000200 +# define TOSTOP 0001000 + +# define VEOF 4 /* also VMIN -- thanks, AT&T */ +# define VEOL 5 /* also VTIME -- thanks again */ +# define VERASE 2 +# define VINTR 0 +# define VKILL 3 +# define VMIN 4 /* also VEOF */ +# define VQUIT 1 +# define VSUSP 10 +# define VTIME 5 /* also VEOL */ +# define VSTART 11 +# define VSTOP 12 + +# define B0 0 +# define B50 50 +# define B75 75 +# define B110 110 +# define B134 134 +# define B150 150 +# define B200 200 +# define B300 300 +# define B600 600 +# define B1200 1200 +# define B1800 1800 +# define B2400 2400 +# define B4800 4800 +# define B9600 9600 +# define B19200 19200 +# define B38400 38400 +# define B57600 57600 +# define B115200 115200 + +typedef unsigned char cc_t; +typedef unsigned short tcflag_t; +typedef unsigned long speed_t; + +struct termios { + tcflag_t c_iflag; + tcflag_t c_oflag; + tcflag_t c_cflag; + tcflag_t c_lflag; + char c_line; + cc_t c_cc[NCCS]; + speed_t c_ispeed; + speed_t c_ospeed; +}; + +# ifndef _NO_MACROS + +# define cfgetospeed(tp) ((tp)->c_ospeed) +# define cfgetispeed(tp) ((tp)->c_ispeed) +# define cfsetospeed(tp,s) (((tp)->c_ospeed = (s)), 0) +# define cfsetispeed(tp,s) (((tp)->c_ispeed = (s)), 0) +# define tcdrain(fd) _ioctl (fd, _TCSBRK, 1) +# endif /* _NO_MACROS */ + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_TERMIOS_H */ + Index: components/sd_card/firmware/bsp/HAL/inc/sys/alt_errno.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/sys/alt_errno.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/sys/alt_errno.h (revision 8) @@ -0,0 +1,87 @@ +#ifndef __ALT_ERRNO_H__ +#define __ALT_ERRNO_H__ + +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +/****************************************************************************** +* * +* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. * +* * +******************************************************************************/ + +/* + * errno is defined in so that it uses the thread local version + * stored in the location pointed to by "_impure_ptr". This means that the + * accesses to errno within the HAL library can cause the entirety of + * of the structure pointed to by "_impure_ptr" to be added to the + * users application. This can be undesirable in very small footprint systems. + * + * To avoid this happening, the HAL uses the macro ALT_ERRNO, defined below, + * to access errno, rather than accessing it directly. This macro will only + * use the thread local version if some other code has already caused it to be + * included into the system, otherwise it will use the global errno value. + * + * This causes a slight increases in code size where errno is accessed, but + * can lead to significant overall benefits in very small systems. The + * increase is inconsequential when compared to the size of the structure + * pointed to by _impure_ptr. + * + * Note that this macro accesses __errno() using an externally declared + * function pointer (alt_errno). This is done so that the function call uses the + * subroutine call instruction via a register rather than an immediate address. + * This is important in the case that the code has been linked for a high + * address, but __errno() is not being used. In this case the weak linkage + * would have resulted in the instruction: "call 0" which would fail to link. + */ + +extern int* (*alt_errno) (void); + +/* Must define this so that values such as EBADFD are defined in errno.h. */ +#define __LINUX_ERRNO_EXTENSIONS__ + +#include + +#include "alt_types.h" + +#undef errno + +extern int errno; + +static ALT_INLINE int* alt_get_errno(void) +{ + return ((alt_errno) ? alt_errno() : &errno); +} + +#define ALT_ERRNO *alt_get_errno() + +#endif /* __ALT_ERRNO_H__ */ Index: components/sd_card/firmware/bsp/HAL/inc/sys/alt_debug.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/sys/alt_debug.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/sys/alt_debug.h (revision 8) @@ -0,0 +1,45 @@ +#ifndef __ALT_DEBUG_H__ +#define __ALT_DEBUG_H__ + +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2003 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +******************************************************************************/ + +/* + * The ALT_DEVUG_ASSERT macro can be used to generate a debugger break + * from within software. The break is generated if "condition" evaluates to + * false. + */ + +#define ALT_DEBUG_ASSERT(condition) if (!condition) \ +{ \ + __asm__ volatile ("break"); \ +} + +#endif /* __ALT_DEBUG_H__ */ Index: components/sd_card/firmware/bsp/HAL/inc/sys/alt_llist.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/sys/alt_llist.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/sys/alt_llist.h (revision 8) @@ -0,0 +1,123 @@ +#ifndef __ALT_LIST_H__ +#define __ALT_LIST_H__ + +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +* Altera does not recommend, suggest or require that this reference design * +* file be used in conjunction or combination with any other product. * +******************************************************************************/ + +/****************************************************************************** +* * +* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. * +* * +******************************************************************************/ + +#include "alt_types.h" + +/* + * alt_llist.h defines structures and functions for use in manipulating linked + * lists. A list is considered to be constructed from a chain of objects of + * type alt_llist, with one object being defined to be the head element. + * + * A list is considered to be empty if it only contains the head element. + */ + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +/* + * alt_llist is the structure used to represent an element within a linked + * list. + */ + +typedef struct alt_llist_s alt_llist; + +struct alt_llist_s { + alt_llist* next; /* Pointer to the next element in the list. */ + alt_llist* previous; /* Pointer to the previous element in the list. */ +}; + +/* + * ALT_LLIST_HEAD is a macro that can be used to create the head of a new + * linked list. This is named "head". The head element is initialised to + * represent an empty list. + */ + +#define ALT_LLIST_HEAD(head) alt_llist head = {&head, &head} + +/* + * ALT_LLIST_ENTRY is a macro used to define an uninitialised linked list + * entry. This is used to reserve space in structure initialisation for + * structures that inherit form alt_llist. + */ + +#define ALT_LLIST_ENTRY {0, 0} + +/* + * alt_llist_insert() insert adds the linked list entry "entry" as the + * first entry in the linked list "list". "list" is the list head element. + */ + +static ALT_INLINE void ALT_ALWAYS_INLINE alt_llist_insert(alt_llist* list, + alt_llist* entry) +{ + entry->previous = list; + entry->next = list->next; + + list->next->previous = entry; + list->next = entry; +} + +/* + * alt_llist_remove() is called to remove an element from a linked list. The + * input argument is the element to remove. + */ + +static ALT_INLINE void ALT_ALWAYS_INLINE alt_llist_remove(alt_llist* entry) +{ + entry->next->previous = entry->previous; + entry->previous->next = entry->next; + + /* + * Set the entry to point to itself, so that any further calls to + * alt_llist_remove() are harmless. + */ + + entry->previous = entry; + entry->next = entry; +} + +#ifdef __cplusplus +} +#endif + +#endif /* __ALT_LLIST_H__ */ Index: components/sd_card/firmware/bsp/HAL/inc/sys/alt_sim.h =================================================================== --- components/sd_card/firmware/bsp/HAL/inc/sys/alt_sim.h (nonexistent) +++ components/sd_card/firmware/bsp/HAL/inc/sys/alt_sim.h (revision 8) @@ -0,0 +1,91 @@ +#ifndef __ALT_SIM_H__ +#define __ALT_SIM_H__ + +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2007 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +******************************************************************************/ +#include "system.h" +#include "alt_types.h" + +/* + * Instructions that might mean something special to a simulator. + * These have no special effect on real hardware (they are just nops). + */ +#define ALT_SIM_FAIL() \ + do { __asm volatile ("cmpltui r0, r0, 0xabc1"); } while (0) + +#define ALT_SIM_PASS() \ + do { __asm volatile ("cmpltui r0, r0, 0xabc2"); } while (0) + +#define ALT_SIM_IN_TOP_OF_HOT_LOOP() \ + do { __asm volatile ("cmpltui r0, r0, 0xabc3"); } while (0) + +/* + * Routine called on exit. + */ +static ALT_INLINE ALT_ALWAYS_INLINE void alt_sim_halt(int exit_code) +{ + int r2 = exit_code; + +#if defined(NIOS2_HAS_DEBUG_STUB) && (defined(ALT_BREAK_ON_EXIT) || defined(ALT_PROVIDE_GMON)) + + int r3 = (1 << 2); + +#ifdef ALT_PROVIDE_GMON + extern unsigned int alt_gmon_data[]; + int r4 = (int)alt_gmon_data; + r3 |= (1 << 4); +#define ALT_GMON_DATA ,"D04"(r4) +#else +#define ALT_GMON_DATA +#endif /* ALT_PROVIDE_GMON */ + + if (r2) { + ALT_SIM_FAIL(); + } else { + ALT_SIM_PASS(); + } + + __asm__ volatile ("\n0:\n\taddi %0,%0, -1\n\tbgt %0,zero,0b" : : "r" (ALT_CPU_FREQ/100) ); /* Delay for >30ms */ + + __asm__ volatile ("break 2" : : "D02"(r2), "D03"(r3) ALT_GMON_DATA ); + +#else /* !DEBUG_STUB */ + if (r2) { + ALT_SIM_FAIL(); + } else { + ALT_SIM_PASS(); + } +#endif /* DEBUG_STUB */ +} + +#define ALT_SIM_HALT(exit_code) \ + alt_sim_halt(exit_code) + +#endif /* __ALT_SIM_H__ */ Index: components/sd_card/firmware/bsp/public.mk =================================================================== --- components/sd_card/firmware/bsp/public.mk (nonexistent) +++ components/sd_card/firmware/bsp/public.mk (revision 8) @@ -0,0 +1,379 @@ +#------------------------------------------------------------------------------ +# BSP "PUBLIC" MAKEFILE CONTENT +# +# This file is intended to be included in an application or library +# Makefile that is using this BSP. You can create such a Makefile with +# the nios2-app-generate-makefile or nios2-lib-generate-makefile +# commands. +# +# The following variables must be defined before including this file: +# +# ALT_LIBRARY_ROOT_DIR +# Contains the path to the BSP top-level (aka root) directory +#------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------ +# PATHS +#------------------------------------------------------------------------------ + + + +# Path to the provided linker script. +BSP_LINKER_SCRIPT := $(ALT_LIBRARY_ROOT_DIR)/linker.x + +# Include paths: +# The path to root of all header files that a library wishes to make +# available for an application's use is specified here. Note that this +# may not be *all* folders within a hierarchy. For example, if it is +# desired that the application developer type: +# #include +# #include +# With files laid out like this: +# /inc/sockets.h +# /inc/ip/tcpip.h +# +# Then, only /inc need be added to the list of include +# directories. Alternatively, if you wish to be able to directly include +# all files in a hierarchy, separate paths to each folder in that +# hierarchy must be defined. + +# The following are the "base" set of include paths for a BSP. +# These paths are appended to the list that individual software +# components, drivers, etc., add in the generated portion of this +# file (below). +ALT_INCLUDE_DIRS_TO_APPEND += \ + $(ALT_LIBRARY_ROOT_DIR) \ + $(ALT_LIBRARY_ROOT_DIR)/drivers/inc + +# Additions to linker library search-path: +# Here we provide a path to "our self" for the application to construct a +# "-L " out of. This should contain a list of directories, +# relative to the library root, of all directories with .a files to link +# against. +ALT_LIBRARY_DIRS += $(ALT_LIBRARY_ROOT_DIR) + + +#------------------------------------------------------------------------------ +# COMPILATION FLAGS +#------------------------------------------------------------------------------ +# Default C pre-processor flags for a BSP: +ALT_CPPFLAGS += -DSYSTEM_BUS_WIDTH=32 \ + -pipe + + +#------------------------------------------------------------------------------ +# MANAGED CONTENT +# +# All content between the lines "START MANAGED" and "END MANAGED" below is +# generated based on variables in the BSP settings file when the +# nios2-bsp-generate-files command is invoked. If you wish to persist any +# information pertaining to the build process, it is recomended that you +# utilize the BSP settings mechanism to do so. +#------------------------------------------------------------------------------ +#START MANAGED + +# The following TYPE comment allows tools to identify the 'type' of target this +# makefile is associated with. +# TYPE: BSP_PUBLIC_MAKEFILE + +# This following VERSION comment indicates the version of the tool used to +# generate this makefile. A makefile variable is provided for VERSION as well. +# ACDS_VERSION: 14.0 +ACDS_VERSION := 14.0 + +# This following BUILD_NUMBER comment indicates the build number of the tool +# used to generate this makefile. +# BUILD_NUMBER: 200 + +# Qsys--generated SOPCINFO file. Required for resolving node instance ID's with +# design component names. +SOPCINFO_FILE := $(ABS_BSP_ROOT_DIR)/../../system.sopcinfo + +# Big-Endian operation. +# setting BIG_ENDIAN is false + + +# Path to the provided C language runtime initialization code. +BSP_CRT0 := $(ALT_LIBRARY_ROOT_DIR)/obj/HAL/src/crt0.o + +# Name of BSP library as provided to linker using the "-msys-lib" flag or +# linker script GROUP command. +# setting BSP_SYS_LIB is hal_bsp +BSP_SYS_LIB := hal_bsp +ELF_PATCH_FLAG += --thread_model hal + +# Type identifier of the BSP library +# setting BSP_TYPE is hal +ALT_CPPFLAGS += -D__hal__ +BSP_TYPE := hal + +# CPU Name +# setting CPU_NAME is nios2_qsys_0 +CPU_NAME = nios2_qsys_0 +ELF_PATCH_FLAG += --cpu_name $(CPU_NAME) + +# Hardware Divider present. +# setting HARDWARE_DIVIDE is false +ALT_CFLAGS += -mno-hw-div + +# Hardware Multiplier present. +# setting HARDWARE_MULTIPLY is false +ALT_CFLAGS += -mno-hw-mul + +# Hardware Mulx present. +# setting HARDWARE_MULX is false +ALT_CFLAGS += -mno-hw-mulx + +# Debug Core present. +# setting HAS_DEBUG_CORE is true +CPU_HAS_DEBUG_CORE = 1 + +# Qsys generated design +# setting QSYS is 1 +QSYS := 1 +ELF_PATCH_FLAG += --qsys true + +# Design Name +# setting SOPC_NAME is system +SOPC_NAME := system + +# SopcBuilder Simulation Enabled +# setting SOPC_SIMULATION_ENABLED is false +ELF_PATCH_FLAG += --simulation_enabled false + +# Enable JTAG UART driver to recover when host is inactive causing buffer to +# full without returning error. Printf will not fail with this recovery. none +# setting altera_avalon_jtag_uart_driver.enable_jtag_uart_ignore_fifo_full_error is false + +# Small-footprint (polled mode) driver none +# setting altera_avalon_jtag_uart_driver.enable_small_driver is false + +# Build a custom version of newlib with the specified space-separated compiler +# flags. The custom newlib build will be placed in the /newlib +# directory, and will be used only for applications that utilize this BSP. +# setting hal.custom_newlib_flags is none + +# Enable support for a subset of the C++ language. This option increases code +# footprint by adding support for C++ constructors. Certain features, such as +# multiple inheritance and exceptions are not supported. If false, adds +# -DALT_NO_C_PLUS_PLUS to ALT_CPPFLAGS in public.mk, and reduces code +# footprint. none +# setting hal.enable_c_plus_plus is false +ALT_CPPFLAGS += -DALT_NO_C_PLUS_PLUS + +# When your application exits, close file descriptors, call C++ destructors, +# etc. Code footprint can be reduced by disabling clean exit. If disabled, adds +# -DALT_NO_CLEAN_EXIT to ALT_CPPFLAGS -D'exit(a)=_exit(a)' in public.mk. none +# setting hal.enable_clean_exit is true + +# Add exit() support. This option increases code footprint if your "main()" +# routine does "return" or call "exit()". If false, adds -DALT_NO_EXIT to +# ALT_CPPFLAGS in public.mk, and reduces footprint none +# setting hal.enable_exit is true + +# Causes code to be compiled with gprof profiling enabled and the application +# ELF to be linked with the GPROF library. If true, adds -DALT_PROVIDE_GMON to +# ALT_CPPFLAGS and -pg to ALT_CFLAGS in public.mk. none +# setting hal.enable_gprof is false + +# Enables lightweight device driver API. This reduces code and data footprint +# by removing the HAL layer that maps device names (e.g. /dev/uart0) to file +# descriptors. Instead, driver routines are called directly. The open(), +# close(), and lseek() routines will always fail if called. The read(), +# write(), fstat(), ioctl(), and isatty() routines only work for the stdio +# devices. If true, adds -DALT_USE_DIRECT_DRIVERS to ALT_CPPFLAGS in public.mk. +# The Altera Host and read-only ZIP file systems can't be used if +# hal.enable_lightweight_device_driver_api is true. +# setting hal.enable_lightweight_device_driver_api is false + +# Adds code to emulate multiply and divide instructions in case they are +# executed but aren't present in the CPU. Normally this isn't required because +# the compiler won't use multiply and divide instructions that aren't present +# in the CPU. If false, adds -DALT_NO_INSTRUCTION_EMULATION to ALT_CPPFLAGS in +# public.mk. none +# setting hal.enable_mul_div_emulation is false +ALT_CPPFLAGS += -DALT_NO_INSTRUCTION_EMULATION + +# Certain drivers are compiled with reduced functionality to reduce code +# footprint. Not all drivers observe this setting. The altera_avalon_uart and +# altera_avalon_jtag_uart drivers switch from interrupt-driven to polled +# operation. CAUTION: Several device drivers are disabled entirely. These +# include the altera_avalon_cfi_flash, altera_avalon_epcs_flash_controller, and +# altera_avalon_lcd_16207 drivers. This can result in certain API (HAL flash +# access routines) to fail. You can define a symbol provided by each driver to +# prevent it from being removed. If true, adds -DALT_USE_SMALL_DRIVERS to +# ALT_CPPFLAGS in public.mk. none +# setting hal.enable_reduced_device_drivers is false + +# Turns on HAL runtime stack checking feature. Enabling this setting causes +# additional code to be placed into each subroutine call to generate an +# exception if a stack collision occurs with the heap or statically allocated +# data. If true, adds -DALT_STACK_CHECK and -fstack-limit-register=et to +# ALT_CPPFLAGS in public.mk. none +# setting hal.enable_runtime_stack_checking is false + +# The BSP is compiled with optimizations to speedup HDL simulation such as +# initializing the cache, clearing the .bss section, and skipping long delay +# loops. If true, adds -DALT_SIM_OPTIMIZE to ALT_CPPFLAGS in public.mk. When +# this setting is true, the BSP shouldn't be used to build applications that +# are expected to run real hardware. +# setting hal.enable_sim_optimize is false + +# Causes the small newlib (C library) to be used. This reduces code and data +# footprint at the expense of reduced functionality. Several newlib features +# are removed such as floating-point support in printf(), stdin input routines, +# and buffered I/O. The small C library is not compatible with Micrium +# MicroC/OS-II. If true, adds -msmallc to ALT_LDFLAGS in public.mk. none +# setting hal.enable_small_c_library is true +ALT_LDFLAGS += -msmallc +ALT_CPPFLAGS += -DSMALL_C_LIB + +# Enable SOPC Builder System ID. If a System ID SOPC Builder component is +# connected to the CPU associated with this BSP, it will be enabled in the +# creation of command-line arguments to download an ELF to the target. +# Otherwise, system ID and timestamp values are left out of public.mk for +# application Makefile "download-elf" target definition. With the system ID +# check disabled, the Nios II EDS tools will not automatically ensure that the +# application .elf file (and BSP it is linked against) corresponds to the +# hardware design on the target. If false, adds --accept-bad-sysid to +# SOPC_SYSID_FLAG in public.mk. none +# setting hal.enable_sopc_sysid_check is false +SOPC_SYSID_FLAG += --accept-bad-sysid + +# Enable BSP generation to query if SOPC system is big endian. If true ignores +# export of 'ALT_CFLAGS += -meb' to public.mk if big endian system. none +# setting hal.make.ignore_system_derived.big_endian is false + +# Enable BSP generation to query if SOPC system has a debug core present. If +# true ignores export of 'CPU_HAS_DEBUG_CORE = 1' to public.mk if a debug core +# is found in the system. If true ignores export of 'CPU_HAS_DEBUG_CORE = 0' if +# no debug core is found in the system. none +# setting hal.make.ignore_system_derived.debug_core_present is false + +# Enable BSP generation to query if SOPC system has FPU present. If true +# ignores export of 'ALT_CFLAGS += -mhard-float' to public.mk if FPU is found +# in the system. If true ignores export of 'ALT_CFLAGS += -mhard-soft' if FPU +# is not found in the system. none +# setting hal.make.ignore_system_derived.fpu_present is false + +# Enable BSP generation to query if SOPC system has hardware divide present. If +# true ignores export of 'ALT_CFLAGS += -mno-hw-div' to public.mk if no +# division is found in system. If true ignores export of 'ALT_CFLAGS += +# -mhw-div' if division is found in the system. none +# setting hal.make.ignore_system_derived.hardware_divide_present is false + +# Enable BSP generation to query if SOPC system floating point custom +# instruction with a divider is present. If true ignores export of 'ALT_CFLAGS +# += -mcustom-fpu-cfg=60-2' and 'ALT_LDFLAGS += -mcustom-fpu-cfg=60-2' to +# public.mk if the custom instruction is found in the system. none +# setting hal.make.ignore_system_derived.hardware_fp_cust_inst_divider_present is false + +# Enable BSP generation to query if SOPC system floating point custom +# instruction without a divider is present. If true ignores export of +# 'ALT_CFLAGS += -mcustom-fpu-cfg=60-1' and 'ALT_LDFLAGS += +# -mcustom-fpu-cfg=60-1' to public.mk if the custom instruction is found in the +# system. none +# setting hal.make.ignore_system_derived.hardware_fp_cust_inst_no_divider_present is false + +# Enable BSP generation to query if SOPC system has multiplier present. If true +# ignores export of 'ALT_CFLAGS += -mno-hw-mul' to public.mk if no multiplier +# is found in the system. If true ignores export of 'ALT_CFLAGS += -mhw-mul' if +# multiplier is found in the system. none +# setting hal.make.ignore_system_derived.hardware_multiplier_present is false + +# Enable BSP generation to query if SOPC system has hardware mulx present. If +# true ignores export of 'ALT_CFLAGS += -mno-hw-mulx' to public.mk if no mulx +# is found in the system. If true ignores export of 'ALT_CFLAGS += -mhw-mulx' +# if mulx is found in the system. none +# setting hal.make.ignore_system_derived.hardware_mulx_present is false + +# Enable BSP generation to query if SOPC system has simulation enabled. If true +# ignores export of 'ELF_PATCH_FLAG += --simulation_enabled' to public.mk. none +# setting hal.make.ignore_system_derived.sopc_simulation_enabled is false + +# Enable BSP generation to query SOPC system for system ID base address. If +# true ignores export of 'SOPC_SYSID_FLAG += --sidp=
' and +# 'ELF_PATCH_FLAG += --sidp=
' to public.mk. none +# setting hal.make.ignore_system_derived.sopc_system_base_address is false + +# Enable BSP generation to query SOPC system for system ID. If true ignores +# export of 'SOPC_SYSID_FLAG += --id=' and 'ELF_PATCH_FLAG += +# --id=' to public.mk. none +# setting hal.make.ignore_system_derived.sopc_system_id is false + +# Enable BSP generation to query SOPC system for system timestamp. If true +# ignores export of 'SOPC_SYSID_FLAG += --timestamp=' and +# 'ELF_PATCH_FLAG += --timestamp=' to public.mk. none +# setting hal.make.ignore_system_derived.sopc_system_timestamp is false + +# Slave descriptor of STDERR character-mode device. This setting is used by the +# ALT_STDERR family of defines in system.h. none +# setting hal.stderr is jtag_uart +ELF_PATCH_FLAG += --stderr_dev jtag_uart + +# Slave descriptor of STDIN character-mode device. This setting is used by the +# ALT_STDIN family of defines in system.h. none +# setting hal.stdin is jtag_uart +ELF_PATCH_FLAG += --stdin_dev jtag_uart + +# Slave descriptor of STDOUT character-mode device. This setting is used by the +# ALT_STDOUT family of defines in system.h. none +# setting hal.stdout is jtag_uart +ELF_PATCH_FLAG += --stdout_dev jtag_uart + + +#------------------------------------------------------------------------------ +# SOFTWARE COMPONENT & DRIVER INCLUDE PATHS +#------------------------------------------------------------------------------ + +ALT_INCLUDE_DIRS += $(ALT_LIBRARY_ROOT_DIR)/HAL/inc + +#------------------------------------------------------------------------------ +# SOFTWARE COMPONENT & DRIVER PRODUCED ALT_CPPFLAGS ADDITIONS +#------------------------------------------------------------------------------ + +ALT_CPPFLAGS += -DALT_SINGLE_THREADED + +#END MANAGED + + +#------------------------------------------------------------------------------ +# LIBRARY INFORMATION +#------------------------------------------------------------------------------ +# Assemble the name of the BSP *.a file using the BSP library name +# (BSP_SYS_LIB) in generated content above. +BSP_LIB := lib$(BSP_SYS_LIB).a + +# Additional libraries to link against: +# An application including this file will prefix each library with "-l". +# For example, to include the Newlib math library "m" is included, which +# becomes "-lm" when linking the application. +ALT_LIBRARY_NAMES += m + +# Additions to linker dependencies: +# An application Makefile will typically add these directly to the list +# of dependencies required to build the executable target(s). The BSP +# library (*.a) file is specified here. +ALT_LDDEPS += $(ALT_LIBRARY_ROOT_DIR)/$(BSP_LIB) + +# Is this library "Makeable"? +# Add to list of root library directories that support running 'make' +# to build them. Because libraries may or may not have a Makefile in their +# root, appending to this variable tells an application to run 'make' in +# the library root to build/update this library. +MAKEABLE_LIBRARY_ROOT_DIRS += $(ALT_LIBRARY_ROOT_DIR) + +# Additional Assembler Flags +# -gdwarf2 flag is required for stepping through assembly code +ALT_ASFLAGS += -gdwarf2 + +#------------------------------------------------------------------------------ +# FINAL INCLUDE PATH LIST +#------------------------------------------------------------------------------ +# Append static include paths to paths specified by OS/driver/sw package +# additions to the BSP thus giving them precedence in case a BSP addition +# is attempting to override BSP sources. +ALT_INCLUDE_DIRS += $(ALT_INCLUDE_DIRS_TO_APPEND) + + + Index: components/sd_card/firmware/bsp/.project =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/xml Index: components/sd_card/firmware/bsp/.project =================================================================== --- components/sd_card/firmware/bsp/.project (nonexistent) +++ components/sd_card/firmware/bsp/.project (revision 8)
components/sd_card/firmware/bsp/.project Property changes : Added: svn:mime-type ## -0,0 +1 ## +application/xml \ No newline at end of property Index: components/sd_card/firmware/bsp/mem_init.mk =================================================================== --- components/sd_card/firmware/bsp/mem_init.mk (nonexistent) +++ components/sd_card/firmware/bsp/mem_init.mk (revision 8) @@ -0,0 +1,342 @@ + +######################################################################### +####### M E M I N I T M A K E F I L E C O N T E N T ###### +######################################################################### + +######################################################################### +# This file is intended to be included by public.mk +# +# +# The following variables must be defined before including this file: +# - ELF +# +# The following variables may be defined to override the default behavior: +# - HDL_SIM_DIR +# - HDL_SIM_INSTALL_DIR +# - MEM_INIT_DIR +# - MEM_INIT_INSTALL_DIR +# - QUARTUS_PROJECT_DIR +# - SOPC_NAME +# - SIM_OPTIMIZE +# - RESET_ADDRESS +# +######################################################################### + +ifeq ($(MEM_INIT_FILE),) +# MEM_INIT_FILE should be set equal to the working relative path to this +# mem_init.mk makefile fragment +MEM_INIT_FILE := $(wildcard $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))) +endif + +ifeq ($(ELF2DAT),) +ELF2DAT := elf2dat +endif + +ifeq ($(ELF2HEX),) +ELF2HEX := elf2hex +endif + +ifeq ($(ELF2FLASH),) +ELF2FLASH := elf2flash +endif + +ifeq ($(FLASH2DAT),) +FLASH2DAT := flash2dat +endif + +ifeq ($(NM),) +NM := nios2-elf-nm +endif + +ifeq ($(MKDIR),) +MKDIR := mkdir -p +endif + +ifeq ($(RM),) +RM := rm -f +endif + +ifeq ($(CP),) +CP := cp +endif + +ifeq ($(ECHO),) +ECHO := echo +endif + +MEM_INIT_DIR ?= mem_init +HDL_SIM_DIR ?= $(MEM_INIT_DIR)/hdl_sim + +ifdef QUARTUS_PROJECT_DIR +MEM_INIT_INSTALL_DIR ?= $(patsubst %/,%,$(QUARTUS_PROJECT_DIR)) +ifdef SOPC_NAME +HDL_SIM_INSTALL_DIR ?= $(patsubst %/,%,$(QUARTUS_PROJECT_DIR))/$(SOPC_NAME)_sim +endif +endif + +MEM_INIT_DESCRIPTOR_FILE ?= $(MEM_INIT_DIR)/meminit.spd + +MEM_INIT_QIP_FILE ?= $(MEM_INIT_DIR)/meminit.qip + +#------------------------------------- +# Default Flash Boot Loaders +#------------------------------------- + +BOOT_LOADER_PATH ?= $(SOPC_KIT_NIOS2)/components/altera_nios2 +BOOT_LOADER_CFI ?= $(BOOT_LOADER_PATH)/boot_loader_cfi.srec +BOOT_LOADER_CFI_BE ?= $(BOOT_LOADER_PATH)/boot_loader_cfi_be.srec + + +#------------------------------------- +# Default Target +#------------------------------------- + +.PHONY: default_mem_init +ifeq ($(QSYS),1) +default_mem_init: mem_init_generate +else +default_mem_init: mem_init_install +endif +#------------------------------------- +# Runtime Macros +#------------------------------------- + +define post-process-info + @echo Post-processing to create $@... +endef + +target_stem = $(notdir $(basename $@)) + +mem_start_address = $($(target_stem)_START) +mem_end_address = $($(target_stem)_END) +mem_span = $($(target_stem)_SPAN) +mem_width = $($(target_stem)_WIDTH) +mem_endianness = $($(target_stem)_ENDIANNESS) +mem_create_lanes = $($(target_stem)_CREATE_LANES) + +mem_pad_flag = $($(target_stem)_PAD_FLAG) +mem_reloc_input_flag = $($(target_stem)_RELOC_INPUT_FLAG) +mem_no_zero_fill_flag = $($(target_stem)_NO_ZERO_FILL_FLAG) + +flash_mem_epcs_flag = $($(target_stem)_EPCS_FLAGS) +flash_mem_cfi_flag = $($(target_stem)_CFI_FLAGS) +flash_mem_boot_loader_flag = $($(target_stem)_BOOT_LOADER_FLAG) + +elf2dat_extra_args = $(mem_pad_flag) +elf2hex_extra_args = $(mem_no_zero_fill_flag) +elf2flash_extra_args = $(flash_mem_cfi_flag) $(flash_mem_epcs_flag) $(flash_mem_boot_loader_flag) +flash2dat_extra_args = $(mem_pad_flag) $(mem_reloc_input_flag) + +#------------------------------------------------------------------------------ +# BSP SPECIFIC CONTENT +# +# The content below is controlled by the BSP and SOPC System +#------------------------------------------------------------------------------ +#START OF BSP SPECIFIC + +#------------------------------------- +# Global Settings +#------------------------------------- + + +# The following TYPE comment allows tools to identify the 'type' of target this +# makefile is associated with. +# TYPE: BSP_MEMINIT_MAKEFILE + +# This following VERSION comment indicates the version of the tool used to +# generate this makefile. A makefile variable is provided for VERSION as well. +# ACDS_VERSION: 14.0 +ACDS_VERSION := 14.0 + +# This following BUILD_NUMBER comment indicates the build number of the tool +# used to generate this makefile. +# BUILD_NUMBER: 200 + +# Optimize for simulation +SIM_OPTIMIZE ?= 0 + +# The CPU reset address as needed by elf2flash +RESET_ADDRESS ?= 0x08008000 + +#------------------------------------- +# Pre-Initialized Memory Descriptions +#------------------------------------- + +# Memory: onchip_memory2_0 +MEM_0 := system_onchip_memory2_0 +$(MEM_0)_NAME := onchip_memory2_0 +$(MEM_0)_MEM_INIT_FILE_PARAM_NAME := INIT_FILE +HEX_FILES += $(MEM_INIT_DIR)/$(MEM_0).hex +MEM_INIT_INSTALL_FILES += $(MEM_INIT_INSTALL_DIR)/$(MEM_0).hex +DAT_FILES += $(HDL_SIM_DIR)/$(MEM_0).dat +HDL_SIM_INSTALL_FILES += $(HDL_SIM_INSTALL_DIR)/$(MEM_0).dat +SYM_FILES += $(HDL_SIM_DIR)/$(MEM_0).sym +HDL_SIM_INSTALL_FILES += $(HDL_SIM_INSTALL_DIR)/$(MEM_0).sym +$(MEM_0)_START := 0x08008000 +$(MEM_0)_END := 0x0800ffff +$(MEM_0)_SPAN := 0x00008000 +$(MEM_0)_HIERARCHICAL_PATH := onchip_memory2_0 +$(MEM_0)_WIDTH := 32 +$(MEM_0)_ENDIANNESS := --little-endian-mem +$(MEM_0)_CREATE_LANES := 0 + +.PHONY: onchip_memory2_0 +onchip_memory2_0: check_elf_exists $(MEM_INIT_DIR)/$(MEM_0).hex $(HDL_SIM_DIR)/$(MEM_0).dat $(HDL_SIM_DIR)/$(MEM_0).sym + +# Memory: sdram +MEM_1 := sdram +$(MEM_1)_NAME := sdram +DAT_FILES += $(HDL_SIM_DIR)/$(MEM_1).dat +HDL_SIM_INSTALL_FILES += $(HDL_SIM_INSTALL_DIR)/$(MEM_1).dat +SYM_FILES += $(HDL_SIM_DIR)/$(MEM_1).sym +HDL_SIM_INSTALL_FILES += $(HDL_SIM_INSTALL_DIR)/$(MEM_1).sym +$(MEM_1)_START := 0x00000000 +$(MEM_1)_END := 0x07ffffff +$(MEM_1)_SPAN := 0x08000000 +$(MEM_1)_HIERARCHICAL_PATH := sdram +$(MEM_1)_WIDTH := 32 +$(MEM_1)_ENDIANNESS := --little-endian-mem +$(MEM_1)_CREATE_LANES := 0 + +.PHONY: sdram +sdram: check_elf_exists $(HDL_SIM_DIR)/$(MEM_1).dat $(HDL_SIM_DIR)/$(MEM_1).sym + + +#END OF BSP SPECIFIC + +#------------------------------------- +# Pre-Initialized Memory Targets +#------------------------------------- + +.PHONY: mem_init_install mem_init_generate mem_init_clean + +ifeq ($(QSYS),1) +# Target mem_init_install is deprecated for QSys based systems +# To initialize onchip memories for Quartus II Synthesis with Qsys based systems: +# 1) Use "make mem_init_genearate" +# 2) Add the generated mem_init/meminit.qip file to your Quartus II Project +# +mem_init_install: + $(error Deprecated Makefile Target: '$@'. Use target 'mem_init_generate' and then add $(MEM_INIT_QIP_FILE) to your Quartus II Project) + +else # QSYS != 1, if SopcBuilder based system + +ifneq ($(MEM_INIT_INSTALL_DIR),) +mem_init_install: $(MEM_INIT_INSTALL_FILES) +endif + +ifneq ($(HDL_SIM_INSTALL_DIR),) +mem_init_install: $(HDL_SIM_INSTALL_FILES) +endif + +mem_init_install: mem_init_generate +ifeq ($(MEM_INIT_INSTALL_DIR),) + @echo "WARNING: MEM_INIT_INSTALL_DIR not set. Set your QUARTUS_PROJECT_DIR environment variable." +endif +ifeq ($(HDL_SIM_INSTALL_DIR),) + @echo "WARNING: HDL_SIM_INSTALL_DIR not set. Set your QUARTUS_PROJECT_DIR and SOPC_NAME environment variable." +endif + +$(MEM_INIT_INSTALL_FILES): $(MEM_INIT_INSTALL_DIR)/%: $(MEM_INIT_DIR)/% + @$(MKDIR) $(@D) + @$(CP) -v $< $@ + +$(HDL_SIM_INSTALL_FILES): $(HDL_SIM_INSTALL_DIR)/%: $(HDL_SIM_DIR)/% + @$(MKDIR) $(@D) + @$(CP) -v $< $@ + +endif # QSYS == 1 + + +mem_init_generate: hex dat sym flash $(MEM_INIT_DESCRIPTOR_FILE) $(MEM_INIT_QIP_FILE) + +mem_init_clean: + @$(RM) -r $(MEM_INIT_DIR) $(HDL_SIM_DIR) $(FLASH_FILES) + +.PHONY: hex dat sym flash + +hex: check_elf_exists $(HEX_FILES) + +dat: check_elf_exists $(DAT_FILES) + +sym: check_elf_exists $(SYM_FILES) + +flash: check_elf_exists $(FLASH_FILES) + +#------------------------------------- +# Pre-Initialized Memory Rules +#------------------------------------- + +.PHONY: check_elf_exists +check_elf_exists: $(ELF) +ifeq ($(ELF),) + $(error ELF var not set in mem_init.mk) +endif + +$(filter-out $(FLASH_DAT_FILES),$(DAT_FILES)): %.dat: $(ELF) + $(post-process-info) + @$(MKDIR) $(@D) + bash -c '$(ELF2DAT) --infile=$< --outfile=$@ \ + --base=$(mem_start_address) --end=$(mem_end_address) --width=$(mem_width) \ + $(mem_endianness) --create-lanes=$(mem_create_lanes) $(elf2dat_extra_args)' + +$(foreach i,0 1 2 3 4 5 6 7,%_lane$(i).dat): %.dat + @true + +$(HEX_FILES): %.hex: $(ELF) + $(post-process-info) + @$(MKDIR) $(@D) + bash -c '$(ELF2HEX) $< $(mem_start_address) $(mem_end_address) --width=$(mem_width) \ + $(mem_endianness) --create-lanes=$(mem_create_lanes) $(elf2hex_extra_args) $@' + +$(SYM_FILES): %.sym: $(ELF) + $(post-process-info) + @$(MKDIR) $(@D) + $(NM) -n $< > $@ + +$(FLASH_FILES): %.flash: $(ELF) + $(post-process-info) + @$(MKDIR) $(@D) + bash -c '$(ELF2FLASH) --input=$< --outfile=$@ --sim_optimize=$(SIM_OPTIMIZE) $(mem_endianness) \ + $(elf2flash_extra_args)' + +# +# Function generate_spd_entry +# Arg1: path to the memory initialization file +# Arg2: Type HEX or DAT +# Arg3: Output spd file to append +gen_spd_entry.BASE_FILE = $(basename $(notdir $1)) +gen_spd_entry.PARAM_NAME = $($(gen_spd_entry.BASE_FILE)_MEM_INIT_FILE_PARAM_NAME) +gen_spd_entry.MEM_PATH = $($(gen_spd_entry.BASE_FILE)_HIERARCHICAL_PATH) +gen_spd_entry.SETTINGS = $(strip \ + path=\"$1\" \ + type=\"$2\" \ + $(if $(gen_spd_entry.PARAM_NAME),initParamName=\"$(gen_spd_entry.PARAM_NAME)\") \ + $(if $(gen_spd_entry.MEM_PATH),memoryPath=\"$(gen_spd_entry.MEM_PATH)\") \ +) +define gen_spd_entry +$(ECHO) "" >> $3 +endef + +$(MEM_INIT_DESCRIPTOR_FILE).DAT_FILESET := $(patsubst $(dir $(MEM_INIT_DESCRIPTOR_FILE))%,%,$(DAT_FILES)) +$(MEM_INIT_DESCRIPTOR_FILE).HEX_FILESET := $(patsubst $(dir $(MEM_INIT_DESCRIPTOR_FILE))%,%,$(HEX_FILES)) + +$(MEM_INIT_DESCRIPTOR_FILE): %.spd: $(MEM_INIT_FILE) + $(post-process-info) + @$(MKDIR) $(@D) + @$(RM) $@ + @$(ECHO) "" > $@ + @$(ECHO) "" >> $@ + @$(foreach dat_file,$($@.DAT_FILESET),$(call gen_spd_entry,$(dat_file),DAT,$@) &&)true + @$(foreach hex_file,$($@.HEX_FILESET),$(call gen_spd_entry,$(hex_file),HEX,$@) &&)true + @$(ECHO) "" >> $@ + +.DELETE_ON_ERROR: $(MEM_INIT_DESCRIPTOR_FILE) + +$(MEM_INIT_QIP_FILE): %.qip: $(MEM_INIT_FILE) + $(post-process-info) + @$(MKDIR) $(@D) + @$(RM) $@ + @$(ECHO) "set_global_assignment -name SEARCH_PATH $$::quartus(qip_path)" > $@ + +.DELETE_ON_ERROR: $(MEM_INIT_QIP_FILE) Index: components/sd_card/firmware/bsp/.cproject =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/xml Index: components/sd_card/firmware/bsp/.cproject =================================================================== --- components/sd_card/firmware/bsp/.cproject (nonexistent) +++ components/sd_card/firmware/bsp/.cproject (revision 8)
components/sd_card/firmware/bsp/.cproject Property changes : Added: svn:mime-type ## -0,0 +1 ## +application/xml \ No newline at end of property Index: components/sd_card/firmware/bsp/system.h =================================================================== --- components/sd_card/firmware/bsp/system.h (nonexistent) +++ components/sd_card/firmware/bsp/system.h (revision 8) @@ -0,0 +1,293 @@ +/* + * system.h - SOPC Builder system and BSP software package information + * + * Machine generated for CPU 'nios2_qsys_0' in SOPC Builder design 'system' + * SOPC Builder design path: ../../system.sopcinfo + * + * Generated: Sun Aug 17 15:22:54 CEST 2014 + */ + +/* + * DO NOT MODIFY THIS FILE + * + * Changing this file will have subtle consequences + * which will almost certainly lead to a nonfunctioning + * system. If you do modify this file, be aware that your + * changes will be overwritten and lost when this file + * is generated again. + * + * DO NOT MODIFY THIS FILE + */ + +/* + * License Agreement + * + * Copyright (c) 2008 + * Altera Corporation, San Jose, California, USA. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * This agreement shall be governed in all respects by the laws of the State + * of California and by the laws of the United States of America. + */ + +#ifndef __SYSTEM_H_ +#define __SYSTEM_H_ + +/* Include definitions from linker script generator */ +#include "linker.h" + + +/* + * CPU configuration + * + */ + +#define ALT_CPU_ARCHITECTURE "altera_nios2_qsys" +#define ALT_CPU_BIG_ENDIAN 0 +#define ALT_CPU_BREAK_ADDR 0x08010820 +#define ALT_CPU_CPU_FREQ 50000000u +#define ALT_CPU_CPU_ID_SIZE 1 +#define ALT_CPU_CPU_ID_VALUE 0x00000000 +#define ALT_CPU_CPU_IMPLEMENTATION "tiny" +#define ALT_CPU_DATA_ADDR_WIDTH 0x1c +#define ALT_CPU_DCACHE_LINE_SIZE 0 +#define ALT_CPU_DCACHE_LINE_SIZE_LOG2 0 +#define ALT_CPU_DCACHE_SIZE 0 +#define ALT_CPU_EXCEPTION_ADDR 0x08008020 +#define ALT_CPU_FLUSHDA_SUPPORTED +#define ALT_CPU_FREQ 50000000 +#define ALT_CPU_HARDWARE_DIVIDE_PRESENT 0 +#define ALT_CPU_HARDWARE_MULTIPLY_PRESENT 0 +#define ALT_CPU_HARDWARE_MULX_PRESENT 0 +#define ALT_CPU_HAS_DEBUG_CORE 1 +#define ALT_CPU_HAS_DEBUG_STUB +#define ALT_CPU_HAS_JMPI_INSTRUCTION +#define ALT_CPU_ICACHE_LINE_SIZE 0 +#define ALT_CPU_ICACHE_LINE_SIZE_LOG2 0 +#define ALT_CPU_ICACHE_SIZE 0 +#define ALT_CPU_INST_ADDR_WIDTH 0x1c +#define ALT_CPU_NAME "nios2_qsys_0" +#define ALT_CPU_RESET_ADDR 0x08008000 + + +/* + * CPU configuration (with legacy prefix - don't use these anymore) + * + */ + +#define NIOS2_BIG_ENDIAN 0 +#define NIOS2_BREAK_ADDR 0x08010820 +#define NIOS2_CPU_FREQ 50000000u +#define NIOS2_CPU_ID_SIZE 1 +#define NIOS2_CPU_ID_VALUE 0x00000000 +#define NIOS2_CPU_IMPLEMENTATION "tiny" +#define NIOS2_DATA_ADDR_WIDTH 0x1c +#define NIOS2_DCACHE_LINE_SIZE 0 +#define NIOS2_DCACHE_LINE_SIZE_LOG2 0 +#define NIOS2_DCACHE_SIZE 0 +#define NIOS2_EXCEPTION_ADDR 0x08008020 +#define NIOS2_FLUSHDA_SUPPORTED +#define NIOS2_HARDWARE_DIVIDE_PRESENT 0 +#define NIOS2_HARDWARE_MULTIPLY_PRESENT 0 +#define NIOS2_HARDWARE_MULX_PRESENT 0 +#define NIOS2_HAS_DEBUG_CORE 1 +#define NIOS2_HAS_DEBUG_STUB +#define NIOS2_HAS_JMPI_INSTRUCTION +#define NIOS2_ICACHE_LINE_SIZE 0 +#define NIOS2_ICACHE_LINE_SIZE_LOG2 0 +#define NIOS2_ICACHE_SIZE 0 +#define NIOS2_INST_ADDR_WIDTH 0x1c +#define NIOS2_RESET_ADDR 0x08008000 + + +/* + * Define for each module class mastered by the CPU + * + */ + +#define __ALTERA_AVALON_JTAG_UART +#define __ALTERA_AVALON_NEW_SDRAM_CONTROLLER +#define __ALTERA_AVALON_ONCHIP_MEMORY2 +#define __ALTERA_NIOS2_QSYS +#define __DRIVER_SD +#define __SLOW_MEM + + +/* + * System configuration + * + */ + +#define ALT_DEVICE_FAMILY "Cyclone IV E" +#define ALT_ENHANCED_INTERRUPT_API_PRESENT +#define ALT_IRQ_BASE NULL +#define ALT_LOG_PORT "/dev/null" +#define ALT_LOG_PORT_BASE 0x0 +#define ALT_LOG_PORT_DEV null +#define ALT_LOG_PORT_TYPE "" +#define ALT_NUM_EXTERNAL_INTERRUPT_CONTROLLERS 0 +#define ALT_NUM_INTERNAL_INTERRUPT_CONTROLLERS 1 +#define ALT_NUM_INTERRUPT_CONTROLLERS 1 +#define ALT_STDERR "/dev/jtag_uart" +#define ALT_STDERR_BASE 0x8011410 +#define ALT_STDERR_DEV jtag_uart +#define ALT_STDERR_IS_JTAG_UART +#define ALT_STDERR_PRESENT +#define ALT_STDERR_TYPE "altera_avalon_jtag_uart" +#define ALT_STDIN "/dev/jtag_uart" +#define ALT_STDIN_BASE 0x8011410 +#define ALT_STDIN_DEV jtag_uart +#define ALT_STDIN_IS_JTAG_UART +#define ALT_STDIN_PRESENT +#define ALT_STDIN_TYPE "altera_avalon_jtag_uart" +#define ALT_STDOUT "/dev/jtag_uart" +#define ALT_STDOUT_BASE 0x8011410 +#define ALT_STDOUT_DEV jtag_uart +#define ALT_STDOUT_IS_JTAG_UART +#define ALT_STDOUT_PRESENT +#define ALT_STDOUT_TYPE "altera_avalon_jtag_uart" +#define ALT_SYSTEM_NAME "system" + + +/* + * driver_sd_0 configuration + * + */ + +#define ALT_MODULE_CLASS_driver_sd_0 driver_sd +#define DRIVER_SD_0_BASE 0x8011400 +#define DRIVER_SD_0_IRQ -1 +#define DRIVER_SD_0_IRQ_INTERRUPT_CONTROLLER_ID -1 +#define DRIVER_SD_0_NAME "/dev/driver_sd_0" +#define DRIVER_SD_0_SPAN 16 +#define DRIVER_SD_0_TYPE "driver_sd" + + +/* + * hal configuration + * + */ + +#define ALT_MAX_FD 32 +#define ALT_SYS_CLK none +#define ALT_TIMESTAMP_CLK none + + +/* + * jtag_uart configuration + * + */ + +#define ALT_MODULE_CLASS_jtag_uart altera_avalon_jtag_uart +#define JTAG_UART_BASE 0x8011410 +#define JTAG_UART_IRQ 0 +#define JTAG_UART_IRQ_INTERRUPT_CONTROLLER_ID 0 +#define JTAG_UART_NAME "/dev/jtag_uart" +#define JTAG_UART_READ_DEPTH 64 +#define JTAG_UART_READ_THRESHOLD 8 +#define JTAG_UART_SPAN 8 +#define JTAG_UART_TYPE "altera_avalon_jtag_uart" +#define JTAG_UART_WRITE_DEPTH 64 +#define JTAG_UART_WRITE_THRESHOLD 8 + + +/* + * onchip_memory2_0 configuration + * + */ + +#define ALT_MODULE_CLASS_onchip_memory2_0 altera_avalon_onchip_memory2 +#define ONCHIP_MEMORY2_0_ALLOW_IN_SYSTEM_MEMORY_CONTENT_EDITOR 0 +#define ONCHIP_MEMORY2_0_ALLOW_MRAM_SIM_CONTENTS_ONLY_FILE 0 +#define ONCHIP_MEMORY2_0_BASE 0x8008000 +#define ONCHIP_MEMORY2_0_CONTENTS_INFO "" +#define ONCHIP_MEMORY2_0_DUAL_PORT 0 +#define ONCHIP_MEMORY2_0_GUI_RAM_BLOCK_TYPE "AUTO" +#define ONCHIP_MEMORY2_0_INIT_CONTENTS_FILE "system_onchip_memory2_0" +#define ONCHIP_MEMORY2_0_INIT_MEM_CONTENT 1 +#define ONCHIP_MEMORY2_0_INSTANCE_ID "NONE" +#define ONCHIP_MEMORY2_0_IRQ -1 +#define ONCHIP_MEMORY2_0_IRQ_INTERRUPT_CONTROLLER_ID -1 +#define ONCHIP_MEMORY2_0_NAME "/dev/onchip_memory2_0" +#define ONCHIP_MEMORY2_0_NON_DEFAULT_INIT_FILE_ENABLED 0 +#define ONCHIP_MEMORY2_0_RAM_BLOCK_TYPE "AUTO" +#define ONCHIP_MEMORY2_0_READ_DURING_WRITE_MODE "DONT_CARE" +#define ONCHIP_MEMORY2_0_SINGLE_CLOCK_OP 0 +#define ONCHIP_MEMORY2_0_SIZE_MULTIPLE 1 +#define ONCHIP_MEMORY2_0_SIZE_VALUE 32768 +#define ONCHIP_MEMORY2_0_SPAN 32768 +#define ONCHIP_MEMORY2_0_TYPE "altera_avalon_onchip_memory2" +#define ONCHIP_MEMORY2_0_WRITABLE 1 + + +/* + * sdram configuration + * + */ + +#define ALT_MODULE_CLASS_sdram altera_avalon_new_sdram_controller +#define SDRAM_BASE 0x0 +#define SDRAM_CAS_LATENCY 2 +#define SDRAM_CONTENTS_INFO +#define SDRAM_INIT_NOP_DELAY 0.0 +#define SDRAM_INIT_REFRESH_COMMANDS 2 +#define SDRAM_IRQ -1 +#define SDRAM_IRQ_INTERRUPT_CONTROLLER_ID -1 +#define SDRAM_IS_INITIALIZED 1 +#define SDRAM_NAME "/dev/sdram" +#define SDRAM_POWERUP_DELAY 100.0 +#define SDRAM_REFRESH_PERIOD 15.625 +#define SDRAM_REGISTER_DATA_IN 1 +#define SDRAM_SDRAM_ADDR_WIDTH 0x19 +#define SDRAM_SDRAM_BANK_WIDTH 2 +#define SDRAM_SDRAM_COL_WIDTH 10 +#define SDRAM_SDRAM_DATA_WIDTH 32 +#define SDRAM_SDRAM_NUM_BANKS 4 +#define SDRAM_SDRAM_NUM_CHIPSELECTS 1 +#define SDRAM_SDRAM_ROW_WIDTH 13 +#define SDRAM_SHARED_DATA 0 +#define SDRAM_SIM_MODEL_BASE 0 +#define SDRAM_SPAN 134217728 +#define SDRAM_STARVATION_INDICATOR 0 +#define SDRAM_TRISTATE_BRIDGE_SLAVE "" +#define SDRAM_TYPE "altera_avalon_new_sdram_controller" +#define SDRAM_T_AC 5.5 +#define SDRAM_T_MRD 3 +#define SDRAM_T_RCD 20.0 +#define SDRAM_T_RFC 70.0 +#define SDRAM_T_RP 20.0 +#define SDRAM_T_WR 14.0 + + +/* + * slow_mem_0 configuration + * + */ + +#define ALT_MODULE_CLASS_slow_mem_0 slow_mem +#define SLOW_MEM_0_BASE 0x8011000 +#define SLOW_MEM_0_IRQ -1 +#define SLOW_MEM_0_IRQ_INTERRUPT_CONTROLLER_ID -1 +#define SLOW_MEM_0_NAME "/dev/slow_mem_0" +#define SLOW_MEM_0_SPAN 1024 +#define SLOW_MEM_0_TYPE "slow_mem" + +#endif /* __SYSTEM_H_ */ Index: components/sd_card/firmware/bsp/linker.h =================================================================== --- components/sd_card/firmware/bsp/linker.h (nonexistent) +++ components/sd_card/firmware/bsp/linker.h (revision 8) @@ -0,0 +1,95 @@ +/* + * linker.h - Linker script mapping information + * + * Machine generated for CPU 'nios2_qsys_0' in SOPC Builder design 'system' + * SOPC Builder design path: ../../system.sopcinfo + * + * Generated: Sat Aug 16 22:39:53 CEST 2014 + */ + +/* + * DO NOT MODIFY THIS FILE + * + * Changing this file will have subtle consequences + * which will almost certainly lead to a nonfunctioning + * system. If you do modify this file, be aware that your + * changes will be overwritten and lost when this file + * is generated again. + * + * DO NOT MODIFY THIS FILE + */ + +/* + * License Agreement + * + * Copyright (c) 2008 + * Altera Corporation, San Jose, California, USA. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * This agreement shall be governed in all respects by the laws of the State + * of California and by the laws of the United States of America. + */ + +#ifndef __LINKER_H_ +#define __LINKER_H_ + + +/* + * BSP controls alt_load() behavior in crt0. + * + */ + +#define ALT_LOAD_EXPLICITLY_CONTROLLED + + +/* + * Base address and span (size in bytes) of each linker region + * + */ + +#define ONCHIP_MEMORY2_0_REGION_BASE 0x8008020 +#define ONCHIP_MEMORY2_0_REGION_SPAN 32736 +#define RESET_REGION_BASE 0x8008000 +#define RESET_REGION_SPAN 32 +#define SDRAM_REGION_BASE 0x0 +#define SDRAM_REGION_SPAN 134217728 + + +/* + * Devices associated with code sections + * + */ + +#define ALT_EXCEPTIONS_DEVICE ONCHIP_MEMORY2_0 +#define ALT_RESET_DEVICE ONCHIP_MEMORY2_0 +#define ALT_RODATA_DEVICE ONCHIP_MEMORY2_0 +#define ALT_RWDATA_DEVICE ONCHIP_MEMORY2_0 +#define ALT_TEXT_DEVICE ONCHIP_MEMORY2_0 + + +/* + * Initialization code at the reset address is allowed (e.g. no external bootloader). + * + */ + +#define ALT_ALLOW_CODE_AT_RESET + +#endif /* __LINKER_H_ */ Index: components/sd_card/firmware/bsp/linker.x =================================================================== --- components/sd_card/firmware/bsp/linker.x (nonexistent) +++ components/sd_card/firmware/bsp/linker.x (revision 8) @@ -0,0 +1,365 @@ +/* + * linker.x - Linker script + * + * Machine generated for CPU 'nios2_qsys_0' in SOPC Builder design 'system' + * SOPC Builder design path: ../../system.sopcinfo + * + * Generated: Sat Aug 16 22:39:53 CEST 2014 + */ + +/* + * DO NOT MODIFY THIS FILE + * + * Changing this file will have subtle consequences + * which will almost certainly lead to a nonfunctioning + * system. If you do modify this file, be aware that your + * changes will be overwritten and lost when this file + * is generated again. + * + * DO NOT MODIFY THIS FILE + */ + +/* + * License Agreement + * + * Copyright (c) 2008 + * Altera Corporation, San Jose, California, USA. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * This agreement shall be governed in all respects by the laws of the State + * of California and by the laws of the United States of America. + */ + +MEMORY +{ + sdram : ORIGIN = 0x0, LENGTH = 134217728 + reset : ORIGIN = 0x8008000, LENGTH = 32 + onchip_memory2_0 : ORIGIN = 0x8008020, LENGTH = 32736 +} + +/* Define symbols for each memory base-address */ +__alt_mem_sdram = 0x0; +__alt_mem_onchip_memory2_0 = 0x8008000; + +OUTPUT_FORMAT( "elf32-littlenios2", + "elf32-littlenios2", + "elf32-littlenios2" ) +OUTPUT_ARCH( nios2 ) +ENTRY( _start ) + +/* + * The alt_load() facility is disabled. This typically happens when an + * external bootloader is provided or the application runs in place. + * The LMA (aka physical address) of each section defaults to its VMA. + */ + +SECTIONS +{ + + /* + * Output sections associated with reset and exceptions (they have to be first) + */ + + .entry : + { + KEEP (*(.entry)) + } > reset + + .exceptions : + { + PROVIDE (__ram_exceptions_start = ABSOLUTE(.)); + . = ALIGN(0x20); + KEEP (*(.irq)); + KEEP (*(.exceptions.entry.label)); + KEEP (*(.exceptions.entry.user)); + KEEP (*(.exceptions.entry.ecc_fatal)); + KEEP (*(.exceptions.entry)); + KEEP (*(.exceptions.irqtest.user)); + KEEP (*(.exceptions.irqtest)); + KEEP (*(.exceptions.irqhandler.user)); + KEEP (*(.exceptions.irqhandler)); + KEEP (*(.exceptions.irqreturn.user)); + KEEP (*(.exceptions.irqreturn)); + KEEP (*(.exceptions.notirq.label)); + KEEP (*(.exceptions.notirq.user)); + KEEP (*(.exceptions.notirq)); + KEEP (*(.exceptions.soft.user)); + KEEP (*(.exceptions.soft)); + KEEP (*(.exceptions.unknown.user)); + KEEP (*(.exceptions.unknown)); + KEEP (*(.exceptions.exit.label)); + KEEP (*(.exceptions.exit.user)); + KEEP (*(.exceptions.exit)); + KEEP (*(.exceptions)); + PROVIDE (__ram_exceptions_end = ABSOLUTE(.)); + } > onchip_memory2_0 + + PROVIDE (__flash_exceptions_start = LOADADDR(.exceptions)); + + .text : + { + /* + * All code sections are merged into the text output section, along with + * the read only data sections. + * + */ + + PROVIDE (stext = ABSOLUTE(.)); + + *(.interp) + *(.hash) + *(.dynsym) + *(.dynstr) + *(.gnu.version) + *(.gnu.version_d) + *(.gnu.version_r) + *(.rel.init) + *(.rela.init) + *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) + *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) + *(.rel.fini) + *(.rela.fini) + *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) + *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) + *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) + *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) + *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) + *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) + *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) + *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) + *(.rel.ctors) + *(.rela.ctors) + *(.rel.dtors) + *(.rela.dtors) + *(.rel.got) + *(.rela.got) + *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) + *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) + *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) + *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) + *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) + *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) + *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) + *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) + *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) + *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) + *(.rel.plt) + *(.rela.plt) + *(.rel.dyn) + + KEEP (*(.init)) + *(.plt) + *(.text .stub .text.* .gnu.linkonce.t.*) + + /* .gnu.warning sections are handled specially by elf32.em. */ + + *(.gnu.warning.*) + KEEP (*(.fini)) + PROVIDE (__etext = ABSOLUTE(.)); + PROVIDE (_etext = ABSOLUTE(.)); + PROVIDE (etext = ABSOLUTE(.)); + + *(.eh_frame_hdr) + /* Ensure the __preinit_array_start label is properly aligned. We + could instead move the label definition inside the section, but + the linker would then create the section even if it turns out to + be empty, which isn't pretty. */ + . = ALIGN(4); + PROVIDE (__preinit_array_start = ABSOLUTE(.)); + *(.preinit_array) + PROVIDE (__preinit_array_end = ABSOLUTE(.)); + PROVIDE (__init_array_start = ABSOLUTE(.)); + *(.init_array) + PROVIDE (__init_array_end = ABSOLUTE(.)); + PROVIDE (__fini_array_start = ABSOLUTE(.)); + *(.fini_array) + PROVIDE (__fini_array_end = ABSOLUTE(.)); + SORT(CONSTRUCTORS) + KEEP (*(.eh_frame)) + *(.gcc_except_table .gcc_except_table.*) + *(.dynamic) + PROVIDE (__CTOR_LIST__ = ABSOLUTE(.)); + KEEP (*(.ctors)) + KEEP (*(SORT(.ctors.*))) + PROVIDE (__CTOR_END__ = ABSOLUTE(.)); + PROVIDE (__DTOR_LIST__ = ABSOLUTE(.)); + KEEP (*(.dtors)) + KEEP (*(SORT(.dtors.*))) + PROVIDE (__DTOR_END__ = ABSOLUTE(.)); + KEEP (*(.jcr)) + . = ALIGN(4); + } > onchip_memory2_0 = 0x3a880100 /* NOP instruction (always in big-endian byte ordering) */ + + .rodata : + { + PROVIDE (__ram_rodata_start = ABSOLUTE(.)); + . = ALIGN(4); + *(.rodata .rodata.* .gnu.linkonce.r.*) + *(.rodata1) + . = ALIGN(4); + PROVIDE (__ram_rodata_end = ABSOLUTE(.)); + } > onchip_memory2_0 + + PROVIDE (__flash_rodata_start = LOADADDR(.rodata)); + + .rwdata : + { + PROVIDE (__ram_rwdata_start = ABSOLUTE(.)); + . = ALIGN(4); + *(.got.plt) *(.got) + *(.data1) + *(.data .data.* .gnu.linkonce.d.*) + + _gp = ABSOLUTE(. + 0x8000); + PROVIDE(gp = _gp); + + *(.rwdata .rwdata.*) + *(.sdata .sdata.* .gnu.linkonce.s.*) + *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) + + . = ALIGN(4); + _edata = ABSOLUTE(.); + PROVIDE (edata = ABSOLUTE(.)); + PROVIDE (__ram_rwdata_end = ABSOLUTE(.)); + } > onchip_memory2_0 + + PROVIDE (__flash_rwdata_start = LOADADDR(.rwdata)); + + .bss : + { + __bss_start = ABSOLUTE(.); + PROVIDE (__sbss_start = ABSOLUTE(.)); + PROVIDE (___sbss_start = ABSOLUTE(.)); + + *(.dynsbss) + *(.sbss .sbss.* .gnu.linkonce.sb.*) + *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) + *(.scommon) + + PROVIDE (__sbss_end = ABSOLUTE(.)); + PROVIDE (___sbss_end = ABSOLUTE(.)); + + *(.dynbss) + *(.bss .bss.* .gnu.linkonce.b.*) + *(COMMON) + + . = ALIGN(4); + __bss_end = ABSOLUTE(.); + } > onchip_memory2_0 + + /* + * + * One output section mapped to the associated memory device for each of + * the available memory devices. These are not used by default, but can + * be used by user applications by using the .section directive. + * + * The output section used for the heap is treated in a special way, + * i.e. the symbols "end" and "_end" are added to point to the heap start. + * + */ + + .sdram : + { + PROVIDE (_alt_partition_sdram_start = ABSOLUTE(.)); + *(.sdram .sdram. sdram.*) + . = ALIGN(4); + PROVIDE (_alt_partition_sdram_end = ABSOLUTE(.)); + } > sdram + + PROVIDE (_alt_partition_sdram_load_addr = LOADADDR(.sdram)); + + .onchip_memory2_0 : + { + PROVIDE (_alt_partition_onchip_memory2_0_start = ABSOLUTE(.)); + *(.onchip_memory2_0 .onchip_memory2_0. onchip_memory2_0.*) + . = ALIGN(4); + PROVIDE (_alt_partition_onchip_memory2_0_end = ABSOLUTE(.)); + _end = ABSOLUTE(.); + end = ABSOLUTE(.); + __alt_stack_base = ABSOLUTE(.); + } > onchip_memory2_0 + + PROVIDE (_alt_partition_onchip_memory2_0_load_addr = LOADADDR(.onchip_memory2_0)); + + /* + * Stabs debugging sections. + * + */ + + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + + /* Altera debug extensions */ + .debug_alt_sim_info 0 : { *(.debug_alt_sim_info) } +} + +/* provide a pointer for the stack */ + +/* + * Don't override this, override the __alt_stack_* symbols instead. + */ +__alt_data_end = 0x8010000; + +/* + * The next two symbols define the location of the default stack. You can + * override them to move the stack to a different memory. + */ +PROVIDE( __alt_stack_pointer = __alt_data_end ); +PROVIDE( __alt_stack_limit = __alt_stack_base ); + +/* + * This symbol controls where the start of the heap is. If the stack is + * contiguous with the heap then the stack will contract as memory is + * allocated to the heap. + * Override this symbol to put the heap in a different memory. + */ +PROVIDE( __alt_heap_start = end ); +PROVIDE( __alt_heap_limit = 0x8010000 ); Index: components/sd_card/firmware/bsp/Makefile =================================================================== --- components/sd_card/firmware/bsp/Makefile (nonexistent) +++ components/sd_card/firmware/bsp/Makefile (revision 8) @@ -0,0 +1,758 @@ +#------------------------------------------------------------------------------ +# BSP MAKEFILE +# +# This makefile was automatically generated by the nios2-bsp-generate-files +# command. Its purpose is to build a custom Board Support Package (BSP) +# targeting a specific Nios II processor in an SOPC Builder-based design. +# +# To create an application or library Makefile which uses this BSP, try the +# nios2-app-generate-makefile or nios2-lib-generate-makefile commands. +#------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------ +# TOOLS +#------------------------------------------------------------------------------ + +MKDIR := mkdir -p +ECHO := echo +SPACE := $(empty) $(empty) + +#------------------------------------------------------------------------------ +# The adjust-path macro +# +# If COMSPEC is defined, Make is launched from Windows through +# Cygwin. This adjust-path macro will call 'cygpath -u' on all +# paths to ensure they are readable by Make. +# +# If COMSPEC is not defined, Make is launched from *nix, and no adjustment +# is necessary +#------------------------------------------------------------------------------ + +ifndef COMSPEC +ifdef ComSpec +COMSPEC = $(ComSpec) +endif # ComSpec +endif # !COMSPEC + +ifdef COMSPEC + adjust-path = $(subst $(SPACE),\$(SPACE),$(shell cygpath -u "$1")) + adjust-path-mixed = $(subst $(SPACE),\$(SPACE),$(shell cygpath -m "$1")) +else + adjust-path = $(subst $(SPACE),\$(SPACE),$1) + adjust-path-mixed = $(subst $(SPACE),\$(SPACE),$1) +endif + +#------------------------------------------------------------------------------ +# DEFAULT TARGET +# +# The default target, "all", must appear before any other target in the +# Makefile. Note that extra prerequisites are added to the "all" rule later. +#------------------------------------------------------------------------------ +.PHONY: all +all: + @$(ECHO) [BSP build complete] + + +#------------------------------------------------------------------------------ +# PATHS & DIRECTORY NAMES +# +# Explicitly locate absolute path of the BSP root +#------------------------------------------------------------------------------ + +BSP_ROOT_DIR := . + +# Define absolute path to the root of the BSP. +ABS_BSP_ROOT := $(call adjust-path-mixed,$(shell pwd)) + +# Stash all BSP object files here +OBJ_DIR := ./obj + + +#------------------------------------------------------------------------------ +# MANAGED CONTENT +# +# All content between the lines "START MANAGED" and "END MANAGED" below is +# generated based on variables in the BSP settings file when the +# nios2-bsp-generate-files command is invoked. If you wish to persist any +# information pertaining to the build process, it is recomended that you +# utilize the BSP settings mechanism to do so. +# +# Note that most variable assignments in this section have a corresponding BSP +# setting that can be changed by using the nios2-bsp-create-settings or +# nios2-bsp-update-settings command before nios2-bsp-generate-files; if you +# want any variable set to a specific value when this Makefile is re-generated +# (to prevent hand-edits from being over-written), use the BSP settings +# facilities above. +#------------------------------------------------------------------------------ + +#START MANAGED + +# The following TYPE comment allows tools to identify the 'type' of target this +# makefile is associated with. +# TYPE: BSP_PRIVATE_MAKEFILE + +# This following VERSION comment indicates the version of the tool used to +# generate this makefile. A makefile variable is provided for VERSION as well. +# ACDS_VERSION: 14.0 +ACDS_VERSION := 14.0 + +# This following BUILD_NUMBER comment indicates the build number of the tool +# used to generate this makefile. +# BUILD_NUMBER: 200 + +SETTINGS_FILE := settings.bsp +SOPC_FILE := ../../system.sopcinfo + +#------------------------------------------------------------------------------- +# TOOL & COMMAND DEFINITIONS +# +# The base command for each build operation are expressed here. Additional +# switches may be expressed here. They will run for all instances of the +# utility. +#------------------------------------------------------------------------------- + +# Archiver command. Creates library files. +AR = nios2-elf-ar + +# Assembler command. Note that CC is used for .S files. +AS = nios2-elf-gcc + +# Custom flags only passed to the archiver. This content of this variable is +# directly passed to the archiver rather than the more standard "ARFLAGS". The +# reason for this is that GNU Make assumes some default content in ARFLAGS. +# This setting defines the value of BSP_ARFLAGS in Makefile. +BSP_ARFLAGS = -src + +# Custom flags only passed to the assembler. This setting defines the value of +# BSP_ASFLAGS in Makefile. +BSP_ASFLAGS = -Wa,-gdwarf2 + +# C/C++ compiler debug level. '-g' provides the default set of debug symbols +# typically required to debug a typical application. Omitting '-g' removes +# debug symbols from the ELF. This setting defines the value of +# BSP_CFLAGS_DEBUG in Makefile. +BSP_CFLAGS_DEBUG = -g + +# C/C++ compiler optimization level. "-O0" = no optimization,"-O2" = "normal" +# optimization, etc. "-O0" is recommended for code that you want to debug since +# compiler optimization can remove variables and produce non-sequential +# execution of code while debugging. This setting defines the value of +# BSP_CFLAGS_OPTIMIZATION in Makefile. +BSP_CFLAGS_OPTIMIZATION = -Os + +# C/C++ compiler warning level. "-Wall" is commonly used.This setting defines +# the value of BSP_CFLAGS_WARNINGS in Makefile. +BSP_CFLAGS_WARNINGS = -Wall + +# C compiler command. +CC = nios2-elf-gcc -xc + +# C++ compiler command. +CXX = nios2-elf-gcc -xc++ + +# Command used to remove files during 'clean' target. +RM = rm -f + + +#------------------------------------------------------------------------------- +# BUILD PRE & POST PROCESS COMMANDS +# +# The following variables are treated as shell commands in the rule +# definitions for each file-type associated with the BSP build, as well as +# commands run at the beginning and end of the entire BSP build operation. +# Pre-process commands are executed before the relevant command (for example, +# a command defined in the "CC_PRE_PROCESS" variable executes before the C +# compiler for building .c files), while post-process commands are executed +# immediately afterwards. +# +# You can view each pre/post-process command in the "Build Rules: All & +# Clean", "Pattern Rules to Build Objects", and "Library Rules" sections of +# this Makefile. +#------------------------------------------------------------------------------- + + +#------------------------------------------------------------------------------- +# BSP SOURCE BUILD SETTINGS (FLAG GENERATION) +# +# Software build settings such as compiler optimization, debug level, warning +# flags, etc., may be defined in the following variables. The variables below +# are concatenated together in the 'Flags' section of this Makefile to form +# final variables of flags passed to the build tools. +# +# These settings are considered private to the BSP and apply to all library & +# driver files in it; they do NOT automatically propagate to, for example, the +# build settings for an application. +# # For additional detail and syntax requirements, please refer to GCC help +# (example: "nios2-elf-gcc --help --verbose"). +# +# Unless indicated otherwise, multiple entries in each variable should be +# space-separated. +#------------------------------------------------------------------------------- + +# Altera HAL alt_sys_init.c generated source file +GENERATED_C_FILES := $(ABS_BSP_ROOT)/alt_sys_init.c +GENERATED_C_LIB_SRCS += alt_sys_init.c + + +#------------------------------------------------------------------------------- +# BSP SOURCE FILE LISTING +# +# All source files that comprise the BSP are listed here, along with path +# information to each file expressed relative to the BSP root. The precise +# list and location of each file is derived from the driver, operating system, +# or software package source file declarations. +# +# Following specification of the source files for each component, driver, etc., +# each source file type (C, assembly, etc.) is concatenated together and used +# to construct a list of objects. Pattern rules to build each object are then +# used to build each file. +#------------------------------------------------------------------------------- + +# altera_avalon_jtag_uart_driver sources root +altera_avalon_jtag_uart_driver_SRCS_ROOT := drivers + +# altera_avalon_jtag_uart_driver sources +altera_avalon_jtag_uart_driver_C_LIB_SRCS := \ + $(altera_avalon_jtag_uart_driver_SRCS_ROOT)/src/altera_avalon_jtag_uart_init.c \ + $(altera_avalon_jtag_uart_driver_SRCS_ROOT)/src/altera_avalon_jtag_uart_read.c \ + $(altera_avalon_jtag_uart_driver_SRCS_ROOT)/src/altera_avalon_jtag_uart_write.c \ + $(altera_avalon_jtag_uart_driver_SRCS_ROOT)/src/altera_avalon_jtag_uart_ioctl.c \ + $(altera_avalon_jtag_uart_driver_SRCS_ROOT)/src/altera_avalon_jtag_uart_fd.c + +# altera_nios2_qsys_hal_driver sources root +altera_nios2_qsys_hal_driver_SRCS_ROOT := HAL + +# altera_nios2_qsys_hal_driver sources +altera_nios2_qsys_hal_driver_C_LIB_SRCS := \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/altera_nios2_qsys_irq.c \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_usleep.c \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_busy_sleep.c \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_irq_vars.c \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_icache_flush.c \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_icache_flush_all.c \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_dcache_flush.c \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_dcache_flush_all.c \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_dcache_flush_no_writeback.c \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_ecc_fatal_exception.c \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_instruction_exception_entry.c \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_irq_register.c \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_iic.c \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_remap_cached.c \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_remap_uncached.c \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_uncached_free.c \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_uncached_malloc.c \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_do_ctors.c \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_do_dtors.c \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_gmon.c + +altera_nios2_qsys_hal_driver_ASM_LIB_SRCS := \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_ecc_fatal_entry.S \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_exception_entry.S \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_exception_trap.S \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_exception_muldiv.S \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_irq_entry.S \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_software_exception.S \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_mcount.S \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_log_macro.S \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/crt0.S + +# hal sources root +hal_SRCS_ROOT := HAL + +# hal sources +hal_C_LIB_SRCS := \ + $(hal_SRCS_ROOT)/src/alt_alarm_start.c \ + $(hal_SRCS_ROOT)/src/alt_close.c \ + $(hal_SRCS_ROOT)/src/alt_dev.c \ + $(hal_SRCS_ROOT)/src/alt_dev_llist_insert.c \ + $(hal_SRCS_ROOT)/src/alt_dma_rxchan_open.c \ + $(hal_SRCS_ROOT)/src/alt_dma_txchan_open.c \ + $(hal_SRCS_ROOT)/src/alt_environ.c \ + $(hal_SRCS_ROOT)/src/alt_env_lock.c \ + $(hal_SRCS_ROOT)/src/alt_errno.c \ + $(hal_SRCS_ROOT)/src/alt_execve.c \ + $(hal_SRCS_ROOT)/src/alt_exit.c \ + $(hal_SRCS_ROOT)/src/alt_fcntl.c \ + $(hal_SRCS_ROOT)/src/alt_fd_lock.c \ + $(hal_SRCS_ROOT)/src/alt_fd_unlock.c \ + $(hal_SRCS_ROOT)/src/alt_find_dev.c \ + $(hal_SRCS_ROOT)/src/alt_find_file.c \ + $(hal_SRCS_ROOT)/src/alt_flash_dev.c \ + $(hal_SRCS_ROOT)/src/alt_fork.c \ + $(hal_SRCS_ROOT)/src/alt_fs_reg.c \ + $(hal_SRCS_ROOT)/src/alt_fstat.c \ + $(hal_SRCS_ROOT)/src/alt_get_fd.c \ + $(hal_SRCS_ROOT)/src/alt_getchar.c \ + $(hal_SRCS_ROOT)/src/alt_getpid.c \ + $(hal_SRCS_ROOT)/src/alt_gettod.c \ + $(hal_SRCS_ROOT)/src/alt_iic_isr_register.c \ + $(hal_SRCS_ROOT)/src/alt_instruction_exception_register.c \ + $(hal_SRCS_ROOT)/src/alt_ioctl.c \ + $(hal_SRCS_ROOT)/src/alt_io_redirect.c \ + $(hal_SRCS_ROOT)/src/alt_irq_handler.c \ + $(hal_SRCS_ROOT)/src/alt_isatty.c \ + $(hal_SRCS_ROOT)/src/alt_kill.c \ + $(hal_SRCS_ROOT)/src/alt_link.c \ + $(hal_SRCS_ROOT)/src/alt_load.c \ + $(hal_SRCS_ROOT)/src/alt_log_printf.c \ + $(hal_SRCS_ROOT)/src/alt_lseek.c \ + $(hal_SRCS_ROOT)/src/alt_main.c \ + $(hal_SRCS_ROOT)/src/alt_malloc_lock.c \ + $(hal_SRCS_ROOT)/src/alt_open.c \ + $(hal_SRCS_ROOT)/src/alt_printf.c \ + $(hal_SRCS_ROOT)/src/alt_putchar.c \ + $(hal_SRCS_ROOT)/src/alt_putstr.c \ + $(hal_SRCS_ROOT)/src/alt_read.c \ + $(hal_SRCS_ROOT)/src/alt_release_fd.c \ + $(hal_SRCS_ROOT)/src/alt_rename.c \ + $(hal_SRCS_ROOT)/src/alt_sbrk.c \ + $(hal_SRCS_ROOT)/src/alt_settod.c \ + $(hal_SRCS_ROOT)/src/alt_stat.c \ + $(hal_SRCS_ROOT)/src/alt_tick.c \ + $(hal_SRCS_ROOT)/src/alt_times.c \ + $(hal_SRCS_ROOT)/src/alt_unlink.c \ + $(hal_SRCS_ROOT)/src/alt_wait.c \ + $(hal_SRCS_ROOT)/src/alt_write.c + + +# Assemble all component C source files +COMPONENT_C_LIB_SRCS += \ + $(altera_avalon_jtag_uart_driver_C_LIB_SRCS) \ + $(altera_nios2_qsys_hal_driver_C_LIB_SRCS) \ + $(hal_C_LIB_SRCS) + +# Assemble all component assembly source files +COMPONENT_ASM_LIB_SRCS += \ + $(altera_nios2_qsys_hal_driver_ASM_LIB_SRCS) + +# Assemble all component C++ source files +COMPONENT_CPP_LIB_SRCS += \ + +#END MANAGED + +#------------------------------------------------------------------------------ +# PUBLIC.MK +# +# The generated public.mk file contains BSP information that is shared with +# other external makefiles, such as a Nios II application makefile. System- +# dependent information such as hardware-specific compiler flags and +# simulation file generation are stored here. +# +# In addition, public.mk contains include paths that various software, +# such as a device driver, may need for the C compiler. These paths are +# written to public.mk with respect to the BSP root. In public.mk, each +# path is prefixed with a special variable, $(ALT_LIBRARY_ROOT_DIR). The +# purpose of this variable is to allow an external Makefile to append on +# path information to precisely locate paths expressed in public.mk +# Since this is the BSP Makefile, we set ALT_LIBRARY_ROOT_DIR to point right +# here ("."), at the BSP root. +# +# ALT_LIBRARY_ROOT_DIR must always be set before public.mk is included. +#------------------------------------------------------------------------------ +ALT_LIBRARY_ROOT_DIR := . +include public.mk + + +#------------------------------------------------------------------------------ +# FLAGS +# +# Include paths for BSP files are written into the public.mk file and must +# be added to the existing list of pre-processor flags. In addition, "hooks" +# for standard flags left intentionally empty (CFLAGS, CPPFLAGS, ASFLAGS, +# and CXXFLAGS) are provided for conveniently adding to the relevant flags +# on the command-line or via script that calls make. +#------------------------------------------------------------------------------ +# Assemble final list of compiler flags from generated content +BSP_CFLAGS += \ + $(BSP_CFLAGS_DEFINED_SYMBOLS) \ + $(BSP_CFLAGS_UNDEFINED_SYMBOLS) \ + $(BSP_CFLAGS_OPTIMIZATION) \ + $(BSP_CFLAGS_DEBUG) \ + $(BSP_CFLAGS_WARNINGS) \ + $(BSP_CFLAGS_USER_FLAGS) \ + $(ALT_CFLAGS) \ + $(CFLAGS) + +# Make ready the final list of include directories and other C pre-processor +# flags. Each include path is made ready by prefixing it with "-I". +BSP_CPPFLAGS += \ + $(addprefix -I, $(BSP_INC_DIRS)) \ + $(addprefix -I, $(ALT_INCLUDE_DIRS)) \ + $(ALT_CPPFLAGS) \ + $(CPPFLAGS) + +# Finish off assembler flags with any user-provided flags +BSP_ASFLAGS += $(ASFLAGS) + +# Finish off C++ flags with any user-provided flags +BSP_CXXFLAGS += $(CXXFLAGS) + +# And finally, the ordered list +C_SRCS += $(GENERATED_C_LIB_SRCS) \ + $(COMPONENT_C_LIB_SRCS) + +CXX_SRCS += $(GENERATED_CPP_LIB_SRCS) \ + $(COMPONENT_CPP_LIB_SRCS) + +ASM_SRCS += $(GENERATED_ASM_LIB_SRCS) \ + $(COMPONENT_ASM_LIB_SRCS) + + +#------------------------------------------------------------------------------ +# LIST OF GENERATED FILES +# +# A Nios II BSP relies on the generation of several source files used +# by both the BSP and any applications referencing the BSP. +#------------------------------------------------------------------------------ + + +GENERATED_H_FILES := $(ABS_BSP_ROOT)/system.h + +GENERATED_LINKER_SCRIPT := $(ABS_BSP_ROOT)/linker.x + +GENERATED_FILES += $(GENERATED_H_FILES) \ + $(GENERATED_LINKER_SCRIPT) + + +#------------------------------------------------------------------------------ +# SETUP TO BUILD OBJECTS +# +# List of object files which are to be built. This is constructed from the input +# list of C source files (C_SRCS), C++ source files (CXX_SRCS), and assembler +# source file (ASM_SRCS). The permitted file extensions are: +# +# .c .C - for C files +# .cxx .cc .cpp .CXX .CC .CPP - for C++ files +# .S .s - for assembly files +# +# Extended description: The list of objects is a sorted list (duplicates +# removed) of all possible objects, placed beneath the ./obj directory, +# including any path information stored in the "*_SRCS" variable. The +# "patsubst" commands are used to concatenate together multiple file suffix +# types for common files (i.e. c++ as .cxx, .cc, .cpp). +# +# File extensions are case-insensitive in build rules with the exception of +# assembly sources. Nios II assembly sources with the ".S" extension are first +# run through the C preprocessor. Sources with the ".s" extension are not. +#------------------------------------------------------------------------------ +OBJS = $(sort $(addprefix $(OBJ_DIR)/, \ + $(patsubst %.c, %.o, $(patsubst %.C, %.o, $(C_SRCS))) \ + $(patsubst %.cxx, %.o, $(patsubst %.CXX, %.o, \ + $(patsubst %.cc, %.o, $(patsubst %.CC, %.o, \ + $(patsubst %.cpp, %.o, $(patsubst %.CPP, %.o, \ + $(CXX_SRCS) )))))) \ + $(patsubst %.S, %.o, $(patsubst %.s, %.o, $(ASM_SRCS))) )) + +# List of dependancy files for each object file. +DEPS = $(OBJS:.o=.d) + + +# Rules to force your project to rebuild or relink +# .force_relink file will cause any application that depends on this project to relink +# .force_rebuild file will cause this project to rebuild object files +# .force_rebuild_all file will cause this project and any project that depends on this project to rebuild object files + +FORCE_RELINK_DEP := .force_relink +FORCE_REBUILD_DEP := .force_rebuild +FORCE_REBUILD_ALL_DEP := .force_rebuild_all +FORCE_REBUILD_DEP_LIST := $(FORCE_RELINK_DEP) $(FORCE_REBUILD_DEP) $(FORCE_REBUILD_ALL_DEP) + +$(FORCE_REBUILD_DEP_LIST): + +$(OBJS): $(wildcard $(FORCE_REBUILD_DEP)) $(wildcard $(FORCE_REBUILD_ALL_DEP)) + + +#------------------------------------------------------------------------------ +# BUILD RULES: ALL & CLEAN +#------------------------------------------------------------------------------ +.DELETE_ON_ERROR: + +.PHONY: all +all: build_pre_process +all: Makefile $(GENERATED_FILES) $(BSP_LIB) $(NEWLIB_DIR) +all: build_post_process + + +# clean: remove .o/.a/.d +.PHONY: clean +clean: + @$(RM) -r $(BSP_LIB) $(OBJ_DIR) $(FORCE_REBUILD_DEP_LIST) +ifneq ($(wildcard $(NEWLIB_DIR)),) + @$(RM) -r $(NEWLIB_DIR) +endif + @$(ECHO) [BSP clean complete] + + +#------------------------------------------------------------------------------ +# BUILD PRE/POST PROCESS +#------------------------------------------------------------------------------ +build_pre_process : + $(BUILD_PRE_PROCESS) + +build_post_process : + $(BUILD_POST_PROCESS) + +.PHONY: build_pre_process build_post_process + + + +#------------------------------------------------------------------------------ +# MAKEFILE UP TO DATE? +# +# Is this very Makefile up to date? Someone may have changed the BSP settings +# file or the associated target hardware. +#------------------------------------------------------------------------------ +# Skip this check when clean is the only target +ifneq ($(MAKECMDGOALS),clean) + +ifneq ($(wildcard $(SETTINGS_FILE)),$(SETTINGS_FILE)) +$(warning Warning: BSP Settings File $(SETTINGS_FILE) could not be found.) +endif + +Makefile: $(wildcard $(SETTINGS_FILE)) + @$(ECHO) Makefile not up to date. + @$(ECHO) $(SETTINGS_FILE) has been modified since the BSP Makefile was generated. + @$(ECHO) + @$(ECHO) Generate the BSP to update the Makefile, and then build again. + @$(ECHO) + @$(ECHO) To generate from Eclipse: + @$(ECHO) " 1. Right-click the BSP project." + @$(ECHO) " 2. In the Nios II Menu, click Generate BSP." + @$(ECHO) + @$(ECHO) To generate from the command line: + @$(ECHO) " nios2-bsp-generate-files --settings= --bsp-dir=" + @$(ECHO) + @exit 1 + +ifneq ($(wildcard $(SOPC_FILE)),$(SOPC_FILE)) +$(warning Warning: SOPC File $(SOPC_FILE) could not be found.) +endif + +public.mk: $(wildcard $(SOPC_FILE)) + @$(ECHO) Makefile not up to date. + @$(ECHO) $(SOPC_FILE) has been modified since the BSP was generated. + @$(ECHO) + @$(ECHO) Generate the BSP to update the Makefile, and then build again. + @$(ECHO) + @$(ECHO) To generate from Eclipse: + @$(ECHO) " 1. Right-click the BSP project." + @$(ECHO) " 2. In the Nios II Menu, click Generate BSP." + @$(ECHO) + @$(ECHO) To generate from the command line: + @$(ECHO) " nios2-bsp-generate-files --settings= --bsp-dir=" + @$(ECHO) + @exit 1 + +endif # $(MAKECMDGOALS) != clean + +#------------------------------------------------------------------------------ +# PATTERN RULES TO BUILD OBJECTS +#------------------------------------------------------------------------------ +$(OBJ_DIR)/%.o: %.c + @$(ECHO) Compiling $(dev; + + return altera_avalon_jtag_uart_read(&dev->state, buffer, space, + fd->fd_flags); +} + +int +altera_avalon_jtag_uart_write_fd(alt_fd* fd, const char* buffer, int space) +{ + altera_avalon_jtag_uart_dev* dev = (altera_avalon_jtag_uart_dev*) fd->dev; + + return altera_avalon_jtag_uart_write(&dev->state, buffer, space, + fd->fd_flags); +} + +#ifndef ALTERA_AVALON_JTAG_UART_SMALL + +int +altera_avalon_jtag_uart_close_fd(alt_fd* fd) +{ + altera_avalon_jtag_uart_dev* dev = (altera_avalon_jtag_uart_dev*) fd->dev; + + return altera_avalon_jtag_uart_close(&dev->state, fd->fd_flags); +} + +int +altera_avalon_jtag_uart_ioctl_fd(alt_fd* fd, int req, void* arg) +{ + altera_avalon_jtag_uart_dev* dev = (altera_avalon_jtag_uart_dev*) fd->dev; + + return altera_avalon_jtag_uart_ioctl(&dev->state, req, arg); +} + +#endif /* ALTERA_AVALON_JTAG_UART_SMALL */ Index: components/sd_card/firmware/bsp/drivers/src/altera_avalon_jtag_uart_write.c =================================================================== --- components/sd_card/firmware/bsp/drivers/src/altera_avalon_jtag_uart_write.c (nonexistent) +++ components/sd_card/firmware/bsp/drivers/src/altera_avalon_jtag_uart_write.c (revision 8) @@ -0,0 +1,217 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2006 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +******************************************************************************/ + +#include +#include +#include +#include + +#include + +#include "sys/alt_irq.h" +#include "sys/alt_alarm.h" +#include "sys/ioctl.h" +#include "alt_types.h" + +#include "altera_avalon_jtag_uart_regs.h" +#include "altera_avalon_jtag_uart.h" + +#include "sys/alt_log_printf.h" + +#ifdef __ucosii__ +#include "includes.h" +#endif /* __ucosii__ */ + +#ifdef ALTERA_AVALON_JTAG_UART_SMALL + +/* ----------------------------------------------------------- */ +/* ------------------------ SMALL DRIVER --------------------- */ +/* ----------------------------------------------------------- */ + +/* Write routine. The small version blocks when there is no space to write + * into, so it's performance will be very bad if you are writing more than + * one FIFOs worth of data. But you said you didn't want to use interrupts :-) + */ + +int altera_avalon_jtag_uart_write(altera_avalon_jtag_uart_state* sp, + const char * ptr, int count, int flags) +{ + unsigned int base = sp->base; + + const char * end = ptr + count; + + while (ptr < end) + if ((IORD_ALTERA_AVALON_JTAG_UART_CONTROL(base) & ALTERA_AVALON_JTAG_UART_CONTROL_WSPACE_MSK) != 0) + IOWR_ALTERA_AVALON_JTAG_UART_DATA(base, *ptr++); + + return count; +} + +#else /* !ALTERA_AVALON_JTAG_UART_SMALL */ + +/* ----------------------------------------------------------- */ +/* ------------------------- FAST DRIVER --------------------- */ +/* ----------------------------------------------------------- */ + +int +altera_avalon_jtag_uart_write(altera_avalon_jtag_uart_state* sp, + const char * ptr, int count, int flags) +{ + /* Remove warning at optimisation level 03 by seting out to 0 */ + unsigned int in, out=0; + unsigned int n; + alt_irq_context context; + + const char * start = ptr; + + /* + * When running in a multi threaded environment, obtain the "write_lock" + * semaphore. This ensures that writing to the device is thread-safe. + */ + ALT_SEM_PEND (sp->write_lock, 0); + + do + { + /* Copy as much as we can into the transmit buffer */ + while (count > 0) + { + /* We need a stable value of the out pointer to calculate the space available */ + in = sp->tx_in; + out = sp->tx_out; + + if (in < out) + n = out - 1 - in; + else if (out > 0) + n = ALTERA_AVALON_JTAG_UART_BUF_LEN - in; + else + n = ALTERA_AVALON_JTAG_UART_BUF_LEN - 1 - in; + + if (n == 0) + break; + + if (n > count) + n = count; + + memcpy(sp->tx_buf + in, ptr, n); + ptr += n; + count -= n; + + sp->tx_in = (in + n) % ALTERA_AVALON_JTAG_UART_BUF_LEN; + } + + /* + * If interrupts are disabled then we could transmit here, we only need + * to enable interrupts if there is no space left in the FIFO + * + * For now kick the interrupt routine every time to make it transmit + * the data + */ + context = alt_irq_disable_all(); + sp->irq_enable |= ALTERA_AVALON_JTAG_UART_CONTROL_WE_MSK; + IOWR_ALTERA_AVALON_JTAG_UART_CONTROL(sp->base, sp->irq_enable); + alt_irq_enable_all(context); + + /* + * If there is any data left then either return now or block until + * some has been sent + */ + /* consider: test whether there is anything there while doing this and delay for at most 2s. */ + if (count > 0) + { + if (flags & O_NONBLOCK) + break; + +#ifdef __ucosii__ + /* OS Present: Pend on a flag if the OS is running, otherwise spin */ + if(OSRunning == OS_TRUE) { + /* + * When running in a multi-threaded mode, we pend on the write event + * flag set or the timeout flag in the isr. This avoids wasting CPU + * cycles waiting in this thread, when we could be doing something + * more profitable elsewhere. + */ +#ifdef ALTERA_AVALON_JTAG_UART_IGNORE_FIFO_FULL_ERROR + if(!sp->host_inactive) +#endif + ALT_FLAG_PEND (sp->events, + ALT_JTAG_UART_WRITE_RDY | ALT_JTAG_UART_TIMEOUT, + OS_FLAG_WAIT_SET_ANY + OS_FLAG_CONSUME, + 0); + } + else { + /* + * OS not running: Wait for data to be removed from buffer. + * Once the interrupt routine has removed some data then we + * will be able to insert some more. + */ + while (out == sp->tx_out && sp->host_inactive < sp->timeout) + ; + } +#else + /* + * No OS present: Always wait for data to be removed from buffer. Once + * the interrupt routine has removed some data then we will be able to + * insert some more. + */ + while (out == sp->tx_out && sp->host_inactive < sp->timeout) + ; +#endif /* __ucosii__ */ + + if (sp->host_inactive) + break; + } + } + while (count > 0); + + /* + * Now that access to the circular buffer is complete, release the write + * semaphore so that other threads can access the buffer. + */ + ALT_SEM_POST (sp->write_lock); + + if (ptr != start) + return ptr - start; + else if (flags & O_NONBLOCK) + return -EWOULDBLOCK; +#ifdef ALTERA_AVALON_JTAG_UART_IGNORE_FIFO_FULL_ERROR + else if (sp->host_inactive >= sp->timeout) { + /* + * Reset the software FIFO, hardware FIFO could not be reset. + * Just throw away characters without reporting error. + */ + sp->tx_out = sp->tx_in = 0; + return ptr - start + count; + } +#endif + else + return -EIO; /* Host not connected */ +} + +#endif /* ALTERA_AVALON_JTAG_UART_SMALL */ Index: components/sd_card/firmware/bsp/drivers/src/altera_avalon_jtag_uart_ioctl.c =================================================================== --- components/sd_card/firmware/bsp/drivers/src/altera_avalon_jtag_uart_ioctl.c (nonexistent) +++ components/sd_card/firmware/bsp/drivers/src/altera_avalon_jtag_uart_ioctl.c (revision 8) @@ -0,0 +1,86 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2006 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +******************************************************************************/ + +#include +#include +#include +#include + +#include + +#include "sys/ioctl.h" +#include "alt_types.h" + +#include "altera_avalon_jtag_uart_regs.h" +#include "altera_avalon_jtag_uart.h" + +#include "sys/alt_log_printf.h" + +#ifndef ALTERA_AVALON_JTAG_UART_SMALL + +/* ----------------------------------------------------------- */ +/* ------------------------- FAST DRIVER --------------------- */ +/* ----------------------------------------------------------- */ + +int +altera_avalon_jtag_uart_ioctl(altera_avalon_jtag_uart_state* sp, int req, + void* arg) +{ + int rc = -ENOTTY; + + switch (req) + { + case TIOCSTIMEOUT: + /* Set the time to wait until assuming host is not connected */ + if (sp->timeout != INT_MAX) + { + int timeout = *((int *)arg); + sp->timeout = (timeout >= 2 && timeout < INT_MAX) ? timeout : INT_MAX - 1; + rc = 0; + } + break; + + case TIOCGCONNECTED: + /* Find out whether host is connected */ + if (sp->timeout != INT_MAX) + { + *((int *)arg) = (sp->host_inactive < sp->timeout) ? 1 : 0; + rc = 0; + } + break; + + default: + break; + } + + return rc; +} + +#endif /* !ALTERA_AVALON_JTAG_UART_SMALL */ Index: components/sd_card/firmware/bsp/drivers/src/altera_avalon_jtag_uart_read.c =================================================================== --- components/sd_card/firmware/bsp/drivers/src/altera_avalon_jtag_uart_read.c (nonexistent) +++ components/sd_card/firmware/bsp/drivers/src/altera_avalon_jtag_uart_read.c (revision 8) @@ -0,0 +1,205 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2006 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +******************************************************************************/ + +#include +#include +#include +#include + +#include + +#include "sys/alt_irq.h" +#include "sys/alt_alarm.h" +#include "sys/ioctl.h" +#include "alt_types.h" + +#include "altera_avalon_jtag_uart_regs.h" +#include "altera_avalon_jtag_uart.h" + +#include "sys/alt_log_printf.h" + +#ifdef __ucosii__ +#include "includes.h" +#endif /* __ucosii__ */ + +#ifdef ALTERA_AVALON_JTAG_UART_SMALL + +/* ----------------------------------------------------------- */ +/* ----------------------- SMALL DRIVER ---------------------- */ +/* ----------------------------------------------------------- */ + +/* Read routine. The small version blocks until it has at least one byte + * available, it then returns as much as is immediately available without + * waiting any more. It's performance will be very poor without + * interrupts. + */ + +int +altera_avalon_jtag_uart_read(altera_avalon_jtag_uart_state* sp, + char* buffer, int space, int flags) +{ + unsigned int base = sp->base; + + char * ptr = buffer; + char * end = buffer + space; + + while (ptr < end) + { + unsigned int data = IORD_ALTERA_AVALON_JTAG_UART_DATA(base); + + if (data & ALTERA_AVALON_JTAG_UART_DATA_RVALID_MSK) + *ptr++ = (data & ALTERA_AVALON_JTAG_UART_DATA_DATA_MSK) >> ALTERA_AVALON_JTAG_UART_DATA_DATA_OFST; + else if (ptr != buffer) + break; + else if(flags & O_NONBLOCK) + break; + + } + + if (ptr != buffer) + return ptr - buffer; + else if (flags & O_NONBLOCK) + return -EWOULDBLOCK; + else + return -EIO; +} + +#else /* !ALTERA_AVALON_JTAG_UART_SMALL */ + +/* ----------------------------------------------------------- */ +/* ----------------------- FAST DRIVER ----------------------- */ +/* ----------------------------------------------------------- */ + +int +altera_avalon_jtag_uart_read(altera_avalon_jtag_uart_state* sp, + char * buffer, int space, int flags) +{ + char * ptr = buffer; + + alt_irq_context context; + unsigned int n; + + /* + * When running in a multi threaded environment, obtain the "read_lock" + * semaphore. This ensures that reading from the device is thread-safe. + */ + ALT_SEM_PEND (sp->read_lock, 0); + + while (space > 0) + { + unsigned int in, out; + + /* Read as much data as possible */ + do + { + in = sp->rx_in; + out = sp->rx_out; + + if (in >= out) + n = in - out; + else + n = ALTERA_AVALON_JTAG_UART_BUF_LEN - out; + + if (n == 0) + break; /* No more data available */ + + if (n > space) + n = space; + + memcpy(ptr, sp->rx_buf + out, n); + ptr += n; + space -= n; + + sp->rx_out = (out + n) % ALTERA_AVALON_JTAG_UART_BUF_LEN; + } + while (space > 0); + + /* If we read any data then return it */ + if (ptr != buffer) + break; + + /* If in non-blocking mode then return error */ + if (flags & O_NONBLOCK) + break; + +#ifdef __ucosii__ + /* OS Present: Pend on a flag if the OS is running, otherwise spin */ + if(OSRunning == OS_TRUE) { + /* + * When running in a multi-threaded mode, we pend on the read event + * flag set and timeout event flag set in the isr. This avoids wasting CPU + * cycles waiting in this thread, when we could be doing something more + * profitable elsewhere. + */ + ALT_FLAG_PEND (sp->events, + ALT_JTAG_UART_READ_RDY | ALT_JTAG_UART_TIMEOUT, + OS_FLAG_WAIT_SET_ANY + OS_FLAG_CONSUME, + 0); + } + else { + /* Spin until more data arrives or until host disconnects */ + while (in == sp->rx_in && sp->host_inactive < sp->timeout) + ; + } +#else + /* No OS: Always spin */ + while (in == sp->rx_in && sp->host_inactive < sp->timeout) + ; +#endif /* __ucosii__ */ + + if (in == sp->rx_in) + break; + } + + /* + * Now that access to the circular buffer is complete, release the read + * semaphore so that other threads can access the buffer. + */ + + ALT_SEM_POST (sp->read_lock); + + if (ptr != buffer) + { + /* If we read any data then there is space in the buffer so enable interrupts */ + context = alt_irq_disable_all(); + sp->irq_enable |= ALTERA_AVALON_JTAG_UART_CONTROL_RE_MSK; + IOWR_ALTERA_AVALON_JTAG_UART_CONTROL(sp->base, sp->irq_enable); + alt_irq_enable_all(context); + } + + if (ptr != buffer) + return ptr - buffer; + else if (flags & O_NONBLOCK) + return -EWOULDBLOCK; + else + return -EIO; +} + +#endif /* ALTERA_AVALON_JTAG_UART_SMALL */ Index: components/sd_card/firmware/bsp/drivers/src/altera_avalon_jtag_uart_init.c =================================================================== --- components/sd_card/firmware/bsp/drivers/src/altera_avalon_jtag_uart_init.c (nonexistent) +++ components/sd_card/firmware/bsp/drivers/src/altera_avalon_jtag_uart_init.c (revision 8) @@ -0,0 +1,256 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2007 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +******************************************************************************/ + +#include +#include +#include +#include + +#include + +#include "sys/alt_irq.h" +#include "sys/alt_alarm.h" +#include "sys/ioctl.h" +#include "alt_types.h" + +#include "altera_avalon_jtag_uart_regs.h" +#include "altera_avalon_jtag_uart.h" + +#include "sys/alt_log_printf.h" + +#ifndef ALTERA_AVALON_JTAG_UART_SMALL + +/* ----------------------------------------------------------- */ +/* ------------------------- FAST DRIVER --------------------- */ +/* ----------------------------------------------------------- */ +#ifdef ALT_ENHANCED_INTERRUPT_API_PRESENT +static void altera_avalon_jtag_uart_irq(void* context); +#else +static void altera_avalon_jtag_uart_irq(void* context, alt_u32 id); +#endif +static alt_u32 altera_avalon_jtag_uart_timeout(void* context); + +/* + * Driver initialization code. Register interrupts and start a timer + * which we can use to check whether the host is there. + * Return 1 on sucessful IRQ register and 0 on failure. + */ + +void altera_avalon_jtag_uart_init(altera_avalon_jtag_uart_state* sp, + int irq_controller_id, int irq) +{ + ALT_FLAG_CREATE(&sp->events, 0); + ALT_SEM_CREATE(&sp->read_lock, 1); + ALT_SEM_CREATE(&sp->write_lock, 1); + + /* enable read interrupts at the device */ + sp->irq_enable = ALTERA_AVALON_JTAG_UART_CONTROL_RE_MSK; + + IOWR_ALTERA_AVALON_JTAG_UART_CONTROL(sp->base, sp->irq_enable); + + /* register the interrupt handler */ +#ifdef ALT_ENHANCED_INTERRUPT_API_PRESENT + alt_ic_isr_register(irq_controller_id, irq, altera_avalon_jtag_uart_irq, + sp, NULL); +#else + alt_irq_register(irq, sp, altera_avalon_jtag_uart_irq); +#endif + + /* Register an alarm to go off every second to check for presence of host */ + sp->host_inactive = 0; + + if (alt_alarm_start(&sp->alarm, alt_ticks_per_second(), + &altera_avalon_jtag_uart_timeout, sp) < 0) + { + /* If we can't set the alarm then record "don't know if host present" + * and behave as though the host is present. + */ + sp->timeout = INT_MAX; + } + + /* ALT_LOG - see altera_hal/HAL/inc/sys/alt_log_printf.h */ + ALT_LOG_JTAG_UART_ALARM_REGISTER(sp, sp->base); +} + +/* + * Interrupt routine + */ +#ifdef ALT_ENHANCED_INTERRUPT_API_PRESENT +static void altera_avalon_jtag_uart_irq(void* context) +#else +static void altera_avalon_jtag_uart_irq(void* context, alt_u32 id) +#endif +{ + altera_avalon_jtag_uart_state* sp = (altera_avalon_jtag_uart_state*) context; + unsigned int base = sp->base; + + /* ALT_LOG - see altera_hal/HAL/inc/sys/alt_log_printf.h */ + ALT_LOG_JTAG_UART_ISR_FUNCTION(base, sp); + + for ( ; ; ) + { + unsigned int control = IORD_ALTERA_AVALON_JTAG_UART_CONTROL(base); + + /* Return once nothing more to do */ + if ((control & (ALTERA_AVALON_JTAG_UART_CONTROL_RI_MSK | ALTERA_AVALON_JTAG_UART_CONTROL_WI_MSK)) == 0) + break; + + if (control & ALTERA_AVALON_JTAG_UART_CONTROL_RI_MSK) + { + /* process a read irq. Start by assuming that there is data in the + * receive FIFO (otherwise why would we have been interrupted?) + */ + unsigned int data = 1 << ALTERA_AVALON_JTAG_UART_DATA_RAVAIL_OFST; + + for ( ; ; ) + { + /* Check whether there is space in the buffer. If not then we must not + * read any characters from the buffer as they will be lost. + */ + unsigned int next = (sp->rx_in + 1) % ALTERA_AVALON_JTAG_UART_BUF_LEN; + if (next == sp->rx_out) + break; + + /* Try to remove a character from the FIFO and find out whether there + * are any more characters remaining. + */ + data = IORD_ALTERA_AVALON_JTAG_UART_DATA(base); + + if ((data & ALTERA_AVALON_JTAG_UART_DATA_RVALID_MSK) == 0) + break; + + sp->rx_buf[sp->rx_in] = (data & ALTERA_AVALON_JTAG_UART_DATA_DATA_MSK) >> ALTERA_AVALON_JTAG_UART_DATA_DATA_OFST; + sp->rx_in = (sp->rx_in + 1) % ALTERA_AVALON_JTAG_UART_BUF_LEN; + + /* Post an event to notify jtag_uart_read that a character has been read */ + ALT_FLAG_POST (sp->events, ALT_JTAG_UART_READ_RDY, OS_FLAG_SET); + } + + if (data & ALTERA_AVALON_JTAG_UART_DATA_RAVAIL_MSK) + { + /* If there is still data available here then the buffer is full + * so turn off receive interrupts until some space becomes available. + */ + sp->irq_enable &= ~ALTERA_AVALON_JTAG_UART_CONTROL_RE_MSK; + IOWR_ALTERA_AVALON_JTAG_UART_CONTROL(base, sp->irq_enable); + + /* Dummy read to ensure IRQ is cleared prior to ISR completion */ + IORD_ALTERA_AVALON_JTAG_UART_CONTROL(base); + } + } + + if (control & ALTERA_AVALON_JTAG_UART_CONTROL_WI_MSK) + { + /* process a write irq */ + unsigned int space = (control & ALTERA_AVALON_JTAG_UART_CONTROL_WSPACE_MSK) >> ALTERA_AVALON_JTAG_UART_CONTROL_WSPACE_OFST; + + while (space > 0 && sp->tx_out != sp->tx_in) + { + IOWR_ALTERA_AVALON_JTAG_UART_DATA(base, sp->tx_buf[sp->tx_out]); + + sp->tx_out = (sp->tx_out + 1) % ALTERA_AVALON_JTAG_UART_BUF_LEN; + + /* Post an event to notify jtag_uart_write that a character has been written */ + ALT_FLAG_POST (sp->events, ALT_JTAG_UART_WRITE_RDY, OS_FLAG_SET); + + space--; + } + + if (space > 0) + { + /* If we don't have any more data available then turn off the TX interrupt */ + sp->irq_enable &= ~ALTERA_AVALON_JTAG_UART_CONTROL_WE_MSK; + IOWR_ALTERA_AVALON_JTAG_UART_CONTROL(sp->base, sp->irq_enable); + + /* Dummy read to ensure IRQ is cleared prior to ISR completion */ + IORD_ALTERA_AVALON_JTAG_UART_CONTROL(base); + } + } + } +} + +/* + * Timeout routine is called every second + */ + +static alt_u32 +altera_avalon_jtag_uart_timeout(void* context) +{ + altera_avalon_jtag_uart_state* sp = (altera_avalon_jtag_uart_state *) context; + + unsigned int control = IORD_ALTERA_AVALON_JTAG_UART_CONTROL(sp->base); + + if (control & ALTERA_AVALON_JTAG_UART_CONTROL_AC_MSK) + { + IOWR_ALTERA_AVALON_JTAG_UART_CONTROL(sp->base, sp->irq_enable | ALTERA_AVALON_JTAG_UART_CONTROL_AC_MSK); + sp->host_inactive = 0; + } + else if (sp->host_inactive < INT_MAX - 2) { + sp->host_inactive++; + + if (sp->host_inactive >= sp->timeout) { + /* Post an event to indicate host is inactive (for jtag_uart_read */ + ALT_FLAG_POST (sp->events, ALT_JTAG_UART_TIMEOUT, OS_FLAG_SET); + } + } + + return alt_ticks_per_second(); +} + +/* + * The close() routine is implemented to drain the JTAG UART transmit buffer + * when not in "small" mode. This routine will wait for transimt data to be + * emptied unless a timeout from host-activity occurs. If the driver flags + * have been set to non-blocking mode, this routine will exit immediately if + * any data remains. This routine should be called indirectly (i.e. though + * the C library close() routine) so that the file descriptor associated + * with the relevant stream (i.e. stdout) can be closed as well. This routine + * does not manage file descriptors. + * + * The close routine is not implemented for the small driver; instead it will + * map to null. This is because the small driver simply waits while characters + * are transmitted; there is no interrupt-serviced buffer to empty + */ +int altera_avalon_jtag_uart_close(altera_avalon_jtag_uart_state* sp, int flags) +{ + /* + * Wait for all transmit data to be emptied by the JTAG UART ISR, or + * for a host-inactivity timeout, in which case transmit data will be lost + */ + while ( (sp->tx_out != sp->tx_in) && (sp->host_inactive < sp->timeout) ) { + if (flags & O_NONBLOCK) { + return -EWOULDBLOCK; + } + } + + return 0; +} + +#endif /* !ALTERA_AVALON_JTAG_UART_SMALL */ Index: components/sd_card/firmware/bsp/drivers/inc/altera_avalon_jtag_uart_fd.h =================================================================== --- components/sd_card/firmware/bsp/drivers/inc/altera_avalon_jtag_uart_fd.h (nonexistent) +++ components/sd_card/firmware/bsp/drivers/inc/altera_avalon_jtag_uart_fd.h (revision 8) @@ -0,0 +1,125 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2007 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +******************************************************************************/ + +#ifndef __ALT_AVALON_JTAG_UART_FD_H__ +#define __ALT_AVALON_JTAG_UART_FD_H__ + +#include "sys/alt_dev.h" + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +/* + * Externally referenced routines + */ +extern int altera_avalon_jtag_uart_read_fd (alt_fd* fd, char* ptr, int len); +extern int altera_avalon_jtag_uart_write_fd (alt_fd* fd, const char* ptr, + int len); + +/* + * Device structure definition. This is needed by alt_sys_init in order to + * reserve memory for the device instance. + */ + +typedef struct altera_avalon_jtag_uart_dev_s +{ + alt_dev dev; + altera_avalon_jtag_uart_state state; +} altera_avalon_jtag_uart_dev; + +/* + * Macros used by alt_sys_init when the ALT file descriptor facility is used. + */ + +#ifdef ALTERA_AVALON_JTAG_UART_SMALL + +#define ALTERA_AVALON_JTAG_UART_DEV_INSTANCE(name, d) \ + static altera_avalon_jtag_uart_dev d = \ + { \ + { \ + ALT_LLIST_ENTRY, \ + name##_NAME, \ + NULL, /* open */ \ + NULL, /* close */ \ + altera_avalon_jtag_uart_read_fd, \ + altera_avalon_jtag_uart_write_fd, \ + NULL, /* lseek */ \ + NULL, /* fstat */ \ + NULL, /* ioctl */ \ + }, \ + { \ + name##_BASE, \ + } \ + } + +#define ALTERA_AVALON_JTAG_UART_DEV_INIT(name, d) alt_dev_reg (&d.dev) + +#else /* !ALTERA_AVALON_JTAG_UART_SMALL */ + +extern int altera_avalon_jtag_uart_close_fd(alt_fd* fd); +extern int altera_avalon_jtag_uart_ioctl_fd (alt_fd* fd, int req, void* arg); + +#define ALTERA_AVALON_JTAG_UART_DEV_INSTANCE(name, d) \ + static altera_avalon_jtag_uart_dev d = \ + { \ + { \ + ALT_LLIST_ENTRY, \ + name##_NAME, \ + NULL, /* open */ \ + altera_avalon_jtag_uart_close_fd, \ + altera_avalon_jtag_uart_read_fd, \ + altera_avalon_jtag_uart_write_fd, \ + NULL, /* lseek */ \ + NULL, /* fstat */ \ + altera_avalon_jtag_uart_ioctl_fd, \ + }, \ + { \ + name##_BASE, \ + ALTERA_AVALON_JTAG_UART_DEFAULT_TIMEOUT, \ + } \ + } + +#define ALTERA_AVALON_JTAG_UART_DEV_INIT(name, d) \ + { \ + ALTERA_AVALON_JTAG_UART_STATE_INIT(name, d.state); \ + \ + /* make the device available to the system */ \ + alt_dev_reg(&d.dev); \ + } + +#endif /* ALTERA_AVALON_JTAG_UART_SMALL */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __ALT_AVALON_JTAG_UART_FD_H__ */ Index: components/sd_card/firmware/bsp/drivers/inc/altera_avalon_jtag_uart.h =================================================================== --- components/sd_card/firmware/bsp/drivers/inc/altera_avalon_jtag_uart.h (nonexistent) +++ components/sd_card/firmware/bsp/drivers/inc/altera_avalon_jtag_uart.h (revision 8) @@ -0,0 +1,198 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2006 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +******************************************************************************/ + +#ifndef __ALT_AVALON_JTAG_UART_H__ +#define __ALT_AVALON_JTAG_UART_H__ + +#include + +#include "sys/alt_alarm.h" +#include "sys/alt_warning.h" + +#include "os/alt_sem.h" +#include "os/alt_flag.h" + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +/* + * If the user wants all drivers to be small rather than fast then make sure + * this one is marked as needing to be small. + */ +#if defined ALT_USE_SMALL_DRIVERS && !defined ALTERA_AVALON_JTAG_UART_SMALL +#define ALTERA_AVALON_JTAG_UART_SMALL +#endif + +/* + * If the user wants to ignore FIFO full error after timeout + */ +#if defined ALT_JTAG_UART_IGNORE_FIFO_FULL_ERROR && !defined ALTERA_AVALON_JTAG_UART_IGNORE_FIFO_FULL_ERROR +#define ALTERA_AVALON_JTAG_UART_IGNORE_FIFO_FULL_ERROR +#endif + +/* + * Constants that can be overriden. + */ +#ifndef ALTERA_AVALON_JTAG_UART_DEFAULT_TIMEOUT +#define ALTERA_AVALON_JTAG_UART_DEFAULT_TIMEOUT 10 +#endif + +#ifndef ALTERA_AVALON_JTAG_UART_BUF_LEN +#define ALTERA_AVALON_JTAG_UART_BUF_LEN 2048 +#endif + +/* + * ALT_JTAG_UART_READ_RDY and ALT_JTAG_UART_WRITE_RDY are the bitmasks + * that define uC/OS-II event flags that are releated to this device. + * + * ALT_JTAG_UART_READ_RDY indicates that there is read data in the buffer + * ready to be processed. ALT_JTAG_UART_WRITE_RDY indicates that the transmitter is + * ready for more data. + */ +#define ALT_JTAG_UART_READ_RDY 0x1 +#define ALT_JTAG_UART_WRITE_RDY 0x2 +#define ALT_JTAG_UART_TIMEOUT 0x4 + +/* + * State structure definition. Each instance of the driver uses one + * of these structures to hold its associated state. + */ + +typedef struct altera_avalon_jtag_uart_state_s +{ + unsigned int base; + +#ifndef ALTERA_AVALON_JTAG_UART_SMALL + + unsigned int timeout; /* Timeout until host is assumed inactive */ + alt_alarm alarm; + unsigned int irq_enable; + unsigned int host_inactive; + + ALT_SEM (read_lock) + ALT_SEM (write_lock) + ALT_FLAG_GRP (events) + + /* The variables below are volatile because they are modified by the + * interrupt routine. Making them volatile and reading them atomically + * means that we don't need any large critical sections. + */ + volatile unsigned int rx_in; + unsigned int rx_out; + unsigned int tx_in; + volatile unsigned int tx_out; + char rx_buf[ALTERA_AVALON_JTAG_UART_BUF_LEN]; + char tx_buf[ALTERA_AVALON_JTAG_UART_BUF_LEN]; + +#endif /* !ALTERA_AVALON_JTAG_UART_SMALL */ + +} altera_avalon_jtag_uart_state; + +/* + * Macros used by alt_sys_init when the ALT file descriptor facility isn't used. + */ + +#ifdef ALTERA_AVALON_JTAG_UART_SMALL + +#define ALTERA_AVALON_JTAG_UART_STATE_INSTANCE(name, state) \ + altera_avalon_jtag_uart_state state = \ + { \ + name##_BASE, \ + } + +#define ALTERA_AVALON_JTAG_UART_STATE_INIT(name, state) + +#else /* !ALTERA_AVALON_JTAG_UART_SMALL */ + +#define ALTERA_AVALON_JTAG_UART_STATE_INSTANCE(name, state) \ + altera_avalon_jtag_uart_state state = \ + { \ + name##_BASE, \ + ALTERA_AVALON_JTAG_UART_DEFAULT_TIMEOUT, \ + } + +/* + * Externally referenced routines + */ +extern void altera_avalon_jtag_uart_init(altera_avalon_jtag_uart_state* sp, + int irq_controller_id, int irq); + +#define ALTERA_AVALON_JTAG_UART_STATE_INIT(name, state) \ + { \ + if (name##_IRQ == ALT_IRQ_NOT_CONNECTED) \ + { \ + ALT_LINK_ERROR ("Error: Interrupt not connected for " #name ". " \ + "You have selected the interrupt driven version of " \ + "the ALTERA Avalon JTAG UART driver, but the " \ + "interrupt is not connected for this device. You can " \ + "select a polled mode driver by checking the 'small " \ + "driver' option in the HAL configuration window, or " \ + "by using the -DALTERA_AVALON_JTAG_UART_SMALL " \ + "preprocessor flag."); \ + } \ + else \ + altera_avalon_jtag_uart_init(&state, \ + name##_IRQ_INTERRUPT_CONTROLLER_ID, \ + name##_IRQ); \ + } + +#endif /* ALTERA_AVALON_JTAG_UART_SMALL */ + +/* + * Include in case non-direct version of driver required. + */ +#include "altera_avalon_jtag_uart_fd.h" + +/* + * Map alt_sys_init macros to direct or non-direct versions. + */ +#ifdef ALT_USE_DIRECT_DRIVERS + +#define ALTERA_AVALON_JTAG_UART_INSTANCE(name, state) \ + ALTERA_AVALON_JTAG_UART_STATE_INSTANCE(name, state) +#define ALTERA_AVALON_JTAG_UART_INIT(name, state) \ + ALTERA_AVALON_JTAG_UART_STATE_INIT(name, state) + +#else /* !ALT_USE_DIRECT_DRIVERS */ + +#define ALTERA_AVALON_JTAG_UART_INSTANCE(name, dev) \ + ALTERA_AVALON_JTAG_UART_DEV_INSTANCE(name, dev) +#define ALTERA_AVALON_JTAG_UART_INIT(name, dev) \ + ALTERA_AVALON_JTAG_UART_DEV_INIT(name, dev) + +#endif /* ALT_USE_DIRECT_DRIVERS */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __ALT_AVALON_JTAG_UART_H__ */ Index: components/sd_card/firmware/bsp/drivers/inc/altera_avalon_jtag_uart_regs.h =================================================================== --- components/sd_card/firmware/bsp/drivers/inc/altera_avalon_jtag_uart_regs.h (nonexistent) +++ components/sd_card/firmware/bsp/drivers/inc/altera_avalon_jtag_uart_regs.h (revision 8) @@ -0,0 +1,73 @@ +/****************************************************************************** +* * +* License Agreement * +* * +* Copyright (c) 2003 Altera Corporation, San Jose, California, USA. * +* All rights reserved. * +* * +* Permission is hereby granted, free of charge, to any person obtaining a * +* copy of this software and associated documentation files (the "Software"), * +* to deal in the Software without restriction, including without limitation * +* the rights to use, copy, modify, merge, publish, distribute, sublicense, * +* and/or sell copies of the Software, and to permit persons to whom the * +* Software is furnished to do so, subject to the following conditions: * +* * +* The above copyright notice and this permission notice shall be included in * +* all copies or substantial portions of the Software. * +* * +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * +* DEALINGS IN THE SOFTWARE. * +* * +* This agreement shall be governed in all respects by the laws of the State * +* of California and by the laws of the United States of America. * +* * +******************************************************************************/ + +#ifndef __ALTERA_AVALON_JTAG_UART_REGS_H__ +#define __ALTERA_AVALON_JTAG_UART_REGS_H__ + +#include + +#define ALTERA_AVALON_JTAG_UART_DATA_REG 0 +#define IOADDR_ALTERA_AVALON_JTAG_UART_DATA(base) \ + __IO_CALC_ADDRESS_NATIVE(base, ALTERA_AVALON_JTAG_UART_DATA_REG) +#define IORD_ALTERA_AVALON_JTAG_UART_DATA(base) \ + IORD(base, ALTERA_AVALON_JTAG_UART_DATA_REG) +#define IOWR_ALTERA_AVALON_JTAG_UART_DATA(base, data) \ + IOWR(base, ALTERA_AVALON_JTAG_UART_DATA_REG, data) + +#define ALTERA_AVALON_JTAG_UART_DATA_DATA_MSK (0x000000FF) +#define ALTERA_AVALON_JTAG_UART_DATA_DATA_OFST (0) +#define ALTERA_AVALON_JTAG_UART_DATA_RVALID_MSK (0x00008000) +#define ALTERA_AVALON_JTAG_UART_DATA_RVALID_OFST (15) +#define ALTERA_AVALON_JTAG_UART_DATA_RAVAIL_MSK (0xFFFF0000) +#define ALTERA_AVALON_JTAG_UART_DATA_RAVAIL_OFST (16) + + +#define ALTERA_AVALON_JTAG_UART_CONTROL_REG 1 +#define IOADDR_ALTERA_AVALON_JTAG_UART_CONTROL(base) \ + __IO_CALC_ADDRESS_NATIVE(base, ALTERA_AVALON_JTAG_UART_CONTROL_REG) +#define IORD_ALTERA_AVALON_JTAG_UART_CONTROL(base) \ + IORD(base, ALTERA_AVALON_JTAG_UART_CONTROL_REG) +#define IOWR_ALTERA_AVALON_JTAG_UART_CONTROL(base, data) \ + IOWR(base, ALTERA_AVALON_JTAG_UART_CONTROL_REG, data) + +#define ALTERA_AVALON_JTAG_UART_CONTROL_RE_MSK (0x00000001) +#define ALTERA_AVALON_JTAG_UART_CONTROL_RE_OFST (0) +#define ALTERA_AVALON_JTAG_UART_CONTROL_WE_MSK (0x00000002) +#define ALTERA_AVALON_JTAG_UART_CONTROL_WE_OFST (1) +#define ALTERA_AVALON_JTAG_UART_CONTROL_RI_MSK (0x00000100) +#define ALTERA_AVALON_JTAG_UART_CONTROL_RI_OFST (8) +#define ALTERA_AVALON_JTAG_UART_CONTROL_WI_MSK (0x00000200) +#define ALTERA_AVALON_JTAG_UART_CONTROL_WI_OFST (9) +#define ALTERA_AVALON_JTAG_UART_CONTROL_AC_MSK (0x00000400) +#define ALTERA_AVALON_JTAG_UART_CONTROL_AC_OFST (10) +#define ALTERA_AVALON_JTAG_UART_CONTROL_WSPACE_MSK (0xFFFF0000) +#define ALTERA_AVALON_JTAG_UART_CONTROL_WSPACE_OFST (16) + +#endif /* __ALTERA_AVALON_JTAG_UART_REGS_H__ */ Index: components/sd_card/sd.sdc =================================================================== --- components/sd_card/sd.sdc (nonexistent) +++ components/sd_card/sd.sdc (revision 8) @@ -0,0 +1,41 @@ +#************************************************************ +# THIS IS A WIZARD-GENERATED FILE. +# +# Version 14.0.0 Build 200 06/17/2014 SJ Web Edition +# +#************************************************************ + +# Copyright (C) 1991-2014 Altera Corporation. All rights reserved. +# Your use of Altera Corporation's design tools, logic functions +# and other software and tools, and its AMPP partner logic +# functions, and any output files from any of the foregoing +# (including device programming or simulation files), and any +# associated documentation or information are expressly subject +# to the terms and conditions of the Altera Program License +# Subscription Agreement, the Altera Quartus II License Agreement, +# the Altera MegaCore Function License Agreement, or other +# applicable license agreement, including, without limitation, +# that your use is for the sole purpose of programming logic +# devices manufactured by Altera and sold by Altera or its +# authorized distributors. Please refer to the applicable +# agreement for further details. + + + +# Clock constraints + +create_clock -name "CLOCK_50" -period 20.000ns [get_ports {CLOCK_50}] + + +# Automatically constrain PLL and other generated clocks +derive_pll_clocks -create_base_clocks + +# Automatically calculate clock uncertainty to jitter and other effects. +derive_clock_uncertainty + +# tsu/th constraints + +# tco constraints + +# tpd constraints +

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.