summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBert Lange <b.lange@hzdr.de>2015-04-15 13:54:39 +0200
committerBert Lange <b.lange@hzdr.de>2015-04-15 13:54:39 +0200
commit8c5a743259480ebd0cfdbb17fbde8584e34b2aa4 (patch)
tree794887f475d6abb4bdde21c94105f7fcdde1bdd4
parenta1c964908b51599bf624bd2d253419c7e629f195 (diff)
downloadzpu-8c5a743259480ebd0cfdbb17fbde8584e34b2aa4.zip
zpu-8c5a743259480ebd0cfdbb17fbde8584e34b2aa4.tar.gz
clean up
-rw-r--r--Makefile3
-rw-r--r--aufsaetze.vymbin3067 -> 0 bytes
-rw-r--r--hw_altium_livedesign/bsp/altium-livedesign-xc3s1000.ucf397
-rw-r--r--hw_altium_livedesign/bsp/build.sh31
-rw-r--r--hw_altium_livedesign/bsp/top.prj1
-rw-r--r--hw_altium_livedesign/bsp/top.ut29
-rw-r--r--hw_altium_livedesign/bsp/top.vhd122
-rw-r--r--hw_altium_livedesign/bsp/top.xst56
-rw-r--r--hw_godil/bsp/build.sh28
-rw-r--r--hw_godil/bsp/godil_xc3s500e.ucf95
-rw-r--r--hw_godil/bsp/top.prj1
-rw-r--r--hw_godil/bsp/top.ut22
-rw-r--r--hw_godil/bsp/top.vhd42
-rw-r--r--hw_godil/bsp/top.xst56
-rw-r--r--hw_godil/doc/godil500_Ueberblick_leiterplatte.odgbin116255 -> 0 bytes
-rw-r--r--hw_godil/godil_xc3s500e_zpu_zealot_implementation.tar.gzbin5048 -> 0 bytes
-rw-r--r--hw_v5_fx30t_extension/bsp/avnet-eval-xc5vfx30t.ucf470
-rw-r--r--hw_v5_fx30t_extension/bsp/build.sh28
-rw-r--r--hw_v5_fx30t_extension/bsp/top.prj1
-rw-r--r--hw_v5_fx30t_extension/bsp/top.ut39
-rw-r--r--hw_v5_fx30t_extension/bsp/top.vhd189
-rw-r--r--hw_v5_fx30t_extension/bsp/top.xst60
-rw-r--r--hw_v5_fx30t_extension/future_extension/Audio_codec/see_altium_data_sheet.txt0
-rw-r--r--hw_v5_fx30t_extension/future_extension/NanoBoard 3000XN Schematics (Xilinx variant).pdfbin9107601 -> 0 bytes
-rw-r--r--hw_v5_fx30t_extension/future_extension/PS2/pins.txt4
-rw-r--r--hw_v5_fx30t_extension/future_extension/PS2/ps2.pngbin12582 -> 0 bytes
-rw-r--r--hw_v5_fx30t_extension/future_extension/PS2/ps2_connector.pngbin12620 -> 0 bytes
-rw-r--r--hw_v5_fx30t_extension/future_extension/SD_card/pins.txt7
-rw-r--r--hw_v5_fx30t_extension/future_extension/VGA_out/pins.txt8
-rw-r--r--hw_v5_fx30t_extension/future_extension/VGA_out/vga_connector.pngbin20390 -> 0 bytes
-rw-r--r--hw_v5_fx30t_extension/future_extension/VGA_out/vga_out.pngbin36062 -> 0 bytes
-rw-r--r--hw_v5_fx30t_extension/future_extension/VGA_out/video_dac.pngbin78969 -> 0 bytes
-rw-r--r--hw_v5_fx30t_extension/readme.txt18
-rw-r--r--hw_v5_fx30t_extension/rtl/top.vhd144
-rw-r--r--hw_v5_fx30t_extension/simulation/Makefile46
-rw-r--r--hw_v5_fx30t_extension/simulation/run.do65
-rw-r--r--hw_v5_fx30t_extension/simulation/vhdl_files.txt1
-rw-r--r--ieee_proposed/doc/link.txt1
-rw-r--r--ieee_proposed/rtl/env_c.vhd48
-rw-r--r--ieee_proposed/rtl/fixed_float_types_c.vhd34
-rw-r--r--ieee_proposed/rtl/fixed_pkg_c.vhd8390
-rw-r--r--ieee_proposed/rtl/float_pkg_c.vhd7190
-rw-r--r--ieee_proposed/rtl/numeric_std_additions.vhd2886
-rw-r--r--ieee_proposed/rtl/numeric_std_unsigned_c.vhd2207
-rw-r--r--ieee_proposed/rtl/standard_additions_c.vhd2073
-rw-r--r--ieee_proposed/rtl/standard_textio_additions_c.vhd478
-rw-r--r--ieee_proposed/rtl/std_logic_1164_additions.vhd1808
-rw-r--r--ieee_proposed/rtl_tb/fixed_synth.vhd741
-rw-r--r--ieee_proposed/rtl_tb/float_synth.vhd712
-rw-r--r--ieee_proposed/rtl_tb/test_fixed_synth.vhd439
-rw-r--r--ieee_proposed/rtl_tb/test_float_synth.vhd892
-rw-r--r--ieee_proposed/simulation/modelsim.ini3
-rw-r--r--library_dependencies.dot8
-rw-r--r--library_dependencies.pdfbin9999 -> 0 bytes
-rw-r--r--mig_test/readme.txt14
-rw-r--r--mig_test/rtl/Makefile30
-rw-r--r--mig_test/rtl/box.vhd432
-rw-r--r--mig_test/rtl/top.vhd697
-rw-r--r--mig_test/rtl/zpu_config.vhd61
-rw-r--r--mig_test/rtl_tb/top_tb.vhd408
-rw-r--r--mig_test/simulation/Makefile67
-rw-r--r--mig_test/simulation/run.do65
-rw-r--r--mig_test/simulation/wave.do27
-rw-r--r--mig_test/software/Makefile89
-rw-r--r--mig_test/software/ambainfo.c216
-rw-r--r--mig_test/software/ambainfo.h16
-rw-r--r--mig_test/software/include/common.h23
-rw-r--r--mig_test/software/include/lcd-routines.h167
-rw-r--r--mig_test/software/include/peripherie.h323
-rw-r--r--mig_test/software/include/timer.h49
-rw-r--r--mig_test/software/include/types.h43
-rw-r--r--mig_test/software/include/uart.h25
-rw-r--r--mig_test/software/include/vga.h18
-rw-r--r--mig_test/software/lib/crt0.S973
-rw-r--r--mig_test/software/lib/divmod.c50
-rw-r--r--mig_test/software/lib/premain.c26
-rw-r--r--mig_test/software/lib/udivmodsi4.c24
-rw-r--r--mig_test/software/libhal/Makefile31
-rw-r--r--mig_test/software/libhal/common.c203
-rw-r--r--mig_test/software/libhal/hw.c28
-rw-r--r--mig_test/software/libhal/include.mak16
-rw-r--r--mig_test/software/libhal/timer.c132
-rw-r--r--mig_test/software/libhal/uart.c56
-rw-r--r--mig_test/software/libhal/vga.c67
-rw-r--r--mig_test/software/main.c296
-rw-r--r--mig_test/software/monitor.c225
-rw-r--r--mig_test/software/monitor.h67
-rw-r--r--mig_test/software/monitor_functions.c134
-rw-r--r--mig_test/software/monitor_functions.h24
-rw-r--r--mig_test/software/schedule.c144
-rw-r--r--mig_test/software/schedule.h25
-rw-r--r--mig_test/synthesis/Makefile474
-rw-r--r--mig_test/synthesis/top.ucf312
-rw-r--r--mig_test/vhdl_files.txt93
-rw-r--r--rechner/uts/bin/wakeonlan262
-rw-r--r--rechner/uts/startconnection.sh57
-rw-r--r--set_mod_bits.sh56
-rw-r--r--test_rrobin_problem/readme.txt26
-rw-r--r--test_rrobin_problem/rtl/box.vhd229
-rw-r--r--test_rrobin_problem/rtl/led_control_ahb.vhd137
-rw-r--r--test_rrobin_problem/rtl/top.vhd535
-rw-r--r--test_rrobin_problem/rtl_tb/top_tb.vhd465
-rw-r--r--test_rrobin_problem/simulation/Makefile55
-rw-r--r--test_rrobin_problem/simulation/run.do71
-rw-r--r--test_rrobin_problem/simulation/vhdl_files.txt22
-rw-r--r--test_rrobin_problem/simulation/wave.do27
-rw-r--r--test_rrobin_problem/synthesis/Makefile205
-rw-r--r--test_rrobin_problem/synthesis/program_fpga.cmd8
-rw-r--r--test_rrobin_problem/synthesis/program_spi.cmd9
-rw-r--r--test_rrobin_problem/synthesis/sp601.ucf372
-rw-r--r--test_rrobin_problem/synthesis/top.ut30
-rw-r--r--test_rrobin_problem/synthesis/top.xst53
-rw-r--r--tobuy.txt14
-rw-r--r--tomake.txt48
-rw-r--r--tool_makefile/Makefile.synthesis.digilent_s3e203
-rw-r--r--tool_makefile/Makefile.synthesis.sp601204
-rw-r--r--tool_makefile/Makefile.synthesis.sp605204
-rw-r--r--treemap/Makefile67
-rw-r--r--treemap/convert.xsl110
-rw-r--r--uc_arm/checkliste.txt63
-rw-r--r--uc_str912/erase_flash/Makefile10
-rw-r--r--uc_str912/erase_flash/erase.S3
-rw-r--r--uc_str912/erase_flash/erase_jlink.gdb7
-rw-r--r--uc_str912/openocd/amontec.sh3
-rw-r--r--uc_str912/openocd/openocd_amontec.cfg26
-rw-r--r--uc_str912/openocd/openocd_segger.cfg6
-rw-r--r--uc_str912/openocd/segger.sh2
-rw-r--r--uc_str912/openocd/str912.cfg131
-rw-r--r--uc_str912/prj_TEST_LED/Makefile496
-rw-r--r--uc_str912/prj_TEST_LED/STR91x-RAM.ld218
-rw-r--r--uc_str912/prj_TEST_LED/STR91x-ROM.ld221
-rw-r--r--uc_str912/prj_TEST_LED/include/91x_ahbapb.h60
-rw-r--r--uc_str912/prj_TEST_LED/include/91x_conf.h115
-rw-r--r--uc_str912/prj_TEST_LED/include/91x_fmi.h184
-rw-r--r--uc_str912/prj_TEST_LED/include/91x_gpio.h93
-rw-r--r--uc_str912/prj_TEST_LED/include/91x_lib.h114
-rw-r--r--uc_str912/prj_TEST_LED/include/91x_map.h878
-rw-r--r--uc_str912/prj_TEST_LED/include/91x_scu.h196
-rw-r--r--uc_str912/prj_TEST_LED/include/91x_type.h50
-rw-r--r--uc_str912/prj_TEST_LED/led.c122
-rw-r--r--uc_str912/prj_TEST_LED/load_segger.gdb20
-rw-r--r--uc_str912/prj_TEST_LED/startup.s233
-rw-r--r--uc_str912/prj_TEST_LED/str91x_lib/91x_ahbapb.c177
-rw-r--r--uc_str912/prj_TEST_LED/str91x_lib/91x_fmi.c519
-rw-r--r--uc_str912/prj_TEST_LED/str91x_lib/91x_gpio.c407
-rw-r--r--uc_str912/prj_TEST_LED/str91x_lib/91x_lib.c281
-rw-r--r--uc_str912/prj_TEST_LED/str91x_lib/91x_scu.c661
-rw-r--r--uc_str912/prj_TEST_LED/vector.s202
-rw-r--r--uc_str912/prj_TEST_LED/vectors.c462
-rw-r--r--uc_str912/prj_TEST_LED/vectors.h67
-rw-r--r--uc_str912/prj_blinky_complex_startup/91x_conf.h118
-rw-r--r--uc_str912/prj_blinky_complex_startup/Makefile463
-rw-r--r--uc_str912/prj_blinky_complex_startup/defines.h67
-rw-r--r--uc_str912/prj_blinky_complex_startup/include/91x_adc.h124
-rw-r--r--uc_str912/prj_blinky_complex_startup/include/91x_ahbapb.h60
-rw-r--r--uc_str912/prj_blinky_complex_startup/include/91x_can.h165
-rw-r--r--uc_str912/prj_blinky_complex_startup/include/91x_dma.h247
-rw-r--r--uc_str912/prj_blinky_complex_startup/include/91x_emi.h83
-rw-r--r--uc_str912/prj_blinky_complex_startup/include/91x_fmi.h184
-rw-r--r--uc_str912/prj_blinky_complex_startup/include/91x_gpio.h93
-rw-r--r--uc_str912/prj_blinky_complex_startup/include/91x_i2c.h112
-rw-r--r--uc_str912/prj_blinky_complex_startup/include/91x_it.h73
-rw-r--r--uc_str912/prj_blinky_complex_startup/include/91x_lib.h114
-rw-r--r--uc_str912/prj_blinky_complex_startup/include/91x_map.h878
-rw-r--r--uc_str912/prj_blinky_complex_startup/include/91x_mc.h144
-rw-r--r--uc_str912/prj_blinky_complex_startup/include/91x_rtc.h109
-rw-r--r--uc_str912/prj_blinky_complex_startup/include/91x_scu.h196
-rw-r--r--uc_str912/prj_blinky_complex_startup/include/91x_ssp.h119
-rw-r--r--uc_str912/prj_blinky_complex_startup/include/91x_tim.h155
-rw-r--r--uc_str912/prj_blinky_complex_startup/include/91x_type.h50
-rw-r--r--uc_str912/prj_blinky_complex_startup/include/91x_uart.h174
-rw-r--r--uc_str912/prj_blinky_complex_startup/include/91x_vic.h94
-rw-r--r--uc_str912/prj_blinky_complex_startup/include/91x_wdg.h82
-rw-r--r--uc_str912/prj_blinky_complex_startup/include/91x_wiu.h99
-rw-r--r--uc_str912/prj_blinky_complex_startup/include/usb_core.h145
-rw-r--r--uc_str912/prj_blinky_complex_startup/include/usb_def.h68
-rw-r--r--uc_str912/prj_blinky_complex_startup/include/usb_init.h45
-rw-r--r--uc_str912/prj_blinky_complex_startup/include/usb_lib.h25
-rw-r--r--uc_str912/prj_blinky_complex_startup/include/usb_mem.h23
-rw-r--r--uc_str912/prj_blinky_complex_startup/include/usb_regs.h442
-rw-r--r--uc_str912/prj_blinky_complex_startup/include/usb_type.h31
-rw-r--r--uc_str912/prj_blinky_complex_startup/interrupt.c295
-rw-r--r--uc_str912/prj_blinky_complex_startup/inthandler.S94
-rw-r--r--uc_str912/prj_blinky_complex_startup/load_segger.gdb23
-rw-r--r--uc_str912/prj_blinky_complex_startup/main.c173
-rw-r--r--uc_str912/prj_blinky_complex_startup/main.h55
-rw-r--r--uc_str912/prj_blinky_complex_startup/src/91x_adc.c590
-rw-r--r--uc_str912/prj_blinky_complex_startup/src/91x_ahbapb.c177
-rw-r--r--uc_str912/prj_blinky_complex_startup/src/91x_can.c769
-rw-r--r--uc_str912/prj_blinky_complex_startup/src/91x_dma.c1125
-rw-r--r--uc_str912/prj_blinky_complex_startup/src/91x_emi.c167
-rw-r--r--uc_str912/prj_blinky_complex_startup/src/91x_fmi.c519
-rw-r--r--uc_str912/prj_blinky_complex_startup/src/91x_gpio.c407
-rw-r--r--uc_str912/prj_blinky_complex_startup/src/91x_i2c.c616
-rw-r--r--uc_str912/prj_blinky_complex_startup/src/91x_lib.c281
-rw-r--r--uc_str912/prj_blinky_complex_startup/src/91x_mc.c932
-rw-r--r--uc_str912/prj_blinky_complex_startup/src/91x_rtc.c400
-rw-r--r--uc_str912/prj_blinky_complex_startup/src/91x_scu.c661
-rw-r--r--uc_str912/prj_blinky_complex_startup/src/91x_ssp.c469
-rw-r--r--uc_str912/prj_blinky_complex_startup/src/91x_tim.c694
-rw-r--r--uc_str912/prj_blinky_complex_startup/src/91x_uart.c658
-rw-r--r--uc_str912/prj_blinky_complex_startup/src/91x_vic.c830
-rw-r--r--uc_str912/prj_blinky_complex_startup/src/91x_wdg.c277
-rw-r--r--uc_str912/prj_blinky_complex_startup/src/91x_wiu.c190
-rw-r--r--uc_str912/prj_blinky_complex_startup/src/usb_core.c860
-rw-r--r--uc_str912/prj_blinky_complex_startup/src/usb_init.c64
-rw-r--r--uc_str912/prj_blinky_complex_startup/src/usb_int.c95
-rw-r--r--uc_str912/prj_blinky_complex_startup/src/usb_mem.c85
-rw-r--r--uc_str912/prj_blinky_complex_startup/src/usb_regs.c1000
-rw-r--r--uc_str912/prj_blinky_complex_startup/startup912.S405
-rw-r--r--uc_str912/prj_blinky_complex_startup/startup912.S_old361
-rw-r--r--uc_str912/prj_blinky_complex_startup/startup_generic.S162
-rw-r--r--uc_str912/prj_blinky_complex_startup/syscalls.c180
-rw-r--r--uc_str912/prj_blinky_simple_startup/Makefile495
-rw-r--r--uc_str912/prj_blinky_simple_startup/STR91x-RAM.ld218
-rw-r--r--uc_str912/prj_blinky_simple_startup/STR91x-ROM.ld221
-rw-r--r--uc_str912/prj_blinky_simple_startup/include/vectors.h67
-rw-r--r--uc_str912/prj_blinky_simple_startup/load_segger.gdb20
-rw-r--r--uc_str912/prj_blinky_simple_startup/src/main.c102
-rw-r--r--uc_str912/prj_blinky_simple_startup/src/startup.s233
-rw-r--r--uc_str912/prj_blinky_simple_startup/src/vector.s202
-rw-r--r--uc_str912/prj_blinky_simple_startup/src/vectors.c462
-rw-r--r--uc_str912/prj_blinky_simple_startup/str91x_lib/Makefile38
-rw-r--r--uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_adc.h124
-rw-r--r--uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_ahbapb.h60
-rw-r--r--uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_can.h165
-rw-r--r--uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_conf.h117
-rw-r--r--uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_dma.h247
-rw-r--r--uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_emi.h83
-rw-r--r--uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_fmi.h184
-rw-r--r--uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_gpio.h93
-rw-r--r--uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_i2c.h112
-rw-r--r--uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_it.h73
-rw-r--r--uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_lib.h113
-rw-r--r--uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_map.h878
-rw-r--r--uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_mc.h144
-rw-r--r--uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_rtc.h109
-rw-r--r--uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_scu.h198
-rw-r--r--uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_ssp.h119
-rw-r--r--uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_tim.h155
-rw-r--r--uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_type.h50
-rw-r--r--uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_uart.h174
-rw-r--r--uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_vic.h94
-rw-r--r--uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_wdg.h82
-rw-r--r--uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_wiu.h99
-rw-r--r--uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_adc.c590
-rw-r--r--uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_ahbapb.c177
-rw-r--r--uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_can.c768
-rw-r--r--uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_dma.c1125
-rw-r--r--uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_emi.c167
-rw-r--r--uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_fmi.c519
-rw-r--r--uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_gpio.c407
-rw-r--r--uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_i2c.c616
-rw-r--r--uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_lib.c281
-rw-r--r--uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_mc.c932
-rw-r--r--uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_rtc.c400
-rw-r--r--uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_scu.c661
-rw-r--r--uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_ssp.c469
-rw-r--r--uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_tim.c694
-rw-r--r--uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_uart.c658
-rw-r--r--uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_vic.c830
-rw-r--r--uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_wdg.c277
-rw-r--r--uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_wiu.c190
-rw-r--r--uc_str912/prj_main_add/Makefile146
-rw-r--r--uc_str912/prj_main_add/dram.bat1
-rw-r--r--uc_str912/prj_main_add/inc/typedefs.h50
-rw-r--r--uc_str912/prj_main_add/prj/eclipse_ram.gdb24
-rw-r--r--uc_str912/prj_main_add/prj/eclipse_rom.gdb24
-rw-r--r--uc_str912/prj_main_add/prj/jtagkey.cfg59
-rw-r--r--uc_str912/prj_main_add/prj/str912_program.script2
-rw-r--r--uc_str912/prj_main_add/prj/str912_ram.gdb22
-rw-r--r--uc_str912/prj_main_add/prj/str912_ram.ld218
-rw-r--r--uc_str912/prj_main_add/prj/str912_reset.script2
-rw-r--r--uc_str912/prj_main_add/prj/str912_rom.gdb22
-rw-r--r--uc_str912/prj_main_add/prj/str912_rom.ld249
-rw-r--r--uc_str912/prj_main_add/segger.gdb17
-rw-r--r--uc_str912/prj_main_add/src/main.c91
-rw-r--r--uc_str912/prj_main_add/src/startup.s222
-rw-r--r--uc_str912/prj_template91x/Makefile495
-rw-r--r--uc_str912/prj_template91x/STR91x-RAM.ld218
-rw-r--r--uc_str912/prj_template91x/STR91x-ROM.ld221
-rw-r--r--uc_str912/prj_template91x/include/vectors.h67
-rw-r--r--uc_str912/prj_template91x/load_segger.gdb23
-rw-r--r--uc_str912/prj_template91x/src/main.c43
-rw-r--r--uc_str912/prj_template91x/src/startup.S233
-rw-r--r--uc_str912/prj_template91x/src/vector.S202
-rw-r--r--uc_str912/prj_template91x/src/vectors.c462
-rw-r--r--uc_str912/prj_template91x/str91x_lib/Makefile38
-rw-r--r--uc_str912/prj_template91x/str91x_lib/include/91x_adc.h124
-rw-r--r--uc_str912/prj_template91x/str91x_lib/include/91x_ahbapb.h60
-rw-r--r--uc_str912/prj_template91x/str91x_lib/include/91x_can.h165
-rw-r--r--uc_str912/prj_template91x/str91x_lib/include/91x_conf.h117
-rw-r--r--uc_str912/prj_template91x/str91x_lib/include/91x_dma.h247
-rw-r--r--uc_str912/prj_template91x/str91x_lib/include/91x_emi.h83
-rw-r--r--uc_str912/prj_template91x/str91x_lib/include/91x_fmi.h184
-rw-r--r--uc_str912/prj_template91x/str91x_lib/include/91x_gpio.h93
-rw-r--r--uc_str912/prj_template91x/str91x_lib/include/91x_i2c.h112
-rw-r--r--uc_str912/prj_template91x/str91x_lib/include/91x_it.h73
-rw-r--r--uc_str912/prj_template91x/str91x_lib/include/91x_lib.h113
-rw-r--r--uc_str912/prj_template91x/str91x_lib/include/91x_map.h878
-rw-r--r--uc_str912/prj_template91x/str91x_lib/include/91x_mc.h144
-rw-r--r--uc_str912/prj_template91x/str91x_lib/include/91x_rtc.h109
-rw-r--r--uc_str912/prj_template91x/str91x_lib/include/91x_scu.h198
-rw-r--r--uc_str912/prj_template91x/str91x_lib/include/91x_ssp.h119
-rw-r--r--uc_str912/prj_template91x/str91x_lib/include/91x_tim.h155
-rw-r--r--uc_str912/prj_template91x/str91x_lib/include/91x_type.h50
-rw-r--r--uc_str912/prj_template91x/str91x_lib/include/91x_uart.h174
-rw-r--r--uc_str912/prj_template91x/str91x_lib/include/91x_vic.h94
-rw-r--r--uc_str912/prj_template91x/str91x_lib/include/91x_wdg.h82
-rw-r--r--uc_str912/prj_template91x/str91x_lib/include/91x_wiu.h99
-rw-r--r--uc_str912/prj_template91x/str91x_lib/src/91x_adc.c590
-rw-r--r--uc_str912/prj_template91x/str91x_lib/src/91x_ahbapb.c177
-rw-r--r--uc_str912/prj_template91x/str91x_lib/src/91x_can.c768
-rw-r--r--uc_str912/prj_template91x/str91x_lib/src/91x_dma.c1125
-rw-r--r--uc_str912/prj_template91x/str91x_lib/src/91x_emi.c167
-rw-r--r--uc_str912/prj_template91x/str91x_lib/src/91x_fmi.c519
-rw-r--r--uc_str912/prj_template91x/str91x_lib/src/91x_gpio.c407
-rw-r--r--uc_str912/prj_template91x/str91x_lib/src/91x_i2c.c616
-rw-r--r--uc_str912/prj_template91x/str91x_lib/src/91x_lib.c281
-rw-r--r--uc_str912/prj_template91x/str91x_lib/src/91x_mc.c932
-rw-r--r--uc_str912/prj_template91x/str91x_lib/src/91x_rtc.c400
-rw-r--r--uc_str912/prj_template91x/str91x_lib/src/91x_scu.c661
-rw-r--r--uc_str912/prj_template91x/str91x_lib/src/91x_ssp.c469
-rw-r--r--uc_str912/prj_template91x/str91x_lib/src/91x_tim.c694
-rw-r--r--uc_str912/prj_template91x/str91x_lib/src/91x_uart.c658
-rw-r--r--uc_str912/prj_template91x/str91x_lib/src/91x_vic.c830
-rw-r--r--uc_str912/prj_template91x/str91x_lib/src/91x_wdg.c277
-rw-r--r--uc_str912/prj_template91x/str91x_lib/src/91x_wiu.c190
-rw-r--r--uc_str912/prj_test_lcd/Makefile496
-rw-r--r--uc_str912/prj_test_lcd/STR91x-ROM.ld221
-rw-r--r--uc_str912/prj_test_lcd/include/91x_ahbapb.h60
-rw-r--r--uc_str912/prj_test_lcd/include/91x_conf.h115
-rw-r--r--uc_str912/prj_test_lcd/include/91x_fmi.h184
-rw-r--r--uc_str912/prj_test_lcd/include/91x_gpio.h93
-rw-r--r--uc_str912/prj_test_lcd/include/91x_lib.h114
-rw-r--r--uc_str912/prj_test_lcd/include/91x_map.h878
-rw-r--r--uc_str912/prj_test_lcd/include/91x_scu.h196
-rw-r--r--uc_str912/prj_test_lcd/include/91x_type.h50
-rw-r--r--uc_str912/prj_test_lcd/include/char_code.h79
-rw-r--r--uc_str912/prj_test_lcd/include/lcd_lib_91x.h63
-rw-r--r--uc_str912/prj_test_lcd/include/vectors.h67
-rw-r--r--uc_str912/prj_test_lcd/load_amontec.gdb15
-rw-r--r--uc_str912/prj_test_lcd/load_segger.gdb20
-rw-r--r--uc_str912/prj_test_lcd/src/lcd.c93
-rw-r--r--uc_str912/prj_test_lcd/src/lcd_lib_91x.c455
-rw-r--r--uc_str912/prj_test_lcd/src/startup.s233
-rw-r--r--uc_str912/prj_test_lcd/src/vector.s202
-rw-r--r--uc_str912/prj_test_lcd/src/vectors.c462
-rw-r--r--uc_str912/prj_test_lcd/str91x_lib/91x_ahbapb.c177
-rw-r--r--uc_str912/prj_test_lcd/str91x_lib/91x_fmi.c519
-rw-r--r--uc_str912/prj_test_lcd/str91x_lib/91x_gpio.c407
-rw-r--r--uc_str912/prj_test_lcd/str91x_lib/91x_lib.c281
-rw-r--r--uc_str912/prj_test_lcd/str91x_lib/91x_scu.c661
-rw-r--r--uc_str912/scripts/flash_str9.ld137
-rw-r--r--uc_str912/scripts/load.gdb24
-rw-r--r--uc_str912/scripts/load_amontec.gdb20
-rw-r--r--uc_str912/scripts/load_segger.gdb18
-rw-r--r--uc_str912/scripts/str912_rom.ld249
-rw-r--r--uc_str912/scripts/str912fw44.ld61
-rw-r--r--uc_str912/scripts/str91x-configs/str91x_flash.gdb6
-rw-r--r--uc_str912/scripts/str91x-configs/str91x_flasherase.ocd6
-rw-r--r--uc_str912/scripts/str91x-configs/str91x_flashprobe.gdb10
-rw-r--r--uc_str912/scripts/str91x-configs/str91x_flashprogram.ocd7
-rw-r--r--uc_str912/scripts/str91x-configs/str91x_jtagkey-flash-erase.cfg43
-rw-r--r--uc_str912/scripts/str91x-configs/str91x_jtagkey-flash-program.cfg43
-rw-r--r--uc_str912/scripts/str91x-configs/str91x_jtagkey.cfg42
-rw-r--r--uc_str912/scripts/str91x-configs/str91x_ram.gdb6
-rw-r--r--uc_str912/scripts/test.gdb42
-rw-r--r--uc_str912/segger.gdb17
-rw-r--r--vhdl_arithmetik/VHDL_arithmetic.csv77
-rw-r--r--vhdl_arithmetik/VHDL_arithmetic.odsbin17476 -> 0 bytes
-rw-r--r--vhdl_arithmetik/VHDL_arithmetic.pdfbin80547 -> 0 bytes
-rw-r--r--vhdl_arithmetik/VHDL_arithmetic.xlsbin86528 -> 0 bytes
-rw-r--r--vhdl_arithmetik/VHDL_arithmetic.xlsxbin39198 -> 0 bytes
374 files changed, 0 insertions, 102561 deletions
diff --git a/Makefile b/Makefile
deleted file mode 100644
index 37e8083..0000000
--- a/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-library_dependencies.pdf: library_dependencies.dot
- dot -Tpdf $< > $@
-
diff --git a/aufsaetze.vym b/aufsaetze.vym
deleted file mode 100644
index d1f75cb..0000000
--- a/aufsaetze.vym
+++ /dev/null
Binary files differ
diff --git a/hw_altium_livedesign/bsp/altium-livedesign-xc3s1000.ucf b/hw_altium_livedesign/bsp/altium-livedesign-xc3s1000.ucf
deleted file mode 100644
index e01e492..0000000
--- a/hw_altium_livedesign/bsp/altium-livedesign-xc3s1000.ucf
+++ /dev/null
@@ -1,397 +0,0 @@
-############################################################
-# Altium Livedesign Evaluation Board constraints file
-#
-# Familiy: Spartan-3
-# Device: XC3S1000
-# Package: FG456C
-# Speed: -4
-#
-# all banks are powered with 3.3V
-#
-# config pins (M2, M1, M0): 101
-
-############################################################
-## clock/timing constraints
-############################################################
-
-NET "clk" period = 50 MHz ;
-
-
-############################################################
-## pin placement constraints
-############################################################
-
-NET "clk" LOC = AA12 | IOSTANDARD = LVCMOS33 | TNM_NET = "clk";
-NET "reset_n" LOC = Y17 | IOSTANDARD = LVCMOS33; # low active
-
-# Soft JTAG
-NET "soft_tdo" LOC = D22 | IOSTANDARD = LVCMOS33;
-NET "soft_tms" LOC = E21 | IOSTANDARD = LVCMOS33;
-NET "soft_tdi" LOC = E22 | IOSTANDARD = LVCMOS33;
-NET "soft_tck" LOC = F21 | IOSTANDARD = LVCMOS33;
-
-# SRAM 0
-NET "sram0_a<0>" LOC = L6 | IOSTANDARD = LVCMOS33;
-NET "sram0_a<1>" LOC = K4 | IOSTANDARD = LVCMOS33;
-NET "sram0_a<2>" LOC = H5 | IOSTANDARD = LVCMOS33;
-NET "sram0_a<3>" LOC = G6 | IOSTANDARD = LVCMOS33;
-NET "sram0_a<4>" LOC = F3 | IOSTANDARD = LVCMOS33;
-NET "sram0_a<5>" LOC = G1 | IOSTANDARD = LVCMOS33;
-NET "sram0_a<6>" LOC = G2 | IOSTANDARD = LVCMOS33;
-NET "sram0_a<7>" LOC = K3 | IOSTANDARD = LVCMOS33;
-NET "sram0_a<8>" LOC = T2 | IOSTANDARD = LVCMOS33;
-NET "sram0_a<9>" LOC = T1 | IOSTANDARD = LVCMOS33;
-NET "sram0_a<10>" LOC = U2 | IOSTANDARD = LVCMOS33;
-NET "sram0_a<11>" LOC = V3 | IOSTANDARD = LVCMOS33;
-NET "sram0_a<12>" LOC = V1 | IOSTANDARD = LVCMOS33;
-NET "sram0_a<13>" LOC = W1 | IOSTANDARD = LVCMOS33;
-NET "sram0_a<14>" LOC = V2 | IOSTANDARD = LVCMOS33;
-NET "sram0_a<15>" LOC = V5 | IOSTANDARD = LVCMOS33;
-NET "sram0_a<16>" LOC = V4 | IOSTANDARD = LVCMOS33;
-NET "sram0_a<17>" LOC = U5 | IOSTANDARD = LVCMOS33;
-NET "sram0_a<18>" LOC = U6 | IOSTANDARD = LVCMOS33; # n.c.
-NET "sram0_d<0>" LOC = L4 | IOSTANDARD = LVCMOS33;
-NET "sram0_d<1>" LOC = L3 | IOSTANDARD = LVCMOS33;
-NET "sram0_d<2>" LOC = M5 | IOSTANDARD = LVCMOS33;
-NET "sram0_d<3>" LOC = M4 | IOSTANDARD = LVCMOS33;
-NET "sram0_d<4>" LOC = M3 | IOSTANDARD = LVCMOS33;
-NET "sram0_d<5>" LOC = N4 | IOSTANDARD = LVCMOS33;
-NET "sram0_d<6>" LOC = N3 | IOSTANDARD = LVCMOS33;
-NET "sram0_d<7>" LOC = T5 | IOSTANDARD = LVCMOS33;
-NET "sram0_d<8>" LOC = T4 | IOSTANDARD = LVCMOS33;
-NET "sram0_d<9>" LOC = T6 | IOSTANDARD = LVCMOS33;
-NET "sram0_d<10>" LOC = M6 | IOSTANDARD = LVCMOS33;
-NET "sram0_d<11>" LOC = N2 | IOSTANDARD = LVCMOS33;
-NET "sram0_d<12>" LOC = N1 | IOSTANDARD = LVCMOS33;
-NET "sram0_d<13>" LOC = M2 | IOSTANDARD = LVCMOS33;
-NET "sram0_d<14>" LOC = M1 | IOSTANDARD = LVCMOS33;
-NET "sram0_d<15>" LOC = L2 | IOSTANDARD = LVCMOS33;
-NET "sram0_cs_n" LOC = L5 | IOSTANDARD = LVCMOS33;
-NET "sram0_lb_n" LOC = L1 | IOSTANDARD = LVCMOS33;
-NET "sram0_ub_n" LOC = K2 | IOSTANDARD = LVCMOS33;
-NET "sram0_we_n" LOC = U4 | IOSTANDARD = LVCMOS33;
-NET "sram0_oe_n" LOC = K1 | IOSTANDARD = LVCMOS33;
-
-# SRAM 1
-NET "sram1_a<0>" LOC = K21 | IOSTANDARD = LVCMOS33;
-NET "sram1_a<1>" LOC = K22 | IOSTANDARD = LVCMOS33;
-NET "sram1_a<2>" LOC = K20 | IOSTANDARD = LVCMOS33;
-NET "sram1_a<3>" LOC = G21 | IOSTANDARD = LVCMOS33;
-NET "sram1_a<4>" LOC = G22 | IOSTANDARD = LVCMOS33;
-NET "sram1_a<5>" LOC = M17 | IOSTANDARD = LVCMOS33;
-NET "sram1_a<6>" LOC = L18 | IOSTANDARD = LVCMOS33;
-NET "sram1_a<7>" LOC = K19 | IOSTANDARD = LVCMOS33;
-NET "sram1_a<8>" LOC = V19 | IOSTANDARD = LVCMOS33;
-NET "sram1_a<9>" LOC = W20 | IOSTANDARD = LVCMOS33;
-NET "sram1_a<10>" LOC = W19 | IOSTANDARD = LVCMOS33;
-NET "sram1_a<11>" LOC = Y20 | IOSTANDARD = LVCMOS33;
-NET "sram1_a<12>" LOC = Y21 | IOSTANDARD = LVCMOS33;
-NET "sram1_a<13>" LOC = Y22 | IOSTANDARD = LVCMOS33;
-NET "sram1_a<14>" LOC = W21 | IOSTANDARD = LVCMOS33;
-NET "sram1_a<15>" LOC = W22 | IOSTANDARD = LVCMOS33;
-NET "sram1_a<16>" LOC = V21 | IOSTANDARD = LVCMOS33;
-NET "sram1_a<17>" LOC = V22 | IOSTANDARD = LVCMOS33;
-NET "sram1_a<18>" LOC = V20 | IOSTANDARD = LVCMOS33; # n.c.
-NET "sram1_d<0>" LOC = L21 | IOSTANDARD = LVCMOS33;
-NET "sram1_d<1>" LOC = M22 | IOSTANDARD = LVCMOS33;
-NET "sram1_d<2>" LOC = M21 | IOSTANDARD = LVCMOS33;
-NET "sram1_d<3>" LOC = N22 | IOSTANDARD = LVCMOS33;
-NET "sram1_d<4>" LOC = N21 | IOSTANDARD = LVCMOS33;
-NET "sram1_d<5>" LOC = U20 | IOSTANDARD = LVCMOS33;
-NET "sram1_d<6>" LOC = T22 | IOSTANDARD = LVCMOS33;
-NET "sram1_d<7>" LOC = T21 | IOSTANDARD = LVCMOS33;
-NET "sram1_d<8>" LOC = V18 | IOSTANDARD = LVCMOS33;
-NET "sram1_d<9>" LOC = U19 | IOSTANDARD = LVCMOS33;
-NET "sram1_d<10>" LOC = U18 | IOSTANDARD = LVCMOS33;
-NET "sram1_d<11>" LOC = T18 | IOSTANDARD = LVCMOS33;
-NET "sram1_d<12>" LOC = R18 | IOSTANDARD = LVCMOS33;
-NET "sram1_d<13>" LOC = T17 | IOSTANDARD = LVCMOS33;
-NET "sram1_d<14>" LOC = M18 | IOSTANDARD = LVCMOS33;
-NET "sram1_d<15>" LOC = M20 | IOSTANDARD = LVCMOS33;
-NET "sram1_cs_n" LOC = L22 | IOSTANDARD = LVCMOS33;
-NET "sram1_lb_n" LOC = M19 | IOSTANDARD = LVCMOS33;
-NET "sram1_ub_n" LOC = L20 | IOSTANDARD = LVCMOS33;
-NET "sram1_we_n" LOC = U21 | IOSTANDARD = LVCMOS33;
-NET "sram1_oe_n" LOC = L19 | IOSTANDARD = LVCMOS33;
-
-# RS232
-NET "rs232_rx" LOC = A5 | IOSTANDARD = LVCMOS33;
-NET "rs232_tx" LOC = F7 | IOSTANDARD = LVCMOS33;
-NET "rs232_cts" LOC = F2 | IOSTANDARD = LVCMOS33;
-NET "rs232_rts" LOC = E1 | IOSTANDARD = LVCMOS33;
-
-# 2x PS2 connectors
-NET "mouse_clk" LOC = L17 | IOSTANDARD = LVCMOS33;
-NET "mouse_data" LOC = G18 | IOSTANDARD = LVCMOS33;
-NET "kbd_clk" LOC = F20 | IOSTANDARD = LVCMOS33;
-NET "kbd_data" LOC = G19 | IOSTANDARD = LVCMOS33;
-
-
-# VGA output (2**9 = 512 colors)
-NET "vga_blue<7>" LOC = E14 | IOSTANDARD = LVCMOS33;
-NET "vga_blue<6>" LOC = A13 | IOSTANDARD = LVCMOS33;
-NET "vga_blue<5>" LOC = C13 | IOSTANDARD = LVCMOS33;
-NET "vga_green<7>" LOC = E11 | IOSTANDARD = LVCMOS33;
-NET "vga_green<6>" LOC = C11 | IOSTANDARD = LVCMOS33;
-NET "vga_green<5>" LOC = D10 | IOSTANDARD = LVCMOS33;
-NET "vga_red<7>" LOC = D6 | IOSTANDARD = LVCMOS33;
-NET "vga_red<6>" LOC = D7 | IOSTANDARD = LVCMOS33;
-NET "vga_red<5>" LOC = D9 | IOSTANDARD = LVCMOS33;
-NET "vga_hsync" LOC = A8 | IOSTANDARD = LVCMOS33;
-NET "vga_vsync" LOC = B14 | IOSTANDARD = LVCMOS33;
-
-
-# Stereo Audio out
-NET "audio_r" LOC = U3 | IOSTANDARD = LVCMOS33;
-NET "audio_l" LOC = W3 | IOSTANDARD = LVCMOS33;
-
-
-# GPIO DIP switches 7..0 left..right, low active
-NET "switch_n<0>" LOC = Y6 | IOSTANDARD = LVCMOS33;
-NET "switch_n<1>" LOC = V6 | IOSTANDARD = LVCMOS33;
-NET "switch_n<2>" LOC = U7 | IOSTANDARD = LVCMOS33;
-NET "switch_n<3>" LOC = AA4 | IOSTANDARD = LVCMOS33;
-NET "switch_n<4>" LOC = AB4 | IOSTANDARD = LVCMOS33;
-NET "switch_n<5>" LOC = AA5 | IOSTANDARD = LVCMOS33;
-NET "switch_n<6>" LOC = AB5 | IOSTANDARD = LVCMOS33;
-NET "switch_n<7>" LOC = AA6 | IOSTANDARD = LVCMOS33;
-
-# GPIO push buttons, low active
-NET "button_n<5>" LOC = C21 | IOSTANDARD = LVCMOS33;
-NET "button_n<4>" LOC = B20 | IOSTANDARD = LVCMOS33;
-NET "button_n<3>" LOC = A15 | IOSTANDARD = LVCMOS33;
-NET "button_n<2>" LOC = B6 | IOSTANDARD = LVCMOS33;
-NET "button_n<1>" LOC = C1 | IOSTANDARD = LVCMOS33;
-NET "button_n<0>" LOC = D1 | IOSTANDARD = LVCMOS33;
-
-# GPIO LEDs
-NET "led<7>" LOC = W6 | IOSTANDARD = LVCMOS33;
-NET "led<6>" LOC = Y5 | IOSTANDARD = LVCMOS33;
-NET "led<5>" LOC = W5 | IOSTANDARD = LVCMOS33;
-NET "led<4>" LOC = W4 | IOSTANDARD = LVCMOS33;
-NET "led<3>" LOC = Y3 | IOSTANDARD = LVCMOS33;
-NET "led<2>" LOC = Y2 | IOSTANDARD = LVCMOS33;
-NET "led<1>" LOC = Y1 | IOSTANDARD = LVCMOS33;
-NET "led<0>" LOC = W2 | IOSTANDARD = LVCMOS33;
-
-# seven segment display (5=left 0=right)
-#
-# segment assignment:
-# .ABCDEFG
-# 76543210
-NET "dig0_seg<7>" LOC = E20 | IOSTANDARD = LVCMOS33;
-NET "dig0_seg<6>" LOC = C22 | IOSTANDARD = LVCMOS33;
-NET "dig0_seg<5>" LOC = E18 | IOSTANDARD = LVCMOS33;
-NET "dig0_seg<4>" LOC = D20 | IOSTANDARD = LVCMOS33;
-NET "dig0_seg<3>" LOC = D21 | IOSTANDARD = LVCMOS33;
-NET "dig0_seg<2>" LOC = E19 | IOSTANDARD = LVCMOS33;
-NET "dig0_seg<1>" LOC = G17 | IOSTANDARD = LVCMOS33;
-NET "dig0_seg<0>" LOC = F19 | IOSTANDARD = LVCMOS33;
-
-NET "dig1_seg<7>" LOC = F17 | IOSTANDARD = LVCMOS33;
-NET "dig1_seg<6>" LOC = D18 | IOSTANDARD = LVCMOS33;
-NET "dig1_seg<5>" LOC = B19 | IOSTANDARD = LVCMOS33;
-NET "dig1_seg<4>" LOC = C18 | IOSTANDARD = LVCMOS33;
-NET "dig1_seg<3>" LOC = C19 | IOSTANDARD = LVCMOS33;
-NET "dig1_seg<2>" LOC = C20 | IOSTANDARD = LVCMOS33;
-NET "dig1_seg<1>" LOC = F18 | IOSTANDARD = LVCMOS33;
-NET "dig1_seg<0>" LOC = D19 | IOSTANDARD = LVCMOS33;
-
-NET "dig2_seg<7>" LOC = A19 | IOSTANDARD = LVCMOS33;
-NET "dig2_seg<6>" LOC = E17 | IOSTANDARD = LVCMOS33;
-NET "dig2_seg<5>" LOC = C17 | IOSTANDARD = LVCMOS33;
-NET "dig2_seg<4>" LOC = D17 | IOSTANDARD = LVCMOS33;
-NET "dig2_seg<3>" LOC = B15 | IOSTANDARD = LVCMOS33;
-NET "dig2_seg<2>" LOC = A18 | IOSTANDARD = LVCMOS33;
-NET "dig2_seg<1>" LOC = B18 | IOSTANDARD = LVCMOS33;
-NET "dig2_seg<0>" LOC = B17 | IOSTANDARD = LVCMOS33;
-
-NET "dig3_seg<7>" LOC = D15 | IOSTANDARD = LVCMOS33;
-NET "dig3_seg<6>" LOC = E13 | IOSTANDARD = LVCMOS33;
-NET "dig3_seg<5>" LOC = B13 | IOSTANDARD = LVCMOS33;
-NET "dig3_seg<4>" LOC = D13 | IOSTANDARD = LVCMOS33;
-NET "dig3_seg<3>" LOC = D14 | IOSTANDARD = LVCMOS33;
-NET "dig3_seg<2>" LOC = A14 | IOSTANDARD = LVCMOS33;
-NET "dig3_seg<1>" LOC = E16 | IOSTANDARD = LVCMOS33;
-NET "dig3_seg<0>" LOC = E15 | IOSTANDARD = LVCMOS33;
-
-NET "dig4_seg<7>" LOC = D11 | IOSTANDARD = LVCMOS33;
-NET "dig4_seg<6>" LOC = E9 | IOSTANDARD = LVCMOS33;
-NET "dig4_seg<5>" LOC = A10 | IOSTANDARD = LVCMOS33;
-NET "dig4_seg<4>" LOC = B9 | IOSTANDARD = LVCMOS33;
-NET "dig4_seg<3>" LOC = A9 | IOSTANDARD = LVCMOS33;
-NET "dig4_seg<2>" LOC = C10 | IOSTANDARD = LVCMOS33;
-NET "dig4_seg<1>" LOC = A12 | IOSTANDARD = LVCMOS33;
-NET "dig4_seg<0>" LOC = B10 | IOSTANDARD = LVCMOS33;
-
-NET "dig5_seg<7>" LOC = C7 | IOSTANDARD = LVCMOS33;
-NET "dig5_seg<6>" LOC = A4 | IOSTANDARD = LVCMOS33;
-NET "dig5_seg<5>" LOC = B5 | IOSTANDARD = LVCMOS33;
-NET "dig5_seg<4>" LOC = E6 | IOSTANDARD = LVCMOS33;
-NET "dig5_seg<3>" LOC = C5 | IOSTANDARD = LVCMOS33;
-NET "dig5_seg<2>" LOC = E7 | IOSTANDARD = LVCMOS33;
-NET "dig5_seg<1>" LOC = B8 | IOSTANDARD = LVCMOS33;
-NET "dig5_seg<0>" LOC = C6 | IOSTANDARD = LVCMOS33;
-
-
-# Header A (left)
-NET "header_a<2>" LOC = V7 | IOSTANDARD = LVCMOS33;
-NET "header_a<3>" LOC = AA8 | IOSTANDARD = LVCMOS33;
-NET "header_a<4>" LOC = AB8 | IOSTANDARD = LVCMOS33;
-NET "header_a<5>" LOC = V8 | IOSTANDARD = LVCMOS33;
-NET "header_a<6>" LOC = Y10 | IOSTANDARD = LVCMOS33;
-NET "header_a<7>" LOC = V9 | IOSTANDARD = LVCMOS33;
-NET "header_a<8>" LOC = W9 | IOSTANDARD = LVCMOS33;
-NET "header_a<9>" LOC = AA10 | IOSTANDARD = LVCMOS33;
-NET "header_a<10>" LOC = AB10 | IOSTANDARD = LVCMOS33;
-NET "header_a<11>" LOC = W10 | IOSTANDARD = LVCMOS33;
-NET "header_a<12>" LOC = AB11 | IOSTANDARD = LVCMOS33;
-NET "header_a<13>" LOC = U11 | IOSTANDARD = LVCMOS33;
-NET "header_a<14>" LOC = AB13 | IOSTANDARD = LVCMOS33;
-NET "header_a<15>" LOC = AA13 | IOSTANDARD = LVCMOS33;
-NET "header_a<16>" LOC = V10 | IOSTANDARD = LVCMOS33;
-NET "header_a<17>" LOC = U10 | IOSTANDARD = LVCMOS33;
-NET "header_a<18>" LOC = W13 | IOSTANDARD = LVCMOS33;
-NET "header_a<19>" LOC = Y13 | IOSTANDARD = LVCMOS33;
-
-# Header B (right)
-NET "header_b<2>" LOC = V14 | IOSTANDARD = LVCMOS33;
-NET "header_b<3>" LOC = V13 | IOSTANDARD = LVCMOS33;
-NET "header_b<4>" LOC = AA15 | IOSTANDARD = LVCMOS33;
-NET "header_b<5>" LOC = W14 | IOSTANDARD = LVCMOS33;
-NET "header_b<6>" LOC = AB15 | IOSTANDARD = LVCMOS33;
-NET "header_b<7>" LOC = Y16 | IOSTANDARD = LVCMOS33;
-NET "header_b<8>" LOC = AA17 | IOSTANDARD = LVCMOS33;
-NET "header_b<9>" LOC = AA18 | IOSTANDARD = LVCMOS33;
-NET "header_b<10>" LOC = AB18 | IOSTANDARD = LVCMOS33;
-NET "header_b<11>" LOC = Y18 | IOSTANDARD = LVCMOS33;
-NET "header_b<12>" LOC = Y19 | IOSTANDARD = LVCMOS33;
-NET "header_b<13>" LOC = AB20 | IOSTANDARD = LVCMOS33;
-NET "header_b<14>" LOC = AA20 | IOSTANDARD = LVCMOS33;
-NET "header_b<15>" LOC = U16 | IOSTANDARD = LVCMOS33;
-NET "header_b<16>" LOC = V16 | IOSTANDARD = LVCMOS33;
-NET "header_b<17>" LOC = V17 | IOSTANDARD = LVCMOS33;
-NET "header_b<18>" LOC = W16 | IOSTANDARD = LVCMOS33;
-NET "header_b<19>" LOC = W17 | IOSTANDARD = LVCMOS33;
-
-# usused pins
-CONFIG PROHIBIT = A3;
-CONFIG PROHIBIT = A7;
-CONFIG PROHIBIT = A11;
-CONFIG PROHIBIT = A16;
-CONFIG PROHIBIT = AA3;
-CONFIG PROHIBIT = AA7;
-CONFIG PROHIBIT = AA9;
-CONFIG PROHIBIT = AA11;
-CONFIG PROHIBIT = AA14;
-CONFIG PROHIBIT = AA16;
-CONFIG PROHIBIT = AA19;
-CONFIG PROHIBIT = AB7;
-CONFIG PROHIBIT = AB9;
-CONFIG PROHIBIT = AB12;
-CONFIG PROHIBIT = AB14;
-CONFIG PROHIBIT = AB16;
-CONFIG PROHIBIT = AB19;
-CONFIG PROHIBIT = B4;
-CONFIG PROHIBIT = B7;
-CONFIG PROHIBIT = B12;
-CONFIG PROHIBIT = B11;
-CONFIG PROHIBIT = B16;
-CONFIG PROHIBIT = C2;
-CONFIG PROHIBIT = C3;
-CONFIG PROHIBIT = C4;
-CONFIG PROHIBIT = C12;
-CONFIG PROHIBIT = C16;
-CONFIG PROHIBIT = D2;
-CONFIG PROHIBIT = D3;
-CONFIG PROHIBIT = D4;
-CONFIG PROHIBIT = D5;
-CONFIG PROHIBIT = D8;
-CONFIG PROHIBIT = D12;
-CONFIG PROHIBIT = D16;
-CONFIG PROHIBIT = E2;
-CONFIG PROHIBIT = E3;
-CONFIG PROHIBIT = E8;
-CONFIG PROHIBIT = E4;
-CONFIG PROHIBIT = E5;
-CONFIG PROHIBIT = F4;
-CONFIG PROHIBIT = E10;
-CONFIG PROHIBIT = E12;
-CONFIG PROHIBIT = F12;
-CONFIG PROHIBIT = F5;
-CONFIG PROHIBIT = F13;
-CONFIG PROHIBIT = F6;
-CONFIG PROHIBIT = F9;
-CONFIG PROHIBIT = F10;
-CONFIG PROHIBIT = F16;
-CONFIG PROHIBIT = F11;
-CONFIG PROHIBIT = F14;
-CONFIG PROHIBIT = G3;
-CONFIG PROHIBIT = G4;
-CONFIG PROHIBIT = G5;
-CONFIG PROHIBIT = G20;
-CONFIG PROHIBIT = H1;
-CONFIG PROHIBIT = H2;
-CONFIG PROHIBIT = H4;
-CONFIG PROHIBIT = H18;
-CONFIG PROHIBIT = H19;
-CONFIG PROHIBIT = H21;
-CONFIG PROHIBIT = H22;
-CONFIG PROHIBIT = J1;
-CONFIG PROHIBIT = J2;
-CONFIG PROHIBIT = J4;
-CONFIG PROHIBIT = J5;
-CONFIG PROHIBIT = J6;
-CONFIG PROHIBIT = J17;
-CONFIG PROHIBIT = J18;
-CONFIG PROHIBIT = J19;
-CONFIG PROHIBIT = J21;
-CONFIG PROHIBIT = J22;
-CONFIG PROHIBIT = K5;
-CONFIG PROHIBIT = K6;
-CONFIG PROHIBIT = K17;
-CONFIG PROHIBIT = K18;
-CONFIG PROHIBIT = N5;
-CONFIG PROHIBIT = N6;
-CONFIG PROHIBIT = N17;
-CONFIG PROHIBIT = N18;
-CONFIG PROHIBIT = N19;
-CONFIG PROHIBIT = N20;
-CONFIG PROHIBIT = P1;
-CONFIG PROHIBIT = P2;
-CONFIG PROHIBIT = P4;
-CONFIG PROHIBIT = P5;
-CONFIG PROHIBIT = P6;
-CONFIG PROHIBIT = P17;
-CONFIG PROHIBIT = P18;
-CONFIG PROHIBIT = P19;
-CONFIG PROHIBIT = P21;
-CONFIG PROHIBIT = P22;
-CONFIG PROHIBIT = R1;
-CONFIG PROHIBIT = R2;
-CONFIG PROHIBIT = R4;
-CONFIG PROHIBIT = R5;
-CONFIG PROHIBIT = R19;
-CONFIG PROHIBIT = R21;
-CONFIG PROHIBIT = R22;
-CONFIG PROHIBIT = T3;
-CONFIG PROHIBIT = T19;
-CONFIG PROHIBIT = T20;
-CONFIG PROHIBIT = U9;
-CONFIG PROHIBIT = U12;
-CONFIG PROHIBIT = U13;
-CONFIG PROHIBIT = U14;
-CONFIG PROHIBIT = U17;
-CONFIG PROHIBIT = V11;
-CONFIG PROHIBIT = V12;
-CONFIG PROHIBIT = V15;
-CONFIG PROHIBIT = W7;
-CONFIG PROHIBIT = W8;
-CONFIG PROHIBIT = W11;
-CONFIG PROHIBIT = W12;
-CONFIG PROHIBIT = W15;
-CONFIG PROHIBIT = W18;
-CONFIG PROHIBIT = Y4;
-CONFIG PROHIBIT = Y7;
-CONFIG PROHIBIT = Y11;
-CONFIG PROHIBIT = Y12;
diff --git a/hw_altium_livedesign/bsp/build.sh b/hw_altium_livedesign/bsp/build.sh
deleted file mode 100644
index 9a3f4ee..0000000
--- a/hw_altium_livedesign/bsp/build.sh
+++ /dev/null
@@ -1,31 +0,0 @@
-# need project files:
-# top.xst
-# top.prj
-# top.ut
-
-# need Xilinx tools:
-# xst
-# ngdbuild
-# map
-# par
-# trce
-# bitgen
-
-echo "########################"
-echo "generate build directory"
-mkdir build
-cd build
-mkdir tmp
-
-echo "###############"
-echo "start processes"
-xst -ifn "../top.xst" -ofn "top.syr"
-ngdbuild -dd _ngo -nt timestamp -uc ../altium-livedesign-xc3s1000.ucf -p xc3s1000-fg456-4 top.ngc top.ngd
-map -p xc3s1000-fg456-4 -cm area -ir off -pr off -c 100 -o top_map.ncd top.ngd top.pcf
-par -w -ol high -t 1 top_map.ncd top.ncd top.pcf
-trce -v 3 -s 4 -n 3 -fastpaths -xml top.twx top.ncd -o top.twr top.pcf
-bitgen -f ../top.ut top.ncd
-
-echo "###########"
-echo "get bitfile"
-cp top.bit ..
diff --git a/hw_altium_livedesign/bsp/top.prj b/hw_altium_livedesign/bsp/top.prj
deleted file mode 100644
index 3975c05..0000000
--- a/hw_altium_livedesign/bsp/top.prj
+++ /dev/null
@@ -1 +0,0 @@
-vhdl work "../top.vhd"
diff --git a/hw_altium_livedesign/bsp/top.ut b/hw_altium_livedesign/bsp/top.ut
deleted file mode 100644
index 765a6f3..0000000
--- a/hw_altium_livedesign/bsp/top.ut
+++ /dev/null
@@ -1,29 +0,0 @@
--w
--g DebugBitstream:No
--g Binary:no
--g CRC:Enable
--g ConfigRate:6
--g CclkPin:PullUp
--g M0Pin:PullUp
--g M1Pin:PullUp
--g M2Pin:PullUp
--g ProgPin:PullUp
--g DonePin:PullUp
--g HswapenPin:PullUp
--g TckPin:PullUp
--g TdiPin:PullUp
--g TdoPin:PullUp
--g TmsPin:PullUp
--g UnusedPin:PullDown
--g UserID:0xFFFFFFFF
--g DCMShutdown:Disable
--g DCIUpdateMode:AsRequired
--g StartUpClk:CClk
--g DONE_cycle:4
--g GTS_cycle:5
--g GWE_cycle:6
--g LCK_cycle:NoWait
--g Match_cycle:Auto
--g Security:None
--g DonePipe:No
--g DriveDone:No
diff --git a/hw_altium_livedesign/bsp/top.vhd b/hw_altium_livedesign/bsp/top.vhd
deleted file mode 100644
index 5d5125b..0000000
--- a/hw_altium_livedesign/bsp/top.vhd
+++ /dev/null
@@ -1,122 +0,0 @@
-library ieee;
-use ieee.std_logic_1164.all;
-
-
-entity top is
- port (
- clk : in std_logic;
- reset_n : in std_logic;
- --
- -- soft JTAG
- soft_tdo : out std_logic;
- soft_tms : in std_logic;
- soft_tdi : in std_logic;
- soft_tck : in std_logic;
- --
- -- SRAM 0 (256k x 16) pin connections
- sram0_a : out std_logic_vector(18 downto 0);
- sram0_d : inout std_logic_vector(15 downto 0);
- sram0_lb_n : out std_logic;
- sram0_ub_n : out std_logic;
- sram0_cs_n : out std_logic; -- chip select
- sram0_we_n : out std_logic; -- write-enable
- sram0_oe_n : out std_logic; -- output enable
- --
- -- SRAM 1 (256k x 16) pin connections
- sram1_a : out std_logic_vector(18 downto 0);
- sram1_d : inout std_logic_vector(15 downto 0);
- sram1_lb_n : out std_logic;
- sram1_ub_n : out std_logic;
- sram1_cs_n : out std_logic; -- chip select
- sram1_we_n : out std_logic; -- write-enable
- sram1_oe_n : out std_logic; -- output enable
- --
- -- RS232
- rs232_rx : in std_logic;
- rs232_tx : out std_logic;
- rs232_cts : in std_logic;
- rs232_rts : out std_logic;
- --
- -- PS2 connectors
- mouse_clk : inout std_logic;
- mouse_data : inout std_logic;
- kbd_clk : inout std_logic;
- kbd_data : inout std_logic;
- --
- -- vga output
- vga_red : out std_logic_vector(7 downto 5);
- vga_green : out std_logic_vector(7 downto 5);
- vga_blue : out std_logic_vector(7 downto 5);
- vga_hsync : out std_logic;
- vga_vsync : out std_logic;
- --
- -- Audio out
- audio_r : out std_logic;
- audio_l : out std_logic;
- --
- -- GPIOs
- switch_n : in std_logic_vector(7 downto 0);
- button_n : in std_logic_vector(5 downto 0);
- led : out std_logic_vector(7 downto 0);
- --
- -- seven segment display
- dig0_seg : out std_logic_vector(7 downto 0);
- dig1_seg : out std_logic_vector(7 downto 0);
- dig2_seg : out std_logic_vector(7 downto 0);
- dig3_seg : out std_logic_vector(7 downto 0);
- dig4_seg : out std_logic_vector(7 downto 0);
- dig5_seg : out std_logic_vector(7 downto 0);
- --
- -- User Header A
- header_a : inout std_logic_vector(19 downto 2);
- header_b : inout std_logic_vector(19 downto 2)
- );
-end entity top;
-
-architecture rtl of top is
-
-
-begin
-
- -- default output drivers
- -- to pass bitgen DRC
- soft_tdo <= '1';
- --
- sram0_a <= (others => '1');
- sram0_lb_n <= '1';
- sram0_ub_n <= '1';
- sram0_cs_n <= '1';
- sram0_we_n <= '1';
- sram0_oe_n <= '1';
- --
- sram1_a <= (others => '1');
- sram1_lb_n <= '1';
- sram1_ub_n <= '1';
- sram1_cs_n <= '1';
- sram1_we_n <= '1';
- sram1_oe_n <= '1';
- --
- rs232_tx <= '1';
- rs232_rts <= '1';
- --
- vga_red <= (others => '1');
- vga_green <= (others => '1');
- vga_blue <= (others => '1');
- vga_hsync <= '1';
- vga_vsync <= '1';
- --
- audio_r <= '0';
- audio_l <= '0';
- --
- led <= (others => '0');
- --
- dig0_seg <= (others => '0');
- dig1_seg <= (others => '0');
- dig2_seg <= (others => '0');
- dig3_seg <= (others => '0');
- dig4_seg <= (others => '0');
- dig5_seg <= (others => '0');
-
-
-end architecture rtl;
-
diff --git a/hw_altium_livedesign/bsp/top.xst b/hw_altium_livedesign/bsp/top.xst
deleted file mode 100644
index 4a39af8..0000000
--- a/hw_altium_livedesign/bsp/top.xst
+++ /dev/null
@@ -1,56 +0,0 @@
-set -tmpdir "tmp"
-set -xsthdpdir "xst"
-run
--ifn ../top.prj
--ifmt mixed
--ofn top
--ofmt NGC
--p xc3s1000-4-fg456
--top top
--opt_mode Speed
--opt_level 1
--iuc NO
--keep_hierarchy No
--netlist_hierarchy As_Optimized
--rtlview Yes
--glob_opt AllClockNets
--read_cores YES
--write_timing_constraints NO
--cross_clock_analysis NO
--hierarchy_separator /
--bus_delimiter <>
--case Maintain
--slice_utilization_ratio 100
--bram_utilization_ratio 100
--verilog2001 YES
--fsm_extract YES -fsm_encoding Auto
--safe_implementation No
--fsm_style LUT
--ram_extract Yes
--ram_style Auto
--rom_extract Yes
--mux_style Auto
--decoder_extract YES
--priority_extract Yes
--shreg_extract YES
--shift_extract YES
--xor_collapse YES
--rom_style Auto
--auto_bram_packing NO
--mux_extract Yes
--resource_sharing YES
--async_to_sync NO
--mult_style Auto
--iobuf YES
--max_fanout 500
--bufg 8
--register_duplication YES
--register_balancing No
--slice_packing YES
--optimize_primitives NO
--use_clock_enable Yes
--use_sync_set Yes
--use_sync_reset Yes
--iob Auto
--equivalent_register_removal YES
--slice_utilization_ratio_maxmargin 5
diff --git a/hw_godil/bsp/build.sh b/hw_godil/bsp/build.sh
deleted file mode 100644
index 3ec68a0..0000000
--- a/hw_godil/bsp/build.sh
+++ /dev/null
@@ -1,28 +0,0 @@
-# need project files:
-# top.xst
-# top.prj
-# top.ut
-
-# need Xilinx tools:
-# xst
-# ngdbuild
-# map
-# par
-# trce
-# bitgen
-
-# generate build directory
-mkdir build
-cd build
-mkdir tmp
-
-# start processes
-xst -ifn "../top.xst" -ofn "top.syr"
-ngdbuild -dd _ngo -nt timestamp -uc ../godil_xc3s500e.ucf -p xc3s500e-vq100-4 top.ngc top.ngd
-map -p xc3s500e-vq100-4 -cm area -ir off -pr off -c 100 -o top_map.ncd top.ngd top.pcf
-par -w -ol high -t 1 top_map.ncd top.ncd top.pcf
-trce -v 3 -s 4 -n 3 -fastpaths -xml top.twx top.ncd -o top.twr top.pcf
-bitgen -f ../top.ut top.ncd
-
-# get bitfile
-cp top.bit ..
diff --git a/hw_godil/bsp/godil_xc3s500e.ucf b/hw_godil/bsp/godil_xc3s500e.ucf
deleted file mode 100644
index 3b36614..0000000
--- a/hw_godil/bsp/godil_xc3s500e.ucf
+++ /dev/null
@@ -1,95 +0,0 @@
-############################################################
-# GODIL Board Constraints File
-#
-# Family: Spartan3E
-# Device: XC3S500E
-# Package: VQ100
-# Speed: -4
-#
-# all "pin"-IOs are equipped with level shifters
-
-
-############################################################
-## clock/timing constraints
-############################################################
-
-NET "m49" PERIOD = 50 MHz ;
-
-
-############################################################
-## pin placement constraints
-############################################################
-
-# inputs only
-NET "m49" LOC=P89 | IOSTANDARD = LVCMOS33 ;
-NET "sw1" LOC=P39 | IOSTANDARD = LVCMOS33 ;
-NET "sw2" LOC=P69 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "c13" LOC=P38 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "d13" LOC=P88 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "sout" LOC=P13 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "rts" LOC=P30 | IOSTANDARD = LVCMOS33 | PULLUP ;
-
-# I/O's for uart & spi flash
-NET "sin" LOC=P43 | IOSTANDARD = LVCMOS33 ;
-NET "cts" LOC=P25 | IOSTANDARD = LVCMOS33 ;
-NET "cso" LOC=P24 | IOSTANDARD = LVCMOS33 ;
-NET "vs2" LOC=P47 | IOSTANDARD = LVCMOS33 ;
-
-# I/O's for test connector
-NET "tvs1" LOC=P48 | IOSTANDARD = LVCMOS33 | DRIVE=16 ;
-NET "tvs0" LOC=P49 | IOSTANDARD = LVCMOS33 | DRIVE=16 ;
-NET "tmosi" LOC=P27 | IOSTANDARD = LVCMOS33 | DRIVE=16 ;
-NET "tdin" LOC=P44 | IOSTANDARD = LVCMOS33 | DRIVE=16 ;
-NET "tcclk" LOC=P50 | IOSTANDARD = LVCMOS33 | DRIVE=16 ;
-NET "tm1" LOC=P42 | IOSTANDARD = LVCMOS33 | DRIVE=16 ;
-NET "thsw" LOC=P99 | IOSTANDARD = LVCMOS33 | DRIVE=16 ;
-
-# I/O's for DIL / main connector
-NET "pin<1>" LOC=P26 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<2>" LOC=P15 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<3>" LOC=P16 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<4>" LOC=P95 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<5>" LOC=P18 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<6>" LOC=P17 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<7>" LOC=P94 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<8>" LOC=P22 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<9>" LOC=P23 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<10>" LOC=P33 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<11>" LOC=P32 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<12>" LOC=P34 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<13>" LOC=P40 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<14>" LOC=P41 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<15>" LOC=P36 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<16>" LOC=P35 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<17>" LOC=P53 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<18>" LOC=P54 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<19>" LOC=P57 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<20>" LOC=P58 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<21>" LOC=P60 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<22>" LOC=P61 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<23>" LOC=P62 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<24>" LOC=P63 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<25>" LOC=P65 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<26>" LOC=P66 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<27>" LOC=P67 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<28>" LOC=P68 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<29>" LOC=P70 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<30>" LOC=P71 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<31>" LOC=P86 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<32>" LOC=P84 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<33>" LOC=P83 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<34>" LOC=P78 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<35>" LOC=P79 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<36>" LOC=P85 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<37>" LOC=P92 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<38>" LOC=P98 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<39>" LOC=P3 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<40>" LOC=P2 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<41>" LOC=P4 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<42>" LOC=P5 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<43>" LOC=P90 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<44>" LOC=P9 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<45>" LOC=P10 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<46>" LOC=P11 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<47>" LOC=P12 | IOSTANDARD = LVCMOS33 | PULLUP ;
-NET "pin<48>" LOC=P91 | IOSTANDARD = LVCMOS33 | PULLUP ;
diff --git a/hw_godil/bsp/top.prj b/hw_godil/bsp/top.prj
deleted file mode 100644
index 3975c05..0000000
--- a/hw_godil/bsp/top.prj
+++ /dev/null
@@ -1 +0,0 @@
-vhdl work "../top.vhd"
diff --git a/hw_godil/bsp/top.ut b/hw_godil/bsp/top.ut
deleted file mode 100644
index 06de8d5..0000000
--- a/hw_godil/bsp/top.ut
+++ /dev/null
@@ -1,22 +0,0 @@
--w
--g DebugBitstream:No
--g Binary:no
--g CRC:Enable
--g ConfigRate:1
--g ProgPin:PullUp
--g DonePin:PullUp
--g TckPin:PullUp
--g TdiPin:PullUp
--g TdoPin:PullUp
--g TmsPin:PullUp
--g UnusedPin:PullDown
--g UserID:0xFFFFFFFF
--g DCMShutdown:Disable
--g StartUpClk:CClk
--g DONE_cycle:4
--g GTS_cycle:5
--g GWE_cycle:6
--g LCK_cycle:NoWait
--g Security:None
--g DonePipe:No
--g DriveDone:No
diff --git a/hw_godil/bsp/top.vhd b/hw_godil/bsp/top.vhd
deleted file mode 100644
index bd11e08..0000000
--- a/hw_godil/bsp/top.vhd
+++ /dev/null
@@ -1,42 +0,0 @@
--- top module of
--- GODIL
-
-
-library ieee;
-use ieee.std_logic_1164.all;
-
-
-entity top is
- port (
- m49 : in std_logic; -- oscillator input
- -- GPIO
- sw1 : in std_logic; -- switch 1, high active
- sw2 : in std_logic; -- switch 2, low active
- -- TUSB3410
- sin : inout std_logic; -- M0 configuration pin, TUSB3410 serial data input, LED3
- sout : in std_logic; -- TUSB3410 serial data out
- rts : in std_logic; -- TUSB3410 ready to send (LED5)
- cts : inout std_logic; -- TUSB3410 clear to send (and LED6)
- vs2 : inout std_logic; -- TUSB3410 I2C connection, LED8
- tvs1 : inout std_logic; -- TUSB3410 I2C connector (and E2)
- -- SPI flash
- cso : inout std_logic; -- SPI memory chip select
- tmosi : inout std_logic; -- SPI memory mosi (and E4)
- tdin : inout std_logic; -- SPI memory data out (and E5)
- tcclk : inout std_logic; -- SPI memory clock (and E6)
- -- remaining IO pins
- c13 : in std_logic; -- external input (pin 49)
- d13 : in std_logic; -- external input (pin 50)
- tvs0 : inout std_logic; -- E3
- tm1 : inout std_logic; -- M1 configuration pin (and E7)
- thsw : inout std_logic; -- HSWAP configuration pin (and E8)
- -- I/O's for DIL / main connector
- pin : inout std_logic_vector(48 downto 1)
- );
-end entity top;
-
-
-architecture rtl of top is
-
-begin
-end architecture rtl;
diff --git a/hw_godil/bsp/top.xst b/hw_godil/bsp/top.xst
deleted file mode 100644
index 6f6b603..0000000
--- a/hw_godil/bsp/top.xst
+++ /dev/null
@@ -1,56 +0,0 @@
-set -tmpdir "tmp"
-set -xsthdpdir "xst"
-run
--ifn ../top.prj
--ifmt mixed
--ofn top
--ofmt NGC
--p xc3s500e-4-vq100
--top top
--opt_mode Speed
--opt_level 1
--iuc NO
--keep_hierarchy No
--netlist_hierarchy As_Optimized
--rtlview Yes
--glob_opt AllClockNets
--read_cores YES
--write_timing_constraints NO
--cross_clock_analysis NO
--hierarchy_separator /
--bus_delimiter <>
--case Maintain
--slice_utilization_ratio 100
--bram_utilization_ratio 100
--verilog2001 YES
--fsm_extract YES -fsm_encoding Auto
--safe_implementation No
--fsm_style LUT
--ram_extract Yes
--ram_style Auto
--rom_extract Yes
--mux_style Auto
--decoder_extract YES
--priority_extract Yes
--shreg_extract YES
--shift_extract YES
--xor_collapse YES
--rom_style Auto
--auto_bram_packing NO
--mux_extract Yes
--resource_sharing YES
--async_to_sync NO
--mult_style Auto
--iobuf YES
--max_fanout 500
--bufg 24
--register_duplication YES
--register_balancing No
--slice_packing YES
--optimize_primitives NO
--use_clock_enable Yes
--use_sync_set Yes
--use_sync_reset Yes
--iob Auto
--equivalent_register_removal YES
--slice_utilization_ratio_maxmargin 5
diff --git a/hw_godil/doc/godil500_Ueberblick_leiterplatte.odg b/hw_godil/doc/godil500_Ueberblick_leiterplatte.odg
deleted file mode 100644
index 66b0eb3..0000000
--- a/hw_godil/doc/godil500_Ueberblick_leiterplatte.odg
+++ /dev/null
Binary files differ
diff --git a/hw_godil/godil_xc3s500e_zpu_zealot_implementation.tar.gz b/hw_godil/godil_xc3s500e_zpu_zealot_implementation.tar.gz
deleted file mode 100644
index 5715aa8..0000000
--- a/hw_godil/godil_xc3s500e_zpu_zealot_implementation.tar.gz
+++ /dev/null
Binary files differ
diff --git a/hw_v5_fx30t_extension/bsp/avnet-eval-xc5vfx30t.ucf b/hw_v5_fx30t_extension/bsp/avnet-eval-xc5vfx30t.ucf
deleted file mode 100644
index 085c55e..0000000
--- a/hw_v5_fx30t_extension/bsp/avnet-eval-xc5vfx30t.ucf
+++ /dev/null
@@ -1,470 +0,0 @@
-############################################################
-# Avnet Virtex 5 FX Evaluation Board constraints file
-#
-# Familiy: Virtex5
-# Device: XC5VFX30T
-# Package: FF665
-# Speed: -1
-#
-#
-# Bank 0 3.3V
-# Bank 1 3.3V
-# Bank 2 3.3V
-# Bank 3 3.3V
-# Bank 4 2.5V or 3.3V (JP2, VIO_EXP1_DP), here 2.5V
-# Bank 11 1.8V
-# Bank 12 3.3V
-# Bank 13 1.8V
-# Bank 15 3.3V
-# Bank 16 2.5V or 3.3V (JP3, VIO_EXP1_SE), here 2.5V
-# Bank 17 1.8V
-# Bank 18 2.5V or 3.3V (JP2, VIO_EXP1_DP), here 2.5V
-
-
-############################################################
-## clock/timing constraints
-############################################################
-
-TIMESPEC "TS_clk_100" = PERIOD "clk_100" 100 MHz;
-
-
-############################################################
-## pin placement constraints
-############################################################
-
-NET "clk_100MHz" LOC= E18 | IOSTANDARD = LVCMOS33 | TNM_NET = "clk_100";
-NET "clk_socket" LOC= E13 | IOSTANDARD = LVCMOS33;
-NET "user_clk_p" LOC= AB15 ;
-NET "user_clk_n" LOC= AC16 ;
-
-# RS232
-NET "RS232_RX" LOC= K8 | IOSTANDARD = LVCMOS33;
-NET "RS232_TX" LOC= L8 | IOSTANDARD = LVCMOS33;
-NET "RS232_RTS" LOC= N8 | IOSTANDARD = LVCMOS33; # Jumper J3
-NET "RS232_CTS" LOC= R8 | IOSTANDARD = LVCMOS33; # Jumper J4
-
-# RS232_USB
-NET "RS232_USB_RX" LOC= AA10 | IOSTANDARD = LVCMOS33;
-NET "RS232_USB_TX" LOC= AA19 | IOSTANDARD = LVCMOS33;
-NET "RS232_USB_reset_n" LOC= Y20 | IOSTANDARD = LVCMOS33;
-
-# GPIO LEDs, active low
-NET "GPIO_LED_n<0>" LOC= AF22 | IOSTANDARD = LVCMOS18 | PULLUP;
-NET "GPIO_LED_n<1>" LOC= AF23 | IOSTANDARD = LVCMOS18 | PULLUP;
-NET "GPIO_LED_n<2>" LOC= AF25 | IOSTANDARD = LVCMOS18 | PULLUP;
-NET "GPIO_LED_n<3>" LOC= AE25 | IOSTANDARD = LVCMOS18 | PULLUP;
-NET "GPIO_LED_n<4>" LOC= AD25 | IOSTANDARD = LVCMOS18 | PULLUP;
-NET "GPIO_LED_n<5>" LOC= AE26 | IOSTANDARD = LVCMOS18 | PULLUP;
-NET "GPIO_LED_n<6>" LOC= AD26 | IOSTANDARD = LVCMOS18 | PULLUP;
-NET "GPIO_LED_n<7>" LOC= AC26 | IOSTANDARD = LVCMOS18 | PULLUP;
-
-# GPIO DIP_Switches
-NET "GPIO_DIPswitch<0>" LOC= AD13 | IOSTANDARD = LVCMOS18;
-NET "GPIO_DIPswitch<1>" LOC= AE13 | IOSTANDARD = LVCMOS18;
-NET "GPIO_DIPswitch<2>" LOC= AF13 | IOSTANDARD = LVCMOS18;
-NET "GPIO_DIPswitch<3>" LOC= AD15 | IOSTANDARD = LVCMOS18;
-NET "GPIO_DIPswitch<4>" LOC= AD14 | IOSTANDARD = LVCMOS18;
-NET "GPIO_DIPswitch<5>" LOC= AF14 | IOSTANDARD = LVCMOS18;
-NET "GPIO_DIPswitch<6>" LOC= AE15 | IOSTANDARD = LVCMOS18;
-NET "GPIO_DIPswitch<7>" LOC= AF15 | IOSTANDARD = LVCMOS18;
-
-# Push Buttons
-NET "GPIO_button<0>" LOC= AF20 | IOSTANDARD = LVCMOS18 | PULLUP; #PB1
-NET "GPIO_button<1>" LOC= AE20 | IOSTANDARD = LVCMOS18 | PULLUP; #PB2
-NET "GPIO_button<2>" LOC= AD19 | IOSTANDARD = LVCMOS18 | PULLUP; #PB3
-NET "GPIO_button<3>" LOC= AD20 | IOSTANDARD = LVCMOS18 | PULLUP; #PB4
-
-# FLASH_8Mx16
-NET "FLASH_A<31>" LOC= Y11 | IOSTANDARD = LVCMOS33;
-NET "FLASH_A<30>" LOC= H9 | IOSTANDARD = LVCMOS33;
-NET "FLASH_A<29>" LOC= G10 | IOSTANDARD = LVCMOS33;
-NET "FLASH_A<28>" LOC= H21 | IOSTANDARD = LVCMOS33;
-NET "FLASH_A<27>" LOC= G20 | IOSTANDARD = LVCMOS33;
-NET "FLASH_A<26>" LOC= H11 | IOSTANDARD = LVCMOS33;
-NET "FLASH_A<25>" LOC= G11 | IOSTANDARD = LVCMOS33;
-NET "FLASH_A<24>" LOC= H19 | IOSTANDARD = LVCMOS33;
-NET "FLASH_A<23>" LOC= H18 | IOSTANDARD = LVCMOS33;
-NET "FLASH_A<22>" LOC= G12 | IOSTANDARD = LVCMOS33;
-NET "FLASH_A<21>" LOC= F13 | IOSTANDARD = LVCMOS33;
-NET "FLASH_A<20>" LOC= G19 | IOSTANDARD = LVCMOS33;
-NET "FLASH_A<19>" LOC= F18 | IOSTANDARD = LVCMOS33;
-NET "FLASH_A<18>" LOC= F14 | IOSTANDARD = LVCMOS33;
-NET "FLASH_A<17>" LOC= F15 | IOSTANDARD = LVCMOS33;
-NET "FLASH_A<16>" LOC= F17 | IOSTANDARD = LVCMOS33;
-NET "FLASH_A<15>" LOC= G17 | IOSTANDARD = LVCMOS33;
-NET "FLASH_A<14>" LOC= G14 | IOSTANDARD = LVCMOS33;
-NET "FLASH_A<13>" LOC= H13 | IOSTANDARD = LVCMOS33;
-NET "FLASH_A<12>" LOC= G16 | IOSTANDARD = LVCMOS33;
-NET "FLASH_A<11>" LOC= G15 | IOSTANDARD = LVCMOS33;
-NET "FLASH_A<10>" LOC= Y18 | IOSTANDARD = LVCMOS33;
-NET "FLASH_A<9>" LOC= AA18 | IOSTANDARD = LVCMOS33;
-NET "FLASH_A<8>" LOC= Y10 | IOSTANDARD = LVCMOS33;
-NET "FLASH_A<7>" LOC= W11 | IOSTANDARD = LVCMOS33;
-NET "FLASH_DQ<0>" LOC= AA15 | IOSTANDARD = LVCMOS33;
-NET "FLASH_DQ<1>" LOC= Y15 | IOSTANDARD = LVCMOS33;
-NET "FLASH_DQ<2>" LOC= W14 | IOSTANDARD = LVCMOS33;
-NET "FLASH_DQ<3>" LOC= Y13 | IOSTANDARD = LVCMOS33;
-NET "FLASH_DQ<4>" LOC= W16 | IOSTANDARD = LVCMOS33;
-NET "FLASH_DQ<5>" LOC= Y16 | IOSTANDARD = LVCMOS33;
-NET "FLASH_DQ<6>" LOC= AA14 | IOSTANDARD = LVCMOS33;
-NET "FLASH_DQ<7>" LOC= AA13 | IOSTANDARD = LVCMOS33;
-NET "FLASH_DQ<8>" LOC= AB12 | IOSTANDARD = LVCMOS25; # with level shifter
-NET "FLASH_DQ<9>" LOC= AC11 | IOSTANDARD = LVCMOS25; # with level shifter
-NET "FLASH_DQ<10>" LOC= AB20 | IOSTANDARD = LVCMOS25; # with level shifter
-NET "FLASH_DQ<11>" LOC= AB21 | IOSTANDARD = LVCMOS25; # with level shifter
-NET "FLASH_DQ<12>" LOC= AB11 | IOSTANDARD = LVCMOS25; # with level shifter
-NET "FLASH_DQ<13>" LOC= AB10 | IOSTANDARD = LVCMOS25; # with level shifter
-NET "FLASH_DQ<14>" LOC= AA20 | IOSTANDARD = LVCMOS25; # with level shifter
-NET "FLASH_DQ<15>" LOC= Y21 | IOSTANDARD = LVCMOS25; # with level shifter
-NET "FLASH_WEN" LOC= AA17 | IOSTANDARD = LVCMOS33;
-NET "FLASH_OEN<0>" LOC= AA12 | IOSTANDARD = LVCMOS33;
-NET "FLASH_CEN<0>" LOC= Y12 | IOSTANDARD = LVCMOS33;
-NET "FLASH_rp_n" LOC= D13 | IOSTANDARD = LVCMOS33;
-NET "FLASH_byte_n" LOC= Y17 | IOSTANDARD = LVCMOS33;
-NET "FLASH_adv_n" LOC= F19 | IOSTANDARD = LVCMOS33;
-NET "FLASH_clk" LOC= E12 | IOSTANDARD = LVCMOS33;
-NET "FLASH_wait" LOC= D16 | IOSTANDARD = LVCMOS33;
-
-# DDR2_SDRAM_16Mx32
-NET "DDR2_ODT<0>" LOC= AF24 | IOSTANDARD = SSTL18_II;
-NET "DDR2_A<0>" LOC= U25 | IOSTANDARD = SSTL18_II;
-NET "DDR2_A<1>" LOC= T25 | IOSTANDARD = SSTL18_II;
-NET "DDR2_A<2>" LOC= T24 | IOSTANDARD = SSTL18_II;
-NET "DDR2_A<3>" LOC= T23 | IOSTANDARD = SSTL18_II;
-NET "DDR2_A<4>" LOC= U24 | IOSTANDARD = SSTL18_II;
-NET "DDR2_A<5>" LOC= V24 | IOSTANDARD = SSTL18_II;
-NET "DDR2_A<6>" LOC= Y23 | IOSTANDARD = SSTL18_II;
-NET "DDR2_A<7>" LOC= W23 | IOSTANDARD = SSTL18_II;
-NET "DDR2_A<8>" LOC= AA25 | IOSTANDARD = SSTL18_II;
-NET "DDR2_A<9>" LOC= AB26 | IOSTANDARD = SSTL18_II;
-NET "DDR2_A<10>" LOC= AB25 | IOSTANDARD = SSTL18_II;
-NET "DDR2_A<11>" LOC= AB24 | IOSTANDARD = SSTL18_II;
-NET "DDR2_A<12>" LOC= AA23 | IOSTANDARD = SSTL18_II;
-NET "DDR2_BA<0>" LOC= U21 | IOSTANDARD = SSTL18_II;
-NET "DDR2_BA<1>" LOC= V22 | IOSTANDARD = SSTL18_II;
-NET "DDR2_CAS_N" LOC= W24 | IOSTANDARD = SSTL18_II;
-NET "DDR2_CKE" LOC= T22 | IOSTANDARD = SSTL18_II;
-NET "DDR2_CS_N" LOC= AD24 | IOSTANDARD = SSTL18_II;
-NET "DDR2_RAS_N" LOC= Y22 | IOSTANDARD = SSTL18_II;
-NET "DDR2_WE_N" LOC= AA22 | IOSTANDARD = SSTL18_II;
-NET "DDR2_DM<0>" LOC= U26 | IOSTANDARD = SSTL18_II;
-NET "DDR2_DM<1>" LOC= N24 | IOSTANDARD = SSTL18_II;
-NET "DDR2_DM<2>" LOC= M24 | IOSTANDARD = SSTL18_II;
-NET "DDR2_DM<3>" LOC= M25 | IOSTANDARD = SSTL18_II;
-NET "DDR2_DQS_P<0>" LOC= W26 | IOSTANDARD = SSTL18_II;
-NET "DDR2_DQS_P<1>" LOC= L23 | IOSTANDARD = SSTL18_II;
-NET "DDR2_DQS_P<2>" LOC= K22 | IOSTANDARD = SSTL18_II;
-NET "DDR2_DQS_P<3>" LOC= J21 | IOSTANDARD = SSTL18_II;
-NET "DDR2_DQS_N<0>" LOC= W25 | IOSTANDARD = SSTL18_II;
-NET "DDR2_DQS_N<1>" LOC= L22 | IOSTANDARD = SSTL18_II;
-NET "DDR2_DQS_N<2>" LOC= K23 | IOSTANDARD = SSTL18_II;
-NET "DDR2_DQS_N<3>" LOC= K21 | IOSTANDARD = SSTL18_II;
-NET "DDR2_DQ<0>" LOC= R22 | IOSTANDARD = SSTL18_II;
-NET "DDR2_DQ<1>" LOC= R23 | IOSTANDARD = SSTL18_II;
-NET "DDR2_DQ<2>" LOC= P23 | IOSTANDARD = SSTL18_II;
-NET "DDR2_DQ<3>" LOC= P24 | IOSTANDARD = SSTL18_II;
-NET "DDR2_DQ<4>" LOC= R25 | IOSTANDARD = SSTL18_II;
-NET "DDR2_DQ<5>" LOC= P25 | IOSTANDARD = SSTL18_II;
-NET "DDR2_DQ<6>" LOC= R26 | IOSTANDARD = SSTL18_II;
-NET "DDR2_DQ<7>" LOC= P26 | IOSTANDARD = SSTL18_II;
-NET "DDR2_DQ<8>" LOC= M26 | IOSTANDARD = SSTL18_II;
-NET "DDR2_DQ<9>" LOC= N26 | IOSTANDARD = SSTL18_II;
-NET "DDR2_DQ<10>" LOC= K25 | IOSTANDARD = SSTL18_II;
-NET "DDR2_DQ<11>" LOC= L24 | IOSTANDARD = SSTL18_II;
-NET "DDR2_DQ<12>" LOC= K26 | IOSTANDARD = SSTL18_II;
-NET "DDR2_DQ<13>" LOC= J26 | IOSTANDARD = SSTL18_II;
-NET "DDR2_DQ<14>" LOC= J25 | IOSTANDARD = SSTL18_II;
-NET "DDR2_DQ<15>" LOC= N21 | IOSTANDARD = SSTL18_II;
-NET "DDR2_DQ<16>" LOC= M21 | IOSTANDARD = SSTL18_II;
-NET "DDR2_DQ<17>" LOC= J23 | IOSTANDARD = SSTL18_II;
-NET "DDR2_DQ<18>" LOC= H23 | IOSTANDARD = SSTL18_II;
-NET "DDR2_DQ<19>" LOC= H22 | IOSTANDARD = SSTL18_II;
-NET "DDR2_DQ<20>" LOC= G22 | IOSTANDARD = SSTL18_II;
-NET "DDR2_DQ<21>" LOC= F22 | IOSTANDARD = SSTL18_II;
-NET "DDR2_DQ<22>" LOC= F23 | IOSTANDARD = SSTL18_II;
-NET "DDR2_DQ<23>" LOC= E23 | IOSTANDARD = SSTL18_II;
-NET "DDR2_DQ<24>" LOC= G24 | IOSTANDARD = SSTL18_II;
-NET "DDR2_DQ<25>" LOC= F24 | IOSTANDARD = SSTL18_II;
-NET "DDR2_DQ<26>" LOC= G25 | IOSTANDARD = SSTL18_II;
-NET "DDR2_DQ<27>" LOC= H26 | IOSTANDARD = SSTL18_II;
-NET "DDR2_DQ<28>" LOC= G26 | IOSTANDARD = SSTL18_II;
-NET "DDR2_DQ<29>" LOC= F25 | IOSTANDARD = SSTL18_II;
-NET "DDR2_DQ<30>" LOC= E25 | IOSTANDARD = SSTL18_II;
-NET "DDR2_DQ<31>" LOC= E26 | IOSTANDARD = SSTL18_II;
-NET "DDR2_CK_p<0>" LOC= V21 | IOSTANDARD = DIFF_SSTL18_II;
-NET "DDR2_CK_p<1>" LOC= N22 | IOSTANDARD = DIFF_SSTL18_II;
-NET "DDR2_CK_n<0>" LOC= W21 | IOSTANDARD = DIFF_SSTL18_II;
-NET "DDR2_CK_n<1>" LOC= M22 | IOSTANDARD = DIFF_SSTL18_II;
-
-# Ethernet MAC
-NET "GMII_txer" LOC= A22 | IOSTANDARD = LVCMOS33;
-NET "GMII_tx_clk" LOC= E17 | IOSTANDARD = LVCMOS33 | PERIOD=40000 ps;
-NET "GMII_rx_clk" LOC= E20 | IOSTANDARD = LVCMOS33 | PERIOD=40000 ps;
-NET "GMII_gtc_clk" LOC= A19 | IOSTANDARD = LVCMOS33;
-NET "GMII_crs" LOC= A25 | IOSTANDARD = LVCMOS33 | IOBDELAY=NONE;
-NET "GMII_dv" LOC= C21 | IOSTANDARD = LVCMOS33 | IOBDELAY=NONE;
-NET "GMII_rx_data<0>" LOC= D24 | IOSTANDARD = LVCMOS33 | IOBDELAY=NONE;
-NET "GMII_rx_data<1>" LOC= D23 | IOSTANDARD = LVCMOS33 | IOBDELAY=NONE;
-NET "GMII_rx_data<2>" LOC= D21 | IOSTANDARD = LVCMOS33 | IOBDELAY=NONE;
-NET "GMII_rx_data<3>" LOC= C26 | IOSTANDARD = LVCMOS33 | IOBDELAY=NONE;
-NET "GMII_rx_data<4>" LOC= D20 | IOSTANDARD = LVCMOS33 | IOBDELAY=NONE;
-NET "GMII_rx_data<5>" LOC= C23 | IOSTANDARD = LVCMOS33 | IOBDELAY=NONE;
-NET "GMII_rx_data<6>" LOC= B25 | IOSTANDARD = LVCMOS33 | IOBDELAY=NONE;
-NET "GMII_rx_data<7>" LOC= C22 | IOSTANDARD = LVCMOS33 | IOBDELAY=NONE;
-NET "GMII_col" LOC= A24 | IOSTANDARD = LVCMOS33 | IOBDELAY=NONE;
-NET "GMII_rx_er" LOC= B24 | IOSTANDARD = LVCMOS33 | IOBDELAY=NONE;
-NET "GMII_tx_en" LOC= A23 | IOSTANDARD = LVCMOS33;
-NET "GMII_tx_data<0>" LOC= D19 | IOSTANDARD = LVCMOS33;
-NET "GMII_tx_data<1>" LOC= C19 | IOSTANDARD = LVCMOS33;
-NET "GMII_tx_data<2>" LOC= A20 | IOSTANDARD = LVCMOS33;
-NET "GMII_tx_data<3>" LOC= B20 | IOSTANDARD = LVCMOS33;
-NET "GMII_tx_data<4>" LOC= B19 | IOSTANDARD = LVCMOS33;
-NET "GMII_tx_data<5>" LOC= A15 | IOSTANDARD = LVCMOS33;
-NET "GMII_tx_data<6>" LOC= B22 | IOSTANDARD = LVCMOS33;
-NET "GMII_tx_data<7>" LOC= B21 | IOSTANDARD = LVCMOS33;
-NET "GBE_rst_n" LOC= B26 | IOSTANDARD = LVCMOS33;
-NET "GBE_mdc" LOC= D26 | IOSTANDARD = LVCMOS33;
-NET "GBE_mdio" LOC= D25 | IOSTANDARD = LVCMOS33;
-NET "GBE_int_n" LOC= C24 | IOSTANDARD = LVCMOS33;
-NET "GBE_mclk" LOC= F20 | IOSTANDARD = LVCMOS33;
-
-# SysACE CompactFlash
-NET "SAM_CLK" LOC= F12 | IOSTANDARD = LVCMOS33;
-NET "SAM_A<0>" LOC= Y5 | IOSTANDARD = LVCMOS33;
-NET "SAM_A<1>" LOC= V7 | IOSTANDARD = LVCMOS33;
-NET "SAM_A<2>" LOC= W6 | IOSTANDARD = LVCMOS33;
-NET "SAM_A<3>" LOC= W5 | IOSTANDARD = LVCMOS33;
-NET "SAM_A<4>" LOC= K6 | IOSTANDARD = LVCMOS33;
-NET "SAM_A<5>" LOC= J5 | IOSTANDARD = LVCMOS33;
-NET "SAM_A<6>" LOC= J6 | IOSTANDARD = LVCMOS33;
-NET "SAM_D<0>" LOC= F5 | IOSTANDARD = LVCMOS33;
-NET "SAM_D<1>" LOC= U7 | IOSTANDARD = LVCMOS33;
-NET "SAM_D<2>" LOC= V6 | IOSTANDARD = LVCMOS33;
-NET "SAM_D<3>" LOC= U5 | IOSTANDARD = LVCMOS33;
-NET "SAM_D<4>" LOC= U6 | IOSTANDARD = LVCMOS33;
-NET "SAM_D<5>" LOC= T5 | IOSTANDARD = LVCMOS33;
-NET "SAM_D<6>" LOC= T7 | IOSTANDARD = LVCMOS33;
-NET "SAM_D<7>" LOC= R6 | IOSTANDARD = LVCMOS33;
-NET "SAM_D<8>" LOC= R7 | IOSTANDARD = LVCMOS33;
-NET "SAM_D<9>" LOC= R5 | IOSTANDARD = LVCMOS33;
-NET "SAM_D<10>" LOC= P6 | IOSTANDARD = LVCMOS33;
-NET "SAM_D<11>" LOC= P8 | IOSTANDARD = LVCMOS33;
-NET "SAM_D<12>" LOC= N6 | IOSTANDARD = LVCMOS33;
-NET "SAM_D<13>" LOC= M7 | IOSTANDARD = LVCMOS33;
-NET "SAM_D<14>" LOC= K5 | IOSTANDARD = LVCMOS33;
-NET "SAM_D<15>" LOC= L7 | IOSTANDARD = LVCMOS33;
-NET "SAM_CEN" LOC= G4 | IOSTANDARD = LVCMOS33;
-NET "SAM_OEN" LOC= Y6 | IOSTANDARD = LVCMOS33;
-NET "SAM_WEN" LOC= Y4 | IOSTANDARD = LVCMOS33;
-NET "SAM_MPIRQ" LOC= H4 | IOSTANDARD = LVCMOS33;
-NET "SAM_BRDY" LOC= G5 | IOSTANDARD = LVCMOS33;
-NET "SAM_RESET_n" LOC= H6 | IOSTANDARD = LVCMOS33;
-
-# Expansion Header
-NET "EXP1_SE_IO<0>" LOC= A8 | IOSTANDARD = LVCMOS25;
-NET "EXP1_SE_IO<1>" LOC= A12 | IOSTANDARD = LVCMOS25;
-NET "EXP1_SE_IO<2>" LOC= B10 | IOSTANDARD = LVCMOS25;
-NET "EXP1_SE_IO<3>" LOC= A10 | IOSTANDARD = LVCMOS25;
-NET "EXP1_SE_IO<4>" LOC= B9 | IOSTANDARD = LVCMOS25;
-NET "EXP1_SE_IO<5>" LOC= A9 | IOSTANDARD = LVCMOS25;
-NET "EXP1_SE_IO<6>" LOC= A5 | IOSTANDARD = LVCMOS25;
-NET "EXP1_SE_IO<7>" LOC= B11 | IOSTANDARD = LVCMOS25;
-NET "EXP1_SE_IO<8>" LOC= B6 | IOSTANDARD = LVCMOS25;
-NET "EXP1_SE_IO<9>" LOC= A7 | IOSTANDARD = LVCMOS25;
-NET "EXP1_SE_IO<10>" LOC= D8 | IOSTANDARD = LVCMOS25;
-NET "EXP1_SE_IO<11>" LOC= C9 | IOSTANDARD = LVCMOS25;
-NET "EXP1_SE_IO<12>" LOC= B7 | IOSTANDARD = LVCMOS25;
-NET "EXP1_SE_IO<13>" LOC= A4 | IOSTANDARD = LVCMOS25;
-NET "EXP1_SE_IO<14>" LOC= B5 | IOSTANDARD = LVCMOS25;
-NET "EXP1_SE_IO<15>" LOC= C8 | IOSTANDARD = LVCMOS25;
-NET "EXP1_SE_IO<16>" LOC= C7 | IOSTANDARD = LVCMOS25;
-NET "EXP1_SE_IO<17>" LOC= A3 | IOSTANDARD = LVCMOS25;
-NET "EXP1_SE_IO<18>" LOC= C6 | IOSTANDARD = LVCMOS25;
-NET "EXP1_SE_IO<19>" LOC= B4 | IOSTANDARD = LVCMOS25;
-NET "EXP1_SE_IO<20>" LOC= D6 | IOSTANDARD = LVCMOS25;
-NET "EXP1_SE_IO<21>" LOC= D9 | IOSTANDARD = LVCMOS25;
-NET "EXP1_SE_IO<22>" LOC= E8 | IOSTANDARD = LVCMOS25;
-NET "EXP1_SE_IO<23>" LOC= D5 | IOSTANDARD = LVCMOS25;
-NET "EXP1_SE_IO<24>" LOC= F7 | IOSTANDARD = LVCMOS25;
-NET "EXP1_SE_IO<25>" LOC= E7 | IOSTANDARD = LVCMOS25;
-NET "EXP1_SE_IO<26>" LOC= E5 | IOSTANDARD = LVCMOS25;
-NET "EXP1_SE_IO<27>" LOC= E6 | IOSTANDARD = LVCMOS25;
-NET "EXP1_SE_IO<28>" LOC= F8 | IOSTANDARD = LVCMOS25;
-NET "EXP1_SE_IO<29>" LOC= H7 | IOSTANDARD = LVCMOS25;
-NET "EXP1_SE_IO<30>" LOC= G7 | IOSTANDARD = LVCMOS25;
-NET "EXP1_SE_IO<31>" LOC= H8 | IOSTANDARD = LVCMOS25;
-NET "EXP1_SE_IO<32>" LOC= G9 | IOSTANDARD = LVCMOS25;
-NET "EXP1_SE_IO<33>" LOC= J8 | IOSTANDARD = LVCMOS25;
-NET "EXP1_DIFF_P<0>" LOC= AF9 ;
-NET "EXP1_DIFF_N<0>" LOC= AF10 ;
-NET "EXP1_DIFF_P<1>" LOC= AF12 ;
-NET "EXP1_DIFF_N<1>" LOC= AE12 ;
-NET "EXP1_DIFF_P<2>" LOC= AF7 ;
-NET "EXP1_DIFF_N<2>" LOC= AF8 ;
-NET "EXP1_DIFF_P<3>" LOC= AE11 ;
-NET "EXP1_DIFF_N<3>" LOC= AD11 ;
-NET "EXP1_DIFF_P<4>" LOC= AF4 ;
-NET "EXP1_DIFF_N<4>" LOC= AF3 ;
-NET "EXP1_DIFF_P<5>" LOC= AD10 ;
-NET "EXP1_DIFF_N<5>" LOC= AE10 ;
-NET "EXP1_DIFF_P<6>" LOC= AE8 ;
-NET "EXP1_DIFF_N<6>" LOC= AE7 ;
-NET "EXP1_DIFF_P<7>" LOC= AC8 ;
-NET "EXP1_DIFF_N<7>" LOC= AD8 ;
-NET "EXP1_DIFF_P<8>" LOC= AD9 ;
-NET "EXP1_DIFF_N<8>" LOC= AC9 ;
-NET "EXP1_DIFF_P<9>" LOC= AE6 ;
-NET "EXP1_DIFF_N<9>" LOC= AF5 ;
-NET "EXP1_DIFF_P<10>" LOC= AB6 ;
-NET "EXP1_DIFF_N<10>" LOC= AB7 ;
-NET "EXP1_DIFF_P<11>" LOC= AC6 ;
-NET "EXP1_DIFF_N<11>" LOC= AD5 ;
-NET "EXP1_DIFF_P<12>" LOC= AD6 ;
-NET "EXP1_DIFF_N<12>" LOC= AC7 ;
-NET "EXP1_DIFF_P<13>" LOC= AE5 ;
-NET "EXP1_DIFF_N<13>" LOC= AD4 ;
-NET "EXP1_DIFF_P<14>" LOC= AB9 ;
-NET "EXP1_DIFF_N<14>" LOC= AA9 ;
-NET "EXP1_DIFF_P<15>" LOC= AC12 ;
-NET "EXP1_DIFF_N<15>" LOC= AC13 ;
-NET "EXP1_DIFF_P<16>" LOC= AA7 ;
-NET "EXP1_DIFF_N<16>" LOC= AA8 ;
-NET "EXP1_DIFF_P<17>" LOC= AA5 ;
-NET "EXP1_DIFF_N<17>" LOC= AB5 ;
-NET "EXP1_DIFF_P<18>" LOC= AB19 ;
-NET "EXP1_DIFF_N<18>" LOC= AC19 ;
-NET "EXP1_DIFF_P<19>" LOC= Y7 ;
-NET "EXP1_DIFF_N<19>" LOC= Y8 ;
-NET "EXP1_DIFF_P<20>" LOC= W9 ;
-NET "EXP1_DIFF_N<20>" LOC= W8 ;
-NET "EXP1_DIFF_P<21>" LOC= V8 ;
-NET "EXP1_DIFF_N<21>" LOC= V9 ;
-NET "EXP1_SE_CLK_OUT" LOC= B12 | IOSTANDARD = LVCMOS25;
-NET "EXP1_SE_CLK_IN" LOC= E10 | IOSTANDARD = LVCMOS33;
-NET "EXP1_DIFF_CLK_OUT_P" LOC= AC18 ;
-NET "EXP1_DIFF_CLK_OUT_N" LOC= AB17 ;
-NET "EXP1_DIFF_CLK_IN_P" LOC= AB14 ;
-NET "EXP1_DIFF_CLK_IN_N" LOC= AC14 ;
-#NET "EXP1_RCLK_DIFF_P" LOC= AB6 ;
-#NET "EXP1_RCLK_DIFF_N" LOC= AB7 ;
-
-# CPU Debug Trace
-NET "ATDD<8>" LOC= C16 | IOSTANDARD = LVCMOS33;
-NET "ATDD<9>" LOC= A17 | IOSTANDARD = LVCMOS33;
-NET "ATDD<10>" LOC= B15 | IOSTANDARD = LVCMOS33;
-NET "ATDD<11>" LOC= E15 | IOSTANDARD = LVCMOS33;
-NET "ATDD<12>" LOC= A14 | IOSTANDARD = LVCMOS33;
-NET "ATDD<13>" LOC= D18 | IOSTANDARD = LVCMOS33;
-NET "ATDD<14>" LOC= A13 | IOSTANDARD = LVCMOS33;
-NET "ATDD<15>" LOC= C13 | IOSTANDARD = LVCMOS33;
-NET "ATDD<16>" LOC= D14 | IOSTANDARD = LVCMOS33;
-NET "ATDD<17>" LOC= C17 | IOSTANDARD = LVCMOS33;
-NET "ATDD<18>" LOC= E16 | IOSTANDARD = LVCMOS33;
-NET "ATDD<19>" LOC= C14 | IOSTANDARD = LVCMOS33;
-NET "TRACE_TS10" LOC= B16 | IOSTANDARD = LVCMOS33;
-NET "TRACE_TS20" LOC= E21 | IOSTANDARD = LVCMOS33;
-NET "TRACE_TS1E" LOC= B14 | IOSTANDARD = LVCMOS33;
-NET "TRACE_TS2E" LOC= B17 | IOSTANDARD = LVCMOS33;
-NET "TRACE_TS3" LOC= C18 | IOSTANDARD = LVCMOS33;
-NET "TRACE_TS4" LOC= G21 | IOSTANDARD = LVCMOS33;
-NET "TRACE_TS5" LOC= A18 | IOSTANDARD = LVCMOS33;
-NET "TRACE_TS6" LOC= F10 | IOSTANDARD = LVCMOS33;
-NET "TRACE_CLK" LOC= D15 | IOSTANDARD = LVCMOS33;
-NET "CPU_HRESET" LOC= E11 | IOSTANDARD = LVCMOS33;
-NET "CPU_TDO" LOC= K7 | IOSTANDARD = LVCMOS33;
-NET "CPU_TMS" LOC= L5 | IOSTANDARD = LVCMOS33;
-NET "CPU_TDI" LOC= M6 | IOSTANDARD = LVCMOS33;
-NET "CPU_TRST" LOC= N7 | IOSTANDARD = LVCMOS33;
-NET "CPU_TCK" LOC= T8 | IOSTANDARD = LVCMOS33;
-NET "CPU_HALT_n" LOC= W4 | IOSTANDARD = LVCMOS33;
-
-
-# voltage termination
-CONFIG PROHIBIT = AA24;
-CONFIG PROHIBIT = AE23;
-CONFIG PROHIBIT = AF17;
-CONFIG PROHIBIT = V26;
-CONFIG PROHIBIT = E22;
-CONFIG PROHIBIT = L25;
-
-# unused pins
-CONFIG PROHIBIT = F9;
-CONFIG PROHIBIT = D10;
-CONFIG PROHIBIT = C12;
-CONFIG PROHIBIT = C11;
-CONFIG PROHIBIT = D11;
-CONFIG PROHIBIT = AB16;
-CONFIG PROHIBIT = AB22;
-CONFIG PROHIBIT = AC17;
-CONFIG PROHIBIT = AC21;
-CONFIG PROHIBIT = AE22;
-CONFIG PROHIBIT = AD23;
-CONFIG PROHIBIT = AC24;
-CONFIG PROHIBIT = AC23;
-CONFIG PROHIBIT = AC22;
-CONFIG PROHIBIT = AB22;
-CONFIG PROHIBIT = AE21;
-CONFIG PROHIBIT = AD21;
-CONFIG PROHIBIT = AF19;
-CONFIG PROHIBIT = AF18;
-CONFIG PROHIBIT = AE18;
-CONFIG PROHIBIT = AD18;
-CONFIG PROHIBIT = AE17;
-CONFIG PROHIBIT = AE16;
-CONFIG PROHIBIT = AD16;
-CONFIG PROHIBIT = G6;
-CONFIG PROHIBIT = H24;
-CONFIG PROHIBIT = J24;
-CONFIG PROHIBIT = N23;
-CONFIG PROHIBIT = N15;
-CONFIG PROHIBIT = P14;
-CONFIG PROHIBIT = V23;
-CONFIG PROHIBIT = Y26;
-CONFIG PROHIBIT = Y25;
-CONFIG PROHIBIT = P21;
-CONFIG PROHIBIT = R21;
-CONFIG PROHIBIT = U22;
-
-# grounded pins from gigabit transcievers
-CONFIG PROHIBIT = P4;
-CONFIG PROHIBIT = K4;
-CONFIG PROHIBIT = K3;
-CONFIG PROHIBIT = J1;
-CONFIG PROHIBIT = K1;
-CONFIG PROHIBIT = M1;
-CONFIG PROHIBIT = L1;
-CONFIG PROHIBIT = T3;
-CONFIG PROHIBIT = T4;
-CONFIG PROHIBIT = R1;
-CONFIG PROHIBIT = T1;
-CONFIG PROHIBIT = V1;
-CONFIG PROHIBIT = U1;
-CONFIG PROHIBIT = D3;
-CONFIG PROHIBIT = D4;
-CONFIG PROHIBIT = C1;
-CONFIG PROHIBIT = D1;
-CONFIG PROHIBIT = E1;
-CONFIG PROHIBIT = F1;
-CONFIG PROHIBIT = AB3;
-CONFIG PROHIBIT = AB4;
-CONFIG PROHIBIT = AA1;
-CONFIG PROHIBIT = AB1;
-CONFIG PROHIBIT = AC1;
-CONFIG PROHIBIT = AD1;
-CONFIG PROHIBIT = H2;
-CONFIG PROHIBIT = J2;
-CONFIG PROHIBIT = N2;
-CONFIG PROHIBIT = M2;
-CONFIG PROHIBIT = P2;
-CONFIG PROHIBIT = R2;
-CONFIG PROHIBIT = V2;
-CONFIG PROHIBIT = W2;
-CONFIG PROHIBIT = B2;
-CONFIG PROHIBIT = C2;
-CONFIG PROHIBIT = G2;
-CONFIG PROHIBIT = F2;
-CONFIG PROHIBIT = Y2;
-CONFIG PROHIBIT = AA2;
-CONFIG PROHIBIT = AD2;
-CONFIG PROHIBIT = AE2;
-
diff --git a/hw_v5_fx30t_extension/bsp/build.sh b/hw_v5_fx30t_extension/bsp/build.sh
deleted file mode 100644
index 0787fa5..0000000
--- a/hw_v5_fx30t_extension/bsp/build.sh
+++ /dev/null
@@ -1,28 +0,0 @@
-# need project files:
-# top.xst
-# top.prj
-# top.ut
-
-# need Xilinx tools:
-# xst
-# ngdbuild
-# map
-# par
-# trce
-# bitgen
-
-# generate build directory
-mkdir build
-cd build
-mkdir tmp
-
-# start processes
-xst -ifn "../top.xst" -ofn "top.syr"
-ngdbuild -dd _ngo -nt timestamp -uc ../avnet-eval-xc5vfx30t.ucf -p xc5vfx30t-ff665-1 top.ngc top.ngd
-map -p xc5vfx30t-ff665-1 -w -logic_opt off -ol high -t 1 -register_duplication off -global_opt off -mt off -cm area -ir off -pr off -lc off -power off -o top_map.ncd top.ngd top.pcf
-par -w -ol high -mt off top_map.ncd top.ncd top.pcf
-trce -v 3 -s 1 -n 3 -fastpaths -xml top.twx top.ncd -o top.twr top.pcf
-bitgen -f ../top.ut top.ncd
-
-# get bitfile
-cp top.bit ..
diff --git a/hw_v5_fx30t_extension/bsp/top.prj b/hw_v5_fx30t_extension/bsp/top.prj
deleted file mode 100644
index 3975c05..0000000
--- a/hw_v5_fx30t_extension/bsp/top.prj
+++ /dev/null
@@ -1 +0,0 @@
-vhdl work "../top.vhd"
diff --git a/hw_v5_fx30t_extension/bsp/top.ut b/hw_v5_fx30t_extension/bsp/top.ut
deleted file mode 100644
index e0159fb..0000000
--- a/hw_v5_fx30t_extension/bsp/top.ut
+++ /dev/null
@@ -1,39 +0,0 @@
--w
--g DebugBitstream:No
--g Binary:no
--g CRC:Enable
--g ConfigRate:2
--g CclkPin:PullUp
--g M0Pin:PullUp
--g M1Pin:PullUp
--g M2Pin:PullUp
--g ProgPin:PullUp
--g DonePin:PullUp
--g InitPin:Pullup
--g CsPin:Pullup
--g DinPin:Pullup
--g BusyPin:Pullup
--g RdWrPin:Pullup
--g HswapenPin:PullUp
--g TckPin:PullUp
--g TdiPin:PullUp
--g TdoPin:PullUp
--g TmsPin:PullUp
--g UnusedPin:PullDown
--g UserID:0xFFFFFFFF
--g ConfigFallback:Enable
--g SelectMAPAbort:Enable
--g BPI_page_size:1
--g OverTempPowerDown:Disable
--g JTAG_SysMon:Enable
--g DCIUpdateMode:AsRequired
--g StartUpClk:CClk
--g DONE_cycle:4
--g GTS_cycle:5
--g GWE_cycle:6
--g LCK_cycle:NoWait
--g Match_cycle:Auto
--g Security:None
--g DonePipe:No
--g DriveDone:No
--g Encrypt:No
diff --git a/hw_v5_fx30t_extension/bsp/top.vhd b/hw_v5_fx30t_extension/bsp/top.vhd
deleted file mode 100644
index 1964fed..0000000
--- a/hw_v5_fx30t_extension/bsp/top.vhd
+++ /dev/null
@@ -1,189 +0,0 @@
--- top module of
--- Avnet Virtex 5 FX Evaluation Board
-
-library ieee;
-use ieee.std_logic_1164.all;
-
-library unisim;
-use unisim.vcomponents.ibufds;
-
-
-entity top is
- port (
- clk_100MHz : in std_logic; -- 100 MHz clock
- clk_socket : in std_logic; -- user clock
- user_clk_p : in std_logic; -- diff user clock
- user_clk_n : in std_logic; -- diff user clock
- --
- -- RS232
- rs232_rx : in std_logic;
- rs232_tx : out std_logic;
- rs232_rts : in std_logic;
- rs232_cts : out std_logic;
- -- RS232 USB
- rs232_usb_rx : in std_logic;
- rs232_usb_tx : out std_logic;
- rs232_usb_reset_n : out std_logic;
- --
- gpio_led_n : out std_logic_vector(7 downto 0);
- gpio_dipswitch : in std_logic_vector(7 downto 0);
- gpio_button : in std_logic_vector(3 downto 0);
- --
- -- FLASH 8Mx16
- flash_a : out std_logic_vector(31 downto 7);
- flash_dq : inout std_logic_vector(15 downto 0);
- flash_wen : out std_logic;
- flash_oen : out std_logic_vector(0 downto 0);
- flash_cen : out std_logic_vector(0 downto 0);
- flash_rp_n : out std_logic;
- flash_byte_n : out std_logic;
- flash_adv_n : out std_logic;
- flash_clk : out std_logic;
- flash_wait : in std_logic;
- --
- -- DDR2 SDRAM 16Mx32
- ddr2_odt : in std_logic_vector(0 downto 0);
- ddr2_a : out std_logic_vector(12 downto 0);
- ddr2_ba : out std_logic_vector(1 downto 0);
- ddr2_cas_n : out std_logic;
- ddr2_cke : out std_logic;
- ddr2_cs_n : out std_logic;
- ddr2_ras_n : out std_logic;
- ddr2_we_n : out std_logic;
- ddr2_dm : out std_logic_vector(3 downto 0);
- ddr2_dqs_p : inout std_logic_vector(3 downto 0);
- ddr2_dqs_n : inout std_logic_vector(3 downto 0);
- ddr2_dq : inout std_logic_vector(31 downto 0);
- ddr2_ck_p : in std_logic_vector(1 downto 0);
- ddr2_ck_n : in std_logic_vector(1 downto 0);
- --
- -- Ethernet MAC
- gmii_txer : out std_logic;
- gmii_tx_clk : in std_logic; -- 25 MHz
- gmii_rx_clk : in std_logic; -- 25 MHz
- gmii_gtc_clk : out std_logic;
- gmii_crs : in std_logic;
- gmii_dv : in std_logic;
- gmii_rx_data : in std_logic_vector(7 downto 0);
- gmii_col : in std_logic;
- gmii_rx_er : in std_logic;
- gmii_tx_en : out std_logic;
- gmii_tx_data : out std_logic_vector(7 downto 0);
- gbe_rst_n : out std_logic;
- gbe_mdc : out std_logic;
- gbe_mdio : inout std_logic;
- gbe_int_n : inout std_logic;
- gbe_mclk : in std_logic;
- --
- -- SysACE CompactFlash
- sam_clk : in std_logic;
- sam_a : out std_logic_vector(6 downto 0);
- sam_d : inout std_logic_vector(15 downto 0);
- sam_cen : out std_logic;
- sam_oen : out std_logic;
- sam_wen : out std_logic;
- sam_mpirq : in std_logic;
- sam_brdy : in std_logic;
- sam_reset_n : out std_logic;
- --
- -- Expansion Header
- exp1_se_io : inout std_logic_vector(33 downto 0);
- exp1_diff_p : inout std_logic_vector(21 downto 0);
- exp1_diff_n : inout std_logic_vector(21 downto 0);
- exp1_se_clk_out : out std_logic;
- exp1_se_clk_in : in std_logic;
- exp1_diff_clk_out_p : out std_logic;
- exp1_diff_clk_out_n : out std_logic;
- exp1_diff_clk_in_p : in std_logic;
- exp1_diff_clk_in_n : in std_logic;
- --
- -- Debug/Trace
- atdd : inout std_logic_vector(19 downto 8);
- trace_ts10 : inout std_logic;
- trace_ts20 : inout std_logic;
- trace_ts1e : inout std_logic;
- trace_ts2e : inout std_logic;
- trace_ts3 : inout std_logic;
- trace_ts4 : inout std_logic;
- trace_ts5 : inout std_logic;
- trace_ts6 : inout std_logic;
- trace_clk : in std_logic;
- cpu_hreset : in std_logic;
- cpu_tdo : out std_logic;
- cpu_tms : in std_logic;
- cpu_tdi : in std_logic;
- cpu_trst : in std_logic;
- cpu_tck : in std_logic;
- cpu_halt_n : in std_logic
- );
-end entity top;
-
-
-architecture rtl of top is
-
- signal ibufds_i0_o : std_ulogic;
- signal ibufds_i1_o : std_ulogic;
-
-begin
-
- ibufds_i0 : ibufds
- generic map (
- diff_term => true
- )
- port map (
- o => ibufds_i0_o,
- i => ddr2_ck_p(0),
- ib => ddr2_ck_n(0)
- );
-
- ibufds_i1 : ibufds
- generic map (
- diff_term => true
- )
- port map (
- o => ibufds_i1_o,
- i => ddr2_ck_p(1),
- ib => ddr2_ck_n(1)
- );
-
- -- default output drivers
- -- to pass bitgen DRC
- rs232_tx <= '1';
- rs232_cts <= '1';
- rs232_usb_tx <= '1';
- rs232_usb_reset_n <= '1';
- gpio_led_n <= (others => '1');
- flash_cen <= "1";
- flash_oen <= "1";
- flash_wen <= '1';
- flash_rp_n <= '1';
- flash_byte_n <= '1';
- flash_adv_n <= '1';
- flash_clk <= '0';
- flash_a <= (others => '0');
- ddr2_a <= (others => '0');
- ddr2_ba <= (others => '0');
- ddr2_dm <= (others => '0');
- ddr2_cs_n <= '1';
- ddr2_we_n <= '1';
- ddr2_cke <= '1';
- ddr2_cas_n <= '1';
- ddr2_ras_n <= '1';
- gmii_gtc_clk <= '0';
- gmii_tx_data <= (others => '0');
- gmii_tx_en <= '0';
- gmii_txer <= '0';
- gbe_rst_n <= '1';
- gbe_mdc <= '1';
- sam_cen <= '1';
- sam_oen <= '1';
- sam_wen <= '1';
- sam_a <= (others => '0');
- sam_reset_n <= '1';
- exp1_se_clk_out <= '0';
- exp1_diff_clk_out_p <= '0';
- exp1_diff_clk_out_n <= '1';
- cpu_tdo <= '1';
-
-end architecture rtl;
-
diff --git a/hw_v5_fx30t_extension/bsp/top.xst b/hw_v5_fx30t_extension/bsp/top.xst
deleted file mode 100644
index a3b6123..0000000
--- a/hw_v5_fx30t_extension/bsp/top.xst
+++ /dev/null
@@ -1,60 +0,0 @@
-set -tmpdir "tmp"
-set -xsthdpdir "xst"
-run
--ifn ../top.prj
--ifmt mixed
--ofn top
--ofmt NGC
--p xc5vfx30t-1-ff665
--top top
--opt_mode Speed
--opt_level 1
--power NO
--iuc NO
--keep_hierarchy No
--netlist_hierarchy As_Optimized
--rtlview Yes
--glob_opt AllClockNets
--read_cores YES
--write_timing_constraints NO
--cross_clock_analysis NO
--hierarchy_separator /
--bus_delimiter <>
--case Maintain
--slice_utilization_ratio 100
--bram_utilization_ratio 100
--dsp_utilization_ratio 100
--lc Off
--reduce_control_sets Off
--verilog2001 YES
--fsm_extract YES -fsm_encoding Auto
--safe_implementation No
--fsm_style LUT
--ram_extract Yes
--ram_style Auto
--rom_extract Yes
--mux_style Auto
--decoder_extract YES
--priority_extract Yes
--shreg_extract YES
--shift_extract YES
--xor_collapse YES
--rom_style Auto
--auto_bram_packing NO
--mux_extract Yes
--resource_sharing YES
--async_to_sync NO
--use_dsp48 Auto
--iobuf YES
--max_fanout 100000
--bufg 32
--register_duplication YES
--register_balancing No
--slice_packing YES
--optimize_primitives NO
--use_clock_enable Auto
--use_sync_set Auto
--use_sync_reset Auto
--iob Auto
--equivalent_register_removal YES
--slice_utilization_ratio_maxmargin 5
diff --git a/hw_v5_fx30t_extension/future_extension/Audio_codec/see_altium_data_sheet.txt b/hw_v5_fx30t_extension/future_extension/Audio_codec/see_altium_data_sheet.txt
deleted file mode 100644
index e69de29..0000000
--- a/hw_v5_fx30t_extension/future_extension/Audio_codec/see_altium_data_sheet.txt
+++ /dev/null
diff --git a/hw_v5_fx30t_extension/future_extension/NanoBoard 3000XN Schematics (Xilinx variant).pdf b/hw_v5_fx30t_extension/future_extension/NanoBoard 3000XN Schematics (Xilinx variant).pdf
deleted file mode 100644
index eaca66e..0000000
--- a/hw_v5_fx30t_extension/future_extension/NanoBoard 3000XN Schematics (Xilinx variant).pdf
+++ /dev/null
Binary files differ
diff --git a/hw_v5_fx30t_extension/future_extension/PS2/pins.txt b/hw_v5_fx30t_extension/future_extension/PS2/pins.txt
deleted file mode 100644
index 24e572f..0000000
--- a/hw_v5_fx30t_extension/future_extension/PS2/pins.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-data 1
-clock 1
-
-sum 2
diff --git a/hw_v5_fx30t_extension/future_extension/PS2/ps2.png b/hw_v5_fx30t_extension/future_extension/PS2/ps2.png
deleted file mode 100644
index 829e696..0000000
--- a/hw_v5_fx30t_extension/future_extension/PS2/ps2.png
+++ /dev/null
Binary files differ
diff --git a/hw_v5_fx30t_extension/future_extension/PS2/ps2_connector.png b/hw_v5_fx30t_extension/future_extension/PS2/ps2_connector.png
deleted file mode 100644
index a39c9e2..0000000
--- a/hw_v5_fx30t_extension/future_extension/PS2/ps2_connector.png
+++ /dev/null
Binary files differ
diff --git a/hw_v5_fx30t_extension/future_extension/SD_card/pins.txt b/hw_v5_fx30t_extension/future_extension/SD_card/pins.txt
deleted file mode 100644
index 6dd09f7..0000000
--- a/hw_v5_fx30t_extension/future_extension/SD_card/pins.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-protect 1
-detect 1
-cmd 1
-clk 1
-data 4
-
-sum 8
diff --git a/hw_v5_fx30t_extension/future_extension/VGA_out/pins.txt b/hw_v5_fx30t_extension/future_extension/VGA_out/pins.txt
deleted file mode 100644
index cb7f392..0000000
--- a/hw_v5_fx30t_extension/future_extension/VGA_out/pins.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-red 8
-green 8
-blue 8
-hsync 1
-vsync 1
-dac_clk 1
-
-sum 27
diff --git a/hw_v5_fx30t_extension/future_extension/VGA_out/vga_connector.png b/hw_v5_fx30t_extension/future_extension/VGA_out/vga_connector.png
deleted file mode 100644
index fd31718..0000000
--- a/hw_v5_fx30t_extension/future_extension/VGA_out/vga_connector.png
+++ /dev/null
Binary files differ
diff --git a/hw_v5_fx30t_extension/future_extension/VGA_out/vga_out.png b/hw_v5_fx30t_extension/future_extension/VGA_out/vga_out.png
deleted file mode 100644
index 2e777e5..0000000
--- a/hw_v5_fx30t_extension/future_extension/VGA_out/vga_out.png
+++ /dev/null
Binary files differ
diff --git a/hw_v5_fx30t_extension/future_extension/VGA_out/video_dac.png b/hw_v5_fx30t_extension/future_extension/VGA_out/video_dac.png
deleted file mode 100644
index 9ad137e..0000000
--- a/hw_v5_fx30t_extension/future_extension/VGA_out/video_dac.png
+++ /dev/null
Binary files differ
diff --git a/hw_v5_fx30t_extension/readme.txt b/hw_v5_fx30t_extension/readme.txt
deleted file mode 100644
index ad96102..0000000
--- a/hw_v5_fx30t_extension/readme.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-done:
-ucf und top angelegt
-LED leuchten auf Tastendruck
-Desing läuft aus dem BPI-Flash
-
-todo:
-grlib mit folgender IP:
-RS232
-USB-UART
-GPIO (LED switch button)
-Flash 8Mx16
-DDR2 16Mx32
-Ethernet (10/100/1000)
-Sysace? eher nicht -> 28 Pins extra
-
-Portierung ZPU + grlib (Größe + Geschwindigkeit)
-Portierung LEON3 + grlib (Größe + Geschwindigkeit)
-Portierung PPC + grlib (Größe + Geschwindigkeit)
diff --git a/hw_v5_fx30t_extension/rtl/top.vhd b/hw_v5_fx30t_extension/rtl/top.vhd
deleted file mode 100644
index 34c82b8..0000000
--- a/hw_v5_fx30t_extension/rtl/top.vhd
+++ /dev/null
@@ -1,144 +0,0 @@
-
-library ieee;
-use ieee.std_logic_1164.all;
-
-library unisim;
-use unisim.vcomponents.ibufds;
-
-
-
-entity top is
- port
- (
- sys_clk : in std_logic; -- 100 MHz clock
- clk_socket : in std_logic; -- user clock
- --sys_rst : in std_logic;
- --
- -- RS232
- RS232_RX : in std_logic;
- RS232_TX : out std_logic;
- -- RS232_USB
- RS232_USB_RX : in std_logic;
- RS232_USB_TX : out std_logic;
- RS232_USB_reset_dummy : out std_logic;
- --
- GPIO_LED_out : out std_logic_vector(7 downto 0);
- GPIO_DIPswitch_in : in std_logic_vector(7 downto 0);
- GPIO_button_in : in std_logic_vector(3 downto 0);
- --
- -- FLASH_8Mx16
- FLASH_8Mx16_Mem_A : out std_logic_vector(31 downto 7);
- FLASH_8Mx16_Mem_DQ : inout std_logic_vector(15 downto 0);
- FLASH_8Mx16_Mem_WEN : out std_logic;
- FLASH_8Mx16_Mem_OEN : out std_logic_vector(0 downto 0);
- FLASH_8Mx16_Mem_CEN : out std_logic_vector(0 downto 0);
- FLASH_8Mx16_rpn_dummy : out std_logic;
- --FLASH_8Mx16_byte_dummy : std_logic;
- --FLASH_8Mx16_adv_dummy : std_logic;
- --FLASH_8Mx16_clk_dummy : std_logic;
- --FLASH_8Mx16_wait_dummy : std_logic;
- --
- -- DDR2_SDRAM_16Mx32
- DDR2_SDRAM_16Mx32_DDR2_ODT : in std_logic_vector( 0 downto 0);
- DDR2_SDRAM_16Mx32_DDR2_A : out std_logic_vector(12 downto 0);
- DDR2_SDRAM_16Mx32_DDR2_BA : out std_logic_vector( 1 downto 0);
- DDR2_SDRAM_16Mx32_DDR2_CAS_N : out std_logic;
- DDR2_SDRAM_16Mx32_DDR2_CKE : out std_logic;
- DDR2_SDRAM_16Mx32_DDR2_CS_N : out std_logic;
- DDR2_SDRAM_16Mx32_DDR2_RAS_N : out std_logic;
- DDR2_SDRAM_16Mx32_DDR2_WE_N : out std_logic;
- DDR2_SDRAM_16Mx32_DDR2_DM : out std_logic_vector( 3 downto 0);
- DDR2_SDRAM_16Mx32_DDR2_DQS : inout std_logic_vector( 3 downto 0);
- DDR2_SDRAM_16Mx32_DDR2_DQS_N : inout std_logic_vector( 3 downto 0);
- DDR2_SDRAM_16Mx32_DDR2_DQ : inout std_logic_vector(31 downto 0);
- DDR2_SDRAM_16Mx32_DDR2_CK : in std_logic_vector( 1 downto 0);
- DDR2_SDRAM_16Mx32_DDR2_CK_N : in std_logic_vector( 1 downto 0);
- --
- -- Ethernet_MAC
- Ethernet_MAC_DUMMY_ETH_TXER : out std_logic;
- Ethernet_MAC_PHY_tx_clk : in std_logic; -- 25 MHz
- Ethernet_MAC_PHY_rx_clk : in std_logic; -- 25 MHz
- Ethernet_MAC_PHY_crs : in std_logic;
- Ethernet_MAC_PHY_dv : in std_logic;
- Ethernet_MAC_PHY_rx_data : in std_logic_vector(3 downto 0);
- Ethernet_MAC_PHY_col : in std_logic;
- Ethernet_MAC_PHY_rx_er : in std_logic;
- Ethernet_MAC_PHY_tx_en : out std_logic;
- Ethernet_MAC_PHY_tx_data : out std_logic_vector(3 downto 0);
- Ethernet_MAC_PHY_rst_n : out std_logic;
- Ethernet_MAC_PHY_Mii_clk : out std_logic;
- Ethernet_MAC_PHY_Mii_data : inout std_logic;
- --
- -- SysACE_CompactFlash
- SysACE_CompactFlash_SysACE_CLK : in std_logic;
- SysACE_CompactFlash_SysACE_MPA : out std_logic_vector( 6 downto 0);
- SysACE_CompactFlash_SysACE_MPD : inout std_logic_vector(15 downto 0);
- SysACE_CompactFlash_SysACE_CEN : out std_logic;
- SysACE_CompactFlash_SysACE_OEN : out std_logic;
- SysACE_CompactFlash_SysACE_WEN : out std_logic;
- SysACE_CompactFlash_SysACE_MPIRQ : in std_logic
- );
-end entity top;
-
-
-architecture rtl of top is
-
- signal ibufds_i0_o : std_ulogic;
- signal ibufds_i1_o : std_ulogic;
-
-begin
-
- ibufds_i0 : ibufds
- generic map (
- diff_term => true
- )
- port map (
- o => ibufds_i0_o,
- i => DDR2_SDRAM_16Mx32_DDR2_CK(0),
- ib => DDR2_SDRAM_16Mx32_DDR2_CK_N(0)
- );
-
- ibufds_i1 : ibufds
- generic map (
- diff_term => true
- )
- port map (
- o => ibufds_i1_o,
- i => DDR2_SDRAM_16Mx32_DDR2_CK(1),
- ib => DDR2_SDRAM_16Mx32_DDR2_CK_N(1)
- );
-
- -- some default assignments
- -- to pass bitgen DRC
- RS232_TX <= '1';
- RS232_USB_TX <= '1';
- RS232_USB_reset_dummy <= '0';
- FLASH_8Mx16_Mem_CEN <= "1";
- FLASH_8Mx16_Mem_OEN <= "1";
- FLASH_8Mx16_Mem_WEN <= '1';
- FLASH_8Mx16_rpn_dummy <= '1';
- FLASH_8Mx16_Mem_A <= (others => '0');
- DDR2_SDRAM_16Mx32_DDR2_A <= (others => '0');
- DDR2_SDRAM_16Mx32_DDR2_BA <= (others => '0');
- DDR2_SDRAM_16Mx32_DDR2_DM <= (others => '0');
- DDR2_SDRAM_16Mx32_DDR2_CS_N <= '1';
- DDR2_SDRAM_16Mx32_DDR2_WE_N <= '1';
- DDR2_SDRAM_16Mx32_DDR2_CKE <= '1';
- DDR2_SDRAM_16Mx32_DDR2_CAS_N <= '1';
- DDR2_SDRAM_16Mx32_DDR2_RAS_N <= '1';
- Ethernet_MAC_PHY_rst_n <= '1';
- Ethernet_MAC_PHY_tx_data <= (others => '0');
- Ethernet_MAC_PHY_tx_en <= '0';
- Ethernet_MAC_DUMMY_ETH_TXER <= '0';
- Ethernet_MAC_PHY_Mii_clk <= '1';
- SysACE_CompactFlash_SysACE_CEN <= '1';
- SysACE_CompactFlash_SysACE_OEN <= '1';
- SysACE_CompactFlash_SysACE_WEN <= '1';
- SysACE_CompactFlash_SysACE_MPA <= (others => '0');
-
-
- -- small function:
- GPIO_LED_out <= GPIO_DIPswitch_in when GPIO_button_in(0) = '0' else not GPIO_DIPswitch_in;
-
-end architecture rtl;
-
diff --git a/hw_v5_fx30t_extension/simulation/Makefile b/hw_v5_fx30t_extension/simulation/Makefile
deleted file mode 100644
index e1185a8..0000000
--- a/hw_v5_fx30t_extension/simulation/Makefile
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-# $HeadURL: https://svn.fzd.de/repo/concast/FWF_Projects/FWKE/beam_position_monitor/hardware/board_sp605/simulation/Makefile $
-# $Date$
-# $Author$
-# $Revision$
-#
-
-library = work
-top = top
-
-library_list = $(shell cut --field 1 --delimiter=" " --only-delimited vhdl_files.txt | grep --invert "\#" | sort --unique)
-
-# http://sourceforge.net/projects/vmk/
-VMK = vmk
-
-all: compile simulate
-
-
-compile: Makefile.msim
- export ANAFLAGS="-quiet -2008"; \
- make -f Makefile.msim | ccze -A
-
-
-simulate:
- export top=$(top); \
- vsim -quiet -gui $(library).$(top) -do run.do -nowlfmcl -l transcript.log
-
-
-clean:
- rm -f transcript
- rm -f *.wlf
- rm -f wlf*
- @#
- -make -f Makefile.msim clean
- rm -f Makefile.msim
- rm -f .stamp
- rm -rf $(library_list)
-
-
-# generate Makefile.msim with vmk
-Makefile.msim: vhdl_files.txt $(library_list)
- $(VMK) -t modelsim -O -w $(library) -F vhdl_files.txt
-
-$(library_list):
- vlib $@
-
diff --git a/hw_v5_fx30t_extension/simulation/run.do b/hw_v5_fx30t_extension/simulation/run.do
deleted file mode 100644
index 339fac7..0000000
--- a/hw_v5_fx30t_extension/simulation/run.do
+++ /dev/null
@@ -1,65 +0,0 @@
-
-#
-# helper functions
-#
-
-# restart + run
-proc r {} {
- restart -f
- set sim_start [clock seconds]
-
- run -all
-
- puts "# simulation run time: [clock format [expr [clock seconds] - $sim_start] -gmt 1 -format %H:%M:%S] "
-}
-
-
-# restart with clear
-proc rc {} {
- .main clear
- r
-}
-
-# print varables
-proc my_debug {} {
- global env
- foreach key [array names env] {
- puts "$key=$env($key)"
- }
-}
-
-
-# fast exit
-proc e {} {
- exit -force
-}
-
-# fast exit
-proc x {} {
- exit -force
-}
-
-
-# get env variables
-global env
-quietly set top $env(top)
-
-
-if {[file exists wave.do]} {
- do wave.do
-} else {
- if {[file exists wave_$top.do]} {
- do wave_$top.do
- } else {
- puts "INFO: no wave file (wave_$top.do) found"
- }
- puts "INFO: no wave file (wave.do) found"
-}
-
-
-
-set sim_start [clock seconds]
-
-run -all
-
-puts "# simulation run time: [clock format [expr [clock seconds] - $sim_start] -gmt 1 -format %H:%M:%S] "
diff --git a/hw_v5_fx30t_extension/simulation/vhdl_files.txt b/hw_v5_fx30t_extension/simulation/vhdl_files.txt
deleted file mode 100644
index a994fc5..0000000
--- a/hw_v5_fx30t_extension/simulation/vhdl_files.txt
+++ /dev/null
@@ -1 +0,0 @@
-work ../rtl/top.vhd
diff --git a/ieee_proposed/doc/link.txt b/ieee_proposed/doc/link.txt
deleted file mode 100644
index a34854d..0000000
--- a/ieee_proposed/doc/link.txt
+++ /dev/null
@@ -1 +0,0 @@
-http://www.eda-stds.org/fphdl/
diff --git a/ieee_proposed/rtl/env_c.vhd b/ieee_proposed/rtl/env_c.vhd
deleted file mode 100644
index e6703fa..0000000
--- a/ieee_proposed/rtl/env_c.vhd
+++ /dev/null
@@ -1,48 +0,0 @@
-package ENV is
-
- procedure STOP (STATUS : INTEGER);
- procedure FINISH (STATUS : INTEGER);
-
- function RESOLUTION_LIMIT return DELAY_LENGTH;
-
-end package ENV;
-library ieee_proposed;
-use ieee_proposed.standard_additions.all;
-package body ENV is
-
- procedure STOP (STATUS : INTEGER) is
- begin
- report "Procedure STOP called with status: " & INTEGER'image(STATUS)
- severity failure;
- end procedure STOP;
- procedure FINISH (STATUS : INTEGER) is
- begin
- report "Procedure FINISH called with status: " & INTEGER'image(STATUS)
- severity failure;
- end procedure FINISH;
-
- constant BASE_TIME_ARRAY : time_vector :=
- (
- 1 fs, 10 fs, 100 fs,
- 1 ps, 10 ps, 100 ps,
- 1 ns, 10 ns, 100 ns,
- 1 us, 10 us, 100 us,
- 1 ms, 10 ms, 100 ms,
- 1 sec, 10 sec, 100 sec,
- 1 min, 10 min, 100 min,
- 1 hr, 10 hr, 100 hr
- ) ;
-
- function RESOLUTION_LIMIT return DELAY_LENGTH is
- begin
- for i in BASE_TIME_ARRAY'range loop
- if BASE_TIME_ARRAY(i) > 0 hr then
- return BASE_TIME_ARRAY(i);
- end if;
- end loop;
- report "STANDATD.RESOLUTION_LIMIT: Simulator resolution not less than 100 hr"
- severity failure;
- return 1 ns;
- end function RESOLUTION_LIMIT;
-
-end package body ENV;
diff --git a/ieee_proposed/rtl/fixed_float_types_c.vhd b/ieee_proposed/rtl/fixed_float_types_c.vhd
deleted file mode 100644
index 315b628..0000000
--- a/ieee_proposed/rtl/fixed_float_types_c.vhd
+++ /dev/null
@@ -1,34 +0,0 @@
--- --------------------------------------------------------------------
--- "fixed_float_types" package contains types used in the fixed and floating
--- point packages..
--- Please see the documentation for the floating point package.
--- This package should be compiled into "ieee_proposed" and used as follows:
---
--- This verison is designed to work with the VHDL-93 compilers. Please
--- note the "%%%" comments. These are where we diverge from the
--- VHDL-200X LRM.
---
--- --------------------------------------------------------------------
--- Version : $Revision: 1.21 $
--- Date : $Date: 2007-09-11 14:52:13-04 $
--- --------------------------------------------------------------------
-
-package fixed_float_types is
-
- -- Types used for generics of fixed_generic_pkg
-
- type fixed_round_style_type is (fixed_round, fixed_truncate);
-
- type fixed_overflow_style_type is (fixed_saturate, fixed_wrap);
-
- -- Type used for generics of float_generic_pkg
-
- -- These are the same as the C FE_TONEAREST, FE_UPWARD, FE_DOWNWARD,
- -- and FE_TOWARDZERO floating point rounding macros.
-
- type round_type is (round_nearest, -- Default, nearest LSB '0'
- round_inf, -- Round toward positive infinity
- round_neginf, -- Round toward negative infinity
- round_zero); -- Round toward zero (truncate)
-
-end package fixed_float_types;
diff --git a/ieee_proposed/rtl/fixed_pkg_c.vhd b/ieee_proposed/rtl/fixed_pkg_c.vhd
deleted file mode 100644
index bb32709..0000000
--- a/ieee_proposed/rtl/fixed_pkg_c.vhd
+++ /dev/null
@@ -1,8390 +0,0 @@
--- --------------------------------------------------------------------
--- "fixed_pkg_c.vhdl" package contains functions for fixed point math.
--- Please see the documentation for the fixed point package.
--- This package should be compiled into "ieee_proposed" and used as follows:
--- use ieee.std_logic_1164.all;
--- use ieee.numeric_std.all;
--- use ieee_proposed.fixed_float_types.all;
--- use ieee_proposed.fixed_pkg.all;
---
--- This verison is designed to work with the VHDL-93 compilers
--- synthesis tools. Please note the "%%%" comments. These are where we
--- diverge from the VHDL-200X LRM.
--- --------------------------------------------------------------------
--- Version : $Revision: 1.21 $
--- Date : $Date: 2007/09/26 18:08:53 $
--- --------------------------------------------------------------------
-
-use STD.TEXTIO.all;
-library IEEE;
-use IEEE.STD_LOGIC_1164.all;
-use IEEE.NUMERIC_STD.all;
-library IEEE_PROPOSED;
-use IEEE_PROPOSED.fixed_float_types.all;
-
-package fixed_pkg is
--- generic (
- -- Rounding routine to use in fixed point, fixed_round or fixed_truncate
- constant fixed_round_style : fixed_round_style_type := fixed_round;
- -- Overflow routine to use in fixed point, fixed_saturate or fixed_wrap
- constant fixed_overflow_style : fixed_overflow_style_type := fixed_saturate;
- -- Extra bits used in divide routines
- constant fixed_guard_bits : NATURAL := 3;
- -- If TRUE, then turn off warnings on "X" propagation
- constant no_warning : BOOLEAN := (false
- );
-
- -- Author David Bishop (dbishop@vhdl.org)
-
- -- base Unsigned fixed point type, downto direction assumed
- type UNRESOLVED_ufixed is array (INTEGER range <>) of STD_ULOGIC;
- -- base Signed fixed point type, downto direction assumed
- type UNRESOLVED_sfixed is array (INTEGER range <>) of STD_ULOGIC;
-
- subtype U_ufixed is UNRESOLVED_ufixed;
- subtype U_sfixed is UNRESOLVED_sfixed;
-
- subtype ufixed is UNRESOLVED_ufixed;
- subtype sfixed is UNRESOLVED_sfixed;
-
- --===========================================================================
- -- Arithmetic Operators:
- --===========================================================================
-
- -- Absolute value, 2's complement
- -- abs sfixed(a downto b) = sfixed(a+1 downto b)
- function "abs" (arg : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
-
- -- Negation, 2's complement
- -- - sfixed(a downto b) = sfixed(a+1 downto b)
- function "-" (arg : UNRESOLVED_sfixed)return UNRESOLVED_sfixed;
-
- -- Addition
- -- ufixed(a downto b) + ufixed(c downto d)
- -- = ufixed(maximum(a,c)+1 downto minimum(b,d))
- function "+" (l, r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
-
- -- sfixed(a downto b) + sfixed(c downto d)
- -- = sfixed(maximum(a,c)+1 downto minimum(b,d))
- function "+" (l, r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
-
- -- Subtraction
- -- ufixed(a downto b) - ufixed(c downto d)
- -- = ufixed(maximum(a,c)+1 downto minimum(b,d))
- function "-" (l, r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
-
- -- sfixed(a downto b) - sfixed(c downto d)
- -- = sfixed(maximum(a,c)+1 downto minimum(b,d))
- function "-" (l, r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
-
- -- Multiplication
- -- ufixed(a downto b) * ufixed(c downto d) = ufixed(a+c+1 downto b+d)
- function "*" (l, r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
-
- -- sfixed(a downto b) * sfixed(c downto d) = sfixed(a+c+1 downto b+d)
- function "*" (l, r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
-
- -- Division
- -- ufixed(a downto b) / ufixed(c downto d) = ufixed(a-d downto b-c-1)
--- function "/" (l, r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
-
- -- sfixed(a downto b) / sfixed(c downto d) = sfixed(a-d+1 downto b-c)
--- function "/" (l, r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
-
- -- Remainder
- -- ufixed (a downto b) rem ufixed (c downto d)
- -- = ufixed (minimum(a,c) downto minimum(b,d))
--- function "rem" (l, r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
-
- -- sfixed (a downto b) rem sfixed (c downto d)
- -- = sfixed (minimum(a,c) downto minimum(b,d))
--- function "rem" (l, r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
-
- -- Modulo
- -- ufixed (a downto b) mod ufixed (c downto d)
- -- = ufixed (minimum(a,c) downto minimum(b, d))
--- function "mod" (l, r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
-
- -- sfixed (a downto b) mod sfixed (c downto d)
- -- = sfixed (c downto minimum(b, d))
--- function "mod" (l, r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
-
- ----------------------------------------------------------------------------
- -- In these routines the "real" or "natural" (integer)
- -- are converted into a fixed point number and then the operation is
- -- performed. It is assumed that the array will be large enough.
- -- If the input is "real" then the real number is converted into a fixed of
- -- the same size as the fixed point input. If the number is an "integer"
- -- then it is converted into fixed with the range (l'high downto 0).
- ----------------------------------------------------------------------------
-
- -- ufixed(a downto b) + ufixed(a downto b) = ufixed(a+1 downto b)
- function "+" (l : UNRESOLVED_ufixed; r : REAL) return UNRESOLVED_ufixed;
-
- -- ufixed(c downto d) + ufixed(c downto d) = ufixed(c+1 downto d)
- function "+" (l : REAL; r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
-
- -- ufixed(a downto b) + ufixed(a downto 0) = ufixed(a+1 downto minimum(0,b))
- function "+" (l : UNRESOLVED_ufixed; r : NATURAL) return UNRESOLVED_ufixed;
-
- -- ufixed(a downto 0) + ufixed(c downto d) = ufixed(c+1 downto minimum(0,d))
- function "+" (l : NATURAL; r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
-
- -- ufixed(a downto b) - ufixed(a downto b) = ufixed(a+1 downto b)
- function "-" (l : UNRESOLVED_ufixed; r : REAL) return UNRESOLVED_ufixed;
-
- -- ufixed(c downto d) - ufixed(c downto d) = ufixed(c+1 downto d)
- function "-" (l : REAL; r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
-
- -- ufixed(a downto b) - ufixed(a downto 0) = ufixed(a+1 downto minimum(0,b))
- function "-" (l : UNRESOLVED_ufixed; r : NATURAL) return UNRESOLVED_ufixed;
-
- -- ufixed(a downto 0) + ufixed(c downto d) = ufixed(c+1 downto minimum(0,d))
- function "-" (l : NATURAL; r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
-
- -- ufixed(a downto b) * ufixed(a downto b) = ufixed(2a+1 downto 2b)
- function "*" (l : UNRESOLVED_ufixed; r : REAL) return UNRESOLVED_ufixed;
-
- -- ufixed(c downto d) * ufixed(c downto d) = ufixed(2c+1 downto 2d)
- function "*" (l : REAL; r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
-
- -- ufixed (a downto b) * ufixed (a downto 0) = ufixed (2a+1 downto b)
- function "*" (l : UNRESOLVED_ufixed; r : NATURAL) return UNRESOLVED_ufixed;
-
- -- ufixed (a downto b) * ufixed (a downto 0) = ufixed (2a+1 downto b)
- function "*" (l : NATURAL; r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
-
- -- ufixed(a downto b) / ufixed(a downto b) = ufixed(a-b downto b-a-1)
--- function "/" (l : UNRESOLVED_ufixed; r : REAL) return UNRESOLVED_ufixed;
-
--- -- ufixed(a downto b) / ufixed(a downto b) = ufixed(a-b downto b-a-1)
--- function "/" (l : REAL; r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
-
- -- ufixed(a downto b) / ufixed(a downto 0) = ufixed(a downto b-a-1)
--- function "/" (l : UNRESOLVED_ufixed; r : NATURAL) return UNRESOLVED_ufixed;
-
- -- ufixed(c downto 0) / ufixed(c downto d) = ufixed(c-d downto -c-1)
--- function "/" (l : NATURAL; r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
-
- -- ufixed (a downto b) rem ufixed (a downto b) = ufixed (a downto b)
--- function "rem" (l : UNRESOLVED_ufixed; r : REAL) return UNRESOLVED_ufixed;
-
--- -- ufixed (c downto d) rem ufixed (c downto d) = ufixed (c downto d)
--- function "rem" (l : REAL; r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
-
--- -- ufixed (a downto b) rem ufixed (a downto 0) = ufixed (a downto minimum(b,0))
--- function "rem" (l : UNRESOLVED_ufixed; r : NATURAL) return UNRESOLVED_ufixed;
-
--- -- ufixed (c downto 0) rem ufixed (c downto d) = ufixed (c downto minimum(d,0))
--- function "rem" (l : NATURAL; r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
-
--- -- ufixed (a downto b) mod ufixed (a downto b) = ufixed (a downto b)
--- function "mod" (l : UNRESOLVED_ufixed; r : REAL) return UNRESOLVED_ufixed;
-
--- -- ufixed (c downto d) mod ufixed (c downto d) = ufixed (c downto d)
--- function "mod" (l : REAL; r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
-
--- -- ufixed (a downto b) mod ufixed (a downto 0) = ufixed (a downto minimum(b,0))
--- function "mod" (l : UNRESOLVED_ufixed; r : NATURAL) return UNRESOLVED_ufixed;
-
--- -- ufixed (c downto 0) mod ufixed (c downto d) = ufixed (c downto minimum(d,0))
--- function "mod" (l : NATURAL; r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
-
- -- sfixed(a downto b) + sfixed(a downto b) = sfixed(a+1 downto b)
- function "+" (l : UNRESOLVED_sfixed; r : REAL) return UNRESOLVED_sfixed;
-
- -- sfixed(c downto d) + sfixed(c downto d) = sfixed(c+1 downto d)
- function "+" (l : REAL; r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
-
- -- sfixed(a downto b) + sfixed(a downto 0) = sfixed(a+1 downto minimum(0,b))
- function "+" (l : UNRESOLVED_sfixed; r : INTEGER) return UNRESOLVED_sfixed;
-
- -- sfixed(c downto 0) + sfixed(c downto d) = sfixed(c+1 downto minimum(0,d))
- function "+" (l : INTEGER; r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
-
- -- sfixed(a downto b) - sfixed(a downto b) = sfixed(a+1 downto b)
- function "-" (l : UNRESOLVED_sfixed; r : REAL) return UNRESOLVED_sfixed;
-
- -- sfixed(c downto d) - sfixed(c downto d) = sfixed(c+1 downto d)
- function "-" (l : REAL; r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
-
- -- sfixed(a downto b) - sfixed(a downto 0) = sfixed(a+1 downto minimum(0,b))
- function "-" (l : UNRESOLVED_sfixed; r : INTEGER) return UNRESOLVED_sfixed;
-
- -- sfixed(c downto 0) - sfixed(c downto d) = sfixed(c+1 downto minimum(0,d))
- function "-" (l : INTEGER; r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
-
- -- sfixed(a downto b) * sfixed(a downto b) = sfixed(2a+1 downto 2b)
- function "*" (l : UNRESOLVED_sfixed; r : REAL) return UNRESOLVED_sfixed;
-
- -- sfixed(c downto d) * sfixed(c downto d) = sfixed(2c+1 downto 2d)
- function "*" (l : REAL; r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
-
- -- sfixed(a downto b) * sfixed(a downto 0) = sfixed(2a+1 downto b)
- function "*" (l : UNRESOLVED_sfixed; r : INTEGER) return UNRESOLVED_sfixed;
-
- -- sfixed(c downto 0) * sfixed(c downto d) = sfixed(2c+1 downto d)
- function "*" (l : INTEGER; r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
-
- -- sfixed(a downto b) / sfixed(a downto b) = sfixed(a-b+1 downto b-a)
--- function "/" (l : UNRESOLVED_sfixed; r : REAL) return UNRESOLVED_sfixed;
-
- -- sfixed(c downto d) / sfixed(c downto d) = sfixed(c-d+1 downto d-c)
--- function "/" (l : REAL; r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
-
- -- sfixed(a downto b) / sfixed(a downto 0) = sfixed(a+1 downto b-a)
--- function "/" (l : UNRESOLVED_sfixed; r : INTEGER) return UNRESOLVED_sfixed;
-
- -- sfixed(c downto 0) / sfixed(c downto d) = sfixed(c-d+1 downto -c)
--- function "/" (l : INTEGER; r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
-
- -- sfixed (a downto b) rem sfixed (a downto b) = sfixed (a downto b)
--- function "rem" (l : UNRESOLVED_sfixed; r : REAL) return UNRESOLVED_sfixed;
-
--- -- sfixed (c downto d) rem sfixed (c downto d) = sfixed (c downto d)
--- function "rem" (l : REAL; r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
-
--- -- sfixed (a downto b) rem sfixed (a downto 0) = sfixed (a downto minimum(b,0))
--- function "rem" (l : UNRESOLVED_sfixed; r : INTEGER) return UNRESOLVED_sfixed;
-
--- -- sfixed (c downto 0) rem sfixed (c downto d) = sfixed (c downto minimum(d,0))
--- function "rem" (l : INTEGER; r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
-
--- -- sfixed (a downto b) mod sfixed (a downto b) = sfixed (a downto b)
--- function "mod" (l : UNRESOLVED_sfixed; r : REAL) return UNRESOLVED_sfixed;
-
--- -- sfixed (c downto d) mod sfixed (c downto d) = sfixed (c downto d)
--- function "mod" (l : REAL; r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
-
--- -- sfixed (a downto b) mod sfixed (a downto 0) = sfixed (a downto minimum(b,0))
--- function "mod" (l : UNRESOLVED_sfixed; r : INTEGER) return UNRESOLVED_sfixed;
-
--- -- sfixed (c downto 0) mod sfixed (c downto d) = sfixed (c downto minimum(d,0))
--- function "mod" (l : INTEGER; r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
-
- -- This version of divide gives the user more control
- -- ufixed(a downto b) / ufixed(c downto d) = ufixed(a-d downto b-c-1)
--- function divide (
--- l, r : UNRESOLVED_ufixed;
--- constant round_style : fixed_round_style_type := fixed_round_style;
--- constant guard_bits : NATURAL := fixed_guard_bits)
--- return UNRESOLVED_ufixed;
-
- -- This version of divide gives the user more control
- -- sfixed(a downto b) / sfixed(c downto d) = sfixed(a-d+1 downto b-c)
--- function divide (
--- l, r : UNRESOLVED_sfixed;
--- constant round_style : fixed_round_style_type := fixed_round_style;
--- constant guard_bits : NATURAL := fixed_guard_bits)
--- return UNRESOLVED_sfixed;
-
- -- These functions return 1/X
- -- 1 / ufixed(a downto b) = ufixed(-b downto -a-1)
--- function reciprocal (
--- arg : UNRESOLVED_ufixed; -- fixed point input
--- constant round_style : fixed_round_style_type := fixed_round_style;
--- constant guard_bits : NATURAL := fixed_guard_bits)
--- return UNRESOLVED_ufixed;
-
- -- 1 / sfixed(a downto b) = sfixed(-b+1 downto -a)
--- function reciprocal (
--- arg : UNRESOLVED_sfixed; -- fixed point input
--- constant round_style : fixed_round_style_type := fixed_round_style;
--- constant guard_bits : NATURAL := fixed_guard_bits)
--- return UNRESOLVED_sfixed;
-
- -- REM function
- -- ufixed (a downto b) rem ufixed (c downto d)
- -- = ufixed (minimum(a,c) downto minimum(b,d))
--- function remainder (
--- l, r : UNRESOLVED_ufixed;
--- constant round_style : fixed_round_style_type := fixed_round_style;
--- constant guard_bits : NATURAL := fixed_guard_bits)
--- return UNRESOLVED_ufixed;
-
- -- sfixed (a downto b) rem sfixed (c downto d)
- -- = sfixed (minimum(a,c) downto minimum(b,d))
--- function remainder (
--- l, r : UNRESOLVED_sfixed;
--- constant round_style : fixed_round_style_type := fixed_round_style;
--- constant guard_bits : NATURAL := fixed_guard_bits)
--- return UNRESOLVED_sfixed;
-
- -- mod function
- -- ufixed (a downto b) mod ufixed (c downto d)
- -- = ufixed (minimum(a,c) downto minimum(b, d))
--- function modulo (
--- l, r : UNRESOLVED_ufixed;
--- constant round_style : fixed_round_style_type := fixed_round_style;
--- constant guard_bits : NATURAL := fixed_guard_bits)
--- return UNRESOLVED_ufixed;
-
- -- sfixed (a downto b) mod sfixed (c downto d)
- -- = sfixed (c downto minimum(b, d))
--- function modulo (
--- l, r : UNRESOLVED_sfixed;
--- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
--- constant round_style : fixed_round_style_type := fixed_round_style;
--- constant guard_bits : NATURAL := fixed_guard_bits)
--- return UNRESOLVED_sfixed;
-
- -- Procedure for those who need an "accumulator" function.
- -- add_carry (ufixed(a downto b), ufixed (c downto d))
- -- = ufixed (maximum(a,c) downto minimum(b,d))
- procedure add_carry (
- L, R : in UNRESOLVED_ufixed;
- c_in : in STD_ULOGIC;
- result : out UNRESOLVED_ufixed;
- c_out : out STD_ULOGIC);
-
- -- add_carry (sfixed(a downto b), sfixed (c downto d))
- -- = sfixed (maximum(a,c) downto minimum(b,d))
- procedure add_carry (
- L, R : in UNRESOLVED_sfixed;
- c_in : in STD_ULOGIC;
- result : out UNRESOLVED_sfixed;
- c_out : out STD_ULOGIC);
-
- -- Scales the result by a power of 2. Width of input = width of output with
- -- the binary point moved.
- function scalb (y : UNRESOLVED_ufixed; N : INTEGER) return UNRESOLVED_ufixed;
- function scalb (y : UNRESOLVED_ufixed; N : SIGNED) return UNRESOLVED_ufixed;
- function scalb (y : UNRESOLVED_sfixed; N : INTEGER) return UNRESOLVED_sfixed;
- function scalb (y : UNRESOLVED_sfixed; N : SIGNED) return UNRESOLVED_sfixed;
-
- function Is_Negative (arg : UNRESOLVED_sfixed) return BOOLEAN;
-
- --===========================================================================
- -- Comparison Operators
- --===========================================================================
-
- function ">" (l, r : UNRESOLVED_ufixed) return BOOLEAN;
- function ">" (l, r : UNRESOLVED_sfixed) return BOOLEAN;
- function "<" (l, r : UNRESOLVED_ufixed) return BOOLEAN;
- function "<" (l, r : UNRESOLVED_sfixed) return BOOLEAN;
- function "<=" (l, r : UNRESOLVED_ufixed) return BOOLEAN;
- function "<=" (l, r : UNRESOLVED_sfixed) return BOOLEAN;
- function ">=" (l, r : UNRESOLVED_ufixed) return BOOLEAN;
- function ">=" (l, r : UNRESOLVED_sfixed) return BOOLEAN;
- function "=" (l, r : UNRESOLVED_ufixed) return BOOLEAN;
- function "=" (l, r : UNRESOLVED_sfixed) return BOOLEAN;
- function "/=" (l, r : UNRESOLVED_ufixed) return BOOLEAN;
- function "/=" (l, r : UNRESOLVED_sfixed) return BOOLEAN;
-
- function \?=\ (l, r : UNRESOLVED_ufixed) return STD_ULOGIC;
- function \?/=\ (l, r : UNRESOLVED_ufixed) return STD_ULOGIC;
- function \?>\ (l, r : UNRESOLVED_ufixed) return STD_ULOGIC;
- function \?>=\ (l, r : UNRESOLVED_ufixed) return STD_ULOGIC;
- function \?<\ (l, r : UNRESOLVED_ufixed) return STD_ULOGIC;
- function \?<=\ (l, r : UNRESOLVED_ufixed) return STD_ULOGIC;
- function \?=\ (l, r : UNRESOLVED_sfixed) return STD_ULOGIC;
- function \?/=\ (l, r : UNRESOLVED_sfixed) return STD_ULOGIC;
- function \?>\ (l, r : UNRESOLVED_sfixed) return STD_ULOGIC;
- function \?>=\ (l, r : UNRESOLVED_sfixed) return STD_ULOGIC;
- function \?<\ (l, r : UNRESOLVED_sfixed) return STD_ULOGIC;
- function \?<=\ (l, r : UNRESOLVED_sfixed) return STD_ULOGIC;
-
- function std_match (l, r : UNRESOLVED_ufixed) return BOOLEAN;
- function std_match (l, r : UNRESOLVED_sfixed) return BOOLEAN;
-
- -- Overloads the default "maximum" and "minimum" function
-
- function maximum (l, r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
- function minimum (l, r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
- function maximum (l, r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
- function minimum (l, r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
-
- ----------------------------------------------------------------------------
- -- In these compare functions a natural is converted into a
- -- fixed point number of the bounds "maximum(l'high,0) downto 0"
- ----------------------------------------------------------------------------
-
- function "=" (l : UNRESOLVED_ufixed; r : NATURAL) return BOOLEAN;
- function "/=" (l : UNRESOLVED_ufixed; r : NATURAL) return BOOLEAN;
- function ">=" (l : UNRESOLVED_ufixed; r : NATURAL) return BOOLEAN;
- function "<=" (l : UNRESOLVED_ufixed; r : NATURAL) return BOOLEAN;
- function ">" (l : UNRESOLVED_ufixed; r : NATURAL) return BOOLEAN;
- function "<" (l : UNRESOLVED_ufixed; r : NATURAL) return BOOLEAN;
-
- function "=" (l : NATURAL; r : UNRESOLVED_ufixed) return BOOLEAN;
- function "/=" (l : NATURAL; r : UNRESOLVED_ufixed) return BOOLEAN;
- function ">=" (l : NATURAL; r : UNRESOLVED_ufixed) return BOOLEAN;
- function "<=" (l : NATURAL; r : UNRESOLVED_ufixed) return BOOLEAN;
- function ">" (l : NATURAL; r : UNRESOLVED_ufixed) return BOOLEAN;
- function "<" (l : NATURAL; r : UNRESOLVED_ufixed) return BOOLEAN;
-
- function \?=\ (l : UNRESOLVED_ufixed; r : NATURAL) return STD_ULOGIC;
- function \?/=\ (l : UNRESOLVED_ufixed; r : NATURAL) return STD_ULOGIC;
- function \?>=\ (l : UNRESOLVED_ufixed; r : NATURAL) return STD_ULOGIC;
- function \?<=\ (l : UNRESOLVED_ufixed; r : NATURAL) return STD_ULOGIC;
- function \?>\ (l : UNRESOLVED_ufixed; r : NATURAL) return STD_ULOGIC;
- function \?<\ (l : UNRESOLVED_ufixed; r : NATURAL) return STD_ULOGIC;
-
- function \?=\ (l : NATURAL; r : UNRESOLVED_ufixed) return STD_ULOGIC;
- function \?/=\ (l : NATURAL; r : UNRESOLVED_ufixed) return STD_ULOGIC;
- function \?>=\ (l : NATURAL; r : UNRESOLVED_ufixed) return STD_ULOGIC;
- function \?<=\ (l : NATURAL; r : UNRESOLVED_ufixed) return STD_ULOGIC;
- function \?>\ (l : NATURAL; r : UNRESOLVED_ufixed) return STD_ULOGIC;
- function \?<\ (l : NATURAL; r : UNRESOLVED_ufixed) return STD_ULOGIC;
-
- function maximum (l : UNRESOLVED_ufixed; r : NATURAL)
- return UNRESOLVED_ufixed;
- function minimum (l : UNRESOLVED_ufixed; r : NATURAL)
- return UNRESOLVED_ufixed;
- function maximum (l : NATURAL; r : UNRESOLVED_ufixed)
- return UNRESOLVED_ufixed;
- function minimum (l : NATURAL; r : UNRESOLVED_ufixed)
- return UNRESOLVED_ufixed;
- ----------------------------------------------------------------------------
- -- In these compare functions a real is converted into a
- -- fixed point number of the bounds "l'high+1 downto l'low"
- ----------------------------------------------------------------------------
-
- function "=" (l : UNRESOLVED_ufixed; r : REAL) return BOOLEAN;
- function "/=" (l : UNRESOLVED_ufixed; r : REAL) return BOOLEAN;
- function ">=" (l : UNRESOLVED_ufixed; r : REAL) return BOOLEAN;
- function "<=" (l : UNRESOLVED_ufixed; r : REAL) return BOOLEAN;
- function ">" (l : UNRESOLVED_ufixed; r : REAL) return BOOLEAN;
- function "<" (l : UNRESOLVED_ufixed; r : REAL) return BOOLEAN;
-
- function "=" (l : REAL; r : UNRESOLVED_ufixed) return BOOLEAN;
- function "/=" (l : REAL; r : UNRESOLVED_ufixed) return BOOLEAN;
- function ">=" (l : REAL; r : UNRESOLVED_ufixed) return BOOLEAN;
- function "<=" (l : REAL; r : UNRESOLVED_ufixed) return BOOLEAN;
- function ">" (l : REAL; r : UNRESOLVED_ufixed) return BOOLEAN;
- function "<" (l : REAL; r : UNRESOLVED_ufixed) return BOOLEAN;
-
- function \?=\ (l : UNRESOLVED_ufixed; r : REAL) return STD_ULOGIC;
- function \?/=\ (l : UNRESOLVED_ufixed; r : REAL) return STD_ULOGIC;
- function \?>=\ (l : UNRESOLVED_ufixed; r : REAL) return STD_ULOGIC;
- function \?<=\ (l : UNRESOLVED_ufixed; r : REAL) return STD_ULOGIC;
- function \?>\ (l : UNRESOLVED_ufixed; r : REAL) return STD_ULOGIC;
- function \?<\ (l : UNRESOLVED_ufixed; r : REAL) return STD_ULOGIC;
-
- function \?=\ (l : REAL; r : UNRESOLVED_ufixed) return STD_ULOGIC;
- function \?/=\ (l : REAL; r : UNRESOLVED_ufixed) return STD_ULOGIC;
- function \?>=\ (l : REAL; r : UNRESOLVED_ufixed) return STD_ULOGIC;
- function \?<=\ (l : REAL; r : UNRESOLVED_ufixed) return STD_ULOGIC;
- function \?>\ (l : REAL; r : UNRESOLVED_ufixed) return STD_ULOGIC;
- function \?<\ (l : REAL; r : UNRESOLVED_ufixed) return STD_ULOGIC;
-
- function maximum (l : UNRESOLVED_ufixed; r : REAL) return UNRESOLVED_ufixed;
- function maximum (l : REAL; r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
- function minimum (l : UNRESOLVED_ufixed; r : REAL) return UNRESOLVED_ufixed;
- function minimum (l : REAL; r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
- ----------------------------------------------------------------------------
- -- In these compare functions an integer is converted into a
- -- fixed point number of the bounds "maximum(l'high,1) downto 0"
- ----------------------------------------------------------------------------
-
- function "=" (l : UNRESOLVED_sfixed; r : INTEGER) return BOOLEAN;
- function "/=" (l : UNRESOLVED_sfixed; r : INTEGER) return BOOLEAN;
- function ">=" (l : UNRESOLVED_sfixed; r : INTEGER) return BOOLEAN;
- function "<=" (l : UNRESOLVED_sfixed; r : INTEGER) return BOOLEAN;
- function ">" (l : UNRESOLVED_sfixed; r : INTEGER) return BOOLEAN;
- function "<" (l : UNRESOLVED_sfixed; r : INTEGER) return BOOLEAN;
-
- function "=" (l : INTEGER; r : UNRESOLVED_sfixed) return BOOLEAN;
- function "/=" (l : INTEGER; r : UNRESOLVED_sfixed) return BOOLEAN;
- function ">=" (l : INTEGER; r : UNRESOLVED_sfixed) return BOOLEAN;
- function "<=" (l : INTEGER; r : UNRESOLVED_sfixed) return BOOLEAN;
- function ">" (l : INTEGER; r : UNRESOLVED_sfixed) return BOOLEAN;
- function "<" (l : INTEGER; r : UNRESOLVED_sfixed) return BOOLEAN;
-
- function \?=\ (l : UNRESOLVED_sfixed; r : INTEGER) return STD_ULOGIC;
- function \?/=\ (l : UNRESOLVED_sfixed; r : INTEGER) return STD_ULOGIC;
- function \?>=\ (l : UNRESOLVED_sfixed; r : INTEGER) return STD_ULOGIC;
- function \?<=\ (l : UNRESOLVED_sfixed; r : INTEGER) return STD_ULOGIC;
- function \?>\ (l : UNRESOLVED_sfixed; r : INTEGER) return STD_ULOGIC;
- function \?<\ (l : UNRESOLVED_sfixed; r : INTEGER) return STD_ULOGIC;
-
- function \?=\ (l : INTEGER; r : UNRESOLVED_sfixed) return STD_ULOGIC;
- function \?/=\ (l : INTEGER; r : UNRESOLVED_sfixed) return STD_ULOGIC;
- function \?>=\ (l : INTEGER; r : UNRESOLVED_sfixed) return STD_ULOGIC;
- function \?<=\ (l : INTEGER; r : UNRESOLVED_sfixed) return STD_ULOGIC;
- function \?>\ (l : INTEGER; r : UNRESOLVED_sfixed) return STD_ULOGIC;
- function \?<\ (l : INTEGER; r : UNRESOLVED_sfixed) return STD_ULOGIC;
-
- function maximum (l : UNRESOLVED_sfixed; r : INTEGER)
- return UNRESOLVED_sfixed;
- function maximum (l : INTEGER; r : UNRESOLVED_sfixed)
- return UNRESOLVED_sfixed;
- function minimum (l : UNRESOLVED_sfixed; r : INTEGER)
- return UNRESOLVED_sfixed;
- function minimum (l : INTEGER; r : UNRESOLVED_sfixed)
- return UNRESOLVED_sfixed;
- ----------------------------------------------------------------------------
- -- In these compare functions a real is converted into a
- -- fixed point number of the bounds "l'high+1 downto l'low"
- ----------------------------------------------------------------------------
-
- function "=" (l : UNRESOLVED_sfixed; r : REAL) return BOOLEAN;
- function "/=" (l : UNRESOLVED_sfixed; r : REAL) return BOOLEAN;
- function ">=" (l : UNRESOLVED_sfixed; r : REAL) return BOOLEAN;
- function "<=" (l : UNRESOLVED_sfixed; r : REAL) return BOOLEAN;
- function ">" (l : UNRESOLVED_sfixed; r : REAL) return BOOLEAN;
- function "<" (l : UNRESOLVED_sfixed; r : REAL) return BOOLEAN;
-
- function "=" (l : REAL; r : UNRESOLVED_sfixed) return BOOLEAN;
- function "/=" (l : REAL; r : UNRESOLVED_sfixed) return BOOLEAN;
- function ">=" (l : REAL; r : UNRESOLVED_sfixed) return BOOLEAN;
- function "<=" (l : REAL; r : UNRESOLVED_sfixed) return BOOLEAN;
- function ">" (l : REAL; r : UNRESOLVED_sfixed) return BOOLEAN;
- function "<" (l : REAL; r : UNRESOLVED_sfixed) return BOOLEAN;
-
- function \?=\ (l : UNRESOLVED_sfixed; r : REAL) return STD_ULOGIC;
- function \?/=\ (l : UNRESOLVED_sfixed; r : REAL) return STD_ULOGIC;
- function \?>=\ (l : UNRESOLVED_sfixed; r : REAL) return STD_ULOGIC;
- function \?<=\ (l : UNRESOLVED_sfixed; r : REAL) return STD_ULOGIC;
- function \?>\ (l : UNRESOLVED_sfixed; r : REAL) return STD_ULOGIC;
- function \?<\ (l : UNRESOLVED_sfixed; r : REAL) return STD_ULOGIC;
-
- function \?=\ (l : REAL; r : UNRESOLVED_sfixed) return STD_ULOGIC;
- function \?/=\ (l : REAL; r : UNRESOLVED_sfixed) return STD_ULOGIC;
- function \?>=\ (l : REAL; r : UNRESOLVED_sfixed) return STD_ULOGIC;
- function \?<=\ (l : REAL; r : UNRESOLVED_sfixed) return STD_ULOGIC;
- function \?>\ (l : REAL; r : UNRESOLVED_sfixed) return STD_ULOGIC;
- function \?<\ (l : REAL; r : UNRESOLVED_sfixed) return STD_ULOGIC;
-
- function maximum (l : UNRESOLVED_sfixed; r : REAL) return UNRESOLVED_sfixed;
- function maximum (l : REAL; r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
- function minimum (l : UNRESOLVED_sfixed; r : REAL) return UNRESOLVED_sfixed;
- function minimum (l : REAL; r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
- --===========================================================================
- -- Shift and Rotate Functions.
- -- Note that sra and sla are not the same as the BIT_VECTOR version
- --===========================================================================
-
- function "sll" (ARG : UNRESOLVED_ufixed; COUNT : INTEGER)
- return UNRESOLVED_ufixed;
- function "srl" (ARG : UNRESOLVED_ufixed; COUNT : INTEGER)
- return UNRESOLVED_ufixed;
- function "rol" (ARG : UNRESOLVED_ufixed; COUNT : INTEGER)
- return UNRESOLVED_ufixed;
- function "ror" (ARG : UNRESOLVED_ufixed; COUNT : INTEGER)
- return UNRESOLVED_ufixed;
- function "sla" (ARG : UNRESOLVED_ufixed; COUNT : INTEGER)
- return UNRESOLVED_ufixed;
- function "sra" (ARG : UNRESOLVED_ufixed; COUNT : INTEGER)
- return UNRESOLVED_ufixed;
- function "sll" (ARG : UNRESOLVED_sfixed; COUNT : INTEGER)
- return UNRESOLVED_sfixed;
- function "srl" (ARG : UNRESOLVED_sfixed; COUNT : INTEGER)
- return UNRESOLVED_sfixed;
- function "rol" (ARG : UNRESOLVED_sfixed; COUNT : INTEGER)
- return UNRESOLVED_sfixed;
- function "ror" (ARG : UNRESOLVED_sfixed; COUNT : INTEGER)
- return UNRESOLVED_sfixed;
- function "sla" (ARG : UNRESOLVED_sfixed; COUNT : INTEGER)
- return UNRESOLVED_sfixed;
- function "sra" (ARG : UNRESOLVED_sfixed; COUNT : INTEGER)
- return UNRESOLVED_sfixed;
- function SHIFT_LEFT (ARG : UNRESOLVED_ufixed; COUNT : NATURAL)
- return UNRESOLVED_ufixed;
- function SHIFT_RIGHT (ARG : UNRESOLVED_ufixed; COUNT : NATURAL)
- return UNRESOLVED_ufixed;
- function SHIFT_LEFT (ARG : UNRESOLVED_sfixed; COUNT : NATURAL)
- return UNRESOLVED_sfixed;
- function SHIFT_RIGHT (ARG : UNRESOLVED_sfixed; COUNT : NATURAL)
- return UNRESOLVED_sfixed;
-
- ----------------------------------------------------------------------------
- -- logical functions
- ----------------------------------------------------------------------------
-
- function "not" (l : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
- function "and" (l, r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
- function "or" (l, r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
- function "nand" (l, r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
- function "nor" (l, r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
- function "xor" (l, r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
- function "xnor" (l, r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
- function "not" (l : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
- function "and" (l, r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
- function "or" (l, r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
- function "nand" (l, r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
- function "nor" (l, r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
- function "xor" (l, r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
- function "xnor" (l, r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
-
- -- Vector and std_ulogic functions, same as functions in numeric_std
- function "and" (l : STD_ULOGIC; r : UNRESOLVED_ufixed)
- return UNRESOLVED_ufixed;
- function "and" (l : UNRESOLVED_ufixed; r : STD_ULOGIC)
- return UNRESOLVED_ufixed;
- function "or" (l : STD_ULOGIC; r : UNRESOLVED_ufixed)
- return UNRESOLVED_ufixed;
- function "or" (l : UNRESOLVED_ufixed; r : STD_ULOGIC)
- return UNRESOLVED_ufixed;
- function "nand" (l : STD_ULOGIC; r : UNRESOLVED_ufixed)
- return UNRESOLVED_ufixed;
- function "nand" (l : UNRESOLVED_ufixed; r : STD_ULOGIC)
- return UNRESOLVED_ufixed;
- function "nor" (l : STD_ULOGIC; r : UNRESOLVED_ufixed)
- return UNRESOLVED_ufixed;
- function "nor" (l : UNRESOLVED_ufixed; r : STD_ULOGIC)
- return UNRESOLVED_ufixed;
- function "xor" (l : STD_ULOGIC; r : UNRESOLVED_ufixed)
- return UNRESOLVED_ufixed;
- function "xor" (l : UNRESOLVED_ufixed; r : STD_ULOGIC)
- return UNRESOLVED_ufixed;
- function "xnor" (l : STD_ULOGIC; r : UNRESOLVED_ufixed)
- return UNRESOLVED_ufixed;
- function "xnor" (l : UNRESOLVED_ufixed; r : STD_ULOGIC)
- return UNRESOLVED_ufixed;
- function "and" (l : STD_ULOGIC; r : UNRESOLVED_sfixed)
- return UNRESOLVED_sfixed;
- function "and" (l : UNRESOLVED_sfixed; r : STD_ULOGIC)
- return UNRESOLVED_sfixed;
- function "or" (l : STD_ULOGIC; r : UNRESOLVED_sfixed)
- return UNRESOLVED_sfixed;
- function "or" (l : UNRESOLVED_sfixed; r : STD_ULOGIC)
- return UNRESOLVED_sfixed;
- function "nand" (l : STD_ULOGIC; r : UNRESOLVED_sfixed)
- return UNRESOLVED_sfixed;
- function "nand" (l : UNRESOLVED_sfixed; r : STD_ULOGIC)
- return UNRESOLVED_sfixed;
- function "nor" (l : STD_ULOGIC; r : UNRESOLVED_sfixed)
- return UNRESOLVED_sfixed;
- function "nor" (l : UNRESOLVED_sfixed; r : STD_ULOGIC)
- return UNRESOLVED_sfixed;
- function "xor" (l : STD_ULOGIC; r : UNRESOLVED_sfixed)
- return UNRESOLVED_sfixed;
- function "xor" (l : UNRESOLVED_sfixed; r : STD_ULOGIC)
- return UNRESOLVED_sfixed;
- function "xnor" (l : STD_ULOGIC; r : UNRESOLVED_sfixed)
- return UNRESOLVED_sfixed;
- function "xnor" (l : UNRESOLVED_sfixed; r : STD_ULOGIC)
- return UNRESOLVED_sfixed;
-
- -- Reduction operators, same as numeric_std functions
- function and_reduce (l : UNRESOLVED_ufixed) return STD_ULOGIC;
- function nand_reduce (l : UNRESOLVED_ufixed) return STD_ULOGIC;
- function or_reduce (l : UNRESOLVED_ufixed) return STD_ULOGIC;
- function nor_reduce (l : UNRESOLVED_ufixed) return STD_ULOGIC;
- function xor_reduce (l : UNRESOLVED_ufixed) return STD_ULOGIC;
- function xnor_reduce (l : UNRESOLVED_ufixed) return STD_ULOGIC;
- function and_reduce (l : UNRESOLVED_sfixed) return STD_ULOGIC;
- function nand_reduce (l : UNRESOLVED_sfixed) return STD_ULOGIC;
- function or_reduce (l : UNRESOLVED_sfixed) return STD_ULOGIC;
- function nor_reduce (l : UNRESOLVED_sfixed) return STD_ULOGIC;
- function xor_reduce (l : UNRESOLVED_sfixed) return STD_ULOGIC;
- function xnor_reduce (l : UNRESOLVED_sfixed) return STD_ULOGIC;
-
- -- returns arg'low-1 if not found
- function find_leftmost (arg : UNRESOLVED_ufixed; y : STD_ULOGIC)
- return INTEGER;
- function find_leftmost (arg : UNRESOLVED_sfixed; y : STD_ULOGIC)
- return INTEGER;
-
- -- returns arg'high+1 if not found
- function find_rightmost (arg : UNRESOLVED_ufixed; y : STD_ULOGIC)
- return INTEGER;
- function find_rightmost (arg : UNRESOLVED_sfixed; y : STD_ULOGIC)
- return INTEGER;
-
- --===========================================================================
- -- RESIZE Functions
- --===========================================================================
- -- resizes the number (larger or smaller)
- -- The returned result will be ufixed (left_index downto right_index)
- -- If "round_style" is fixed_round, then the result will be rounded.
- -- If the MSB of the remainder is a "1" AND the LSB of the unrounded result
- -- is a '1' or the lower bits of the remainder include a '1' then the result
- -- will be increased by the smallest representable number for that type.
- -- "overflow_style" can be fixed_saturate or fixed_wrap.
- -- In saturate mode, if the number overflows then the largest possible
- -- representable number is returned. If wrap mode, then the upper bits
- -- of the number are truncated.
-
- function resize (
- arg : UNRESOLVED_ufixed; -- input
- constant left_index : INTEGER; -- integer portion
- constant right_index : INTEGER; -- size of fraction
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
- constant round_style : fixed_round_style_type := fixed_round_style)
- return UNRESOLVED_ufixed;
-
- -- "size_res" functions create the size of the output from the indices
- -- of the "size_res" input. The actual value of "size_res" is not used.
- function resize (
- arg : UNRESOLVED_ufixed; -- input
- size_res : UNRESOLVED_ufixed; -- for size only
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
- constant round_style : fixed_round_style_type := fixed_round_style)
- return UNRESOLVED_ufixed;
-
- -- Note that in "wrap" mode the sign bit is not replicated. Thus the
- -- resize of a negative number can have a positive result in wrap mode.
- function resize (
- arg : UNRESOLVED_sfixed; -- input
- constant left_index : INTEGER; -- integer portion
- constant right_index : INTEGER; -- size of fraction
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
- constant round_style : fixed_round_style_type := fixed_round_style)
- return UNRESOLVED_sfixed;
-
- function resize (
- arg : UNRESOLVED_sfixed; -- input
- size_res : UNRESOLVED_sfixed; -- for size only
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
- constant round_style : fixed_round_style_type := fixed_round_style)
- return UNRESOLVED_sfixed;
-
- --===========================================================================
- -- Conversion Functions
- --===========================================================================
-
- -- integer (natural) to unsigned fixed point.
- -- arguments are the upper and lower bounds of the number, thus
- -- ufixed (7 downto -3) <= to_ufixed (int, 7, -3);
- function to_ufixed (
- arg : NATURAL; -- integer
- constant left_index : INTEGER; -- left index (high index)
- constant right_index : INTEGER := 0; -- right index
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
- constant round_style : fixed_round_style_type := fixed_round_style)
- return UNRESOLVED_ufixed;
-
- function to_ufixed (
- arg : NATURAL; -- integer
- size_res : UNRESOLVED_ufixed; -- for size only
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
- constant round_style : fixed_round_style_type := fixed_round_style)
- return UNRESOLVED_ufixed;
-
- -- real to unsigned fixed point
- function to_ufixed (
- arg : REAL; -- real
- constant left_index : INTEGER; -- left index (high index)
- constant right_index : INTEGER; -- right index
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
- constant round_style : fixed_round_style_type := fixed_round_style;
- constant guard_bits : NATURAL := fixed_guard_bits)
- return UNRESOLVED_ufixed;
-
- function to_ufixed (
- arg : REAL; -- real
- size_res : UNRESOLVED_ufixed; -- for size only
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
- constant round_style : fixed_round_style_type := fixed_round_style;
- constant guard_bits : NATURAL := fixed_guard_bits)
- return UNRESOLVED_ufixed;
-
- -- unsigned to unsigned fixed point
- function to_ufixed (
- arg : UNSIGNED; -- unsigned
- constant left_index : INTEGER; -- left index (high index)
- constant right_index : INTEGER := 0; -- right index
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
- constant round_style : fixed_round_style_type := fixed_round_style)
- return UNRESOLVED_ufixed;
-
- function to_ufixed (
- arg : UNSIGNED; -- unsigned
- size_res : UNRESOLVED_ufixed; -- for size only
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
- constant round_style : fixed_round_style_type := fixed_round_style)
- return UNRESOLVED_ufixed;
-
- -- Performs a conversion. ufixed (arg'range) is returned
- function to_ufixed (
- arg : UNSIGNED) -- unsigned
- return UNRESOLVED_ufixed;
-
- -- unsigned fixed point to unsigned
- function to_unsigned (
- arg : UNRESOLVED_ufixed; -- fixed point input
- constant size : NATURAL; -- length of output
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
- constant round_style : fixed_round_style_type := fixed_round_style)
- return UNSIGNED;
-
- -- unsigned fixed point to unsigned
- function to_unsigned (
- arg : UNRESOLVED_ufixed; -- fixed point input
- size_res : UNSIGNED; -- used for length of output
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
- constant round_style : fixed_round_style_type := fixed_round_style)
- return UNSIGNED;
-
- -- unsigned fixed point to real
- function to_real (
- arg : UNRESOLVED_ufixed) -- fixed point input
- return REAL;
-
- -- unsigned fixed point to integer
- function to_integer (
- arg : UNRESOLVED_ufixed; -- fixed point input
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
- constant round_style : fixed_round_style_type := fixed_round_style)
- return NATURAL;
-
- -- Integer to UNRESOLVED_sfixed
- function to_sfixed (
- arg : INTEGER; -- integer
- constant left_index : INTEGER; -- left index (high index)
- constant right_index : INTEGER := 0; -- right index
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
- constant round_style : fixed_round_style_type := fixed_round_style)
- return UNRESOLVED_sfixed;
-
- function to_sfixed (
- arg : INTEGER; -- integer
- size_res : UNRESOLVED_sfixed; -- for size only
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
- constant round_style : fixed_round_style_type := fixed_round_style)
- return UNRESOLVED_sfixed;
-
- -- Real to sfixed
- function to_sfixed (
- arg : REAL; -- real
- constant left_index : INTEGER; -- left index (high index)
- constant right_index : INTEGER; -- right index
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
- constant round_style : fixed_round_style_type := fixed_round_style;
- constant guard_bits : NATURAL := fixed_guard_bits)
- return UNRESOLVED_sfixed;
-
- function to_sfixed (
- arg : REAL; -- real
- size_res : UNRESOLVED_sfixed; -- for size only
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
- constant round_style : fixed_round_style_type := fixed_round_style;
- constant guard_bits : NATURAL := fixed_guard_bits)
- return UNRESOLVED_sfixed;
-
- -- signed to sfixed
- function to_sfixed (
- arg : SIGNED; -- signed
- constant left_index : INTEGER; -- left index (high index)
- constant right_index : INTEGER := 0; -- right index
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
- constant round_style : fixed_round_style_type := fixed_round_style)
- return UNRESOLVED_sfixed;
-
- function to_sfixed (
- arg : SIGNED; -- signed
- size_res : UNRESOLVED_sfixed; -- for size only
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
- constant round_style : fixed_round_style_type := fixed_round_style)
- return UNRESOLVED_sfixed;
-
- -- signed to sfixed (output assumed to be size of signed input)
- function to_sfixed (
- arg : SIGNED) -- signed
- return UNRESOLVED_sfixed;
-
- -- Conversion from ufixed to sfixed
- function to_sfixed (
- arg : UNRESOLVED_ufixed)
- return UNRESOLVED_sfixed;
-
- -- signed fixed point to signed
- function to_signed (
- arg : UNRESOLVED_sfixed; -- fixed point input
- constant size : NATURAL; -- length of output
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
- constant round_style : fixed_round_style_type := fixed_round_style)
- return SIGNED;
-
- -- signed fixed point to signed
- function to_signed (
- arg : UNRESOLVED_sfixed; -- fixed point input
- size_res : SIGNED; -- used for length of output
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
- constant round_style : fixed_round_style_type := fixed_round_style)
- return SIGNED;
-
- -- signed fixed point to real
- function to_real (
- arg : UNRESOLVED_sfixed) -- fixed point input
- return REAL;
-
- -- signed fixed point to integer
- function to_integer (
- arg : UNRESOLVED_sfixed; -- fixed point input
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
- constant round_style : fixed_round_style_type := fixed_round_style)
- return INTEGER;
-
- -- Because of the fairly complicated sizing rules in the fixed point
- -- packages these functions are provided to compute the result ranges
- -- Example:
- -- signal uf1 : ufixed (3 downto -3);
- -- signal uf2 : ufixed (4 downto -2);
- -- signal uf1multuf2 : ufixed (ufixed_high (3, -3, '*', 4, -2) downto
- -- ufixed_low (3, -3, '*', 4, -2));
- -- uf1multuf2 <= uf1 * uf2;
- -- Valid characters: '+', '-', '*', '/', 'r' or 'R' (rem), 'm' or 'M' (mod),
- -- '1' (reciprocal), 'a' or 'A' (abs), 'n' or 'N' (unary -)
- function ufixed_high (left_index, right_index : INTEGER;
- operation : CHARACTER := 'X';
- left_index2, right_index2 : INTEGER := 0)
- return INTEGER;
-
- function ufixed_low (left_index, right_index : INTEGER;
- operation : CHARACTER := 'X';
- left_index2, right_index2 : INTEGER := 0)
- return INTEGER;
-
- function sfixed_high (left_index, right_index : INTEGER;
- operation : CHARACTER := 'X';
- left_index2, right_index2 : INTEGER := 0)
- return INTEGER;
-
- function sfixed_low (left_index, right_index : INTEGER;
- operation : CHARACTER := 'X';
- left_index2, right_index2 : INTEGER := 0)
- return INTEGER;
-
- -- Same as above, but using the "size_res" input only for their ranges:
- -- signal uf1multuf2 : ufixed (ufixed_high (uf1, '*', uf2) downto
- -- ufixed_low (uf1, '*', uf2));
- -- uf1multuf2 <= uf1 * uf2;
- --
- function ufixed_high (size_res : UNRESOLVED_ufixed;
- operation : CHARACTER := 'X';
- size_res2 : UNRESOLVED_ufixed)
- return INTEGER;
-
- function ufixed_low (size_res : UNRESOLVED_ufixed;
- operation : CHARACTER := 'X';
- size_res2 : UNRESOLVED_ufixed)
- return INTEGER;
-
- function sfixed_high (size_res : UNRESOLVED_sfixed;
- operation : CHARACTER := 'X';
- size_res2 : UNRESOLVED_sfixed)
- return INTEGER;
-
- function sfixed_low (size_res : UNRESOLVED_sfixed;
- operation : CHARACTER := 'X';
- size_res2 : UNRESOLVED_sfixed)
- return INTEGER;
-
- -- purpose: returns a saturated number
- function saturate (
- constant left_index : INTEGER;
- constant right_index : INTEGER)
- return UNRESOLVED_ufixed;
-
- -- purpose: returns a saturated number
- function saturate (
- constant left_index : INTEGER;
- constant right_index : INTEGER)
- return UNRESOLVED_sfixed;
-
- function saturate (
- size_res : UNRESOLVED_ufixed) -- only the size of this is used
- return UNRESOLVED_ufixed;
-
- function saturate (
- size_res : UNRESOLVED_sfixed) -- only the size of this is used
- return UNRESOLVED_sfixed;
-
- --===========================================================================
- -- Translation Functions
- --===========================================================================
-
- -- maps meta-logical values
- function to_01 (
- s : UNRESOLVED_ufixed; -- fixed point input
- constant XMAP : STD_ULOGIC := '0') -- Map x to
- return UNRESOLVED_ufixed;
-
- -- maps meta-logical values
- function to_01 (
- s : UNRESOLVED_sfixed; -- fixed point input
- constant XMAP : STD_ULOGIC := '0') -- Map x to
- return UNRESOLVED_sfixed;
-
- function Is_X (arg : UNRESOLVED_ufixed) return BOOLEAN;
- function Is_X (arg : UNRESOLVED_sfixed) return BOOLEAN;
- function to_X01 (arg : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
- function to_X01 (arg : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
- function to_X01Z (arg : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
- function to_X01Z (arg : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
- function to_UX01 (arg : UNRESOLVED_ufixed) return UNRESOLVED_ufixed;
- function to_UX01 (arg : UNRESOLVED_sfixed) return UNRESOLVED_sfixed;
-
- -- straight vector conversion routines, needed for synthesis.
- -- These functions are here so that a std_logic_vector can be
- -- converted to and from sfixed and ufixed. Note that you can
- -- not convert these vectors because of their negative index.
-
- function to_slv (
- arg : UNRESOLVED_ufixed) -- fixed point vector
- return STD_LOGIC_VECTOR;
--- alias to_StdLogicVector is to_slv [UNRESOLVED_ufixed
--- return STD_LOGIC_VECTOR];
--- alias to_Std_Logic_Vector is to_slv [UNRESOLVED_ufixed
--- return STD_LOGIC_VECTOR];
-
- function to_slv (
- arg : UNRESOLVED_sfixed) -- fixed point vector
- return STD_LOGIC_VECTOR;
--- alias to_StdLogicVector is to_slv [UNRESOLVED_sfixed
--- return STD_LOGIC_VECTOR];
--- alias to_Std_Logic_Vector is to_slv [UNRESOLVED_sfixed
--- return STD_LOGIC_VECTOR];
-
- function to_sulv (
- arg : UNRESOLVED_ufixed) -- fixed point vector
- return STD_ULOGIC_VECTOR;
--- alias to_StdULogicVector is to_sulv [UNRESOLVED_ufixed
--- return STD_ULOGIC_VECTOR];
--- alias to_Std_ULogic_Vector is to_sulv [UNRESOLVED_ufixed
--- return STD_ULOGIC_VECTOR];
-
- function to_sulv (
- arg : UNRESOLVED_sfixed) -- fixed point vector
- return STD_ULOGIC_VECTOR;
--- alias to_StdULogicVector is to_sulv [UNRESOLVED_sfixed
--- return STD_ULOGIC_VECTOR];
--- alias to_Std_ULogic_Vector is to_sulv [UNRESOLVED_sfixed
--- return STD_ULOGIC_VECTOR];
-
- function to_ufixed (
- arg : STD_ULOGIC_VECTOR; -- shifted vector
- constant left_index : INTEGER;
- constant right_index : INTEGER)
- return UNRESOLVED_ufixed;
-
- function to_ufixed (
- arg : STD_ULOGIC_VECTOR; -- shifted vector
- size_res : UNRESOLVED_ufixed) -- for size only
- return UNRESOLVED_ufixed;
-
- function to_sfixed (
- arg : STD_ULOGIC_VECTOR; -- shifted vector
- constant left_index : INTEGER;
- constant right_index : INTEGER)
- return UNRESOLVED_sfixed;
-
- function to_sfixed (
- arg : STD_ULOGIC_VECTOR; -- shifted vector
- size_res : UNRESOLVED_sfixed) -- for size only
- return UNRESOLVED_sfixed;
-
- -- As a concession to those who use a graphical DSP environment,
- -- these functions take parameters in those tools format and create
- -- fixed point numbers. These functions are designed to convert from
- -- a std_logic_vector to the VHDL fixed point format using the conventions
- -- of these packages. In a pure VHDL environment you should use the
- -- "to_ufixed" and "to_sfixed" routines.
-
- -- unsigned fixed point
- function to_UFix (
- arg : STD_ULOGIC_VECTOR;
- width : NATURAL; -- width of vector
- fraction : NATURAL) -- width of fraction
- return UNRESOLVED_ufixed;
-
- -- signed fixed point
- function to_SFix (
- arg : STD_ULOGIC_VECTOR;
- width : NATURAL; -- width of vector
- fraction : NATURAL) -- width of fraction
- return UNRESOLVED_sfixed;
-
- -- finding the bounds of a number. These functions can be used like this:
- -- signal xxx : ufixed (7 downto -3);
- -- -- Which is the same as "ufixed (UFix_high (11,3) downto UFix_low(11,3))"
- -- signal yyy : ufixed (UFix_high (11, 3, "+", 11, 3)
- -- downto UFix_low(11, 3, "+", 11, 3));
- -- Where "11" is the width of xxx (xxx'length),
- -- and 3 is the lower bound (abs (xxx'low))
- -- In a pure VHDL environment use "ufixed_high" and "ufixed_low"
-
- function UFix_high (width, fraction : NATURAL;
- operation : CHARACTER := 'X';
- width2, fraction2 : NATURAL := 0)
- return INTEGER;
-
- function UFix_low (width, fraction : NATURAL;
- operation : CHARACTER := 'X';
- width2, fraction2 : NATURAL := 0)
- return INTEGER;
-
- -- Same as above but for signed fixed point. Note that the width
- -- of a signed fixed point number ignores the sign bit, thus
- -- width = sxxx'length-1
-
- function SFix_high (width, fraction : NATURAL;
- operation : CHARACTER := 'X';
- width2, fraction2 : NATURAL := 0)
- return INTEGER;
-
- function SFix_low (width, fraction : NATURAL;
- operation : CHARACTER := 'X';
- width2, fraction2 : NATURAL := 0)
- return INTEGER;
--- rtl_synthesis off
--- pragma synthesis_off
- --===========================================================================
- -- string and textio Functions
- --===========================================================================
-
- -- purpose: writes fixed point into a line
- procedure WRITE (
- L : inout LINE; -- input line
- VALUE : in UNRESOLVED_ufixed; -- fixed point input
- JUSTIFIED : in SIDE := right;
- FIELD : in WIDTH := 0);
-
- -- purpose: writes fixed point into a line
- procedure WRITE (
- L : inout LINE; -- input line
- VALUE : in UNRESOLVED_sfixed; -- fixed point input
- JUSTIFIED : in SIDE := right;
- FIELD : in WIDTH := 0);
-
- procedure READ(L : inout LINE;
- VALUE : out UNRESOLVED_ufixed);
-
- procedure READ(L : inout LINE;
- VALUE : out UNRESOLVED_ufixed;
- GOOD : out BOOLEAN);
-
- procedure READ(L : inout LINE;
- VALUE : out UNRESOLVED_sfixed);
-
- procedure READ(L : inout LINE;
- VALUE : out UNRESOLVED_sfixed;
- GOOD : out BOOLEAN);
-
- alias bwrite is WRITE [LINE, UNRESOLVED_ufixed, SIDE, width];
- alias bwrite is WRITE [LINE, UNRESOLVED_sfixed, SIDE, width];
- alias bread is READ [LINE, UNRESOLVED_ufixed];
- alias bread is READ [LINE, UNRESOLVED_ufixed, BOOLEAN];
- alias bread is READ [LINE, UNRESOLVED_sfixed];
- alias bread is READ [LINE, UNRESOLVED_sfixed, BOOLEAN];
- alias BINARY_WRITE is WRITE [LINE, UNRESOLVED_ufixed, SIDE, width];
- alias BINARY_WRITE is WRITE [LINE, UNRESOLVED_sfixed, SIDE, width];
- alias BINARY_READ is READ [LINE, UNRESOLVED_ufixed, BOOLEAN];
- alias BINARY_READ is READ [LINE, UNRESOLVED_ufixed];
- alias BINARY_READ is READ [LINE, UNRESOLVED_sfixed, BOOLEAN];
- alias BINARY_READ is READ [LINE, UNRESOLVED_sfixed];
-
- -- octal read and write
- procedure OWRITE (
- L : inout LINE; -- input line
- VALUE : in UNRESOLVED_ufixed; -- fixed point input
- JUSTIFIED : in SIDE := right;
- FIELD : in WIDTH := 0);
-
- procedure OWRITE (
- L : inout LINE; -- input line
- VALUE : in UNRESOLVED_sfixed; -- fixed point input
- JUSTIFIED : in SIDE := right;
- FIELD : in WIDTH := 0);
-
- procedure OREAD(L : inout LINE;
- VALUE : out UNRESOLVED_ufixed);
-
- procedure OREAD(L : inout LINE;
- VALUE : out UNRESOLVED_ufixed;
- GOOD : out BOOLEAN);
-
- procedure OREAD(L : inout LINE;
- VALUE : out UNRESOLVED_sfixed);
-
- procedure OREAD(L : inout LINE;
- VALUE : out UNRESOLVED_sfixed;
- GOOD : out BOOLEAN);
- alias OCTAL_READ is OREAD [LINE, UNRESOLVED_ufixed, BOOLEAN];
- alias OCTAL_READ is OREAD [LINE, UNRESOLVED_ufixed];
- alias OCTAL_READ is OREAD [LINE, UNRESOLVED_sfixed, BOOLEAN];
- alias OCTAL_READ is OREAD [LINE, UNRESOLVED_sfixed];
- alias OCTAL_WRITE is OWRITE [LINE, UNRESOLVED_ufixed, SIDE, WIDTH];
- alias OCTAL_WRITE is OWRITE [LINE, UNRESOLVED_sfixed, SIDE, WIDTH];
-
- -- hex read and write
- procedure HWRITE (
- L : inout LINE; -- input line
- VALUE : in UNRESOLVED_ufixed; -- fixed point input
- JUSTIFIED : in SIDE := right;
- FIELD : in WIDTH := 0);
-
- -- purpose: writes fixed point into a line
- procedure HWRITE (
- L : inout LINE; -- input line
- VALUE : in UNRESOLVED_sfixed; -- fixed point input
- JUSTIFIED : in SIDE := right;
- FIELD : in WIDTH := 0);
-
- procedure HREAD(L : inout LINE;
- VALUE : out UNRESOLVED_ufixed);
-
- procedure HREAD(L : inout LINE;
- VALUE : out UNRESOLVED_ufixed;
- GOOD : out BOOLEAN);
-
- procedure HREAD(L : inout LINE;
- VALUE : out UNRESOLVED_sfixed);
-
- procedure HREAD(L : inout LINE;
- VALUE : out UNRESOLVED_sfixed;
- GOOD : out BOOLEAN);
- alias HEX_READ is HREAD [LINE, UNRESOLVED_ufixed, BOOLEAN];
- alias HEX_READ is HREAD [LINE, UNRESOLVED_sfixed, BOOLEAN];
- alias HEX_READ is HREAD [LINE, UNRESOLVED_ufixed];
- alias HEX_READ is HREAD [LINE, UNRESOLVED_sfixed];
- alias HEX_WRITE is HWRITE [LINE, UNRESOLVED_ufixed, SIDE, WIDTH];
- alias HEX_WRITE is HWRITE [LINE, UNRESOLVED_sfixed, SIDE, WIDTH];
-
- -- returns a string, useful for:
- -- assert (x = y) report "error found " & to_string(x) severity error;
- function to_string (value : UNRESOLVED_ufixed) return STRING;
- alias to_bstring is to_string [UNRESOLVED_ufixed return STRING];
- alias TO_BINARY_STRING is TO_STRING [UNRESOLVED_ufixed return STRING];
-
- function to_ostring (value : UNRESOLVED_ufixed) return STRING;
- alias TO_OCTAL_STRING is TO_OSTRING [UNRESOLVED_ufixed return STRING];
-
- function to_hstring (value : UNRESOLVED_ufixed) return STRING;
- alias TO_HEX_STRING is TO_HSTRING [UNRESOLVED_ufixed return STRING];
-
- function to_string (value : UNRESOLVED_sfixed) return STRING;
- alias to_bstring is to_string [UNRESOLVED_sfixed return STRING];
- alias TO_BINARY_STRING is TO_STRING [UNRESOLVED_sfixed return STRING];
-
- function to_ostring (value : UNRESOLVED_sfixed) return STRING;
- alias TO_OCTAL_STRING is TO_OSTRING [UNRESOLVED_sfixed return STRING];
-
- function to_hstring (value : UNRESOLVED_sfixed) return STRING;
- alias TO_HEX_STRING is TO_HSTRING [UNRESOLVED_sfixed return STRING];
-
- -- From string functions allow you to convert a string into a fixed
- -- point number. Example:
- -- signal uf1 : ufixed (3 downto -3);
- -- uf1 <= from_string ("0110.100", uf1'high, uf1'low); -- 6.5
- -- The "." is optional in this syntax, however it exist and is
- -- in the wrong location an error is produced. Overflow will
- -- result in saturation.
-
- function from_string (
- bstring : STRING; -- binary string
- constant left_index : INTEGER;
- constant right_index : INTEGER)
- return UNRESOLVED_ufixed;
- alias from_bstring is from_string [STRING, INTEGER, INTEGER
- return UNRESOLVED_ufixed];
- alias from_binary_string is from_string [STRING, INTEGER, INTEGER
- return UNRESOLVED_ufixed];
-
- -- Octal and hex conversions work as follows:
- -- uf1 <= from_hstring ("6.8", 3, -3); -- 6.5 (bottom zeros dropped)
- -- uf1 <= from_ostring ("06.4", 3, -3); -- 6.5 (top zeros dropped)
-
- function from_ostring (
- ostring : STRING; -- Octal string
- constant left_index : INTEGER;
- constant right_index : INTEGER)
- return UNRESOLVED_ufixed;
- alias from_octal_string is from_ostring [STRING, INTEGER, INTEGER
- return UNRESOLVED_ufixed];
-
- function from_hstring (
- hstring : STRING; -- hex string
- constant left_index : INTEGER;
- constant right_index : INTEGER)
- return UNRESOLVED_ufixed;
- alias from_hex_string is from_hstring [STRING, INTEGER, INTEGER
- return UNRESOLVED_ufixed];
-
- function from_string (
- bstring : STRING; -- binary string
- constant left_index : INTEGER;
- constant right_index : INTEGER)
- return UNRESOLVED_sfixed;
- alias from_bstring is from_string [STRING, INTEGER, INTEGER
- return UNRESOLVED_sfixed];
- alias from_binary_string is from_string [STRING, INTEGER, INTEGER
- return UNRESOLVED_sfixed];
-
- function from_ostring (
- ostring : STRING; -- Octal string
- constant left_index : INTEGER;
- constant right_index : INTEGER)
- return UNRESOLVED_sfixed;
- alias from_octal_string is from_ostring [STRING, INTEGER, INTEGER
- return UNRESOLVED_sfixed];
-
- function from_hstring (
- hstring : STRING; -- hex string
- constant left_index : INTEGER;
- constant right_index : INTEGER)
- return UNRESOLVED_sfixed;
- alias from_hex_string is from_hstring [STRING, INTEGER, INTEGER
- return UNRESOLVED_sfixed];
-
- -- Same as above, "size_res" is used for it's range only.
- function from_string (
- bstring : STRING; -- binary string
- size_res : UNRESOLVED_ufixed)
- return UNRESOLVED_ufixed;
- alias from_bstring is from_string [STRING, UNRESOLVED_ufixed
- return UNRESOLVED_ufixed];
- alias from_binary_string is from_string [STRING, UNRESOLVED_ufixed
- return UNRESOLVED_ufixed];
-
- function from_ostring (
- ostring : STRING; -- Octal string
- size_res : UNRESOLVED_ufixed)
- return UNRESOLVED_ufixed;
- alias from_octal_string is from_ostring [STRING, UNRESOLVED_ufixed
- return UNRESOLVED_ufixed];
-
- function from_hstring (
- hstring : STRING; -- hex string
- size_res : UNRESOLVED_ufixed)
- return UNRESOLVED_ufixed;
- alias from_hex_string is from_hstring [STRING, UNRESOLVED_ufixed
- return UNRESOLVED_ufixed];
-
- function from_string (
- bstring : STRING; -- binary string
- size_res : UNRESOLVED_sfixed)
- return UNRESOLVED_sfixed;
- alias from_bstring is from_string [STRING, UNRESOLVED_sfixed
- return UNRESOLVED_sfixed];
- alias from_binary_string is from_string [STRING, UNRESOLVED_sfixed
- return UNRESOLVED_sfixed];
-
- function from_ostring (
- ostring : STRING; -- Octal string
- size_res : UNRESOLVED_sfixed)
- return UNRESOLVED_sfixed;
- alias from_octal_string is from_ostring [STRING, UNRESOLVED_sfixed
- return UNRESOLVED_sfixed];
-
- function from_hstring (
- hstring : STRING; -- hex string
- size_res : UNRESOLVED_sfixed)
- return UNRESOLVED_sfixed;
- alias from_hex_string is from_hstring [STRING, UNRESOLVED_sfixed
- return UNRESOLVED_sfixed];
-
- -- Direct conversion functions. Example:
- -- signal uf1 : ufixed (3 downto -3);
- -- uf1 <= from_string ("0110.100"); -- 6.5
- -- In this case the "." is not optional, and the size of
- -- the output must match exactly.
-
- function from_string (
- bstring : STRING) -- binary string
- return UNRESOLVED_ufixed;
- alias from_bstring is from_string [STRING return UNRESOLVED_ufixed];
- alias from_binary_string is from_string [STRING return UNRESOLVED_ufixed];
-
- -- Direct octal and hex conversion functions. In this case
- -- the string lengths must match. Example:
- -- signal sf1 := sfixed (5 downto -3);
- -- sf1 <= from_ostring ("71.4") -- -6.5
-
- function from_ostring (
- ostring : STRING) -- Octal string
- return UNRESOLVED_ufixed;
- alias from_octal_string is from_ostring [STRING return UNRESOLVED_ufixed];
-
- function from_hstring (
- hstring : STRING) -- hex string
- return UNRESOLVED_ufixed;
- alias from_hex_string is from_hstring [STRING return UNRESOLVED_ufixed];
-
- function from_string (
- bstring : STRING) -- binary string
- return UNRESOLVED_sfixed;
- alias from_bstring is from_string [STRING return UNRESOLVED_sfixed];
- alias from_binary_string is from_string [STRING return UNRESOLVED_sfixed];
-
- function from_ostring (
- ostring : STRING) -- Octal string
- return UNRESOLVED_sfixed;
- alias from_octal_string is from_ostring [STRING return UNRESOLVED_sfixed];
-
- function from_hstring (
- hstring : STRING) -- hex string
- return UNRESOLVED_sfixed;
- alias from_hex_string is from_hstring [STRING return UNRESOLVED_sfixed];
--- rtl_synthesis on
--- pragma synthesis_on
-
- -- IN VHDL-2006 std_logic_vector is a subtype of std_ulogic_vector, so these
- -- extra functions are needed for compatability.
- function to_ufixed (
- arg : STD_LOGIC_VECTOR; -- shifted vector
- constant left_index : INTEGER;
- constant right_index : INTEGER)
- return UNRESOLVED_ufixed;
-
- function to_ufixed (
- arg : STD_LOGIC_VECTOR; -- shifted vector
- size_res : UNRESOLVED_ufixed) -- for size only
- return UNRESOLVED_ufixed;
-
- function to_sfixed (
- arg : STD_LOGIC_VECTOR; -- shifted vector
- constant left_index : INTEGER;
- constant right_index : INTEGER)
- return UNRESOLVED_sfixed;
-
- function to_sfixed (
- arg : STD_LOGIC_VECTOR; -- shifted vector
- size_res : UNRESOLVED_sfixed) -- for size only
- return UNRESOLVED_sfixed;
-
- -- unsigned fixed point
- function to_UFix (
- arg : STD_LOGIC_VECTOR;
- width : NATURAL; -- width of vector
- fraction : NATURAL) -- width of fraction
- return UNRESOLVED_ufixed;
-
- -- signed fixed point
- function to_SFix (
- arg : STD_LOGIC_VECTOR;
- width : NATURAL; -- width of vector
- fraction : NATURAL) -- width of fraction
- return UNRESOLVED_sfixed;
-
-end package fixed_pkg;
--------------------------------------------------------------------------------
--- Proposed package body for the VHDL-200x-FT fixed_pkg package
--- (Fixed point math package)
--- This package body supplies a recommended implementation of these functions
--- Version : $Revision: 1.21 $
--- Date : $Date: 2007/09/26 18:08:53 $
---
--- Created for VHDL-200X-ft, David Bishop (dbishop@vhdl.org)
--------------------------------------------------------------------------------
-library IEEE;
-use IEEE.MATH_REAL.all;
-
-package body fixed_pkg is
- -- Author David Bishop (dbishop@vhdl.org)
- -- Other contributers: Jim Lewis, Yannick Grugni, Ryan W. Hilton
- -- null array constants
- constant NAUF : UNRESOLVED_ufixed (0 downto 1) := (others => '0');
- constant NASF : UNRESOLVED_sfixed (0 downto 1) := (others => '0');
- constant NSLV : STD_ULOGIC_VECTOR (0 downto 1) := (others => '0');
-
- -- This differed constant will tell you if the package body is synthesizable
- -- or implemented as real numbers, set to "true" if synthesizable.
- constant fixedsynth_or_real : BOOLEAN := true;
-
- -- %%% Replicated functions
- function maximum (
- l, r : integer) -- inputs
- return integer is
- begin -- function max
- if l > r then return l;
- else return r;
- end if;
- end function maximum;
-
- function minimum (
- l, r : integer) -- inputs
- return integer is
- begin -- function min
- if l > r then return r;
- else return l;
- end if;
- end function minimum;
-
- function "sra" (arg : SIGNED; count : INTEGER)
- return SIGNED is
- begin
- if (COUNT >= 0) then
- return SHIFT_RIGHT(arg, count);
- else
- return SHIFT_LEFT(arg, -count);
- end if;
- end function "sra";
-
- function or_reduce (arg : STD_ULOGIC_VECTOR)
- return STD_LOGIC is
- variable Upper, Lower : STD_ULOGIC;
- variable Half : INTEGER;
- variable BUS_int : STD_ULOGIC_VECTOR (arg'length - 1 downto 0);
- variable Result : STD_ULOGIC;
- begin
- if (arg'length < 1) then -- In the case of a NULL range
- Result := '0';
- else
- BUS_int := to_ux01 (arg);
- if (BUS_int'length = 1) then
- Result := BUS_int (BUS_int'left);
- elsif (BUS_int'length = 2) then
- Result := BUS_int (BUS_int'right) or BUS_int (BUS_int'left);
- else
- Half := (BUS_int'length + 1) / 2 + BUS_int'right;
- Upper := or_reduce (BUS_int (BUS_int'left downto Half));
- Lower := or_reduce (BUS_int (Half - 1 downto BUS_int'right));
- Result := Upper or Lower;
- end if;
- end if;
- return Result;
- end function or_reduce;
-
- -- purpose: AND all of the bits in a vector together
- -- This is a copy of the proposed "and_reduce" from 1076.3
- function and_reduce (arg : STD_ULOGIC_VECTOR)
- return STD_LOGIC is
- variable Upper, Lower : STD_ULOGIC;
- variable Half : INTEGER;
- variable BUS_int : STD_ULOGIC_VECTOR (arg'length - 1 downto 0);
- variable Result : STD_ULOGIC;
- begin
- if (arg'length < 1) then -- In the case of a NULL range
- Result := '1';
- else
- BUS_int := to_ux01 (arg);
- if (BUS_int'length = 1) then
- Result := BUS_int (BUS_int'left);
- elsif (BUS_int'length = 2) then
- Result := BUS_int (BUS_int'right) and BUS_int (BUS_int'left);
- else
- Half := (BUS_int'length + 1) / 2 + BUS_int'right;
- Upper := and_reduce (BUS_int (BUS_int'left downto Half));
- Lower := and_reduce (BUS_int (Half - 1 downto BUS_int'right));
- Result := Upper and Lower;
- end if;
- end if;
- return Result;
- end function and_reduce;
-
- function xor_reduce (arg : STD_ULOGIC_VECTOR) return STD_ULOGIC is
- variable Upper, Lower : STD_ULOGIC;
- variable Half : INTEGER;
- variable BUS_int : STD_ULOGIC_VECTOR (arg'length - 1 downto 0);
- variable Result : STD_ULOGIC := '0'; -- In the case of a NULL range
- begin
- if (arg'length >= 1) then
- BUS_int := to_ux01 (arg);
- if (BUS_int'length = 1) then
- Result := BUS_int (BUS_int'left);
- elsif (BUS_int'length = 2) then
- Result := BUS_int(BUS_int'right) xor BUS_int(BUS_int'left);
- else
- Half := (BUS_int'length + 1) / 2 + BUS_int'right;
- Upper := xor_reduce (BUS_int (BUS_int'left downto Half));
- Lower := xor_reduce (BUS_int (Half - 1 downto BUS_int'right));
- Result := Upper xor Lower;
- end if;
- end if;
- return Result;
- end function xor_reduce;
-
- function nand_reduce(arg : std_ulogic_vector) return STD_ULOGIC is
- begin
- return not and_reduce (arg);
- end function nand_reduce;
- function nor_reduce(arg : std_ulogic_vector) return STD_ULOGIC is
- begin
- return not or_reduce (arg);
- end function nor_reduce;
- function xnor_reduce(arg : std_ulogic_vector) return STD_ULOGIC is
- begin
- return not xor_reduce (arg);
- end function xnor_reduce;
- -- Match table, copied form new std_logic_1164
--- type stdlogic_table is array(STD_ULOGIC, STD_ULOGIC) of STD_ULOGIC;
--- constant match_logic_table : stdlogic_table := (
--- -----------------------------------------------------
--- -- U X 0 1 Z W L H - | |
--- -----------------------------------------------------
--- ('U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', '1'), -- | U |
--- ('U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', '1'), -- | X |
--- ('U', 'X', '1', '0', 'X', 'X', '1', '0', '1'), -- | 0 |
--- ('U', 'X', '0', '1', 'X', 'X', '0', '1', '1'), -- | 1 |
--- ('U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', '1'), -- | Z |
--- ('U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', '1'), -- | W |
--- ('U', 'X', '1', '0', 'X', 'X', '1', '0', '1'), -- | L |
--- ('U', 'X', '0', '1', 'X', 'X', '0', '1', '1'), -- | H |
--- ('1', '1', '1', '1', '1', '1', '1', '1', '1') -- | - |
--- );
-
--- constant no_match_logic_table : stdlogic_table := (
--- -----------------------------------------------------
--- -- U X 0 1 Z W L H - | |
--- -----------------------------------------------------
--- ('U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', '0'), -- | U |
--- ('U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', '0'), -- | X |
--- ('U', 'X', '0', '1', 'X', 'X', '0', '1', '0'), -- | 0 |
--- ('U', 'X', '1', '0', 'X', 'X', '1', '0', '0'), -- | 1 |
--- ('U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', '0'), -- | Z |
--- ('U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', '0'), -- | W |
--- ('U', 'X', '0', '1', 'X', 'X', '0', '1', '0'), -- | L |
--- ('U', 'X', '1', '0', 'X', 'X', '1', '0', '0'), -- | H |
--- ('0', '0', '0', '0', '0', '0', '0', '0', '0') -- | - |
--- );
-
- -------------------------------------------------------------------
- -- ?= functions, Similar to "std_match", but returns "std_ulogic".
- -------------------------------------------------------------------
- function \?=\ (l, r : STD_ULOGIC) return STD_ULOGIC is
- variable lx, rx : STD_ULOGIC;
- begin
--- return match_logic_table (l, r);
- lx := to_x01(l);
- rx := to_x01(r);
- if lx = 'X' or rx = 'X' then
- return 'X';
- elsif lx = rx then
- return '1';
- else
- return '0';
- end if;
- end function \?=\;
- function \?/=\ (l, r : STD_ULOGIC) return STD_ULOGIC is
- begin
--- return no_match_logic_table (l, r);
- return not \?=\ (l, r);
- end function \?/=\;
- -- "?=" operator is similar to "std_match", but returns a std_ulogic..
- -- Id: M.2B
- function \?=\ (L, R: UNSIGNED) return STD_ULOGIC is
- constant L_LEFT : INTEGER := L'LENGTH-1;
- constant R_LEFT : INTEGER := R'LENGTH-1;
- alias XL : UNSIGNED(L_LEFT downto 0) is L;
- alias XR : UNSIGNED(R_LEFT downto 0) is R;
- constant SIZE : NATURAL := MAXIMUM(L'LENGTH, R'LENGTH);
- variable LX : UNSIGNED(SIZE-1 downto 0);
- variable RX : UNSIGNED(SIZE-1 downto 0);
- variable result, result1 : STD_ULOGIC; -- result
- begin
- -- Logically identical to an "=" operator.
- if ((L'LENGTH < 1) or (R'LENGTH < 1)) then
- assert NO_WARNING
- report "NUMERIC_STD.""?="": null detected, returning X"
- severity warning;
- return 'X';
- else
- LX := RESIZE(XL, SIZE);
- RX := RESIZE(XR, SIZE);
- result := '1';
- for i in LX'low to LX'high loop
- result1 := \?=\(LX(i), RX(i));
- if result1 = 'U' then
- return 'U';
- elsif result1 = 'X' or result = 'X' then
- result := 'X';
- else
- result := result and result1;
- end if;
- end loop;
- return result;
- end if;
- end function \?=\;
-
- -- Id: M.3B
- function \?=\ (L, R: SIGNED) return std_ulogic is
- constant L_LEFT : INTEGER := L'LENGTH-1;
- constant R_LEFT : INTEGER := R'LENGTH-1;
- alias XL : SIGNED(L_LEFT downto 0) is L;
- alias XR : SIGNED(R_LEFT downto 0) is R;
- constant SIZE : NATURAL := MAXIMUM(L'LENGTH, R'LENGTH);
- variable LX : SIGNED(SIZE-1 downto 0);
- variable RX : SIGNED(SIZE-1 downto 0);
- variable result, result1 : STD_ULOGIC; -- result
- begin -- ?=
- if ((L'LENGTH < 1) or (R'LENGTH < 1)) then
- assert NO_WARNING
- report "NUMERIC_STD.""?="": null detected, returning X"
- severity warning;
- return 'X';
- else
- LX := RESIZE(XL, SIZE);
- RX := RESIZE(XR, SIZE);
- result := '1';
- for i in LX'low to LX'high loop
- result1 := \?=\ (LX(i), RX(i));
- if result1 = 'U' then
- return 'U';
- elsif result1 = 'X' or result = 'X' then
- result := 'X';
- else
- result := result and result1;
- end if;
- end loop;
- return result;
- end if;
- end function \?=\;
-
- function \?/=\ (L, R : UNSIGNED) return std_ulogic is
- constant L_LEFT : INTEGER := L'LENGTH-1;
- constant R_LEFT : INTEGER := R'LENGTH-1;
- alias XL : UNSIGNED(L_LEFT downto 0) is L;
- alias XR : UNSIGNED(R_LEFT downto 0) is R;
- constant SIZE : NATURAL := MAXIMUM(L'LENGTH, R'LENGTH);
- variable LX : UNSIGNED(SIZE-1 downto 0);
- variable RX : UNSIGNED(SIZE-1 downto 0);
- variable result, result1 : STD_ULOGIC; -- result
- begin -- ?=
- if ((L'LENGTH < 1) or (R'LENGTH < 1)) then
- assert NO_WARNING
- report "NUMERIC_STD.""?/="": null detected, returning X"
- severity warning;
- return 'X';
- else
- LX := RESIZE(XL, SIZE);
- RX := RESIZE(XR, SIZE);
- result := '0';
- for i in LX'low to LX'high loop
- result1 := \?/=\ (LX(i), RX(i));
- if result1 = 'U' then
- return 'U';
- elsif result1 = 'X' or result = 'X' then
- result := 'X';
- else
- result := result or result1;
- end if;
- end loop;
- return result;
- end if;
- end function \?/=\;
-
- function \?/=\ (L, R : SIGNED) return std_ulogic is
- constant L_LEFT : INTEGER := L'LENGTH-1;
- constant R_LEFT : INTEGER := R'LENGTH-1;
- alias XL : SIGNED(L_LEFT downto 0) is L;
- alias XR : SIGNED(R_LEFT downto 0) is R;
- constant SIZE : NATURAL := MAXIMUM(L'LENGTH, R'LENGTH);
- variable LX : SIGNED(SIZE-1 downto 0);
- variable RX : SIGNED(SIZE-1 downto 0);
- variable result, result1 : STD_ULOGIC; -- result
- begin -- ?=
- if ((L'LENGTH < 1) or (R'LENGTH < 1)) then
- assert NO_WARNING
- report "NUMERIC_STD.""?/="": null detected, returning X"
- severity warning;
- return 'X';
- else
- LX := RESIZE(XL, SIZE);
- RX := RESIZE(XR, SIZE);
- result := '0';
- for i in LX'low to LX'high loop
- result1 := \?/=\ (LX(i), RX(i));
- if result1 = 'U' then
- return 'U';
- elsif result1 = 'X' or result = 'X' then
- result := 'X';
- else
- result := result or result1;
- end if;
- end loop;
- return result;
- end if;
- end function \?/=\;
-
- function Is_X ( s : UNSIGNED ) return BOOLEAN is
- begin
- return Is_X (STD_LOGIC_VECTOR (s));
- end function Is_X;
-
- function Is_X ( s : SIGNED ) return BOOLEAN is
- begin
- return Is_X (STD_LOGIC_VECTOR (s));
- end function Is_X;
- function \?>\ (L, R : UNSIGNED) return STD_ULOGIC is
- begin
- if ((l'length < 1) or (r'length < 1)) then
- assert NO_WARNING
- report "NUMERIC_STD.""?>"": null detected, returning X"
- severity warning;
- return 'X';
- else
- for i in L'range loop
- if L(i) = '-' then
- report "NUMERIC_STD.""?>"": '-' found in compare string"
- severity error;
- return 'X';
- end if;
- end loop;
- for i in R'range loop
- if R(i) = '-' then
- report "NUMERIC_STD.""?>"": '-' found in compare string"
- severity error;
- return 'X';
- end if;
- end loop;
- if is_x(l) or is_x(r) then
- return 'X';
- elsif l > r then
- return '1';
- else
- return '0';
- end if;
- end if;
- end function \?>\;
- -- %%% function "?>" (L, R : UNSIGNED) return std_ulogic is
- -- %%% end function "?>"\;
- function \?>\ (L, R : SIGNED) return STD_ULOGIC is
- begin
- if ((l'length < 1) or (r'length < 1)) then
- assert NO_WARNING
- report "NUMERIC_STD.""?>"": null detected, returning X"
- severity warning;
- return 'X';
- else
- for i in L'range loop
- if L(i) = '-' then
- report "NUMERIC_STD.""?>"": '-' found in compare string"
- severity error;
- return 'X';
- end if;
- end loop;
- for i in R'range loop
- if R(i) = '-' then
- report "NUMERIC_STD.""?>"": '-' found in compare string"
- severity error;
- return 'X';
- end if;
- end loop;
- if is_x(l) or is_x(r) then
- return 'X';
- elsif l > r then
- return '1';
- else
- return '0';
- end if;
- end if;
- end function \?>\;
- function \?>=\ (L, R : UNSIGNED) return STD_ULOGIC is
- begin
- if ((l'length < 1) or (r'length < 1)) then
- assert NO_WARNING
- report "NUMERIC_STD.""?>="": null detected, returning X"
- severity warning;
- return 'X';
- else
- for i in L'range loop
- if L(i) = '-' then
- report "NUMERIC_STD.""?>="": '-' found in compare string"
- severity error;
- return 'X';
- end if;
- end loop;
- for i in R'range loop
- if R(i) = '-' then
- report "NUMERIC_STD.""?>="": '-' found in compare string"
- severity error;
- return 'X';
- end if;
- end loop;
- if is_x(l) or is_x(r) then
- return 'X';
- elsif l >= r then
- return '1';
- else
- return '0';
- end if;
- end if;
- end function \?>=\;
- -- %%% function "?>=" (L, R : UNSIGNED) return std_ulogic is
- -- %%% end function "?>=";
- function \?>=\ (L, R : SIGNED) return STD_ULOGIC is
- begin
- if ((l'length < 1) or (r'length < 1)) then
- assert NO_WARNING
- report "NUMERIC_STD.""?>="": null detected, returning X"
- severity warning;
- return 'X';
- else
- for i in L'range loop
- if L(i) = '-' then
- report "NUMERIC_STD.""?>="": '-' found in compare string"
- severity error;
- return 'X';
- end if;
- end loop;
- for i in R'range loop
- if R(i) = '-' then
- report "NUMERIC_STD.""?>="": '-' found in compare string"
- severity error;
- return 'X';
- end if;
- end loop;
- if is_x(l) or is_x(r) then
- return 'X';
- elsif l >= r then
- return '1';
- else
- return '0';
- end if;
- end if;
- end function \?>=\;
- function \?<\ (L, R : UNSIGNED) return STD_ULOGIC is
- begin
- if ((l'length < 1) or (r'length < 1)) then
- assert NO_WARNING
- report "NUMERIC_STD.""?<"": null detected, returning X"
- severity warning;
- return 'X';
- else
- for i in L'range loop
- if L(i) = '-' then
- report "NUMERIC_STD.""?<"": '-' found in compare string"
- severity error;
- return 'X';
- end if;
- end loop;
- for i in R'range loop
- if R(i) = '-' then
- report "NUMERIC_STD.""?<"": '-' found in compare string"
- severity error;
- return 'X';
- end if;
- end loop;
- if is_x(l) or is_x(r) then
- return 'X';
- elsif l < r then
- return '1';
- else
- return '0';
- end if;
- end if;
- end function \?<\;
- -- %%% function "?<" (L, R : UNSIGNED) return std_ulogic is
- -- %%% end function "?<";
- function \?<\ (L, R : SIGNED) return STD_ULOGIC is
- begin
- if ((l'length < 1) or (r'length < 1)) then
- assert NO_WARNING
- report "NUMERIC_STD.""?<"": null detected, returning X"
- severity warning;
- return 'X';
- else
- for i in L'range loop
- if L(i) = '-' then
- report "NUMERIC_STD.""?<"": '-' found in compare string"
- severity error;
- return 'X';
- end if;
- end loop;
- for i in R'range loop
- if R(i) = '-' then
- report "NUMERIC_STD.""?<"": '-' found in compare string"
- severity error;
- return 'X';
- end if;
- end loop;
- if is_x(l) or is_x(r) then
- return 'X';
- elsif l < r then
- return '1';
- else
- return '0';
- end if;
- end if;
- end function \?<\;
- function \?<=\ (L, R : UNSIGNED) return STD_ULOGIC is
- begin
- if ((l'length < 1) or (r'length < 1)) then
- assert NO_WARNING
- report "NUMERIC_STD.""?<="": null detected, returning X"
- severity warning;
- return 'X';
- else
- for i in L'range loop
- if L(i) = '-' then
- report "NUMERIC_STD.""?<="": '-' found in compare string"
- severity error;
- return 'X';
- end if;
- end loop;
- for i in R'range loop
- if R(i) = '-' then
- report "NUMERIC_STD.""?<="": '-' found in compare string"
- severity error;
- return 'X';
- end if;
- end loop;
- if is_x(l) or is_x(r) then
- return 'X';
- elsif l <= r then
- return '1';
- else
- return '0';
- end if;
- end if;
- end function \?<=\;
- -- %%% function "?<=" (L, R : UNSIGNED) return std_ulogic is
- -- %%% end function "?<=";
- function \?<=\ (L, R : SIGNED) return STD_ULOGIC is
- begin
- if ((l'length < 1) or (r'length < 1)) then
- assert NO_WARNING
- report "NUMERIC_STD.""?<="": null detected, returning X"
- severity warning;
- return 'X';
- else
- for i in L'range loop
- if L(i) = '-' then
- report "NUMERIC_STD.""?<="": '-' found in compare string"
- severity error;
- return 'X';
- end if;
- end loop;
- for i in R'range loop
- if R(i) = '-' then
- report "NUMERIC_STD.""?<="": '-' found in compare string"
- severity error;
- return 'X';
- end if;
- end loop;
- if is_x(l) or is_x(r) then
- return 'X';
- elsif l <= r then
- return '1';
- else
- return '0';
- end if;
- end if;
- end function \?<=\;
-
--- %%% END replicated functions
- -- Special version of "minimum" to do some boundary checking without errors
- function mins (l, r : INTEGER)
- return INTEGER is
- begin -- function mins
- if (L = INTEGER'low or R = INTEGER'low) then
- return 0; -- error condition, silent
- end if;
- return minimum (L, R);
- end function mins;
-
- -- Special version of "minimum" to do some boundary checking with errors
- function mine (l, r : INTEGER)
- return INTEGER is
- begin -- function mine
- if (L = INTEGER'low or R = INTEGER'low) then
- report "fixed_pkg:"
- & " Unbounded number passed, was a literal used?"
- severity error;
- return 0;
- end if;
- return minimum (L, R);
- end function mine;
-
- -- The following functions are used only internally. Every function
- -- calls "cleanvec" either directly or indirectly.
- -- purpose: Fixes "downto" problem and resolves meta states
- function cleanvec (
- arg : UNRESOLVED_sfixed) -- input
- return UNRESOLVED_sfixed is
- constant left_index : INTEGER := maximum(arg'left, arg'right);
- constant right_index : INTEGER := mins(arg'left, arg'right);
- variable result : UNRESOLVED_sfixed (arg'range);
- begin -- function cleanvec
- assert not (arg'ascending and (arg'low /= INTEGER'low))
- report "fixed_pkg:"
- & " Vector passed using a ""to"" range, expected is ""downto"""
- severity error;
- return arg;
- end function cleanvec;
-
- -- purpose: Fixes "downto" problem and resolves meta states
- function cleanvec (
- arg : UNRESOLVED_ufixed) -- input
- return UNRESOLVED_ufixed is
- constant left_index : INTEGER := maximum(arg'left, arg'right);
- constant right_index : INTEGER := mins(arg'left, arg'right);
- variable result : UNRESOLVED_ufixed (arg'range);
- begin -- function cleanvec
- assert not (arg'ascending and (arg'low /= INTEGER'low))
- report "fixed_pkg:"
- & " Vector passed using a ""to"" range, expected is ""downto"""
- severity error;
- return arg;
- end function cleanvec;
-
- -- Type convert a "unsigned" into a "ufixed", used internally
- function to_fixed (
- arg : UNSIGNED; -- shifted vector
- constant left_index : INTEGER;
- constant right_index : INTEGER)
- return UNRESOLVED_ufixed is
- variable result : UNRESOLVED_ufixed (left_index downto right_index);
- begin -- function to_fixed
- result := UNRESOLVED_ufixed(arg);
- return result;
- end function to_fixed;
-
- -- Type convert a "signed" into an "sfixed", used internally
- function to_fixed (
- arg : SIGNED; -- shifted vector
- constant left_index : INTEGER;
- constant right_index : INTEGER)
- return UNRESOLVED_sfixed is
- variable result : UNRESOLVED_sfixed (left_index downto right_index);
- begin -- function to_fixed
- result := UNRESOLVED_sfixed(arg);
- return result;
- end function to_fixed;
-
- -- Type convert a "ufixed" into an "unsigned", used internally
- function to_uns (
- arg : UNRESOLVED_ufixed) -- fp vector
- return UNSIGNED is
- subtype t is UNSIGNED(arg'high - arg'low downto 0);
- variable slv : t;
- begin -- function to_uns
- slv := t(arg);
- return slv;
- end function to_uns;
-
- -- Type convert an "sfixed" into a "signed", used internally
- function to_s (
- arg : UNRESOLVED_sfixed) -- fp vector
- return SIGNED is
- subtype t is SIGNED(arg'high - arg'low downto 0);
- variable slv : t;
- begin -- function to_s
- slv := t(arg);
- return slv;
- end function to_s;
-
- -- adds 1 to the LSB of the number
- procedure round_up (arg : in UNRESOLVED_ufixed;
- result : out UNRESOLVED_ufixed;
- overflowx : out BOOLEAN) is
- variable arguns, resuns : UNSIGNED (arg'high-arg'low+1 downto 0)
- := (others => '0');
- begin -- round_up
- arguns (arguns'high-1 downto 0) := to_uns (arg);
- resuns := arguns + 1;
- result := to_fixed(resuns(arg'high-arg'low
- downto 0), arg'high, arg'low);
- overflowx := (resuns(resuns'high) = '1');
- end procedure round_up;
-
- -- adds 1 to the LSB of the number
- procedure round_up (arg : in UNRESOLVED_sfixed;
- result : out UNRESOLVED_sfixed;
- overflowx : out BOOLEAN) is
- variable args, ress : SIGNED (arg'high-arg'low+1 downto 0);
- begin -- round_up
- args (args'high-1 downto 0) := to_s (arg);
- args(args'high) := arg(arg'high); -- sign extend
- ress := args + 1;
- result := to_fixed(ress (ress'high-1
- downto 0), arg'high, arg'low);
- overflowx := ((arg(arg'high) /= ress(ress'high-1))
- and (or_reduce (STD_ULOGIC_VECTOR(ress)) /= '0'));
- end procedure round_up;
-
- -- Rounding - Performs a "round_nearest" (IEEE 754) which rounds up
- -- when the remainder is > 0.5. If the remainder IS 0.5 then if the
- -- bottom bit is a "1" it is rounded, otherwise it remains the same.
- function round_fixed (arg : UNRESOLVED_ufixed;
- remainder : UNRESOLVED_ufixed;
- overflow_style : fixed_overflow_style_type := fixed_overflow_style)
- return UNRESOLVED_ufixed is
- variable rounds : BOOLEAN;
- variable round_overflow : BOOLEAN;
- variable result : UNRESOLVED_ufixed (arg'range);
- begin
- rounds := false;
- if (remainder'length > 1) then
- if (remainder (remainder'high) = '1') then
- rounds := (arg(arg'low) = '1')
- or (or_reduce (to_sulv(remainder(remainder'high-1 downto
- remainder'low))) = '1');
- end if;
- else
- rounds := (arg(arg'low) = '1') and (remainder (remainder'high) = '1');
- end if;
- if rounds then
- round_up(arg => arg,
- result => result,
- overflowx => round_overflow);
- else
- result := arg;
- end if;
- if (overflow_style = fixed_saturate) and round_overflow then
- result := saturate (result'high, result'low);
- end if;
- return result;
- end function round_fixed;
-
- -- Rounding case statement
- function round_fixed (arg : UNRESOLVED_sfixed;
- remainder : UNRESOLVED_sfixed;
- overflow_style : fixed_overflow_style_type := fixed_overflow_style)
- return UNRESOLVED_sfixed is
- variable rounds : BOOLEAN;
- variable round_overflow : BOOLEAN;
- variable result : UNRESOLVED_sfixed (arg'range);
- begin
- rounds := false;
- if (remainder'length > 1) then
- if (remainder (remainder'high) = '1') then
- rounds := (arg(arg'low) = '1')
- or (or_reduce (to_sulv(remainder(remainder'high-1 downto
- remainder'low))) = '1');
- end if;
- else
- rounds := (arg(arg'low) = '1') and (remainder (remainder'high) = '1');
- end if;
- if rounds then
- round_up(arg => arg,
- result => result,
- overflowx => round_overflow);
- else
- result := arg;
- end if;
- if round_overflow then
- if (overflow_style = fixed_saturate) then
- if arg(arg'high) = '0' then
- result := saturate (result'high, result'low);
- else
- result := not saturate (result'high, result'low);
- end if;
- -- Sign bit not fixed when wrapping
- end if;
- end if;
- return result;
- end function round_fixed;
-
- -- converts an sfixed into a ufixed. The output is the same length as the
- -- input, because abs("1000") = "1000" = 8.
- function to_ufixed (
- arg : UNRESOLVED_sfixed)
- return UNRESOLVED_ufixed
- is
- constant left_index : INTEGER := arg'high;
- constant right_index : INTEGER := mine(arg'low, arg'low);
- variable xarg : UNRESOLVED_sfixed(left_index+1 downto right_index);
- variable result : UNRESOLVED_ufixed(left_index downto right_index);
- begin
- if arg'length < 1 then
- return NAUF;
- end if;
- xarg := abs(arg);
- result := UNRESOLVED_ufixed (xarg (left_index downto right_index));
- return result;
- end function to_ufixed;
-
------------------------------------------------------------------------------
--- Visible functions
------------------------------------------------------------------------------
-
- -- Conversion functions. These are needed for synthesis where typically
- -- the only input and output type is a std_logic_vector.
- function to_sulv (
- arg : UNRESOLVED_ufixed) -- fixed point vector
- return STD_ULOGIC_VECTOR is
- variable result : STD_ULOGIC_VECTOR (arg'length-1 downto 0);
- begin
- if arg'length < 1 then
- return NSLV;
- end if;
- result := STD_ULOGIC_VECTOR (arg);
- return result;
- end function to_sulv;
-
- function to_sulv (
- arg : UNRESOLVED_sfixed) -- fixed point vector
- return STD_ULOGIC_VECTOR is
- variable result : STD_ULOGIC_VECTOR (arg'length-1 downto 0);
- begin
- if arg'length < 1 then
- return NSLV;
- end if;
- result := STD_ULOGIC_VECTOR (arg);
- return result;
- end function to_sulv;
-
- function to_slv (
- arg : UNRESOLVED_ufixed) -- fixed point vector
- return STD_LOGIC_VECTOR is
- begin
- return std_logic_vector(to_sulv(arg));
- end function to_slv;
-
- function to_slv (
- arg : UNRESOLVED_sfixed) -- fixed point vector
- return STD_LOGIC_VECTOR is
- begin
- return std_logic_vector(to_sulv(arg));
- end function to_slv;
-
- function to_ufixed (
- arg : STD_ULOGIC_VECTOR; -- shifted vector
- constant left_index : INTEGER;
- constant right_index : INTEGER)
- return unresolved_ufixed is
- variable result : UNRESOLVED_ufixed (left_index downto right_index);
- begin
- if (arg'length < 1 or right_index > left_index) then
- return NAUF;
- end if;
- if (arg'length /= result'length) then
- report "fixed_pkg:" & "TO_UFIXED(SLV) "
- & "Vector lengths do not match. Input length is "
- & INTEGER'image(arg'length) & " and output will be "
- & INTEGER'image(result'length) & " wide."
- severity error;
- return NAUF;
- else
- result := to_fixed (arg => UNSIGNED(arg),
- left_index => left_index,
- right_index => right_index);
- return result;
- end if;
- end function to_ufixed;
-
- function to_sfixed (
- arg : STD_ULOGIC_VECTOR; -- shifted vector
- constant left_index : INTEGER;
- constant right_index : INTEGER)
- return unresolved_sfixed is
- variable result : UNRESOLVED_sfixed (left_index downto right_index);
- begin
- if (arg'length < 1 or right_index > left_index) then
- return NASF;
- end if;
- if (arg'length /= result'length) then
- report "fixed_pkg:" & "TO_SFIXED(SLV) "
- & "Vector lengths do not match. Input length is "
- & INTEGER'image(arg'length) & " and output will be "
- & INTEGER'image(result'length) & " wide."
- severity error;
- return NASF;
- else
- result := to_fixed (arg => SIGNED(arg),
- left_index => left_index,
- right_index => right_index);
- return result;
- end if;
- end function to_sfixed;
-
- -- Two's complement number, Grows the vector by 1 bit.
- -- because "abs (1000.000) = 01000.000" or abs(-16) = 16.
- function "abs" (
- arg : UNRESOLVED_sfixed) -- fixed point input
- return UNRESOLVED_sfixed is
- constant left_index : INTEGER := arg'high;
- constant right_index : INTEGER := mine(arg'low, arg'low);
- variable ressns : SIGNED (arg'length downto 0);
- variable result : UNRESOLVED_sfixed (left_index+1 downto right_index);
- begin
- if (arg'length < 1 or result'length < 1) then
- return NASF;
- end if;
- ressns (arg'length-1 downto 0) := to_s (cleanvec (arg));
- ressns (arg'length) := ressns (arg'length-1); -- expand sign bit
- result := to_fixed (abs(ressns), left_index+1, right_index);
- return result;
- end function "abs";
-
- -- also grows the vector by 1 bit.
- function "-" (
- arg : UNRESOLVED_sfixed) -- fixed point input
- return UNRESOLVED_sfixed is
- constant left_index : INTEGER := arg'high+1;
- constant right_index : INTEGER := mine(arg'low, arg'low);
- variable ressns : SIGNED (arg'length downto 0);
- variable result : UNRESOLVED_sfixed (left_index downto right_index);
- begin
- if (arg'length < 1 or result'length < 1) then
- return NASF;
- end if;
- ressns (arg'length-1 downto 0) := to_s (cleanvec(arg));
- ressns (arg'length) := ressns (arg'length-1); -- expand sign bit
- result := to_fixed (-ressns, left_index, right_index);
- return result;
- end function "-";
-
- -- Addition
- function "+" (
- l, r : UNRESOLVED_ufixed) -- ufixed(a downto b) + ufixed(c downto d) =
- return UNRESOLVED_ufixed is -- ufixed(max(a,c)+1 downto min(b,d))
- constant left_index : INTEGER := maximum(l'high, r'high)+1;
- constant right_index : INTEGER := mine(l'low, r'low);
- variable lresize, rresize : UNRESOLVED_ufixed (left_index downto right_index);
- variable result : UNRESOLVED_ufixed (left_index downto right_index);
- variable lslv, rslv : UNSIGNED (left_index-right_index
- downto 0);
- variable result_slv : UNSIGNED (left_index-right_index
- downto 0);
- begin
- if (l'length < 1 or r'length < 1 or result'length < 1) then
- return NAUF;
- end if;
- lresize := resize (l, left_index, right_index);
- rresize := resize (r, left_index, right_index);
- lslv := to_uns (lresize);
- rslv := to_uns (rresize);
- result_slv := lslv + rslv;
- result := to_fixed(result_slv, left_index, right_index);
- return result;
- end function "+";
-
- function "+" (
- l, r : UNRESOLVED_sfixed) -- sfixed(a downto b) + sfixed(c downto d) =
- return UNRESOLVED_sfixed is -- sfixed(max(a,c)+1 downto min(b,d))
- constant left_index : INTEGER := maximum(l'high, r'high)+1;
- constant right_index : INTEGER := mine(l'low, r'low);
- variable lresize, rresize : UNRESOLVED_sfixed (left_index downto right_index);
- variable result : UNRESOLVED_sfixed (left_index downto right_index);
- variable lslv, rslv : SIGNED (left_index-right_index downto 0);
- variable result_slv : SIGNED (left_index-right_index downto 0);
- begin
- if (l'length < 1 or r'length < 1 or result'length < 1) then
- return NASF;
- end if;
- lresize := resize (l, left_index, right_index);
- rresize := resize (r, left_index, right_index);
- lslv := to_s (lresize);
- rslv := to_s (rresize);
- result_slv := lslv + rslv;
- result := to_fixed(result_slv, left_index, right_index);
- return result;
- end function "+";
-
- -- Subtraction
- function "-" (
- l, r : UNRESOLVED_ufixed) -- ufixed(a downto b) - ufixed(c downto d) =
- return UNRESOLVED_ufixed is -- ufixed(max(a,c)+1 downto min(b,d))
- constant left_index : INTEGER := maximum(l'high, r'high)+1;
- constant right_index : INTEGER := mine(l'low, r'low);
- variable lresize, rresize : UNRESOLVED_ufixed (left_index downto right_index);
- variable result : UNRESOLVED_ufixed (left_index downto right_index);
- variable lslv, rslv : UNSIGNED (left_index-right_index
- downto 0);
- variable result_slv : UNSIGNED (left_index-right_index
- downto 0);
- begin
- if (l'length < 1 or r'length < 1 or result'length < 1) then
- return NAUF;
- end if;
- lresize := resize (l, left_index, right_index);
- rresize := resize (r, left_index, right_index);
- lslv := to_uns (lresize);
- rslv := to_uns (rresize);
- result_slv := lslv - rslv;
- result := to_fixed(result_slv, left_index, right_index);
- return result;
- end function "-";
-
- function "-" (
- l, r : UNRESOLVED_sfixed) -- sfixed(a downto b) - sfixed(c downto d) =
- return UNRESOLVED_sfixed is -- sfixed(max(a,c)+1 downto min(b,d))
- constant left_index : INTEGER := maximum(l'high, r'high)+1;
- constant right_index : INTEGER := mine(l'low, r'low);
- variable lresize, rresize : UNRESOLVED_sfixed (left_index downto right_index);
- variable result : UNRESOLVED_sfixed (left_index downto right_index);
- variable lslv, rslv : SIGNED (left_index-right_index downto 0);
- variable result_slv : SIGNED (left_index-right_index downto 0);
- begin
- if (l'length < 1 or r'length < 1 or result'length < 1) then
- return NASF;
- end if;
- lresize := resize (l, left_index, right_index);
- rresize := resize (r, left_index, right_index);
- lslv := to_s (lresize);
- rslv := to_s (rresize);
- result_slv := lslv - rslv;
- result := to_fixed(result_slv, left_index, right_index);
- return result;
- end function "-";
-
- function "*" (
- l, r : UNRESOLVED_ufixed) -- ufixed(a downto b) * ufixed(c downto d) =
- return UNRESOLVED_ufixed is -- ufixed(a+c+1 downto b+d)
- variable lslv : UNSIGNED (l'length-1 downto 0);
- variable rslv : UNSIGNED (r'length-1 downto 0);
- variable result_slv : UNSIGNED (r'length+l'length-1 downto 0);
- variable result : UNRESOLVED_ufixed (l'high + r'high+1 downto
- mine(l'low, l'low) + mine(r'low, r'low));
- begin
- if (l'length < 1 or r'length < 1 or
- result'length /= result_slv'length) then
- return NAUF;
- end if;
- lslv := to_uns (cleanvec(l));
- rslv := to_uns (cleanvec(r));
- result_slv := lslv * rslv;
- result := to_fixed (result_slv, result'high, result'low);
- return result;
- end function "*";
-
- function "*" (
- l, r : UNRESOLVED_sfixed) -- sfixed(a downto b) * sfixed(c downto d) =
- return UNRESOLVED_sfixed is -- sfixed(a+c+1 downto b+d)
- variable lslv : SIGNED (l'length-1 downto 0);
- variable rslv : SIGNED (r'length-1 downto 0);
- variable result_slv : SIGNED (r'length+l'length-1 downto 0);
- variable result : UNRESOLVED_sfixed (l'high + r'high+1 downto
- mine(l'low, l'low) + mine(r'low, r'low));
- begin
- if (l'length < 1 or r'length < 1 or
- result'length /= result_slv'length) then
- return NASF;
- end if;
- lslv := to_s (cleanvec(l));
- rslv := to_s (cleanvec(r));
- result_slv := lslv * rslv;
- result := to_fixed (result_slv, result'high, result'low);
- return result;
- end function "*";
-
--- function "/" (
--- l, r : UNRESOLVED_ufixed) -- ufixed(a downto b) / ufixed(c downto d) =
--- return UNRESOLVED_ufixed is -- ufixed(a-d downto b-c-1)
--- begin
--- return divide (l, r);
--- end function "/";
-
--- function "/" (
--- l, r : UNRESOLVED_sfixed) -- sfixed(a downto b) / sfixed(c downto d) =
--- return UNRESOLVED_sfixed is -- sfixed(a-d+1 downto b-c)
--- begin
--- return divide (l, r);
--- end function "/";
-
- -- This version of divide gives the user more control
- -- ufixed(a downto b) / ufixed(c downto d) = ufixed(a-d downto b-c-1)
--- function divide (
--- l, r : UNRESOLVED_ufixed;
--- constant round_style : fixed_round_style_type := fixed_round_style;
--- constant guard_bits : NATURAL := fixed_guard_bits)
--- return UNRESOLVED_ufixed is
--- variable result : UNRESOLVED_ufixed (l'high - mine(r'low, r'low) downto
--- mine (l'low, l'low) - r'high -1);
--- variable dresult : UNRESOLVED_ufixed (result'high downto result'low -guard_bits);
--- variable lresize : UNRESOLVED_ufixed (l'high downto l'high - dresult'length+1);
--- variable lslv : UNSIGNED (lresize'length-1 downto 0);
--- variable rslv : UNSIGNED (r'length-1 downto 0);
--- variable result_slv : UNSIGNED (lresize'length-1 downto 0);
--- begin
--- if (l'length < 1 or r'length < 1 or
--- mins(r'low, r'low) /= r'low or mins(l'low, l'low) /= l'low) then
--- return NAUF;
--- end if;
--- lresize := resize (arg => l,
--- left_index => lresize'high,
--- right_index => lresize'low,
--- overflow_style => fixed_wrap, -- vector only grows
--- round_style => fixed_truncate);
--- lslv := to_uns (cleanvec (lresize));
--- rslv := to_uns (cleanvec (r));
--- if (rslv = 0) then
--- report "fixed_pkg:"
--- & "DIVIDE(ufixed) Division by zero" severity error;
--- result := saturate (result'high, result'low); -- saturate
--- else
--- result_slv := lslv / rslv;
--- dresult := to_fixed (result_slv, dresult'high, dresult'low);
--- result := resize (arg => dresult,
--- left_index => result'high,
--- right_index => result'low,
--- overflow_style => fixed_wrap, -- overflow impossible
--- round_style => round_style);
--- end if;
--- return result;
--- end function divide;
-
- -- sfixed(a downto b) / sfixed(c downto d) = sfixed(a-d+1 downto b-c)
--- function divide (
--- l, r : UNRESOLVED_sfixed;
--- constant round_style : fixed_round_style_type := fixed_round_style;
--- constant guard_bits : NATURAL := fixed_guard_bits)
--- return UNRESOLVED_sfixed is
--- variable result : UNRESOLVED_sfixed (l'high - mine(r'low, r'low) + 1 downto
--- mine (l'low, l'low) - r'high);
--- variable dresult : UNRESOLVED_sfixed (result'high downto result'low-guard_bits);
--- variable lresize : UNRESOLVED_sfixed (l'high+1 downto l'high+1 -dresult'length+1);
--- variable lslv : SIGNED (lresize'length-1 downto 0);
--- variable rslv : SIGNED (r'length-1 downto 0);
--- variable result_slv : SIGNED (lresize'length-1 downto 0);
--- begin
--- if (l'length < 1 or r'length < 1 or
--- mins(r'low, r'low) /= r'low or mins(l'low, l'low) /= l'low) then
--- return NASF;
--- end if;
--- lresize := resize (arg => l,
--- left_index => lresize'high,
--- right_index => lresize'low,
--- overflow_style => fixed_wrap, -- vector only grows
--- round_style => fixed_truncate);
--- lslv := to_s (cleanvec (lresize));
--- rslv := to_s (cleanvec (r));
--- if (rslv = 0) then
--- report "fixed_pkg:"
--- & "DIVIDE(sfixed) Division by zero" severity error;
--- result := saturate (result'high, result'low);
--- else
--- result_slv := lslv / rslv;
--- dresult := to_fixed (result_slv, dresult'high, dresult'low);
--- result := resize (arg => dresult,
--- left_index => result'high,
--- right_index => result'low,
--- overflow_style => fixed_wrap, -- overflow impossible
--- round_style => round_style);
--- end if;
--- return result;
--- end function divide;
-
- -- 1 / ufixed(a downto b) = ufixed(-b downto -a-1)
--- function reciprocal (
--- arg : UNRESOLVED_ufixed; -- fixed point input
--- constant round_style : fixed_round_style_type := fixed_round_style;
--- constant guard_bits : NATURAL := fixed_guard_bits)
--- return UNRESOLVED_ufixed is
--- constant one : UNRESOLVED_ufixed (0 downto 0) := "1";
--- begin
--- return divide (l => one,
--- r => arg,
--- round_style => round_style,
--- guard_bits => guard_bits);
--- end function reciprocal;
-
- -- 1 / sfixed(a downto b) = sfixed(-b+1 downto -a)
--- function reciprocal (
--- arg : UNRESOLVED_sfixed; -- fixed point input
--- constant round_style : fixed_round_style_type := fixed_round_style;
--- constant guard_bits : NATURAL := fixed_guard_bits)
--- return UNRESOLVED_sfixed is
--- constant one : UNRESOLVED_sfixed (1 downto 0) := "01"; -- extra bit.
--- variable resultx : UNRESOLVED_sfixed (-mine(arg'low, arg'low)+2 downto -arg'high);
--- begin
--- if (arg'length < 1 or resultx'length < 1) then
--- return NASF;
--- else
--- resultx := divide (l => one,
--- r => arg,
--- round_style => round_style,
--- guard_bits => guard_bits);
--- return resultx (resultx'high-1 downto resultx'low); -- remove extra bit
--- end if;
--- end function reciprocal;
-
- -- ufixed (a downto b) rem ufixed (c downto d)
- -- = ufixed (min(a,c) downto min(b,d))
--- function "rem" (
--- l, r : UNRESOLVED_ufixed) -- fixed point input
--- return UNRESOLVED_ufixed is
--- begin
--- return remainder (l, r);
--- end function "rem";
-
--- -- remainder
--- -- sfixed (a downto b) rem sfixed (c downto d)
--- -- = sfixed (min(a,c) downto min(b,d))
--- function "rem" (
--- l, r : UNRESOLVED_sfixed) -- fixed point input
--- return UNRESOLVED_sfixed is
--- begin
--- return remainder (l, r);
--- end function "rem";
-
- -- ufixed (a downto b) rem ufixed (c downto d)
- -- = ufixed (min(a,c) downto min(b,d))
--- function remainder (
--- l, r : UNRESOLVED_ufixed; -- fixed point input
--- constant round_style : fixed_round_style_type := fixed_round_style;
--- constant guard_bits : NATURAL := fixed_guard_bits)
--- return UNRESOLVED_ufixed is
--- variable result : UNRESOLVED_ufixed (minimum(l'high, r'high) downto
--- mine(l'low, r'low));
--- variable lresize : UNRESOLVED_ufixed (maximum(l'high, r'low) downto
--- mins(r'low, r'low)-guard_bits);
--- variable rresize : UNRESOLVED_ufixed (r'high downto r'low-guard_bits);
--- variable dresult : UNRESOLVED_ufixed (rresize'range);
--- variable lslv : UNSIGNED (lresize'length-1 downto 0);
--- variable rslv : UNSIGNED (rresize'length-1 downto 0);
--- variable result_slv : UNSIGNED (rslv'range);
--- begin
--- if (l'length < 1 or r'length < 1 or
--- mins(r'low, r'low) /= r'low or mins(l'low, l'low) /= l'low) then
--- return NAUF;
--- end if;
--- lresize := resize (arg => l,
--- left_index => lresize'high,
--- right_index => lresize'low,
--- overflow_style => fixed_wrap, -- vector only grows
--- round_style => fixed_truncate);
--- lslv := to_uns (lresize);
--- rresize := resize (arg => r,
--- left_index => rresize'high,
--- right_index => rresize'low,
--- overflow_style => fixed_wrap, -- vector only grows
--- round_style => fixed_truncate);
--- rslv := to_uns (rresize);
--- if (rslv = 0) then
--- report "fixed_pkg:"
--- & "remainder(ufixed) Division by zero" severity error;
--- result := saturate (result'high, result'low); -- saturate
--- else
--- if (r'low <= l'high) then
--- result_slv := lslv rem rslv;
--- dresult := to_fixed (result_slv, dresult'high, dresult'low);
--- result := resize (arg => dresult,
--- left_index => result'high,
--- right_index => result'low,
--- overflow_style => fixed_wrap, -- can't overflow
--- round_style => round_style);
--- end if;
--- if l'low < r'low then
--- result(mins(r'low-1, l'high) downto l'low) :=
--- cleanvec(l(mins(r'low-1, l'high) downto l'low));
--- end if;
--- end if;
--- return result;
--- end function remainder;
-
--- -- remainder
--- -- sfixed (a downto b) rem sfixed (c downto d)
--- -- = sfixed (min(a,c) downto min(b,d))
--- function remainder (
--- l, r : UNRESOLVED_sfixed; -- fixed point input
--- constant round_style : fixed_round_style_type := fixed_round_style;
--- constant guard_bits : NATURAL := fixed_guard_bits)
--- return UNRESOLVED_sfixed is
--- variable l_abs : UNRESOLVED_ufixed (l'range);
--- variable r_abs : UNRESOLVED_ufixed (r'range);
--- variable result : UNRESOLVED_sfixed (minimum(r'high, l'high) downto
--- mine(r'low, l'low));
--- variable neg_result : UNRESOLVED_sfixed (minimum(r'high, l'high)+1 downto
--- mins(r'low, l'low));
--- begin
--- if (l'length < 1 or r'length < 1 or
--- mins(r'low, r'low) /= r'low or mins(l'low, l'low) /= l'low) then
--- return NASF;
--- end if;
--- l_abs := to_ufixed (l);
--- r_abs := to_ufixed (r);
--- result := UNRESOLVED_sfixed (remainder (
--- l => l_abs,
--- r => r_abs,
--- round_style => round_style));
--- neg_result := -result;
--- if l(l'high) = '1' then
--- result := neg_result(result'range);
--- end if;
--- return result;
--- end function remainder;
-
--- -- modulo
--- -- ufixed (a downto b) mod ufixed (c downto d)
--- -- = ufixed (min(a,c) downto min(b, d))
--- function "mod" (
--- l, r : UNRESOLVED_ufixed) -- fixed point input
--- return UNRESOLVED_ufixed is
--- begin
--- return modulo (l, r);
--- end function "mod";
-
--- -- sfixed (a downto b) mod sfixed (c downto d)
--- -- = sfixed (c downto min(b, d))
--- function "mod" (
--- l, r : UNRESOLVED_sfixed) -- fixed point input
--- return UNRESOLVED_sfixed is
--- begin
--- return modulo(l, r);
--- end function "mod";
-
--- -- modulo
--- -- ufixed (a downto b) mod ufixed (c downto d)
--- -- = ufixed (min(a,c) downto min(b, d))
--- function modulo (
--- l, r : UNRESOLVED_ufixed; -- fixed point input
--- constant round_style : fixed_round_style_type := fixed_round_style;
--- constant guard_bits : NATURAL := fixed_guard_bits)
--- return UNRESOLVED_ufixed is
--- begin
--- return remainder(l => l,
--- r => r,
--- round_style => round_style,
--- guard_bits => guard_bits);
--- end function modulo;
-
--- -- sfixed (a downto b) mod sfixed (c downto d)
--- -- = sfixed (c downto min(b, d))
--- function modulo (
--- l, r : UNRESOLVED_sfixed; -- fixed point input
--- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
--- constant round_style : fixed_round_style_type := fixed_round_style;
--- constant guard_bits : NATURAL := fixed_guard_bits)
--- return UNRESOLVED_sfixed is
--- variable l_abs : UNRESOLVED_ufixed (l'range);
--- variable r_abs : UNRESOLVED_ufixed (r'range);
--- variable result : UNRESOLVED_sfixed (r'high downto
--- mine(r'low, l'low));
--- variable dresult : UNRESOLVED_sfixed (minimum(r'high, l'high)+1 downto
--- mins(r'low, l'low));
--- variable dresult_not_zero : BOOLEAN;
--- begin
--- if (l'length < 1 or r'length < 1 or
--- mins(r'low, r'low) /= r'low or mins(l'low, l'low) /= l'low) then
--- return NASF;
--- end if;
--- l_abs := to_ufixed (l);
--- r_abs := to_ufixed (r);
--- dresult := "0" & UNRESOLVED_sfixed(remainder (l => l_abs,
--- r => r_abs,
--- round_style => round_style));
--- if (to_s(dresult) = 0) then
--- dresult_not_zero := false;
--- else
--- dresult_not_zero := true;
--- end if;
--- if to_x01(l(l'high)) = '1' and to_x01(r(r'high)) = '0'
--- and dresult_not_zero then
--- result := resize (arg => r - dresult,
--- left_index => result'high,
--- right_index => result'low,
--- overflow_style => overflow_style,
--- round_style => round_style);
--- elsif to_x01(l(l'high)) = '1' and to_x01(r(r'high)) = '1' then
--- result := resize (arg => -dresult,
--- left_index => result'high,
--- right_index => result'low,
--- overflow_style => overflow_style,
--- round_style => round_style);
--- elsif to_x01(l(l'high)) = '0' and to_x01(r(r'high)) = '1'
--- and dresult_not_zero then
--- result := resize (arg => dresult + r,
--- left_index => result'high,
--- right_index => result'low,
--- overflow_style => overflow_style,
--- round_style => round_style);
--- else
--- result := resize (arg => dresult,
--- left_index => result'high,
--- right_index => result'low,
--- overflow_style => overflow_style,
--- round_style => round_style);
--- end if;
--- return result;
--- end function modulo;
-
- -- Procedure for those who need an "accumulator" function
- procedure add_carry (
- L, R : in UNRESOLVED_ufixed;
- c_in : in STD_ULOGIC;
- result : out UNRESOLVED_ufixed;
- c_out : out STD_ULOGIC) is
- constant left_index : INTEGER := maximum(l'high, r'high)+1;
- constant right_index : INTEGER := mins(l'low, r'low);
- variable lresize, rresize : UNRESOLVED_ufixed (left_index downto right_index);
- variable lslv, rslv : UNSIGNED (left_index-right_index
- downto 0);
- variable result_slv : UNSIGNED (left_index-right_index
- downto 0);
- variable cx : UNSIGNED (0 downto 0); -- Carry in
- begin
- if (l'length < 1 or r'length < 1) then
- result := NAUF;
- c_out := '0';
- else
- cx (0) := c_in;
- lresize := resize (l, left_index, right_index);
- rresize := resize (r, left_index, right_index);
- lslv := to_uns (lresize);
- rslv := to_uns (rresize);
- result_slv := lslv + rslv + cx;
- c_out := result_slv(left_index);
- result := to_fixed(result_slv (left_index-right_index-1 downto 0),
- left_index-1, right_index);
- end if;
- end procedure add_carry;
-
- procedure add_carry (
- L, R : in UNRESOLVED_sfixed;
- c_in : in STD_ULOGIC;
- result : out UNRESOLVED_sfixed;
- c_out : out STD_ULOGIC) is
- constant left_index : INTEGER := maximum(l'high, r'high)+1;
- constant right_index : INTEGER := mins(l'low, r'low);
- variable lresize, rresize : UNRESOLVED_sfixed (left_index downto right_index);
- variable lslv, rslv : SIGNED (left_index-right_index
- downto 0);
- variable result_slv : SIGNED (left_index-right_index
- downto 0);
- variable cx : SIGNED (1 downto 0); -- Carry in
- begin
- if (l'length < 1 or r'length < 1) then
- result := NASF;
- c_out := '0';
- else
- cx (1) := '0';
- cx (0) := c_in;
- lresize := resize (l, left_index, right_index);
- rresize := resize (r, left_index, right_index);
- lslv := to_s (lresize);
- rslv := to_s (rresize);
- result_slv := lslv + rslv + cx;
- c_out := result_slv(left_index);
- result := to_fixed(result_slv (left_index-right_index-1 downto 0),
- left_index-1, right_index);
- end if;
- end procedure add_carry;
-
- -- Scales the result by a power of 2. Width of input = width of output with
- -- the decimal point moved.
- function scalb (y : UNRESOLVED_ufixed; N : INTEGER)
- return UNRESOLVED_ufixed is
- variable result : UNRESOLVED_ufixed (y'high+N downto y'low+N);
- begin
- if y'length < 1 then
- return NAUF;
- else
- result := y;
- return result;
- end if;
- end function scalb;
-
- function scalb (y : UNRESOLVED_ufixed; N : SIGNED)
- return UNRESOLVED_ufixed is
- begin
- return scalb (y => y,
- N => to_integer(N));
- end function scalb;
-
- function scalb (y : UNRESOLVED_sfixed; N : INTEGER)
- return UNRESOLVED_sfixed is
- variable result : UNRESOLVED_sfixed (y'high+N downto y'low+N);
- begin
- if y'length < 1 then
- return NASF;
- else
- result := y;
- return result;
- end if;
- end function scalb;
-
- function scalb (y : UNRESOLVED_sfixed; N : SIGNED)
- return UNRESOLVED_sfixed is
- begin
- return scalb (y => y,
- N => to_integer(N));
- end function scalb;
-
- function Is_Negative (arg : UNRESOLVED_sfixed) return BOOLEAN is
- begin
- if to_X01(arg(arg'high)) = '1' then
- return true;
- else
- return false;
- end if;
- end function Is_Negative;
-
- function find_rightmost (arg : UNRESOLVED_ufixed; y : STD_ULOGIC)
- return INTEGER is
- begin
- for_loop : for i in arg'reverse_range loop
- if \?=\ (arg(i), y) = '1' then
- return i;
- end if;
- end loop;
- return arg'high+1; -- return out of bounds 'high
- end function find_rightmost;
-
- function find_leftmost (arg : UNRESOLVED_ufixed; y : STD_ULOGIC)
- return INTEGER is
- begin
- for_loop : for i in arg'range loop
- if \?=\ (arg(i), y) = '1' then
- return i;
- end if;
- end loop;
- return arg'low-1; -- return out of bounds 'low
- end function find_leftmost;
-
- function find_rightmost (arg : UNRESOLVED_sfixed; y : STD_ULOGIC)
- return INTEGER is
- begin
- for_loop : for i in arg'reverse_range loop
- if \?=\ (arg(i), y) = '1' then
- return i;
- end if;
- end loop;
- return arg'high+1; -- return out of bounds 'high
- end function find_rightmost;
-
- function find_leftmost (arg : UNRESOLVED_sfixed; y : STD_ULOGIC)
- return INTEGER is
- begin
- for_loop : for i in arg'range loop
- if \?=\ (arg(i), y) = '1' then
- return i;
- end if;
- end loop;
- return arg'low-1; -- return out of bounds 'low
- end function find_leftmost;
-
- function "sll" (ARG : UNRESOLVED_ufixed; COUNT : INTEGER)
- return UNRESOLVED_ufixed is
- variable argslv : UNSIGNED (arg'length-1 downto 0);
- variable result : UNRESOLVED_ufixed (arg'range);
- begin
- argslv := to_uns (arg);
- argslv := argslv sll COUNT;
- result := to_fixed (argslv, result'high, result'low);
- return result;
- end function "sll";
-
- function "srl" (ARG : UNRESOLVED_ufixed; COUNT : INTEGER)
- return UNRESOLVED_ufixed is
- variable argslv : UNSIGNED (arg'length-1 downto 0);
- variable result : UNRESOLVED_ufixed (arg'range);
- begin
- argslv := to_uns (arg);
- argslv := argslv srl COUNT;
- result := to_fixed (argslv, result'high, result'low);
- return result;
- end function "srl";
-
- function "rol" (ARG : UNRESOLVED_ufixed; COUNT : INTEGER)
- return UNRESOLVED_ufixed is
- variable argslv : UNSIGNED (arg'length-1 downto 0);
- variable result : UNRESOLVED_ufixed (arg'range);
- begin
- argslv := to_uns (arg);
- argslv := argslv rol COUNT;
- result := to_fixed (argslv, result'high, result'low);
- return result;
- end function "rol";
-
- function "ror" (ARG : UNRESOLVED_ufixed; COUNT : INTEGER)
- return UNRESOLVED_ufixed is
- variable argslv : UNSIGNED (arg'length-1 downto 0);
- variable result : UNRESOLVED_ufixed (arg'range);
- begin
- argslv := to_uns (arg);
- argslv := argslv ror COUNT;
- result := to_fixed (argslv, result'high, result'low);
- return result;
- end function "ror";
-
- function "sla" (ARG : UNRESOLVED_ufixed; COUNT : INTEGER)
- return UNRESOLVED_ufixed is
- variable argslv : UNSIGNED (arg'length-1 downto 0);
- variable result : UNRESOLVED_ufixed (arg'range);
- begin
- argslv := to_uns (arg);
- -- Arithmetic shift on an unsigned is a logical shift
- argslv := argslv sll COUNT;
- result := to_fixed (argslv, result'high, result'low);
- return result;
- end function "sla";
-
- function "sra" (ARG : UNRESOLVED_ufixed; COUNT : INTEGER)
- return UNRESOLVED_ufixed is
- variable argslv : UNSIGNED (arg'length-1 downto 0);
- variable result : UNRESOLVED_ufixed (arg'range);
- begin
- argslv := to_uns (arg);
- -- Arithmetic shift on an unsigned is a logical shift
- argslv := argslv srl COUNT;
- result := to_fixed (argslv, result'high, result'low);
- return result;
- end function "sra";
-
- function "sll" (ARG : UNRESOLVED_sfixed; COUNT : INTEGER)
- return UNRESOLVED_sfixed is
- variable argslv : SIGNED (arg'length-1 downto 0);
- variable result : UNRESOLVED_sfixed (arg'range);
- begin
- argslv := to_s (arg);
- argslv := argslv sll COUNT;
- result := to_fixed (argslv, result'high, result'low);
- return result;
- end function "sll";
-
- function "srl" (ARG : UNRESOLVED_sfixed; COUNT : INTEGER)
- return UNRESOLVED_sfixed is
- variable argslv : SIGNED (arg'length-1 downto 0);
- variable result : UNRESOLVED_sfixed (arg'range);
- begin
- argslv := to_s (arg);
- argslv := argslv srl COUNT;
- result := to_fixed (argslv, result'high, result'low);
- return result;
- end function "srl";
-
- function "rol" (ARG : UNRESOLVED_sfixed; COUNT : INTEGER)
- return UNRESOLVED_sfixed is
- variable argslv : SIGNED (arg'length-1 downto 0);
- variable result : UNRESOLVED_sfixed (arg'range);
- begin
- argslv := to_s (arg);
- argslv := argslv rol COUNT;
- result := to_fixed (argslv, result'high, result'low);
- return result;
- end function "rol";
-
- function "ror" (ARG : UNRESOLVED_sfixed; COUNT : INTEGER)
- return UNRESOLVED_sfixed is
- variable argslv : SIGNED (arg'length-1 downto 0);
- variable result : UNRESOLVED_sfixed (arg'range);
- begin
- argslv := to_s (arg);
- argslv := argslv ror COUNT;
- result := to_fixed (argslv, result'high, result'low);
- return result;
- end function "ror";
-
- function "sla" (ARG : UNRESOLVED_sfixed; COUNT : INTEGER)
- return UNRESOLVED_sfixed is
- variable argslv : SIGNED (arg'length-1 downto 0);
- variable result : UNRESOLVED_sfixed (arg'range);
- begin
- argslv := to_s (arg);
- if COUNT > 0 then
- -- Arithmetic shift left on a 2's complement number is a logic shift
- argslv := argslv sll COUNT;
- else
- argslv := argslv sra -COUNT;
- end if;
- result := to_fixed (argslv, result'high, result'low);
- return result;
- end function "sla";
-
- function "sra" (ARG : UNRESOLVED_sfixed; COUNT : INTEGER)
- return UNRESOLVED_sfixed is
- variable argslv : SIGNED (arg'length-1 downto 0);
- variable result : UNRESOLVED_sfixed (arg'range);
- begin
- argslv := to_s (arg);
- if COUNT > 0 then
- argslv := argslv sra COUNT;
- else
- -- Arithmetic shift left on a 2's complement number is a logic shift
- argslv := argslv sll -COUNT;
- end if;
- result := to_fixed (argslv, result'high, result'low);
- return result;
- end function "sra";
-
- -- Because some people want the older functions.
- function SHIFT_LEFT (ARG : UNRESOLVED_ufixed; COUNT : NATURAL)
- return UNRESOLVED_ufixed is
- begin
- if (ARG'length < 1) then
- return NAUF;
- end if;
- return ARG sla COUNT;
- end function SHIFT_LEFT;
-
- function SHIFT_RIGHT (ARG : UNRESOLVED_ufixed; COUNT : NATURAL)
- return UNRESOLVED_ufixed is
- begin
- if (ARG'length < 1) then
- return NAUF;
- end if;
- return ARG sra COUNT;
- end function SHIFT_RIGHT;
-
- function SHIFT_LEFT (ARG : UNRESOLVED_sfixed; COUNT : NATURAL)
- return UNRESOLVED_sfixed is
- begin
- if (ARG'length < 1) then
- return NASF;
- end if;
- return ARG sla COUNT;
- end function SHIFT_LEFT;
-
- function SHIFT_RIGHT (ARG : UNRESOLVED_sfixed; COUNT : NATURAL)
- return UNRESOLVED_sfixed is
- begin
- if (ARG'length < 1) then
- return NASF;
- end if;
- return ARG sra COUNT;
- end function SHIFT_RIGHT;
-
- ----------------------------------------------------------------------------
- -- logical functions
- ----------------------------------------------------------------------------
- function "not" (L : UNRESOLVED_ufixed) return UNRESOLVED_ufixed is
- variable RESULT : STD_ULOGIC_VECTOR(L'length-1 downto 0); -- force downto
- begin
- RESULT := not to_sulv(L);
- return to_ufixed(RESULT, L'high, L'low);
- end function "not";
-
- function "and" (L, R : UNRESOLVED_ufixed) return UNRESOLVED_ufixed is
- variable RESULT : STD_ULOGIC_VECTOR(L'length-1 downto 0); -- force downto
- begin
- if (L'high = R'high and L'low = R'low) then
- RESULT := to_sulv(L) and to_sulv(R);
- else
- assert NO_WARNING
- report "fixed_pkg:"
- & """and"": Range error L'RANGE /= R'RANGE"
- severity warning;
- RESULT := (others => 'X');
- end if;
- return to_ufixed(RESULT, L'high, L'low);
- end function "and";
-
- function "or" (L, R : UNRESOLVED_ufixed) return UNRESOLVED_ufixed is
- variable RESULT : STD_ULOGIC_VECTOR(L'length-1 downto 0); -- force downto
- begin
- if (L'high = R'high and L'low = R'low) then
- RESULT := to_sulv(L) or to_sulv(R);
- else
- assert NO_WARNING
- report "fixed_pkg:"
- & """or"": Range error L'RANGE /= R'RANGE"
- severity warning;
- RESULT := (others => 'X');
- end if;
- return to_ufixed(RESULT, L'high, L'low);
- end function "or";
-
- function "nand" (L, R : UNRESOLVED_ufixed) return UNRESOLVED_ufixed is
- variable RESULT : STD_ULOGIC_VECTOR(L'length-1 downto 0); -- force downto
- begin
- if (L'high = R'high and L'low = R'low) then
- RESULT := to_sulv(L) nand to_sulv(R);
- else
- assert NO_WARNING
- report "fixed_pkg:"
- & """nand"": Range error L'RANGE /= R'RANGE"
- severity warning;
- RESULT := (others => 'X');
- end if;
- return to_ufixed(RESULT, L'high, L'low);
- end function "nand";
-
- function "nor" (L, R : UNRESOLVED_ufixed) return UNRESOLVED_ufixed is
- variable RESULT : STD_ULOGIC_VECTOR(L'length-1 downto 0); -- force downto
- begin
- if (L'high = R'high and L'low = R'low) then
- RESULT := to_sulv(L) nor to_sulv(R);
- else
- assert NO_WARNING
- report "fixed_pkg:"
- & """nor"": Range error L'RANGE /= R'RANGE"
- severity warning;
- RESULT := (others => 'X');
- end if;
- return to_ufixed(RESULT, L'high, L'low);
- end function "nor";
-
- function "xor" (L, R : UNRESOLVED_ufixed) return UNRESOLVED_ufixed is
- variable RESULT : STD_ULOGIC_VECTOR(L'length-1 downto 0); -- force downto
- begin
- if (L'high = R'high and L'low = R'low) then
- RESULT := to_sulv(L) xor to_sulv(R);
- else
- assert NO_WARNING
- report "fixed_pkg:"
- & """xor"": Range error L'RANGE /= R'RANGE"
- severity warning;
- RESULT := (others => 'X');
- end if;
- return to_ufixed(RESULT, L'high, L'low);
- end function "xor";
-
- function "xnor" (L, R : UNRESOLVED_ufixed) return UNRESOLVED_ufixed is
- variable RESULT : STD_ULOGIC_VECTOR(L'length-1 downto 0); -- force downto
- begin
- if (L'high = R'high and L'low = R'low) then
- RESULT := to_sulv(L) xnor to_sulv(R);
- else
- assert NO_WARNING
- report "fixed_pkg:"
- & """xnor"": Range error L'RANGE /= R'RANGE"
- severity warning;
- RESULT := (others => 'X');
- end if;
- return to_ufixed(RESULT, L'high, L'low);
- end function "xnor";
-
- function "not" (L : UNRESOLVED_sfixed) return UNRESOLVED_sfixed is
- variable RESULT : STD_ULOGIC_VECTOR(L'length-1 downto 0); -- force downto
- begin
- RESULT := not to_sulv(L);
- return to_sfixed(RESULT, L'high, L'low);
- end function "not";
-
- function "and" (L, R : UNRESOLVED_sfixed) return UNRESOLVED_sfixed is
- variable RESULT : STD_ULOGIC_VECTOR(L'length-1 downto 0); -- force downto
- begin
- if (L'high = R'high and L'low = R'low) then
- RESULT := to_sulv(L) and to_sulv(R);
- else
- assert NO_WARNING
- report "fixed_pkg:"
- & """and"": Range error L'RANGE /= R'RANGE"
- severity warning;
- RESULT := (others => 'X');
- end if;
- return to_sfixed(RESULT, L'high, L'low);
- end function "and";
-
- function "or" (L, R : UNRESOLVED_sfixed) return UNRESOLVED_sfixed is
- variable RESULT : STD_ULOGIC_VECTOR(L'length-1 downto 0); -- force downto
- begin
- if (L'high = R'high and L'low = R'low) then
- RESULT := to_sulv(L) or to_sulv(R);
- else
- assert NO_WARNING
- report "fixed_pkg:"
- & """or"": Range error L'RANGE /= R'RANGE"
- severity warning;
- RESULT := (others => 'X');
- end if;
- return to_sfixed(RESULT, L'high, L'low);
- end function "or";
-
- function "nand" (L, R : UNRESOLVED_sfixed) return UNRESOLVED_sfixed is
- variable RESULT : STD_ULOGIC_VECTOR(L'length-1 downto 0); -- force downto
- begin
- if (L'high = R'high and L'low = R'low) then
- RESULT := to_sulv(L) nand to_sulv(R);
- else
- assert NO_WARNING
- report "fixed_pkg:"
- & """nand"": Range error L'RANGE /= R'RANGE"
- severity warning;
- RESULT := (others => 'X');
- end if;
- return to_sfixed(RESULT, L'high, L'low);
- end function "nand";
-
- function "nor" (L, R : UNRESOLVED_sfixed) return UNRESOLVED_sfixed is
- variable RESULT : STD_ULOGIC_VECTOR(L'length-1 downto 0); -- force downto
- begin
- if (L'high = R'high and L'low = R'low) then
- RESULT := to_sulv(L) nor to_sulv(R);
- else
- assert NO_WARNING
- report "fixed_pkg:"
- & """nor"": Range error L'RANGE /= R'RANGE"
- severity warning;
- RESULT := (others => 'X');
- end if;
- return to_sfixed(RESULT, L'high, L'low);
- end function "nor";
-
- function "xor" (L, R : UNRESOLVED_sfixed) return UNRESOLVED_sfixed is
- variable RESULT : STD_ULOGIC_VECTOR(L'length-1 downto 0); -- force downto
- begin
- if (L'high = R'high and L'low = R'low) then
- RESULT := to_sulv(L) xor to_sulv(R);
- else
- assert NO_WARNING
- report "fixed_pkg:"
- & """xor"": Range error L'RANGE /= R'RANGE"
- severity warning;
- RESULT := (others => 'X');
- end if;
- return to_sfixed(RESULT, L'high, L'low);
- end function "xor";
-
- function "xnor" (L, R : UNRESOLVED_sfixed) return UNRESOLVED_sfixed is
- variable RESULT : STD_ULOGIC_VECTOR(L'length-1 downto 0); -- force downto
- begin
- if (L'high = R'high and L'low = R'low) then
- RESULT := to_sulv(L) xnor to_sulv(R);
- else
- assert NO_WARNING
- report "fixed_pkg:"
- & """xnor"": Range error L'RANGE /= R'RANGE"
- severity warning;
- RESULT := (others => 'X');
- end if;
- return to_sfixed(RESULT, L'high, L'low);
- end function "xnor";
-
- -- Vector and std_ulogic functions, same as functions in numeric_std
- function "and" (L : STD_ULOGIC; R : UNRESOLVED_ufixed)
- return UNRESOLVED_ufixed is
- variable result : UNRESOLVED_ufixed (R'range);
- begin
- for i in result'range loop
- result(i) := L and R(i);
- end loop;
- return result;
- end function "and";
-
- function "and" (L : UNRESOLVED_ufixed; R : STD_ULOGIC)
- return UNRESOLVED_ufixed is
- variable result : UNRESOLVED_ufixed (L'range);
- begin
- for i in result'range loop
- result(i) := L(i) and R;
- end loop;
- return result;
- end function "and";
-
- function "or" (L : STD_ULOGIC; R : UNRESOLVED_ufixed)
- return UNRESOLVED_ufixed is
- variable result : UNRESOLVED_ufixed (R'range);
- begin
- for i in result'range loop
- result(i) := L or R(i);
- end loop;
- return result;
- end function "or";
-
- function "or" (L : UNRESOLVED_ufixed; R : STD_ULOGIC)
- return UNRESOLVED_ufixed is
- variable result : UNRESOLVED_ufixed (L'range);
- begin
- for i in result'range loop
- result(i) := L(i) or R;
- end loop;
- return result;
- end function "or";
-
- function "nand" (L : STD_ULOGIC; R : UNRESOLVED_ufixed)
- return UNRESOLVED_ufixed is
- variable result : UNRESOLVED_ufixed (R'range);
- begin
- for i in result'range loop
- result(i) := L nand R(i);
- end loop;
- return result;
- end function "nand";
-
- function "nand" (L : UNRESOLVED_ufixed; R : STD_ULOGIC)
- return UNRESOLVED_ufixed is
- variable result : UNRESOLVED_ufixed (L'range);
- begin
- for i in result'range loop
- result(i) := L(i) nand R;
- end loop;
- return result;
- end function "nand";
-
- function "nor" (L : STD_ULOGIC; R : UNRESOLVED_ufixed)
- return UNRESOLVED_ufixed is
- variable result : UNRESOLVED_ufixed (R'range);
- begin
- for i in result'range loop
- result(i) := L nor R(i);
- end loop;
- return result;
- end function "nor";
-
- function "nor" (L : UNRESOLVED_ufixed; R : STD_ULOGIC)
- return UNRESOLVED_ufixed is
- variable result : UNRESOLVED_ufixed (L'range);
- begin
- for i in result'range loop
- result(i) := L(i) nor R;
- end loop;
- return result;
- end function "nor";
-
- function "xor" (L : STD_ULOGIC; R : UNRESOLVED_ufixed)
- return UNRESOLVED_ufixed is
- variable result : UNRESOLVED_ufixed (R'range);
- begin
- for i in result'range loop
- result(i) := L xor R(i);
- end loop;
- return result;
- end function "xor";
-
- function "xor" (L : UNRESOLVED_ufixed; R : STD_ULOGIC)
- return UNRESOLVED_ufixed is
- variable result : UNRESOLVED_ufixed (L'range);
- begin
- for i in result'range loop
- result(i) := L(i) xor R;
- end loop;
- return result;
- end function "xor";
-
- function "xnor" (L : STD_ULOGIC; R : UNRESOLVED_ufixed)
- return UNRESOLVED_ufixed is
- variable result : UNRESOLVED_ufixed (R'range);
- begin
- for i in result'range loop
- result(i) := L xnor R(i);
- end loop;
- return result;
- end function "xnor";
-
- function "xnor" (L : UNRESOLVED_ufixed; R : STD_ULOGIC)
- return UNRESOLVED_ufixed is
- variable result : UNRESOLVED_ufixed (L'range);
- begin
- for i in result'range loop
- result(i) := L(i) xnor R;
- end loop;
- return result;
- end function "xnor";
-
- function "and" (L : STD_ULOGIC; R : UNRESOLVED_sfixed)
- return UNRESOLVED_sfixed is
- variable result : UNRESOLVED_sfixed (R'range);
- begin
- for i in result'range loop
- result(i) := L and R(i);
- end loop;
- return result;
- end function "and";
-
- function "and" (L : UNRESOLVED_sfixed; R : STD_ULOGIC)
- return UNRESOLVED_sfixed is
- variable result : UNRESOLVED_sfixed (L'range);
- begin
- for i in result'range loop
- result(i) := L(i) and R;
- end loop;
- return result;
- end function "and";
-
- function "or" (L : STD_ULOGIC; R : UNRESOLVED_sfixed)
- return UNRESOLVED_sfixed is
- variable result : UNRESOLVED_sfixed (R'range);
- begin
- for i in result'range loop
- result(i) := L or R(i);
- end loop;
- return result;
- end function "or";
-
- function "or" (L : UNRESOLVED_sfixed; R : STD_ULOGIC)
- return UNRESOLVED_sfixed is
- variable result : UNRESOLVED_sfixed (L'range);
- begin
- for i in result'range loop
- result(i) := L(i) or R;
- end loop;
- return result;
- end function "or";
-
- function "nand" (L : STD_ULOGIC; R : UNRESOLVED_sfixed)
- return UNRESOLVED_sfixed is
- variable result : UNRESOLVED_sfixed (R'range);
- begin
- for i in result'range loop
- result(i) := L nand R(i);
- end loop;
- return result;
- end function "nand";
-
- function "nand" (L : UNRESOLVED_sfixed; R : STD_ULOGIC)
- return UNRESOLVED_sfixed is
- variable result : UNRESOLVED_sfixed (L'range);
- begin
- for i in result'range loop
- result(i) := L(i) nand R;
- end loop;
- return result;
- end function "nand";
-
- function "nor" (L : STD_ULOGIC; R : UNRESOLVED_sfixed)
- return UNRESOLVED_sfixed is
- variable result : UNRESOLVED_sfixed (R'range);
- begin
- for i in result'range loop
- result(i) := L nor R(i);
- end loop;
- return result;
- end function "nor";
-
- function "nor" (L : UNRESOLVED_sfixed; R : STD_ULOGIC)
- return UNRESOLVED_sfixed is
- variable result : UNRESOLVED_sfixed (L'range);
- begin
- for i in result'range loop
- result(i) := L(i) nor R;
- end loop;
- return result;
- end function "nor";
-
- function "xor" (L : STD_ULOGIC; R : UNRESOLVED_sfixed)
- return UNRESOLVED_sfixed is
- variable result : UNRESOLVED_sfixed (R'range);
- begin
- for i in result'range loop
- result(i) := L xor R(i);
- end loop;
- return result;
- end function "xor";
-
- function "xor" (L : UNRESOLVED_sfixed; R : STD_ULOGIC)
- return UNRESOLVED_sfixed is
- variable result : UNRESOLVED_sfixed (L'range);
- begin
- for i in result'range loop
- result(i) := L(i) xor R;
- end loop;
- return result;
- end function "xor";
-
- function "xnor" (L : STD_ULOGIC; R : UNRESOLVED_sfixed)
- return UNRESOLVED_sfixed is
- variable result : UNRESOLVED_sfixed (R'range);
- begin
- for i in result'range loop
- result(i) := L xnor R(i);
- end loop;
- return result;
- end function "xnor";
-
- function "xnor" (L : UNRESOLVED_sfixed; R : STD_ULOGIC)
- return UNRESOLVED_sfixed is
- variable result : UNRESOLVED_sfixed (L'range);
- begin
- for i in result'range loop
- result(i) := L(i) xnor R;
- end loop;
- return result;
- end function "xnor";
-
- -- Reduction operator_reduces
- function and_reduce (l : UNRESOLVED_ufixed) return STD_ULOGIC is
- begin
- return and_reduce (to_sulv(l));
- end function and_reduce;
-
- function nand_reduce (l : UNRESOLVED_ufixed) return STD_ULOGIC is
- begin
- return nand_reduce (to_sulv(l));
- end function nand_reduce;
-
- function or_reduce (l : UNRESOLVED_ufixed) return STD_ULOGIC is
- begin
- return or_reduce (to_sulv(l));
- end function or_reduce;
-
- function nor_reduce (l : UNRESOLVED_ufixed) return STD_ULOGIC is
- begin
- return nor_reduce (to_sulv(l));
- end function nor_reduce;
-
- function xor_reduce (l : UNRESOLVED_ufixed) return STD_ULOGIC is
- begin
- return xor_reduce (to_sulv(l));
- end function xor_reduce;
-
- function xnor_reduce (l : UNRESOLVED_ufixed) return STD_ULOGIC is
- begin
- return xnor_reduce (to_sulv(l));
- end function xnor_reduce;
-
- function and_reduce (l : UNRESOLVED_sfixed) return STD_ULOGIC is
- begin
- return and_reduce (to_sulv(l));
- end function and_reduce;
-
- function nand_reduce (l : UNRESOLVED_sfixed) return STD_ULOGIC is
- begin
- return nand_reduce (to_sulv(l));
- end function nand_reduce;
-
- function or_reduce (l : UNRESOLVED_sfixed) return STD_ULOGIC is
- begin
- return or_reduce (to_sulv(l));
- end function or_reduce;
-
- function nor_reduce (l : UNRESOLVED_sfixed) return STD_ULOGIC is
- begin
- return nor_reduce (to_sulv(l));
- end function nor_reduce;
-
- function xor_reduce (l : UNRESOLVED_sfixed) return STD_ULOGIC is
- begin
- return xor_reduce (to_sulv(l));
- end function xor_reduce;
-
- function xnor_reduce (l : UNRESOLVED_sfixed) return STD_ULOGIC is
- begin
- return xnor_reduce (to_sulv(l));
- end function xnor_reduce;
- -- End reduction operator_reduces
-
- function \?=\ (L, R : UNRESOLVED_ufixed) return STD_ULOGIC is
- constant left_index : INTEGER := maximum(l'high, r'high);
- constant right_index : INTEGER := mins(l'low, r'low);
- variable lresize, rresize : UNRESOLVED_ufixed (left_index downto right_index);
- variable lslv, rslv : UNSIGNED (lresize'length-1 downto 0);
- begin -- ?=
- if ((L'length < 1) or (R'length < 1)) then
- assert NO_WARNING
- report "fixed_pkg:"
- & """?="": null detected, returning X"
- severity warning;
- return 'X';
- else
- lresize := resize (l, left_index, right_index);
- rresize := resize (r, left_index, right_index);
- lslv := to_uns (lresize);
- rslv := to_uns (rresize);
- return \?=\ (lslv, rslv);
- end if;
- end function \?=\;
-
- function \?/=\ (L, R : UNRESOLVED_ufixed) return STD_ULOGIC is
- constant left_index : INTEGER := maximum(l'high, r'high);
- constant right_index : INTEGER := mins(l'low, r'low);
- variable lresize, rresize : UNRESOLVED_ufixed (left_index downto right_index);
- variable lslv, rslv : UNSIGNED (lresize'length-1 downto 0);
- begin -- ?/=
- if ((L'length < 1) or (R'length < 1)) then
- assert NO_WARNING
- report "fixed_pkg:"
- & """?/="": null detected, returning X"
- severity warning;
- return 'X';
- else
- lresize := resize (l, left_index, right_index);
- rresize := resize (r, left_index, right_index);
- lslv := to_uns (lresize);
- rslv := to_uns (rresize);
- return \?/=\ (lslv, rslv);
- end if;
- end function \?/=\;
-
- function \?>\ (L, R : UNRESOLVED_ufixed) return STD_ULOGIC is
- constant left_index : INTEGER := maximum(l'high, r'high);
- constant right_index : INTEGER := mins(l'low, r'low);
- variable lresize, rresize : UNRESOLVED_ufixed (left_index downto right_index);
- variable lslv, rslv : UNSIGNED (lresize'length-1 downto 0);
- begin -- ?>
- if ((l'length < 1) or (r'length < 1)) then
- assert NO_WARNING
- report "fixed_pkg:"
- & """?>"": null detected, returning X"
- severity warning;
- return 'X';
- else
- lresize := resize (l, left_index, right_index);
- rresize := resize (r, left_index, right_index);
- lslv := to_uns (lresize);
- rslv := to_uns (rresize);
- return \?>\ (lslv, rslv);
- end if;
- end function \?>\;
-
- function \?>=\ (L, R : UNRESOLVED_ufixed) return STD_ULOGIC is
- constant left_index : INTEGER := maximum(l'high, r'high);
- constant right_index : INTEGER := mins(l'low, r'low);
- variable lresize, rresize : UNRESOLVED_ufixed (left_index downto right_index);
- variable lslv, rslv : UNSIGNED (lresize'length-1 downto 0);
- begin -- ?>=
- if ((l'length < 1) or (r'length < 1)) then
- assert NO_WARNING
- report "fixed_pkg:"
- & """?>="": null detected, returning X"
- severity warning;
- return 'X';
- else
- lresize := resize (l, left_index, right_index);
- rresize := resize (r, left_index, right_index);
- lslv := to_uns (lresize);
- rslv := to_uns (rresize);
- return \?>=\ (lslv, rslv);
- end if;
- end function \?>=\;
-
- function \?<\ (L, R : UNRESOLVED_ufixed) return STD_ULOGIC is
- constant left_index : INTEGER := maximum(l'high, r'high);
- constant right_index : INTEGER := mins(l'low, r'low);
- variable lresize, rresize : UNRESOLVED_ufixed (left_index downto right_index);
- variable lslv, rslv : UNSIGNED (lresize'length-1 downto 0);
- begin -- ?<
- if ((l'length < 1) or (r'length < 1)) then
- assert NO_WARNING
- report "fixed_pkg:"
- & """?<"": null detected, returning X"
- severity warning;
- return 'X';
- else
- lresize := resize (l, left_index, right_index);
- rresize := resize (r, left_index, right_index);
- lslv := to_uns (lresize);
- rslv := to_uns (rresize);
- return \?<\ (lslv, rslv);
- end if;
- end function \?<\;
-
- function \?<=\ (L, R : UNRESOLVED_ufixed) return STD_ULOGIC is
- constant left_index : INTEGER := maximum(l'high, r'high);
- constant right_index : INTEGER := mins(l'low, r'low);
- variable lresize, rresize : UNRESOLVED_ufixed (left_index downto right_index);
- variable lslv, rslv : UNSIGNED (lresize'length-1 downto 0);
- begin -- ?<=
- if ((l'length < 1) or (r'length < 1)) then
- assert NO_WARNING
- report "fixed_pkg:"
- & """?<="": null detected, returning X"
- severity warning;
- return 'X';
- else
- lresize := resize (l, left_index, right_index);
- rresize := resize (r, left_index, right_index);
- lslv := to_uns (lresize);
- rslv := to_uns (rresize);
- return \?<=\ (lslv, rslv);
- end if;
- end function \?<=\;
-
- function \?=\ (L, R : UNRESOLVED_sfixed) return STD_ULOGIC is
- constant left_index : INTEGER := maximum(l'high, r'high);
- constant right_index : INTEGER := mins(l'low, r'low);
- variable lresize, rresize : UNRESOLVED_sfixed (left_index downto right_index);
- variable lslv, rslv : SIGNED (lresize'length-1 downto 0);
- begin -- ?=
- if ((L'length < 1) or (R'length < 1)) then
- assert NO_WARNING
- report "fixed_pkg:"
- & """?="": null detected, returning X"
- severity warning;
- return 'X';
- else
- lresize := resize (l, left_index, right_index);
- rresize := resize (r, left_index, right_index);
- lslv := to_s (lresize);
- rslv := to_s (rresize);
- return \?=\ (lslv, rslv);
- end if;
- end function \?=\;
-
- function \?/=\ (L, R : UNRESOLVED_sfixed) return STD_ULOGIC is
- constant left_index : INTEGER := maximum(l'high, r'high);
- constant right_index : INTEGER := mins(l'low, r'low);
- variable lresize, rresize : UNRESOLVED_sfixed (left_index downto right_index);
- variable lslv, rslv : SIGNED (lresize'length-1 downto 0);
- begin -- ?/=
- if ((L'length < 1) or (R'length < 1)) then
- assert NO_WARNING
- report "fixed_pkg:"
- & """?/="": null detected, returning X"
- severity warning;
- return 'X';
- else
- lresize := resize (l, left_index, right_index);
- rresize := resize (r, left_index, right_index);
- lslv := to_s (lresize);
- rslv := to_s (rresize);
- return \?/=\ (lslv, rslv);
- end if;
- end function \?/=\;
-
- function \?>\ (L, R : UNRESOLVED_sfixed) return STD_ULOGIC is
- constant left_index : INTEGER := maximum(l'high, r'high);
- constant right_index : INTEGER := mins(l'low, r'low);
- variable lresize, rresize : UNRESOLVED_sfixed (left_index downto right_index);
- variable lslv, rslv : SIGNED (lresize'length-1 downto 0);
- begin -- ?>
- if ((l'length < 1) or (r'length < 1)) then
- assert NO_WARNING
- report "fixed_pkg:"
- & """?>"": null detected, returning X"
- severity warning;
- return 'X';
- else
- lresize := resize (l, left_index, right_index);
- rresize := resize (r, left_index, right_index);
- lslv := to_s (lresize);
- rslv := to_s (rresize);
- return \?>\ (lslv, rslv);
- end if;
- end function \?>\;
-
- function \?>=\ (L, R : UNRESOLVED_sfixed) return STD_ULOGIC is
- constant left_index : INTEGER := maximum(l'high, r'high);
- constant right_index : INTEGER := mins(l'low, r'low);
- variable lresize, rresize : UNRESOLVED_sfixed (left_index downto right_index);
- variable lslv, rslv : SIGNED (lresize'length-1 downto 0);
- begin -- ?>=
- if ((l'length < 1) or (r'length < 1)) then
- assert NO_WARNING
- report "fixed_pkg:"
- & """?>="": null detected, returning X"
- severity warning;
- return 'X';
- else
- lresize := resize (l, left_index, right_index);
- rresize := resize (r, left_index, right_index);
- lslv := to_s (lresize);
- rslv := to_s (rresize);
- return \?>=\ (lslv, rslv);
- end if;
- end function \?>=\;
-
- function \?<\ (L, R : UNRESOLVED_sfixed) return STD_ULOGIC is
- constant left_index : INTEGER := maximum(l'high, r'high);
- constant right_index : INTEGER := mins(l'low, r'low);
- variable lresize, rresize : UNRESOLVED_sfixed (left_index downto right_index);
- variable lslv, rslv : SIGNED (lresize'length-1 downto 0);
- begin -- ?<
- if ((l'length < 1) or (r'length < 1)) then
- assert NO_WARNING
- report "fixed_pkg:"
- & """?<"": null detected, returning X"
- severity warning;
- return 'X';
- else
- lresize := resize (l, left_index, right_index);
- rresize := resize (r, left_index, right_index);
- lslv := to_s (lresize);
- rslv := to_s (rresize);
- return \?<\ (lslv, rslv);
- end if;
- end function \?<\;
-
- function \?<=\ (L, R : UNRESOLVED_sfixed) return STD_ULOGIC is
- constant left_index : INTEGER := maximum(l'high, r'high);
- constant right_index : INTEGER := mins(l'low, r'low);
- variable lresize, rresize : UNRESOLVED_sfixed (left_index downto right_index);
- variable lslv, rslv : SIGNED (lresize'length-1 downto 0);
- begin -- ?<=
- if ((l'length < 1) or (r'length < 1)) then
- assert NO_WARNING
- report "fixed_pkg:"
- & """?<="": null detected, returning X"
- severity warning;
- return 'X';
- else
- lresize := resize (l, left_index, right_index);
- rresize := resize (r, left_index, right_index);
- lslv := to_s (lresize);
- rslv := to_s (rresize);
- return \?<=\ (lslv, rslv);
- end if;
- end function \?<=\;
-
- -- Match function, similar to "std_match" from numeric_std
- function std_match (L, R : UNRESOLVED_ufixed) return BOOLEAN is
- begin
- if (L'high = R'high and L'low = R'low) then
- return std_match(to_sulv(L), to_sulv(R));
- else
- assert NO_WARNING
- report "fixed_pkg:"
- & "STD_MATCH: L'RANGE /= R'RANGE, returning FALSE"
- severity warning;
- return false;
- end if;
- end function std_match;
-
- function std_match (L, R : UNRESOLVED_sfixed) return BOOLEAN is
- begin
- if (L'high = R'high and L'low = R'low) then
- return std_match(to_sulv(L), to_sulv(R));
- else
- assert NO_WARNING
- report "fixed_pkg:"
- & "STD_MATCH: L'RANGE /= R'RANGE, returning FALSE"
- severity warning;
- return false;
- end if;
- end function std_match;
-
- -- compare functions
- function "=" (
- l, r : UNRESOLVED_ufixed) -- fixed point input
- return BOOLEAN is
- constant left_index : INTEGER := maximum(l'high, r'high);
- constant right_index : INTEGER := mins(l'low, r'low);
- variable lresize, rresize : UNRESOLVED_ufixed (left_index downto right_index);
- variable lslv, rslv : UNSIGNED (lresize'length-1 downto 0);
- begin
- if (l'length < 1 or r'length < 1) then
- assert NO_WARNING
- report "fixed_pkg:"
- & """="": null argument detected, returning FALSE"
- severity warning;
- return false;
- elsif (Is_X(l) or Is_X(r)) then
- assert NO_WARNING
- report "fixed_pkg:"
- & """="": metavalue detected, returning FALSE"
- severity warning;
- return false;
- end if;
- lresize := resize (l, left_index, right_index);
- rresize := resize (r, left_index, right_index);
- lslv := to_uns (lresize);
- rslv := to_uns (rresize);
- return lslv = rslv;
- end function "=";
-
- function "=" (
- l, r : UNRESOLVED_sfixed) -- fixed point input
- return BOOLEAN is
- constant left_index : INTEGER := maximum(l'high, r'high);
- constant right_index : INTEGER := mins(l'low, r'low);
- variable lresize, rresize : UNRESOLVED_sfixed (left_index downto right_index);
- variable lslv, rslv : SIGNED (lresize'length-1 downto 0);
- begin
- if (l'length < 1 or r'length < 1) then
- assert NO_WARNING
- report "fixed_pkg:"
- & """="": null argument detected, returning FALSE"
- severity warning;
- return false;
- elsif (Is_X(l) or Is_X(r)) then
- assert NO_WARNING
- report "fixed_pkg:"
- & """="": metavalue detected, returning FALSE"
- severity warning;
- return false;
- end if;
- lresize := resize (l, left_index, right_index);
- rresize := resize (r, left_index, right_index);
- lslv := to_s (lresize);
- rslv := to_s (rresize);
- return lslv = rslv;
- end function "=";
-
- function "/=" (
- l, r : UNRESOLVED_ufixed) -- fixed point input
- return BOOLEAN is
- constant left_index : INTEGER := maximum(l'high, r'high);
- constant right_index : INTEGER := mins(l'low, r'low);
- variable lresize, rresize : UNRESOLVED_ufixed (left_index downto right_index);
- variable lslv, rslv : UNSIGNED (lresize'length-1 downto 0);
- begin
- if (l'length < 1 or r'length < 1) then
- assert NO_WARNING
- report "fixed_pkg:"
- & """/="": null argument detected, returning TRUE"
- severity warning;
- return true;
- elsif (Is_X(l) or Is_X(r)) then
- assert NO_WARNING
- report "fixed_pkg:"
- & """/="": metavalue detected, returning TRUE"
- severity warning;
- return true;
- end if;
- lresize := resize (l, left_index, right_index);
- rresize := resize (r, left_index, right_index);
- lslv := to_uns (lresize);
- rslv := to_uns (rresize);
- return lslv /= rslv;
- end function "/=";
-
- function "/=" (
- l, r : UNRESOLVED_sfixed) -- fixed point input
- return BOOLEAN is
- constant left_index : INTEGER := maximum(l'high, r'high);
- constant right_index : INTEGER := mins(l'low, r'low);
- variable lresize, rresize : UNRESOLVED_sfixed (left_index downto right_index);
- variable lslv, rslv : SIGNED (lresize'length-1 downto 0);
- begin
- if (l'length < 1 or r'length < 1) then
- assert NO_WARNING
- report "fixed_pkg:"
- & """/="": null argument detected, returning TRUE"
- severity warning;
- return true;
- elsif (Is_X(l) or Is_X(r)) then
- assert NO_WARNING
- report "fixed_pkg:"
- & """/="": metavalue detected, returning TRUE"
- severity warning;
- return true;
- end if;
- lresize := resize (l, left_index, right_index);
- rresize := resize (r, left_index, right_index);
- lslv := to_s (lresize);
- rslv := to_s (rresize);
- return lslv /= rslv;
- end function "/=";
-
- function ">" (
- l, r : UNRESOLVED_ufixed) -- fixed point input
- return BOOLEAN is
- constant left_index : INTEGER := maximum(l'high, r'high);
- constant right_index : INTEGER := mins(l'low, r'low);
- variable lresize, rresize : UNRESOLVED_ufixed (left_index downto right_index);
- variable lslv, rslv : UNSIGNED (lresize'length-1 downto 0);
- begin
- if (l'length < 1 or r'length < 1) then
- assert NO_WARNING
- report "fixed_pkg:"
- & """>"": null argument detected, returning FALSE"
- severity warning;
- return false;
- elsif (Is_X(l) or Is_X(r)) then
- assert NO_WARNING
- report "fixed_pkg:"
- & """>"": metavalue detected, returning FALSE"
- severity warning;
- return false;
- end if;
- lresize := resize (l, left_index, right_index);
- rresize := resize (r, left_index, right_index);
- lslv := to_uns (lresize);
- rslv := to_uns (rresize);
- return lslv > rslv;
- end function ">";
-
- function ">" (
- l, r : UNRESOLVED_sfixed) -- fixed point input
- return BOOLEAN is
- constant left_index : INTEGER := maximum(l'high, r'high);
- constant right_index : INTEGER := mins(l'low, r'low);
- variable lresize, rresize : UNRESOLVED_sfixed (left_index downto right_index);
- variable lslv, rslv : SIGNED (lresize'length-1 downto 0);
- begin
- if (l'length < 1 or r'length < 1) then
- assert NO_WARNING
- report "fixed_pkg:"
- & """>"": null argument detected, returning FALSE"
- severity warning;
- return false;
- elsif (Is_X(l) or Is_X(r)) then
- assert NO_WARNING
- report "fixed_pkg:"
- & """>"": metavalue detected, returning FALSE"
- severity warning;
- return false;
- end if;
- lresize := resize (l, left_index, right_index);
- rresize := resize (r, left_index, right_index);
- lslv := to_s (lresize);
- rslv := to_s (rresize);
- return lslv > rslv;
- end function ">";
-
- function "<" (
- l, r : UNRESOLVED_ufixed) -- fixed point input
- return BOOLEAN is
- constant left_index : INTEGER := maximum(l'high, r'high);
- constant right_index : INTEGER := mins(l'low, r'low);
- variable lresize, rresize : UNRESOLVED_ufixed (left_index downto right_index);
- variable lslv, rslv : UNSIGNED (lresize'length-1 downto 0);
- begin
- if (l'length < 1 or r'length < 1) then
- assert NO_WARNING
- report "fixed_pkg:"
- & """<"": null argument detected, returning FALSE"
- severity warning;
- return false;
- elsif (Is_X(l) or Is_X(r)) then
- assert NO_WARNING
- report "fixed_pkg:"
- & """<"": metavalue detected, returning FALSE"
- severity warning;
- return false;
- end if;
- lresize := resize (l, left_index, right_index);
- rresize := resize (r, left_index, right_index);
- lslv := to_uns (lresize);
- rslv := to_uns (rresize);
- return lslv < rslv;
- end function "<";
-
- function "<" (
- l, r : UNRESOLVED_sfixed) -- fixed point input
- return BOOLEAN is
- constant left_index : INTEGER := maximum(l'high, r'high);
- constant right_index : INTEGER := mins(l'low, r'low);
- variable lresize, rresize : UNRESOLVED_sfixed (left_index downto right_index);
- variable lslv, rslv : SIGNED (lresize'length-1 downto 0);
- begin
- if (l'length < 1 or r'length < 1) then
- assert NO_WARNING
- report "fixed_pkg:"
- & """<"": null argument detected, returning FALSE"
- severity warning;
- return false;
- elsif (Is_X(l) or Is_X(r)) then
- assert NO_WARNING
- report "fixed_pkg:"
- & """<"": metavalue detected, returning FALSE"
- severity warning;
- return false;
- end if;
- lresize := resize (l, left_index, right_index);
- rresize := resize (r, left_index, right_index);
- lslv := to_s (lresize);
- rslv := to_s (rresize);
- return lslv < rslv;
- end function "<";
-
- function ">=" (
- l, r : UNRESOLVED_ufixed) -- fixed point input
- return BOOLEAN is
- constant left_index : INTEGER := maximum(l'high, r'high);
- constant right_index : INTEGER := mins(l'low, r'low);
- variable lresize, rresize : UNRESOLVED_ufixed (left_index downto right_index);
- variable lslv, rslv : UNSIGNED (lresize'length-1 downto 0);
- begin
- if (l'length < 1 or r'length < 1) then
- assert NO_WARNING
- report "fixed_pkg:"
- & """>="": null argument detected, returning FALSE"
- severity warning;
- return false;
- elsif (Is_X(l) or Is_X(r)) then
- assert NO_WARNING
- report "fixed_pkg:"
- & """>="": metavalue detected, returning FALSE"
- severity warning;
- return false;
- end if;
- lresize := resize (l, left_index, right_index);
- rresize := resize (r, left_index, right_index);
- lslv := to_uns (lresize);
- rslv := to_uns (rresize);
- return lslv >= rslv;
- end function ">=";
-
- function ">=" (
- l, r : UNRESOLVED_sfixed) -- fixed point input
- return BOOLEAN is
- constant left_index : INTEGER := maximum(l'high, r'high);
- constant right_index : INTEGER := mins(l'low, r'low);
- variable lresize, rresize : UNRESOLVED_sfixed (left_index downto right_index);
- variable lslv, rslv : SIGNED (lresize'length-1 downto 0);
- begin
- if (l'length < 1 or r'length < 1) then
- assert NO_WARNING
- report "fixed_pkg:"
- & """>="": null argument detected, returning FALSE"
- severity warning;
- return false;
- elsif (Is_X(l) or Is_X(r)) then
- assert NO_WARNING
- report "fixed_pkg:"
- & """>="": metavalue detected, returning FALSE"
- severity warning;
- return false;
- end if;
- lresize := resize (l, left_index, right_index);
- rresize := resize (r, left_index, right_index);
- lslv := to_s (lresize);
- rslv := to_s (rresize);
- return lslv >= rslv;
- end function ">=";
-
- function "<=" (
- l, r : UNRESOLVED_ufixed) -- fixed point input
- return BOOLEAN is
- constant left_index : INTEGER := maximum(l'high, r'high);
- constant right_index : INTEGER := mins(l'low, r'low);
- variable lresize, rresize : UNRESOLVED_ufixed (left_index downto right_index);
- variable lslv, rslv : UNSIGNED (lresize'length-1 downto 0);
- begin
- if (l'length < 1 or r'length < 1) then
- assert NO_WARNING
- report "fixed_pkg:"
- & """<="": null argument detected, returning FALSE"
- severity warning;
- return false;
- elsif (Is_X(l) or Is_X(r)) then
- assert NO_WARNING
- report "fixed_pkg:"
- & """<="": metavalue detected, returning FALSE"
- severity warning;
- return false;
- end if;
- lresize := resize (l, left_index, right_index);
- rresize := resize (r, left_index, right_index);
- lslv := to_uns (lresize);
- rslv := to_uns (rresize);
- return lslv <= rslv;
- end function "<=";
-
- function "<=" (
- l, r : UNRESOLVED_sfixed) -- fixed point input
- return BOOLEAN is
- constant left_index : INTEGER := maximum(l'high, r'high);
- constant right_index : INTEGER := mins(l'low, r'low);
- variable lresize, rresize : UNRESOLVED_sfixed (left_index downto right_index);
- variable lslv, rslv : SIGNED (lresize'length-1 downto 0);
- begin
- if (l'length < 1 or r'length < 1) then
- assert NO_WARNING
- report "fixed_pkg:"
- & """<="": null argument detected, returning FALSE"
- severity warning;
- return false;
- elsif (Is_X(l) or Is_X(r)) then
- assert NO_WARNING
- report "fixed_pkg:"
- & """<="": metavalue detected, returning FALSE"
- severity warning;
- return false;
- end if;
- lresize := resize (l, left_index, right_index);
- rresize := resize (r, left_index, right_index);
- lslv := to_s (lresize);
- rslv := to_s (rresize);
- return lslv <= rslv;
- end function "<=";
-
- -- overloads of the default maximum and minimum functions
- function maximum (l, r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed is
- constant left_index : INTEGER := maximum(l'high, r'high);
- constant right_index : INTEGER := mins(l'low, r'low);
- variable lresize, rresize : UNRESOLVED_ufixed (left_index downto right_index);
- begin
- if (l'length < 1 or r'length < 1) then
- return NAUF;
- end if;
- lresize := resize (l, left_index, right_index);
- rresize := resize (r, left_index, right_index);
- if lresize > rresize then return lresize;
- else return rresize;
- end if;
- end function maximum;
-
- function maximum (l, r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed is
- constant left_index : INTEGER := maximum(l'high, r'high);
- constant right_index : INTEGER := mins(l'low, r'low);
- variable lresize, rresize : UNRESOLVED_sfixed (left_index downto right_index);
- begin
- if (l'length < 1 or r'length < 1) then
- return NASF;
- end if;
- lresize := resize (l, left_index, right_index);
- rresize := resize (r, left_index, right_index);
- if lresize > rresize then return lresize;
- else return rresize;
- end if;
- end function maximum;
-
- function minimum (l, r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed is
- constant left_index : INTEGER := maximum(l'high, r'high);
- constant right_index : INTEGER := mins(l'low, r'low);
- variable lresize, rresize : UNRESOLVED_ufixed (left_index downto right_index);
- begin
- if (l'length < 1 or r'length < 1) then
- return NAUF;
- end if;
- lresize := resize (l, left_index, right_index);
- rresize := resize (r, left_index, right_index);
- if lresize > rresize then return rresize;
- else return lresize;
- end if;
- end function minimum;
-
- function minimum (l, r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed is
- constant left_index : INTEGER := maximum(l'high, r'high);
- constant right_index : INTEGER := mins(l'low, r'low);
- variable lresize, rresize : UNRESOLVED_sfixed (left_index downto right_index);
- begin
- if (l'length < 1 or r'length < 1) then
- return NASF;
- end if;
- lresize := resize (l, left_index, right_index);
- rresize := resize (r, left_index, right_index);
- if lresize > rresize then return rresize;
- else return lresize;
- end if;
- end function minimum;
-
- function to_ufixed (
- arg : NATURAL; -- integer
- constant left_index : INTEGER; -- left index (high index)
- constant right_index : INTEGER := 0; -- right index
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
- constant round_style : fixed_round_style_type := fixed_round_style)
- return UNRESOLVED_ufixed is
- constant fw : INTEGER := mins (right_index, right_index); -- catch literals
- variable result : UNRESOLVED_ufixed (left_index downto fw);
- variable sresult : UNRESOLVED_ufixed (left_index downto 0) :=
- (others => '0'); -- integer portion
- variable argx : NATURAL; -- internal version of arg
- begin
- if (result'length < 1) then
- return NAUF;
- end if;
- if arg /= 0 then
- argx := arg;
- for I in 0 to sresult'left loop
- if (argx mod 2) = 0 then
- sresult(I) := '0';
- else
- sresult(I) := '1';
- end if;
- argx := argx/2;
- end loop;
- if argx /= 0 then
- assert NO_WARNING
- report "fixed_pkg:"
- & "TO_UFIXED(NATURAL): vector truncated"
- severity warning;
- if overflow_style = fixed_saturate then
- return saturate (left_index, right_index);
- end if;
- end if;
- result := resize (arg => sresult,
- left_index => left_index,
- right_index => right_index,
- round_style => round_style,
- overflow_style => overflow_style);
- else
- result := (others => '0');
- end if;
- return result;
- end function to_ufixed;
-
- function to_sfixed (
- arg : INTEGER; -- integer
- constant left_index : INTEGER; -- left index (high index)
- constant right_index : INTEGER := 0; -- right index
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
- constant round_style : fixed_round_style_type := fixed_round_style)
- return UNRESOLVED_sfixed is
- constant fw : INTEGER := mins (right_index, right_index); -- catch literals
- variable result : UNRESOLVED_sfixed (left_index downto fw);
- variable sresult : UNRESOLVED_sfixed (left_index downto 0) :=
- (others => '0'); -- integer portion
- variable argx : INTEGER; -- internal version of arg
- variable sign : STD_ULOGIC; -- sign of input
- begin
- if (result'length < 1) then -- null range
- return NASF;
- end if;
- if arg /= 0 then
- if (arg < 0) then
- sign := '1';
- argx := -(arg + 1);
- else
- sign := '0';
- argx := arg;
- end if;
- for I in 0 to sresult'left loop
- if (argx mod 2) = 0 then
- sresult(I) := sign;
- else
- sresult(I) := not sign;
- end if;
- argx := argx/2;
- end loop;
- if argx /= 0 or left_index < 0 or sign /= sresult(sresult'left) then
- assert NO_WARNING
- report "fixed_pkg:"
- & "TO_SFIXED(INTEGER): vector truncated"
- severity warning;
- if overflow_style = fixed_saturate then -- saturate
- if arg < 0 then
- result := not saturate (result'high, result'low); -- underflow
- else
- result := saturate (result'high, result'low); -- overflow
- end if;
- return result;
- end if;
- end if;
- result := resize (arg => sresult,
- left_index => left_index,
- right_index => right_index,
- round_style => round_style,
- overflow_style => overflow_style);
- else
- result := (others => '0');
- end if;
- return result;
- end function to_sfixed;
-
- function to_ufixed (
- arg : REAL; -- real
- constant left_index : INTEGER; -- left index (high index)
- constant right_index : INTEGER; -- right index
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
- constant round_style : fixed_round_style_type := fixed_round_style;
- constant guard_bits : NATURAL := fixed_guard_bits) -- # of guard bits
- return UNRESOLVED_ufixed is
- constant fw : INTEGER := mins (right_index, right_index); -- catch literals
- variable result : UNRESOLVED_ufixed (left_index downto fw) :=
- (others => '0');
- variable Xresult : UNRESOLVED_ufixed (left_index downto
- fw-guard_bits) :=
- (others => '0');
- variable presult : REAL;
--- variable overflow_needed : BOOLEAN;
- begin
- -- If negative or null range, return.
- if (left_index < fw) then
- return NAUF;
- end if;
- if (arg < 0.0) then
- report "fixed_pkg:"
- & "TO_UFIXED: Negative argument passed "
- & REAL'image(arg) severity error;
- return result;
- end if;
- presult := arg;
- if presult >= (2.0**(left_index+1)) then
- assert NO_WARNING report "fixed_pkg:"
- & "TO_UFIXED(REAL): vector truncated"
- severity warning;
- if overflow_style = fixed_wrap then
- presult := presult mod (2.0**(left_index+1)); -- wrap
- else
- return saturate (result'high, result'low);
- end if;
- end if;
- for i in Xresult'range loop
- if presult >= 2.0**i then
- Xresult(i) := '1';
- presult := presult - 2.0**i;
- else
- Xresult(i) := '0';
- end if;
- end loop;
- if guard_bits > 0 and round_style = fixed_round then
- result := round_fixed (arg => Xresult (left_index
- downto right_index),
- remainder => Xresult (right_index-1 downto
- right_index-guard_bits),
- overflow_style => overflow_style);
- else
- result := Xresult (result'range);
- end if;
- return result;
- end function to_ufixed;
-
- function to_sfixed (
- arg : REAL; -- real
- constant left_index : INTEGER; -- left index (high index)
- constant right_index : INTEGER; -- right index
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
- constant round_style : fixed_round_style_type := fixed_round_style;
- constant guard_bits : NATURAL := fixed_guard_bits) -- # of guard bits
- return UNRESOLVED_sfixed is
- constant fw : INTEGER := mins (right_index, right_index); -- catch literals
- variable result : UNRESOLVED_sfixed (left_index downto fw) :=
- (others => '0');
- variable Xresult : UNRESOLVED_sfixed (left_index+1 downto fw-guard_bits) :=
- (others => '0');
- variable presult : REAL;
- begin
- if (left_index < fw) then -- null range
- return NASF;
- end if;
- if (arg >= (2.0**left_index) or arg < -(2.0**left_index)) then
- assert NO_WARNING report "fixed_pkg:"
- & "TO_SFIXED(REAL): vector truncated"
- severity warning;
- if overflow_style = fixed_saturate then
- if arg < 0.0 then -- saturate
- result := not saturate (result'high, result'low); -- underflow
- else
- result := saturate (result'high, result'low); -- overflow
- end if;
- return result;
- else
- presult := abs(arg) mod (2.0**(left_index+1)); -- wrap
- end if;
- else
- presult := abs(arg);
- end if;
- for i in Xresult'range loop
- if presult >= 2.0**i then
- Xresult(i) := '1';
- presult := presult - 2.0**i;
- else
- Xresult(i) := '0';
- end if;
- end loop;
- if arg < 0.0 then
- Xresult := to_fixed(-to_s(Xresult), Xresult'high, Xresult'low);
- end if;
- if guard_bits > 0 and round_style = fixed_round then
- result := round_fixed (arg => Xresult (left_index
- downto right_index),
- remainder => Xresult (right_index-1 downto
- right_index-guard_bits),
- overflow_style => overflow_style);
- else
- result := Xresult (result'range);
- end if;
- return result;
- end function to_sfixed;
-
- function to_ufixed (
- arg : UNSIGNED; -- unsigned
- constant left_index : INTEGER; -- left index (high index)
- constant right_index : INTEGER := 0; -- right index
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
- constant round_style : fixed_round_style_type := fixed_round_style)
- return UNRESOLVED_ufixed is
- constant ARG_LEFT : INTEGER := ARG'length-1;
- alias XARG : UNSIGNED(ARG_LEFT downto 0) is ARG;
- variable result : UNRESOLVED_ufixed (left_index downto right_index);
- begin
- if arg'length < 1 or (left_index < right_index) then
- return NAUF;
- end if;
- result := resize (arg => UNRESOLVED_ufixed (XARG),
- left_index => left_index,
- right_index => right_index,
- round_style => round_style,
- overflow_style => overflow_style);
- return result;
- end function to_ufixed;
-
- -- converted version
- function to_ufixed (
- arg : UNSIGNED) -- unsigned
- return UNRESOLVED_ufixed is
- constant ARG_LEFT : INTEGER := ARG'length-1;
- alias XARG : UNSIGNED(ARG_LEFT downto 0) is ARG;
- begin
- if arg'length < 1 then
- return NAUF;
- end if;
- return UNRESOLVED_ufixed(xarg);
- end function to_ufixed;
-
- function to_sfixed (
- arg : SIGNED; -- signed
- constant left_index : INTEGER; -- left index (high index)
- constant right_index : INTEGER := 0; -- right index
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
- constant round_style : fixed_round_style_type := fixed_round_style)
- return UNRESOLVED_sfixed is
- constant ARG_LEFT : INTEGER := ARG'length-1;
- alias XARG : SIGNED(ARG_LEFT downto 0) is ARG;
- variable result : UNRESOLVED_sfixed (left_index downto right_index);
- begin
- if arg'length < 1 or (left_index < right_index) then
- return NASF;
- end if;
- result := resize (arg => UNRESOLVED_sfixed (XARG),
- left_index => left_index,
- right_index => right_index,
- round_style => round_style,
- overflow_style => overflow_style);
- return result;
- end function to_sfixed;
-
- -- converted version
- function to_sfixed (
- arg : SIGNED) -- signed
- return UNRESOLVED_sfixed is
- constant ARG_LEFT : INTEGER := ARG'length-1;
- alias XARG : SIGNED(ARG_LEFT downto 0) is ARG;
- begin
- if arg'length < 1 then
- return NASF;
- end if;
- return UNRESOLVED_sfixed(xarg);
- end function to_sfixed;
-
- function to_sfixed (arg : UNRESOLVED_ufixed) return UNRESOLVED_sfixed is
- variable result : UNRESOLVED_sfixed (arg'high+1 downto arg'low);
- begin
- if arg'length < 1 then
- return NASF;
- end if;
- result (arg'high downto arg'low) := UNRESOLVED_sfixed(cleanvec(arg));
- result (arg'high+1) := '0';
- return result;
- end function to_sfixed;
-
- -- Because of the fairly complicated sizing rules in the fixed point
- -- packages these functions are provided to compute the result ranges
- -- Example:
- -- signal uf1 : ufixed (3 downto -3);
- -- signal uf2 : ufixed (4 downto -2);
- -- signal uf1multuf2 : ufixed (ufixed_high (3, -3, '*', 4, -2) downto
- -- ufixed_low (3, -3, '*', 4, -2));
- -- uf1multuf2 <= uf1 * uf2;
- -- Valid characters: '+', '-', '*', '/', 'r' or 'R' (rem), 'm' or 'M' (mod),
- -- '1' (reciprocal), 'A', 'a' (abs), 'N', 'n' (-sfixed)
- function ufixed_high (left_index, right_index : INTEGER;
- operation : CHARACTER := 'X';
- left_index2, right_index2 : INTEGER := 0)
- return INTEGER is
- begin
- case operation is
- when '+'| '-' => return maximum (left_index, left_index2) + 1;
- when '*' => return left_index + left_index2 + 1;
- when '/' => return left_index - right_index2;
- when '1' => return -right_index; -- reciprocal
- when 'R'|'r' => return mins (left_index, left_index2); -- "rem"
- when 'M'|'m' => return mins (left_index, left_index2); -- "mod"
- when others => return left_index; -- For abs and default
- end case;
- end function ufixed_high;
-
- function ufixed_low (left_index, right_index : INTEGER;
- operation : CHARACTER := 'X';
- left_index2, right_index2 : INTEGER := 0)
- return INTEGER is
- begin
- case operation is
- when '+'| '-' => return mins (right_index, right_index2);
- when '*' => return right_index + right_index2;
- when '/' => return right_index - left_index2 - 1;
- when '1' => return -left_index - 1; -- reciprocal
- when 'R'|'r' => return mins (right_index, right_index2); -- "rem"
- when 'M'|'m' => return mins (right_index, right_index2); -- "mod"
- when others => return right_index; -- for abs and default
- end case;
- end function ufixed_low;
-
- function sfixed_high (left_index, right_index : INTEGER;
- operation : CHARACTER := 'X';
- left_index2, right_index2 : INTEGER := 0)
- return INTEGER is
- begin
- case operation is
- when '+'| '-' => return maximum (left_index, left_index2) + 1;
- when '*' => return left_index + left_index2 + 1;
- when '/' => return left_index - right_index2 + 1;
- when '1' => return -right_index + 1; -- reciprocal
- when 'R'|'r' => return mins (left_index, left_index2); -- "rem"
- when 'M'|'m' => return left_index2; -- "mod"
- when 'A'|'a' => return left_index + 1; -- "abs"
- when 'N'|'n' => return left_index + 1; -- -sfixed
- when others => return left_index;
- end case;
- end function sfixed_high;
-
- function sfixed_low (left_index, right_index : INTEGER;
- operation : CHARACTER := 'X';
- left_index2, right_index2 : INTEGER := 0)
- return INTEGER is
- begin
- case operation is
- when '+'| '-' => return mins (right_index, right_index2);
- when '*' => return right_index + right_index2;
- when '/' => return right_index - left_index2;
- when '1' => return -left_index; -- reciprocal
- when 'R'|'r' => return mins (right_index, right_index2); -- "rem"
- when 'M'|'m' => return mins (right_index, right_index2); -- "mod"
- when others => return right_index; -- default for abs, neg and default
- end case;
- end function sfixed_low;
-
- -- Same as above, but using the "size_res" input only for their ranges:
- -- signal uf1multuf2 : ufixed (ufixed_high (uf1, '*', uf2) downto
- -- ufixed_low (uf1, '*', uf2));
- -- uf1multuf2 <= uf1 * uf2;
- function ufixed_high (size_res : UNRESOLVED_ufixed;
- operation : CHARACTER := 'X';
- size_res2 : UNRESOLVED_ufixed)
- return INTEGER is
- begin
- return ufixed_high (left_index => size_res'high,
- right_index => size_res'low,
- operation => operation,
- left_index2 => size_res2'high,
- right_index2 => size_res2'low);
- end function ufixed_high;
-
- function ufixed_low (size_res : UNRESOLVED_ufixed;
- operation : CHARACTER := 'X';
- size_res2 : UNRESOLVED_ufixed)
- return INTEGER is
- begin
- return ufixed_low (left_index => size_res'high,
- right_index => size_res'low,
- operation => operation,
- left_index2 => size_res2'high,
- right_index2 => size_res2'low);
- end function ufixed_low;
-
- function sfixed_high (size_res : UNRESOLVED_sfixed;
- operation : CHARACTER := 'X';
- size_res2 : UNRESOLVED_sfixed)
- return INTEGER is
- begin
- return sfixed_high (left_index => size_res'high,
- right_index => size_res'low,
- operation => operation,
- left_index2 => size_res2'high,
- right_index2 => size_res2'low);
- end function sfixed_high;
-
- function sfixed_low (size_res : UNRESOLVED_sfixed;
- operation : CHARACTER := 'X';
- size_res2 : UNRESOLVED_sfixed)
- return INTEGER is
- begin
- return sfixed_low (left_index => size_res'high,
- right_index => size_res'low,
- operation => operation,
- left_index2 => size_res2'high,
- right_index2 => size_res2'low);
- end function sfixed_low;
-
- -- purpose: returns a saturated number
- function saturate (
- constant left_index : INTEGER;
- constant right_index : INTEGER)
- return UNRESOLVED_ufixed is
- constant sat : UNRESOLVED_ufixed (left_index downto right_index) :=
- (others => '1');
- begin
- return sat;
- end function saturate;
-
- -- purpose: returns a saturated number
- function saturate (
- constant left_index : INTEGER;
- constant right_index : INTEGER)
- return UNRESOLVED_sfixed is
- variable sat : UNRESOLVED_sfixed (left_index downto right_index) :=
- (others => '1');
- begin
- -- saturate positive, to saturate negative, just do "not saturate()"
- sat (left_index) := '0';
- return sat;
- end function saturate;
-
- function saturate (
- size_res : UNRESOLVED_ufixed) -- only the size of this is used
- return UNRESOLVED_ufixed is
- begin
- return saturate (size_res'high, size_res'low);
- end function saturate;
-
- function saturate (
- size_res : UNRESOLVED_sfixed) -- only the size of this is used
- return UNRESOLVED_sfixed is
- begin
- return saturate (size_res'high, size_res'low);
- end function saturate;
-
- -- As a concession to those who use a graphical DSP environment,
- -- these functions take parameters in those tools format and create
- -- fixed point numbers. These functions are designed to convert from
- -- a std_logic_vector to the VHDL fixed point format using the conventions
- -- of these packages. In a pure VHDL environment you should use the
- -- "to_ufixed" and "to_sfixed" routines.
- -- Unsigned fixed point
- function to_UFix (
- arg : STD_ULOGIC_VECTOR;
- width : NATURAL; -- width of vector
- fraction : NATURAL) -- width of fraction
- return UNRESOLVED_ufixed is
- variable result : UNRESOLVED_ufixed (width-fraction-1 downto -fraction);
- begin
- if (arg'length /= result'length) then
- report "fixed_pkg:"
- & "TO_UFIX (STD_ULOGIC_VECTOR) "
- & "Vector lengths do not match. Input length is "
- & INTEGER'image(arg'length) & " and output will be "
- & INTEGER'image(result'length) & " wide."
- severity error;
- return NAUF;
- else
- result := to_ufixed (arg, result'high, result'low);
- return result;
- end if;
- end function to_UFix;
-
- -- signed fixed point
- function to_SFix (
- arg : STD_ULOGIC_VECTOR;
- width : NATURAL; -- width of vector
- fraction : NATURAL) -- width of fraction
- return UNRESOLVED_sfixed is
- variable result : UNRESOLVED_sfixed (width-fraction-1 downto -fraction);
- begin
- if (arg'length /= result'length) then
- report "fixed_pkg:"
- & "TO_SFIX (STD_ULOGIC_VECTOR) "
- & "Vector lengths do not match. Input length is "
- & INTEGER'image(arg'length) & " and output will be "
- & INTEGER'image(result'length) & " wide."
- severity error;
- return NASF;
- else
- result := to_sfixed (arg, result'high, result'low);
- return result;
- end if;
- end function to_SFix;
-
- -- finding the bounds of a number. These functions can be used like this:
- -- signal xxx : ufixed (7 downto -3);
- -- -- Which is the same as "ufixed (UFix_high (11,3) downto UFix_low(11,3))"
- -- signal yyy : ufixed (UFix_high (11, 3, "+", 11, 3)
- -- downto UFix_low(11, 3, "+", 11, 3));
- -- Where "11" is the width of xxx (xxx'length),
- -- and 3 is the lower bound (abs (xxx'low))
- -- In a pure VHDL environment use "ufixed_high" and "ufixed_low"
- function ufix_high (
- width, fraction : NATURAL;
- operation : CHARACTER := 'X';
- width2, fraction2 : NATURAL := 0)
- return INTEGER is
- begin
- return ufixed_high (left_index => width - 1 - fraction,
- right_index => -fraction,
- operation => operation,
- left_index2 => width2 - 1 - fraction2,
- right_index2 => -fraction2);
- end function ufix_high;
-
- function ufix_low (
- width, fraction : NATURAL;
- operation : CHARACTER := 'X';
- width2, fraction2 : NATURAL := 0)
- return INTEGER is
- begin
- return ufixed_low (left_index => width - 1 - fraction,
- right_index => -fraction,
- operation => operation,
- left_index2 => width2 - 1 - fraction2,
- right_index2 => -fraction2);
- end function ufix_low;
-
- function sfix_high (
- width, fraction : NATURAL;
- operation : CHARACTER := 'X';
- width2, fraction2 : NATURAL := 0)
- return INTEGER is
- begin
- return sfixed_high (left_index => width - fraction,
- right_index => -fraction,
- operation => operation,
- left_index2 => width2 - fraction2,
- right_index2 => -fraction2);
- end function sfix_high;
-
- function sfix_low (
- width, fraction : NATURAL;
- operation : CHARACTER := 'X';
- width2, fraction2 : NATURAL := 0)
- return INTEGER is
- begin
- return sfixed_low (left_index => width - fraction,
- right_index => -fraction,
- operation => operation,
- left_index2 => width2 - fraction2,
- right_index2 => -fraction2);
- end function sfix_low;
-
- function to_unsigned (
- arg : UNRESOLVED_ufixed; -- ufixed point input
- constant size : NATURAL; -- length of output
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
- constant round_style : fixed_round_style_type := fixed_round_style)
- return UNSIGNED is
- begin
- return to_uns(resize (arg => arg,
- left_index => size-1,
- right_index => 0,
- round_style => round_style,
- overflow_style => overflow_style));
- end function to_unsigned;
-
- function to_unsigned (
- arg : UNRESOLVED_ufixed; -- ufixed point input
- size_res : UNSIGNED; -- length of output
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
- constant round_style : fixed_round_style_type := fixed_round_style)
- return UNSIGNED is
- begin
- return to_unsigned (arg => arg,
- size => size_res'length,
- round_style => round_style,
- overflow_style => overflow_style);
- end function to_unsigned;
-
- function to_signed (
- arg : UNRESOLVED_sfixed; -- sfixed point input
- constant size : NATURAL; -- length of output
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
- constant round_style : fixed_round_style_type := fixed_round_style)
- return SIGNED is
- begin
- return to_s(resize (arg => arg,
- left_index => size-1,
- right_index => 0,
- round_style => round_style,
- overflow_style => overflow_style));
- end function to_signed;
-
- function to_signed (
- arg : UNRESOLVED_sfixed; -- sfixed point input
- size_res : SIGNED; -- used for length of output
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
- constant round_style : fixed_round_style_type := fixed_round_style)
- return SIGNED is
- begin
- return to_signed (arg => arg,
- size => size_res'length,
- round_style => round_style,
- overflow_style => overflow_style);
- end function to_signed;
-
- function to_real (
- arg : UNRESOLVED_ufixed) -- ufixed point input
- return REAL is
- constant left_index : INTEGER := arg'high;
- constant right_index : INTEGER := arg'low;
- variable result : REAL; -- result
- variable arg_int : UNRESOLVED_ufixed (left_index downto right_index);
- begin
- if (arg'length < 1) then
- return 0.0;
- end if;
- arg_int := to_x01(cleanvec(arg));
- if (Is_X(arg_int)) then
- assert NO_WARNING
- report "fixed_pkg:"
- & "TO_REAL (ufixed): metavalue detected, returning 0.0"
- severity warning;
- return 0.0;
- end if;
- result := 0.0;
- for i in arg_int'range loop
- if (arg_int(i) = '1') then
- result := result + (2.0**i);
- end if;
- end loop;
- return result;
- end function to_real;
-
- function to_real (
- arg : UNRESOLVED_sfixed) -- ufixed point input
- return REAL is
- constant left_index : INTEGER := arg'high;
- constant right_index : INTEGER := arg'low;
- variable result : REAL; -- result
- variable arg_int : UNRESOLVED_sfixed (left_index downto right_index);
- -- unsigned version of argument
- variable arg_uns : UNRESOLVED_ufixed (left_index downto right_index);
- -- absolute of argument
- begin
- if (arg'length < 1) then
- return 0.0;
- end if;
- arg_int := to_x01(cleanvec(arg));
- if (Is_X(arg_int)) then
- assert NO_WARNING
- report "fixed_pkg:"
- & "TO_REAL (sfixed): metavalue detected, returning 0.0"
- severity warning;
- return 0.0;
- end if;
- arg_uns := to_ufixed (arg_int);
- result := to_real (arg_uns);
- if (arg_int(arg_int'high) = '1') then
- result := -result;
- end if;
- return result;
- end function to_real;
-
- function to_integer (
- arg : UNRESOLVED_ufixed; -- fixed point input
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
- constant round_style : fixed_round_style_type := fixed_round_style)
- return NATURAL is
- constant left_index : INTEGER := arg'high;
- variable arg_uns : UNSIGNED (left_index+1 downto 0)
- := (others => '0');
- begin
- if (arg'length < 1) then
- return 0;
- end if;
- if (Is_X (arg)) then
- assert NO_WARNING
- report "fixed_pkg:"
- & "TO_INTEGER (ufixed): metavalue detected, returning 0"
- severity warning;
- return 0;
- end if;
- if (left_index < -1) then
- return 0;
- end if;
- arg_uns := to_uns(resize (arg => arg,
- left_index => arg_uns'high,
- right_index => 0,
- round_style => round_style,
- overflow_style => overflow_style));
- return to_integer (arg_uns);
- end function to_integer;
-
- function to_integer (
- arg : UNRESOLVED_sfixed; -- fixed point input
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
- constant round_style : fixed_round_style_type := fixed_round_style)
- return INTEGER is
- constant left_index : INTEGER := arg'high;
- constant right_index : INTEGER := arg'low;
- variable arg_s : SIGNED (left_index+1 downto 0);
- begin
- if (arg'length < 1) then
- return 0;
- end if;
- if (Is_X (arg)) then
- assert NO_WARNING
- report "fixed_pkg:"
- & "TO_INTEGER (sfixed): metavalue detected, returning 0"
- severity warning;
- return 0;
- end if;
- if (left_index < -1) then
- return 0;
- end if;
- arg_s := to_s(resize (arg => arg,
- left_index => arg_s'high,
- right_index => 0,
- round_style => round_style,
- overflow_style => overflow_style));
- return to_integer (arg_s);
- end function to_integer;
-
- function to_01 (
- s : UNRESOLVED_ufixed; -- ufixed point input
- constant XMAP : STD_ULOGIC := '0') -- Map x to
- return UNRESOLVED_ufixed is
- variable result : UNRESOLVED_ufixed (s'range); -- result
- begin
- if (s'length < 1) then
- assert NO_WARNING
- report "fixed_pkg:"
- & "TO_01(ufixed): null detected, returning NULL"
- severity warning;
- return NAUF;
- end if;
- return to_fixed (to_01(to_uns(s), XMAP), s'high, s'low);
- end function to_01;
-
- function to_01 (
- s : UNRESOLVED_sfixed; -- sfixed point input
- constant XMAP : STD_ULOGIC := '0') -- Map x to
- return UNRESOLVED_sfixed is
- variable result : UNRESOLVED_sfixed (s'range);
- begin
- if (s'length < 1) then
- assert NO_WARNING
- report "fixed_pkg:"
- & "TO_01(sfixed): null detected, returning NULL"
- severity warning;
- return NASF;
- end if;
- return to_fixed (to_01(to_s(s), XMAP), s'high, s'low);
- end function to_01;
-
- function Is_X (
- arg : UNRESOLVED_ufixed)
- return BOOLEAN is
- variable argslv : STD_ULOGIC_VECTOR (arg'length-1 downto 0); -- slv
- begin
- argslv := to_sulv(arg);
- return Is_X (argslv);
- end function Is_X;
-
- function Is_X (
- arg : UNRESOLVED_sfixed)
- return BOOLEAN is
- variable argslv : STD_ULOGIC_VECTOR (arg'length-1 downto 0); -- slv
- begin
- argslv := to_sulv(arg);
- return Is_X (argslv);
- end function Is_X;
-
- function To_X01 (
- arg : UNRESOLVED_ufixed)
- return UNRESOLVED_ufixed is
- begin
- return to_ufixed (To_X01(to_sulv(arg)), arg'high, arg'low);
- end function To_X01;
-
- function to_X01 (
- arg : UNRESOLVED_sfixed)
- return UNRESOLVED_sfixed is
- begin
- return to_sfixed (To_X01(to_sulv(arg)), arg'high, arg'low);
- end function To_X01;
-
- function To_X01Z (
- arg : UNRESOLVED_ufixed)
- return UNRESOLVED_ufixed is
- begin
- return to_ufixed (To_X01Z(to_sulv(arg)), arg'high, arg'low);
- end function To_X01Z;
-
- function to_X01Z (
- arg : UNRESOLVED_sfixed)
- return UNRESOLVED_sfixed is
- begin
- return to_sfixed (To_X01Z(to_sulv(arg)), arg'high, arg'low);
- end function To_X01Z;
-
- function To_UX01 (
- arg : UNRESOLVED_ufixed)
- return UNRESOLVED_ufixed is
- begin
- return to_ufixed (To_UX01(to_sulv(arg)), arg'high, arg'low);
- end function To_UX01;
-
- function to_UX01 (
- arg : UNRESOLVED_sfixed)
- return UNRESOLVED_sfixed is
- begin
- return to_sfixed (To_UX01(to_sulv(arg)), arg'high, arg'low);
- end function To_UX01;
-
- function resize (
- arg : UNRESOLVED_ufixed; -- input
- constant left_index : INTEGER; -- integer portion
- constant right_index : INTEGER; -- size of fraction
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
- constant round_style : fixed_round_style_type := fixed_round_style)
- return UNRESOLVED_ufixed is
- constant arghigh : INTEGER := maximum (arg'high, arg'low);
- constant arglow : INTEGER := mine (arg'high, arg'low);
- variable invec : UNRESOLVED_ufixed (arghigh downto arglow);
- variable result : UNRESOLVED_ufixed(left_index downto right_index) :=
- (others => '0');
- variable needs_rounding : BOOLEAN := false;
- begin -- resize
- if (arg'length < 1) or (result'length < 1) then
- return NAUF;
- elsif (invec'length < 1) then
- return result; -- string literal value
- else
- invec := cleanvec(arg);
- if (right_index > arghigh) then -- return top zeros
- needs_rounding := (round_style = fixed_round) and
- (right_index = arghigh+1);
- elsif (left_index < arglow) then -- return overflow
- if (overflow_style = fixed_saturate) and
- (or_reduce(to_sulv(invec)) = '1') then
- result := saturate (result'high, result'low); -- saturate
- end if;
- elsif (arghigh > left_index) then
- -- wrap or saturate?
- if (overflow_style = fixed_saturate and
- or_reduce (to_sulv(invec(arghigh downto left_index+1))) = '1')
- then
- result := saturate (result'high, result'low); -- saturate
- else
- if (arglow >= right_index) then
- result (left_index downto arglow) :=
- invec(left_index downto arglow);
- else
- result (left_index downto right_index) :=
- invec (left_index downto right_index);
- needs_rounding := (round_style = fixed_round); -- round
- end if;
- end if;
- else -- arghigh <= integer width
- if (arglow >= right_index) then
- result (arghigh downto arglow) := invec;
- else
- result (arghigh downto right_index) :=
- invec (arghigh downto right_index);
- needs_rounding := (round_style = fixed_round); -- round
- end if;
- end if;
- -- Round result
- if needs_rounding then
- result := round_fixed (arg => result,
- remainder => invec (right_index-1
- downto arglow),
- overflow_style => overflow_style);
- end if;
- return result;
- end if;
- end function resize;
-
- function resize (
- arg : UNRESOLVED_sfixed; -- input
- constant left_index : INTEGER; -- integer portion
- constant right_index : INTEGER; -- size of fraction
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
- constant round_style : fixed_round_style_type := fixed_round_style)
- return UNRESOLVED_sfixed is
- constant arghigh : INTEGER := maximum (arg'high, arg'low);
- constant arglow : INTEGER := mine (arg'high, arg'low);
- variable invec : UNRESOLVED_sfixed (arghigh downto arglow);
- variable result : UNRESOLVED_sfixed(left_index downto right_index) :=
- (others => '0');
- variable reduced : STD_ULOGIC;
- variable needs_rounding : BOOLEAN := false; -- rounding
- begin -- resize
- if (arg'length < 1) or (result'length < 1) then
- return NASF;
- elsif (invec'length < 1) then
- return result; -- string literal value
- else
- invec := cleanvec(arg);
- if (right_index > arghigh) then -- return top zeros
- if (arg'low /= INTEGER'low) then -- check for a literal
- result := (others => arg(arghigh)); -- sign extend
- end if;
- needs_rounding := (round_style = fixed_round) and
- (right_index = arghigh+1);
- elsif (left_index < arglow) then -- return overflow
- if (overflow_style = fixed_saturate) then
- reduced := or_reduce (to_sulv(invec));
- if (reduced = '1') then
- if (invec(arghigh) = '0') then
- -- saturate POSITIVE
- result := saturate (result'high, result'low);
- else
- -- saturate negative
- result := not saturate (result'high, result'low);
- end if;
- -- else return 0 (input was 0)
- end if;
- -- else return 0 (wrap)
- end if;
- elsif (arghigh > left_index) then
- if (invec(arghigh) = '0') then
- reduced := or_reduce (to_sulv(invec(arghigh-1 downto
- left_index)));
- if overflow_style = fixed_saturate and reduced = '1' then
- -- saturate positive
- result := saturate (result'high, result'low);
- else
- if (right_index > arglow) then
- result := invec (left_index downto right_index);
- needs_rounding := (round_style = fixed_round);
- else
- result (left_index downto arglow) :=
- invec (left_index downto arglow);
- end if;
- end if;
- else
- reduced := and_reduce (to_sulv(invec(arghigh-1 downto
- left_index)));
- if overflow_style = fixed_saturate and reduced = '0' then
- result := not saturate (result'high, result'low);
- else
- if (right_index > arglow) then
- result := invec (left_index downto right_index);
- needs_rounding := (round_style = fixed_round);
- else
- result (left_index downto arglow) :=
- invec (left_index downto arglow);
- end if;
- end if;
- end if;
- else -- arghigh <= integer width
- if (arglow >= right_index) then
- result (arghigh downto arglow) := invec;
- else
- result (arghigh downto right_index) :=
- invec (arghigh downto right_index);
- needs_rounding := (round_style = fixed_round); -- round
- end if;
- if (left_index > arghigh) then -- sign extend
- result(left_index downto arghigh+1) := (others => invec(arghigh));
- end if;
- end if;
- -- Round result
- if (needs_rounding) then
- result := round_fixed (arg => result,
- remainder => invec (right_index-1
- downto arglow),
- overflow_style => overflow_style);
- end if;
- return result;
- end if;
- end function resize;
-
- -- size_res functions
- -- These functions compute the size from a passed variable named "size_res"
- -- The only part of this variable used it it's size, it is never passed
- -- to a lower level routine.
- function to_ufixed (
- arg : STD_ULOGIC_VECTOR; -- shifted vector
- size_res : UNRESOLVED_ufixed) -- for size only
- return UNRESOLVED_ufixed is
- constant fw : INTEGER := mine (size_res'low, size_res'low); -- catch literals
- variable result : UNRESOLVED_ufixed (size_res'left downto fw);
- begin
- if (result'length < 1 or arg'length < 1) then
- return NAUF;
- else
- result := to_ufixed (arg => arg,
- left_index => size_res'high,
- right_index => size_res'low);
- return result;
- end if;
- end function to_ufixed;
-
- function to_sfixed (
- arg : STD_ULOGIC_VECTOR; -- shifted vector
- size_res : UNRESOLVED_sfixed) -- for size only
- return UNRESOLVED_sfixed is
- constant fw : INTEGER := mine (size_res'low, size_res'low); -- catch literals
- variable result : UNRESOLVED_sfixed (size_res'left downto fw);
- begin
- if (result'length < 1 or arg'length < 1) then
- return NASF;
- else
- result := to_sfixed (arg => arg,
- left_index => size_res'high,
- right_index => size_res'low);
- return result;
- end if;
- end function to_sfixed;
-
- function to_ufixed (
- arg : NATURAL; -- integer
- size_res : UNRESOLVED_ufixed; -- for size only
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
- constant round_style : fixed_round_style_type := fixed_round_style)
- return UNRESOLVED_ufixed is
- constant fw : INTEGER := mine (size_res'low, size_res'low); -- catch literals
- variable result : UNRESOLVED_ufixed (size_res'left downto fw);
- begin
- if (result'length < 1) then
- return NAUF;
- else
- result := to_ufixed (arg => arg,
- left_index => size_res'high,
- right_index => size_res'low,
- round_style => round_style,
- overflow_style => overflow_style);
- return result;
- end if;
- end function to_ufixed;
-
- function to_sfixed (
- arg : INTEGER; -- integer
- size_res : UNRESOLVED_sfixed; -- for size only
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
- constant round_style : fixed_round_style_type := fixed_round_style)
- return UNRESOLVED_sfixed is
- constant fw : INTEGER := mine (size_res'low, size_res'low); -- catch literals
- variable result : UNRESOLVED_sfixed (size_res'left downto fw);
- begin
- if (result'length < 1) then
- return NASF;
- else
- result := to_sfixed (arg => arg,
- left_index => size_res'high,
- right_index => size_res'low,
- round_style => round_style,
- overflow_style => overflow_style);
- return result;
- end if;
- end function to_sfixed;
-
- function to_ufixed (
- arg : REAL; -- real
- size_res : UNRESOLVED_ufixed; -- for size only
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
- constant round_style : fixed_round_style_type := fixed_round_style;
- constant guard_bits : NATURAL := fixed_guard_bits) -- # of guard bits
- return UNRESOLVED_ufixed is
- constant fw : INTEGER := mine (size_res'low, size_res'low); -- catch literals
- variable result : UNRESOLVED_ufixed (size_res'left downto fw);
- begin
- if (result'length < 1) then
- return NAUF;
- else
- result := to_ufixed (arg => arg,
- left_index => size_res'high,
- right_index => size_res'low,
- guard_bits => guard_bits,
- round_style => round_style,
- overflow_style => overflow_style);
- return result;
- end if;
- end function to_ufixed;
-
- function to_sfixed (
- arg : REAL; -- real
- size_res : UNRESOLVED_sfixed; -- for size only
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
- constant round_style : fixed_round_style_type := fixed_round_style;
- constant guard_bits : NATURAL := fixed_guard_bits) -- # of guard bits
- return UNRESOLVED_sfixed is
- constant fw : INTEGER := mine (size_res'low, size_res'low); -- catch literals
- variable result : UNRESOLVED_sfixed (size_res'left downto fw);
- begin
- if (result'length < 1) then
- return NASF;
- else
- result := to_sfixed (arg => arg,
- left_index => size_res'high,
- right_index => size_res'low,
- guard_bits => guard_bits,
- round_style => round_style,
- overflow_style => overflow_style);
- return result;
- end if;
- end function to_sfixed;
-
- function to_ufixed (
- arg : UNSIGNED; -- unsigned
- size_res : UNRESOLVED_ufixed; -- for size only
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
- constant round_style : fixed_round_style_type := fixed_round_style)
- return UNRESOLVED_ufixed is
- constant fw : INTEGER := mine (size_res'low, size_res'low); -- catch literals
- variable result : UNRESOLVED_ufixed (size_res'left downto fw);
- begin
- if (result'length < 1 or arg'length < 1) then
- return NAUF;
- else
- result := to_ufixed (arg => arg,
- left_index => size_res'high,
- right_index => size_res'low,
- round_style => round_style,
- overflow_style => overflow_style);
- return result;
- end if;
- end function to_ufixed;
-
- function to_sfixed (
- arg : SIGNED; -- signed
- size_res : UNRESOLVED_sfixed; -- for size only
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
- constant round_style : fixed_round_style_type := fixed_round_style)
- return UNRESOLVED_sfixed is
- constant fw : INTEGER := mine (size_res'low, size_res'low); -- catch literals
- variable result : UNRESOLVED_sfixed (size_res'left downto fw);
- begin
- if (result'length < 1 or arg'length < 1) then
- return NASF;
- else
- result := to_sfixed (arg => arg,
- left_index => size_res'high,
- right_index => size_res'low,
- round_style => round_style,
- overflow_style => overflow_style);
- return result;
- end if;
- end function to_sfixed;
-
- function resize (
- arg : UNRESOLVED_ufixed; -- input
- size_res : UNRESOLVED_ufixed; -- for size only
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
- constant round_style : fixed_round_style_type := fixed_round_style)
- return UNRESOLVED_ufixed is
- constant fw : INTEGER := mine (size_res'low, size_res'low); -- catch literals
- variable result : UNRESOLVED_ufixed (size_res'high downto fw);
- begin
- if (result'length < 1 or arg'length < 1) then
- return NAUF;
- else
- result := resize (arg => arg,
- left_index => size_res'high,
- right_index => size_res'low,
- round_style => round_style,
- overflow_style => overflow_style);
- return result;
- end if;
- end function resize;
-
- function resize (
- arg : UNRESOLVED_sfixed; -- input
- size_res : UNRESOLVED_sfixed; -- for size only
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style;
- constant round_style : fixed_round_style_type := fixed_round_style)
- return UNRESOLVED_sfixed is
- constant fw : INTEGER := mine (size_res'low, size_res'low); -- catch literals
- variable result : UNRESOLVED_sfixed (size_res'high downto fw);
- begin
- if (result'length < 1 or arg'length < 1) then
- return NASF;
- else
- result := resize (arg => arg,
- left_index => size_res'high,
- right_index => size_res'low,
- round_style => round_style,
- overflow_style => overflow_style);
- return result;
- end if;
- end function resize;
-
- -- Overloaded math functions for real
- function "+" (
- l : UNRESOLVED_ufixed; -- fixed point input
- r : REAL)
- return UNRESOLVED_ufixed is
- begin
- return (l + to_ufixed (r, l'high, l'low));
- end function "+";
-
- function "+" (
- l : REAL;
- r : UNRESOLVED_ufixed) -- fixed point input
- return UNRESOLVED_ufixed is
- begin
- return (to_ufixed (l, r'high, r'low) + r);
- end function "+";
-
- function "+" (
- l : UNRESOLVED_sfixed; -- fixed point input
- r : REAL)
- return UNRESOLVED_sfixed is
- begin
- return (l + to_sfixed (r, l'high, l'low));
- end function "+";
-
- function "+" (
- l : REAL;
- r : UNRESOLVED_sfixed) -- fixed point input
- return UNRESOLVED_sfixed is
- begin
- return (to_sfixed (l, r'high, r'low) + r);
- end function "+";
-
- function "-" (
- l : UNRESOLVED_ufixed; -- fixed point input
- r : REAL)
- return UNRESOLVED_ufixed is
- begin
- return (l - to_ufixed (r, l'high, l'low));
- end function "-";
-
- function "-" (
- l : REAL;
- r : UNRESOLVED_ufixed) -- fixed point input
- return UNRESOLVED_ufixed is
- begin
- return (to_ufixed (l, r'high, r'low) - r);
- end function "-";
-
- function "-" (
- l : UNRESOLVED_sfixed; -- fixed point input
- r : REAL)
- return UNRESOLVED_sfixed is
- begin
- return (l - to_sfixed (r, l'high, l'low));
- end function "-";
-
- function "-" (
- l : REAL;
- r : UNRESOLVED_sfixed) -- fixed point input
- return UNRESOLVED_sfixed is
- begin
- return (to_sfixed (l, r'high, r'low) - r);
- end function "-";
-
- function "*" (
- l : UNRESOLVED_ufixed; -- fixed point input
- r : REAL)
- return UNRESOLVED_ufixed is
- begin
- return (l * to_ufixed (r, l'high, l'low));
- end function "*";
-
- function "*" (
- l : REAL;
- r : UNRESOLVED_ufixed) -- fixed point input
- return UNRESOLVED_ufixed is
- begin
- return (to_ufixed (l, r'high, r'low) * r);
- end function "*";
-
- function "*" (
- l : UNRESOLVED_sfixed; -- fixed point input
- r : REAL)
- return UNRESOLVED_sfixed is
- begin
- return (l * to_sfixed (r, l'high, l'low));
- end function "*";
-
- function "*" (
- l : REAL;
- r : UNRESOLVED_sfixed) -- fixed point input
- return UNRESOLVED_sfixed is
- begin
- return (to_sfixed (l, r'high, r'low) * r);
- end function "*";
-
--- function "/" (
--- l : UNRESOLVED_ufixed; -- fixed point input
--- r : REAL)
--- return UNRESOLVED_ufixed is
--- begin
--- return (l / to_ufixed (r, l'high, l'low));
--- end function "/";
-
--- function "/" (
--- l : REAL;
--- r : UNRESOLVED_ufixed) -- fixed point input
--- return UNRESOLVED_ufixed is
--- begin
--- return (to_ufixed (l, r'high, r'low) / r);
--- end function "/";
-
--- function "/" (
--- l : UNRESOLVED_sfixed; -- fixed point input
--- r : REAL)
--- return UNRESOLVED_sfixed is
--- begin
--- return (l / to_sfixed (r, l'high, l'low));
--- end function "/";
-
--- function "/" (
--- l : REAL;
--- r : UNRESOLVED_sfixed) -- fixed point input
--- return UNRESOLVED_sfixed is
--- begin
--- return (to_sfixed (l, r'high, r'low) / r);
--- end function "/";
-
--- function "rem" (
--- l : UNRESOLVED_ufixed; -- fixed point input
--- r : REAL)
--- return UNRESOLVED_ufixed is
--- begin
--- return (l rem to_ufixed (r, l'high, l'low));
--- end function "rem";
-
--- function "rem" (
--- l : REAL;
--- r : UNRESOLVED_ufixed) -- fixed point input
--- return UNRESOLVED_ufixed is
--- begin
--- return (to_ufixed (l, r'high, r'low) rem r);
--- end function "rem";
-
--- function "rem" (
--- l : UNRESOLVED_sfixed; -- fixed point input
--- r : REAL)
--- return UNRESOLVED_sfixed is
--- begin
--- return (l rem to_sfixed (r, l'high, l'low));
--- end function "rem";
-
--- function "rem" (
--- l : REAL;
--- r : UNRESOLVED_sfixed) -- fixed point input
--- return UNRESOLVED_sfixed is
--- begin
--- return (to_sfixed (l, r'high, r'low) rem r);
--- end function "rem";
-
--- function "mod" (
--- l : UNRESOLVED_ufixed; -- fixed point input
--- r : REAL)
--- return UNRESOLVED_ufixed is
--- begin
--- return (l mod to_ufixed (r, l'high, l'low));
--- end function "mod";
-
--- function "mod" (
--- l : REAL;
--- r : UNRESOLVED_ufixed) -- fixed point input
--- return UNRESOLVED_ufixed is
--- begin
--- return (to_ufixed (l, r'high, r'low) mod r);
--- end function "mod";
-
--- function "mod" (
--- l : UNRESOLVED_sfixed; -- fixed point input
--- r : REAL)
--- return UNRESOLVED_sfixed is
--- begin
--- return (l mod to_sfixed (r, l'high, l'low));
--- end function "mod";
-
--- function "mod" (
--- l : REAL;
--- r : UNRESOLVED_sfixed) -- fixed point input
--- return UNRESOLVED_sfixed is
--- begin
--- return (to_sfixed (l, r'high, r'low) mod r);
--- end function "mod";
-
- -- Overloaded math functions for integers
- function "+" (
- l : UNRESOLVED_ufixed; -- fixed point input
- r : NATURAL)
- return UNRESOLVED_ufixed is
- begin
- return (l + to_ufixed (r, l'high, 0));
- end function "+";
-
- function "+" (
- l : NATURAL;
- r : UNRESOLVED_ufixed) -- fixed point input
- return UNRESOLVED_ufixed is
- begin
- return (to_ufixed (l, r'high, 0) + r);
- end function "+";
-
- function "+" (
- l : UNRESOLVED_sfixed; -- fixed point input
- r : INTEGER)
- return UNRESOLVED_sfixed is
- begin
- return (l + to_sfixed (r, l'high, 0));
- end function "+";
-
- function "+" (
- l : INTEGER;
- r : UNRESOLVED_sfixed) -- fixed point input
- return UNRESOLVED_sfixed is
- begin
- return (to_sfixed (l, r'high, 0) + r);
- end function "+";
-
- -- Overloaded functions
- function "-" (
- l : UNRESOLVED_ufixed; -- fixed point input
- r : NATURAL)
- return UNRESOLVED_ufixed is
- begin
- return (l - to_ufixed (r, l'high, 0));
- end function "-";
-
- function "-" (
- l : NATURAL;
- r : UNRESOLVED_ufixed) -- fixed point input
- return UNRESOLVED_ufixed is
- begin
- return (to_ufixed (l, r'high, 0) - r);
- end function "-";
-
- function "-" (
- l : UNRESOLVED_sfixed; -- fixed point input
- r : INTEGER)
- return UNRESOLVED_sfixed is
- begin
- return (l - to_sfixed (r, l'high, 0));
- end function "-";
-
- function "-" (
- l : INTEGER;
- r : UNRESOLVED_sfixed) -- fixed point input
- return UNRESOLVED_sfixed is
- begin
- return (to_sfixed (l, r'high, 0) - r);
- end function "-";
-
- -- Overloaded functions
- function "*" (
- l : UNRESOLVED_ufixed; -- fixed point input
- r : NATURAL)
- return UNRESOLVED_ufixed is
- begin
- return (l * to_ufixed (r, l'high, 0));
- end function "*";
-
- function "*" (
- l : NATURAL;
- r : UNRESOLVED_ufixed) -- fixed point input
- return UNRESOLVED_ufixed is
- begin
- return (to_ufixed (l, r'high, 0) * r);
- end function "*";
-
- function "*" (
- l : UNRESOLVED_sfixed; -- fixed point input
- r : INTEGER)
- return UNRESOLVED_sfixed is
- begin
- return (l * to_sfixed (r, l'high, 0));
- end function "*";
-
- function "*" (
- l : INTEGER;
- r : UNRESOLVED_sfixed) -- fixed point input
- return UNRESOLVED_sfixed is
- begin
- return (to_sfixed (l, r'high, 0) * r);
- end function "*";
-
- -- Overloaded functions
--- function "/" (
--- l : UNRESOLVED_ufixed; -- fixed point input
--- r : NATURAL)
--- return UNRESOLVED_ufixed is
--- begin
--- return (l / to_ufixed (r, l'high, 0));
--- end function "/";
-
--- function "/" (
--- l : NATURAL;
--- r : UNRESOLVED_ufixed) -- fixed point input
--- return UNRESOLVED_ufixed is
--- begin
--- return (to_ufixed (l, r'high, 0) / r);
--- end function "/";
-
--- function "/" (
--- l : UNRESOLVED_sfixed; -- fixed point input
--- r : INTEGER)
--- return UNRESOLVED_sfixed is
--- begin
--- return (l / to_sfixed (r, l'high, 0));
--- end function "/";
-
--- function "/" (
--- l : INTEGER;
--- r : UNRESOLVED_sfixed) -- fixed point input
--- return UNRESOLVED_sfixed is
--- begin
--- return (to_sfixed (l, r'high, 0) / r);
--- end function "/";
-
--- function "rem" (
--- l : UNRESOLVED_ufixed; -- fixed point input
--- r : NATURAL)
--- return UNRESOLVED_ufixed is
--- begin
--- return (l rem to_ufixed (r, l'high, 0));
--- end function "rem";
-
--- function "rem" (
--- l : NATURAL;
--- r : UNRESOLVED_ufixed) -- fixed point input
--- return UNRESOLVED_ufixed is
--- begin
--- return (to_ufixed (l, r'high, 0) rem r);
--- end function "rem";
-
--- function "rem" (
--- l : UNRESOLVED_sfixed; -- fixed point input
--- r : INTEGER)
--- return UNRESOLVED_sfixed is
--- begin
--- return (l rem to_sfixed (r, l'high, 0));
--- end function "rem";
-
--- function "rem" (
--- l : INTEGER;
--- r : UNRESOLVED_sfixed) -- fixed point input
--- return UNRESOLVED_sfixed is
--- begin
--- return (to_sfixed (l, r'high, 0) rem r);
--- end function "rem";
-
--- function "mod" (
--- l : UNRESOLVED_ufixed; -- fixed point input
--- r : NATURAL)
--- return UNRESOLVED_ufixed is
--- begin
--- return (l mod to_ufixed (r, l'high, 0));
--- end function "mod";
-
--- function "mod" (
--- l : NATURAL;
--- r : UNRESOLVED_ufixed) -- fixed point input
--- return UNRESOLVED_ufixed is
--- begin
--- return (to_ufixed (l, r'high, 0) mod r);
--- end function "mod";
-
--- function "mod" (
--- l : UNRESOLVED_sfixed; -- fixed point input
--- r : INTEGER)
--- return UNRESOLVED_sfixed is
--- begin
--- return (l mod to_sfixed (r, l'high, 0));
--- end function "mod";
-
--- function "mod" (
--- l : INTEGER;
--- r : UNRESOLVED_sfixed) -- fixed point input
--- return UNRESOLVED_sfixed is
--- begin
--- return (to_sfixed (l, r'high, 0) mod r);
--- end function "mod";
-
- -- overloaded ufixed compare functions with integer
- function "=" (
- l : UNRESOLVED_ufixed;
- r : NATURAL) -- fixed point input
- return BOOLEAN is
- begin
- return (l = to_ufixed (r, l'high, l'low));
- end function "=";
-
- function "/=" (
- l : UNRESOLVED_ufixed;
- r : NATURAL) -- fixed point input
- return BOOLEAN is
- begin
- return (l /= to_ufixed (r, l'high, l'low));
- end function "/=";
-
- function ">=" (
- l : UNRESOLVED_ufixed;
- r : NATURAL) -- fixed point input
- return BOOLEAN is
- begin
- return (l >= to_ufixed (r, l'high, l'low));
- end function ">=";
-
- function "<=" (
- l : UNRESOLVED_ufixed;
- r : NATURAL) -- fixed point input
- return BOOLEAN is
- begin
- return (l <= to_ufixed (r, l'high, l'low));
- end function "<=";
-
- function ">" (
- l : UNRESOLVED_ufixed;
- r : NATURAL) -- fixed point input
- return BOOLEAN is
- begin
- return (l > to_ufixed (r, l'high, l'low));
- end function ">";
-
- function "<" (
- l : UNRESOLVED_ufixed;
- r : NATURAL) -- fixed point input
- return BOOLEAN is
- begin
- return (l < to_ufixed (r, l'high, l'low));
- end function "<";
-
- function \?=\ (
- l : UNRESOLVED_ufixed;
- r : NATURAL) -- fixed point input
- return STD_ULOGIC is
- begin
- return \?=\ (l, to_ufixed (r, l'high, l'low));
- end function \?=\;
-
- function \?/=\ (
- l : UNRESOLVED_ufixed;
- r : NATURAL) -- fixed point input
- return STD_ULOGIC is
- begin
- return \?/=\ (l, to_ufixed (r, l'high, l'low));
- end function \?/=\;
-
- function \?>=\ (
- l : UNRESOLVED_ufixed;
- r : NATURAL) -- fixed point input
- return STD_ULOGIC is
- begin
- return \?>=\ (l, to_ufixed (r, l'high, l'low));
- end function \?>=\;
-
- function \?<=\ (
- l : UNRESOLVED_ufixed;
- r : NATURAL) -- fixed point input
- return STD_ULOGIC is
- begin
- return \?<=\ (l, to_ufixed (r, l'high, l'low));
- end function \?<=\;
-
- function \?>\ (
- l : UNRESOLVED_ufixed;
- r : NATURAL) -- fixed point input
- return STD_ULOGIC is
- begin
- return \?>\ (l, to_ufixed (r, l'high, l'low));
- end function \?>\;
-
- function \?<\ (
- l : UNRESOLVED_ufixed;
- r : NATURAL) -- fixed point input
- return STD_ULOGIC is
- begin
- return \?<\ (l, to_ufixed (r, l'high, l'low));
- end function \?<\;
-
- function maximum (
- l : UNRESOLVED_ufixed; -- fixed point input
- r : NATURAL)
- return UNRESOLVED_ufixed is
- begin
- return maximum (l, to_ufixed (r, l'high, l'low));
- end function maximum;
-
- function minimum (
- l : UNRESOLVED_ufixed; -- fixed point input
- r : NATURAL)
- return UNRESOLVED_ufixed is
- begin
- return minimum (l, to_ufixed (r, l'high, l'low));
- end function minimum;
-
- -- NATURAL to ufixed
- function "=" (
- l : NATURAL;
- r : UNRESOLVED_ufixed) -- fixed point input
- return BOOLEAN is
- begin
- return (to_ufixed (l, r'high, r'low) = r);
- end function "=";
-
- function "/=" (
- l : NATURAL;
- r : UNRESOLVED_ufixed) -- fixed point input
- return BOOLEAN is
- begin
- return (to_ufixed (l, r'high, r'low) /= r);
- end function "/=";
-
- function ">=" (
- l : NATURAL;
- r : UNRESOLVED_ufixed) -- fixed point input
- return BOOLEAN is
- begin
- return (to_ufixed (l, r'high, r'low) >= r);
- end function ">=";
-
- function "<=" (
- l : NATURAL;
- r : UNRESOLVED_ufixed) -- fixed point input
- return BOOLEAN is
- begin
- return (to_ufixed (l, r'high, r'low) <= r);
- end function "<=";
-
- function ">" (
- l : NATURAL;
- r : UNRESOLVED_ufixed) -- fixed point input
- return BOOLEAN is
- begin
- return (to_ufixed (l, r'high, r'low) > r);
- end function ">";
-
- function "<" (
- l : NATURAL;
- r : UNRESOLVED_ufixed) -- fixed point input
- return BOOLEAN is
- begin
- return (to_ufixed (l, r'high, r'low) < r);
- end function "<";
-
- function \?=\ (
- l : NATURAL;
- r : UNRESOLVED_ufixed) -- fixed point input
- return STD_ULOGIC is
- begin
- return \?=\ (to_ufixed (l, r'high, r'low), r);
- end function \?=\;
-
- function \?/=\ (
- l : NATURAL;
- r : UNRESOLVED_ufixed) -- fixed point input
- return STD_ULOGIC is
- begin
- return \?/=\ (to_ufixed (l, r'high, r'low), r);
- end function \?/=\;
-
- function \?>=\ (
- l : NATURAL;
- r : UNRESOLVED_ufixed) -- fixed point input
- return STD_ULOGIC is
- begin
- return \?>=\ (to_ufixed (l, r'high, r'low), r);
- end function \?>=\;
-
- function \?<=\ (
- l : NATURAL;
- r : UNRESOLVED_ufixed) -- fixed point input
- return STD_ULOGIC is
- begin
- return \?<=\ (to_ufixed (l, r'high, r'low), r);
- end function \?<=\;
-
- function \?>\ (
- l : NATURAL;
- r : UNRESOLVED_ufixed) -- fixed point input
- return STD_ULOGIC is
- begin
- return \?>\ (to_ufixed (l, r'high, r'low), r);
- end function \?>\;
-
- function \?<\ (
- l : NATURAL;
- r : UNRESOLVED_ufixed) -- fixed point input
- return STD_ULOGIC is
- begin
- return \?<\ (to_ufixed (l, r'high, r'low), r);
- end function \?<\;
-
- function maximum (
- l : NATURAL;
- r : UNRESOLVED_ufixed) -- fixed point input
- return UNRESOLVED_ufixed is
- begin
- return maximum (to_ufixed (l, r'high, r'low), r);
- end function maximum;
-
- function minimum (
- l : NATURAL;
- r : UNRESOLVED_ufixed) -- fixed point input
- return UNRESOLVED_ufixed is
- begin
- return minimum (to_ufixed (l, r'high, r'low), r);
- end function minimum;
-
- -- overloaded ufixed compare functions with real
- function "=" (
- l : UNRESOLVED_ufixed;
- r : REAL)
- return BOOLEAN is
- begin
- return (l = to_ufixed (r, l'high, l'low));
- end function "=";
-
- function "/=" (
- l : UNRESOLVED_ufixed;
- r : REAL)
- return BOOLEAN is
- begin
- return (l /= to_ufixed (r, l'high, l'low));
- end function "/=";
-
- function ">=" (
- l : UNRESOLVED_ufixed;
- r : REAL)
- return BOOLEAN is
- begin
- return (l >= to_ufixed (r, l'high, l'low));
- end function ">=";
-
- function "<=" (
- l : UNRESOLVED_ufixed;
- r : REAL)
- return BOOLEAN is
- begin
- return (l <= to_ufixed (r, l'high, l'low));
- end function "<=";
-
- function ">" (
- l : UNRESOLVED_ufixed;
- r : REAL)
- return BOOLEAN is
- begin
- return (l > to_ufixed (r, l'high, l'low));
- end function ">";
-
- function "<" (
- l : UNRESOLVED_ufixed;
- r : REAL)
- return BOOLEAN is
- begin
- return (l < to_ufixed (r, l'high, l'low));
- end function "<";
-
- function \?=\ (
- l : UNRESOLVED_ufixed;
- r : REAL)
- return STD_ULOGIC is
- begin
- return \?=\ (l, to_ufixed (r, l'high, l'low));
- end function \?=\;
-
- function \?/=\ (
- l : UNRESOLVED_ufixed;
- r : REAL)
- return STD_ULOGIC is
- begin
- return \?/=\ (l, to_ufixed (r, l'high, l'low));
- end function \?/=\;
-
- function \?>=\ (
- l : UNRESOLVED_ufixed;
- r : REAL)
- return STD_ULOGIC is
- begin
- return \?>=\ (l, to_ufixed (r, l'high, l'low));
- end function \?>=\;
-
- function \?<=\ (
- l : UNRESOLVED_ufixed;
- r : REAL)
- return STD_ULOGIC is
- begin
- return \?<=\ (l, to_ufixed (r, l'high, l'low));
- end function \?<=\;
-
- function \?>\ (
- l : UNRESOLVED_ufixed;
- r : REAL)
- return STD_ULOGIC is
- begin
- return \?>\ (l, to_ufixed (r, l'high, l'low));
- end function \?>\;
-
- function \?<\ (
- l : UNRESOLVED_ufixed;
- r : REAL)
- return STD_ULOGIC is
- begin
- return \?<\ (l, to_ufixed (r, l'high, l'low));
- end function \?<\;
-
- function maximum (
- l : UNRESOLVED_ufixed;
- r : REAL)
- return UNRESOLVED_ufixed is
- begin
- return maximum (l, to_ufixed (r, l'high, l'low));
- end function maximum;
-
- function minimum (
- l : UNRESOLVED_ufixed;
- r : REAL)
- return UNRESOLVED_ufixed is
- begin
- return minimum (l, to_ufixed (r, l'high, l'low));
- end function minimum;
-
- -- real and ufixed
- function "=" (
- l : REAL;
- r : UNRESOLVED_ufixed) -- fixed point input
- return BOOLEAN is
- begin
- return (to_ufixed (l, r'high, r'low) = r);
- end function "=";
-
- function "/=" (
- l : REAL;
- r : UNRESOLVED_ufixed) -- fixed point input
- return BOOLEAN is
- begin
- return (to_ufixed (l, r'high, r'low) /= r);
- end function "/=";
-
- function ">=" (
- l : REAL;
- r : UNRESOLVED_ufixed) -- fixed point input
- return BOOLEAN is
- begin
- return (to_ufixed (l, r'high, r'low) >= r);
- end function ">=";
-
- function "<=" (
- l : REAL;
- r : UNRESOLVED_ufixed) -- fixed point input
- return BOOLEAN is
- begin
- return (to_ufixed (l, r'high, r'low) <= r);
- end function "<=";
-
- function ">" (
- l : REAL;
- r : UNRESOLVED_ufixed) -- fixed point input
- return BOOLEAN is
- begin
- return (to_ufixed (l, r'high, r'low) > r);
- end function ">";
-
- function "<" (
- l : REAL;
- r : UNRESOLVED_ufixed) -- fixed point input
- return BOOLEAN is
- begin
- return (to_ufixed (l, r'high, r'low) < r);
- end function "<";
-
- function \?=\ (
- l : REAL;
- r : UNRESOLVED_ufixed) -- fixed point input
- return STD_ULOGIC is
- begin
- return \?=\ (to_ufixed (l, r'high, r'low), r);
- end function \?=\;
-
- function \?/=\ (
- l : REAL;
- r : UNRESOLVED_ufixed) -- fixed point input
- return STD_ULOGIC is
- begin
- return \?/=\ (to_ufixed (l, r'high, r'low), r);
- end function \?/=\;
-
- function \?>=\ (
- l : REAL;
- r : UNRESOLVED_ufixed) -- fixed point input
- return STD_ULOGIC is
- begin
- return \?>=\ (to_ufixed (l, r'high, r'low), r);
- end function \?>=\;
-
- function \?<=\ (
- l : REAL;
- r : UNRESOLVED_ufixed) -- fixed point input
- return STD_ULOGIC is
- begin
- return \?<=\ (to_ufixed (l, r'high, r'low), r);
- end function \?<=\;
-
- function \?>\ (
- l : REAL;
- r : UNRESOLVED_ufixed) -- fixed point input
- return STD_ULOGIC is
- begin
- return \?>\ (to_ufixed (l, r'high, r'low), r);
- end function \?>\;
-
- function \?<\ (
- l : REAL;
- r : UNRESOLVED_ufixed) -- fixed point input
- return STD_ULOGIC is
- begin
- return \?<\ (to_ufixed (l, r'high, r'low), r);
- end function \?<\;
-
- function maximum (
- l : REAL;
- r : UNRESOLVED_ufixed) -- fixed point input
- return UNRESOLVED_ufixed is
- begin
- return maximum (to_ufixed (l, r'high, r'low), r);
- end function maximum;
-
- function minimum (
- l : REAL;
- r : UNRESOLVED_ufixed) -- fixed point input
- return UNRESOLVED_ufixed is
- begin
- return minimum (to_ufixed (l, r'high, r'low), r);
- end function minimum;
-
- -- overloaded sfixed compare functions with integer
- function "=" (
- l : UNRESOLVED_sfixed;
- r : INTEGER)
- return BOOLEAN is
- begin
- return (l = to_sfixed (r, l'high, l'low));
- end function "=";
-
- function "/=" (
- l : UNRESOLVED_sfixed;
- r : INTEGER)
- return BOOLEAN is
- begin
- return (l /= to_sfixed (r, l'high, l'low));
- end function "/=";
-
- function ">=" (
- l : UNRESOLVED_sfixed;
- r : INTEGER)
- return BOOLEAN is
- begin
- return (l >= to_sfixed (r, l'high, l'low));
- end function ">=";
-
- function "<=" (
- l : UNRESOLVED_sfixed;
- r : INTEGER)
- return BOOLEAN is
- begin
- return (l <= to_sfixed (r, l'high, l'low));
- end function "<=";
-
- function ">" (
- l : UNRESOLVED_sfixed;
- r : INTEGER)
- return BOOLEAN is
- begin
- return (l > to_sfixed (r, l'high, l'low));
- end function ">";
-
- function "<" (
- l : UNRESOLVED_sfixed;
- r : INTEGER)
- return BOOLEAN is
- begin
- return (l < to_sfixed (r, l'high, l'low));
- end function "<";
-
- function \?=\ (
- l : UNRESOLVED_sfixed;
- r : INTEGER)
- return STD_ULOGIC is
- begin
- return \?=\ (l, to_sfixed (r, l'high, l'low));
- end function \?=\;
-
- function \?/=\ (
- l : UNRESOLVED_sfixed;
- r : INTEGER)
- return STD_ULOGIC is
- begin
- return \?/=\ (l, to_sfixed (r, l'high, l'low));
- end function \?/=\;
-
- function \?>=\ (
- l : UNRESOLVED_sfixed;
- r : INTEGER)
- return STD_ULOGIC is
- begin
- return \?>=\ (l, to_sfixed (r, l'high, l'low));
- end function \?>=\;
-
- function \?<=\ (
- l : UNRESOLVED_sfixed;
- r : INTEGER)
- return STD_ULOGIC is
- begin
- return \?<=\ (l, to_sfixed (r, l'high, l'low));
- end function \?<=\;
-
- function \?>\ (
- l : UNRESOLVED_sfixed;
- r : INTEGER)
- return STD_ULOGIC is
- begin
- return \?>\ (l, to_sfixed (r, l'high, l'low));
- end function \?>\;
-
- function \?<\ (
- l : UNRESOLVED_sfixed;
- r : INTEGER)
- return STD_ULOGIC is
- begin
- return \?<\ (l, to_sfixed (r, l'high, l'low));
- end function \?<\;
-
- function maximum (
- l : UNRESOLVED_sfixed;
- r : INTEGER)
- return UNRESOLVED_sfixed is
- begin
- return maximum (l, to_sfixed (r, l'high, l'low));
- end function maximum;
-
- function minimum (
- l : UNRESOLVED_sfixed;
- r : INTEGER)
- return UNRESOLVED_sfixed is
- begin
- return minimum (l, to_sfixed (r, l'high, l'low));
- end function minimum;
-
- -- integer and sfixed
- function "=" (
- l : INTEGER;
- r : UNRESOLVED_sfixed) -- fixed point input
- return BOOLEAN is
- begin
- return (to_sfixed (l, r'high, r'low) = r);
- end function "=";
-
- function "/=" (
- l : INTEGER;
- r : UNRESOLVED_sfixed) -- fixed point input
- return BOOLEAN is
- begin
- return (to_sfixed (l, r'high, r'low) /= r);
- end function "/=";
-
- function ">=" (
- l : INTEGER;
- r : UNRESOLVED_sfixed) -- fixed point input
- return BOOLEAN is
- begin
- return (to_sfixed (l, r'high, r'low) >= r);
- end function ">=";
-
- function "<=" (
- l : INTEGER;
- r : UNRESOLVED_sfixed) -- fixed point input
- return BOOLEAN is
- begin
- return (to_sfixed (l, r'high, r'low) <= r);
- end function "<=";
-
- function ">" (
- l : INTEGER;
- r : UNRESOLVED_sfixed) -- fixed point input
- return BOOLEAN is
- begin
- return (to_sfixed (l, r'high, r'low) > r);
- end function ">";
-
- function "<" (
- l : INTEGER;
- r : UNRESOLVED_sfixed) -- fixed point input
- return BOOLEAN is
- begin
- return (to_sfixed (l, r'high, r'low) < r);
- end function "<";
-
- function \?=\ (
- l : INTEGER;
- r : UNRESOLVED_sfixed) -- fixed point input
- return STD_ULOGIC is
- begin
- return \?=\ (to_sfixed (l, r'high, r'low), r);
- end function \?=\;
-
- function \?/=\ (
- l : INTEGER;
- r : UNRESOLVED_sfixed) -- fixed point input
- return STD_ULOGIC is
- begin
- return \?/=\ (to_sfixed (l, r'high, r'low), r);
- end function \?/=\;
-
- function \?>=\ (
- l : INTEGER;
- r : UNRESOLVED_sfixed) -- fixed point input
- return STD_ULOGIC is
- begin
- return \?>=\ (to_sfixed (l, r'high, r'low), r);
- end function \?>=\;
-
- function \?<=\ (
- l : INTEGER;
- r : UNRESOLVED_sfixed) -- fixed point input
- return STD_ULOGIC is
- begin
- return \?<=\ (to_sfixed (l, r'high, r'low), r);
- end function \?<=\;
-
- function \?>\ (
- l : INTEGER;
- r : UNRESOLVED_sfixed) -- fixed point input
- return STD_ULOGIC is
- begin
- return \?>\ (to_sfixed (l, r'high, r'low), r);
- end function \?>\;
-
- function \?<\ (
- l : INTEGER;
- r : UNRESOLVED_sfixed) -- fixed point input
- return STD_ULOGIC is
- begin
- return \?<\ (to_sfixed (l, r'high, r'low), r);
- end function \?<\;
-
- function maximum (
- l : INTEGER;
- r : UNRESOLVED_sfixed)
- return UNRESOLVED_sfixed is
- begin
- return maximum (to_sfixed (l, r'high, r'low), r);
- end function maximum;
-
- function minimum (
- l : INTEGER;
- r : UNRESOLVED_sfixed)
- return UNRESOLVED_sfixed is
- begin
- return minimum (to_sfixed (l, r'high, r'low), r);
- end function minimum;
-
- -- overloaded sfixed compare functions with real
- function "=" (
- l : UNRESOLVED_sfixed;
- r : REAL)
- return BOOLEAN is
- begin
- return (l = to_sfixed (r, l'high, l'low));
- end function "=";
-
- function "/=" (
- l : UNRESOLVED_sfixed;
- r : REAL)
- return BOOLEAN is
- begin
- return (l /= to_sfixed (r, l'high, l'low));
- end function "/=";
-
- function ">=" (
- l : UNRESOLVED_sfixed;
- r : REAL)
- return BOOLEAN is
- begin
- return (l >= to_sfixed (r, l'high, l'low));
- end function ">=";
-
- function "<=" (
- l : UNRESOLVED_sfixed;
- r : REAL)
- return BOOLEAN is
- begin
- return (l <= to_sfixed (r, l'high, l'low));
- end function "<=";
-
- function ">" (
- l : UNRESOLVED_sfixed;
- r : REAL)
- return BOOLEAN is
- begin
- return (l > to_sfixed (r, l'high, l'low));
- end function ">";
-
- function "<" (
- l : UNRESOLVED_sfixed;
- r : REAL)
- return BOOLEAN is
- begin
- return (l < to_sfixed (r, l'high, l'low));
- end function "<";
-
- function \?=\ (
- l : UNRESOLVED_sfixed;
- r : REAL)
- return STD_ULOGIC is
- begin
- return \?=\ (l, to_sfixed (r, l'high, l'low));
- end function \?=\;
-
- function \?/=\ (
- l : UNRESOLVED_sfixed;
- r : REAL)
- return STD_ULOGIC is
- begin
- return \?/=\ (l, to_sfixed (r, l'high, l'low));
- end function \?/=\;
-
- function \?>=\ (
- l : UNRESOLVED_sfixed;
- r : REAL)
- return STD_ULOGIC is
- begin
- return \?>=\ (l, to_sfixed (r, l'high, l'low));
- end function \?>=\;
-
- function \?<=\ (
- l : UNRESOLVED_sfixed;
- r : REAL)
- return STD_ULOGIC is
- begin
- return \?<=\ (l, to_sfixed (r, l'high, l'low));
- end function \?<=\;
-
- function \?>\ (
- l : UNRESOLVED_sfixed;
- r : REAL)
- return STD_ULOGIC is
- begin
- return \?>\ (l, to_sfixed (r, l'high, l'low));
- end function \?>\;
-
- function \?<\ (
- l : UNRESOLVED_sfixed;
- r : REAL)
- return STD_ULOGIC is
- begin
- return \?<\ (l, to_sfixed (r, l'high, l'low));
- end function \?<\;
-
- function maximum (
- l : UNRESOLVED_sfixed;
- r : REAL)
- return UNRESOLVED_sfixed is
- begin
- return maximum (l, to_sfixed (r, l'high, l'low));
- end function maximum;
-
- function minimum (
- l : UNRESOLVED_sfixed;
- r : REAL)
- return UNRESOLVED_sfixed is
- begin
- return minimum (l, to_sfixed (r, l'high, l'low));
- end function minimum;
-
- -- REAL and sfixed
- function "=" (
- l : REAL;
- r : UNRESOLVED_sfixed) -- fixed point input
- return BOOLEAN is
- begin
- return (to_sfixed (l, r'high, r'low) = r);
- end function "=";
-
- function "/=" (
- l : REAL;
- r : UNRESOLVED_sfixed) -- fixed point input
- return BOOLEAN is
- begin
- return (to_sfixed (l, r'high, r'low) /= r);
- end function "/=";
-
- function ">=" (
- l : REAL;
- r : UNRESOLVED_sfixed) -- fixed point input
- return BOOLEAN is
- begin
- return (to_sfixed (l, r'high, r'low) >= r);
- end function ">=";
-
- function "<=" (
- l : REAL;
- r : UNRESOLVED_sfixed) -- fixed point input
- return BOOLEAN is
- begin
- return (to_sfixed (l, r'high, r'low) <= r);
- end function "<=";
-
- function ">" (
- l : REAL;
- r : UNRESOLVED_sfixed) -- fixed point input
- return BOOLEAN is
- begin
- return (to_sfixed (l, r'high, r'low) > r);
- end function ">";
-
- function "<" (
- l : REAL;
- r : UNRESOLVED_sfixed) -- fixed point input
- return BOOLEAN is
- begin
- return (to_sfixed (l, r'high, r'low) < r);
- end function "<";
-
- function \?=\ (
- l : REAL;
- r : UNRESOLVED_sfixed) -- fixed point input
- return STD_ULOGIC is
- begin
- return \?=\ (to_sfixed (l, r'high, r'low), r);
- end function \?=\;
-
- function \?/=\ (
- l : REAL;
- r : UNRESOLVED_sfixed) -- fixed point input
- return STD_ULOGIC is
- begin
- return \?/=\ (to_sfixed (l, r'high, r'low), r);
- end function \?/=\;
-
- function \?>=\ (
- l : REAL;
- r : UNRESOLVED_sfixed) -- fixed point input
- return STD_ULOGIC is
- begin
- return \?>=\ (to_sfixed (l, r'high, r'low), r);
- end function \?>=\;
-
- function \?<=\ (
- l : REAL;
- r : UNRESOLVED_sfixed) -- fixed point input
- return STD_ULOGIC is
- begin
- return \?<=\ (to_sfixed (l, r'high, r'low), r);
- end function \?<=\;
-
- function \?>\ (
- l : REAL;
- r : UNRESOLVED_sfixed) -- fixed point input
- return STD_ULOGIC is
- begin
- return \?>\ (to_sfixed (l, r'high, r'low), r);
- end function \?>\;
-
- function \?<\ (
- l : REAL;
- r : UNRESOLVED_sfixed) -- fixed point input
- return STD_ULOGIC is
- begin
- return \?<\ (to_sfixed (l, r'high, r'low), r);
- end function \?<\;
-
- function maximum (
- l : REAL;
- r : UNRESOLVED_sfixed)
- return UNRESOLVED_sfixed is
- begin
- return maximum (to_sfixed (l, r'high, r'low), r);
- end function maximum;
-
- function minimum (
- l : REAL;
- r : UNRESOLVED_sfixed)
- return UNRESOLVED_sfixed is
- begin
- return minimum (to_sfixed (l, r'high, r'low), r);
- end function minimum;
--- rtl_synthesis off
--- pragma synthesis_off
- -- copied from std_logic_textio
- type MVL9plus is ('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-', error);
- type char_indexed_by_MVL9 is array (STD_ULOGIC) of CHARACTER;
- type MVL9_indexed_by_char is array (CHARACTER) of STD_ULOGIC;
- type MVL9plus_indexed_by_char is array (CHARACTER) of MVL9plus;
-
- constant MVL9_to_char : char_indexed_by_MVL9 := "UX01ZWLH-";
- constant char_to_MVL9 : MVL9_indexed_by_char :=
- ('U' => 'U', 'X' => 'X', '0' => '0', '1' => '1', 'Z' => 'Z',
- 'W' => 'W', 'L' => 'L', 'H' => 'H', '-' => '-', others => 'U');
- constant char_to_MVL9plus : MVL9plus_indexed_by_char :=
- ('U' => 'U', 'X' => 'X', '0' => '0', '1' => '1', 'Z' => 'Z',
- 'W' => 'W', 'L' => 'L', 'H' => 'H', '-' => '-', others => error);
- constant NBSP : CHARACTER := CHARACTER'val(160); -- space character
- constant NUS : STRING(2 to 1) := (others => ' ');
-
- -- %%% Replicated Textio functions
- procedure Char2TriBits (C : CHARACTER;
- RESULT : out STD_ULOGIC_VECTOR(2 downto 0);
- GOOD : out BOOLEAN;
- ISSUE_ERROR : in BOOLEAN) is
- begin
- case c is
- when '0' => result := o"0"; good := true;
- when '1' => result := o"1"; good := true;
- when '2' => result := o"2"; good := true;
- when '3' => result := o"3"; good := true;
- when '4' => result := o"4"; good := true;
- when '5' => result := o"5"; good := true;
- when '6' => result := o"6"; good := true;
- when '7' => result := o"7"; good := true;
- when 'Z' => result := "ZZZ"; good := true;
- when 'X' => result := "XXX"; good := true;
- when others =>
- assert not ISSUE_ERROR
- report "fixed_pkg:"
- & "OREAD Error: Read a '" & c &
- "', expected an Octal character (0-7)."
- severity error;
- result := "UUU";
- good := false;
- end case;
- end procedure Char2TriBits;
- -- Hex Read and Write procedures for STD_ULOGIC_VECTOR.
- -- Modified from the original to be more forgiving.
-
- procedure Char2QuadBits (C : CHARACTER;
- RESULT : out STD_ULOGIC_VECTOR(3 downto 0);
- GOOD : out BOOLEAN;
- ISSUE_ERROR : in BOOLEAN) is
- begin
- case c is
- when '0' => result := x"0"; good := true;
- when '1' => result := x"1"; good := true;
- when '2' => result := x"2"; good := true;
- when '3' => result := x"3"; good := true;
- when '4' => result := x"4"; good := true;
- when '5' => result := x"5"; good := true;
- when '6' => result := x"6"; good := true;
- when '7' => result := x"7"; good := true;
- when '8' => result := x"8"; good := true;
- when '9' => result := x"9"; good := true;
- when 'A' | 'a' => result := x"A"; good := true;
- when 'B' | 'b' => result := x"B"; good := true;
- when 'C' | 'c' => result := x"C"; good := true;
- when 'D' | 'd' => result := x"D"; good := true;
- when 'E' | 'e' => result := x"E"; good := true;
- when 'F' | 'f' => result := x"F"; good := true;
- when 'Z' => result := "ZZZZ"; good := true;
- when 'X' => result := "XXXX"; good := true;
- when others =>
- assert not ISSUE_ERROR
- report "fixed_pkg:"
- & "HREAD Error: Read a '" & c &
- "', expected a Hex character (0-F)."
- severity error;
- result := "UUUU";
- good := false;
- end case;
- end procedure Char2QuadBits;
-
- -- purpose: Skips white space
- procedure skip_whitespace (
- L : inout LINE) is
- variable readOk : BOOLEAN;
- variable c : CHARACTER;
- begin
- while L /= null and L.all'length /= 0 loop
- if (L.all(1) = ' ' or L.all(1) = NBSP or L.all(1) = HT) then
- read (l, c, readOk);
- else
- exit;
- end if;
- end loop;
- end procedure skip_whitespace;
-
- function to_ostring (value : STD_ULOGIC_VECTOR) return STRING is
- constant ne : INTEGER := (value'length+2)/3;
- variable pad : STD_ULOGIC_VECTOR(0 to (ne*3 - value'length) - 1);
- variable ivalue : STD_ULOGIC_VECTOR(0 to ne*3 - 1);
- variable result : STRING(1 to ne);
- variable tri : STD_ULOGIC_VECTOR(0 to 2);
- begin
- if value'length < 1 then
- return NUS;
- else
- if value (value'left) = 'Z' then
- pad := (others => 'Z');
- else
- pad := (others => '0');
- end if;
- ivalue := pad & value;
- for i in 0 to ne-1 loop
- tri := To_X01Z(ivalue(3*i to 3*i+2));
- case tri is
- when o"0" => result(i+1) := '0';
- when o"1" => result(i+1) := '1';
- when o"2" => result(i+1) := '2';
- when o"3" => result(i+1) := '3';
- when o"4" => result(i+1) := '4';
- when o"5" => result(i+1) := '5';
- when o"6" => result(i+1) := '6';
- when o"7" => result(i+1) := '7';
- when "ZZZ" => result(i+1) := 'Z';
- when others => result(i+1) := 'X';
- end case;
- end loop;
- return result;
- end if;
- end function to_ostring;
- -------------------------------------------------------------------
- function to_hstring (value : STD_ULOGIC_VECTOR) return STRING is
- constant ne : INTEGER := (value'length+3)/4;
- variable pad : STD_ULOGIC_VECTOR(0 to (ne*4 - value'length) - 1);
- variable ivalue : STD_ULOGIC_VECTOR(0 to ne*4 - 1);
- variable result : STRING(1 to ne);
- variable quad : STD_ULOGIC_VECTOR(0 to 3);
- begin
- if value'length < 1 then
- return NUS;
- else
- if value (value'left) = 'Z' then
- pad := (others => 'Z');
- else
- pad := (others => '0');
- end if;
- ivalue := pad & value;
- for i in 0 to ne-1 loop
- quad := To_X01Z(ivalue(4*i to 4*i+3));
- case quad is
- when x"0" => result(i+1) := '0';
- when x"1" => result(i+1) := '1';
- when x"2" => result(i+1) := '2';
- when x"3" => result(i+1) := '3';
- when x"4" => result(i+1) := '4';
- when x"5" => result(i+1) := '5';
- when x"6" => result(i+1) := '6';
- when x"7" => result(i+1) := '7';
- when x"8" => result(i+1) := '8';
- when x"9" => result(i+1) := '9';
- when x"A" => result(i+1) := 'A';
- when x"B" => result(i+1) := 'B';
- when x"C" => result(i+1) := 'C';
- when x"D" => result(i+1) := 'D';
- when x"E" => result(i+1) := 'E';
- when x"F" => result(i+1) := 'F';
- when "ZZZZ" => result(i+1) := 'Z';
- when others => result(i+1) := 'X';
- end case;
- end loop;
- return result;
- end if;
- end function to_hstring;
-
-
--- %%% END replicated textio functions
-
- -- purpose: writes fixed point into a line
- procedure write (
- L : inout LINE; -- input line
- VALUE : in UNRESOLVED_ufixed; -- fixed point input
- JUSTIFIED : in SIDE := right;
- FIELD : in WIDTH := 0) is
- variable s : STRING(1 to value'length +1) := (others => ' ');
- variable sindx : INTEGER;
- begin -- function write Example: 0011.1100
- sindx := 1;
- for i in value'high downto value'low loop
- if i = -1 then
- s(sindx) := '.';
- sindx := sindx + 1;
- end if;
- s(sindx) := MVL9_to_char(STD_ULOGIC(value(i)));
- sindx := sindx + 1;
- end loop;
- write(l, s, justified, field);
- end procedure write;
-
- -- purpose: writes fixed point into a line
- procedure write (
- L : inout LINE; -- input line
- VALUE : in UNRESOLVED_sfixed; -- fixed point input
- JUSTIFIED : in SIDE := right;
- FIELD : in WIDTH := 0) is
- variable s : STRING(1 to value'length +1);
- variable sindx : INTEGER;
- begin -- function write Example: 0011.1100
- sindx := 1;
- for i in value'high downto value'low loop
- if i = -1 then
- s(sindx) := '.';
- sindx := sindx + 1;
- end if;
- s(sindx) := MVL9_to_char(STD_ULOGIC(value(i)));
- sindx := sindx + 1;
- end loop;
- write(l, s, justified, field);
- end procedure write;
-
- procedure READ(L : inout LINE;
- VALUE : out UNRESOLVED_ufixed) is
- -- Possible data: 00000.0000000
- -- 000000000000
- variable c : CHARACTER;
- variable readOk : BOOLEAN;
- variable i : INTEGER; -- index variable
- variable mv : ufixed (VALUE'range);
- variable lastu : BOOLEAN := false; -- last character was an "_"
- variable founddot : BOOLEAN := false; -- found a "."
- begin -- READ
- VALUE := (VALUE'range => 'U');
- Skip_whitespace (L);
- if VALUE'length > 0 then -- non Null input string
- read (l, c, readOk);
- i := value'high;
- while i >= VALUE'low loop
- if readOk = false then -- Bail out if there was a bad read
- report "fixed_pkg:" & "READ(ufixed) "
- & "End of string encountered"
- severity error;
- return;
- elsif c = '_' then
- if i = value'high then
- report "fixed_pkg:" & "READ(ufixed) "
- & "String begins with an ""_""" severity error;
- return;
- elsif lastu then
- report "fixed_pkg:" & "READ(ufixed) "
- & "Two underscores detected in input string ""__"""
- severity error;
- return;
- else
- lastu := true;
- end if;
- elsif c = '.' then -- binary point
- if founddot then
- report "fixed_pkg:" & "READ(ufixed) "
- & "Two binary points found in input string" severity error;
- return;
- elsif i /= -1 then -- Seperator in the wrong spot
- report "fixed_pkg:" & "READ(ufixed) "
- & "Decimal point does not match number format "
- severity error;
- return;
- end if;
- founddot := true;
- lastu := false;
- elsif c = ' ' or c = NBSP or c = HT then -- reading done.
- report "fixed_pkg:" & "READ(ufixed) "
- & "Short read, Space encounted in input string"
- severity error;
- return;
- elsif char_to_MVL9plus(c) = error then
- report "fixed_pkg:" & "READ(ufixed) "
- & "Character '" &
- c & "' read, expected STD_ULOGIC literal."
- severity error;
- return;
- else
- mv(i) := char_to_MVL9(c);
- i := i - 1;
- if i < mv'low then
- VALUE := mv;
- return;
- end if;
- lastu := false;
- end if;
- read(L, c, readOk);
- end loop;
- end if;
- end procedure READ;
-
- procedure READ(L : inout LINE;
- VALUE : out UNRESOLVED_ufixed;
- GOOD : out BOOLEAN) is
- -- Possible data: 00000.0000000
- -- 000000000000
- variable c : CHARACTER;
- variable readOk : BOOLEAN;
- variable mv : ufixed (VALUE'range);
- variable i : INTEGER; -- index variable
- variable lastu : BOOLEAN := false; -- last character was an "_"
- variable founddot : BOOLEAN := false; -- found a "."
- begin -- READ
- VALUE := (VALUE'range => 'U');
- Skip_whitespace (L);
- if VALUE'length > 0 then
- read (l, c, readOk);
- i := value'high;
- GOOD := false;
- while i >= VALUE'low loop
- if not readOk then -- Bail out if there was a bad read
- return;
- elsif c = '_' then
- if i = value'high then -- Begins with an "_"
- return;
- elsif lastu then -- "__" detected
- return;
- else
- lastu := true;
- end if;
- elsif c = '.' then -- binary point
- if founddot then
- return;
- elsif i /= -1 then -- Seperator in the wrong spot
- return;
- end if;
- founddot := true;
- lastu := false;
- elsif (char_to_MVL9plus(c) = error) then -- Illegal character/short read
- return;
- else
- mv(i) := char_to_MVL9(c);
- i := i - 1;
- if i < mv'low then -- reading done
- GOOD := true;
- VALUE := mv;
- return;
- end if;
- lastu := false;
- end if;
- read(L, c, readOk);
- end loop;
- else
- GOOD := true; -- read into a null array
- end if;
- end procedure READ;
-
- procedure READ(L : inout LINE;
- VALUE : out UNRESOLVED_sfixed) is
- variable c : CHARACTER;
- variable readOk : BOOLEAN;
- variable i : INTEGER; -- index variable
- variable mv : sfixed (VALUE'range);
- variable lastu : BOOLEAN := false; -- last character was an "_"
- variable founddot : BOOLEAN := false; -- found a "."
- begin -- READ
- VALUE := (VALUE'range => 'U');
- Skip_whitespace (L);
- if VALUE'length > 0 then -- non Null input string
- read (l, c, readOk);
- i := value'high;
- while i >= VALUE'low loop
- if readOk = false then -- Bail out if there was a bad read
- report "fixed_pkg:" & "READ(sfixed) "
- & "End of string encountered"
- severity error;
- return;
- elsif c = '_' then
- if i = value'high then
- report "fixed_pkg:" & "READ(sfixed) "
- & "String begins with an ""_""" severity error;
- return;
- elsif lastu then
- report "fixed_pkg:" & "READ(sfixed) "
- & "Two underscores detected in input string ""__"""
- severity error;
- return;
- else
- lastu := true;
- end if;
- elsif c = '.' then -- binary point
- if founddot then
- report "fixed_pkg:" & "READ(sfixed) "
- & "Two binary points found in input string" severity error;
- return;
- elsif i /= -1 then -- Seperator in the wrong spot
- report "fixed_pkg:" & "READ(sfixed) "
- & "Decimal point does not match number format "
- severity error;
- return;
- end if;
- founddot := true;
- lastu := false;
- elsif c = ' ' or c = NBSP or c = HT then -- reading done.
- report "fixed_pkg:" & "READ(sfixed) "
- & "Short read, Space encounted in input string"
- severity error;
- return;
- elsif char_to_MVL9plus(c) = error then
- report "fixed_pkg:" & "READ(sfixed) "
- & "Character '" &
- c & "' read, expected STD_ULOGIC literal."
- severity error;
- return;
- else
- mv(i) := char_to_MVL9(c);
- i := i - 1;
- if i < mv'low then
- VALUE := mv;
- return;
- end if;
- lastu := false;
- end if;
- read(L, c, readOk);
- end loop;
- end if;
- end procedure READ;
-
- procedure READ(L : inout LINE;
- VALUE : out UNRESOLVED_sfixed;
- GOOD : out BOOLEAN) is
- variable value_ufixed : UNRESOLVED_ufixed (VALUE'range);
- begin -- READ
- READ (L => L, VALUE => value_ufixed, GOOD => GOOD);
- VALUE := UNRESOLVED_sfixed (value_ufixed);
- end procedure READ;
-
- -- octal read and write
- procedure owrite (
- L : inout LINE; -- input line
- VALUE : in UNRESOLVED_ufixed; -- fixed point input
- JUSTIFIED : in SIDE := right;
- FIELD : in WIDTH := 0) is
- begin -- Example 03.30
- write (L => L,
- VALUE => to_ostring (VALUE),
- JUSTIFIED => JUSTIFIED,
- FIELD => FIELD);
- end procedure owrite;
-
- procedure owrite (
- L : inout LINE; -- input line
- VALUE : in UNRESOLVED_sfixed; -- fixed point input
- JUSTIFIED : in SIDE := right;
- FIELD : in WIDTH := 0) is
- begin -- Example 03.30
- write (L => L,
- VALUE => to_ostring (VALUE),
- JUSTIFIED => JUSTIFIED,
- FIELD => FIELD);
- end procedure owrite;
-
- -- purpose: Routines common to the OREAD routines
- procedure OREAD_common (
- L : inout LINE;
- slv : out STD_ULOGIC_VECTOR;
- igood : out BOOLEAN;
- idex : out INTEGER;
- constant bpoint : in INTEGER; -- binary point
- constant message : in BOOLEAN;
- constant smath : in BOOLEAN) is
-
- -- purpose: error message routine
- procedure errmes (
- constant mess : in STRING) is -- error message
- begin
- if message then
- if smath then
- report "fixed_pkg:"
- & "OREAD(sfixed) "
- & mess
- severity error;
- else
- report "fixed_pkg:"
- & "OREAD(ufixed) "
- & mess
- severity error;
- end if;
- end if;
- end procedure errmes;
- variable xgood : BOOLEAN;
- variable nybble : STD_ULOGIC_VECTOR (2 downto 0); -- 3 bits
- variable c : CHARACTER;
- variable i : INTEGER;
- variable lastu : BOOLEAN := false; -- last character was an "_"
- variable founddot : BOOLEAN := false; -- found a dot.
- begin
- Skip_whitespace (L);
- if slv'length > 0 then
- i := slv'high;
- read (l, c, xgood);
- while i > 0 loop
- if xgood = false then
- errmes ("Error: end of string encountered");
- exit;
- elsif c = '_' then
- if i = slv'length then
- errmes ("Error: String begins with an ""_""");
- xgood := false;
- exit;
- elsif lastu then
- errmes ("Error: Two underscores detected in input string ""__""");
- xgood := false;
- exit;
- else
- lastu := true;
- end if;
- elsif (c = '.') then
- if (i + 1 /= bpoint) then
- errmes ("encountered ""."" at wrong index");
- xgood := false;
- exit;
- elsif i = slv'length then
- errmes ("encounted a ""."" at the beginning of the line");
- xgood := false;
- exit;
- elsif founddot then
- errmes ("Two ""."" encounted in input string");
- xgood := false;
- exit;
- end if;
- founddot := true;
- lastu := false;
- else
- Char2triBits(c, nybble, xgood, message);
- if not xgood then
- exit;
- end if;
- slv (i downto i-2) := nybble;
- i := i - 3;
- lastu := false;
- end if;
- if i > 0 then
- read (L, c, xgood);
- end if;
- end loop;
- idex := i;
- igood := xgood;
- else
- igood := true; -- read into a null array
- idex := -1;
- end if;
- end procedure OREAD_common;
-
- -- Note that for Octal and Hex read, you can not start with a ".",
- -- the read is for numbers formatted "A.BC". These routines go to
- -- the nearest bounds, so "F.E" will fit into an sfixed (2 downto -3).
- procedure OREAD (L : inout LINE;
- VALUE : out UNRESOLVED_ufixed) is
- constant hbv : INTEGER := (((maximum(3, (VALUE'high+1))+2)/3)*3)-1;
- constant lbv : INTEGER := ((mine(0, VALUE'low)-2)/3)*3;
- variable slv : STD_ULOGIC_VECTOR (hbv-lbv downto 0); -- high bits
- variable valuex : UNRESOLVED_ufixed (hbv downto lbv);
- variable igood : BOOLEAN;
- variable i : INTEGER;
- begin
- VALUE := (VALUE'range => 'U');
- OREAD_common ( L => L,
- slv => slv,
- igood => igood,
- idex => i,
- bpoint => -lbv,
- message => true,
- smath => false);
- if igood then -- We did not get another error
- if not ((i = -1) and -- We read everything, and high bits 0
- (or_reduce (slv(hbv-lbv downto VALUE'high+1-lbv)) = '0')) then
- report "fixed_pkg:"
- & "OREAD(ufixed): Vector truncated."
- severity error;
- else
- if (or_reduce (slv(VALUE'low-lbv-1 downto 0)) = '1') then
- assert NO_WARNING
- report "fixed_pkg:"
- & "OREAD(ufixed): Vector truncated"
- severity warning;
- end if;
- valuex := to_ufixed (slv, hbv, lbv);
- VALUE := valuex (VALUE'range);
- end if;
- end if;
- end procedure OREAD;
-
- procedure OREAD(L : inout LINE;
- VALUE : out UNRESOLVED_ufixed;
- GOOD : out BOOLEAN) is
- constant hbv : INTEGER := (((maximum(3, (VALUE'high+1))+2)/3)*3)-1;
- constant lbv : INTEGER := ((mine(0, VALUE'low)-2)/3)*3;
- variable slv : STD_ULOGIC_VECTOR (hbv-lbv downto 0); -- high bits
- variable valuex : UNRESOLVED_ufixed (hbv downto lbv);
- variable igood : BOOLEAN;
- variable i : INTEGER;
- begin
- VALUE := (VALUE'range => 'U');
- OREAD_common ( L => L,
- slv => slv,
- igood => igood,
- idex => i,
- bpoint => -lbv,
- message => false,
- smath => false);
- if (igood and -- We did not get another error
- (i = -1) and -- We read everything, and high bits 0
- (or_reduce (slv(hbv-lbv downto VALUE'high+1-lbv)) = '0')) then
- valuex := to_ufixed (slv, hbv, lbv);
- VALUE := valuex (VALUE'range);
- good := true;
- else
- good := false;
- end if;
- end procedure OREAD;
-
- procedure OREAD(L : inout LINE;
- VALUE : out UNRESOLVED_sfixed) is
- constant hbv : INTEGER := (((maximum(3, (VALUE'high+1))+2)/3)*3)-1;
- constant lbv : INTEGER := ((mine(0, VALUE'low)-2)/3)*3;
- variable slv : STD_ULOGIC_VECTOR (hbv-lbv downto 0); -- high bits
- variable valuex : UNRESOLVED_sfixed (hbv downto lbv);
- variable igood : BOOLEAN;
- variable i : INTEGER;
- begin
- VALUE := (VALUE'range => 'U');
- OREAD_common ( L => L,
- slv => slv,
- igood => igood,
- idex => i,
- bpoint => -lbv,
- message => true,
- smath => true);
- if igood then -- We did not get another error
- if not ((i = -1) and -- We read everything
- ((slv(VALUE'high-lbv) = '0' and -- sign bits = extra bits
- or_reduce (slv(hbv-lbv downto VALUE'high+1-lbv)) = '0') or
- (slv(VALUE'high-lbv) = '1' and
- and_reduce (slv(hbv-lbv downto VALUE'high+1-lbv)) = '1'))) then
- report "fixed_pkg:"
- & "OREAD(sfixed): Vector truncated."
- severity error;
- else
- if (or_reduce (slv(VALUE'low-lbv-1 downto 0)) = '1') then
- assert NO_WARNING
- report "fixed_pkg:"
- & "OREAD(sfixed): Vector truncated"
- severity warning;
- end if;
- valuex := to_sfixed (slv, hbv, lbv);
- VALUE := valuex (VALUE'range);
- end if;
- end if;
- end procedure OREAD;
-
- procedure OREAD(L : inout LINE;
- VALUE : out UNRESOLVED_sfixed;
- GOOD : out BOOLEAN) is
- constant hbv : INTEGER := (((maximum(3, (VALUE'high+1))+2)/3)*3)-1;
- constant lbv : INTEGER := ((mine(0, VALUE'low)-2)/3)*3;
- variable slv : STD_ULOGIC_VECTOR (hbv-lbv downto 0); -- high bits
- variable valuex : UNRESOLVED_sfixed (hbv downto lbv);
- variable igood : BOOLEAN;
- variable i : INTEGER;
- begin
- VALUE := (VALUE'range => 'U');
- OREAD_common ( L => L,
- slv => slv,
- igood => igood,
- idex => i,
- bpoint => -lbv,
- message => false,
- smath => true);
- if (igood -- We did not get another error
- and (i = -1) -- We read everything
- and ((slv(VALUE'high-lbv) = '0' and -- sign bits = extra bits
- or_reduce (slv(hbv-lbv downto VALUE'high+1-lbv)) = '0') or
- (slv(VALUE'high-lbv) = '1' and
- and_reduce (slv(hbv-lbv downto VALUE'high+1-lbv)) = '1'))) then
- valuex := to_sfixed (slv, hbv, lbv);
- VALUE := valuex (VALUE'range);
- good := true;
- else
- good := false;
- end if;
- end procedure OREAD;
-
- -- hex read and write
- procedure hwrite (
- L : inout LINE; -- input line
- VALUE : in UNRESOLVED_ufixed; -- fixed point input
- JUSTIFIED : in SIDE := right;
- FIELD : in WIDTH := 0) is
- begin -- Example 03.30
- write (L => L,
- VALUE => to_hstring (VALUE),
- JUSTIFIED => JUSTIFIED,
- FIELD => FIELD);
- end procedure hwrite;
-
- -- purpose: writes fixed point into a line
- procedure hwrite (
- L : inout LINE; -- input line
- VALUE : in UNRESOLVED_sfixed; -- fixed point input
- JUSTIFIED : in SIDE := right;
- FIELD : in WIDTH := 0) is
- begin -- Example 03.30
- write (L => L,
- VALUE => to_hstring (VALUE),
- JUSTIFIED => JUSTIFIED,
- FIELD => FIELD);
- end procedure hwrite;
-
- -- purpose: Routines common to the OREAD routines
- procedure HREAD_common (
- L : inout LINE;
- slv : out STD_ULOGIC_VECTOR;
- igood : out BOOLEAN;
- idex : out INTEGER;
- constant bpoint : in INTEGER; -- binary point
- constant message : in BOOLEAN;
- constant smath : in BOOLEAN) is
-
- -- purpose: error message routine
- procedure errmes (
- constant mess : in STRING) is -- error message
- begin
- if message then
- if smath then
- report "fixed_pkg:"
- & "HREAD(sfixed) "
- & mess
- severity error;
- else
- report "fixed_pkg:"
- & "HREAD(ufixed) "
- & mess
- severity error;
- end if;
- end if;
- end procedure errmes;
- variable xgood : BOOLEAN;
- variable nybble : STD_ULOGIC_VECTOR (3 downto 0); -- 4 bits
- variable c : CHARACTER;
- variable i : INTEGER;
- variable lastu : BOOLEAN := false; -- last character was an "_"
- variable founddot : BOOLEAN := false; -- found a dot.
- begin
- Skip_whitespace (L);
- if slv'length > 0 then
- i := slv'high;
- read (l, c, xgood);
- while i > 0 loop
- if xgood = false then
- errmes ("Error: end of string encountered");
- exit;
- elsif c = '_' then
- if i = slv'length then
- errmes ("Error: String begins with an ""_""");
- xgood := false;
- exit;
- elsif lastu then
- errmes ("Error: Two underscores detected in input string ""__""");
- xgood := false;
- exit;
- else
- lastu := true;
- end if;
- elsif (c = '.') then
- if (i + 1 /= bpoint) then
- errmes ("encountered ""."" at wrong index");
- xgood := false;
- exit;
- elsif i = slv'length then
- errmes ("encounted a ""."" at the beginning of the line");
- xgood := false;
- exit;
- elsif founddot then
- errmes ("Two ""."" encounted in input string");
- xgood := false;
- exit;
- end if;
- founddot := true;
- lastu := false;
- else
- Char2QuadBits(c, nybble, xgood, message);
- if not xgood then
- exit;
- end if;
- slv (i downto i-3) := nybble;
- i := i - 4;
- lastu := false;
- end if;
- if i > 0 then
- read (L, c, xgood);
- end if;
- end loop;
- idex := i;
- igood := xgood;
- else
- idex := -1;
- igood := true; -- read null string
- end if;
- end procedure HREAD_common;
-
- procedure HREAD(L : inout LINE;
- VALUE : out UNRESOLVED_ufixed) is
- constant hbv : INTEGER := (((maximum(4, (VALUE'high+1))+3)/4)*4)-1;
- constant lbv : INTEGER := ((mine(0, VALUE'low)-3)/4)*4;
- variable slv : STD_ULOGIC_VECTOR (hbv-lbv downto 0); -- high bits
- variable valuex : UNRESOLVED_ufixed (hbv downto lbv);
- variable igood : BOOLEAN;
- variable i : INTEGER;
- begin
- VALUE := (VALUE'range => 'U');
- HREAD_common ( L => L,
- slv => slv,
- igood => igood,
- idex => i,
- bpoint => -lbv,
- message => false,
- smath => false);
- if igood then
- if not ((i = -1) and -- We read everything, and high bits 0
- (or_reduce (slv(hbv-lbv downto VALUE'high+1-lbv)) = '0')) then
- report "fixed_pkg:"
- & "HREAD(ufixed): Vector truncated."
- severity error;
- else
- if (or_reduce (slv(VALUE'low-lbv-1 downto 0)) = '1') then
- assert NO_WARNING
- report "fixed_pkg:"
- & "HREAD(ufixed): Vector truncated"
- severity warning;
- end if;
- valuex := to_ufixed (slv, hbv, lbv);
- VALUE := valuex (VALUE'range);
- end if;
- end if;
- end procedure HREAD;
-
- procedure HREAD(L : inout LINE;
- VALUE : out UNRESOLVED_ufixed;
- GOOD : out BOOLEAN) is
- constant hbv : INTEGER := (((maximum(4, (VALUE'high+1))+3)/4)*4)-1;
- constant lbv : INTEGER := ((mine(0, VALUE'low)-3)/4)*4;
- variable slv : STD_ULOGIC_VECTOR (hbv-lbv downto 0); -- high bits
- variable valuex : UNRESOLVED_ufixed (hbv downto lbv);
- variable igood : BOOLEAN;
- variable i : INTEGER;
- begin
- VALUE := (VALUE'range => 'U');
- HREAD_common ( L => L,
- slv => slv,
- igood => igood,
- idex => i,
- bpoint => -lbv,
- message => false,
- smath => false);
- if (igood and -- We did not get another error
- (i = -1) and -- We read everything, and high bits 0
- (or_reduce (slv(hbv-lbv downto VALUE'high+1-lbv)) = '0')) then
- valuex := to_ufixed (slv, hbv, lbv);
- VALUE := valuex (VALUE'range);
- good := true;
- else
- good := false;
- end if;
- end procedure HREAD;
-
- procedure HREAD(L : inout LINE;
- VALUE : out UNRESOLVED_sfixed) is
- constant hbv : INTEGER := (((maximum(4, (VALUE'high+1))+3)/4)*4)-1;
- constant lbv : INTEGER := ((mine(0, VALUE'low)-3)/4)*4;
- variable slv : STD_ULOGIC_VECTOR (hbv-lbv downto 0); -- high bits
- variable valuex : UNRESOLVED_sfixed (hbv downto lbv);
- variable igood : BOOLEAN;
- variable i : INTEGER;
- begin
- VALUE := (VALUE'range => 'U');
- HREAD_common ( L => L,
- slv => slv,
- igood => igood,
- idex => i,
- bpoint => -lbv,
- message => true,
- smath => true);
- if igood then -- We did not get another error
- if not ((i = -1) -- We read everything
- and ((slv(VALUE'high-lbv) = '0' and -- sign bits = extra bits
- or_reduce (slv(hbv-lbv downto VALUE'high+1-lbv)) = '0') or
- (slv(VALUE'high-lbv) = '1' and
- and_reduce (slv(hbv-lbv downto VALUE'high+1-lbv)) = '1'))) then
- report "fixed_pkg:"
- & "HREAD(sfixed): Vector truncated."
- severity error;
- else
- if (or_reduce (slv(VALUE'low-lbv-1 downto 0)) = '1') then
- assert NO_WARNING
- report "fixed_pkg:"
- & "HREAD(sfixed): Vector truncated"
- severity warning;
- end if;
- valuex := to_sfixed (slv, hbv, lbv);
- VALUE := valuex (VALUE'range);
- end if;
- end if;
- end procedure HREAD;
-
- procedure HREAD(L : inout LINE;
- VALUE : out UNRESOLVED_sfixed;
- GOOD : out BOOLEAN) is
- constant hbv : INTEGER := (((maximum(4, (VALUE'high+1))+3)/4)*4)-1;
- constant lbv : INTEGER := ((mine(0, VALUE'low)-3)/4)*4;
- variable slv : STD_ULOGIC_VECTOR (hbv-lbv downto 0); -- high bits
- variable valuex : UNRESOLVED_sfixed (hbv downto lbv);
- variable igood : BOOLEAN;
- variable i : INTEGER;
- begin
- VALUE := (VALUE'range => 'U');
- HREAD_common ( L => L,
- slv => slv,
- igood => igood,
- idex => i,
- bpoint => -lbv,
- message => false,
- smath => true);
- if (igood and -- We did not get another error
- (i = -1) and -- We read everything
- ((slv(VALUE'high-lbv) = '0' and -- sign bits = extra bits
- or_reduce (slv(hbv-lbv downto VALUE'high+1-lbv)) = '0') or
- (slv(VALUE'high-lbv) = '1' and
- and_reduce (slv(hbv-lbv downto VALUE'high+1-lbv)) = '1'))) then
- valuex := to_sfixed (slv, hbv, lbv);
- VALUE := valuex (VALUE'range);
- good := true;
- else
- good := false;
- end if;
- end procedure HREAD;
-
- function to_string (value : UNRESOLVED_ufixed) return STRING is
- variable s : STRING(1 to value'length +1) := (others => ' ');
- variable subval : UNRESOLVED_ufixed (value'high downto -1);
- variable sindx : INTEGER;
- begin
- if value'length < 1 then
- return NUS;
- else
- if value'high < 0 then
- if value(value'high) = 'Z' then
- return to_string (resize (sfixed(value), 0, value'low));
- else
- return to_string (resize (value, 0, value'low));
- end if;
- elsif value'low >= 0 then
- if Is_X (value(value'low)) then
- subval := (others => value(value'low));
- subval (value'range) := value;
- return to_string(subval);
- else
- return to_string (resize (value, value'high, -1));
- end if;
- else
- sindx := 1;
- for i in value'high downto value'low loop
- if i = -1 then
- s(sindx) := '.';
- sindx := sindx + 1;
- end if;
- s(sindx) := MVL9_to_char(STD_ULOGIC(value(i)));
- sindx := sindx + 1;
- end loop;
- return s;
- end if;
- end if;
- end function to_string;
-
- function to_string (value : UNRESOLVED_sfixed) return STRING is
- variable s : STRING(1 to value'length + 1) := (others => ' ');
- variable subval : UNRESOLVED_sfixed (value'high downto -1);
- variable sindx : INTEGER;
- begin
- if value'length < 1 then
- return NUS;
- else
- if value'high < 0 then
- return to_string (resize (value, 0, value'low));
- elsif value'low >= 0 then
- if Is_X (value(value'low)) then
- subval := (others => value(value'low));
- subval (value'range) := value;
- return to_string(subval);
- else
- return to_string (resize (value, value'high, -1));
- end if;
- else
- sindx := 1;
- for i in value'high downto value'low loop
- if i = -1 then
- s(sindx) := '.';
- sindx := sindx + 1;
- end if;
- s(sindx) := MVL9_to_char(STD_ULOGIC(value(i)));
- sindx := sindx + 1;
- end loop;
- return s;
- end if;
- end if;
- end function to_string;
-
- function to_ostring (value : UNRESOLVED_ufixed) return STRING is
- constant lne : INTEGER := (-VALUE'low+2)/3;
- variable subval : UNRESOLVED_ufixed (value'high downto -3);
- variable lpad : STD_ULOGIC_VECTOR (0 to (lne*3 + VALUE'low) -1);
- variable slv : STD_ULOGIC_VECTOR (value'length-1 downto 0);
- begin
- if value'length < 1 then
- return NUS;
- else
- if value'high < 0 then
- if value(value'high) = 'Z' then
- return to_ostring (resize (sfixed(value), 2, value'low));
- else
- return to_ostring (resize (value, 2, value'low));
- end if;
- elsif value'low >= 0 then
- if Is_X (value(value'low)) then
- subval := (others => value(value'low));
- subval (value'range) := value;
- return to_ostring(subval);
- else
- return to_ostring (resize (value, value'high, -3));
- end if;
- else
- slv := to_sulv (value);
- if Is_X (value (value'low)) then
- lpad := (others => value (value'low));
- else
- lpad := (others => '0');
- end if;
- return to_ostring(slv(slv'high downto slv'high-VALUE'high))
- & "."
- & to_ostring(slv(slv'high-VALUE'high-1 downto 0) & lpad);
- end if;
- end if;
- end function to_ostring;
-
- function to_hstring (value : UNRESOLVED_ufixed) return STRING is
- constant lne : INTEGER := (-VALUE'low+3)/4;
- variable subval : UNRESOLVED_ufixed (value'high downto -4);
- variable lpad : STD_ULOGIC_VECTOR (0 to (lne*4 + VALUE'low) -1);
- variable slv : STD_ULOGIC_VECTOR (value'length-1 downto 0);
- begin
- if value'length < 1 then
- return NUS;
- else
- if value'high < 0 then
- if value(value'high) = 'Z' then
- return to_hstring (resize (sfixed(value), 3, value'low));
- else
- return to_hstring (resize (value, 3, value'low));
- end if;
- elsif value'low >= 0 then
- if Is_X (value(value'low)) then
- subval := (others => value(value'low));
- subval (value'range) := value;
- return to_hstring(subval);
- else
- return to_hstring (resize (value, value'high, -4));
- end if;
- else
- slv := to_sulv (value);
- if Is_X (value (value'low)) then
- lpad := (others => value(value'low));
- else
- lpad := (others => '0');
- end if;
- return to_hstring(slv(slv'high downto slv'high-VALUE'high))
- & "."
- & to_hstring(slv(slv'high-VALUE'high-1 downto 0)&lpad);
- end if;
- end if;
- end function to_hstring;
-
- function to_ostring (value : UNRESOLVED_sfixed) return STRING is
- constant ne : INTEGER := ((value'high+1)+2)/3;
- variable pad : STD_ULOGIC_VECTOR(0 to (ne*3 - (value'high+1)) - 1);
- constant lne : INTEGER := (-VALUE'low+2)/3;
- variable subval : UNRESOLVED_sfixed (value'high downto -3);
- variable lpad : STD_ULOGIC_VECTOR (0 to (lne*3 + VALUE'low) -1);
- variable slv : STD_ULOGIC_VECTOR (VALUE'high - VALUE'low downto 0);
- begin
- if value'length < 1 then
- return NUS;
- else
- if value'high < 0 then
- return to_ostring (resize (value, 2, value'low));
- elsif value'low >= 0 then
- if Is_X (value(value'low)) then
- subval := (others => value(value'low));
- subval (value'range) := value;
- return to_ostring(subval);
- else
- return to_ostring (resize (value, value'high, -3));
- end if;
- else
- pad := (others => value(value'high));
- slv := to_sulv (value);
- if Is_X (value (value'low)) then
- lpad := (others => value(value'low));
- else
- lpad := (others => '0');
- end if;
- return to_ostring(pad & slv(slv'high downto slv'high-VALUE'high))
- & "."
- & to_ostring(slv(slv'high-VALUE'high-1 downto 0) & lpad);
- end if;
- end if;
- end function to_ostring;
-
- function to_hstring (value : UNRESOLVED_sfixed) return STRING is
- constant ne : INTEGER := ((value'high+1)+3)/4;
- variable pad : STD_ULOGIC_VECTOR(0 to (ne*4 - (value'high+1)) - 1);
- constant lne : INTEGER := (-VALUE'low+3)/4;
- variable subval : UNRESOLVED_sfixed (value'high downto -4);
- variable lpad : STD_ULOGIC_VECTOR (0 to (lne*4 + VALUE'low) -1);
- variable slv : STD_ULOGIC_VECTOR (value'length-1 downto 0);
- begin
- if value'length < 1 then
- return NUS;
- else
- if value'high < 0 then
- return to_hstring (resize (value, 3, value'low));
- elsif value'low >= 0 then
- if Is_X (value(value'low)) then
- subval := (others => value(value'low));
- subval (value'range) := value;
- return to_hstring(subval);
- else
- return to_hstring (resize (value, value'high, -4));
- end if;
- else
- slv := to_sulv (value);
- pad := (others => value(value'high));
- if Is_X (value (value'low)) then
- lpad := (others => value(value'low));
- else
- lpad := (others => '0');
- end if;
- return to_hstring(pad & slv(slv'high downto slv'high-VALUE'high))
- & "."
- & to_hstring(slv(slv'high-VALUE'high-1 downto 0) & lpad);
- end if;
- end if;
- end function to_hstring;
-
- -- From string functions allow you to convert a string into a fixed
- -- point number. Example:
- -- signal uf1 : ufixed (3 downto -3);
- -- uf1 <= from_string ("0110.100", uf1'high, uf1'low); -- 6.5
- -- The "." is optional in this syntax, however it exist and is
- -- in the wrong location an error is produced. Overflow will
- -- result in saturation.
-
- function from_string (
- bstring : STRING; -- binary string
- constant left_index : INTEGER;
- constant right_index : INTEGER)
- return UNRESOLVED_ufixed is
- variable result : UNRESOLVED_ufixed (left_index downto right_index);
- variable L : LINE;
- variable good : BOOLEAN;
- begin
- L := new STRING'(bstring);
- read (L, result, good);
- deallocate (L);
- assert (good)
- report "fixed_pkg:"
- & "from_string: Bad string "& bstring severity error;
- return result;
- end function from_string;
-
- -- Octal and hex conversions work as follows:
- -- uf1 <= from_hstring ("6.8", 3, -3); -- 6.5 (bottom zeros dropped)
- -- uf1 <= from_ostring ("06.4", 3, -3); -- 6.5 (top zeros dropped)
- function from_ostring (
- ostring : STRING; -- Octal string
- constant left_index : INTEGER;
- constant right_index : INTEGER)
- return UNRESOLVED_ufixed is
- variable result : UNRESOLVED_ufixed (left_index downto right_index);
- variable L : LINE;
- variable good : BOOLEAN;
- begin
- L := new STRING'(ostring);
- oread (L, result, good);
- deallocate (L);
- assert (good)
- report "fixed_pkg:"
- & "from_ostring: Bad string "& ostring severity error;
- return result;
- end function from_ostring;
-
- function from_hstring (
- hstring : STRING; -- hex string
- constant left_index : INTEGER;
- constant right_index : INTEGER)
- return UNRESOLVED_ufixed is
- variable result : UNRESOLVED_ufixed (left_index downto right_index);
- variable L : LINE;
- variable good : BOOLEAN;
- begin
- L := new STRING'(hstring);
- hread (L, result, good);
- deallocate (L);
- assert (good)
- report "fixed_pkg:"
- & "from_hstring: Bad string "& hstring severity error;
- return result;
- end function from_hstring;
-
- function from_string (
- bstring : STRING; -- binary string
- constant left_index : INTEGER;
- constant right_index : INTEGER)
- return UNRESOLVED_sfixed is
- variable result : UNRESOLVED_sfixed (left_index downto right_index);
- variable L : LINE;
- variable good : BOOLEAN;
- begin
- L := new STRING'(bstring);
- read (L, result, good);
- deallocate (L);
- assert (good)
- report "fixed_pkg:"
- & "from_string: Bad string "& bstring severity error;
- return result;
- end function from_string;
-
- function from_ostring (
- ostring : STRING; -- Octal string
- constant left_index : INTEGER;
- constant right_index : INTEGER)
- return UNRESOLVED_sfixed is
- variable result : UNRESOLVED_sfixed (left_index downto right_index);
- variable L : LINE;
- variable good : BOOLEAN;
- begin
- L := new STRING'(ostring);
- oread (L, result, good);
- deallocate (L);
- assert (good)
- report "fixed_pkg:"
- & "from_ostring: Bad string "& ostring severity error;
- return result;
- end function from_ostring;
-
- function from_hstring (
- hstring : STRING; -- hex string
- constant left_index : INTEGER;
- constant right_index : INTEGER)
- return UNRESOLVED_sfixed is
- variable result : UNRESOLVED_sfixed (left_index downto right_index);
- variable L : LINE;
- variable good : BOOLEAN;
- begin
- L := new STRING'(hstring);
- hread (L, result, good);
- deallocate (L);
- assert (good)
- report "fixed_pkg:"
- & "from_hstring: Bad string "& hstring severity error;
- return result;
- end function from_hstring;
-
- -- Same as above, "size_res" is used for it's range only.
- function from_string (
- bstring : STRING; -- binary string
- size_res : UNRESOLVED_ufixed)
- return UNRESOLVED_ufixed is
- begin
- return from_string (bstring, size_res'high, size_res'low);
- end function from_string;
-
- function from_ostring (
- ostring : STRING; -- Octal string
- size_res : UNRESOLVED_ufixed)
- return UNRESOLVED_ufixed is
- begin
- return from_ostring (ostring, size_res'high, size_res'low);
- end function from_ostring;
-
- function from_hstring (
- hstring : STRING; -- hex string
- size_res : UNRESOLVED_ufixed)
- return UNRESOLVED_ufixed is
- begin
- return from_hstring(hstring, size_res'high, size_res'low);
- end function from_hstring;
-
- function from_string (
- bstring : STRING; -- binary string
- size_res : UNRESOLVED_sfixed)
- return UNRESOLVED_sfixed is
- begin
- return from_string (bstring, size_res'high, size_res'low);
- end function from_string;
-
- function from_ostring (
- ostring : STRING; -- Octal string
- size_res : UNRESOLVED_sfixed)
- return UNRESOLVED_sfixed is
- begin
- return from_ostring (ostring, size_res'high, size_res'low);
- end function from_ostring;
-
- function from_hstring (
- hstring : STRING; -- hex string
- size_res : UNRESOLVED_sfixed)
- return UNRESOLVED_sfixed is
- begin
- return from_hstring (hstring, size_res'high, size_res'low);
- end function from_hstring;
-
- -- purpose: Calculate the string boundaries
- procedure calculate_string_boundry (
- arg : in STRING; -- input string
- left_index : out INTEGER; -- left
- right_index : out INTEGER) is -- right
- -- examples "10001.111" would return +4, -3
- -- "07X.44" would return +2, -2 (then the octal routine would multiply)
- -- "A_B_._C" would return +1, -1 (then the hex routine would multiply)
- alias xarg : STRING (arg'length downto 1) is arg; -- make it downto range
- variable l, r : INTEGER; -- internal indexes
- variable founddot : BOOLEAN := false;
- begin
- if arg'length > 0 then
- l := xarg'high - 1;
- r := 0;
- for i in xarg'range loop
- if xarg(i) = '_' then
- if r = 0 then
- l := l - 1;
- else
- r := r + 1;
- end if;
- elsif xarg(i) = ' ' or xarg(i) = NBSP or xarg(i) = HT then
- report "fixed_pkg:"
- & "Found a space in the input STRING " & xarg
- severity error;
- elsif xarg(i) = '.' then
- if founddot then
- report "fixed_pkg:"
- & "Found two binary points in input string " & xarg
- severity error;
- else
- l := l - i;
- r := -i + 1;
- founddot := true;
- end if;
- end if;
- end loop;
- left_index := l;
- right_index := r;
- else
- left_index := 0;
- right_index := 0;
- end if;
- end procedure calculate_string_boundry;
-
- -- Direct conversion functions. Example:
- -- signal uf1 : ufixed (3 downto -3);
- -- uf1 <= from_string ("0110.100"); -- 6.5
- -- In this case the "." is not optional, and the size of
- -- the output must match exactly.
- function from_string (
- bstring : STRING) -- binary string
- return UNRESOLVED_ufixed is
- variable left_index, right_index : INTEGER;
- begin
- calculate_string_boundry (bstring, left_index, right_index);
- return from_string (bstring, left_index, right_index);
- end function from_string;
-
- -- Direct octal and hex conversion functions. In this case
- -- the string lengths must match. Example:
- -- signal sf1 := sfixed (5 downto -3);
- -- sf1 <= from_ostring ("71.4") -- -6.5
- function from_ostring (
- ostring : STRING) -- Octal string
- return UNRESOLVED_ufixed is
- variable left_index, right_index : INTEGER;
- begin
- calculate_string_boundry (ostring, left_index, right_index);
- return from_ostring (ostring, ((left_index+1)*3)-1, right_index*3);
- end function from_ostring;
-
- function from_hstring (
- hstring : STRING) -- hex string
- return UNRESOLVED_ufixed is
- variable left_index, right_index : INTEGER;
- begin
- calculate_string_boundry (hstring, left_index, right_index);
- return from_hstring (hstring, ((left_index+1)*4)-1, right_index*4);
- end function from_hstring;
-
- function from_string (
- bstring : STRING) -- binary string
- return UNRESOLVED_sfixed is
- variable left_index, right_index : INTEGER;
- begin
- calculate_string_boundry (bstring, left_index, right_index);
- return from_string (bstring, left_index, right_index);
- end function from_string;
-
- function from_ostring (
- ostring : STRING) -- Octal string
- return UNRESOLVED_sfixed is
- variable left_index, right_index : INTEGER;
- begin
- calculate_string_boundry (ostring, left_index, right_index);
- return from_ostring (ostring, ((left_index+1)*3)-1, right_index*3);
- end function from_ostring;
-
- function from_hstring (
- hstring : STRING) -- hex string
- return UNRESOLVED_sfixed is
- variable left_index, right_index : INTEGER;
- begin
- calculate_string_boundry (hstring, left_index, right_index);
- return from_hstring (hstring, ((left_index+1)*4)-1, right_index*4);
- end function from_hstring;
--- pragma synthesis_on
--- rtl_synthesis on
- -- IN VHDL-2006 std_logic_vector is a subtype of std_ulogic_vector, so these
- -- extra functions are needed for compatability.
- function to_ufixed (
- arg : STD_LOGIC_VECTOR; -- shifted vector
- constant left_index : INTEGER;
- constant right_index : INTEGER)
- return UNRESOLVED_ufixed is
- begin
- return to_ufixed (
- arg => std_ulogic_vector (arg),
- left_index => left_index,
- right_index => right_index);
- end function to_ufixed;
-
- function to_ufixed (
- arg : STD_LOGIC_VECTOR; -- shifted vector
- size_res : UNRESOLVED_ufixed) -- for size only
- return UNRESOLVED_ufixed is
- begin
- return to_ufixed (
- arg => std_ulogic_vector (arg),
- size_res => size_res);
- end function to_ufixed;
-
- function to_sfixed (
- arg : STD_LOGIC_VECTOR; -- shifted vector
- constant left_index : INTEGER;
- constant right_index : INTEGER)
- return UNRESOLVED_sfixed is
- begin
- return to_sfixed (
- arg => std_ulogic_vector (arg),
- left_index => left_index,
- right_index => right_index);
- end function to_sfixed;
-
- function to_sfixed (
- arg : STD_LOGIC_VECTOR; -- shifted vector
- size_res : UNRESOLVED_sfixed) -- for size only
- return UNRESOLVED_sfixed is
- begin
- return to_sfixed (
- arg => std_ulogic_vector (arg),
- size_res => size_res);
- end function to_sfixed;
-
- -- unsigned fixed point
- function to_UFix (
- arg : STD_LOGIC_VECTOR;
- width : NATURAL; -- width of vector
- fraction : NATURAL) -- width of fraction
- return UNRESOLVED_ufixed is
- begin
- return to_UFix (
- arg => std_ulogic_vector (arg),
- width => width,
- fraction => fraction);
- end function to_UFix;
-
- -- signed fixed point
- function to_SFix (
- arg : STD_LOGIC_VECTOR;
- width : NATURAL; -- width of vector
- fraction : NATURAL) -- width of fraction
- return UNRESOLVED_sfixed is
- begin
- return to_SFix (
- arg => std_ulogic_vector (arg),
- width => width,
- fraction => fraction);
- end function to_SFix;
-
-end package body fixed_pkg;
diff --git a/ieee_proposed/rtl/float_pkg_c.vhd b/ieee_proposed/rtl/float_pkg_c.vhd
deleted file mode 100644
index 8abbff6..0000000
--- a/ieee_proposed/rtl/float_pkg_c.vhd
+++ /dev/null
@@ -1,7190 +0,0 @@
--- --------------------------------------------------------------------
--- "float_pkg" package contains functions for floating point math.
--- Please see the documentation for the floating point package.
--- This package should be compiled into "ieee_proposed" and used as follows:
--- use ieee.std_logic_1164.all;
--- use ieee.numeric_std.all;
--- use ieee_proposed.fixed_float_types.all;
--- use ieee_proposed.fixed_pkg.all;
--- use ieee_proposed.float_pkg.all;
---
--- This verison is designed to work with the VHDL-93 compilers. Please
--- note the "%%%" comments. These are where we diverge from the
--- VHDL-200X LRM.
---
--- --------------------------------------------------------------------
--- Version : $Revision: 2.0 $
--- Date : $Date: 2009/01/27 20:45:30 $
--- --------------------------------------------------------------------
-
-use STD.TEXTIO.all;
-library IEEE;
-use IEEE.STD_LOGIC_1164.all;
-use IEEE.NUMERIC_STD.all;
-library ieee_proposed;
-use ieee_proposed.fixed_float_types.all;
-use ieee_proposed.fixed_pkg.all;
-
-package float_pkg is
--- generic (
- -- Defaults for sizing routines, when you do a "to_float" this will be
- -- the default size. Example float32 would be 8 and 23 (8 downto -23)
- constant float_exponent_width : NATURAL := 8;
- constant float_fraction_width : NATURAL := 23;
- -- Rounding algorithm, "round_nearest" is default, other valid values
- -- are "round_zero" (truncation), "round_inf" (round up), and
- -- "round_neginf" (round down)
- constant float_round_style : round_type := round_nearest;
- -- Denormal numbers (very small numbers near zero) true or false
- constant float_denormalize : BOOLEAN := true;
- -- Turns on NAN processing (invalid numbers and overflow) true of false
- constant float_check_error : BOOLEAN := true;
- -- Guard bits are added to the bottom of every operation for rounding.
- -- any natural number (including 0) are valid.
- constant float_guard_bits : NATURAL := 3;
- -- If TRUE, then turn off warnings on "X" propagation
- constant no_warning : BOOLEAN := (false
- );
-
- -- Author David Bishop (dbishop@vhdl.org)
-
- -- Note that the size of the vector is not defined here, but in
- -- the package which calls this one.
- type UNRESOLVED_float is array (INTEGER range <>) of STD_ULOGIC; -- main type
- subtype U_float is UNRESOLVED_float;
-
- subtype float is UNRESOLVED_float;
- -----------------------------------------------------------------------------
- -- Use the float type to define your own floating point numbers.
- -- There must be a negative index or the packages will error out.
- -- Minimum supported is "subtype float7 is float (3 downto -3);"
- -- "subtype float16 is float (6 downto -9);" is probably the smallest
- -- practical one to use.
- -----------------------------------------------------------------------------
-
- -- IEEE 754 single precision
- subtype UNRESOLVED_float32 is UNRESOLVED_float (8 downto -23);
--- alias U_float32 is UNRESOLVED_float32;
- subtype float32 is float (8 downto -23);
- -----------------------------------------------------------------------------
- -- IEEE-754 single precision floating point. This is a "float"
- -- in C, and a FLOAT in Fortran. The exponent is 8 bits wide, and
- -- the fraction is 23 bits wide. This format can hold roughly 7 decimal
- -- digits. Infinity is 2**127 = 1.7E38 in this number system.
- -- The bit representation is as follows:
- -- 1 09876543 21098765432109876543210
- -- 8 76543210 12345678901234567890123
- -- 0 00000000 00000000000000000000000
- -- 8 7 0 -1 -23
- -- +/- exp. fraction
- -----------------------------------------------------------------------------
-
- -- IEEE 754 double precision
- subtype UNRESOLVED_float64 is UNRESOLVED_float (11 downto -52);
--- alias U_float64 is UNRESOLVED_float64;
- subtype float64 is float (11 downto -52);
- -----------------------------------------------------------------------------
- -- IEEE-754 double precision floating point. This is a "double float"
- -- in C, and a FLOAT*8 in Fortran. The exponent is 11 bits wide, and
- -- the fraction is 52 bits wide. This format can hold roughly 15 decimal
- -- digits. Infinity is 2**2047 in this number system.
- -- The bit representation is as follows:
- -- 3 21098765432 1098765432109876543210987654321098765432109876543210
- -- 1 09876543210 1234567890123456789012345678901234567890123456789012
- -- S EEEEEEEEEEE FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
- -- 11 10 0 -1 -52
- -- +/- exponent fraction
- -----------------------------------------------------------------------------
-
- -- IEEE 854 & C extended precision
- subtype UNRESOLVED_float128 is UNRESOLVED_float (15 downto -112);
--- alias U_float128 is UNRESOLVED_float128;
- subtype float128 is float (15 downto -112);
- -----------------------------------------------------------------------------
- -- The 128 bit floating point number is "long double" in C (on
- -- some systems this is a 70 bit floating point number) and FLOAT*32
- -- in Fortran. The exponent is 15 bits wide and the fraction is 112
- -- bits wide. This number can handle approximately 33 decimal digits.
- -- Infinity is 2**32,767 in this number system.
- -----------------------------------------------------------------------------
-
- -- purpose: Checks for a valid floating point number
- type valid_fpstate is (nan, -- Signaling NaN (C FP_NAN)
- quiet_nan, -- Quiet NaN (C FP_NAN)
- neg_inf, -- Negative infinity (C FP_INFINITE)
- neg_normal, -- negative normalized nonzero
- neg_denormal, -- negative denormalized (FP_SUBNORMAL)
- neg_zero, -- -0 (C FP_ZERO)
- pos_zero, -- +0 (C FP_ZERO)
- pos_denormal, -- Positive denormalized (FP_SUBNORMAL)
- pos_normal, -- positive normalized nonzero
- pos_inf, -- positive infinity
- isx); -- at least one input is unknown
-
- -- This deferred constant will tell you if the package body is synthesizable
- -- or implemented as real numbers.
- constant fphdlsynth_or_real : BOOLEAN; -- deferred constant
-
- -- Returns the class which X falls into
- function Classfp (
- x : UNRESOLVED_float; -- floating point input
- check_error : BOOLEAN := float_check_error) -- check for errors
- return valid_fpstate;
-
- -- Arithmetic functions, these operators do not require parameters.
- function "abs" (arg : UNRESOLVED_float) return UNRESOLVED_float;
- function "-" (arg : UNRESOLVED_float) return UNRESOLVED_float;
-
- -- These allows the base math functions to use the default values
- -- of their parameters. Thus they do full IEEE floating point.
-
- function "+" (l, r : UNRESOLVED_float) return UNRESOLVED_float;
- function "-" (l, r : UNRESOLVED_float) return UNRESOLVED_float;
- function "*" (l, r : UNRESOLVED_float) return UNRESOLVED_float;
- function "/" (l, r : UNRESOLVED_float) return UNRESOLVED_float;
--- function "rem" (l, r : UNRESOLVED_float) return UNRESOLVED_float;
--- function "mod" (l, r : UNRESOLVED_float) return UNRESOLVED_float;
-
- -- Basic parameter list
- -- round_style - Selects the rounding algorithm to use
- -- guard - extra bits added to the end if the operation to add precision
- -- check_error - When "false" turns off NAN and overflow checks
- -- denormalize - When "false" turns off denormal number processing
-
- function add (
- l, r : UNRESOLVED_float; -- floating point input
- constant round_style : round_type := float_round_style; -- rounding option
- constant guard : NATURAL := float_guard_bits; -- number of guard bits
- constant check_error : BOOLEAN := float_check_error; -- check for errors
- constant denormalize : BOOLEAN := float_denormalize) -- Use IEEE extended FP
- return UNRESOLVED_float;
-
- function subtract (
- l, r : UNRESOLVED_float; -- floating point input
- constant round_style : round_type := float_round_style; -- rounding option
- constant guard : NATURAL := float_guard_bits; -- number of guard bits
- constant check_error : BOOLEAN := float_check_error; -- check for errors
- constant denormalize : BOOLEAN := float_denormalize) -- Use IEEE extended FP
- return UNRESOLVED_float;
-
- function multiply (
- l, r : UNRESOLVED_float; -- floating point input
- constant round_style : round_type := float_round_style; -- rounding option
- constant guard : NATURAL := float_guard_bits; -- number of guard bits
- constant check_error : BOOLEAN := float_check_error; -- check for errors
- constant denormalize : BOOLEAN := float_denormalize) -- Use IEEE extended FP
- return UNRESOLVED_float;
-
- function divide (
- l, r : UNRESOLVED_float; -- floating point input
- constant round_style : round_type := float_round_style; -- rounding option
- constant guard : NATURAL := float_guard_bits; -- number of guard bits
- constant check_error : BOOLEAN := float_check_error; -- check for errors
- constant denormalize : BOOLEAN := float_denormalize) -- Use IEEE extended FP
- return UNRESOLVED_float;
-
--- function remainder (
--- l, r : UNRESOLVED_float; -- floating point input
--- constant round_style : round_type := float_round_style; -- rounding option
--- constant guard : NATURAL := float_guard_bits; -- number of guard bits
--- constant check_error : BOOLEAN := float_check_error; -- check for errors
--- constant denormalize : BOOLEAN := float_denormalize) -- Use IEEE extended FP
--- return UNRESOLVED_float;
-
--- function modulo (
--- l, r : UNRESOLVED_float; -- floating point input
--- constant round_style : round_type := float_round_style; -- rounding option
--- constant guard : NATURAL := float_guard_bits; -- number of guard bits
--- constant check_error : BOOLEAN := float_check_error; -- check for errors
--- constant denormalize : BOOLEAN := float_denormalize) -- Use IEEE extended FP
--- return UNRESOLVED_float;
-
- -- reciprocal
- function reciprocal (
- arg : UNRESOLVED_float; -- floating point input
- constant round_style : round_type := float_round_style; -- rounding option
- constant guard : NATURAL := float_guard_bits; -- number of guard bits
- constant check_error : BOOLEAN := float_check_error; -- check for errors
- constant denormalize : BOOLEAN := float_denormalize) -- Use IEEE extended FP
- return UNRESOLVED_float;
-
- function dividebyp2 (
- l, r : UNRESOLVED_float; -- floating point input
- constant round_style : round_type := float_round_style; -- rounding option
- constant guard : NATURAL := float_guard_bits; -- number of guard bits
- constant check_error : BOOLEAN := float_check_error; -- check for errors
- constant denormalize : BOOLEAN := float_denormalize) -- Use IEEE extended FP
- return UNRESOLVED_float;
-
- -- Multiply accumulate result = l*r + c
- function mac (
- l, r, c : UNRESOLVED_float; -- floating point input
- constant round_style : round_type := float_round_style; -- rounding option
- constant guard : NATURAL := float_guard_bits; -- number of guard bits
- constant check_error : BOOLEAN := float_check_error; -- check for errors
- constant denormalize : BOOLEAN := float_denormalize) -- Use IEEE extended FP
- return UNRESOLVED_float;
-
- -- Square root (all 754 based implementations need this)
--- function sqrt (
--- arg : UNRESOLVED_float; -- floating point input
--- constant round_style : round_type := float_round_style;
--- constant guard : NATURAL := float_guard_bits;
--- constant check_error : BOOLEAN := float_check_error;
--- constant denormalize : BOOLEAN := float_denormalize)
--- return UNRESOLVED_float;
-
- function Is_Negative (arg : UNRESOLVED_float) return BOOLEAN;
-
- -----------------------------------------------------------------------------
- -- compare functions
- -- =, /=, >=, <=, <, >, maximum, minimum
-
- function eq ( -- equal =
- l, r : UNRESOLVED_float; -- floating point input
- constant check_error : BOOLEAN := float_check_error;
- constant denormalize : BOOLEAN := float_denormalize)
- return BOOLEAN;
-
- function ne ( -- not equal /=
- l, r : UNRESOLVED_float; -- floating point input
- constant check_error : BOOLEAN := float_check_error;
- constant denormalize : BOOLEAN := float_denormalize)
- return BOOLEAN;
-
- function lt ( -- less than <
- l, r : UNRESOLVED_float; -- floating point input
- constant check_error : BOOLEAN := float_check_error;
- constant denormalize : BOOLEAN := float_denormalize)
- return BOOLEAN;
-
- function gt ( -- greater than >
- l, r : UNRESOLVED_float; -- floating point input
- constant check_error : BOOLEAN := float_check_error;
- constant denormalize : BOOLEAN := float_denormalize)
- return BOOLEAN;
-
- function le ( -- less than or equal to <=
- l, r : UNRESOLVED_float; -- floating point input
- constant check_error : BOOLEAN := float_check_error;
- constant denormalize : BOOLEAN := float_denormalize)
- return BOOLEAN;
-
- function ge ( -- greater than or equal to >=
- l, r : UNRESOLVED_float; -- floating point input
- constant check_error : BOOLEAN := float_check_error;
- constant denormalize : BOOLEAN := float_denormalize)
- return BOOLEAN;
-
- -- Need to overload the default versions of these
- function "=" (l, r : UNRESOLVED_float) return BOOLEAN;
- function "/=" (l, r : UNRESOLVED_float) return BOOLEAN;
- function ">=" (l, r : UNRESOLVED_float) return BOOLEAN;
- function "<=" (l, r : UNRESOLVED_float) return BOOLEAN;
- function ">" (l, r : UNRESOLVED_float) return BOOLEAN;
- function "<" (l, r : UNRESOLVED_float) return BOOLEAN;
-
- function \?=\ (l, r : UNRESOLVED_float) return STD_ULOGIC;
- function \?/=\ (l, r : UNRESOLVED_float) return STD_ULOGIC;
- function \?>\ (l, r : UNRESOLVED_float) return STD_ULOGIC;
- function \?>=\ (l, r : UNRESOLVED_float) return STD_ULOGIC;
- function \?<\ (l, r : UNRESOLVED_float) return STD_ULOGIC;
- function \?<=\ (l, r : UNRESOLVED_float) return STD_ULOGIC;
-
- function std_match (l, r : UNRESOLVED_float) return BOOLEAN;
- function find_rightmost (arg : UNRESOLVED_float; y : STD_ULOGIC)
- return INTEGER;
- function find_leftmost (arg : UNRESOLVED_float; y : STD_ULOGIC)
- return INTEGER;
- function maximum (l, r : UNRESOLVED_float) return UNRESOLVED_float;
- function minimum (l, r : UNRESOLVED_float) return UNRESOLVED_float;
-
- -- conversion functions
- -- Converts one floating point number into another.
-
- function resize (
- arg : UNRESOLVED_float; -- Floating point input
- constant exponent_width : NATURAL := float_exponent_width; -- length of FP output exponent
- constant fraction_width : NATURAL := float_fraction_width; -- length of FP output fraction
- constant round_style : round_type := float_round_style; -- rounding option
- constant check_error : BOOLEAN := float_check_error;
- constant denormalize_in : BOOLEAN := float_denormalize; -- Use IEEE extended FP
- constant denormalize : BOOLEAN := float_denormalize) -- Use IEEE extended FP
- return UNRESOLVED_float;
-
- function resize (
- arg : UNRESOLVED_float; -- Floating point input
- size_res : UNRESOLVED_float;
- constant round_style : round_type := float_round_style; -- rounding option
- constant check_error : BOOLEAN := float_check_error;
- constant denormalize_in : BOOLEAN := float_denormalize; -- Use IEEE extended FP
- constant denormalize : BOOLEAN := float_denormalize) -- Use IEEE extended FP
- return UNRESOLVED_float;
-
- function to_float32 (
- arg : UNRESOLVED_float;
- constant round_style : round_type := float_round_style; -- rounding option
- constant check_error : BOOLEAN := float_check_error;
- constant denormalize_in : BOOLEAN := float_denormalize; -- Use IEEE extended FP
- constant denormalize : BOOLEAN := float_denormalize) -- Use IEEE extended FP
- return UNRESOLVED_float32;
-
- function to_float64 (
- arg : UNRESOLVED_float;
- constant round_style : round_type := float_round_style; -- rounding option
- constant check_error : BOOLEAN := float_check_error;
- constant denormalize_in : BOOLEAN := float_denormalize; -- Use IEEE extended FP
- constant denormalize : BOOLEAN := float_denormalize) -- Use IEEE extended FP
- return UNRESOLVED_float64;
-
- function to_float128 (
- arg : UNRESOLVED_float;
- constant round_style : round_type := float_round_style; -- rounding option
- constant check_error : BOOLEAN := float_check_error;
- constant denormalize_in : BOOLEAN := float_denormalize; -- Use IEEE extended FP
- constant denormalize : BOOLEAN := float_denormalize) -- Use IEEE extended FP
- return UNRESOLVED_float128;
-
- -- Converts an fp into an SLV (needed for synthesis)
- function to_slv (arg : UNRESOLVED_float) return STD_LOGIC_VECTOR;
--- alias to_StdLogicVector is to_slv [UNRESOLVED_float return STD_LOGIC_VECTOR];
--- alias to_Std_Logic_Vector is to_slv [UNRESOLVED_float return STD_LOGIC_VECTOR];
-
- -- Converts an fp into an std_ulogic_vector (sulv)
- function to_sulv (arg : UNRESOLVED_float) return STD_ULOGIC_VECTOR;
--- alias to_StdULogicVector is to_sulv [UNRESOLVED_float return STD_ULOGIC_VECTOR];
--- alias to_Std_ULogic_Vector is to_sulv [UNRESOLVED_float return STD_ULOGIC_VECTOR];
-
- -- std_ulogic_vector to float
- function to_float (
- arg : STD_ULOGIC_VECTOR;
- constant exponent_width : NATURAL := float_exponent_width; -- length of FP output exponent
- constant fraction_width : NATURAL := float_fraction_width) -- length of FP output fraction
- return UNRESOLVED_float;
-
- -- Integer to float
- function to_float (
- arg : INTEGER;
- constant exponent_width : NATURAL := float_exponent_width; -- length of FP output exponent
- constant fraction_width : NATURAL := float_fraction_width; -- length of FP output fraction
- constant round_style : round_type := float_round_style) -- rounding option
- return UNRESOLVED_float;
-
- -- real to float
- function to_float (
- arg : REAL;
- constant exponent_width : NATURAL := float_exponent_width; -- length of FP output exponent
- constant fraction_width : NATURAL := float_fraction_width; -- length of FP output fraction
- constant round_style : round_type := float_round_style; -- rounding option
- constant denormalize : BOOLEAN := float_denormalize) -- Use IEEE extended FP
- return UNRESOLVED_float;
-
- -- unsigned to float
- function to_float (
- arg : UNSIGNED;
- constant exponent_width : NATURAL := float_exponent_width; -- length of FP output exponent
- constant fraction_width : NATURAL := float_fraction_width; -- length of FP output fraction
- constant round_style : round_type := float_round_style) -- rounding option
- return UNRESOLVED_float;
-
- -- signed to float
- function to_float (
- arg : SIGNED;
- constant exponent_width : NATURAL := float_exponent_width; -- length of FP output exponent
- constant fraction_width : NATURAL := float_fraction_width; -- length of FP output fraction
- constant round_style : round_type := float_round_style) -- rounding option
- return UNRESOLVED_float;
-
- -- unsigned fixed point to float
- function to_float (
- arg : UNRESOLVED_ufixed; -- unsigned fixed point input
- constant exponent_width : NATURAL := float_exponent_width; -- width of exponent
- constant fraction_width : NATURAL := float_fraction_width; -- width of fraction
- constant round_style : round_type := float_round_style; -- rounding
- constant denormalize : BOOLEAN := float_denormalize) -- use ieee extensions
- return UNRESOLVED_float;
-
- -- signed fixed point to float
- function to_float (
- arg : UNRESOLVED_sfixed;
- constant exponent_width : NATURAL := float_exponent_width; -- length of FP output exponent
- constant fraction_width : NATURAL := float_fraction_width; -- length of FP output fraction
- constant round_style : round_type := float_round_style; -- rounding
- constant denormalize : BOOLEAN := float_denormalize) -- rounding option
- return UNRESOLVED_float;
-
- -- size_res functions
- -- Integer to float
- function to_float (
- arg : INTEGER;
- size_res : UNRESOLVED_float;
- constant round_style : round_type := float_round_style) -- rounding option
- return UNRESOLVED_float;
-
- -- real to float
- function to_float (
- arg : REAL;
- size_res : UNRESOLVED_float;
- constant round_style : round_type := float_round_style; -- rounding option
- constant denormalize : BOOLEAN := float_denormalize) -- Use IEEE extended FP
- return UNRESOLVED_float;
-
- -- unsigned to float
- function to_float (
- arg : UNSIGNED;
- size_res : UNRESOLVED_float;
- constant round_style : round_type := float_round_style) -- rounding option
- return UNRESOLVED_float;
-
- -- signed to float
- function to_float (
- arg : SIGNED;
- size_res : UNRESOLVED_float;
- constant round_style : round_type := float_round_style) -- rounding option
- return UNRESOLVED_float;
-
- -- sulv to float
- function to_float (
- arg : STD_ULOGIC_VECTOR;
- size_res : UNRESOLVED_float)
- return UNRESOLVED_float;
-
- -- unsigned fixed point to float
- function to_float (
- arg : UNRESOLVED_ufixed; -- unsigned fixed point input
- size_res : UNRESOLVED_float;
- constant round_style : round_type := float_round_style; -- rounding
- constant denormalize : BOOLEAN := float_denormalize) -- use ieee extensions
- return UNRESOLVED_float;
-
- -- signed fixed point to float
- function to_float (
- arg : UNRESOLVED_sfixed;
- size_res : UNRESOLVED_float;
- constant round_style : round_type := float_round_style; -- rounding
- constant denormalize : BOOLEAN := float_denormalize) -- rounding option
- return UNRESOLVED_float;
-
- -- float to unsigned
- function to_unsigned (
- arg : UNRESOLVED_float; -- floating point input
- constant size : NATURAL; -- length of output
- constant round_style : round_type := float_round_style; -- rounding option
- constant check_error : BOOLEAN := float_check_error) -- check for errors
- return UNSIGNED;
-
- -- float to signed
- function to_signed (
- arg : UNRESOLVED_float; -- floating point input
- constant size : NATURAL; -- length of output
- constant round_style : round_type := float_round_style; -- rounding option
- constant check_error : BOOLEAN := float_check_error) -- check for errors
- return SIGNED;
-
- -- purpose: Converts a float to unsigned fixed point
- function to_ufixed (
- arg : UNRESOLVED_float; -- fp input
- constant left_index : INTEGER; -- integer part
- constant right_index : INTEGER; -- fraction part
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style; -- saturate
- constant round_style : fixed_round_style_type := fixed_round_style; -- rounding
- constant check_error : BOOLEAN := float_check_error; -- check for errors
- constant denormalize : BOOLEAN := float_denormalize)
- return UNRESOLVED_ufixed;
-
- -- float to signed fixed point
- function to_sfixed (
- arg : UNRESOLVED_float; -- fp input
- constant left_index : INTEGER; -- integer part
- constant right_index : INTEGER; -- fraction part
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style; -- saturate
- constant round_style : fixed_round_style_type := fixed_round_style; -- rounding
- constant check_error : BOOLEAN := float_check_error; -- check for errors
- constant denormalize : BOOLEAN := float_denormalize)
- return UNRESOLVED_sfixed;
-
- -- size_res versions
- -- float to unsigned
- function to_unsigned (
- arg : UNRESOLVED_float; -- floating point input
- size_res : UNSIGNED;
- constant round_style : round_type := float_round_style; -- rounding option
- constant check_error : BOOLEAN := float_check_error) -- check for errors
- return UNSIGNED;
-
- -- float to signed
- function to_signed (
- arg : UNRESOLVED_float; -- floating point input
- size_res : SIGNED;
- constant round_style : round_type := float_round_style; -- rounding option
- constant check_error : BOOLEAN := float_check_error) -- check for errors
- return SIGNED;
-
- -- purpose: Converts a float to unsigned fixed point
- function to_ufixed (
- arg : UNRESOLVED_float; -- fp input
- size_res : UNRESOLVED_ufixed;
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style; -- saturate
- constant round_style : fixed_round_style_type := fixed_round_style; -- rounding
- constant check_error : BOOLEAN := float_check_error; -- check for errors
- constant denormalize : BOOLEAN := float_denormalize)
- return UNRESOLVED_ufixed;
-
- -- float to signed fixed point
- function to_sfixed (
- arg : UNRESOLVED_float; -- fp input
- size_res : UNRESOLVED_sfixed;
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style; -- saturate
- constant round_style : fixed_round_style_type := fixed_round_style; -- rounding
- constant check_error : BOOLEAN := float_check_error; -- check for errors
- constant denormalize : BOOLEAN := float_denormalize)
- return UNRESOLVED_sfixed;
-
- -- float to real
- function to_real (
- arg : UNRESOLVED_float; -- floating point input
- constant check_error : BOOLEAN := float_check_error; -- check for errors
- constant denormalize : BOOLEAN := float_denormalize) -- Use IEEE extended FP
- return REAL;
-
- -- float to integer
- function to_integer (
- arg : UNRESOLVED_float; -- floating point input
- constant round_style : round_type := float_round_style; -- rounding option
- constant check_error : BOOLEAN := float_check_error) -- check for errors
- return INTEGER;
-
- -- For Verilog compatability
- function realtobits (arg : REAL) return STD_ULOGIC_VECTOR;
- function bitstoreal (arg : STD_ULOGIC_VECTOR) return REAL;
-
- -- Maps metalogical values
- function to_01 (
- arg : UNRESOLVED_float; -- floating point input
- XMAP : STD_LOGIC := '0')
- return UNRESOLVED_float;
-
- function Is_X (arg : UNRESOLVED_float) return BOOLEAN;
- function to_X01 (arg : UNRESOLVED_float) return UNRESOLVED_float;
- function to_X01Z (arg : UNRESOLVED_float) return UNRESOLVED_float;
- function to_UX01 (arg : UNRESOLVED_float) return UNRESOLVED_float;
-
- -- These two procedures were copied out of the body because they proved
- -- very useful for vendor specific algorithm development
- -- Break_number converts a floating point number into it's parts
- -- Exponent is biased by -1
-
- procedure break_number (
- arg : in UNRESOLVED_float;
- denormalize : in BOOLEAN := float_denormalize;
- check_error : in BOOLEAN := float_check_error;
- fract : out UNSIGNED;
- expon : out SIGNED; -- NOTE: Add 1 to get the real exponent!
- sign : out STD_ULOGIC);
-
- procedure break_number (
- arg : in UNRESOLVED_float;
- denormalize : in BOOLEAN := float_denormalize;
- check_error : in BOOLEAN := float_check_error;
- fract : out ufixed; -- a number between 1.0 and 2.0
- expon : out SIGNED; -- NOTE: Add 1 to get the real exponent!
- sign : out STD_ULOGIC);
-
- -- Normalize takes a fraction and and exponent and converts them into
- -- a floating point number. Does the shifting and the rounding.
- -- Exponent is assumed to be biased by -1
-
- function normalize (
- fract : UNSIGNED; -- fraction, unnormalized
- expon : SIGNED; -- exponent - 1, normalized
- sign : STD_ULOGIC; -- sign bit
- sticky : STD_ULOGIC := '0'; -- Sticky bit (rounding)
- constant exponent_width : NATURAL := float_exponent_width; -- size of output exponent
- constant fraction_width : NATURAL := float_fraction_width; -- size of output fraction
- constant round_style : round_type := float_round_style; -- rounding option
- constant denormalize : BOOLEAN := float_denormalize; -- Use IEEE extended FP
- constant nguard : NATURAL := float_guard_bits) -- guard bits
- return UNRESOLVED_float;
-
- -- Exponent is assumed to be biased by -1
- function normalize (
- fract : ufixed; -- unsigned fixed point
- expon : SIGNED; -- exponent - 1, normalized
- sign : STD_ULOGIC; -- sign bit
- sticky : STD_ULOGIC := '0'; -- Sticky bit (rounding)
- constant exponent_width : NATURAL := float_exponent_width; -- size of output exponent
- constant fraction_width : NATURAL := float_fraction_width; -- size of output fraction
- constant round_style : round_type := float_round_style; -- rounding option
- constant denormalize : BOOLEAN := float_denormalize; -- Use IEEE extended FP
- constant nguard : NATURAL := float_guard_bits) -- guard bits
- return UNRESOLVED_float;
-
- function normalize (
- fract : UNSIGNED; -- unsigned
- expon : SIGNED; -- exponent - 1, normalized
- sign : STD_ULOGIC; -- sign bit
- sticky : STD_ULOGIC := '0'; -- Sticky bit (rounding)
- size_res : UNRESOLVED_float; -- used for sizing only
- constant round_style : round_type := float_round_style; -- rounding option
- constant denormalize : BOOLEAN := float_denormalize; -- Use IEEE extended FP
- constant nguard : NATURAL := float_guard_bits) -- guard bits
- return UNRESOLVED_float;
-
- -- Exponent is assumed to be biased by -1
- function normalize (
- fract : ufixed; -- unsigned fixed point
- expon : SIGNED; -- exponent - 1, normalized
- sign : STD_ULOGIC; -- sign bit
- sticky : STD_ULOGIC := '0'; -- Sticky bit (rounding)
- size_res : UNRESOLVED_float; -- used for sizing only
- constant round_style : round_type := float_round_style; -- rounding option
- constant denormalize : BOOLEAN := float_denormalize; -- Use IEEE extended FP
- constant nguard : NATURAL := float_guard_bits) -- guard bits
- return UNRESOLVED_float;
-
- -- overloaded versions
- function "+" (l : UNRESOLVED_float; r : REAL) return UNRESOLVED_float;
- function "+" (l : REAL; r : UNRESOLVED_float) return UNRESOLVED_float;
- function "+" (l : UNRESOLVED_float; r : INTEGER) return UNRESOLVED_float;
- function "+" (l : INTEGER; r : UNRESOLVED_float) return UNRESOLVED_float;
- function "-" (l : UNRESOLVED_float; r : REAL) return UNRESOLVED_float;
- function "-" (l : REAL; r : UNRESOLVED_float) return UNRESOLVED_float;
- function "-" (l : UNRESOLVED_float; r : INTEGER) return UNRESOLVED_float;
- function "-" (l : INTEGER; r : UNRESOLVED_float) return UNRESOLVED_float;
- function "*" (l : UNRESOLVED_float; r : REAL) return UNRESOLVED_float;
- function "*" (l : REAL; r : UNRESOLVED_float) return UNRESOLVED_float;
- function "*" (l : UNRESOLVED_float; r : INTEGER) return UNRESOLVED_float;
- function "*" (l : INTEGER; r : UNRESOLVED_float) return UNRESOLVED_float;
- function "/" (l : UNRESOLVED_float; r : REAL) return UNRESOLVED_float;
- function "/" (l : REAL; r : UNRESOLVED_float) return UNRESOLVED_float;
- function "/" (l : UNRESOLVED_float; r : INTEGER) return UNRESOLVED_float;
- function "/" (l : INTEGER; r : UNRESOLVED_float) return UNRESOLVED_float;
--- function "rem" (l : UNRESOLVED_float; r : REAL) return UNRESOLVED_float;
--- function "rem" (l : REAL; r : UNRESOLVED_float) return UNRESOLVED_float;
--- function "rem" (l : UNRESOLVED_float; r : INTEGER) return UNRESOLVED_float;
--- function "rem" (l : INTEGER; r : UNRESOLVED_float) return UNRESOLVED_float;
--- function "mod" (l : UNRESOLVED_float; r : REAL) return UNRESOLVED_float;
--- function "mod" (l : REAL; r : UNRESOLVED_float) return UNRESOLVED_float;
--- function "mod" (l : UNRESOLVED_float; r : INTEGER) return UNRESOLVED_float;
--- function "mod" (l : INTEGER; r : UNRESOLVED_float) return UNRESOLVED_float;
-
- -- overloaded compare functions
- function "=" (l : UNRESOLVED_float; r : REAL) return BOOLEAN;
- function "/=" (l : UNRESOLVED_float; r : REAL) return BOOLEAN;
- function ">=" (l : UNRESOLVED_float; r : REAL) return BOOLEAN;
- function "<=" (l : UNRESOLVED_float; r : REAL) return BOOLEAN;
- function ">" (l : UNRESOLVED_float; r : REAL) return BOOLEAN;
- function "<" (l : UNRESOLVED_float; r : REAL) return BOOLEAN;
- function "=" (l : REAL; r : UNRESOLVED_float) return BOOLEAN;
- function "/=" (l : REAL; r : UNRESOLVED_float) return BOOLEAN;
- function ">=" (l : REAL; r : UNRESOLVED_float) return BOOLEAN;
- function "<=" (l : REAL; r : UNRESOLVED_float) return BOOLEAN;
- function ">" (l : REAL; r : UNRESOLVED_float) return BOOLEAN;
- function "<" (l : REAL; r : UNRESOLVED_float) return BOOLEAN;
- function "=" (l : UNRESOLVED_float; r : INTEGER) return BOOLEAN;
- function "/=" (l : UNRESOLVED_float; r : INTEGER) return BOOLEAN;
- function ">=" (l : UNRESOLVED_float; r : INTEGER) return BOOLEAN;
- function "<=" (l : UNRESOLVED_float; r : INTEGER) return BOOLEAN;
- function ">" (l : UNRESOLVED_float; r : INTEGER) return BOOLEAN;
- function "<" (l : UNRESOLVED_float; r : INTEGER) return BOOLEAN;
- function "=" (l : INTEGER; r : UNRESOLVED_float) return BOOLEAN;
- function "/=" (l : INTEGER; r : UNRESOLVED_float) return BOOLEAN;
- function ">=" (l : INTEGER; r : UNRESOLVED_float) return BOOLEAN;
- function "<=" (l : INTEGER; r : UNRESOLVED_float) return BOOLEAN;
- function ">" (l : INTEGER; r : UNRESOLVED_float) return BOOLEAN;
- function "<" (l : INTEGER; r : UNRESOLVED_float) return BOOLEAN;
- function \?=\ (l : UNRESOLVED_float; r : REAL) return STD_ULOGIC;
- function \?/=\ (l : UNRESOLVED_float; r : REAL) return STD_ULOGIC;
- function \?>\ (l : UNRESOLVED_float; r : REAL) return STD_ULOGIC;
- function \?>=\ (l : UNRESOLVED_float; r : REAL) return STD_ULOGIC;
- function \?<\ (l : UNRESOLVED_float; r : REAL) return STD_ULOGIC;
- function \?<=\ (l : UNRESOLVED_float; r : REAL) return STD_ULOGIC;
- function \?=\ (l : REAL; r : UNRESOLVED_float) return STD_ULOGIC;
- function \?/=\ (l : REAL; r : UNRESOLVED_float) return STD_ULOGIC;
- function \?>\ (l : REAL; r : UNRESOLVED_float) return STD_ULOGIC;
- function \?>=\ (l : REAL; r : UNRESOLVED_float) return STD_ULOGIC;
- function \?<\ (l : REAL; r : UNRESOLVED_float) return STD_ULOGIC;
- function \?<=\ (l : REAL; r : UNRESOLVED_float) return STD_ULOGIC;
- function \?=\ (l : UNRESOLVED_float; r : INTEGER) return STD_ULOGIC;
- function \?/=\ (l : UNRESOLVED_float; r : INTEGER) return STD_ULOGIC;
- function \?>\ (l : UNRESOLVED_float; r : INTEGER) return STD_ULOGIC;
- function \?>=\ (l : UNRESOLVED_float; r : INTEGER) return STD_ULOGIC;
- function \?<\ (l : UNRESOLVED_float; r : INTEGER) return STD_ULOGIC;
- function \?<=\ (l : UNRESOLVED_float; r : INTEGER) return STD_ULOGIC;
- function \?=\ (l : INTEGER; r : UNRESOLVED_float) return STD_ULOGIC;
- function \?/=\ (l : INTEGER; r : UNRESOLVED_float) return STD_ULOGIC;
- function \?>\ (l : INTEGER; r : UNRESOLVED_float) return STD_ULOGIC;
- function \?>=\ (l : INTEGER; r : UNRESOLVED_float) return STD_ULOGIC;
- function \?<\ (l : INTEGER; r : UNRESOLVED_float) return STD_ULOGIC;
- function \?<=\ (l : INTEGER; r : UNRESOLVED_float) return STD_ULOGIC;
- -- minimum and maximum overloads
- function maximum (l : UNRESOLVED_float; r : REAL) return UNRESOLVED_float;
- function minimum (l : UNRESOLVED_float; r : REAL) return UNRESOLVED_float;
- function maximum (l : REAL; r : UNRESOLVED_float) return UNRESOLVED_float;
- function minimum (l : REAL; r : UNRESOLVED_float) return UNRESOLVED_float;
- function maximum (l : UNRESOLVED_float; r : INTEGER) return UNRESOLVED_float;
- function minimum (l : UNRESOLVED_float; r : INTEGER) return UNRESOLVED_float;
- function maximum (l : INTEGER; r : UNRESOLVED_float) return UNRESOLVED_float;
- function minimum (l : INTEGER; r : UNRESOLVED_float) return UNRESOLVED_float;
-----------------------------------------------------------------------------
- -- logical functions
- ----------------------------------------------------------------------------
-
- function "not" (l : UNRESOLVED_float) return UNRESOLVED_float;
- function "and" (l, r : UNRESOLVED_float) return UNRESOLVED_float;
- function "or" (l, r : UNRESOLVED_float) return UNRESOLVED_float;
- function "nand" (l, r : UNRESOLVED_float) return UNRESOLVED_float;
- function "nor" (l, r : UNRESOLVED_float) return UNRESOLVED_float;
- function "xor" (l, r : UNRESOLVED_float) return UNRESOLVED_float;
- function "xnor" (l, r : UNRESOLVED_float) return UNRESOLVED_float;
- -- Vector and std_ulogic functions, same as functions in numeric_std
- function "and" (l : STD_ULOGIC; r : UNRESOLVED_float)
- return UNRESOLVED_float;
- function "and" (l : UNRESOLVED_float; r : STD_ULOGIC)
- return UNRESOLVED_float;
- function "or" (l : STD_ULOGIC; r : UNRESOLVED_float)
- return UNRESOLVED_float;
- function "or" (l : UNRESOLVED_float; r : STD_ULOGIC)
- return UNRESOLVED_float;
- function "nand" (l : STD_ULOGIC; r : UNRESOLVED_float)
- return UNRESOLVED_float;
- function "nand" (l : UNRESOLVED_float; r : STD_ULOGIC)
- return UNRESOLVED_float;
- function "nor" (l : STD_ULOGIC; r : UNRESOLVED_float)
- return UNRESOLVED_float;
- function "nor" (l : UNRESOLVED_float; r : STD_ULOGIC)
- return UNRESOLVED_float;
- function "xor" (l : STD_ULOGIC; r : UNRESOLVED_float)
- return UNRESOLVED_float;
- function "xor" (l : UNRESOLVED_float; r : STD_ULOGIC)
- return UNRESOLVED_float;
- function "xnor" (l : STD_ULOGIC; r : UNRESOLVED_float)
- return UNRESOLVED_float;
- function "xnor" (l : UNRESOLVED_float; r : STD_ULOGIC)
- return UNRESOLVED_float;
- -- Reduction operators, same as numeric_std functions
- function and_reduce (l : UNRESOLVED_float) return STD_ULOGIC;
- function nand_reduce (l : UNRESOLVED_float) return STD_ULOGIC;
- function or_reduce (l : UNRESOLVED_float) return STD_ULOGIC;
- function nor_reduce (l : UNRESOLVED_float) return STD_ULOGIC;
- function xor_reduce (l : UNRESOLVED_float) return STD_ULOGIC;
- function xnor_reduce (l : UNRESOLVED_float) return STD_ULOGIC;
-
- -- Note: "sla", "sra", "sll", "slr", "rol" and "ror" not implemented.
-
- -----------------------------------------------------------------------------
- -- Recommended Functions from the IEEE 754 Appendix
- -----------------------------------------------------------------------------
-
- -- returns x with the sign of y.
- function Copysign (x, y : UNRESOLVED_float) return UNRESOLVED_float;
-
- -- Returns y * 2**n for integral values of N without computing 2**n
- function Scalb (
- y : UNRESOLVED_float; -- floating point input
- N : INTEGER; -- exponent to add
- constant round_style : round_type := float_round_style; -- rounding option
- constant check_error : BOOLEAN := float_check_error; -- check for errors
- constant denormalize : BOOLEAN := float_denormalize) -- Use IEEE extended FP
- return UNRESOLVED_float;
-
- -- Returns y * 2**n for integral values of N without computing 2**n
- function Scalb (
- y : UNRESOLVED_float; -- floating point input
- N : SIGNED; -- exponent to add
- constant round_style : round_type := float_round_style; -- rounding option
- constant check_error : BOOLEAN := float_check_error; -- check for errors
- constant denormalize : BOOLEAN := float_denormalize) -- Use IEEE extended FP
- return UNRESOLVED_float;
-
- -- returns the unbiased exponent of x
- function Logb (x : UNRESOLVED_float) return INTEGER;
- function Logb (x : UNRESOLVED_float) return SIGNED;
-
- -- returns the next representable neighbor of x in the direction toward y
--- function Nextafter (
--- x, y : UNRESOLVED_float; -- floating point input
--- constant check_error : BOOLEAN := float_check_error; -- check for errors
--- constant denormalize : BOOLEAN := float_denormalize)
--- return UNRESOLVED_float;
-
- -- Returns TRUE if X is unordered with Y.
- function Unordered (x, y : UNRESOLVED_float) return BOOLEAN;
- function Finite (x : UNRESOLVED_float) return BOOLEAN;
- function Isnan (x : UNRESOLVED_float) return BOOLEAN;
-
- -- Function to return constants.
- function zerofp (
- constant exponent_width : NATURAL := float_exponent_width; -- exponent
- constant fraction_width : NATURAL := float_fraction_width) -- fraction
- return UNRESOLVED_float;
- function nanfp (
- constant exponent_width : NATURAL := float_exponent_width; -- exponent
- constant fraction_width : NATURAL := float_fraction_width) -- fraction
- return UNRESOLVED_float;
- function qnanfp (
- constant exponent_width : NATURAL := float_exponent_width; -- exponent
- constant fraction_width : NATURAL := float_fraction_width) -- fraction
- return UNRESOLVED_float;
- function pos_inffp (
- constant exponent_width : NATURAL := float_exponent_width; -- exponent
- constant fraction_width : NATURAL := float_fraction_width) -- fraction
- return UNRESOLVED_float;
- function neg_inffp (
- constant exponent_width : NATURAL := float_exponent_width; -- exponent
- constant fraction_width : NATURAL := float_fraction_width) -- fraction
- return UNRESOLVED_float;
- function neg_zerofp (
- constant exponent_width : NATURAL := float_exponent_width; -- exponent
- constant fraction_width : NATURAL := float_fraction_width) -- fraction
- return UNRESOLVED_float;
- -- size_res versions
- function zerofp (
- size_res : UNRESOLVED_float) -- variable is only use for sizing
- return UNRESOLVED_float;
- function nanfp (
- size_res : UNRESOLVED_float) -- variable is only use for sizing
- return UNRESOLVED_float;
- function qnanfp (
- size_res : UNRESOLVED_float) -- variable is only use for sizing
- return UNRESOLVED_float;
- function pos_inffp (
- size_res : UNRESOLVED_float) -- variable is only use for sizing
- return UNRESOLVED_float;
- function neg_inffp (
- size_res : UNRESOLVED_float) -- variable is only use for sizing
- return UNRESOLVED_float;
- function neg_zerofp (
- size_res : UNRESOLVED_float) -- variable is only use for sizing
- return UNRESOLVED_float;
-
- -- ===========================================================================
- -- string and textio Functions
- -- ===========================================================================
--- rtl_synthesis off
--- pragma synthesis_off
- -- writes S:EEEE:FFFFFFFF
- procedure WRITE (
- L : inout LINE; -- access type (pointer)
- VALUE : in UNRESOLVED_float; -- value to write
- JUSTIFIED : in SIDE := right; -- which side to justify text
- FIELD : in WIDTH := 0); -- width of field
-
- -- Reads SEEEEFFFFFFFF, "." and ":" are ignored
- procedure READ (L : inout LINE; VALUE : out UNRESOLVED_float);
- procedure READ (L : inout LINE; VALUE : out UNRESOLVED_float;
- GOOD : out BOOLEAN);
-
- alias BREAD is READ [LINE, UNRESOLVED_float, BOOLEAN];
- alias BREAD is READ [LINE, UNRESOLVED_float];
- alias BWRITE is WRITE [LINE, UNRESOLVED_float, SIDE, WIDTH];
- alias BINARY_READ is READ [LINE, UNRESOLVED_FLOAT, BOOLEAN];
- alias BINARY_READ is READ [LINE, UNRESOLVED_FLOAT];
- alias BINARY_WRITE is WRITE [LINE, UNRESOLVED_float, SIDE, WIDTH];
-
- procedure OWRITE (
- L : inout LINE; -- access type (pointer)
- VALUE : in UNRESOLVED_float; -- value to write
- JUSTIFIED : in SIDE := right; -- which side to justify text
- FIELD : in WIDTH := 0); -- width of field
-
- -- Octal read with padding, no separators used
- procedure OREAD (L : inout LINE; VALUE : out UNRESOLVED_float);
- procedure OREAD (L : inout LINE; VALUE : out UNRESOLVED_float;
- GOOD : out BOOLEAN);
- alias OCTAL_READ is OREAD [LINE, UNRESOLVED_FLOAT, BOOLEAN];
- alias OCTAL_READ is OREAD [LINE, UNRESOLVED_FLOAT];
- alias OCTAL_WRITE is OWRITE [LINE, UNRESOLVED_FLOAT, SIDE, WIDTH];
-
- -- Hex write with padding, no separators
- procedure HWRITE (
- L : inout LINE; -- access type (pointer)
- VALUE : in UNRESOLVED_float; -- value to write
- JUSTIFIED : in SIDE := right; -- which side to justify text
- FIELD : in WIDTH := 0); -- width of field
-
- -- Hex read with padding, no separators used
- procedure HREAD (L : inout LINE; VALUE : out UNRESOLVED_float);
- procedure HREAD (L : inout LINE; VALUE : out UNRESOLVED_float;
- GOOD : out BOOLEAN);
- alias HEX_READ is HREAD [LINE, UNRESOLVED_FLOAT, BOOLEAN];
- alias HEX_READ is HREAD [LINE, UNRESOLVED_FLOAT];
- alias HEX_WRITE is HWRITE [LINE, UNRESOLVED_FLOAT, SIDE, WIDTH];
-
- -- returns "S:EEEE:FFFFFFFF"
- function to_string (value : UNRESOLVED_float) return STRING;
- alias TO_BSTRING is TO_STRING [UNRESOLVED_FLOAT return STRING];
- alias TO_BINARY_STRING is TO_STRING [UNRESOLVED_FLOAT return STRING];
-
- -- Returns a HEX string, with padding
- function to_hstring (value : UNRESOLVED_float) return STRING;
- alias TO_HEX_STRING is TO_HSTRING [UNRESOLVED_FLOAT return STRING];
-
- -- Returns and octal string, with padding
- function to_ostring (value : UNRESOLVED_float) return STRING;
- alias TO_OCTAL_STRING is TO_OSTRING [UNRESOLVED_FLOAT return STRING];
-
- function from_string (
- bstring : STRING; -- binary string
- constant exponent_width : NATURAL := float_exponent_width;
- constant fraction_width : NATURAL := float_fraction_width)
- return UNRESOLVED_float;
- alias from_bstring is from_string [STRING, NATURAL, NATURAL
- return UNRESOLVED_float];
- alias from_binary_string is from_string [STRING, NATURAL, NATURAL
- return UNRESOLVED_float];
- function from_ostring (
- ostring : STRING; -- Octal string
- constant exponent_width : NATURAL := float_exponent_width;
- constant fraction_width : NATURAL := float_fraction_width)
- return UNRESOLVED_float;
- alias from_octal_string is from_ostring [STRING, NATURAL, NATURAL
- return UNRESOLVED_float];
-
- function from_hstring (
- hstring : STRING; -- hex string
- constant exponent_width : NATURAL := float_exponent_width;
- constant fraction_width : NATURAL := float_fraction_width)
- return UNRESOLVED_float;
- alias from_hex_string is from_hstring [STRING, NATURAL, NATURAL
- return UNRESOLVED_float];
-
- function from_string (
- bstring : STRING; -- binary string
- size_res : UNRESOLVED_float) -- used for sizing only
- return UNRESOLVED_float;
- alias from_bstring is from_string [STRING, UNRESOLVED_float
- return UNRESOLVED_float];
- alias from_binary_string is from_string [STRING, UNRESOLVED_float
- return UNRESOLVED_float];
-
- function from_ostring (
- ostring : STRING; -- Octal string
- size_res : UNRESOLVED_float) -- used for sizing only
- return UNRESOLVED_float;
- alias from_octal_string is from_ostring [STRING, UNRESOLVED_float
- return UNRESOLVED_float];
-
- function from_hstring (
- hstring : STRING; -- hex string
- size_res : UNRESOLVED_float) -- used for sizing only
- return UNRESOLVED_float;
- alias from_hex_string is from_hstring [STRING, UNRESOLVED_float
- return UNRESOLVED_float];
--- rtl_synthesis on
--- pragma synthesis_on
- -- IN VHDL-2006 std_logic_vector is a subtype of std_ulogic_vector, so these
- -- extra functions are needed for compatability.
- function to_float (
- arg : STD_LOGIC_VECTOR;
- constant exponent_width : NATURAL := float_exponent_width; -- length of FP output exponent
- constant fraction_width : NATURAL := float_fraction_width) -- length of FP output fraction
- return UNRESOLVED_float;
-
- function to_float (
- arg : STD_LOGIC_VECTOR;
- size_res : UNRESOLVED_float)
- return UNRESOLVED_float;
-
- -- For Verilog compatability
- function realtobits (arg : REAL) return STD_LOGIC_VECTOR;
- function bitstoreal (arg : STD_LOGIC_VECTOR) return REAL;
-
-end package float_pkg;
--------------------------------------------------------------------------------
--- Proposed package body for the VHDL-200x-FT float_pkg package
--- This version is optimized for Synthesis, and not for simulation.
--- Note that there are functional differences between the synthesis and
--- simulation packages bodies. The Synthesis version is preferred.
--- This package body supplies a recommended implementation of these functions
--- Version : $Revision: 2.0 $
--- Date : $Date: 2009/01/27 20:45:30 $
---
--- Created for VHDL-200X par, David Bishop (dbishop@vhdl.org)
--------------------------------------------------------------------------------
-
-package body float_pkg is
-
- -- Author David Bishop (dbishop@vhdl.org)
- -----------------------------------------------------------------------------
- -- type declarations
- -----------------------------------------------------------------------------
-
- -- This deferred constant will tell you if the package body is synthesizable
- -- or implemented as real numbers, set to "true" if synthesizable.
- constant fphdlsynth_or_real : BOOLEAN := true; -- deferred constant
-
- -- types of boundary conditions
- type boundary_type is (normal, infinity, zero, denormal);
-
- -- null range array constant
- constant NAFP : UNRESOLVED_float (0 downto 1) := (others => '0');
- constant NSLV : STD_ULOGIC_VECTOR (0 downto 1) := (others => '0');
-
- -- %%% Replicated functions
- -- These functions are replicated so that we don't need to reference the new
- -- 2006 package std.standard, std_logic_1164 and numeric_std.
- function maximum (
- l, r : INTEGER) -- inputs
- return INTEGER is
- begin -- function max
- if l > r then return l;
- else return r;
- end if;
- end function maximum;
-
- function minimum (
- l, r : INTEGER) -- inputs
- return INTEGER is
- begin -- function min
- if l > r then return r;
- else return l;
- end if;
- end function minimum;
-
- function or_reduce (arg : STD_ULOGIC_VECTOR)
- return STD_LOGIC is
- variable Upper, Lower : STD_ULOGIC;
- variable Half : INTEGER;
- variable BUS_int : STD_ULOGIC_VECTOR (arg'length - 1 downto 0);
- variable Result : STD_ULOGIC;
- begin
- if (arg'length < 1) then -- In the case of a NULL range
- Result := '0';
- else
- BUS_int := to_ux01 (arg);
- if (BUS_int'length = 1) then
- Result := BUS_int (BUS_int'left);
- elsif (BUS_int'length = 2) then
- Result := BUS_int (BUS_int'right) or BUS_int (BUS_int'left);
- else
- Half := (BUS_int'length + 1) / 2 + BUS_int'right;
- Upper := or_reduce (BUS_int (BUS_int'left downto Half));
- Lower := or_reduce (BUS_int (Half - 1 downto BUS_int'right));
- Result := Upper or Lower;
- end if;
- end if;
- return Result;
- end function or_reduce;
-
- function or_reduce (arg : UNSIGNED)
- return STD_ULOGIC is
- begin
- return or_reduce (STD_ULOGIC_VECTOR (arg));
- end function or_reduce;
-
- function or_reduce (arg : SIGNED)
- return STD_ULOGIC is
- begin
- return or_reduce (STD_ULOGIC_VECTOR (arg));
- end function or_reduce;
-
- function or_reduce (arg : STD_LOGIC_VECTOR)
- return STD_ULOGIC is
- begin
- return or_reduce (STD_ULOGIC_VECTOR (arg));
- end function or_reduce;
-
- -- purpose: AND all of the bits in a vector together
- -- This is a copy of the proposed "and_reduce" from 1076.3
- function and_reduce (arg : STD_ULOGIC_VECTOR)
- return STD_LOGIC is
- variable Upper, Lower : STD_ULOGIC;
- variable Half : INTEGER;
- variable BUS_int : STD_ULOGIC_VECTOR (arg'length - 1 downto 0);
- variable Result : STD_ULOGIC;
- begin
- if (arg'length < 1) then -- In the case of a NULL range
- Result := '1';
- else
- BUS_int := to_ux01 (arg);
- if (BUS_int'length = 1) then
- Result := BUS_int (BUS_int'left);
- elsif (BUS_int'length = 2) then
- Result := BUS_int (BUS_int'right) and BUS_int (BUS_int'left);
- else
- Half := (BUS_int'length + 1) / 2 + BUS_int'right;
- Upper := and_reduce (BUS_int (BUS_int'left downto Half));
- Lower := and_reduce (BUS_int (Half - 1 downto BUS_int'right));
- Result := Upper and Lower;
- end if;
- end if;
- return Result;
- end function and_reduce;
-
- function and_reduce (arg : UNSIGNED)
- return STD_ULOGIC is
- begin
- return and_reduce (STD_ULOGIC_VECTOR (arg));
- end function and_reduce;
-
- function and_reduce (arg : SIGNED)
- return STD_ULOGIC is
- begin
- return and_reduce (STD_ULOGIC_VECTOR (arg));
- end function and_reduce;
-
- function xor_reduce (arg : STD_ULOGIC_VECTOR) return STD_ULOGIC is
- variable Upper, Lower : STD_ULOGIC;
- variable Half : INTEGER;
- variable BUS_int : STD_ULOGIC_VECTOR (arg'length - 1 downto 0);
- variable Result : STD_ULOGIC := '0'; -- In the case of a NULL range
- begin
- if (arg'length >= 1) then
- BUS_int := to_ux01 (arg);
- if (BUS_int'length = 1) then
- Result := BUS_int (BUS_int'left);
- elsif (BUS_int'length = 2) then
- Result := BUS_int(BUS_int'right) xor BUS_int(BUS_int'left);
- else
- Half := (BUS_int'length + 1) / 2 + BUS_int'right;
- Upper := xor_reduce (BUS_int (BUS_int'left downto Half));
- Lower := xor_reduce (BUS_int (Half - 1 downto BUS_int'right));
- Result := Upper xor Lower;
- end if;
- end if;
- return Result;
- end function xor_reduce;
-
- function nand_reduce(arg : STD_ULOGIC_VECTOR) return STD_ULOGIC is
- begin
- return not and_reduce (arg);
- end function nand_reduce;
-
- function nor_reduce(arg : STD_ULOGIC_VECTOR) return STD_ULOGIC is
- begin
- return not or_reduce (arg);
- end function nor_reduce;
-
- function xnor_reduce(arg : STD_ULOGIC_VECTOR) return STD_ULOGIC is
- begin
- return not xor_reduce (arg);
- end function xnor_reduce;
-
- function find_leftmost (ARG : UNSIGNED; Y : STD_ULOGIC)
- return INTEGER is
- begin
- for INDEX in ARG'range loop
- if ARG(INDEX) = Y then
- return INDEX;
- end if;
- end loop;
- return -1;
- end function find_leftmost;
-
- -- Match table, copied form new std_logic_1164
--- type stdlogic_table is array(STD_ULOGIC, STD_ULOGIC) of STD_ULOGIC;
--- constant match_logic_table : stdlogic_table := (
--- -----------------------------------------------------
--- -- U X 0 1 Z W L H - | |
--- -----------------------------------------------------
--- ('U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', '1'), -- | U |
--- ('U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', '1'), -- | X |
--- ('U', 'X', '1', '0', 'X', 'X', '1', '0', '1'), -- | 0 |
--- ('U', 'X', '0', '1', 'X', 'X', '0', '1', '1'), -- | 1 |
--- ('U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', '1'), -- | Z |
--- ('U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', '1'), -- | W |
--- ('U', 'X', '1', '0', 'X', 'X', '1', '0', '1'), -- | L |
--- ('U', 'X', '0', '1', 'X', 'X', '0', '1', '1'), -- | H |
--- ('1', '1', '1', '1', '1', '1', '1', '1', '1') -- | - |
--- );
-
--- constant no_match_logic_table : stdlogic_table := (
--- -----------------------------------------------------
--- -- U X 0 1 Z W L H - | |
--- -----------------------------------------------------
--- ('U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', '0'), -- | U |
--- ('U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', '0'), -- | X |
--- ('U', 'X', '0', '1', 'X', 'X', '0', '1', '0'), -- | 0 |
--- ('U', 'X', '1', '0', 'X', 'X', '1', '0', '0'), -- | 1 |
--- ('U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', '0'), -- | Z |
--- ('U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', '0'), -- | W |
--- ('U', 'X', '0', '1', 'X', 'X', '0', '1', '0'), -- | L |
--- ('U', 'X', '1', '0', 'X', 'X', '1', '0', '0'), -- | H |
--- ('0', '0', '0', '0', '0', '0', '0', '0', '0') -- | - |
--- );
-
- -------------------------------------------------------------------
- -- ?= functions, Similar to "std_match", but returns "std_ulogic".
- -------------------------------------------------------------------
- -- %%% FUNCTION "?=" ( l, r : std_ulogic ) RETURN std_ulogic IS
- function \?=\ (l, r : STD_ULOGIC) return STD_ULOGIC is
- variable lx, rx : STD_ULOGIC;
- begin
--- return match_logic_table (l, r);
- lx := to_x01(l);
- rx := to_x01(r);
- if lx = 'X' or rx = 'X' then
- return 'X';
- elsif lx = rx then
- return '1';
- else
- return '0';
- end if;
- end function \?=\;
- function \?/=\ (l, r : STD_ULOGIC) return STD_ULOGIC is
- begin
--- return no_match_logic_table (l, r);
- return not \?=\ (l, r);
- end function \?/=\;
-
--- -- %%% FUNCTION "?=" ( l, r : std_logic_vector ) RETURN std_ulogic IS
--- function \?=\ (l, r : STD_LOGIC_VECTOR) return STD_ULOGIC is
--- alias lv : STD_LOGIC_VECTOR(1 to l'length) is l;
--- alias rv : STD_LOGIC_VECTOR(1 to r'length) is r;
--- variable result, result1 : STD_ULOGIC; -- result
--- begin
--- -- Logically identical to an "=" operator.
--- if ((l'length < 1) or (r'length < 1)) then
--- report "STD_LOGIC_1164.""?="": null detected, returning X"
--- severity warning;
--- return 'X';
--- end if;
--- if lv'length /= rv'length then
--- report "STD_LOGIC_1164.""?="": L'LENGTH /= R'LENGTH, returning X"
--- severity warning;
--- return 'X';
--- else
--- result := '1';
--- for i in lv'low to lv'high loop
--- result1 := match_logic_table(lv(i), rv(i));
--- if result1 = 'U' then
--- return 'U';
--- elsif result1 = 'X' or result = 'X' then
--- result := 'X';
--- else
--- result := result and result1;
--- end if;
--- end loop;
--- return result;
--- end if;
--- end function \?=\;
--- -- %%% END FUNCTION "?=";
--- -------------------------------------------------------------------
--- -- %%% FUNCTION "?=" ( l, r : std_ulogic_vector ) RETURN std_ulogic IS
- function \?=\ (l, r : STD_ULOGIC_VECTOR) return STD_ULOGIC is
- alias lv : STD_ULOGIC_VECTOR(1 to l'length) is l;
- alias rv : STD_ULOGIC_VECTOR(1 to r'length) is r;
- variable result, result1 : STD_ULOGIC;
- begin
- if ((l'length < 1) or (r'length < 1)) then
- report "STD_LOGIC_1164.""?="": null detected, returning X"
- severity warning;
- return 'X';
- end if;
- if lv'length /= rv'length then
- report "STD_LOGIC_1164.""?="": L'LENGTH /= R'LENGTH, returning X"
- severity warning;
- return 'X';
- else
- result := '1';
- for i in lv'low to lv'high loop
- result1 := \?=\ (lv(i), rv(i));
- if result1 = 'U' then
- return 'U';
- elsif result1 = 'X' or result = 'X' then
- result := 'X';
- else
- result := result and result1;
- end if;
- end loop;
- return result;
- end if;
- end function \?=\;
-
- function Is_X (s : UNSIGNED) return BOOLEAN is
- begin
- return Is_X (STD_LOGIC_VECTOR (s));
- end function Is_X;
-
- function Is_X (s : SIGNED) return BOOLEAN is
- begin
- return Is_X (STD_LOGIC_VECTOR (s));
- end function Is_X;
--- %%% END replicated functions
-
- -- Special version of "minimum" to do some boundary checking
- function mine (L, R : INTEGER)
- return INTEGER is
- begin -- function minimum
- if (L = INTEGER'low or R = INTEGER'low) then
- report "float_pkg:"
- & " Unbounded number passed, was a literal used?"
- severity error;
- return 0;
- end if;
- return minimum (L, R);
- end function mine;
-
- -- Generates the base number for the exponent normalization offset.
- function gen_expon_base (
- constant exponent_width : NATURAL)
- return SIGNED is
- variable result : SIGNED (exponent_width-1 downto 0);
- begin
- result := (others => '1');
- result (exponent_width-1) := '0';
- return result;
- end function gen_expon_base;
-
- -- Integer version of the "log2" command (contributed by Peter Ashenden)
- function log2 (A : NATURAL) return NATURAL is
- variable quotient : NATURAL;
- variable result : NATURAL := 0;
- begin
- quotient := A / 2;
- while quotient > 0 loop
- quotient := quotient / 2;
- result := result + 1;
- end loop;
- return result;
- end function log2;
-
- -- Function similar to the ILOGB function in MATH_REAL
- function log2 (A : REAL) return INTEGER is
- variable Y : REAL;
- variable N : INTEGER := 0;
- begin
- if (A = 1.0 or A = 0.0) then
- return 0;
- end if;
- Y := A;
- if(A > 1.0) then
- while Y >= 2.0 loop
- Y := Y / 2.0;
- N := N + 1;
- end loop;
- return N;
- end if;
- -- O < Y < 1
- while Y < 1.0 loop
- Y := Y * 2.0;
- N := N - 1;
- end loop;
- return N;
- end function log2;
-
- -- purpose: Test the boundary conditions of a Real number
- procedure test_boundary (
- arg : in REAL; -- Input, converted to real
- constant fraction_width : in NATURAL; -- length of FP output fraction
- constant exponent_width : in NATURAL; -- length of FP exponent
- constant denormalize : in BOOLEAN := true; -- Use IEEE extended FP
- variable btype : out boundary_type;
- variable log2i : out INTEGER
- ) is
- constant expon_base : SIGNED (exponent_width-1 downto 0) :=
- gen_expon_base(exponent_width); -- exponent offset
- constant exp_min : SIGNED (12 downto 0) :=
- -(resize(expon_base, 13)) + 1; -- Minimum normal exponent
- constant exp_ext_min : SIGNED (12 downto 0) :=
- exp_min - fraction_width; -- Minimum for denormal exponent
- variable log2arg : INTEGER; -- log2 of argument
- begin -- function test_boundary
- -- Check to see if the exponent is big enough
- -- Note that the argument is always an absolute value at this point.
- log2arg := log2(arg);
- if arg = 0.0 then
- btype := zero;
- elsif exponent_width > 11 then -- Exponent for Real is 11 (64 bit)
- btype := normal;
- else
- if log2arg < to_integer(exp_min) then
- if denormalize then
- if log2arg < to_integer(exp_ext_min) then
- btype := zero;
- else
- btype := denormal;
- end if;
- else
- if log2arg < to_integer(exp_min)-1 then
- btype := zero;
- else
- btype := normal; -- Can still represent this number
- end if;
- end if;
- elsif exponent_width < 11 then
- if log2arg > to_integer(expon_base)+1 then
- btype := infinity;
- else
- btype := normal;
- end if;
- else
- btype := normal;
- end if;
- end if;
- log2i := log2arg;
- end procedure test_boundary;
-
- -- purpose: Rounds depending on the state of the "round_style"
- -- Logic taken from
- -- "What Every Computer Scientist Should Know About Floating Point Arithmetic"
- -- by David Goldberg (1991)
- function check_round (
- fract_in : STD_ULOGIC; -- input fraction
- sign : STD_ULOGIC; -- sign bit
- remainder : UNSIGNED; -- remainder to round from
- sticky : STD_ULOGIC := '0'; -- Sticky bit
- constant round_style : round_type) -- rounding type
- return BOOLEAN is
- variable result : BOOLEAN;
- variable or_reduced : STD_ULOGIC;
- begin -- function check_round
- result := false;
- if (remainder'length > 0) then -- if remainder in a null array
- or_reduced := or_reduce (remainder & sticky);
- rounding_case : case round_style is
- when round_nearest => -- Round Nearest, default mode
- if remainder(remainder'high) = '1' then -- round
- if (remainder'length > 1) then
- if ((or_reduce (remainder(remainder'high-1
- downto remainder'low)) = '1'
- or sticky = '1')
- or fract_in = '1') then
- -- Make the bottom bit zero if possible if we are at 1/2
- result := true;
- end if;
- else
- result := (fract_in = '1' or sticky = '1');
- end if;
- end if;
- when round_inf => -- round up if positive, else truncate.
- if or_reduced = '1' and sign = '0' then
- result := true;
- end if;
- when round_neginf => -- round down if negative, else truncate.
- if or_reduced = '1' and sign = '1' then
- result := true;
- end if;
- when round_zero => -- round toward 0 Truncate
- null;
- end case rounding_case;
- end if;
- return result;
- end function check_round;
-
- -- purpose: Rounds depending on the state of the "round_style"
- -- unsigned version
- procedure fp_round (
- fract_in : in UNSIGNED; -- input fraction
- expon_in : in SIGNED; -- input exponent
- fract_out : out UNSIGNED; -- output fraction
- expon_out : out SIGNED) is -- output exponent
- begin -- procedure fp_round
- if and_reduce (fract_in) = '1' then -- Fraction is all "1"
- expon_out := expon_in + 1;
- fract_out := to_unsigned(0, fract_out'high+1);
- else
- expon_out := expon_in;
- fract_out := fract_in + 1;
- end if;
- end procedure fp_round;
-
- -- This version of break_number doesn't call "classfp"
- procedure break_number ( -- internal version
- arg : in UNRESOLVED_float;
- fptyp : in valid_fpstate;
- denormalize : in BOOLEAN := true;
- fract : out UNSIGNED;
- expon : out SIGNED) is
- constant fraction_width : NATURAL := -arg'low; -- length of FP output fraction
- constant exponent_width : NATURAL := arg'high; -- length of FP output exponent
- constant expon_base : SIGNED (exponent_width-1 downto 0) :=
- gen_expon_base(exponent_width); -- exponent offset
- variable exp : SIGNED (expon'range);
- begin
- fract (fraction_width-1 downto 0) :=
- UNSIGNED (to_slv(arg(-1 downto -fraction_width)));
- breakcase : case fptyp is
- when pos_zero | neg_zero =>
- fract (fraction_width) := '0';
- exp := -expon_base;
- when pos_denormal | neg_denormal =>
- if denormalize then
- exp := -expon_base;
- fract (fraction_width) := '0';
- else
- exp := -expon_base - 1;
- fract (fraction_width) := '1';
- end if;
- when pos_normal | neg_normal | pos_inf | neg_inf =>
- fract (fraction_width) := '1';
- exp := SIGNED(arg(exponent_width-1 downto 0));
- exp (exponent_width-1) := not exp(exponent_width-1);
- when others =>
- assert NO_WARNING
- report "float_pkg:"
- & "BREAK_NUMBER: " &
- "Meta state detected in fp_break_number process"
- severity warning;
- -- complete the case, if a NAN goes in, a NAN comes out.
- exp := (others => '1');
- fract (fraction_width) := '1';
- end case breakcase;
- expon := exp;
- end procedure break_number;
-
- -- purpose: floating point to UNSIGNED
- -- Used by to_integer, to_unsigned, and to_signed functions
- procedure float_to_unsigned (
- arg : in UNRESOLVED_float; -- floating point input
- variable sign : out STD_ULOGIC; -- sign of output
- variable frac : out UNSIGNED; -- unsigned biased output
- constant denormalize : in BOOLEAN; -- turn on denormalization
- constant bias : in NATURAL; -- bias for fixed point
- constant round_style : in round_type) is -- rounding method
- constant fraction_width : INTEGER := -mine(arg'low, arg'low); -- length of FP output fraction
- constant exponent_width : INTEGER := arg'high; -- length of FP output exponent
- variable fract : UNSIGNED (frac'range); -- internal version of frac
- variable isign : STD_ULOGIC; -- internal version of sign
- variable exp : INTEGER; -- Exponent
- variable expon : SIGNED (exponent_width-1 downto 0); -- Vectorized exp
- -- Base to divide fraction by
- variable frac_shift : UNSIGNED (frac'high+3 downto 0); -- Fraction shifted
- variable shift : INTEGER;
- variable remainder : UNSIGNED (2 downto 0);
- variable round : STD_ULOGIC; -- round BIT
- begin
- isign := to_x01(arg(arg'high));
- -- exponent /= '0', normal floating point
- expon := to_01(SIGNED(arg (exponent_width-1 downto 0)), 'X');
- expon(exponent_width-1) := not expon(exponent_width-1);
- exp := to_integer (expon);
- -- Figure out the fraction
- fract := (others => '0'); -- fill with zero
- fract (fract'high) := '1'; -- Add the "1.0".
- shift := (fract'high-1) - exp;
- if fraction_width > fract'high then -- Can only use size-2 bits
- fract (fract'high-1 downto 0) := UNSIGNED (to_slv (arg(-1 downto
- -fract'high)));
- else -- can use all bits
- fract (fract'high-1 downto fract'high-fraction_width) :=
- UNSIGNED (to_slv (arg(-1 downto -fraction_width)));
- end if;
- frac_shift := fract & "000";
- if shift < 0 then -- Overflow
- fract := (others => '1');
- else
- frac_shift := shift_right (frac_shift, shift);
- fract := frac_shift (frac_shift'high downto 3);
- remainder := frac_shift (2 downto 0);
- -- round (round_zero will bypass this and truncate)
- case round_style is
- when round_nearest =>
- round := remainder(2) and
- (fract (0) or (or_reduce (remainder (1 downto 0))));
- when round_inf =>
- round := remainder(2) and not isign;
- when round_neginf =>
- round := remainder(2) and isign;
- when others =>
- round := '0';
- end case;
- if round = '1' then
- fract := fract + 1;
- end if;
- end if;
- frac := fract;
- sign := isign;
- end procedure float_to_unsigned;
-
- -- purpose: returns a part of a vector, this function is here because
- -- or (fractr (to_integer(shiftx) downto 0));
- -- can't be synthesized in some synthesis tools.
- function smallfract (
- arg : UNSIGNED;
- shift : NATURAL)
- return STD_ULOGIC is
- variable orx : STD_ULOGIC;
- begin
- orx := arg(shift);
- for i in arg'range loop
- if i < shift then
- orx := arg(i) or orx;
- end if;
- end loop;
- return orx;
- end function smallfract;
- ---------------------------------------------------------------------------
- -- Visible functions
- ---------------------------------------------------------------------------
-
- -- purpose: converts the negative index to a positive one
- -- negative indices are illegal in 1164 and 1076.3
- function to_sulv (
- arg : UNRESOLVED_float) -- fp vector
- return STD_ULOGIC_VECTOR is
- variable result : STD_ULOGIC_VECTOR (arg'length-1 downto 0);
- begin -- function to_std_ulogic_vector
- if arg'length < 1 then
- return NSLV;
- end if;
- result := STD_ULOGIC_VECTOR (arg);
- return result;
- end function to_sulv;
-
- -- Converts an fp into an SLV
- function to_slv (arg : UNRESOLVED_float) return STD_LOGIC_VECTOR is
- begin
- return std_logic_vector (to_sulv (arg));
- end function to_slv;
-
- -- purpose: normalizes a floating point number
- -- This version assumes an "unsigned" input with
- function normalize (
- fract : UNSIGNED; -- fraction, unnormalized
- expon : SIGNED; -- exponent, normalized by -1
- sign : STD_ULOGIC; -- sign BIT
- sticky : STD_ULOGIC := '0'; -- Sticky bit (rounding)
- constant exponent_width : NATURAL := float_exponent_width; -- size of output exponent
- constant fraction_width : NATURAL := float_fraction_width; -- size of output fraction
- constant round_style : round_type := float_round_style; -- rounding option
- constant denormalize : BOOLEAN := float_denormalize; -- Use IEEE extended FP
- constant nguard : NATURAL := float_guard_bits) -- guard bits
- return UNRESOLVED_float is
- variable sfract : UNSIGNED (fract'high downto 0); -- shifted fraction
- variable rfract : UNSIGNED (fraction_width-1 downto 0); -- fraction
- variable exp : SIGNED (exponent_width+1 downto 0); -- exponent
- variable rexp : SIGNED (exponent_width+1 downto 0); -- result exponent
- variable rexpon : UNSIGNED (exponent_width-1 downto 0); -- exponent
- variable result : UNRESOLVED_float (exponent_width downto -fraction_width); -- result
- variable shiftr : INTEGER; -- shift amount
- variable stickyx : STD_ULOGIC; -- version of sticky
- constant expon_base : SIGNED (exponent_width-1 downto 0) :=
- gen_expon_base(exponent_width); -- exponent offset
- variable round, zerores, infres : BOOLEAN;
- begin -- function normalize
- zerores := false;
- infres := false;
- round := false;
- shiftr := find_leftmost (to_01(fract), '1') -- Find the first "1"
- - fraction_width - nguard; -- subtract the length we want
- exp := resize (expon, exp'length) + shiftr;
- if (or_reduce (fract) = '0') then -- Zero
- zerores := true;
- elsif ((exp <= -resize(expon_base, exp'length)-1) and denormalize)
- or ((exp < -resize(expon_base, exp'length)-1) and not denormalize) then
- if (exp >= -resize(expon_base, exp'length)-fraction_width-1)
- and denormalize then
- exp := -resize(expon_base, exp'length)-1;
- shiftr := -to_integer (expon + expon_base); -- new shift
- else -- return zero
- zerores := true;
- end if;
- elsif (exp > expon_base-1) then -- infinity
- infres := true;
- end if;
- if zerores then
- result := zerofp (fraction_width => fraction_width,
- exponent_width => exponent_width);
- elsif infres then
- result := pos_inffp (fraction_width => fraction_width,
- exponent_width => exponent_width);
- else
- sfract := fract srl shiftr; -- shift
- if shiftr > 0 then
--- stickyx := sticky or (or_reduce(fract (shiftr-1 downto 0)));
- stickyx := sticky or smallfract (fract, shiftr-1);
- else
- stickyx := sticky;
- end if;
- if nguard > 0 then
- round := check_round (
- fract_in => sfract (nguard),
- sign => sign,
- remainder => sfract(nguard-1 downto 0),
- sticky => stickyx,
- round_style => round_style);
- end if;
- if round then
- fp_round(fract_in => sfract (fraction_width-1+nguard downto nguard),
- expon_in => exp(rexp'range),
- fract_out => rfract,
- expon_out => rexp);
- else
- rfract := sfract (fraction_width-1+nguard downto nguard);
- rexp := exp(rexp'range);
- end if;
- -- result
- rexpon := UNSIGNED (rexp(exponent_width-1 downto 0));
- rexpon (exponent_width-1) := not rexpon(exponent_width-1);
- result (rexpon'range) := UNRESOLVED_float(rexpon);
- result (-1 downto -fraction_width) := UNRESOLVED_float(rfract);
- end if;
- result (exponent_width) := sign; -- sign BIT
- return result;
- end function normalize;
-
- -- purpose: normalizes a floating point number
- -- This version assumes a "ufixed" input
- function normalize (
- fract : ufixed; -- unsigned fixed point
- expon : SIGNED; -- exponent, normalized by -1
- sign : STD_ULOGIC; -- sign bit
- sticky : STD_ULOGIC := '0'; -- Sticky bit (rounding)
- constant exponent_width : NATURAL := float_exponent_width; -- size of output exponent
- constant fraction_width : NATURAL := float_fraction_width; -- size of output fraction
- constant round_style : round_type := float_round_style; -- rounding option
- constant denormalize : BOOLEAN := float_denormalize; -- Use IEEE extended FP
- constant nguard : NATURAL := float_guard_bits) -- guard bits
- return UNRESOLVED_float is
- variable result : UNRESOLVED_float (exponent_width downto -fraction_width);
- variable arguns : UNSIGNED (fract'high + fraction_width + nguard
- downto 0) := (others => '0');
- begin -- function normalize
- arguns (arguns'high downto maximum (arguns'high-fract'length+1, 0)) :=
- UNSIGNED (to_slv (fract));
- result := normalize (fract => arguns,
- expon => expon,
- sign => sign,
- sticky => sticky,
- fraction_width => fraction_width,
- exponent_width => exponent_width,
- round_style => round_style,
- denormalize => denormalize,
- nguard => nguard);
- return result;
- end function normalize;
-
- -- purpose: normalizes a floating point number
- -- This version assumes a "ufixed" input with a "size_res" input
- function normalize (
- fract : ufixed; -- unsigned fixed point
- expon : SIGNED; -- exponent, normalized by -1
- sign : STD_ULOGIC; -- sign bit
- sticky : STD_ULOGIC := '0'; -- Sticky bit (rounding)
- size_res : UNRESOLVED_float; -- used for sizing only
- constant round_style : round_type := float_round_style; -- rounding option
- constant denormalize : BOOLEAN := float_denormalize; -- Use IEEE extended FP
- constant nguard : NATURAL := float_guard_bits) -- guard bits
- return UNRESOLVED_float is
- constant fraction_width : NATURAL := -size_res'low;
- constant exponent_width : NATURAL := size_res'high;
- variable result : UNRESOLVED_float (exponent_width downto -fraction_width);
- variable arguns : UNSIGNED (fract'high + fraction_width + nguard
- downto 0) := (others => '0');
- begin -- function normalize
- arguns (arguns'high downto maximum (arguns'high-fract'length+1, 0)) :=
- UNSIGNED (to_slv (fract));
- result := normalize (fract => arguns,
- expon => expon,
- sign => sign,
- sticky => sticky,
- fraction_width => fraction_width,
- exponent_width => exponent_width,
- round_style => round_style,
- denormalize => denormalize,
- nguard => nguard);
- return result;
- end function normalize;
-
- -- Regular "normalize" function with a "size_res" input.
- function normalize (
- fract : UNSIGNED; -- unsigned
- expon : SIGNED; -- exponent - 1, normalized
- sign : STD_ULOGIC; -- sign bit
- sticky : STD_ULOGIC := '0'; -- Sticky bit (rounding)
- size_res : UNRESOLVED_float; -- used for sizing only
- constant round_style : round_type := float_round_style; -- rounding option
- constant denormalize : BOOLEAN := float_denormalize; -- Use IEEE extended FP
- constant nguard : NATURAL := float_guard_bits) -- guard bits
- return UNRESOLVED_float is
- begin
- return normalize (fract => fract,
- expon => expon,
- sign => sign,
- sticky => sticky,
- fraction_width => -size_res'low,
- exponent_width => size_res'high,
- round_style => round_style,
- denormalize => denormalize,
- nguard => nguard);
- end function normalize;
-
- -- Returns the class which X falls into
- function Classfp (
- x : UNRESOLVED_float; -- floating point input
- check_error : BOOLEAN := float_check_error) -- check for errors
- return valid_fpstate is
- constant fraction_width : INTEGER := -mine(x'low, x'low); -- length of FP output fraction
- constant exponent_width : INTEGER := x'high; -- length of FP output exponent
- variable arg : UNRESOLVED_float (exponent_width downto -fraction_width);
- begin -- classfp
- if (arg'length < 1 or fraction_width < 3 or exponent_width < 3
- or x'left < x'right) then
- report "float_pkg:"
- & "CLASSFP: " &
- "Floating point number detected with a bad range"
- severity error;
- return isx;
- end if;
- -- Check for "X".
- arg := to_01 (x, 'X');
- if (arg(0) = 'X') then
- return isx; -- If there is an X in the number
- -- Special cases, check for illegal number
- elsif check_error and
- (and_reduce (STD_ULOGIC_VECTOR (arg (exponent_width-1 downto 0)))
- = '1') then -- Exponent is all "1".
- if or_reduce (to_slv (arg (-1 downto -fraction_width)))
- /= '0' then -- Fraction must be all "0" or this is not a number.
- if (arg(-1) = '1') then -- From "W. Khan - IEEE standard
- return nan; -- 754 binary FP Signaling nan (Not a number)
- else
- return quiet_nan;
- end if;
- -- Check for infinity
- elsif arg(exponent_width) = '0' then
- return pos_inf; -- Positive infinity
- else
- return neg_inf; -- Negative infinity
- end if;
- -- check for "0"
- elsif or_reduce (STD_LOGIC_VECTOR (arg (exponent_width-1 downto 0)))
- = '0' then -- Exponent is all "0"
- if or_reduce (to_slv (arg (-1 downto -fraction_width)))
- = '0' then -- Fraction is all "0"
- if arg(exponent_width) = '0' then
- return pos_zero; -- Zero
- else
- return neg_zero;
- end if;
- else
- if arg(exponent_width) = '0' then
- return pos_denormal; -- Denormal number (ieee extended fp)
- else
- return neg_denormal;
- end if;
- end if;
- else
- if arg(exponent_width) = '0' then
- return pos_normal; -- Normal FP number
- else
- return neg_normal;
- end if;
- end if;
- end function Classfp;
-
- procedure break_number (
- arg : in UNRESOLVED_float;
- denormalize : in BOOLEAN := float_denormalize;
- check_error : in BOOLEAN := float_check_error;
- fract : out UNSIGNED;
- expon : out SIGNED;
- sign : out STD_ULOGIC) is
- constant fraction_width : NATURAL := -mine(arg'low, arg'low); -- length of FP output fraction
- variable fptyp : valid_fpstate;
- begin
- fptyp := Classfp (arg, check_error);
- sign := to_x01(arg(arg'high));
- break_number (
- arg => arg,
- fptyp => fptyp,
- denormalize => denormalize,
- fract => fract,
- expon => expon);
- end procedure break_number;
-
- procedure break_number (
- arg : in UNRESOLVED_float;
- denormalize : in BOOLEAN := float_denormalize;
- check_error : in BOOLEAN := float_check_error;
- fract : out ufixed; -- 1 downto -fraction_width
- expon : out SIGNED; -- exponent_width-1 downto 0
- sign : out STD_ULOGIC) is
- constant fraction_width : NATURAL := -mine(arg'low, arg'low); -- length of FP output fraction
- variable fptyp : valid_fpstate;
- variable ufract : UNSIGNED (fraction_width downto 0); -- unsigned fraction
- begin
- fptyp := Classfp (arg, check_error);
- sign := to_x01(arg(arg'high));
- break_number (
- arg => arg,
- fptyp => fptyp,
- denormalize => denormalize,
- fract => ufract,
- expon => expon);
- fract (0 downto -fraction_width) := ufixed (ufract);
- end procedure break_number;
-
- -- Arithmetic functions
- function "abs" (
- arg : UNRESOLVED_float) -- floating point input
- return UNRESOLVED_float is
- variable result : UNRESOLVED_float (arg'range); -- result
- begin
- if (arg'length > 0) then
- result := to_01 (arg, 'X');
- result (arg'high) := '0'; -- set the sign bit to positive
- return result;
- else
- return NAFP;
- end if;
- end function "abs";
-
- -- IEEE 754 "negative" function
- function "-" (
- arg : UNRESOLVED_float) -- floating point input
- return UNRESOLVED_float is
- variable result : UNRESOLVED_float (arg'range); -- result
- begin
- if (arg'length > 0) then
- result := to_01 (arg, 'X');
- result (arg'high) := not result (arg'high); -- invert sign bit
- return result;
- else
- return NAFP;
- end if;
- end function "-";
-
- -- Addition, adds two floating point numbers
- function add (
- l, r : UNRESOLVED_float; -- floating point input
- constant round_style : round_type := float_round_style; -- rounding option
- constant guard : NATURAL := float_guard_bits; -- number of guard bits
- constant check_error : BOOLEAN := float_check_error; -- check for errors
- constant denormalize : BOOLEAN := float_denormalize) -- Use IEEE extended FP
- return UNRESOLVED_float is
- constant fraction_width : NATURAL := -mine(l'low, r'low); -- length of FP output fraction
- constant exponent_width : NATURAL := maximum(l'high, r'high); -- length of FP output exponent
- constant addguard : NATURAL := guard; -- add one guard bit
- variable lfptype, rfptype : valid_fpstate;
- variable fpresult : UNRESOLVED_float (exponent_width downto -fraction_width);
- variable fractl, fractr : UNSIGNED (fraction_width+1+addguard downto 0); -- fractions
- variable fractc, fracts : UNSIGNED (fractl'range); -- constant and shifted variables
- variable urfract, ulfract : UNSIGNED (fraction_width downto 0);
- variable ufract : UNSIGNED (fraction_width+1+addguard downto 0);
- variable exponl, exponr : SIGNED (exponent_width-1 downto 0); -- exponents
- variable rexpon : SIGNED (exponent_width downto 0); -- result exponent
- variable shiftx : SIGNED (exponent_width downto 0); -- shift fractions
- variable sign : STD_ULOGIC; -- sign of the output
- variable leftright : BOOLEAN; -- left or right used
- variable lresize, rresize : UNRESOLVED_float (exponent_width downto -fraction_width);
- variable sticky : STD_ULOGIC; -- Holds precision for rounding
- begin -- addition
- if (fraction_width = 0 or l'length < 7 or r'length < 7) then
- lfptype := isx;
- else
- lfptype := classfp (l, check_error);
- rfptype := classfp (r, check_error);
- end if;
- if (lfptype = isx or rfptype = isx) then
- fpresult := (others => 'X');
- elsif (lfptype = nan or lfptype = quiet_nan or
- rfptype = nan or rfptype = quiet_nan)
- -- Return quiet NAN, IEEE754-1985-7.1,1
- or (lfptype = pos_inf and rfptype = neg_inf)
- or (lfptype = neg_inf and rfptype = pos_inf) then
- -- Return quiet NAN, IEEE754-1985-7.1,2
- fpresult := qnanfp (fraction_width => fraction_width,
- exponent_width => exponent_width);
- elsif (lfptype = pos_inf or rfptype = pos_inf) then -- x + inf = inf
- fpresult := pos_inffp (fraction_width => fraction_width,
- exponent_width => exponent_width);
- elsif (lfptype = neg_inf or rfptype = neg_inf) then -- x - inf = -inf
- fpresult := neg_inffp (fraction_width => fraction_width,
- exponent_width => exponent_width);
- elsif (lfptype = neg_zero and rfptype = neg_zero) then -- -0 + -0 = -0
- fpresult := neg_zerofp (fraction_width => fraction_width,
- exponent_width => exponent_width);
- else
- lresize := resize (arg => to_x01(l),
- exponent_width => exponent_width,
- fraction_width => fraction_width,
- denormalize_in => denormalize,
- denormalize => denormalize);
- lfptype := classfp (lresize, false); -- errors already checked
- rresize := resize (arg => to_x01(r),
- exponent_width => exponent_width,
- fraction_width => fraction_width,
- denormalize_in => denormalize,
- denormalize => denormalize);
- rfptype := classfp (rresize, false); -- errors already checked
- break_number (
- arg => lresize,
- fptyp => lfptype,
- denormalize => denormalize,
- fract => ulfract,
- expon => exponl);
- fractl := (others => '0');
- fractl (fraction_width+addguard downto addguard) := ulfract;
- break_number (
- arg => rresize,
- fptyp => rfptype,
- denormalize => denormalize,
- fract => urfract,
- expon => exponr);
- fractr := (others => '0');
- fractr (fraction_width+addguard downto addguard) := urfract;
- shiftx := (exponl(exponent_width-1) & exponl) - exponr;
- if shiftx < -fractl'high then
- rexpon := exponr(exponent_width-1) & exponr;
- fractc := fractr;
- fracts := (others => '0'); -- add zero
- leftright := false;
- sticky := or_reduce (fractl);
- elsif shiftx < 0 then
- shiftx := - shiftx;
- fracts := shift_right (fractl, to_integer(shiftx));
- fractc := fractr;
- rexpon := exponr(exponent_width-1) & exponr;
- leftright := false;
--- sticky := or_reduce (fractl (to_integer(shiftx) downto 0));
- sticky := smallfract (fractl, to_integer(shiftx));
- elsif shiftx = 0 then
- rexpon := exponl(exponent_width-1) & exponl;
- sticky := '0';
- if fractr > fractl then
- fractc := fractr;
- fracts := fractl;
- leftright := false;
- else
- fractc := fractl;
- fracts := fractr;
- leftright := true;
- end if;
- elsif shiftx > fractr'high then
- rexpon := exponl(exponent_width-1) & exponl;
- fracts := (others => '0'); -- add zero
- fractc := fractl;
- leftright := true;
- sticky := or_reduce (fractr);
- elsif shiftx > 0 then
- fracts := shift_right (fractr, to_integer(shiftx));
- fractc := fractl;
- rexpon := exponl(exponent_width-1) & exponl;
- leftright := true;
--- sticky := or_reduce (fractr (to_integer(shiftx) downto 0));
- sticky := smallfract (fractr, to_integer(shiftx));
- end if;
- -- add
- fracts (0) := fracts (0) or sticky; -- Or the sticky bit into the LSB
- if l(l'high) = r(r'high) then
- ufract := fractc + fracts;
- sign := l(l'high);
- else -- signs are different
- ufract := fractc - fracts; -- always positive result
- if leftright then -- Figure out which sign to use
- sign := l(l'high);
- else
- sign := r(r'high);
- end if;
- end if;
- if or_reduce (ufract) = '0' then
- sign := '0'; -- IEEE 854, 6.3, paragraph 2.
- end if;
- -- normalize
- fpresult := normalize (fract => ufract,
- expon => rexpon,
- sign => sign,
- sticky => sticky,
- fraction_width => fraction_width,
- exponent_width => exponent_width,
- round_style => round_style,
- denormalize => denormalize,
- nguard => addguard);
- end if;
- return fpresult;
- end function add;
-
- -- Subtraction, Calls "add".
- function subtract (
- l, r : UNRESOLVED_float; -- floating point input
- constant round_style : round_type := float_round_style; -- rounding option
- constant guard : NATURAL := float_guard_bits; -- number of guard bits
- constant check_error : BOOLEAN := float_check_error; -- check for errors
- constant denormalize : BOOLEAN := float_denormalize) -- Use IEEE extended FP
- return UNRESOLVED_float is
- variable negr : UNRESOLVED_float (r'range); -- negative version of r
- begin
- negr := -r;
- return add (l => l,
- r => negr,
- round_style => round_style,
- guard => guard,
- check_error => check_error,
- denormalize => denormalize);
- end function subtract;
-
- -- Floating point multiply
- function multiply (
- l, r : UNRESOLVED_float; -- floating point input
- constant round_style : round_type := float_round_style; -- rounding option
- constant guard : NATURAL := float_guard_bits; -- number of guard bits
- constant check_error : BOOLEAN := float_check_error; -- check for errors
- constant denormalize : BOOLEAN := float_denormalize) -- Use IEEE extended FP
- return UNRESOLVED_float is
- constant fraction_width : NATURAL := -mine(l'low, r'low); -- length of FP output fraction
- constant exponent_width : NATURAL := maximum(l'high, r'high); -- length of FP output exponent
- constant multguard : NATURAL := guard; -- guard bits
- variable lfptype, rfptype : valid_fpstate;
- variable fpresult : UNRESOLVED_float (exponent_width downto -fraction_width);
- variable fractl, fractr : UNSIGNED (fraction_width downto 0); -- fractions
- variable rfract : UNSIGNED ((2*(fraction_width))+1 downto 0); -- result fraction
- variable sfract : UNSIGNED (fraction_width+1+multguard downto 0); -- result fraction
- variable shifty : INTEGER; -- denormal shift
- variable exponl, exponr : SIGNED (exponent_width-1 downto 0); -- exponents
- variable rexpon : SIGNED (exponent_width+1 downto 0); -- result exponent
- variable fp_sign : STD_ULOGIC; -- sign of result
- variable lresize, rresize : UNRESOLVED_float (exponent_width downto -fraction_width);
- variable sticky : STD_ULOGIC; -- Holds precision for rounding
- begin -- multiply
- if (fraction_width = 0 or l'length < 7 or r'length < 7) then
- lfptype := isx;
- else
- lfptype := classfp (l, check_error);
- rfptype := classfp (r, check_error);
- end if;
- if (lfptype = isx or rfptype = isx) then
- fpresult := (others => 'X');
- elsif ((lfptype = nan or lfptype = quiet_nan or
- rfptype = nan or rfptype = quiet_nan)) then
- -- Return quiet NAN, IEEE754-1985-7.1,1
- fpresult := qnanfp (fraction_width => fraction_width,
- exponent_width => exponent_width);
- elsif (((lfptype = pos_inf or lfptype = neg_inf) and
- (rfptype = pos_zero or rfptype = neg_zero)) or
- ((rfptype = pos_inf or rfptype = neg_inf) and
- (lfptype = pos_zero or lfptype = neg_zero))) then -- 0 * inf
- -- Return quiet NAN, IEEE754-1985-7.1,3
- fpresult := qnanfp (fraction_width => fraction_width,
- exponent_width => exponent_width);
- elsif (lfptype = pos_inf or rfptype = pos_inf
- or lfptype = neg_inf or rfptype = neg_inf) then -- x * inf = inf
- fpresult := pos_inffp (fraction_width => fraction_width,
- exponent_width => exponent_width);
- -- figure out the sign
- fp_sign := l(l'high) xor r(r'high); -- figure out the sign
- fpresult (exponent_width) := fp_sign;
- else
- fp_sign := l(l'high) xor r(r'high); -- figure out the sign
- lresize := resize (arg => to_x01(l),
- exponent_width => exponent_width,
- fraction_width => fraction_width,
- denormalize_in => denormalize,
- denormalize => denormalize);
- lfptype := classfp (lresize, false); -- errors already checked
- rresize := resize (arg => to_x01(r),
- exponent_width => exponent_width,
- fraction_width => fraction_width,
- denormalize_in => denormalize,
- denormalize => denormalize);
- rfptype := classfp (rresize, false); -- errors already checked
- break_number (
- arg => lresize,
- fptyp => lfptype,
- denormalize => denormalize,
- fract => fractl,
- expon => exponl);
- break_number (
- arg => rresize,
- fptyp => rfptype,
- denormalize => denormalize,
- fract => fractr,
- expon => exponr);
- if (rfptype = pos_denormal or rfptype = neg_denormal) then
- shifty := fraction_width - find_leftmost(fractr, '1');
- fractr := shift_left (fractr, shifty);
- elsif (lfptype = pos_denormal or lfptype = neg_denormal) then
- shifty := fraction_width - find_leftmost(fractl, '1');
- fractl := shift_left (fractl, shifty);
- else
- shifty := 0;
- -- Note that a denormal number * a denormal number is always zero.
- end if;
- -- multiply
- -- add the exponents
- rexpon := resize (exponl, rexpon'length) + exponr - shifty + 1;
- rfract := fractl * fractr; -- Multiply the fraction
- sfract := rfract (rfract'high downto
- rfract'high - (fraction_width+1+multguard));
- sticky := or_reduce (rfract (rfract'high-(fraction_width+1+multguard)
- downto 0));
- -- normalize
- fpresult := normalize (fract => sfract,
- expon => rexpon,
- sign => fp_sign,
- sticky => sticky,
- fraction_width => fraction_width,
- exponent_width => exponent_width,
- round_style => round_style,
- denormalize => denormalize,
- nguard => multguard);
- end if;
- return fpresult;
- end function multiply;
-
- function short_divide (
- lx, rx : UNSIGNED)
- return UNSIGNED is
- -- This is a special divider for the floating point routines.
- -- For a true unsigned divider, "stages" needs to = lx'high
- constant stages : INTEGER := lx'high - rx'high; -- number of stages
- variable partial : UNSIGNED (lx'range);
- variable q : UNSIGNED (stages downto 0);
- variable partial_argl : SIGNED (rx'high + 2 downto 0);
- variable partial_arg : SIGNED (rx'high + 2 downto 0);
- begin
- partial := lx;
- for i in stages downto 0 loop
- partial_argl := resize ("0" & SIGNED (partial(lx'high downto i)),
- partial_argl'length);
- partial_arg := partial_argl - SIGNED ("0" & rx);
- if (partial_arg (partial_arg'high) = '1') then -- negative
- q(i) := '0';
- else
- q(i) := '1';
- partial (lx'high+i-stages downto lx'high+i-stages-rx'high) :=
- UNSIGNED (partial_arg(rx'range));
- end if;
- end loop;
- -- to make the output look like that of the unsigned IEEE divide.
- return resize (q, lx'length);
- end function short_divide;
-
- -- 1/X function. Needed for algorithm development.
- function reciprocal (
- arg : UNRESOLVED_float;
- constant round_style : round_type := float_round_style; -- rounding option
- constant guard : NATURAL := float_guard_bits; -- number of guard bits
- constant check_error : BOOLEAN := float_check_error; -- check for errors
- constant denormalize : BOOLEAN := float_denormalize) -- Use IEEE extended FP
- return UNRESOLVED_float is
- constant fraction_width : NATURAL := -mine(arg'low, arg'low); -- length of FP output fraction
- constant exponent_width : NATURAL := arg'high; -- length of FP output exponent
- constant divguard : NATURAL := guard; -- guard bits
- function onedivy (
- arg : UNSIGNED)
- return UNSIGNED is
- variable q : UNSIGNED((2*arg'high)+1 downto 0);
- variable one : UNSIGNED (q'range);
- begin
- one := (others => '0');
- one(one'high) := '1';
- q := short_divide (one, arg); -- Unsigned divide
- return resize (q, arg'length+1);
- end function onedivy;
- variable fptype : valid_fpstate;
- variable expon : SIGNED (exponent_width-1 downto 0); -- exponents
- variable denorm_offset : NATURAL range 0 to 2;
- variable fract : UNSIGNED (fraction_width downto 0);
- variable fractg : UNSIGNED (fraction_width+divguard downto 0);
- variable sfract : UNSIGNED (fraction_width+1+divguard downto 0); -- result fraction
- variable fpresult : UNRESOLVED_float (exponent_width downto -fraction_width);
- begin -- reciprocal
- fptype := classfp(arg, check_error);
- classcase : case fptype is
- when isx =>
- fpresult := (others => 'X');
- when nan | quiet_nan =>
- -- Return quiet NAN, IEEE754-1985-7.1,1
- fpresult := qnanfp (fraction_width => fraction_width,
- exponent_width => exponent_width);
- when pos_inf | neg_inf => -- 1/inf, return 0
- fpresult := zerofp (fraction_width => fraction_width,
- exponent_width => exponent_width);
- when neg_zero | pos_zero => -- 1/0
- report "float_pkg:"
- & "RECIPROCAL: Floating Point divide by zero"
- severity error;
- fpresult := pos_inffp (fraction_width => fraction_width,
- exponent_width => exponent_width);
- when others =>
- if (fptype = pos_denormal or fptype = neg_denormal)
- and ((arg (-1) or arg(-2)) /= '1') then
- -- 1/denormal = infinity, with the exception of 2**-expon_base
- fpresult := pos_inffp (fraction_width => fraction_width,
- exponent_width => exponent_width);
- fpresult (exponent_width) := to_x01 (arg (exponent_width));
- else
- break_number (
- arg => arg,
- fptyp => fptype,
- denormalize => denormalize,
- fract => fract,
- expon => expon);
- fractg := (others => '0');
- if (fptype = pos_denormal or fptype = neg_denormal) then
- -- The reciprocal of a denormal number is typically zero,
- -- except for two special cases which are trapped here.
- if (to_x01(arg (-1)) = '1') then
- fractg (fractg'high downto divguard+1) :=
- fract (fract'high-1 downto 0); -- Shift to not denormal
- denorm_offset := 1; -- add 1 to exponent compensate
- else -- arg(-2) = '1'
- fractg (fractg'high downto divguard+2) :=
- fract (fract'high-2 downto 0); -- Shift to not denormal
- denorm_offset := 2; -- add 2 to exponent compensate
- end if;
- else
- fractg (fractg'high downto divguard) := fract;
- denorm_offset := 0;
- end if;
- expon := - expon - 3 + denorm_offset;
- sfract := onedivy (fractg);
- -- normalize
- fpresult := normalize (fract => sfract,
- expon => expon,
- sign => arg(exponent_width),
- sticky => '1',
- fraction_width => fraction_width,
- exponent_width => exponent_width,
- round_style => round_style,
- denormalize => denormalize,
- nguard => divguard);
- end if;
- end case classcase;
- return fpresult;
- end function reciprocal;
-
- -- floating point division
- function divide (
- l, r : UNRESOLVED_float; -- floating point input
- constant round_style : round_type := float_round_style; -- rounding option
- constant guard : NATURAL := float_guard_bits; -- number of guard bits
- constant check_error : BOOLEAN := float_check_error; -- check for errors
- constant denormalize : BOOLEAN := float_denormalize) -- Use IEEE extended FP
- return UNRESOLVED_float is
- constant fraction_width : NATURAL := -mine(l'low, r'low); -- length of FP output fraction
- constant exponent_width : NATURAL := maximum(l'high, r'high); -- length of FP output exponent
- constant divguard : NATURAL := guard; -- division guard bits
- variable lfptype, rfptype : valid_fpstate;
- variable fpresult : UNRESOLVED_float (exponent_width downto -fraction_width);
- variable ulfract, urfract : UNSIGNED (fraction_width downto 0);
- variable fractl : UNSIGNED ((2*(fraction_width+divguard)+1) downto 0); -- left
- variable fractr : UNSIGNED (fraction_width+divguard downto 0); -- right
- variable rfract : UNSIGNED (fractl'range); -- result fraction
- variable sfract : UNSIGNED (fraction_width+1+divguard downto 0); -- result fraction
- variable exponl, exponr : SIGNED (exponent_width-1 downto 0); -- exponents
- variable rexpon : SIGNED (exponent_width+1 downto 0); -- result exponent
- variable fp_sign, sticky : STD_ULOGIC; -- sign of result
- variable shifty, shiftx : INTEGER; -- denormal number shift
- variable lresize, rresize : UNRESOLVED_float (exponent_width downto -fraction_width);
- begin -- divide
- if (fraction_width = 0 or l'length < 7 or r'length < 7) then
- lfptype := isx;
- else
- lfptype := classfp (l, check_error);
- rfptype := classfp (r, check_error);
- end if;
- classcase : case rfptype is
- when isx =>
- fpresult := (others => 'X');
- when nan | quiet_nan =>
- -- Return quiet NAN, IEEE754-1985-7.1,1
- fpresult := qnanfp (fraction_width => fraction_width,
- exponent_width => exponent_width);
- when pos_inf | neg_inf =>
- if lfptype = pos_inf or lfptype = neg_inf -- inf / inf
- or lfptype = quiet_nan or lfptype = nan then
- -- Return quiet NAN, IEEE754-1985-7.1,4
- fpresult := qnanfp (fraction_width => fraction_width,
- exponent_width => exponent_width);
- else -- x / inf = 0
- fpresult := zerofp (fraction_width => fraction_width,
- exponent_width => exponent_width);
- fp_sign := l(l'high) xor r(r'high); -- sign
- fpresult (fpresult'high) := fp_sign; -- sign
- end if;
- when pos_zero | neg_zero =>
- if lfptype = pos_zero or lfptype = neg_zero -- 0 / 0
- or lfptype = quiet_nan or lfptype = nan then
- -- Return quiet NAN, IEEE754-1985-7.1,4
- fpresult := qnanfp (fraction_width => fraction_width,
- exponent_width => exponent_width);
- else
- report "float_pkg:"
- & "DIVIDE: Floating Point divide by zero"
- severity error;
- -- Infinity, define in 754-1985-7.2
- fpresult := pos_inffp (fraction_width => fraction_width,
- exponent_width => exponent_width);
- fp_sign := l(l'high) xor r(r'high); -- sign
- fpresult (fpresult'high) := fp_sign; -- sign
- end if;
- when others =>
- classcase2 : case lfptype is
- when isx =>
- fpresult := (others => 'X');
- when nan | quiet_nan =>
- -- Return quiet NAN, IEEE754-1985-7.1,1
- fpresult := qnanfp (fraction_width => fraction_width,
- exponent_width => exponent_width);
- when pos_inf | neg_inf => -- inf / x = inf
- fpresult := pos_inffp (fraction_width => fraction_width,
- exponent_width => exponent_width);
- fp_sign := l(l'high) xor r(r'high); -- sign
- fpresult(exponent_width) := fp_sign;
- when pos_zero | neg_zero => -- 0 / X = 0
- fpresult := zerofp (fraction_width => fraction_width,
- exponent_width => exponent_width);
- fp_sign := l(l'high) xor r(r'high); -- sign
- fpresult(exponent_width) := fp_sign;
- when others =>
- fp_sign := l(l'high) xor r(r'high); -- sign
- lresize := resize (arg => to_x01(l),
- exponent_width => exponent_width,
- fraction_width => fraction_width,
- denormalize_in => denormalize,
- denormalize => denormalize);
- lfptype := classfp (lresize, false); -- errors already checked
- rresize := resize (arg => to_x01(r),
- exponent_width => exponent_width,
- fraction_width => fraction_width,
- denormalize_in => denormalize,
- denormalize => denormalize);
- rfptype := classfp (rresize, false); -- errors already checked
- break_number (
- arg => lresize,
- fptyp => lfptype,
- denormalize => denormalize,
- fract => ulfract,
- expon => exponl);
- -- right side
- break_number (
- arg => rresize,
- fptyp => rfptype,
- denormalize => denormalize,
- fract => urfract,
- expon => exponr);
- -- Compute the exponent
- rexpon := resize (exponl, rexpon'length) - exponr - 2;
- if (rfptype = pos_denormal or rfptype = neg_denormal) then
- -- Do the shifting here not after. That way we have a smaller
- -- shifter, and need a smaller divider, because the top
- -- bit in the divisor will always be a "1".
- shifty := fraction_width - find_leftmost(urfract, '1');
- urfract := shift_left (urfract, shifty);
- rexpon := rexpon + shifty;
- end if;
- fractr := (others => '0');
- fractr (fraction_width+divguard downto divguard) := urfract;
- if (lfptype = pos_denormal or lfptype = neg_denormal) then
- shiftx := fraction_width - find_leftmost(ulfract, '1');
- ulfract := shift_left (ulfract, shiftx);
- rexpon := rexpon - shiftx;
- end if;
- fractl := (others => '0');
- fractl (fractl'high downto fractl'high-fraction_width) := ulfract;
- -- divide
- rfract := short_divide (fractl, fractr); -- unsigned divide
- sfract := rfract (sfract'range); -- lower bits
- sticky := '1';
- -- normalize
- fpresult := normalize (fract => sfract,
- expon => rexpon,
- sign => fp_sign,
- sticky => sticky,
- fraction_width => fraction_width,
- exponent_width => exponent_width,
- round_style => round_style,
- denormalize => denormalize,
- nguard => divguard);
- end case classcase2;
- end case classcase;
- return fpresult;
- end function divide;
-
- -- division by a power of 2
- function dividebyp2 (
- l, r : UNRESOLVED_float; -- floating point input
- constant round_style : round_type := float_round_style; -- rounding option
- constant guard : NATURAL := float_guard_bits; -- number of guard bits
- constant check_error : BOOLEAN := float_check_error; -- check for errors
- constant denormalize : BOOLEAN := float_denormalize) -- Use IEEE extended FP
- return UNRESOLVED_float is
- constant fraction_width : NATURAL := -mine(l'low, r'low); -- length of FP output fraction
- constant exponent_width : NATURAL := maximum(l'high, r'high); -- length of FP output exponent
- variable lfptype, rfptype : valid_fpstate;
- variable fpresult : UNRESOLVED_float (exponent_width downto -fraction_width);
- variable ulfract, urfract : UNSIGNED (fraction_width downto 0);
- variable exponl, exponr : SIGNED(exponent_width-1 downto 0); -- exponents
- variable rexpon : SIGNED(exponent_width downto 0); -- result exponent
- variable fp_sign : STD_ULOGIC; -- sign of result
- variable lresize, rresize : UNRESOLVED_float (exponent_width downto -fraction_width);
- begin -- divisionbyp2
- if (fraction_width = 0 or l'length < 7 or r'length < 7) then
- lfptype := isx;
- else
- lfptype := classfp (l, check_error);
- rfptype := classfp (r, check_error);
- end if;
- classcase : case rfptype is
- when isx =>
- fpresult := (others => 'X');
- when nan | quiet_nan =>
- -- Return quiet NAN, IEEE754-1985-7.1,1
- fpresult := qnanfp (fraction_width => fraction_width,
- exponent_width => exponent_width);
- when pos_inf | neg_inf =>
- if lfptype = pos_inf or lfptype = neg_inf then -- inf / inf
- -- Return quiet NAN, IEEE754-1985-7.1,4
- fpresult := qnanfp (fraction_width => fraction_width,
- exponent_width => exponent_width);
- else -- x / inf = 0
- fpresult := zerofp (fraction_width => fraction_width,
- exponent_width => exponent_width);
- fp_sign := l(l'high) xor r(r'high); -- sign
- fpresult (fpresult'high) := fp_sign; -- sign
- end if;
- when pos_zero | neg_zero =>
- if lfptype = pos_zero or lfptype = neg_zero then -- 0 / 0
- -- Return quiet NAN, IEEE754-1985-7.1,4
- fpresult := qnanfp (fraction_width => fraction_width,
- exponent_width => exponent_width);
- else
- report "float_pkg:"
- & "DIVIDEBYP2: Floating Point divide by zero"
- severity error;
- -- Infinity, define in 754-1985-7.2
- fpresult := pos_inffp (fraction_width => fraction_width,
- exponent_width => exponent_width);
- fp_sign := l(l'high) xor r(r'high); -- sign
- fpresult (fpresult'high) := fp_sign; -- sign
- end if;
- when others =>
- classcase2 : case lfptype is
- when isx =>
- fpresult := (others => 'X');
- when nan | quiet_nan =>
- -- Return quiet NAN, IEEE754-1985-7.1,1
- fpresult := qnanfp (fraction_width => fraction_width,
- exponent_width => exponent_width);
- when pos_inf | neg_inf => -- inf / x = inf
- fpresult := pos_inffp (fraction_width => fraction_width,
- exponent_width => exponent_width);
- fp_sign := l(l'high) xor r(r'high); -- sign
- fpresult (exponent_width) := fp_sign; -- sign
- when pos_zero | neg_zero => -- 0 / X = 0
- fpresult := zerofp (fraction_width => fraction_width,
- exponent_width => exponent_width);
- fp_sign := l(l'high) xor r(r'high); -- sign
- fpresult (exponent_width) := fp_sign; -- sign
- when others =>
- fp_sign := l(l'high) xor r(r'high); -- sign
- lresize := resize (arg => to_x01(l),
- exponent_width => exponent_width,
- fraction_width => fraction_width,
- denormalize_in => denormalize,
- denormalize => denormalize);
- lfptype := classfp (lresize, false); -- errors already checked
- rresize := resize (arg => to_x01(r),
- exponent_width => exponent_width,
- fraction_width => fraction_width,
- denormalize_in => denormalize,
- denormalize => denormalize);
- rfptype := classfp (rresize, false); -- errors already checked
- break_number (
- arg => lresize,
- fptyp => lfptype,
- denormalize => denormalize,
- fract => ulfract,
- expon => exponl);
- -- right side
- break_number (
- arg => rresize,
- fptyp => rfptype,
- denormalize => denormalize,
- fract => urfract,
- expon => exponr);
- assert (or_reduce (urfract (fraction_width-1 downto 0)) = '0')
- report "float_pkg:"
- & "DIVIDEBYP2: "
- & "Dividebyp2 called with a non power of two divisor"
- severity error;
- rexpon := (exponl(exponl'high)&exponl)
- - (exponr(exponr'high)&exponr) - 1;
- -- normalize
- fpresult := normalize (fract => ulfract,
- expon => rexpon,
- sign => fp_sign,
- sticky => '1',
- fraction_width => fraction_width,
- exponent_width => exponent_width,
- round_style => round_style,
- denormalize => denormalize,
- nguard => 0);
- end case classcase2;
- end case classcase;
- return fpresult;
- end function dividebyp2;
-
- -- Multiply accumulate result = l*r + c
- function mac (
- l, r, c : UNRESOLVED_float; -- floating point input
- constant round_style : round_type := float_round_style; -- rounding option
- constant guard : NATURAL := float_guard_bits; -- number of guard bits
- constant check_error : BOOLEAN := float_check_error; -- check for errors
- constant denormalize : BOOLEAN := float_denormalize) -- Use IEEE extended FP
- return UNRESOLVED_float is
- constant fraction_width : NATURAL :=
- -mine (mine(l'low, r'low), c'low); -- length of FP output fraction
- constant exponent_width : NATURAL :=
- maximum (maximum(l'high, r'high), c'high); -- length of FP output exponent
- variable lfptype, rfptype, cfptype : valid_fpstate;
- variable fpresult : UNRESOLVED_float (exponent_width downto -fraction_width);
- variable fractl, fractr : UNSIGNED (fraction_width downto 0); -- fractions
- variable fractx : UNSIGNED (fraction_width+guard downto 0);
- variable fractc, fracts : UNSIGNED (fraction_width+1+guard downto 0);
- variable rfract : UNSIGNED ((2*(fraction_width))+1 downto 0); -- result fraction
- variable sfract, ufract : UNSIGNED (fraction_width+1+guard downto 0); -- result fraction
- variable exponl, exponr, exponc : SIGNED (exponent_width-1 downto 0); -- exponents
- variable rexpon, rexpon2 : SIGNED (exponent_width+1 downto 0); -- result exponent
- variable shifty : INTEGER; -- denormal shift
- variable shiftx : SIGNED (rexpon'range); -- shift fractions
- variable fp_sign : STD_ULOGIC; -- sign of result
- variable lresize, rresize : UNRESOLVED_float (exponent_width downto -fraction_width);
- variable cresize : UNRESOLVED_float (exponent_width downto -fraction_width - guard);
- variable leftright : BOOLEAN; -- left or right used
- variable sticky : STD_ULOGIC; -- Holds precision for rounding
- begin -- multiply
- if (fraction_width = 0 or l'length < 7 or r'length < 7 or c'length < 7) then
- lfptype := isx;
- else
- lfptype := classfp (l, check_error);
- rfptype := classfp (r, check_error);
- cfptype := classfp (c, check_error);
- end if;
- if (lfptype = isx or rfptype = isx or cfptype = isx) then
- fpresult := (others => 'X');
- elsif (lfptype = nan or lfptype = quiet_nan or
- rfptype = nan or rfptype = quiet_nan or
- cfptype = nan or cfptype = quiet_nan) then
- -- Return quiet NAN, IEEE754-1985-7.1,1
- fpresult := qnanfp (fraction_width => fraction_width,
- exponent_width => exponent_width);
- elsif (((lfptype = pos_inf or lfptype = neg_inf) and
- (rfptype = pos_zero or rfptype = neg_zero)) or
- ((rfptype = pos_inf or rfptype = neg_inf) and
- (lfptype = pos_zero or lfptype = neg_zero))) then -- 0 * inf
- -- Return quiet NAN, IEEE754-1985-7.1,3
- fpresult := qnanfp (fraction_width => fraction_width,
- exponent_width => exponent_width);
- elsif (lfptype = pos_inf or rfptype = pos_inf
- or lfptype = neg_inf or rfptype = neg_inf -- x * inf = inf
- or cfptype = neg_inf or cfptype = pos_inf) then -- x + inf = inf
- fpresult := pos_inffp (fraction_width => fraction_width,
- exponent_width => exponent_width);
- -- figure out the sign
- fpresult (exponent_width) := l(l'high) xor r(r'high);
- else
- fp_sign := l(l'high) xor r(r'high); -- figure out the sign
- lresize := resize (arg => to_x01(l),
- exponent_width => exponent_width,
- fraction_width => fraction_width,
- denormalize_in => denormalize,
- denormalize => denormalize);
- lfptype := classfp (lresize, false); -- errors already checked
- rresize := resize (arg => to_x01(r),
- exponent_width => exponent_width,
- fraction_width => fraction_width,
- denormalize_in => denormalize,
- denormalize => denormalize);
- rfptype := classfp (rresize, false); -- errors already checked
- cresize := resize (arg => to_x01(c),
- exponent_width => exponent_width,
- fraction_width => -cresize'low,
- denormalize_in => denormalize,
- denormalize => denormalize);
- cfptype := classfp (cresize, false); -- errors already checked
- break_number (
- arg => lresize,
- fptyp => lfptype,
- denormalize => denormalize,
- fract => fractl,
- expon => exponl);
- break_number (
- arg => rresize,
- fptyp => rfptype,
- denormalize => denormalize,
- fract => fractr,
- expon => exponr);
- break_number (
- arg => cresize,
- fptyp => cfptype,
- denormalize => denormalize,
- fract => fractx,
- expon => exponc);
- if (rfptype = pos_denormal or rfptype = neg_denormal) then
- shifty := fraction_width - find_leftmost(fractr, '1');
- fractr := shift_left (fractr, shifty);
- elsif (lfptype = pos_denormal or lfptype = neg_denormal) then
- shifty := fraction_width - find_leftmost(fractl, '1');
- fractl := shift_left (fractl, shifty);
- else
- shifty := 0;
- -- Note that a denormal number * a denormal number is always zero.
- end if;
- -- multiply
- rfract := fractl * fractr; -- Multiply the fraction
- -- add the exponents
- rexpon := resize (exponl, rexpon'length) + exponr - shifty + 1;
- shiftx := rexpon - exponc;
- if shiftx < -fractl'high then
- rexpon2 := resize (exponc, rexpon2'length);
- fractc := "0" & fractx;
- fracts := (others => '0');
- sticky := or_reduce (rfract);
- elsif shiftx < 0 then
- shiftx := - shiftx;
- fracts := shift_right (rfract (rfract'high downto rfract'high
- - fracts'length+1),
- to_integer(shiftx));
- fractc := "0" & fractx;
- rexpon2 := resize (exponc, rexpon2'length);
- leftright := false;
- sticky := or_reduce (rfract (to_integer(shiftx)+rfract'high
- - fracts'length downto 0));
- elsif shiftx = 0 then
- rexpon2 := resize (exponc, rexpon2'length);
- sticky := or_reduce (rfract (rfract'high - fractc'length downto 0));
- if rfract (rfract'high downto rfract'high - fractc'length+1) > fractx
- then
- fractc := "0" & fractx;
- fracts := rfract (rfract'high downto rfract'high
- - fracts'length+1);
- leftright := false;
- else
- fractc := rfract (rfract'high downto rfract'high
- - fractc'length+1);
- fracts := "0" & fractx;
- leftright := true;
- end if;
- elsif shiftx > fractx'high then
- rexpon2 := rexpon;
- fracts := (others => '0');
- fractc := rfract (rfract'high downto rfract'high - fractc'length+1);
- leftright := true;
- sticky := or_reduce (fractx & rfract (rfract'high - fractc'length
- downto 0));
- else -- fractx'high > shiftx > 0
- rexpon2 := rexpon;
- fracts := "0" & shift_right (fractx, to_integer (shiftx));
- fractc := rfract (rfract'high downto rfract'high - fractc'length+1);
- leftright := true;
- sticky := or_reduce (fractx (to_integer (shiftx) downto 0)
- & rfract (rfract'high - fractc'length downto 0));
- end if;
- fracts (0) := fracts (0) or sticky; -- Or the sticky bit into the LSB
- if fp_sign = to_X01(c(c'high)) then
- ufract := fractc + fracts;
- fp_sign := fp_sign;
- else -- signs are different
- ufract := fractc - fracts; -- always positive result
- if leftright then -- Figure out which sign to use
- fp_sign := fp_sign;
- else
- fp_sign := c(c'high);
- end if;
- end if;
- -- normalize
- fpresult := normalize (fract => ufract,
- expon => rexpon2,
- sign => fp_sign,
- sticky => sticky,
- fraction_width => fraction_width,
- exponent_width => exponent_width,
- round_style => round_style,
- denormalize => denormalize,
- nguard => guard);
- end if;
- return fpresult;
- end function mac;
-
- -- "rem" function
--- function remainder (
--- l, r : UNRESOLVED_float; -- floating point input
--- constant round_style : round_type := float_round_style; -- rounding option
--- constant guard : NATURAL := float_guard_bits; -- number of guard bits
--- constant check_error : BOOLEAN := float_check_error; -- check for errors
--- constant denormalize : BOOLEAN := float_denormalize) -- Use IEEE extended FP
--- return UNRESOLVED_float is
--- constant fraction_width : NATURAL := -mine(l'low, r'low); -- length of FP output fraction
--- constant exponent_width : NATURAL := maximum(l'high, r'high); -- length of FP output exponent
--- constant divguard : NATURAL := guard; -- division guard bits
--- variable lfptype, rfptype : valid_fpstate;
--- variable fpresult : UNRESOLVED_float (exponent_width downto -fraction_width);
--- variable ulfract, urfract : UNSIGNED (fraction_width downto 0);
--- variable fractr, fractl : UNSIGNED (fraction_width+divguard downto 0); -- right
--- variable rfract : UNSIGNED (fractr'range); -- result fraction
--- variable sfract : UNSIGNED (fraction_width+divguard downto 0); -- result fraction
--- variable exponl, exponr : SIGNED (exponent_width-1 downto 0); -- exponents
--- variable rexpon : SIGNED (exponent_width downto 0); -- result exponent
--- variable fp_sign : STD_ULOGIC; -- sign of result
--- variable shifty : INTEGER; -- denormal number shift
--- variable lresize, rresize : UNRESOLVED_float (exponent_width downto -fraction_width);
--- begin -- remainder
--- if (fraction_width = 0 or l'length < 7 or r'length < 7) then
--- lfptype := isx;
--- else
--- lfptype := classfp (l, check_error);
--- rfptype := classfp (r, check_error);
--- end if;
--- if (lfptype = isx or rfptype = isx) then
--- fpresult := (others => 'X');
--- elsif (lfptype = nan or lfptype = quiet_nan)
--- or (rfptype = nan or rfptype = quiet_nan)
--- -- Return quiet NAN, IEEE754-1985-7.1,1
--- or (lfptype = pos_inf or lfptype = neg_inf) -- inf rem x
--- -- Return quiet NAN, IEEE754-1985-7.1,5
--- or (rfptype = pos_zero or rfptype = neg_zero) then -- x rem 0
--- -- Return quiet NAN, IEEE754-1985-7.1,5
--- fpresult := qnanfp (fraction_width => fraction_width,
--- exponent_width => exponent_width);
--- elsif (rfptype = pos_inf or rfptype = neg_inf) then -- x rem inf = 0
--- fpresult := zerofp (fraction_width => fraction_width,
--- exponent_width => exponent_width);
--- elsif (abs(l) < abs(r)) then
--- fpresult := l;
--- else
--- fp_sign := to_X01(l(l'high)); -- sign
--- lresize := resize (arg => to_x01(l),
--- exponent_width => exponent_width,
--- fraction_width => fraction_width,
--- denormalize_in => denormalize,
--- denormalize => denormalize);
--- lfptype := classfp (lresize, false); -- errors already checked
--- rresize := resize (arg => to_x01(r),
--- exponent_width => exponent_width,
--- fraction_width => fraction_width,
--- denormalize_in => denormalize,
--- denormalize => denormalize);
--- rfptype := classfp (rresize, false); -- errors already checked
--- fractl := (others => '0');
--- break_number (
--- arg => lresize,
--- fptyp => lfptype,
--- denormalize => denormalize,
--- fract => ulfract,
--- expon => exponl);
--- fractl (fraction_width+divguard downto divguard) := ulfract;
--- -- right side
--- fractr := (others => '0');
--- break_number (
--- arg => rresize,
--- fptyp => rfptype,
--- denormalize => denormalize,
--- fract => urfract,
--- expon => exponr);
--- fractr (fraction_width+divguard downto divguard) := urfract;
--- rexpon := (exponr(exponr'high)&exponr);
--- shifty := to_integer(exponl - rexpon);
--- if (shifty > 0) then
--- fractr := shift_right (fractr, shifty);
--- rexpon := rexpon + shifty;
--- end if;
--- if (fractr /= 0) then
--- -- rem
--- rfract := fractl rem fractr; -- unsigned rem
--- sfract := rfract (sfract'range); -- lower bits
--- -- normalize
--- fpresult := normalize (fract => sfract,
--- expon => rexpon,
--- sign => fp_sign,
--- fraction_width => fraction_width,
--- exponent_width => exponent_width,
--- round_style => round_style,
--- denormalize => denormalize,
--- nguard => divguard);
--- else
--- -- If we shift "fractr" so far that it becomes zero, return zero.
--- fpresult := zerofp (fraction_width => fraction_width,
--- exponent_width => exponent_width);
--- end if;
--- end if;
--- return fpresult;
--- end function remainder;
-
--- -- "mod" function
--- function modulo (
--- l, r : UNRESOLVED_float; -- floating point input
--- constant round_style : round_type := float_round_style; -- rounding option
--- constant guard : NATURAL := float_guard_bits; -- number of guard bits
--- constant check_error : BOOLEAN := float_check_error; -- check for errors
--- constant denormalize : BOOLEAN := float_denormalize) -- Use IEEE extended FP
--- return UNRESOLVED_float is
--- constant fraction_width : NATURAL := - mine(l'low, r'low); -- length of FP output fraction
--- constant exponent_width : NATURAL := maximum(l'high, r'high); -- length of FP output exponent
--- variable lfptype, rfptype : valid_fpstate;
--- variable fpresult : UNRESOLVED_float (exponent_width downto -fraction_width);
--- variable remres : UNRESOLVED_float (exponent_width downto -fraction_width);
--- begin -- remainder
--- if (fraction_width = 0 or l'length < 7 or r'length < 7) then
--- lfptype := isx;
--- else
--- lfptype := classfp (l, check_error);
--- rfptype := classfp (r, check_error);
--- end if;
--- if (lfptype = isx or rfptype = isx) then
--- fpresult := (others => 'X');
--- elsif (lfptype = nan or lfptype = quiet_nan)
--- or (rfptype = nan or rfptype = quiet_nan)
--- -- Return quiet NAN, IEEE754-1985-7.1,1
--- or (lfptype = pos_inf or lfptype = neg_inf) -- inf rem x
--- -- Return quiet NAN, IEEE754-1985-7.1,5
--- or (rfptype = pos_zero or rfptype = neg_zero) then -- x rem 0
--- -- Return quiet NAN, IEEE754-1985-7.1,5
--- fpresult := qnanfp (fraction_width => fraction_width,
--- exponent_width => exponent_width);
--- elsif (rfptype = pos_inf or rfptype = neg_inf) then -- x rem inf = 0
--- fpresult := zerofp (fraction_width => fraction_width,
--- exponent_width => exponent_width);
--- else
--- remres := remainder (l => abs(l),
--- r => abs(r),
--- round_style => round_style,
--- guard => guard,
--- check_error => false,
--- denormalize => denormalize);
--- -- MOD is the same as REM, but you do something different with
--- -- negative values
--- if (is_negative (l)) then
--- remres := - remres;
--- end if;
--- if (is_negative (l) = is_negative (r) or remres = 0) then
--- fpresult := remres;
--- else
--- fpresult := add (l => remres,
--- r => r,
--- round_style => round_style,
--- guard => guard,
--- check_error => false,
--- denormalize => denormalize);
--- end if;
--- end if;
--- return fpresult;
--- end function modulo;
-
- -- Square root of a floating point number. Done using Newton's Iteration.
--- function sqrt (
--- arg : UNRESOLVED_float; -- floating point input
--- constant round_style : round_type := float_round_style;
--- constant guard : NATURAL := float_guard_bits;
--- constant check_error : BOOLEAN := float_check_error;
--- constant denormalize : BOOLEAN := float_denormalize)
--- return UNRESOLVED_float is
--- constant fraction_width : NATURAL := guard-arg'low; -- length of FP output fraction
--- constant exponent_width : NATURAL := arg'high; -- length of FP output exponent
--- variable sign : STD_ULOGIC;
--- variable fpresult : float (arg'range);
--- variable fptype : valid_fpstate;
--- variable iexpon : SIGNED(exponent_width-1 downto 0); -- exponents
--- variable expon : SIGNED(exponent_width downto 0); -- exponents
--- variable ufact : ufixed (0 downto arg'low);
--- variable fact : ufixed (2 downto -fraction_width); -- fraction
--- variable resb : ufixed (fact'high+1 downto fact'low);
--- begin -- square root
--- fptype := Classfp (arg, check_error);
--- classcase : case fptype is
--- when isx =>
--- fpresult := (others => 'X');
--- when nan | quiet_nan |
--- -- Return quiet NAN, IEEE754-1985-7.1,1
--- neg_normal | neg_denormal | neg_inf => -- sqrt (neg)
--- -- Return quiet NAN, IEEE754-1985-7.1.6
--- fpresult := qnanfp (fraction_width => fraction_width-guard,
--- exponent_width => exponent_width);
--- when pos_inf => -- Sqrt (inf), return infinity
--- fpresult := pos_inffp (fraction_width => fraction_width-guard,
--- exponent_width => exponent_width);
--- when pos_zero => -- return 0
--- fpresult := zerofp (fraction_width => fraction_width-guard,
--- exponent_width => exponent_width);
--- when neg_zero => -- IEEE754-1985-6.3 return -0
--- fpresult := neg_zerofp (fraction_width => fraction_width-guard,
--- exponent_width => exponent_width);
--- when others =>
--- break_number (arg => arg,
--- denormalize => denormalize,
--- check_error => false,
--- fract => ufact,
--- expon => iexpon,
--- sign => sign);
--- expon := resize (iexpon+1, expon'length); -- get exponent
--- fact := resize (ufact, fact'high, fact'low);
--- if (expon(0) = '1') then
--- fact := fact sla 1; -- * 2.0
--- end if;
--- expon := shift_right (expon, 1); -- exponent/2
--- -- Newton's iteration - root := (1 + arg) / 2
--- resb := (fact + 1) sra 1;
--- for j in 0 to fraction_width/4 loop
--- -- root := (root + (arg/root))/2
--- resb := resize (arg => (resb + (fact/resb)) sra 1,
--- left_index => resb'high,
--- right_index => resb'low,
--- round_style => fixed_truncate,
--- overflow_style => fixed_wrap);
--- end loop;
--- fpresult := normalize (fract => resb,
--- expon => expon-1,
--- sign => '0',
--- exponent_width => arg'high,
--- fraction_width => -arg'low,
--- round_style => round_style,
--- denormalize => denormalize,
--- nguard => guard);
--- end case classcase;
--- return fpresult;
--- end function sqrt;
-
- function Is_Negative (arg : UNRESOLVED_float) return BOOLEAN is
- -- Technically -0 should return "false", but I'm leaving that case out.
- begin
- return (to_x01(arg(arg'high)) = '1');
- end function Is_Negative;
-
- -- compare functions
- -- =, /=, >=, <=, <, >
-
- function eq ( -- equal =
- l, r : UNRESOLVED_float; -- floating point input
- constant check_error : BOOLEAN := float_check_error;
- constant denormalize : BOOLEAN := float_denormalize)
- return BOOLEAN is
- variable lfptype, rfptype : valid_fpstate;
- variable is_equal, is_unordered : BOOLEAN;
- constant fraction_width : NATURAL := -mine(l'low, r'low); -- length of FP output fraction
- constant exponent_width : NATURAL := maximum(l'high, r'high); -- length of FP output exponent
- variable lresize, rresize : UNRESOLVED_float (exponent_width downto -fraction_width);
- begin -- equal
- if (fraction_width = 0 or l'length < 7 or r'length < 7) then
- return false;
- else
- lfptype := classfp (l, check_error);
- rfptype := classfp (r, check_error);
- end if;
- if (lfptype = neg_zero or lfptype = pos_zero) and
- (rfptype = neg_zero or rfptype = pos_zero) then
- is_equal := true;
- else
- lresize := resize (arg => to_x01(l),
- exponent_width => exponent_width,
- fraction_width => fraction_width,
- denormalize_in => denormalize,
- denormalize => denormalize);
- rresize := resize (arg => to_x01(r),
- exponent_width => exponent_width,
- fraction_width => fraction_width,
- denormalize_in => denormalize,
- denormalize => denormalize);
- is_equal := (to_slv(lresize) = to_slv(rresize));
- end if;
- if (check_error) then
- is_unordered := Unordered (x => l,
- y => r);
- else
- is_unordered := false;
- end if;
- return is_equal and not is_unordered;
- end function eq;
-
- function lt ( -- less than <
- l, r : UNRESOLVED_float; -- floating point input
- constant check_error : BOOLEAN := float_check_error;
- constant denormalize : BOOLEAN := float_denormalize)
- return BOOLEAN is
- constant fraction_width : NATURAL := -mine(l'low, r'low); -- length of FP output fraction
- constant exponent_width : NATURAL := maximum(l'high, r'high); -- length of FP output exponent
- variable lfptype, rfptype : valid_fpstate;
- variable expl, expr : UNSIGNED (exponent_width-1 downto 0);
- variable fractl, fractr : UNSIGNED (fraction_width-1 downto 0);
- variable is_less_than, is_unordered : BOOLEAN;
- variable lresize, rresize : UNRESOLVED_float (exponent_width downto -fraction_width);
- begin
- if (fraction_width = 0 or l'length < 7 or r'length < 7) then
- is_less_than := false;
- else
- lresize := resize (arg => to_x01(l),
- exponent_width => exponent_width,
- fraction_width => fraction_width,
- denormalize_in => denormalize,
- denormalize => denormalize);
- rresize := resize (arg => to_x01(r),
- exponent_width => exponent_width,
- fraction_width => fraction_width,
- denormalize_in => denormalize,
- denormalize => denormalize);
- if to_x01(l(l'high)) = to_x01(r(r'high)) then -- sign bits
- expl := UNSIGNED(lresize(exponent_width-1 downto 0));
- expr := UNSIGNED(rresize(exponent_width-1 downto 0));
- if expl = expr then
- fractl := UNSIGNED (to_slv(lresize(-1 downto -fraction_width)));
- fractr := UNSIGNED (to_slv(rresize(-1 downto -fraction_width)));
- if to_x01(l(l'high)) = '0' then -- positive number
- is_less_than := (fractl < fractr);
- else
- is_less_than := (fractl > fractr); -- negative
- end if;
- else
- if to_x01(l(l'high)) = '0' then -- positive number
- is_less_than := (expl < expr);
- else
- is_less_than := (expl > expr); -- negative
- end if;
- end if;
- else
- lfptype := classfp (l, check_error);
- rfptype := classfp (r, check_error);
- if (lfptype = neg_zero and rfptype = pos_zero) then
- is_less_than := false; -- -0 < 0 returns false.
- else
- is_less_than := (to_x01(l(l'high)) > to_x01(r(r'high)));
- end if;
- end if;
- end if;
- if check_error then
- is_unordered := Unordered (x => l,
- y => r);
- else
- is_unordered := false;
- end if;
- return is_less_than and not is_unordered;
- end function lt;
-
- function gt ( -- greater than >
- l, r : UNRESOLVED_float; -- floating point input
- constant check_error : BOOLEAN := float_check_error;
- constant denormalize : BOOLEAN := float_denormalize)
- return BOOLEAN is
- constant fraction_width : NATURAL := -mine(l'low, r'low); -- length of FP output fraction
- constant exponent_width : NATURAL := maximum(l'high, r'high); -- length of FP output exponent
- variable lfptype, rfptype : valid_fpstate;
- variable expl, expr : UNSIGNED (exponent_width-1 downto 0);
- variable fractl, fractr : UNSIGNED (fraction_width-1 downto 0);
- variable is_greater_than : BOOLEAN;
- variable is_unordered : BOOLEAN;
- variable lresize, rresize : UNRESOLVED_float (exponent_width downto -fraction_width);
- begin -- greater_than
- if (fraction_width = 0 or l'length < 7 or r'length < 7) then
- is_greater_than := false;
- else
- lresize := resize (arg => to_x01(l),
- exponent_width => exponent_width,
- fraction_width => fraction_width,
- denormalize_in => denormalize,
- denormalize => denormalize);
- rresize := resize (arg => to_x01(r),
- exponent_width => exponent_width,
- fraction_width => fraction_width,
- denormalize_in => denormalize,
- denormalize => denormalize);
- if to_x01(l(l'high)) = to_x01(r(r'high)) then -- sign bits
- expl := UNSIGNED(lresize(exponent_width-1 downto 0));
- expr := UNSIGNED(rresize(exponent_width-1 downto 0));
- if expl = expr then
- fractl := UNSIGNED (to_slv(lresize(-1 downto -fraction_width)));
- fractr := UNSIGNED (to_slv(rresize(-1 downto -fraction_width)));
- if to_x01(l(l'high)) = '0' then -- positive number
- is_greater_than := fractl > fractr;
- else
- is_greater_than := fractl < fractr; -- negative
- end if;
- else
- if to_x01(l(l'high)) = '0' then -- positive number
- is_greater_than := expl > expr;
- else
- is_greater_than := expl < expr; -- negative
- end if;
- end if;
- else
- lfptype := classfp (l, check_error);
- rfptype := classfp (r, check_error);
- if (lfptype = pos_zero and rfptype = neg_zero) then
- is_greater_than := false; -- 0 > -0 returns false.
- else
- is_greater_than := to_x01(l(l'high)) < to_x01(r(r'high));
- end if;
- end if;
- end if;
- if check_error then
- is_unordered := Unordered (x => l,
- y => r);
- else
- is_unordered := false;
- end if;
- return is_greater_than and not is_unordered;
- end function gt;
-
- -- purpose: /= function
- function ne ( -- not equal /=
- l, r : UNRESOLVED_float;
- constant check_error : BOOLEAN := float_check_error;
- constant denormalize : BOOLEAN := float_denormalize)
- return BOOLEAN is
- variable is_equal, is_unordered : BOOLEAN;
- begin
- is_equal := eq (l => l,
- r => r,
- check_error => false,
- denormalize => denormalize);
- if check_error then
- is_unordered := Unordered (x => l,
- y => r);
- else
- is_unordered := false;
- end if;
- return not (is_equal and not is_unordered);
- end function ne;
-
- function le ( -- less than or equal to <=
- l, r : UNRESOLVED_float; -- floating point input
- constant check_error : BOOLEAN := float_check_error;
- constant denormalize : BOOLEAN := float_denormalize)
- return BOOLEAN is
- variable is_greater_than, is_unordered : BOOLEAN;
- begin
- is_greater_than := gt (l => l,
- r => r,
- check_error => false,
- denormalize => denormalize);
- if check_error then
- is_unordered := Unordered (x => l,
- y => r);
- else
- is_unordered := false;
- end if;
- return not is_greater_than and not is_unordered;
- end function le;
-
- function ge ( -- greater than or equal to >=
- l, r : UNRESOLVED_float; -- floating point input
- constant check_error : BOOLEAN := float_check_error;
- constant denormalize : BOOLEAN := float_denormalize)
- return BOOLEAN is
- variable is_less_than, is_unordered : BOOLEAN;
- begin
- is_less_than := lt (l => l,
- r => r,
- check_error => false,
- denormalize => denormalize);
- if check_error then
- is_unordered := Unordered (x => l,
- y => r);
- else
- is_unordered := false;
- end if;
- return not is_less_than and not is_unordered;
- end function ge;
-
- function \?=\ (L, R : UNRESOLVED_float) return STD_ULOGIC is
- constant fraction_width : NATURAL := -mine(l'low, r'low); -- length of FP output fraction
- constant exponent_width : NATURAL := maximum(l'high, r'high); -- length of FP output exponent
- variable lfptype, rfptype : valid_fpstate;
- variable is_equal, is_unordered : STD_ULOGIC;
- variable lresize, rresize : UNRESOLVED_float (exponent_width downto -fraction_width);
- begin -- ?=
- if (fraction_width = 0 or l'length < 7 or r'length < 7) then
- return 'X';
- else
- lfptype := classfp (l, float_check_error);
- rfptype := classfp (r, float_check_error);
- end if;
- if (lfptype = neg_zero or lfptype = pos_zero) and
- (rfptype = neg_zero or rfptype = pos_zero) then
- is_equal := '1';
- else
- lresize := resize (arg => l,
- exponent_width => exponent_width,
- fraction_width => fraction_width,
- denormalize_in => float_denormalize,
- denormalize => float_denormalize);
- rresize := resize (arg => r,
- exponent_width => exponent_width,
- fraction_width => fraction_width,
- denormalize_in => float_denormalize,
- denormalize => float_denormalize);
- is_equal := \?=\ (to_sulv(lresize), to_sulv(rresize));
- end if;
- if (float_check_error) then
- if (lfptype = nan or lfptype = quiet_nan or
- rfptype = nan or rfptype = quiet_nan) then
- is_unordered := '1';
- else
- is_unordered := '0';
- end if;
- else
- is_unordered := '0';
- end if;
- return is_equal and not is_unordered;
- end function \?=\;
-
- function \?/=\ (L, R : UNRESOLVED_float) return STD_ULOGIC is
- constant fraction_width : NATURAL := -mine(l'low, r'low); -- length of FP output fraction
- constant exponent_width : NATURAL := maximum(l'high, r'high); -- length of FP output exponent
- variable lfptype, rfptype : valid_fpstate;
- variable is_equal, is_unordered : STD_ULOGIC;
- variable lresize, rresize : UNRESOLVED_float (exponent_width downto -fraction_width);
- begin -- ?/=
- if (fraction_width = 0 or l'length < 7 or r'length < 7) then
- return 'X';
- else
- lfptype := classfp (l, float_check_error);
- rfptype := classfp (r, float_check_error);
- end if;
- if (lfptype = neg_zero or lfptype = pos_zero) and
- (rfptype = neg_zero or rfptype = pos_zero) then
- is_equal := '1';
- else
- lresize := resize (arg => l,
- exponent_width => exponent_width,
- fraction_width => fraction_width,
- denormalize_in => float_denormalize,
- denormalize => float_denormalize);
- rresize := resize (arg => r,
- exponent_width => exponent_width,
- fraction_width => fraction_width,
- denormalize_in => float_denormalize,
- denormalize => float_denormalize);
- is_equal := \?=\ (to_sulv(lresize), to_sulv(rresize));
- end if;
- if (float_check_error) then
- if (lfptype = nan or lfptype = quiet_nan or
- rfptype = nan or rfptype = quiet_nan) then
- is_unordered := '1';
- else
- is_unordered := '0';
- end if;
- else
- is_unordered := '0';
- end if;
- return not (is_equal and not is_unordered);
- end function \?/=\;
-
- function \?>\ (L, R : UNRESOLVED_float) return STD_ULOGIC is
- constant fraction_width : NATURAL := -mine(l'low, r'low);
- variable founddash : BOOLEAN := false;
- begin
- if (fraction_width = 0 or l'length < 7 or r'length < 7) then
- return 'X';
- else
- for i in L'range loop
- if L(i) = '-' then
- founddash := true;
- end if;
- end loop;
- for i in R'range loop
- if R(i) = '-' then
- founddash := true;
- end if;
- end loop;
- if founddash then
- report "float_pkg:"
- & " ""?>"": '-' found in compare string"
- severity error;
- return 'X';
- elsif is_x(l) or is_x(r) then
- return 'X';
- elsif l > r then
- return '1';
- else
- return '0';
- end if;
- end if;
- end function \?>\;
-
- function \?>=\ (L, R : UNRESOLVED_float) return STD_ULOGIC is
- constant fraction_width : NATURAL := -mine(l'low, r'low);
- variable founddash : BOOLEAN := false;
- begin
- if (fraction_width = 0 or l'length < 7 or r'length < 7) then
- return 'X';
- else
- for i in L'range loop
- if L(i) = '-' then
- founddash := true;
- end if;
- end loop;
- for i in R'range loop
- if R(i) = '-' then
- founddash := true;
- end if;
- end loop;
- if founddash then
- report "float_pkg:"
- & " ""?>="": '-' found in compare string"
- severity error;
- return 'X';
- elsif is_x(l) or is_x(r) then
- return 'X';
- elsif l >= r then
- return '1';
- else
- return '0';
- end if;
- end if;
- end function \?>=\;
-
- function \?<\ (L, R : UNRESOLVED_float) return STD_ULOGIC is
- constant fraction_width : NATURAL := -mine(l'low, r'low);
- variable founddash : BOOLEAN := false;
- begin
- if (fraction_width = 0 or l'length < 7 or r'length < 7) then
- return 'X';
- else
- for i in L'range loop
- if L(i) = '-' then
- founddash := true;
- end if;
- end loop;
- for i in R'range loop
- if R(i) = '-' then
- founddash := true;
- end if;
- end loop;
- if founddash then
- report "float_pkg:"
- & " ""?<"": '-' found in compare string"
- severity error;
- return 'X';
- elsif is_x(l) or is_x(r) then
- return 'X';
- elsif l < r then
- return '1';
- else
- return '0';
- end if;
- end if;
- end function \?<\;
-
- function \?<=\ (L, R : UNRESOLVED_float) return STD_ULOGIC is
- constant fraction_width : NATURAL := -mine(l'low, r'low);
- variable founddash : BOOLEAN := false;
- begin
- if (fraction_width = 0 or l'length < 7 or r'length < 7) then
- return 'X';
- else
- for i in L'range loop
- if L(i) = '-' then
- founddash := true;
- end if;
- end loop;
- for i in R'range loop
- if R(i) = '-' then
- founddash := true;
- end if;
- end loop;
- if founddash then
- report "float_pkg:"
- & " ""?<="": '-' found in compare string"
- severity error;
- return 'X';
- elsif is_x(l) or is_x(r) then
- return 'X';
- elsif l <= r then
- return '1';
- else
- return '0';
- end if;
- end if;
- end function \?<=\;
-
- function std_match (L, R : UNRESOLVED_float) return BOOLEAN is
- begin
- if (L'high = R'high and L'low = R'low) then
- return std_match(to_sulv(L), to_sulv(R));
- else
- report "float_pkg:"
- & "STD_MATCH: L'RANGE /= R'RANGE, returning FALSE"
- severity warning;
- return false;
- end if;
- end function std_match;
-
- function find_rightmost (arg : UNRESOLVED_float; y : STD_ULOGIC) return INTEGER is
- begin
- for_loop : for i in arg'reverse_range loop
- if arg(i) = y then
- return i;
- end if;
- end loop;
- return arg'high+1; -- return out of bounds 'high
- end function find_rightmost;
-
- function find_leftmost (arg : UNRESOLVED_float; y : STD_ULOGIC) return INTEGER is
- begin
- for_loop : for i in arg'range loop
- if arg(i) = y then
- return i;
- end if;
- end loop;
- return arg'low-1; -- return out of bounds 'low
- end function find_leftmost;
-
- -- These override the defaults for the compare operators.
- function "=" (l, r : UNRESOLVED_float) return BOOLEAN is
- begin
- return eq(l, r);
- end function "=";
-
- function "/=" (l, r : UNRESOLVED_float) return BOOLEAN is
- begin
- return ne(l, r);
- end function "/=";
-
- function ">=" (l, r : UNRESOLVED_float) return BOOLEAN is
- begin
- return ge(l, r);
- end function ">=";
-
- function "<=" (l, r : UNRESOLVED_float) return BOOLEAN is
- begin
- return le(l, r);
- end function "<=";
-
- function ">" (l, r : UNRESOLVED_float) return BOOLEAN is
- begin
- return gt(l, r);
- end function ">";
-
- function "<" (l, r : UNRESOLVED_float) return BOOLEAN is
- begin
- return lt(l, r);
- end function "<";
-
- -- purpose: maximum of two numbers (overrides default)
- function maximum (
- L, R : UNRESOLVED_float)
- return UNRESOLVED_float is
- constant fraction_width : NATURAL := -mine(l'low, r'low); -- length of FP output fraction
- constant exponent_width : NATURAL := maximum(l'high, r'high); -- length of FP output exponent
- variable lresize, rresize : UNRESOLVED_float (exponent_width downto -fraction_width);
- begin
- if ((L'length < 1) or (R'length < 1)) then return NAFP;
- end if;
- lresize := resize (l, exponent_width, fraction_width);
- rresize := resize (r, exponent_width, fraction_width);
- if lresize > rresize then return lresize;
- else return rresize;
- end if;
- end function maximum;
-
- function minimum (
- L, R : UNRESOLVED_float)
- return UNRESOLVED_float is
- constant fraction_width : NATURAL := -mine(l'low, r'low); -- length of FP output fraction
- constant exponent_width : NATURAL := maximum(l'high, r'high); -- length of FP output exponent
- variable lresize, rresize : UNRESOLVED_float (exponent_width downto -fraction_width);
- begin
- if ((L'length < 1) or (R'length < 1)) then return NAFP;
- end if;
- lresize := resize (l, exponent_width, fraction_width);
- rresize := resize (r, exponent_width, fraction_width);
- if lresize > rresize then return rresize;
- else return lresize;
- end if;
- end function minimum;
-
- -----------------------------------------------------------------------------
- -- conversion functions
- -----------------------------------------------------------------------------
-
- -- Converts a floating point number of one format into another format
- function resize (
- arg : UNRESOLVED_float; -- Floating point input
- constant exponent_width : NATURAL := float_exponent_width; -- length of FP output exponent
- constant fraction_width : NATURAL := float_fraction_width; -- length of FP output fraction
- constant round_style : round_type := float_round_style; -- rounding option
- constant check_error : BOOLEAN := float_check_error;
- constant denormalize_in : BOOLEAN := float_denormalize; -- Use IEEE extended FP
- constant denormalize : BOOLEAN := float_denormalize) -- Use IEEE extended FP
- return UNRESOLVED_float is
- constant in_fraction_width : NATURAL := -arg'low; -- length of FP output fraction
- constant in_exponent_width : NATURAL := arg'high; -- length of FP output exponent
- variable result : UNRESOLVED_float (exponent_width downto -fraction_width);
- -- result value
- variable fptype : valid_fpstate;
- variable expon_in : SIGNED (in_exponent_width-1 downto 0);
- variable fract_in : UNSIGNED (in_fraction_width downto 0);
- variable round : BOOLEAN;
- variable expon_out : SIGNED (exponent_width-1 downto 0); -- output fract
- variable fract_out : UNSIGNED (fraction_width downto 0); -- output fract
- variable passguard : NATURAL;
- begin
- fptype := classfp(arg, check_error);
- if ((fptype = pos_denormal or fptype = neg_denormal) and denormalize_in
- and (in_exponent_width < exponent_width
- or in_fraction_width < fraction_width))
- or in_exponent_width > exponent_width
- or in_fraction_width > fraction_width then
- -- size reduction
- classcase : case fptype is
- when isx =>
- result := (others => 'X');
- when nan | quiet_nan =>
- result := qnanfp (fraction_width => fraction_width,
- exponent_width => exponent_width);
- when pos_inf =>
- result := pos_inffp (fraction_width => fraction_width,
- exponent_width => exponent_width);
- when neg_inf =>
- result := neg_inffp (fraction_width => fraction_width,
- exponent_width => exponent_width);
- when pos_zero | neg_zero =>
- result := zerofp (fraction_width => fraction_width, -- hate -0
- exponent_width => exponent_width);
- when others =>
- break_number (
- arg => arg,
- fptyp => fptype,
- denormalize => denormalize_in,
- fract => fract_in,
- expon => expon_in);
- if fraction_width > in_fraction_width and denormalize_in then
- -- You only get here if you have a denormal input
- fract_out := (others => '0'); -- pad with zeros
- fract_out (fraction_width downto
- fraction_width - in_fraction_width) := fract_in;
- result := normalize (
- fract => fract_out,
- expon => expon_in,
- sign => arg(arg'high),
- fraction_width => fraction_width,
- exponent_width => exponent_width,
- round_style => round_style,
- denormalize => denormalize,
- nguard => 0);
- else
- result := normalize (
- fract => fract_in,
- expon => expon_in,
- sign => arg(arg'high),
- fraction_width => fraction_width,
- exponent_width => exponent_width,
- round_style => round_style,
- denormalize => denormalize,
- nguard => in_fraction_width - fraction_width);
- end if;
- end case classcase;
- else -- size increase or the same size
- if exponent_width > in_exponent_width then
- expon_in := SIGNED(arg (in_exponent_width-1 downto 0));
- if fptype = pos_zero or fptype = neg_zero then
- result (exponent_width-1 downto 0) := (others => '0');
- elsif expon_in = -1 then -- inf or nan (shorts out check_error)
- result (exponent_width-1 downto 0) := (others => '1');
- else
- -- invert top BIT
- expon_in(expon_in'high) := not expon_in(expon_in'high);
- expon_out := resize (expon_in, expon_out'length); -- signed expand
- -- Flip it back.
- expon_out(expon_out'high) := not expon_out(expon_out'high);
- result (exponent_width-1 downto 0) := UNRESOLVED_float(expon_out);
- end if;
- result (exponent_width) := arg (in_exponent_width); -- sign
- else -- exponent_width = in_exponent_width
- result (exponent_width downto 0) := arg (in_exponent_width downto 0);
- end if;
- if fraction_width > in_fraction_width then
- result (-1 downto -fraction_width) := (others => '0'); -- zeros
- result (-1 downto -in_fraction_width) :=
- arg (-1 downto -in_fraction_width);
- else -- fraction_width = in_fraciton_width
- result (-1 downto -fraction_width) :=
- arg (-1 downto -in_fraction_width);
- end if;
- end if;
- return result;
- end function resize;
-
- function resize (
- arg : UNRESOLVED_float; -- floating point input
- size_res : UNRESOLVED_float;
- constant round_style : round_type := float_round_style; -- rounding option
- constant check_error : BOOLEAN := float_check_error;
- constant denormalize_in : BOOLEAN := float_denormalize; -- Use IEEE extended FP
- constant denormalize : BOOLEAN := float_denormalize) -- Use IEEE extended FP
- return UNRESOLVED_float is
- variable result : UNRESOLVED_float (size_res'left downto size_res'right);
- begin
- if (result'length < 1) then
- return result;
- else
- result := resize (arg => arg,
- exponent_width => size_res'high,
- fraction_width => -size_res'low,
- round_style => round_style,
- check_error => check_error,
- denormalize_in => denormalize_in,
- denormalize => denormalize);
- return result;
- end if;
- end function resize;
-
- function to_float32 (
- arg : UNRESOLVED_float;
- constant round_style : round_type := float_round_style; -- rounding option
- constant check_error : BOOLEAN := float_check_error;
- constant denormalize_in : BOOLEAN := float_denormalize; -- Use IEEE extended FP
- constant denormalize : BOOLEAN := float_denormalize) -- Use IEEE extended FP
- return UNRESOLVED_float32 is
- begin
- return resize (arg => arg,
- exponent_width => float32'high,
- fraction_width => -float32'low,
- round_style => round_style,
- check_error => check_error,
- denormalize_in => denormalize_in,
- denormalize => denormalize);
- end function to_float32;
-
- function to_float64 (
- arg : UNRESOLVED_float;
- constant round_style : round_type := float_round_style; -- rounding option
- constant check_error : BOOLEAN := float_check_error;
- constant denormalize_in : BOOLEAN := float_denormalize; -- Use IEEE extended FP
- constant denormalize : BOOLEAN := float_denormalize) -- Use IEEE extended FP
- return UNRESOLVED_float64 is
- begin
- return resize (arg => arg,
- exponent_width => float64'high,
- fraction_width => -float64'low,
- round_style => round_style,
- check_error => check_error,
- denormalize_in => denormalize_in,
- denormalize => denormalize);
- end function to_float64;
-
- function to_float128 (
- arg : UNRESOLVED_float;
- constant round_style : round_type := float_round_style; -- rounding option
- constant check_error : BOOLEAN := float_check_error;
- constant denormalize_in : BOOLEAN := float_denormalize; -- Use IEEE extended FP
- constant denormalize : BOOLEAN := float_denormalize) -- Use IEEE extended FP
- return UNRESOLVED_float128 is
- begin
- return resize (arg => arg,
- exponent_width => float128'high,
- fraction_width => -float128'low,
- round_style => round_style,
- check_error => check_error,
- denormalize_in => denormalize_in,
- denormalize => denormalize);
- end function to_float128;
-
- -- to_float (Real)
- -- typically not Synthesizable unless the input is a constant.
- function to_float (
- arg : REAL;
- constant exponent_width : NATURAL := float_exponent_width; -- length of FP output exponent
- constant fraction_width : NATURAL := float_fraction_width; -- length of FP output fraction
- constant round_style : round_type := float_round_style; -- rounding option
- constant denormalize : BOOLEAN := float_denormalize) -- Use IEEE extended FP
- return UNRESOLVED_float is
- variable result : UNRESOLVED_float (exponent_width downto -fraction_width);
- variable arg_real : REAL; -- Real version of argument
- variable validfp : boundary_type; -- Check for valid results
- variable exp : INTEGER; -- Integer version of exponent
- variable expon : UNSIGNED (exponent_width - 1 downto 0);
- -- Unsigned version of exp.
- constant expon_base : SIGNED (exponent_width-1 downto 0) :=
- gen_expon_base(exponent_width); -- exponent offset
- variable fract : UNSIGNED (fraction_width-1 downto 0);
- variable frac : REAL; -- Real version of fraction
- constant roundfrac : REAL := 2.0 ** (-2 - fract'high); -- used for rounding
- variable round : BOOLEAN; -- to round or not to round
- begin
- result := (others => '0');
- arg_real := arg;
- if arg_real < 0.0 then
- result (exponent_width) := '1';
- arg_real := - arg_real; -- Make it positive.
- else
- result (exponent_width) := '0';
- end if;
- test_boundary (arg => arg_real,
- fraction_width => fraction_width,
- exponent_width => exponent_width,
- denormalize => denormalize,
- btype => validfp,
- log2i => exp);
- if validfp = zero then
- return result; -- Result initialized to "0".
- elsif validfp = infinity then
- result (exponent_width - 1 downto 0) := (others => '1'); -- Exponent all "1"
- -- return infinity.
- return result;
- else
- if validfp = denormal then -- Exponent will default to "0".
- expon := (others => '0');
- frac := arg_real * (2.0 ** (to_integer(expon_base)-1));
- else -- Number less than 1. "normal" number
- expon := UNSIGNED (to_signed (exp-1, exponent_width));
- expon(exponent_width-1) := not expon(exponent_width-1);
- frac := (arg_real / 2.0 ** exp) - 1.0; -- Number less than 1.
- end if;
- for i in 0 to fract'high loop
- if frac >= 2.0 ** (-1 - i) then
- fract (fract'high - i) := '1';
- frac := frac - 2.0 ** (-1 - i);
- else
- fract (fract'high - i) := '0';
- end if;
- end loop;
- round := false;
- case round_style is
- when round_nearest =>
- if frac > roundfrac or ((frac = roundfrac) and fract(0) = '1') then
- round := true;
- end if;
- when round_inf =>
- if frac /= 0.0 and result(exponent_width) = '0' then
- round := true;
- end if;
- when round_neginf =>
- if frac /= 0.0 and result(exponent_width) = '1' then
- round := true;
- end if;
- when others =>
- null; -- don't round
- end case;
- if (round) then
- if and_reduce (fract) = '1' then -- fraction is all "1"
- expon := expon + 1;
- fract := (others => '0');
- else
- fract := fract + 1;
- end if;
- end if;
- result (exponent_width-1 downto 0) := UNRESOLVED_float(expon);
- result (-1 downto -fraction_width) := UNRESOLVED_float(fract);
- return result;
- end if;
- end function to_float;
-
- -- to_float (Integer)
- function to_float (
- arg : INTEGER;
- constant exponent_width : NATURAL := float_exponent_width; -- length of FP output exponent
- constant fraction_width : NATURAL := float_fraction_width; -- length of FP output fraction
- constant round_style : round_type := float_round_style) -- rounding option
- return UNRESOLVED_float is
- variable result : UNRESOLVED_float (exponent_width downto -fraction_width);
- variable arg_int : NATURAL; -- Natural version of argument
- variable expon : SIGNED (exponent_width-1 downto 0);
- variable exptmp : SIGNED (exponent_width-1 downto 0);
- -- Unsigned version of exp.
- constant expon_base : SIGNED (exponent_width-1 downto 0) :=
- gen_expon_base(exponent_width); -- exponent offset
- variable fract : UNSIGNED (fraction_width-1 downto 0) := (others => '0');
- variable fracttmp : UNSIGNED (fraction_width-1 downto 0);
- variable round : BOOLEAN;
- variable shift : NATURAL;
- variable shiftr : NATURAL;
- variable roundfrac : NATURAL; -- used in rounding
- begin
- if arg < 0 then
- result (exponent_width) := '1';
- arg_int := -arg; -- Make it positive.
- else
- result (exponent_width) := '0';
- arg_int := arg;
- end if;
- if arg_int = 0 then
- result := zerofp (fraction_width => fraction_width,
- exponent_width => exponent_width);
- else
- -- If the number is larger than we can represent in this number system
- -- we need to return infinity.
- shift := log2(arg_int);
- if shift > to_integer(expon_base) then
- -- worry about infinity
- if result (exponent_width) = '0' then
- result := pos_inffp (fraction_width => fraction_width,
- exponent_width => exponent_width);
- else
- -- return negative infinity.
- result := neg_inffp (fraction_width => fraction_width,
- exponent_width => exponent_width);
- end if;
- else -- Normal number (can't be denormal)
- -- Compute Exponent
- expon := to_signed (shift-1, expon'length); -- positive fraction.
- -- Compute Fraction
- arg_int := arg_int - 2**shift; -- Subtract off the 1.0
- shiftr := shift;
- for I in fract'high downto maximum (fract'high - shift + 1, 0) loop
- shiftr := shiftr - 1;
- if (arg_int >= 2**shiftr) then
- arg_int := arg_int - 2**shiftr;
- fract(I) := '1';
- else
- fract(I) := '0';
- end if;
- end loop;
- -- Rounding routine
- round := false;
- if arg_int > 0 then
- roundfrac := 2**(shiftr-1);
- case round_style is
- when round_nearest =>
- if arg_int > roundfrac or
- ((arg_int = roundfrac) and fract(0) = '1') then
- round := true;
- end if;
- when round_inf =>
- if arg_int /= 0 and result (exponent_width) = '0' then
- round := true;
- end if;
- when round_neginf =>
- if arg_int /= 0 and result (exponent_width) = '1' then
- round := true;
- end if;
- when others =>
- null;
- end case;
- end if;
- if round then
- fp_round(fract_in => fract,
- expon_in => expon,
- fract_out => fracttmp,
- expon_out => exptmp);
- fract := fracttmp;
- expon := exptmp;
- end if;
- -- Put the number together and return
- expon(exponent_width-1) := not expon(exponent_width-1);
- result (exponent_width-1 downto 0) := UNRESOLVED_float(expon);
- result (-1 downto -fraction_width) := UNRESOLVED_float(fract);
- end if;
- end if;
- return result;
- end function to_float;
-
- -- to_float (unsigned)
- function to_float (
- arg : UNSIGNED;
- constant exponent_width : NATURAL := float_exponent_width; -- length of FP output exponent
- constant fraction_width : NATURAL := float_fraction_width; -- length of FP output fraction
- constant round_style : round_type := float_round_style) -- rounding option
- return UNRESOLVED_float is
- variable result : UNRESOLVED_float (exponent_width downto -fraction_width);
- constant ARG_LEFT : INTEGER := ARG'length-1;
- alias XARG : UNSIGNED(ARG_LEFT downto 0) is ARG;
- variable sarg : SIGNED (ARG_LEFT+1 downto 0); -- signed version of arg
- begin
- if arg'length < 1 then
- return NAFP;
- end if;
- sarg (XARG'range) := SIGNED (XARG);
- sarg (sarg'high) := '0';
- result := to_float (arg => sarg,
- exponent_width => exponent_width,
- fraction_width => fraction_width,
- round_style => round_style);
- return result;
- end function to_float;
-
- -- to_float (signed)
- function to_float (
- arg : SIGNED;
- constant exponent_width : NATURAL := float_exponent_width; -- length of FP output exponent
- constant fraction_width : NATURAL := float_fraction_width; -- length of FP output fraction
- constant round_style : round_type := float_round_style) -- rounding option
- return UNRESOLVED_float is
- variable result : UNRESOLVED_float (exponent_width downto -fraction_width);
- constant ARG_LEFT : INTEGER := ARG'length-1;
- alias XARG : SIGNED(ARG_LEFT downto 0) is ARG;
- variable arg_int : UNSIGNED(xarg'range); -- Real version of argument
- variable argb2 : UNSIGNED(xarg'high/2 downto 0); -- log2 of input
- variable rexp : SIGNED (exponent_width - 1 downto 0);
- variable exp : SIGNED (exponent_width - 1 downto 0);
- -- signed version of exp.
- variable expon : UNSIGNED (exponent_width - 1 downto 0);
- -- Unsigned version of exp.
- constant expon_base : SIGNED (exponent_width-1 downto 0) :=
- gen_expon_base(exponent_width); -- exponent offset
- variable round : BOOLEAN;
- variable fract : UNSIGNED (fraction_width-1 downto 0);
- variable rfract : UNSIGNED (fraction_width-1 downto 0);
- variable sign : STD_ULOGIC; -- sign bit
- begin
- if arg'length < 1 then
- return NAFP;
- end if;
- if Is_X (xarg) then
- result := (others => 'X');
- elsif (xarg = 0) then
- result := zerofp (fraction_width => fraction_width,
- exponent_width => exponent_width);
- else -- Normal number (can't be denormal)
- sign := to_X01(xarg (xarg'high));
- arg_int := UNSIGNED(abs (to_01(xarg)));
- -- Compute Exponent
- argb2 := to_unsigned(find_leftmost(arg_int, '1'), argb2'length); -- Log2
- if argb2 > UNSIGNED(expon_base) then
- result := pos_inffp (fraction_width => fraction_width,
- exponent_width => exponent_width);
- result (exponent_width) := sign;
- else
- exp := SIGNED(resize(argb2, exp'length));
- arg_int := shift_left (arg_int, arg_int'high-to_integer(exp));
- if (arg_int'high > fraction_width) then
- fract := arg_int (arg_int'high-1 downto (arg_int'high-fraction_width));
- round := check_round (
- fract_in => fract (0),
- sign => sign,
- remainder => arg_int((arg_int'high-fraction_width-1)
- downto 0),
- round_style => round_style);
- if round then
- fp_round(fract_in => fract,
- expon_in => exp,
- fract_out => rfract,
- expon_out => rexp);
- else
- rfract := fract;
- rexp := exp;
- end if;
- else
- rexp := exp;
- rfract := (others => '0');
- rfract (fraction_width-1 downto fraction_width-1-(arg_int'high-1)) :=
- arg_int (arg_int'high-1 downto 0);
- end if;
- result (exponent_width) := sign;
- expon := UNSIGNED (rexp-1);
- expon(exponent_width-1) := not expon(exponent_width-1);
- result (exponent_width-1 downto 0) := UNRESOLVED_float(expon);
- result (-1 downto -fraction_width) := UNRESOLVED_float(rfract);
- end if;
- end if;
- return result;
- end function to_float;
-
- -- std_logic_vector to float
- function to_float (
- arg : STD_ULOGIC_VECTOR;
- constant exponent_width : NATURAL := float_exponent_width; -- length of FP output exponent
- constant fraction_width : NATURAL := float_fraction_width) -- length of FP output fraction
- return UNRESOLVED_float is
- variable fpvar : UNRESOLVED_float (exponent_width downto -fraction_width);
- begin
- if arg'length < 1 then
- return NAFP;
- end if;
- fpvar := UNRESOLVED_float(arg);
- return fpvar;
- end function to_float;
-
- -- purpose: converts a ufixed to a floating point
- function to_float (
- arg : UNRESOLVED_ufixed; -- unsigned fixed point input
- constant exponent_width : NATURAL := float_exponent_width; -- width of exponent
- constant fraction_width : NATURAL := float_fraction_width; -- width of fraction
- constant round_style : round_type := float_round_style; -- rounding
- constant denormalize : BOOLEAN := float_denormalize) -- use ieee extensions
- return UNRESOLVED_float is
- variable sarg : sfixed (arg'high+1 downto arg'low); -- Signed version of arg
- variable result : UNRESOLVED_float (exponent_width downto -fraction_width);
- begin -- function to_float
- if (arg'length < 1) then
- return NAFP;
- end if;
- sarg (arg'range) := sfixed (arg);
- sarg (sarg'high) := '0';
- result := to_float (arg => sarg,
- exponent_width => exponent_width,
- fraction_width => fraction_width,
- round_style => round_style,
- denormalize => denormalize);
- return result;
- end function to_float;
-
- function to_float (
- arg : UNRESOLVED_sfixed; -- signed fixed point
- constant exponent_width : NATURAL := float_exponent_width; -- length of FP output exponent
- constant fraction_width : NATURAL := float_fraction_width; -- length of FP output fraction
- constant round_style : round_type := float_round_style; -- rounding
- constant denormalize : BOOLEAN := float_denormalize) -- rounding option
- return UNRESOLVED_float is
- constant integer_width : INTEGER := arg'high;
- constant in_fraction_width : INTEGER := arg'low;
- variable xresult : sfixed (integer_width downto in_fraction_width);
- variable result : UNRESOLVED_float (exponent_width downto -fraction_width);
- variable arg_int : UNSIGNED(integer_width - in_fraction_width
- downto 0); -- unsigned version of argument
- variable argx : SIGNED (integer_width - in_fraction_width downto 0);
- variable exp, exptmp : SIGNED (exponent_width downto 0);
- variable expon : UNSIGNED (exponent_width - 1 downto 0);
- -- Unsigned version of exp.
- constant expon_base : SIGNED (exponent_width-1 downto 0) :=
- gen_expon_base(exponent_width); -- exponent offset
- variable fract, fracttmp : UNSIGNED (fraction_width-1 downto 0) :=
- (others => '0');
- variable round : BOOLEAN := false;
- begin
- if (arg'length < 1) then
- return NAFP;
- end if;
- xresult := to_01(arg, 'X');
- argx := SIGNED(to_slv(xresult));
- if (Is_X (arg)) then
- result := (others => 'X');
- elsif (argx = 0) then
- result := (others => '0');
- else
- result := (others => '0'); -- zero out the result
- if argx(argx'left) = '1' then -- toss the sign bit
- result (exponent_width) := '1'; -- Negative number
- arg_int := UNSIGNED(to_x01(not STD_LOGIC_VECTOR (argx))) + 1; -- Make it positive with two's complement
- else
- result (exponent_width) := '0';
- arg_int := UNSIGNED(to_x01(STD_LOGIC_VECTOR (argx))); -- new line: direct conversion to unsigned
- end if;
- -- Compute Exponent
- exp := to_signed(find_leftmost(arg_int, '1'), exp'length); -- Log2
- if exp + in_fraction_width > expon_base then -- return infinity
- result (-1 downto -fraction_width) := (others => '0');
- result (exponent_width -1 downto 0) := (others => '1');
- return result;
- elsif (denormalize and
- (exp + in_fraction_width <= -resize(expon_base, exp'length))) then
- exp := -resize(expon_base, exp'length);
- -- shift by a constant
- arg_int := shift_left (arg_int,
- (arg_int'high + to_integer(expon_base)
- + in_fraction_width - 1));
- if (arg_int'high > fraction_width) then
- fract := arg_int (arg_int'high-1 downto (arg_int'high-fraction_width));
- round := check_round (
- fract_in => arg_int(arg_int'high-fraction_width),
- sign => result(result'high),
- remainder => arg_int((arg_int'high-fraction_width-1)
- downto 0),
- round_style => round_style);
- if (round) then
- fp_round (fract_in => arg_int (arg_int'high-1 downto
- (arg_int'high-fraction_width)),
- expon_in => exp,
- fract_out => fract,
- expon_out => exptmp);
- exp := exptmp;
- end if;
- else
- fract (fraction_width-1 downto fraction_width-1-(arg_int'high-1)) :=
- arg_int (arg_int'high-1 downto 0);
- end if;
- else
- arg_int := shift_left (arg_int, arg_int'high-to_integer(exp));
- exp := exp + in_fraction_width;
- if (arg_int'high > fraction_width) then
- fract := arg_int (arg_int'high-1 downto (arg_int'high-fraction_width));
- round := check_round (
- fract_in => fract(0),
- sign => result(result'high),
- remainder => arg_int((arg_int'high-fraction_width-1)
- downto 0),
- round_style => round_style);
- if (round) then
- fp_round (fract_in => fract,
- expon_in => exp,
- fract_out => fracttmp,
- expon_out => exptmp);
- fract := fracttmp;
- exp := exptmp;
- end if;
- else
- fract (fraction_width-1 downto fraction_width-1-(arg_int'high-1)) :=
- arg_int (arg_int'high-1 downto 0);
- end if;
- end if;
- expon := UNSIGNED (resize(exp-1, exponent_width));
- expon(exponent_width-1) := not expon(exponent_width-1);
- result (exponent_width-1 downto 0) := UNRESOLVED_float(expon);
- result (-1 downto -fraction_width) := UNRESOLVED_float(fract);
- end if;
- return result;
- end function to_float;
-
- -- size_res functions
- -- Integer to float
- function to_float (
- arg : INTEGER;
- size_res : UNRESOLVED_float;
- constant round_style : round_type := float_round_style) -- rounding option
- return UNRESOLVED_float is
- variable result : UNRESOLVED_float (size_res'left downto size_res'right);
- begin
- if (result'length < 1) then
- return result;
- else
- result := to_float (arg => arg,
- exponent_width => size_res'high,
- fraction_width => -size_res'low,
- round_style => round_style);
- return result;
- end if;
- end function to_float;
-
- -- real to float
- function to_float (
- arg : REAL;
- size_res : UNRESOLVED_float;
- constant round_style : round_type := float_round_style; -- rounding option
- constant denormalize : BOOLEAN := float_denormalize) -- Use IEEE extended FP
- return UNRESOLVED_float is
- variable result : UNRESOLVED_float (size_res'left downto size_res'right);
- begin
- if (result'length < 1) then
- return result;
- else
- result := to_float (arg => arg,
- exponent_width => size_res'high,
- fraction_width => -size_res'low,
- round_style => round_style,
- denormalize => denormalize);
- return result;
- end if;
- end function to_float;
-
- -- unsigned to float
- function to_float (
- arg : UNSIGNED;
- size_res : UNRESOLVED_float;
- constant round_style : round_type := float_round_style) -- rounding option
- return UNRESOLVED_float is
- variable result : UNRESOLVED_float (size_res'left downto size_res'right);
- begin
- if (result'length < 1) then
- return result;
- else
- result := to_float (arg => arg,
- exponent_width => size_res'high,
- fraction_width => -size_res'low,
- round_style => round_style);
- return result;
- end if;
- end function to_float;
-
- -- signed to float
- function to_float (
- arg : SIGNED;
- size_res : UNRESOLVED_float;
- constant round_style : round_type := float_round_style) -- rounding
- return UNRESOLVED_float is
- variable result : UNRESOLVED_float (size_res'left downto size_res'right);
- begin
- if (result'length < 1) then
- return result;
- else
- result := to_float (arg => arg,
- exponent_width => size_res'high,
- fraction_width => -size_res'low,
- round_style => round_style);
- return result;
- end if;
- end function to_float;
-
- -- std_ulogic_vector to float
- function to_float (
- arg : STD_ULOGIC_VECTOR;
- size_res : UNRESOLVED_float)
- return UNRESOLVED_float is
- variable result : UNRESOLVED_float (size_res'left downto size_res'right);
- begin
- if (result'length < 1) then
- return result;
- else
- result := to_float (arg => arg,
- exponent_width => size_res'high,
- fraction_width => -size_res'low);
- return result;
- end if;
- end function to_float;
-
- -- unsigned fixed point to float
- function to_float (
- arg : UNRESOLVED_ufixed; -- unsigned fixed point input
- size_res : UNRESOLVED_float;
- constant round_style : round_type := float_round_style; -- rounding
- constant denormalize : BOOLEAN := float_denormalize) -- use ieee extensions
- return UNRESOLVED_float is
- variable result : UNRESOLVED_float (size_res'left downto size_res'right);
- begin
- if (result'length < 1) then
- return result;
- else
- result := to_float (arg => arg,
- exponent_width => size_res'high,
- fraction_width => -size_res'low,
- round_style => round_style,
- denormalize => denormalize);
- return result;
- end if;
- end function to_float;
-
- -- signed fixed point to float
- function to_float (
- arg : UNRESOLVED_sfixed;
- size_res : UNRESOLVED_float;
- constant round_style : round_type := float_round_style; -- rounding
- constant denormalize : BOOLEAN := float_denormalize) -- rounding option
- return UNRESOLVED_float is
- variable result : UNRESOLVED_float (size_res'left downto size_res'right);
- begin
- if (result'length < 1) then
- return result;
- else
- result := to_float (arg => arg,
- exponent_width => size_res'high,
- fraction_width => -size_res'low,
- round_style => round_style,
- denormalize => denormalize);
- return result;
- end if;
- end function to_float;
-
- -- to_integer (float)
- function to_integer (
- arg : UNRESOLVED_float; -- floating point input
- constant round_style : round_type := float_round_style; -- rounding option
- constant check_error : BOOLEAN := float_check_error) -- check for errors
- return INTEGER is
- variable validfp : valid_fpstate; -- Valid FP state
- variable frac : UNSIGNED (-arg'low downto 0); -- Fraction
- variable fract : UNSIGNED (1-arg'low downto 0); -- Fraction
- variable expon : SIGNED (arg'high-1 downto 0);
- variable isign : STD_ULOGIC; -- internal version of sign
- variable round : STD_ULOGIC; -- is rounding needed?
- variable result : INTEGER;
- variable base : INTEGER; -- Integer exponent
- begin
- validfp := classfp (arg, check_error);
- classcase : case validfp is
- when isx | nan | quiet_nan | pos_zero | neg_zero | pos_denormal | neg_denormal =>
- result := 0; -- return 0
- when pos_inf =>
- result := INTEGER'high;
- when neg_inf =>
- result := INTEGER'low;
- when others =>
- break_number (
- arg => arg,
- fptyp => validfp,
- denormalize => false,
- fract => frac,
- expon => expon);
- fract (fract'high) := '0'; -- Add extra bit for 0.6 case
- fract (fract'high-1 downto 0) := frac;
- isign := to_x01 (arg (arg'high));
- base := to_integer (expon) + 1;
- if base < -1 then
- result := 0;
- elsif base >= frac'high then
- result := to_integer (fract) * 2**(base - frac'high);
- else -- We need to round
- if base = -1 then -- trap for 0.6 case.
- result := 0;
- else
- result := to_integer (fract (frac'high downto frac'high-base));
- end if;
- -- rounding routine
- case round_style is
- when round_nearest =>
- if frac'high - base > 1 then
- round := fract (frac'high - base - 1) and
- (fract (frac'high - base)
- or (or_reduce (fract (frac'high - base - 2 downto 0))));
- else
- round := fract (frac'high - base - 1) and
- fract (frac'high - base);
- end if;
- when round_inf =>
- round := fract(frac'high - base - 1) and not isign;
- when round_neginf =>
- round := fract(frac'high - base - 1) and isign;
- when others =>
- round := '0';
- end case;
- if round = '1' then
- result := result + 1;
- end if;
- end if;
- if isign = '1' then
- result := - result;
- end if;
- end case classcase;
- return result;
- end function to_integer;
-
- -- to_unsigned (float)
- function to_unsigned (
- arg : UNRESOLVED_float; -- floating point input
- constant size : NATURAL; -- length of output
- constant round_style : round_type := float_round_style; -- rounding option
- constant check_error : BOOLEAN := float_check_error) -- check for errors
- return UNSIGNED is
- variable validfp : valid_fpstate; -- Valid FP state
- variable frac : UNSIGNED (size-1 downto 0); -- Fraction
- variable sign : STD_ULOGIC; -- not used
- begin
- validfp := classfp (arg, check_error);
- classcase : case validfp is
- when isx | nan | quiet_nan =>
- frac := (others => 'X');
- when pos_zero | neg_inf | neg_zero | neg_normal | pos_denormal | neg_denormal =>
- frac := (others => '0'); -- return 0
- when pos_inf =>
- frac := (others => '1');
- when others =>
- float_to_unsigned (
- arg => arg,
- frac => frac,
- sign => sign,
- denormalize => false,
- bias => 0,
- round_style => round_style);
- end case classcase;
- return (frac);
- end function to_unsigned;
-
- -- to_signed (float)
- function to_signed (
- arg : UNRESOLVED_float; -- floating point input
- constant size : NATURAL; -- length of output
- constant round_style : round_type := float_round_style; -- rounding option
- constant check_error : BOOLEAN := float_check_error) -- check for errors
- return SIGNED is
- variable sign : STD_ULOGIC; -- true if negative
- variable validfp : valid_fpstate; -- Valid FP state
- variable frac : UNSIGNED (size-1 downto 0); -- Fraction
- variable result : SIGNED (size-1 downto 0);
- begin
- validfp := classfp (arg, check_error);
- classcase : case validfp is
- when isx | nan | quiet_nan =>
- result := (others => 'X');
- when pos_zero | neg_zero | pos_denormal | neg_denormal =>
- result := (others => '0'); -- return 0
- when pos_inf =>
- result := (others => '1');
- result (result'high) := '0';
- when neg_inf =>
- result := (others => '0');
- result (result'high) := '1';
- when others =>
- float_to_unsigned (
- arg => arg,
- sign => sign,
- frac => frac,
- denormalize => false,
- bias => 0,
- round_style => round_style);
- result (size-1) := '0';
- result (size-2 downto 0) := SIGNED(frac (size-2 downto 0));
- if sign = '1' then
- -- Because the most negative signed number is 1 less than the most
- -- positive signed number, we need this code.
- if frac(frac'high) = '1' then -- return most negative number
- result := (others => '0');
- result (result'high) := '1';
- else
- result := -result;
- end if;
- else
- if frac(frac'high) = '1' then -- return most positive number
- result := (others => '1');
- result (result'high) := '0';
- end if;
- end if;
- end case classcase;
- return result;
- end function to_signed;
-
- -- purpose: Converts a float to ufixed
- function to_ufixed (
- arg : UNRESOLVED_float; -- fp input
- constant left_index : INTEGER; -- integer part
- constant right_index : INTEGER; -- fraction part
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style; -- saturate
- constant round_style : fixed_round_style_type := fixed_round_style; -- rounding
- constant check_error : BOOLEAN := float_check_error; -- check for errors
- constant denormalize : BOOLEAN := float_denormalize)
- return UNRESOLVED_ufixed is
- constant fraction_width : INTEGER := -mine(arg'low, arg'low); -- length of FP output fraction
- constant exponent_width : INTEGER := arg'high; -- length of FP output exponent
- constant size : INTEGER := left_index - right_index + 4; -- unsigned size
- variable expon_base : INTEGER; -- exponent offset
- variable validfp : valid_fpstate; -- Valid FP state
- variable exp : INTEGER; -- Exponent
- variable expon : UNSIGNED (exponent_width-1 downto 0); -- Vectorized exponent
- -- Base to divide fraction by
- variable frac : UNSIGNED (size-1 downto 0) := (others => '0'); -- Fraction
- variable frac_shift : UNSIGNED (size-1 downto 0); -- Fraction shifted
- variable shift : INTEGER;
- variable result_big : UNRESOLVED_ufixed (left_index downto right_index-3);
- variable result : UNRESOLVED_ufixed (left_index downto right_index); -- result
- begin -- function to_ufixed
- validfp := classfp (arg, check_error);
- classcase : case validfp is
- when isx | nan | quiet_nan =>
- frac := (others => 'X');
- when pos_zero | neg_inf | neg_zero | neg_normal | neg_denormal =>
- frac := (others => '0'); -- return 0
- when pos_inf =>
- frac := (others => '1'); -- always saturate
- when others =>
- expon_base := 2**(exponent_width-1) -1; -- exponent offset
- -- Figure out the fraction
- if (validfp = pos_denormal) and denormalize then
- exp := -expon_base +1;
- frac (frac'high) := '0'; -- Remove the "1.0".
- else
- -- exponent /= '0', normal floating point
- expon := UNSIGNED(arg (exponent_width-1 downto 0));
- expon(exponent_width-1) := not expon(exponent_width-1);
- exp := to_integer (SIGNED(expon)) +1;
- frac (frac'high) := '1'; -- Add the "1.0".
- end if;
- shift := (frac'high - 3 + right_index) - exp;
- if fraction_width > frac'high then -- Can only use size-2 bits
- frac (frac'high-1 downto 0) := UNSIGNED (to_slv (arg(-1 downto
- -frac'high)));
- else -- can use all bits
- frac (frac'high-1 downto frac'high-fraction_width) :=
- UNSIGNED (to_slv (arg(-1 downto -fraction_width)));
- end if;
- frac_shift := frac srl shift;
- if shift < 0 then -- Overflow
- frac := (others => '1');
- else
- frac := frac_shift;
- end if;
- end case classcase;
- result_big := to_ufixed (
- arg => STD_ULOGIC_VECTOR(frac),
- left_index => left_index,
- right_index => (right_index-3));
- result := resize (arg => result_big,
- left_index => left_index,
- right_index => right_index,
- round_style => round_style,
- overflow_style => overflow_style);
- return result;
- end function to_ufixed;
-
- -- purpose: Converts a float to sfixed
- function to_sfixed (
- arg : UNRESOLVED_float; -- fp input
- constant left_index : INTEGER; -- integer part
- constant right_index : INTEGER; -- fraction part
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style; -- saturate
- constant round_style : fixed_round_style_type := fixed_round_style; -- rounding
- constant check_error : BOOLEAN := float_check_error; -- check for errors
- constant denormalize : BOOLEAN := float_denormalize)
- return UNRESOLVED_sfixed is
- constant fraction_width : INTEGER := -mine(arg'low, arg'low); -- length of FP output fraction
- constant exponent_width : INTEGER := arg'high; -- length of FP output exponent
- constant size : INTEGER := left_index - right_index + 4; -- unsigned size
- variable expon_base : INTEGER; -- exponent offset
- variable validfp : valid_fpstate; -- Valid FP state
- variable exp : INTEGER; -- Exponent
- variable sign : BOOLEAN; -- true if negative
- variable expon : UNSIGNED (exponent_width-1 downto 0); -- Vectorized exponent
- -- Base to divide fraction by
- variable frac : UNSIGNED (size-2 downto 0) := (others => '0'); -- Fraction
- variable frac_shift : UNSIGNED (size-2 downto 0); -- Fraction shifted
- variable shift : INTEGER;
- variable rsigned : SIGNED (size-1 downto 0); -- signed version of result
- variable result_big : UNRESOLVED_sfixed (left_index downto right_index-3);
- variable result : UNRESOLVED_sfixed (left_index downto right_index)
- := (others => '0'); -- result
- begin -- function to_sfixed
- validfp := classfp (arg, check_error);
- classcase : case validfp is
- when isx | nan | quiet_nan =>
- result := (others => 'X');
- when pos_zero | neg_zero =>
- result := (others => '0'); -- return 0
- when neg_inf =>
- result (left_index) := '1'; -- return smallest negative number
- when pos_inf =>
- result := (others => '1'); -- return largest number
- result (left_index) := '0';
- when others =>
- expon_base := 2**(exponent_width-1) -1; -- exponent offset
- if arg(exponent_width) = '0' then
- sign := false;
- else
- sign := true;
- end if;
- -- Figure out the fraction
- if (validfp = pos_denormal or validfp = neg_denormal)
- and denormalize then
- exp := -expon_base +1;
- frac (frac'high) := '0'; -- Add the "1.0".
- else
- -- exponent /= '0', normal floating point
- expon := UNSIGNED(arg (exponent_width-1 downto 0));
- expon(exponent_width-1) := not expon(exponent_width-1);
- exp := to_integer (SIGNED(expon)) +1;
- frac (frac'high) := '1'; -- Add the "1.0".
- end if;
- shift := (frac'high - 3 + right_index) - exp;
- if fraction_width > frac'high then -- Can only use size-2 bits
- frac (frac'high-1 downto 0) := UNSIGNED (to_slv (arg(-1 downto
- -frac'high)));
- else -- can use all bits
- frac (frac'high-1 downto frac'high-fraction_width) :=
- UNSIGNED (to_slv (arg(-1 downto -fraction_width)));
- end if;
- frac_shift := frac srl shift;
- if shift < 0 then -- Overflow
- frac := (others => '1');
- else
- frac := frac_shift;
- end if;
- if not sign then
- rsigned := SIGNED("0" & frac);
- else
- rsigned := -(SIGNED("0" & frac));
- end if;
- result_big := to_sfixed (
- arg => STD_LOGIC_VECTOR(rsigned),
- left_index => left_index,
- right_index => (right_index-3));
- result := resize (arg => result_big,
- left_index => left_index,
- right_index => right_index,
- round_style => round_style,
- overflow_style => overflow_style);
- end case classcase;
- return result;
- end function to_sfixed;
-
- -- size_res versions
- -- float to unsigned
- function to_unsigned (
- arg : UNRESOLVED_float; -- floating point input
- size_res : UNSIGNED;
- constant round_style : round_type := float_round_style; -- rounding option
- constant check_error : BOOLEAN := float_check_error) -- check for errors
- return UNSIGNED is
- variable result : UNSIGNED (size_res'range);
- begin
- if (SIZE_RES'length = 0) then
- return result;
- else
- result := to_unsigned (
- arg => arg,
- size => size_res'length,
- round_style => round_style,
- check_error => check_error);
- return result;
- end if;
- end function to_unsigned;
-
- -- float to signed
- function to_signed (
- arg : UNRESOLVED_float; -- floating point input
- size_res : SIGNED;
- constant round_style : round_type := float_round_style; -- rounding option
- constant check_error : BOOLEAN := float_check_error) -- check for errors
- return SIGNED is
- variable result : SIGNED (size_res'range);
- begin
- if (SIZE_RES'length = 0) then
- return result;
- else
- result := to_signed (
- arg => arg,
- size => size_res'length,
- round_style => round_style,
- check_error => check_error);
- return result;
- end if;
- end function to_signed;
-
- -- purpose: Converts a float to unsigned fixed point
- function to_ufixed (
- arg : UNRESOLVED_float; -- fp input
- size_res : UNRESOLVED_ufixed;
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style; -- saturate
- constant round_style : fixed_round_style_type := fixed_round_style; -- rounding
- constant check_error : BOOLEAN := float_check_error; -- check for errors
- constant denormalize : BOOLEAN := float_denormalize)
- return UNRESOLVED_ufixed is
- variable result : UNRESOLVED_ufixed (size_res'left downto size_res'right);
- begin
- if (result'length < 1) then
- return result;
- else
- result := to_ufixed (
- arg => arg,
- left_index => size_res'high,
- right_index => size_res'low,
- overflow_style => overflow_style,
- round_style => round_style,
- check_error => check_error,
- denormalize => denormalize);
- return result;
- end if;
- end function to_ufixed;
-
- -- float to signed fixed point
- function to_sfixed (
- arg : UNRESOLVED_float; -- fp input
- size_res : UNRESOLVED_sfixed;
- constant overflow_style : fixed_overflow_style_type := fixed_overflow_style; -- saturate
- constant round_style : fixed_round_style_type := fixed_round_style; -- rounding
- constant check_error : BOOLEAN := float_check_error; -- check for errors
- constant denormalize : BOOLEAN := float_denormalize)
- return UNRESOLVED_sfixed is
- variable result : UNRESOLVED_sfixed (size_res'left downto size_res'right);
- begin
- if (result'length < 1) then
- return result;
- else
- result := to_sfixed (
- arg => arg,
- left_index => size_res'high,
- right_index => size_res'low,
- overflow_style => overflow_style,
- round_style => round_style,
- check_error => check_error,
- denormalize => denormalize);
- return result;
- end if;
- end function to_sfixed;
-
- -- to_real (float)
- -- typically not Synthesizable unless the input is a constant.
- function to_real (
- arg : UNRESOLVED_float; -- floating point input
- constant check_error : BOOLEAN := float_check_error; -- check for errors
- constant denormalize : BOOLEAN := float_denormalize) -- Use IEEE extended FP
- return REAL is
- constant fraction_width : INTEGER := -mine(arg'low, arg'low); -- length of FP output fraction
- constant exponent_width : INTEGER := arg'high; -- length of FP output exponent
- variable sign : REAL; -- Sign, + or - 1
- variable exp : INTEGER; -- Exponent
- variable expon_base : INTEGER; -- exponent offset
- variable frac : REAL := 0.0; -- Fraction
- variable validfp : valid_fpstate; -- Valid FP state
- variable expon : UNSIGNED (exponent_width - 1 downto 0)
- := (others => '1'); -- Vectorized exponent
- begin
- validfp := classfp (arg, check_error);
- classcase : case validfp is
- when isx | pos_zero | neg_zero | nan | quiet_nan =>
- return 0.0;
- when neg_inf =>
- return REAL'low; -- Negative infinity.
- when pos_inf =>
- return REAL'high; -- Positive infinity
- when others =>
- expon_base := 2**(exponent_width-1) -1;
- if to_X01(arg(exponent_width)) = '0' then
- sign := 1.0;
- else
- sign := -1.0;
- end if;
- -- Figure out the fraction
- for i in 0 to fraction_width-1 loop
- if to_X01(arg (-1 - i)) = '1' then
- frac := frac + (2.0 **(-1 - i));
- end if;
- end loop; -- i
- if validfp = pos_normal or validfp = neg_normal or not denormalize then
- -- exponent /= '0', normal floating point
- expon := UNSIGNED(arg (exponent_width-1 downto 0));
- expon(exponent_width-1) := not expon(exponent_width-1);
- exp := to_integer (SIGNED(expon)) +1;
- sign := sign * (2.0 ** exp) * (1.0 + frac);
- else -- exponent = '0', IEEE extended floating point
- exp := 1 - expon_base;
- sign := sign * (2.0 ** exp) * frac;
- end if;
- return sign;
- end case classcase;
- end function to_real;
-
- -- For Verilog compatability
- function realtobits (arg : REAL) return STD_ULOGIC_VECTOR is
- variable result : float64; -- 64 bit floating point
- begin
- result := to_float (arg => arg,
- exponent_width => float64'high,
- fraction_width => -float64'low);
- return to_sulv (result);
- end function realtobits;
-
- function bitstoreal (arg : STD_ULOGIC_VECTOR) return REAL is
- variable arg64 : float64; -- arg converted to float
- begin
- arg64 := to_float (arg => arg,
- exponent_width => float64'high,
- fraction_width => -float64'low);
- return to_real (arg64);
- end function bitstoreal;
-
- -- purpose: Removes meta-logical values from FP string
- function to_01 (
- arg : UNRESOLVED_float; -- floating point input
- XMAP : STD_LOGIC := '0')
- return UNRESOLVED_float is
- variable result : UNRESOLVED_float (arg'range);
- begin -- function to_01
- if (arg'length < 1) then
- assert NO_WARNING
- report "float_pkg:"
- & "TO_01: null detected, returning NULL"
- severity warning;
- return NAFP;
- end if;
- result := UNRESOLVED_float (STD_LOGIC_VECTOR(to_01(UNSIGNED(to_slv(arg)), XMAP)));
- return result;
- end function to_01;
-
- function Is_X
- (arg : UNRESOLVED_float)
- return BOOLEAN is
- begin
- return Is_X (to_slv(arg));
- end function Is_X;
-
- function to_X01 (arg : UNRESOLVED_float) return UNRESOLVED_float is
- variable result : UNRESOLVED_float (arg'range);
- begin
- if (arg'length < 1) then
- assert NO_WARNING
- report "float_pkg:"
- & "TO_X01: null detected, returning NULL"
- severity warning;
- return NAFP;
- else
- result := UNRESOLVED_float (to_X01(to_slv(arg)));
- return result;
- end if;
- end function to_X01;
-
- function to_X01Z (arg : UNRESOLVED_float) return UNRESOLVED_float is
- variable result : UNRESOLVED_float (arg'range);
- begin
- if (arg'length < 1) then
- assert NO_WARNING
- report "float_pkg:"
- & "TO_X01Z: null detected, returning NULL"
- severity warning;
- return NAFP;
- else
- result := UNRESOLVED_float (to_X01Z(to_slv(arg)));
- return result;
- end if;
- end function to_X01Z;
-
- function to_UX01 (arg : UNRESOLVED_float) return UNRESOLVED_float is
- variable result : UNRESOLVED_float (arg'range);
- begin
- if (arg'length < 1) then
- assert NO_WARNING
- report "float_pkg:"
- & "TO_UX01: null detected, returning NULL"
- severity warning;
- return NAFP;
- else
- result := UNRESOLVED_float (to_UX01(to_slv(arg)));
- return result;
- end if;
- end function to_UX01;
-
- -- These allows the base math functions to use the default values
- -- of their parameters. Thus they do full IEEE floating point.
- function "+" (l, r : UNRESOLVED_float) return UNRESOLVED_float is
- begin
- return add (l, r);
- end function "+";
-
- function "-" (l, r : UNRESOLVED_float) return UNRESOLVED_float is
- begin
- return subtract (l, r);
- end function "-";
-
- function "*" (l, r : UNRESOLVED_float) return UNRESOLVED_float is
- begin
- return multiply (l, r);
- end function "*";
-
- function "/" (l, r : UNRESOLVED_float) return UNRESOLVED_float is
- begin
- return divide (l, r);
- end function "/";
-
--- function "rem" (l, r : UNRESOLVED_float) return UNRESOLVED_float is
--- begin
--- return remainder (l, r);
--- end function "rem";
-
--- function "mod" (l, r : UNRESOLVED_float) return UNRESOLVED_float is
--- begin
--- return modulo (l, r);
--- end function "mod";
-
- -- overloaded versions
- function "+" (l : UNRESOLVED_float; r : REAL) return UNRESOLVED_float is
- variable r_float : UNRESOLVED_float (l'range);
- begin
- r_float := to_float (r, l'high, -l'low);
- return add (l, r_float);
- end function "+";
-
- function "+" (l : REAL; r : UNRESOLVED_float) return UNRESOLVED_float is
- variable l_float : UNRESOLVED_float (r'range);
- begin
- l_float := to_float(l, r'high, -r'low);
- return add (l_float, r);
- end function "+";
-
- function "+" (l : UNRESOLVED_float; r : INTEGER) return UNRESOLVED_float is
- variable r_float : UNRESOLVED_float (l'range);
- begin
- r_float := to_float (r, l'high, -l'low);
- return add (l, r_float);
- end function "+";
-
- function "+" (l : INTEGER; r : UNRESOLVED_float) return UNRESOLVED_float is
- variable l_float : UNRESOLVED_float (r'range);
- begin
- l_float := to_float(l, r'high, -r'low);
- return add (l_float, r);
- end function "+";
-
- function "-" (l : UNRESOLVED_float; r : REAL) return UNRESOLVED_float is
- variable r_float : UNRESOLVED_float (l'range);
- begin
- r_float := to_float (r, l'high, -l'low);
- return subtract (l, r_float);
- end function "-";
-
- function "-" (l : REAL; r : UNRESOLVED_float) return UNRESOLVED_float is
- variable l_float : UNRESOLVED_float (r'range);
- begin
- l_float := to_float(l, r'high, -r'low);
- return subtract (l_float, r);
- end function "-";
-
- function "-" (l : UNRESOLVED_float; r : INTEGER) return UNRESOLVED_float is
- variable r_float : UNRESOLVED_float (l'range);
- begin
- r_float := to_float (r, l'high, -l'low);
- return subtract (l, r_float);
- end function "-";
-
- function "-" (l : INTEGER; r : UNRESOLVED_float) return UNRESOLVED_float is
- variable l_float : UNRESOLVED_float (r'range);
- begin
- l_float := to_float(l, r'high, -r'low);
- return subtract (l_float, r);
- end function "-";
-
- function "*" (l : UNRESOLVED_float; r : REAL) return UNRESOLVED_float is
- variable r_float : UNRESOLVED_float (l'range);
- begin
- r_float := to_float (r, l'high, -l'low);
- return multiply (l, r_float);
- end function "*";
-
- function "*" (l : REAL; r : UNRESOLVED_float) return UNRESOLVED_float is
- variable l_float : UNRESOLVED_float (r'range);
- begin
- l_float := to_float(l, r'high, -r'low);
- return multiply (l_float, r);
- end function "*";
-
- function "*" (l : UNRESOLVED_float; r : INTEGER) return UNRESOLVED_float is
- variable r_float : UNRESOLVED_float (l'range);
- begin
- r_float := to_float (r, l'high, -l'low);
- return multiply (l, r_float);
- end function "*";
-
- function "*" (l : INTEGER; r : UNRESOLVED_float) return UNRESOLVED_float is
- variable l_float : UNRESOLVED_float (r'range);
- begin
- l_float := to_float(l, r'high, -r'low);
- return multiply (l_float, r);
- end function "*";
-
- function "/" (l : UNRESOLVED_float; r : REAL) return UNRESOLVED_float is
- variable r_float : UNRESOLVED_float (l'range);
- begin
- r_float := to_float (r, l'high, -l'low);
- return divide (l, r_float);
- end function "/";
-
- function "/" (l : REAL; r : UNRESOLVED_float) return UNRESOLVED_float is
- variable l_float : UNRESOLVED_float (r'range);
- begin
- l_float := to_float(l, r'high, -r'low);
- return divide (l_float, r);
- end function "/";
-
- function "/" (l : UNRESOLVED_float; r : INTEGER) return UNRESOLVED_float is
- variable r_float : UNRESOLVED_float (l'range);
- begin
- r_float := to_float (r, l'high, -l'low);
- return divide (l, r_float);
- end function "/";
-
- function "/" (l : INTEGER; r : UNRESOLVED_float) return UNRESOLVED_float is
- variable l_float : UNRESOLVED_float (r'range);
- begin
- l_float := to_float(l, r'high, -r'low);
- return divide (l_float, r);
- end function "/";
-
--- function "rem" (l : UNRESOLVED_float; r : REAL) return UNRESOLVED_float is
--- variable r_float : UNRESOLVED_float (l'range);
--- begin
--- r_float := to_float (r, l'high, -l'low);
--- return remainder (l, r_float);
--- end function "rem";
-
--- function "rem" (l : REAL; r : UNRESOLVED_float) return UNRESOLVED_float is
--- variable l_float : UNRESOLVED_float (r'range);
--- begin
--- l_float := to_float(l, r'high, -r'low);
--- return remainder (l_float, r);
--- end function "rem";
-
--- function "rem" (l : UNRESOLVED_float; r : INTEGER) return UNRESOLVED_float is
--- variable r_float : UNRESOLVED_float (l'range);
--- begin
--- r_float := to_float (r, l'high, -l'low);
--- return remainder (l, r_float);
--- end function "rem";
-
--- function "rem" (l : INTEGER; r : UNRESOLVED_float) return UNRESOLVED_float is
--- variable l_float : UNRESOLVED_float (r'range);
--- begin
--- l_float := to_float(l, r'high, -r'low);
--- return remainder (l_float, r);
--- end function "rem";
-
--- function "mod" (l : UNRESOLVED_float; r : REAL) return UNRESOLVED_float is
--- variable r_float : UNRESOLVED_float (l'range);
--- begin
--- r_float := to_float (r, l'high, -l'low);
--- return modulo (l, r_float);
--- end function "mod";
-
--- function "mod" (l : REAL; r : UNRESOLVED_float) return UNRESOLVED_float is
--- variable l_float : UNRESOLVED_float (r'range);
--- begin
--- l_float := to_float(l, r'high, -r'low);
--- return modulo (l_float, r);
--- end function "mod";
-
--- function "mod" (l : UNRESOLVED_float; r : INTEGER) return UNRESOLVED_float is
--- variable r_float : UNRESOLVED_float (l'range);
--- begin
--- r_float := to_float (r, l'high, -l'low);
--- return modulo (l, r_float);
--- end function "mod";
-
--- function "mod" (l : INTEGER; r : UNRESOLVED_float) return UNRESOLVED_float is
--- variable l_float : UNRESOLVED_float (r'range);
--- begin
--- l_float := to_float(l, r'high, -r'low);
--- return modulo (l_float, r);
--- end function "mod";
-
- function "=" (l : UNRESOLVED_float; r : REAL) return BOOLEAN is
- variable r_float : UNRESOLVED_float (l'range);
- begin
- r_float := to_float (r, l'high, -l'low);
- return eq (l, r_float);
- end function "=";
-
- function "/=" (l : UNRESOLVED_float; r : REAL) return BOOLEAN is
- variable r_float : UNRESOLVED_float (l'range);
- begin
- r_float := to_float (r, l'high, -l'low);
- return ne (l, r_float);
- end function "/=";
-
- function ">=" (l : UNRESOLVED_float; r : REAL) return BOOLEAN is
- variable r_float : UNRESOLVED_float (l'range);
- begin
- r_float := to_float (r, l'high, -l'low);
- return ge (l, r_float);
- end function ">=";
-
- function "<=" (l : UNRESOLVED_float; r : REAL) return BOOLEAN is
- variable r_float : UNRESOLVED_float (l'range);
- begin
- r_float := to_float (r, l'high, -l'low);
- return le (l, r_float);
- end function "<=";
-
- function ">" (l : UNRESOLVED_float; r : REAL) return BOOLEAN is
- variable r_float : UNRESOLVED_float (l'range);
- begin
- r_float := to_float (r, l'high, -l'low);
- return gt (l, r_float);
- end function ">";
-
- function "<" (l : UNRESOLVED_float; r : REAL) return BOOLEAN is
- variable r_float : UNRESOLVED_float (l'range);
- begin
- r_float := to_float (r, l'high, -l'low);
- return lt (l, r_float);
- end function "<";
-
- function "=" (l : REAL; r : UNRESOLVED_float) return BOOLEAN is
- variable l_float : UNRESOLVED_float (r'range);
- begin
- l_float := to_float(l, r'high, -r'low);
- return eq (l_float, r);
- end function "=";
-
- function "/=" (l : REAL; r : UNRESOLVED_float) return BOOLEAN is
- variable l_float : UNRESOLVED_float (r'range);
- begin
- l_float := to_float(l, r'high, -r'low);
- return ne (l_float, r);
- end function "/=";
-
- function ">=" (l : REAL; r : UNRESOLVED_float) return BOOLEAN is
- variable l_float : UNRESOLVED_float (r'range);
- begin
- l_float := to_float(l, r'high, -r'low);
- return ge (l_float, r);
- end function ">=";
-
- function "<=" (l : REAL; r : UNRESOLVED_float) return BOOLEAN is
- variable l_float : UNRESOLVED_float (r'range);
- begin
- l_float := to_float(l, r'high, -r'low);
- return le (l_float, r);
- end function "<=";
-
- function ">" (l : REAL; r : UNRESOLVED_float) return BOOLEAN is
- variable l_float : UNRESOLVED_float (r'range);
- begin
- l_float := to_float(l, r'high, -r'low);
- return gt (l_float, r);
- end function ">";
-
- function "<" (l : REAL; r : UNRESOLVED_float) return BOOLEAN is
- variable l_float : UNRESOLVED_float (r'range);
- begin
- l_float := to_float(l, r'high, -r'low);
- return lt (l_float, r);
- end function "<";
-
- function "=" (l : UNRESOLVED_float; r : INTEGER) return BOOLEAN is
- variable r_float : UNRESOLVED_float (l'range);
- begin
- r_float := to_float (r, l'high, -l'low);
- return eq (l, r_float);
- end function "=";
-
- function "/=" (l : UNRESOLVED_float; r : INTEGER) return BOOLEAN is
- variable r_float : UNRESOLVED_float (l'range);
- begin
- r_float := to_float (r, l'high, -l'low);
- return ne (l, r_float);
- end function "/=";
-
- function ">=" (l : UNRESOLVED_float; r : INTEGER) return BOOLEAN is
- variable r_float : UNRESOLVED_float (l'range);
- begin
- r_float := to_float (r, l'high, -l'low);
- return ge (l, r_float);
- end function ">=";
-
- function "<=" (l : UNRESOLVED_float; r : INTEGER) return BOOLEAN is
- variable r_float : UNRESOLVED_float (l'range);
- begin
- r_float := to_float (r, l'high, -l'low);
- return le (l, r_float);
- end function "<=";
-
- function ">" (l : UNRESOLVED_float; r : INTEGER) return BOOLEAN is
- variable r_float : UNRESOLVED_float (l'range);
- begin
- r_float := to_float (r, l'high, -l'low);
- return gt (l, r_float);
- end function ">";
-
- function "<" (l : UNRESOLVED_float; r : INTEGER) return BOOLEAN is
- variable r_float : UNRESOLVED_float (l'range);
- begin
- r_float := to_float (r, l'high, -l'low);
- return lt (l, r_float);
- end function "<";
-
- function "=" (l : INTEGER; r : UNRESOLVED_float) return BOOLEAN is
- variable l_float : UNRESOLVED_float (r'range);
- begin
- l_float := to_float(l, r'high, -r'low);
- return eq (l_float, r);
- end function "=";
-
- function "/=" (l : INTEGER; r : UNRESOLVED_float) return BOOLEAN is
- variable l_float : UNRESOLVED_float (r'range);
- begin
- l_float := to_float(l, r'high, -r'low);
- return ne (l_float, r);
- end function "/=";
-
- function ">=" (l : INTEGER; r : UNRESOLVED_float) return BOOLEAN is
- variable l_float : UNRESOLVED_float (r'range);
- begin
- l_float := to_float(l, r'high, -r'low);
- return ge (l_float, r);
- end function ">=";
-
- function "<=" (l : INTEGER; r : UNRESOLVED_float) return BOOLEAN is
- variable l_float : UNRESOLVED_float (r'range);
- begin
- l_float := to_float(l, r'high, -r'low);
- return le (l_float, r);
- end function "<=";
-
- function ">" (l : INTEGER; r : UNRESOLVED_float) return BOOLEAN is
- variable l_float : UNRESOLVED_float (r'range);
- begin
- l_float := to_float(l, r'high, -r'low);
- return gt (l_float, r);
- end function ">";
-
- function "<" (l : INTEGER; r : UNRESOLVED_float) return BOOLEAN is
- variable l_float : UNRESOLVED_float (r'range);
- begin
- l_float := to_float(l, r'high, -r'low);
- return lt (l_float, r);
- end function "<";
-
- -- ?= overloads
- function \?=\ (l : UNRESOLVED_float; r : REAL) return STD_ULOGIC is
- variable r_float : UNRESOLVED_float (l'range);
- begin
- r_float := to_float (r, l'high, -l'low);
- return \?=\ (l, r_float);
- end function \?=\;
-
- function \?/=\ (l : UNRESOLVED_float; r : REAL) return STD_ULOGIC is
- variable r_float : UNRESOLVED_float (l'range);
- begin
- r_float := to_float (r, l'high, -l'low);
- return \?/=\ (l, r_float);
- end function \?/=\;
-
- function \?>\ (l : UNRESOLVED_float; r : REAL) return STD_ULOGIC is
- variable r_float : UNRESOLVED_float (l'range);
- begin
- r_float := to_float (r, l'high, -l'low);
- return \?>\ (l, r_float);
- end function \?>\;
-
- function \?>=\ (l : UNRESOLVED_float; r : REAL) return STD_ULOGIC is
- variable r_float : UNRESOLVED_float (l'range);
- begin
- r_float := to_float (r, l'high, -l'low);
- return \?>=\ (l, r_float);
- end function \?>=\;
-
- function \?<\ (l : UNRESOLVED_float; r : REAL) return STD_ULOGIC is
- variable r_float : UNRESOLVED_float (l'range);
- begin
- r_float := to_float (r, l'high, -l'low);
- return \?<\ (l, r_float);
- end function \?<\;
-
- function \?<=\ (l : UNRESOLVED_float; r : REAL) return STD_ULOGIC is
- variable r_float : UNRESOLVED_float (l'range);
- begin
- r_float := to_float (r, l'high, -l'low);
- return \?<=\ (l, r_float);
- end function \?<=\;
-
- -- real and float
- function \?=\ (l : REAL; r : UNRESOLVED_float) return STD_ULOGIC is
- variable l_float : UNRESOLVED_float (r'range);
- begin
- l_float := to_float (l, r'high, -r'low);
- return \?=\ (l_float, r);
- end function \?=\;
-
- function \?/=\ (l : REAL; r : UNRESOLVED_float) return STD_ULOGIC is
- variable l_float : UNRESOLVED_float (r'range);
- begin
- l_float := to_float (l, r'high, -r'low);
- return \?/=\ (l_float, r);
- end function \?/=\;
-
- function \?>\ (l : REAL; r : UNRESOLVED_float) return STD_ULOGIC is
- variable l_float : UNRESOLVED_float (r'range);
- begin
- l_float := to_float (l, r'high, -r'low);
- return \?>\ (l_float, r);
- end function \?>\;
-
- function \?>=\ (l : REAL; r : UNRESOLVED_float) return STD_ULOGIC is
- variable l_float : UNRESOLVED_float (r'range);
- begin
- l_float := to_float (l, r'high, -r'low);
- return \?>=\ (l_float, r);
- end function \?>=\;
-
- function \?<\ (l : REAL; r : UNRESOLVED_float) return STD_ULOGIC is
- variable l_float : UNRESOLVED_float (r'range);
- begin
- l_float := to_float (l, r'high, -r'low);
- return \?<\ (l_float, r);
- end function \?<\;
-
- function \?<=\ (l : REAL; r : UNRESOLVED_float) return STD_ULOGIC is
- variable l_float : UNRESOLVED_float (r'range);
- begin
- l_float := to_float (l, r'high, -r'low);
- return \?<=\ (l_float, r);
- end function \?<=\;
-
- -- ?= overloads
- function \?=\ (l : UNRESOLVED_float; r : INTEGER) return STD_ULOGIC is
- variable r_float : UNRESOLVED_float (l'range);
- begin
- r_float := to_float (r, l'high, -l'low);
- return \?=\ (l, r_float);
- end function \?=\;
-
- function \?/=\ (l : UNRESOLVED_float; r : INTEGER) return STD_ULOGIC is
- variable r_float : UNRESOLVED_float (l'range);
- begin
- r_float := to_float (r, l'high, -l'low);
- return \?/=\ (l, r_float);
- end function \?/=\;
-
- function \?>\ (l : UNRESOLVED_float; r : INTEGER) return STD_ULOGIC is
- variable r_float : UNRESOLVED_float (l'range);
- begin
- r_float := to_float (r, l'high, -l'low);
- return \?>\ (l, r_float);
- end function \?>\;
-
- function \?>=\ (l : UNRESOLVED_float; r : INTEGER) return STD_ULOGIC is
- variable r_float : UNRESOLVED_float (l'range);
- begin
- r_float := to_float (r, l'high, -l'low);
- return \?>=\ (l, r_float);
- end function \?>=\;
-
- function \?<\ (l : UNRESOLVED_float; r : INTEGER) return STD_ULOGIC is
- variable r_float : UNRESOLVED_float (l'range);
- begin
- r_float := to_float (r, l'high, -l'low);
- return \?<\ (l, r_float);
- end function \?<\;
-
- function \?<=\ (l : UNRESOLVED_float; r : INTEGER) return STD_ULOGIC is
- variable r_float : UNRESOLVED_float (l'range);
- begin
- r_float := to_float (r, l'high, -l'low);
- return \?<=\ (l, r_float);
- end function \?<=\;
-
- -- integer and float
- function \?=\ (l : INTEGER; r : UNRESOLVED_float) return STD_ULOGIC is
- variable l_float : UNRESOLVED_float (r'range);
- begin
- l_float := to_float (l, r'high, -r'low);
- return \?=\ (l_float, r);
- end function \?=\;
-
- function \?/=\ (l : INTEGER; r : UNRESOLVED_float) return STD_ULOGIC is
- variable l_float : UNRESOLVED_float (r'range);
- begin
- l_float := to_float (l, r'high, -r'low);
- return \?/=\ (l_float, r);
- end function \?/=\;
-
- function \?>\ (l : INTEGER; r : UNRESOLVED_float) return STD_ULOGIC is
- variable l_float : UNRESOLVED_float (r'range);
- begin
- l_float := to_float (l, r'high, -r'low);
- return \?>\ (l_float, r);
- end function \?>\;
-
- function \?>=\ (l : INTEGER; r : UNRESOLVED_float) return STD_ULOGIC is
- variable l_float : UNRESOLVED_float (r'range);
- begin
- l_float := to_float (l, r'high, -r'low);
- return \?>=\ (l_float, r);
- end function \?>=\;
-
- function \?<\ (l : INTEGER; r : UNRESOLVED_float) return STD_ULOGIC is
- variable l_float : UNRESOLVED_float (r'range);
- begin
- l_float := to_float (l, r'high, -r'low);
- return \?<\ (l_float, r);
- end function \?<\;
-
- function \?<=\ (l : INTEGER; r : UNRESOLVED_float) return STD_ULOGIC is
- variable l_float : UNRESOLVED_float (r'range);
- begin
- l_float := to_float (l, r'high, -r'low);
- return \?<=\ (l_float, r);
- end function \?<=\;
-
- -- minimum and maximum overloads
- function minimum (l : UNRESOLVED_float; r : REAL)
- return UNRESOLVED_float is
- variable r_float : UNRESOLVED_float (l'range);
- begin
- r_float := to_float (r, l'high, -l'low);
- return minimum (l, r_float);
- end function minimum;
-
- function maximum (l : UNRESOLVED_float; r : REAL)
- return UNRESOLVED_float is
- variable r_float : UNRESOLVED_float (l'range);
- begin
- r_float := to_float (r, l'high, -l'low);
- return maximum (l, r_float);
- end function maximum;
-
- function minimum (l : REAL; r : UNRESOLVED_float)
- return UNRESOLVED_float is
- variable l_float : UNRESOLVED_float (r'range);
- begin
- l_float := to_float (l, r'high, -r'low);
- return minimum (l_float, r);
- end function minimum;
-
- function maximum (l : REAL; r : UNRESOLVED_float)
- return UNRESOLVED_float is
- variable l_float : UNRESOLVED_float (r'range);
- begin
- l_float := to_float (l, r'high, -r'low);
- return maximum (l_float, r);
- end function maximum;
-
- function minimum (l : UNRESOLVED_float; r : INTEGER)
- return UNRESOLVED_float is
- variable r_float : UNRESOLVED_float (l'range);
- begin
- r_float := to_float (r, l'high, -l'low);
- return minimum (l, r_float);
- end function minimum;
-
- function maximum (l : UNRESOLVED_float; r : INTEGER)
- return UNRESOLVED_float is
- variable r_float : UNRESOLVED_float (l'range);
- begin
- r_float := to_float (r, l'high, -l'low);
- return maximum (l, r_float);
- end function maximum;
-
- function minimum (l : INTEGER; r : UNRESOLVED_float)
- return UNRESOLVED_float is
- variable l_float : UNRESOLVED_float (r'range);
- begin
- l_float := to_float (l, r'high, -r'low);
- return minimum (l_float, r);
- end function minimum;
-
- function maximum (l : INTEGER; r : UNRESOLVED_float)
- return UNRESOLVED_float is
- variable l_float : UNRESOLVED_float (r'range);
- begin
- l_float := to_float (l, r'high, -r'low);
- return maximum (l_float, r);
- end function maximum;
-
- ----------------------------------------------------------------------------
- -- logical functions
- ----------------------------------------------------------------------------
- function "not" (L : UNRESOLVED_float) return UNRESOLVED_float is
- variable RESULT : STD_ULOGIC_VECTOR(L'length-1 downto 0); -- force downto
- begin
- RESULT := not to_sulv(L);
- return to_float (RESULT, L'high, -L'low);
- end function "not";
-
- function "and" (L, R : UNRESOLVED_float) return UNRESOLVED_float is
- variable RESULT : STD_ULOGIC_VECTOR(L'length-1 downto 0); -- force downto
- begin
- if (L'high = R'high and L'low = R'low) then
- RESULT := to_sulv(L) and to_sulv(R);
- else
- assert NO_WARNING
- report "float_pkg:"
- & """and"": Range error L'RANGE /= R'RANGE"
- severity warning;
- RESULT := (others => 'X');
- end if;
- return to_float (RESULT, L'high, -L'low);
- end function "and";
-
- function "or" (L, R : UNRESOLVED_float) return UNRESOLVED_float is
- variable RESULT : STD_ULOGIC_VECTOR(L'length-1 downto 0); -- force downto
- begin
- if (L'high = R'high and L'low = R'low) then
- RESULT := to_sulv(L) or to_sulv(R);
- else
- assert NO_WARNING
- report "float_pkg:"
- & """or"": Range error L'RANGE /= R'RANGE"
- severity warning;
- RESULT := (others => 'X');
- end if;
- return to_float (RESULT, L'high, -L'low);
- end function "or";
-
- function "nand" (L, R : UNRESOLVED_float) return UNRESOLVED_float is
- variable RESULT : STD_ULOGIC_VECTOR(L'length-1 downto 0); -- force downto
- begin
- if (L'high = R'high and L'low = R'low) then
- RESULT := to_sulv(L) nand to_sulv(R);
- else
- assert NO_WARNING
- report "float_pkg:"
- & """nand"": Range error L'RANGE /= R'RANGE"
- severity warning;
- RESULT := (others => 'X');
- end if;
- return to_float (RESULT, L'high, -L'low);
- end function "nand";
-
- function "nor" (L, R : UNRESOLVED_float) return UNRESOLVED_float is
- variable RESULT : STD_ULOGIC_VECTOR(L'length-1 downto 0); -- force downto
- begin
- if (L'high = R'high and L'low = R'low) then
- RESULT := to_sulv(L) nor to_sulv(R);
- else
- assert NO_WARNING
- report "float_pkg:"
- & """nor"": Range error L'RANGE /= R'RANGE"
- severity warning;
- RESULT := (others => 'X');
- end if;
- return to_float (RESULT, L'high, -L'low);
- end function "nor";
-
- function "xor" (L, R : UNRESOLVED_float) return UNRESOLVED_float is
- variable RESULT : STD_ULOGIC_VECTOR(L'length-1 downto 0); -- force downto
- begin
- if (L'high = R'high and L'low = R'low) then
- RESULT := to_sulv(L) xor to_sulv(R);
- else
- assert NO_WARNING
- report "float_pkg:"
- & """xor"": Range error L'RANGE /= R'RANGE"
- severity warning;
- RESULT := (others => 'X');
- end if;
- return to_float (RESULT, L'high, -L'low);
- end function "xor";
-
- function "xnor" (L, R : UNRESOLVED_float) return UNRESOLVED_float is
- variable RESULT : STD_ULOGIC_VECTOR(L'length-1 downto 0); -- force downto
- begin
- if (L'high = R'high and L'low = R'low) then
- RESULT := to_sulv(L) xnor to_sulv(R);
- else
- assert NO_WARNING
- report "float_pkg:"
- & """xnor"": Range error L'RANGE /= R'RANGE"
- severity warning;
- RESULT := (others => 'X');
- end if;
- return to_float (RESULT, L'high, -L'low);
- end function "xnor";
-
- -- Vector and std_ulogic functions, same as functions in numeric_std
- function "and" (L : STD_ULOGIC; R : UNRESOLVED_float)
- return UNRESOLVED_float is
- variable result : UNRESOLVED_float (R'range);
- begin
- for i in result'range loop
- result(i) := L and R(i);
- end loop;
- return result;
- end function "and";
-
- function "and" (L : UNRESOLVED_float; R : STD_ULOGIC)
- return UNRESOLVED_float is
- variable result : UNRESOLVED_float (L'range);
- begin
- for i in result'range loop
- result(i) := L(i) and R;
- end loop;
- return result;
- end function "and";
-
- function "or" (L : STD_ULOGIC; R : UNRESOLVED_float)
- return UNRESOLVED_float is
- variable result : UNRESOLVED_float (R'range);
- begin
- for i in result'range loop
- result(i) := L or R(i);
- end loop;
- return result;
- end function "or";
-
- function "or" (L : UNRESOLVED_float; R : STD_ULOGIC)
- return UNRESOLVED_float is
- variable result : UNRESOLVED_float (L'range);
- begin
- for i in result'range loop
- result(i) := L(i) or R;
- end loop;
- return result;
- end function "or";
-
- function "nand" (L : STD_ULOGIC; R : UNRESOLVED_float)
- return UNRESOLVED_float is
- variable result : UNRESOLVED_float (R'range);
- begin
- for i in result'range loop
- result(i) := L nand R(i);
- end loop;
- return result;
- end function "nand";
-
- function "nand" (L : UNRESOLVED_float; R : STD_ULOGIC)
- return UNRESOLVED_float is
- variable result : UNRESOLVED_float (L'range);
- begin
- for i in result'range loop
- result(i) := L(i) nand R;
- end loop;
- return result;
- end function "nand";
-
- function "nor" (L : STD_ULOGIC; R : UNRESOLVED_float)
- return UNRESOLVED_float is
- variable result : UNRESOLVED_float (R'range);
- begin
- for i in result'range loop
- result(i) := L nor R(i);
- end loop;
- return result;
- end function "nor";
-
- function "nor" (L : UNRESOLVED_float; R : STD_ULOGIC)
- return UNRESOLVED_float is
- variable result : UNRESOLVED_float (L'range);
- begin
- for i in result'range loop
- result(i) := L(i) nor R;
- end loop;
- return result;
- end function "nor";
-
- function "xor" (L : STD_ULOGIC; R : UNRESOLVED_float)
- return UNRESOLVED_float is
- variable result : UNRESOLVED_float (R'range);
- begin
- for i in result'range loop
- result(i) := L xor R(i);
- end loop;
- return result;
- end function "xor";
-
- function "xor" (L : UNRESOLVED_float; R : STD_ULOGIC)
- return UNRESOLVED_float is
- variable result : UNRESOLVED_float (L'range);
- begin
- for i in result'range loop
- result(i) := L(i) xor R;
- end loop;
- return result;
- end function "xor";
-
- function "xnor" (L : STD_ULOGIC; R : UNRESOLVED_float)
- return UNRESOLVED_float is
- variable result : UNRESOLVED_float (R'range);
- begin
- for i in result'range loop
- result(i) := L xnor R(i);
- end loop;
- return result;
- end function "xnor";
-
- function "xnor" (L : UNRESOLVED_float; R : STD_ULOGIC)
- return UNRESOLVED_float is
- variable result : UNRESOLVED_float (L'range);
- begin
- for i in result'range loop
- result(i) := L(i) xnor R;
- end loop;
- return result;
- end function "xnor";
-
- -- Reduction operator_reduces, same as numeric_std functions
-
- function and_reduce (l : UNRESOLVED_float) return STD_ULOGIC is
- begin
- return and_reduce (to_sulv(l));
- end function and_reduce;
-
- function nand_reduce (l : UNRESOLVED_float) return STD_ULOGIC is
- begin
- return nand_reduce (to_sulv(l));
- end function nand_reduce;
-
- function or_reduce (l : UNRESOLVED_float) return STD_ULOGIC is
- begin
- return or_reduce (to_sulv(l));
- end function or_reduce;
-
- function nor_reduce (l : UNRESOLVED_float) return STD_ULOGIC is
- begin
- return nor_reduce (to_sulv(l));
- end function nor_reduce;
-
- function xor_reduce (l : UNRESOLVED_float) return STD_ULOGIC is
- begin
- return xor_reduce (to_sulv(l));
- end function xor_reduce;
-
- function xnor_reduce (l : UNRESOLVED_float) return STD_ULOGIC is
- begin
- return xnor_reduce (to_sulv(l));
- end function xnor_reduce;
-
- -----------------------------------------------------------------------------
- -- Recommended Functions from the IEEE 754 Appendix
- -----------------------------------------------------------------------------
- -- returns x with the sign of y.
- function Copysign (
- x, y : UNRESOLVED_float) -- floating point input
- return UNRESOLVED_float is
- begin
- return y(y'high) & x (x'high-1 downto x'low);
- end function Copysign;
-
- -- Returns y * 2**n for integral values of N without computing 2**n
- function Scalb (
- y : UNRESOLVED_float; -- floating point input
- N : INTEGER; -- exponent to add
- constant round_style : round_type := float_round_style; -- rounding option
- constant check_error : BOOLEAN := float_check_error; -- check for errors
- constant denormalize : BOOLEAN := float_denormalize) -- Use IEEE extended FP
- return UNRESOLVED_float is
- constant fraction_width : NATURAL := -mine(y'low, y'low); -- length of FP output fraction
- constant exponent_width : NATURAL := y'high; -- length of FP output exponent
- variable arg, result : UNRESOLVED_float (exponent_width downto -fraction_width); -- internal argument
- variable expon : SIGNED (exponent_width-1 downto 0); -- Vectorized exp
- variable exp : SIGNED (exponent_width downto 0);
- variable ufract : UNSIGNED (fraction_width downto 0);
- constant expon_base : SIGNED (exponent_width-1 downto 0)
- := gen_expon_base(exponent_width); -- exponent offset
- variable fptype : valid_fpstate;
- begin
- -- This can be done by simply adding N to the exponent.
- arg := to_01 (y, 'X');
- fptype := classfp(arg, check_error);
- classcase : case fptype is
- when isx =>
- result := (others => 'X');
- when nan | quiet_nan =>
- -- Return quiet NAN, IEEE754-1985-7.1,1
- result := qnanfp (fraction_width => fraction_width,
- exponent_width => exponent_width);
- when others =>
- break_number (
- arg => arg,
- fptyp => fptype,
- denormalize => denormalize,
- fract => ufract,
- expon => expon);
- exp := resize (expon, exp'length) + N;
- result := normalize (
- fract => ufract,
- expon => exp,
- sign => to_x01 (arg (arg'high)),
- fraction_width => fraction_width,
- exponent_width => exponent_width,
- round_style => round_style,
- denormalize => denormalize,
- nguard => 0);
- end case classcase;
- return result;
- end function Scalb;
-
- -- Returns y * 2**n for integral values of N without computing 2**n
- function Scalb (
- y : UNRESOLVED_float; -- floating point input
- N : SIGNED; -- exponent to add
- constant round_style : round_type := float_round_style; -- rounding option
- constant check_error : BOOLEAN := float_check_error; -- check for errors
- constant denormalize : BOOLEAN := float_denormalize) -- Use IEEE extended FP
- return UNRESOLVED_float is
- variable n_int : INTEGER;
- begin
- n_int := to_integer(N);
- return Scalb (y => y,
- N => n_int,
- round_style => round_style,
- check_error => check_error,
- denormalize => denormalize);
- end function Scalb;
-
- -- returns the unbiased exponent of x
- function Logb (
- x : UNRESOLVED_float) -- floating point input
- return INTEGER is
- constant fraction_width : NATURAL := -mine (x'low, x'low); -- length of FP output fraction
- constant exponent_width : NATURAL := x'high; -- length of FP output exponent
- variable result : INTEGER; -- result
- variable arg : UNRESOLVED_float (exponent_width downto -fraction_width); -- internal argument
- variable expon : SIGNED (exponent_width - 1 downto 0);
- variable fract : UNSIGNED (fraction_width downto 0);
- constant expon_base : INTEGER := 2**(exponent_width-1) -1; -- exponent
- -- offset +1
- variable fptype : valid_fpstate;
- begin
- -- Just return the exponent.
- arg := to_01 (x, 'X');
- fptype := classfp(arg);
- classcase : case fptype is
- when isx | nan | quiet_nan =>
- -- Return quiet NAN, IEEE754-1985-7.1,1
- result := 0;
- when pos_denormal | neg_denormal =>
- fract (fraction_width) := '0';
- fract (fraction_width-1 downto 0) :=
- UNSIGNED (to_slv(arg(-1 downto -fraction_width)));
- result := find_leftmost (fract, '1') -- Find the first "1"
- - fraction_width; -- subtract the length we want
- result := -expon_base + 1 + result;
- when others =>
- expon := SIGNED(arg (exponent_width - 1 downto 0));
- expon(exponent_width-1) := not expon(exponent_width-1);
- expon := expon + 1;
- result := to_integer (expon);
- end case classcase;
- return result;
- end function Logb;
-
- -- returns the unbiased exponent of x
- function Logb (
- x : UNRESOLVED_float) -- floating point input
- return SIGNED is
- constant exponent_width : NATURAL := x'high; -- length of FP output exponent
- variable result : SIGNED (exponent_width - 1 downto 0); -- result
- begin
- -- Just return the exponent.
- result := to_signed (Logb (x), exponent_width);
- return result;
- end function Logb;
-
- -- returns the next representable neighbor of x in the direction toward y
--- function Nextafter (
--- x, y : UNRESOLVED_float; -- floating point input
--- constant check_error : BOOLEAN := float_check_error; -- check for errors
--- constant denormalize : BOOLEAN := float_denormalize)
--- return UNRESOLVED_float is
--- constant fraction_width : NATURAL := -mine(x'low, x'low); -- length of FP output fraction
--- constant exponent_width : NATURAL := x'high; -- length of FP output exponent
--- function "=" (
--- l, r : UNRESOLVED_float) -- inputs
--- return BOOLEAN is
--- begin -- function "="
--- return eq (l => l,
--- r => r,
--- check_error => false);
--- end function "=";
--- function ">" (
--- l, r : UNRESOLVED_float) -- inputs
--- return BOOLEAN is
--- begin -- function ">"
--- return gt (l => l,
--- r => r,
--- check_error => false);
--- end function ">";
--- variable fract : UNSIGNED (fraction_width-1 downto 0);
--- variable expon : UNSIGNED (exponent_width-1 downto 0);
--- variable sign : STD_ULOGIC;
--- variable result : UNRESOLVED_float (exponent_width downto -fraction_width);
--- variable validfpx, validfpy : valid_fpstate; -- Valid FP state
--- begin -- fp_Nextafter
--- -- If Y > X, add one to the fraction, otherwise subtract.
--- validfpx := classfp (x, check_error);
--- validfpy := classfp (y, check_error);
--- if validfpx = isx or validfpy = isx then
--- result := (others => 'X');
--- return result;
--- elsif (validfpx = nan or validfpy = nan) then
--- return nanfp (fraction_width => fraction_width,
--- exponent_width => exponent_width);
--- elsif (validfpx = quiet_nan or validfpy = quiet_nan) then
--- return qnanfp (fraction_width => fraction_width,
--- exponent_width => exponent_width);
--- elsif x = y then -- Return X
--- return x;
--- else
--- fract := UNSIGNED (to_slv (x (-1 downto -fraction_width))); -- Fraction
--- expon := UNSIGNED (x (exponent_width - 1 downto 0)); -- exponent
--- sign := x(exponent_width); -- sign bit
--- if (y > x) then
--- -- Increase the number given
--- if validfpx = neg_inf then
--- -- return most negative number
--- expon := (others => '1');
--- expon (0) := '0';
--- fract := (others => '1');
--- elsif validfpx = pos_zero or validfpx = neg_zero then
--- -- return smallest denormal number
--- sign := '0';
--- expon := (others => '0');
--- fract := (others => '0');
--- fract(0) := '1';
--- elsif validfpx = pos_normal then
--- if and_reduce (fract) = '1' then -- fraction is all "1".
--- if and_reduce (expon (exponent_width-1 downto 1)) = '1'
--- and expon (0) = '0' then
--- -- Exponent is one away from infinity.
--- assert NO_WARNING
--- report "float_pkg:"
--- & "FP_NEXTAFTER: NextAfter overflow"
--- severity warning;
--- return pos_inffp (fraction_width => fraction_width,
--- exponent_width => exponent_width);
--- else
--- expon := expon + 1;
--- fract := (others => '0');
--- end if;
--- else
--- fract := fract + 1;
--- end if;
--- elsif validfpx = pos_denormal then
--- if and_reduce (fract) = '1' then -- fraction is all "1".
--- -- return smallest possible normal number
--- expon := (others => '0');
--- expon(0) := '1';
--- fract := (others => '0');
--- else
--- fract := fract + 1;
--- end if;
--- elsif validfpx = neg_normal then
--- if or_reduce (fract) = '0' then -- fraction is all "0".
--- if or_reduce (expon (exponent_width-1 downto 1)) = '0' and
--- expon (0) = '1' then -- Smallest exponent
--- -- return the largest negative denormal number
--- expon := (others => '0');
--- fract := (others => '1');
--- else
--- expon := expon - 1;
--- fract := (others => '1');
--- end if;
--- else
--- fract := fract - 1;
--- end if;
--- elsif validfpx = neg_denormal then
--- if or_reduce (fract(fract'high downto 1)) = '0'
--- and fract (0) = '1' then -- Smallest possible fraction
--- return zerofp (fraction_width => fraction_width,
--- exponent_width => exponent_width);
--- else
--- fract := fract - 1;
--- end if;
--- end if;
--- else
--- -- Decrease the number
--- if validfpx = pos_inf then
--- -- return most positive number
--- expon := (others => '1');
--- expon (0) := '0';
--- fract := (others => '1');
--- elsif validfpx = pos_zero
--- or classfp (x) = neg_zero then
--- -- return smallest negative denormal number
--- sign := '1';
--- expon := (others => '0');
--- fract := (others => '0');
--- fract(0) := '1';
--- elsif validfpx = neg_normal then
--- if and_reduce (fract) = '1' then -- fraction is all "1".
--- if and_reduce (expon (exponent_width-1 downto 1)) = '1'
--- and expon (0) = '0' then
--- -- Exponent is one away from infinity.
--- assert NO_WARNING
--- report "float_pkg:"
--- & "FP_NEXTAFTER: NextAfter overflow"
--- severity warning;
--- return neg_inffp (fraction_width => fraction_width,
--- exponent_width => exponent_width);
--- else
--- expon := expon + 1; -- Fraction overflow
--- fract := (others => '0');
--- end if;
--- else
--- fract := fract + 1;
--- end if;
--- elsif validfpx = neg_denormal then
--- if and_reduce (fract) = '1' then -- fraction is all "1".
--- -- return smallest possible normal number
--- expon := (others => '0');
--- expon(0) := '1';
--- fract := (others => '0');
--- else
--- fract := fract + 1;
--- end if;
--- elsif validfpx = pos_normal then
--- if or_reduce (fract) = '0' then -- fraction is all "0".
--- if or_reduce (expon (exponent_width-1 downto 1)) = '0' and
--- expon (0) = '1' then -- Smallest exponent
--- -- return the largest positive denormal number
--- expon := (others => '0');
--- fract := (others => '1');
--- else
--- expon := expon - 1;
--- fract := (others => '1');
--- end if;
--- else
--- fract := fract - 1;
--- end if;
--- elsif validfpx = pos_denormal then
--- if or_reduce (fract(fract'high downto 1)) = '0'
--- and fract (0) = '1' then -- Smallest possible fraction
--- return zerofp (fraction_width => fraction_width,
--- exponent_width => exponent_width);
--- else
--- fract := fract - 1;
--- end if;
--- end if;
--- end if;
--- result (-1 downto -fraction_width) := UNRESOLVED_float(fract);
--- result (exponent_width -1 downto 0) := UNRESOLVED_float(expon);
--- result (exponent_width) := sign;
--- return result;
--- end if;
--- end function Nextafter;
-
- -- Returns True if X is unordered with Y.
- function Unordered (
- x, y : UNRESOLVED_float) -- floating point input
- return BOOLEAN is
- variable lfptype, rfptype : valid_fpstate;
- begin
- lfptype := classfp (x);
- rfptype := classfp (y);
- if (lfptype = nan or lfptype = quiet_nan or
- rfptype = nan or rfptype = quiet_nan or
- lfptype = isx or rfptype = isx) then
- return true;
- else
- return false;
- end if;
- end function Unordered;
-
- function Finite (
- x : UNRESOLVED_float)
- return BOOLEAN is
- variable fp_state : valid_fpstate; -- fp state
- begin
- fp_state := Classfp (x);
- if (fp_state = pos_inf) or (fp_state = neg_inf) then
- return true;
- else
- return false;
- end if;
- end function Finite;
-
- function Isnan (
- x : UNRESOLVED_float)
- return BOOLEAN is
- variable fp_state : valid_fpstate; -- fp state
- begin
- fp_state := Classfp (x);
- if (fp_state = nan) or (fp_state = quiet_nan) then
- return true;
- else
- return false;
- end if;
- end function Isnan;
-
- -- Function to return constants.
- function zerofp (
- constant exponent_width : NATURAL := float_exponent_width; -- exponent
- constant fraction_width : NATURAL := float_fraction_width) -- fraction
- return UNRESOLVED_float is
- constant result : UNRESOLVED_float (exponent_width downto -fraction_width) :=
- (others => '0'); -- zero
- begin
- return result;
- end function zerofp;
-
- function nanfp (
- constant exponent_width : NATURAL := float_exponent_width; -- exponent
- constant fraction_width : NATURAL := float_fraction_width) -- fraction
- return UNRESOLVED_float is
- variable result : UNRESOLVED_float (exponent_width downto -fraction_width) :=
- (others => '0'); -- zero
- begin
- result (exponent_width-1 downto 0) := (others => '1');
- -- Exponent all "1"
- result (-1) := '1'; -- MSB of Fraction "1"
- -- Note: From W. Khan "IEEE Standard 754 for Binary Floating Point"
- -- The difference between a signaling NAN and a quiet NAN is that
- -- the MSB of the Fraction is a "1" in a Signaling NAN, and is a
- -- "0" in a quiet NAN.
- return result;
- end function nanfp;
-
- function qnanfp (
- constant exponent_width : NATURAL := float_exponent_width; -- exponent
- constant fraction_width : NATURAL := float_fraction_width) -- fraction
- return UNRESOLVED_float is
- variable result : UNRESOLVED_float (exponent_width downto -fraction_width) :=
- (others => '0'); -- zero
- begin
- result (exponent_width-1 downto 0) := (others => '1');
- -- Exponent all "1"
- result (-fraction_width) := '1'; -- LSB of Fraction "1"
- -- (Could have been any bit)
- return result;
- end function qnanfp;
-
- function pos_inffp (
- constant exponent_width : NATURAL := float_exponent_width; -- exponent
- constant fraction_width : NATURAL := float_fraction_width) -- fraction
- return UNRESOLVED_float is
- variable result : UNRESOLVED_float (exponent_width downto -fraction_width) :=
- (others => '0'); -- zero
- begin
- result (exponent_width-1 downto 0) := (others => '1'); -- Exponent all "1"
- return result;
- end function pos_inffp;
-
- function neg_inffp (
- constant exponent_width : NATURAL := float_exponent_width; -- exponent
- constant fraction_width : NATURAL := float_fraction_width) -- fraction
- return UNRESOLVED_float is
- variable result : UNRESOLVED_float (exponent_width downto -fraction_width) :=
- (others => '0'); -- zero
- begin
- result (exponent_width downto 0) := (others => '1'); -- top bits all "1"
- return result;
- end function neg_inffp;
-
- function neg_zerofp (
- constant exponent_width : NATURAL := float_exponent_width; -- exponent
- constant fraction_width : NATURAL := float_fraction_width) -- fraction
- return UNRESOLVED_float is
- variable result : UNRESOLVED_float (exponent_width downto -fraction_width) :=
- (others => '0'); -- zero
- begin
- result (exponent_width) := '1';
- return result;
- end function neg_zerofp;
-
- -- size_res versions
- function zerofp (
- size_res : UNRESOLVED_float) -- variable is only use for sizing
- return UNRESOLVED_float is
- begin
- return zerofp (
- exponent_width => size_res'high,
- fraction_width => -size_res'low);
- end function zerofp;
-
- function nanfp (
- size_res : UNRESOLVED_float) -- variable is only use for sizing
- return UNRESOLVED_float is
- begin
- return nanfp (
- exponent_width => size_res'high,
- fraction_width => -size_res'low);
- end function nanfp;
-
- function qnanfp (
- size_res : UNRESOLVED_float) -- variable is only use for sizing
- return UNRESOLVED_float is
- begin
- return qnanfp (
- exponent_width => size_res'high,
- fraction_width => -size_res'low);
- end function qnanfp;
-
- function pos_inffp (
- size_res : UNRESOLVED_float) -- variable is only use for sizing
- return UNRESOLVED_float is
- begin
- return pos_inffp (
- exponent_width => size_res'high,
- fraction_width => -size_res'low);
- end function pos_inffp;
-
- function neg_inffp (
- size_res : UNRESOLVED_float) -- variable is only use for sizing
- return UNRESOLVED_float is
- begin
- return neg_inffp (
- exponent_width => size_res'high,
- fraction_width => -size_res'low);
- end function neg_inffp;
-
- function neg_zerofp (
- size_res : UNRESOLVED_float) -- variable is only use for sizing
- return UNRESOLVED_float is
- begin
- return neg_zerofp (
- exponent_width => size_res'high,
- fraction_width => -size_res'low);
- end function neg_zerofp;
-
--- rtl_synthesis off
--- pragma synthesis_off
-
- --%%% these functions are copied from std_logic_1164 (VHDL-200X edition)
- -- Textio functions
- -- purpose: writes float into a line (NOTE changed basetype)
- type MVL9plus is ('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-', error);
- type char_indexed_by_MVL9 is array (STD_ULOGIC) of CHARACTER;
- type MVL9_indexed_by_char is array (CHARACTER) of STD_ULOGIC;
- type MVL9plus_indexed_by_char is array (CHARACTER) of MVL9plus;
-
- constant NBSP : CHARACTER := CHARACTER'val(160); -- space character
- constant MVL9_to_char : char_indexed_by_MVL9 := "UX01ZWLH-";
- constant char_to_MVL9 : MVL9_indexed_by_char :=
- ('U' => 'U', 'X' => 'X', '0' => '0', '1' => '1', 'Z' => 'Z',
- 'W' => 'W', 'L' => 'L', 'H' => 'H', '-' => '-', others => 'U');
- constant char_to_MVL9plus : MVL9plus_indexed_by_char :=
- ('U' => 'U', 'X' => 'X', '0' => '0', '1' => '1', 'Z' => 'Z',
- 'W' => 'W', 'L' => 'L', 'H' => 'H', '-' => '-', others => error);
- constant NUS : STRING(2 to 1) := (others => ' ');
-
- -- purpose: Skips white space
- procedure skip_whitespace (
- L : inout LINE) is
- variable readOk : BOOLEAN;
- variable c : CHARACTER;
- begin
- while L /= null and L.all'length /= 0 loop
- if (L.all(1) = ' ' or L.all(1) = NBSP or L.all(1) = HT) then
- read (l, c, readOk);
- else
- exit;
- end if;
- end loop;
- end procedure skip_whitespace;
-
--- %%% Replicated textio functions
- function to_ostring (value : STD_LOGIC_VECTOR) return STRING is
- constant ne : INTEGER := (value'length+2)/3;
- variable pad : STD_LOGIC_VECTOR(0 to (ne*3 - value'length) - 1);
- variable ivalue : STD_LOGIC_VECTOR(0 to ne*3 - 1);
- variable result : STRING(1 to ne);
- variable tri : STD_LOGIC_VECTOR(0 to 2);
- begin
- if value'length < 1 then
- return NUS;
- else
- if value (value'left) = 'Z' then
- pad := (others => 'Z');
- else
- pad := (others => '0');
- end if;
- ivalue := pad & value;
- for i in 0 to ne-1 loop
- tri := To_X01Z(ivalue(3*i to 3*i+2));
- case tri is
- when o"0" => result(i+1) := '0';
- when o"1" => result(i+1) := '1';
- when o"2" => result(i+1) := '2';
- when o"3" => result(i+1) := '3';
- when o"4" => result(i+1) := '4';
- when o"5" => result(i+1) := '5';
- when o"6" => result(i+1) := '6';
- when o"7" => result(i+1) := '7';
- when "ZZZ" => result(i+1) := 'Z';
- when others => result(i+1) := 'X';
- end case;
- end loop;
- return result;
- end if;
- end function to_ostring;
- -------------------------------------------------------------------
- function to_hstring (value : STD_LOGIC_VECTOR) return STRING is
- constant ne : INTEGER := (value'length+3)/4;
- variable pad : STD_LOGIC_VECTOR(0 to (ne*4 - value'length) - 1);
- variable ivalue : STD_LOGIC_VECTOR(0 to ne*4 - 1);
- variable result : STRING(1 to ne);
- variable quad : STD_LOGIC_VECTOR(0 to 3);
- begin
- if value'length < 1 then
- return NUS;
- else
- if value (value'left) = 'Z' then
- pad := (others => 'Z');
- else
- pad := (others => '0');
- end if;
- ivalue := pad & value;
- for i in 0 to ne-1 loop
- quad := To_X01Z(ivalue(4*i to 4*i+3));
- case quad is
- when x"0" => result(i+1) := '0';
- when x"1" => result(i+1) := '1';
- when x"2" => result(i+1) := '2';
- when x"3" => result(i+1) := '3';
- when x"4" => result(i+1) := '4';
- when x"5" => result(i+1) := '5';
- when x"6" => result(i+1) := '6';
- when x"7" => result(i+1) := '7';
- when x"8" => result(i+1) := '8';
- when x"9" => result(i+1) := '9';
- when x"A" => result(i+1) := 'A';
- when x"B" => result(i+1) := 'B';
- when x"C" => result(i+1) := 'C';
- when x"D" => result(i+1) := 'D';
- when x"E" => result(i+1) := 'E';
- when x"F" => result(i+1) := 'F';
- when "ZZZZ" => result(i+1) := 'Z';
- when others => result(i+1) := 'X';
- end case;
- end loop;
- return result;
- end if;
- end function to_hstring;
- procedure Char2TriBits (C : CHARACTER;
- RESULT : out STD_LOGIC_VECTOR(2 downto 0);
- GOOD : out BOOLEAN;
- ISSUE_ERROR : in BOOLEAN) is
- begin
- case c is
- when '0' => result := o"0"; good := true;
- when '1' => result := o"1"; good := true;
- when '2' => result := o"2"; good := true;
- when '3' => result := o"3"; good := true;
- when '4' => result := o"4"; good := true;
- when '5' => result := o"5"; good := true;
- when '6' => result := o"6"; good := true;
- when '7' => result := o"7"; good := true;
- when 'Z' => result := "ZZZ"; good := true;
- when 'X' => result := "XXX"; good := true;
- when others =>
- assert not ISSUE_ERROR
- report "float_pkg:"
- & "OREAD Error: Read a '" & c &
- "', expected an Octal character (0-7)."
- severity error;
- result := "UUU";
- good := false;
- end case;
- end procedure Char2TriBits;
-
- procedure OREAD (L : inout LINE; VALUE : out STD_LOGIC_VECTOR;
- GOOD : out BOOLEAN) is
- variable ok : BOOLEAN;
- variable c : CHARACTER;
- constant ne : INTEGER := (VALUE'length+2)/3;
- constant pad : INTEGER := ne*3 - VALUE'length;
- variable sv : STD_LOGIC_VECTOR(0 to ne*3 - 1);
- variable i : INTEGER;
- variable lastu : BOOLEAN := false; -- last character was an "_"
- begin
- VALUE := (VALUE'range => 'U'); -- initialize to a "U"
- Skip_whitespace (L);
- if VALUE'length > 0 then
- read (l, c, ok);
- i := 0;
- while i < ne loop
- -- Bail out if there was a bad read
- if not ok then
- good := false;
- return;
- elsif c = '_' then
- if i = 0 then
- good := false; -- Begins with an "_"
- return;
- elsif lastu then
- good := false; -- "__" detected
- return;
- else
- lastu := true;
- end if;
- else
- Char2TriBits(c, sv(3*i to 3*i+2), ok, false);
- if not ok then
- good := false;
- return;
- end if;
- i := i + 1;
- lastu := false;
- end if;
- if i < ne then
- read(L, c, ok);
- end if;
- end loop;
- if or_reduce (sv (0 to pad-1)) = '1' then -- %%% replace with "or"
- good := false; -- vector was truncated.
- else
- good := true;
- VALUE := sv (pad to sv'high);
- end if;
- else
- good := true; -- read into a null array
- end if;
- end procedure OREAD;
-
- -- Hex Read and Write procedures for STD_ULOGIC_VECTOR.
- -- Modified from the original to be more forgiving.
-
- procedure Char2QuadBits (C : CHARACTER;
- RESULT : out STD_LOGIC_VECTOR(3 downto 0);
- GOOD : out BOOLEAN;
- ISSUE_ERROR : in BOOLEAN) is
- begin
- case c is
- when '0' => result := x"0"; good := true;
- when '1' => result := x"1"; good := true;
- when '2' => result := x"2"; good := true;
- when '3' => result := x"3"; good := true;
- when '4' => result := x"4"; good := true;
- when '5' => result := x"5"; good := true;
- when '6' => result := x"6"; good := true;
- when '7' => result := x"7"; good := true;
- when '8' => result := x"8"; good := true;
- when '9' => result := x"9"; good := true;
- when 'A' | 'a' => result := x"A"; good := true;
- when 'B' | 'b' => result := x"B"; good := true;
- when 'C' | 'c' => result := x"C"; good := true;
- when 'D' | 'd' => result := x"D"; good := true;
- when 'E' | 'e' => result := x"E"; good := true;
- when 'F' | 'f' => result := x"F"; good := true;
- when 'Z' => result := "ZZZZ"; good := true;
- when 'X' => result := "XXXX"; good := true;
- when others =>
- assert not ISSUE_ERROR
- report "float_pkg:"
- & "HREAD Error: Read a '" & c &
- "', expected a Hex character (0-F)."
- severity error;
- result := "UUUU";
- good := false;
- end case;
- end procedure Char2QuadBits;
-
- procedure HREAD (L : inout LINE; VALUE : out STD_LOGIC_VECTOR;
- GOOD : out BOOLEAN) is
- variable ok : BOOLEAN;
- variable c : CHARACTER;
- constant ne : INTEGER := (VALUE'length+3)/4;
- constant pad : INTEGER := ne*4 - VALUE'length;
- variable sv : STD_LOGIC_VECTOR(0 to ne*4 - 1);
- variable i : INTEGER;
- variable lastu : BOOLEAN := false; -- last character was an "_"
- begin
- VALUE := (VALUE'range => 'U'); -- initialize to a "U"
- Skip_whitespace (L);
- if VALUE'length > 0 then
- read (l, c, ok);
- i := 0;
- while i < ne loop
- -- Bail out if there was a bad read
- if not ok then
- good := false;
- return;
- elsif c = '_' then
- if i = 0 then
- good := false; -- Begins with an "_"
- return;
- elsif lastu then
- good := false; -- "__" detected
- return;
- else
- lastu := true;
- end if;
- else
- Char2QuadBits(c, sv(4*i to 4*i+3), ok, false);
- if not ok then
- good := false;
- return;
- end if;
- i := i + 1;
- lastu := false;
- end if;
- if i < ne then
- read(L, c, ok);
- end if;
- end loop;
- if or_reduce (sv (0 to pad-1)) = '1' then -- %%% replace with "or"
- good := false; -- vector was truncated.
- else
- good := true;
- VALUE := sv (pad to sv'high);
- end if;
- else
- good := true; -- Null input string, skips whitespace
- end if;
- end procedure HREAD;
-
--- %%% END replicated textio functions
-
- -- purpose: Checks the punctuation in a line
- procedure check_punctuation (
- arg : in STRING;
- colon : out BOOLEAN; -- There was a colon in the line
- dot : out BOOLEAN; -- There was a dot in the line
- good : out BOOLEAN; -- True if enough characters found
- chars : in INTEGER) is
- -- Examples. Legal inputs are "0000000", "0000.000", "0:000:000"
- alias xarg : STRING (1 to arg'length) is arg; -- make it downto range
- variable icolon, idot : BOOLEAN; -- internal
- variable j : INTEGER := 0; -- charters read
- begin
- good := false;
- icolon := false;
- idot := false;
- for i in 1 to arg'length loop
- if xarg(i) = ' ' or xarg(i) = NBSP or xarg(i) = HT or j = chars then
- exit;
- elsif xarg(i) = ':' then
- icolon := true;
- elsif xarg(i) = '.' then
- idot := true;
- elsif xarg (i) /= '_' then
- j := j + 1;
- end if;
- end loop;
- if j = chars then
- good := true; -- There are enough charactes to read
- end if;
- colon := icolon;
- if idot and icolon then
- dot := false;
- else
- dot := idot;
- end if;
- end procedure check_punctuation;
-
- -- purpose: Searches a line for a ":" and replaces it with a ".".
- procedure fix_colon (
- arg : inout STRING;
- chars : in integer) is
- alias xarg : STRING (1 to arg'length) is arg; -- make it downto range
- variable j : INTEGER := 0; -- charters read
- begin
- for i in 1 to arg'length loop
- if xarg(i) = ' ' or xarg(i) = NBSP or xarg(i) = HT or j > chars then
- exit;
- elsif xarg(i) = ':' then
- xarg (i) := '.';
- elsif xarg (i) /= '_' then
- j := j + 1;
- end if;
- end loop;
- end procedure fix_colon;
-
- procedure WRITE (
- L : inout LINE; -- input line
- VALUE : in UNRESOLVED_float; -- floating point input
- JUSTIFIED : in SIDE := right;
- FIELD : in WIDTH := 0) is
- variable s : STRING(1 to value'high - value'low +3);
- variable sindx : INTEGER;
- begin -- function write
- s(1) := MVL9_to_char(STD_ULOGIC(VALUE(VALUE'high)));
- s(2) := ':';
- sindx := 3;
- for i in VALUE'high-1 downto 0 loop
- s(sindx) := MVL9_to_char(STD_ULOGIC(VALUE(i)));
- sindx := sindx + 1;
- end loop;
- s(sindx) := ':';
- sindx := sindx + 1;
- for i in -1 downto VALUE'low loop
- s(sindx) := MVL9_to_char(STD_ULOGIC(VALUE(i)));
- sindx := sindx + 1;
- end loop;
- WRITE (L, s, JUSTIFIED, FIELD);
- end procedure WRITE;
-
- procedure READ (L : inout LINE; VALUE : out UNRESOLVED_float) is
- -- Possible data: 0:0000:0000000
- -- 000000000000
- variable c : CHARACTER;
- variable mv : UNRESOLVED_float (VALUE'range);
- variable readOk : BOOLEAN;
- variable lastu : BOOLEAN := false; -- last character was an "_"
- variable i : INTEGER; -- index variable
- begin -- READ
- VALUE := (VALUE'range => 'U'); -- initialize to a "U"
- Skip_whitespace (L);
- READ (l, c, readOk);
- if VALUE'length > 0 then
- i := value'high;
- readloop : loop
- if readOk = false then -- Bail out if there was a bad read
- report "float_pkg:"
- & "READ(float): "
- & "Error end of file encountered."
- severity error;
- return;
- elsif c = ' ' or c = CR or c = HT then -- reading done.
- if (i /= value'low) then
- report "float_pkg:"
- & "READ(float): "
- & "Warning: Value truncated."
- severity warning;
- return;
- end if;
- elsif c = '_' then
- if i = value'high then -- Begins with an "_"
- report "float_pkg:"
- & "READ(float): "
- & "String begins with an ""_""" severity error;
- return;
- elsif lastu then -- "__" detected
- report "float_pkg:"
- & "READ(float): "
- & "Two underscores detected in input string ""__"""
- severity error;
- return;
- else
- lastu := true;
- end if;
- elsif c = ':' or c = '.' then -- separator, ignore
- if not (i = -1 or i = value'high-1) then
- report "float_pkg:"
- & "READ(float): "
- & "Warning: Separator point does not match number format: '"
- & c & "' encountered at location " & INTEGER'image(i) & "."
- severity warning;
- end if;
- lastu := false;
- elsif (char_to_MVL9plus(c) = error) then
- report "float_pkg:"
- & "READ(float): "
- & "Error: Character '" & c & "' read, expected STD_ULOGIC literal."
- severity error;
- return;
- else
- mv (i) := char_to_MVL9(c);
- i := i - 1;
- if i < value'low then
- VALUE := mv;
- return;
- end if;
- lastu := false;
- end if;
- READ (l, c, readOk);
- end loop readloop;
- end if;
- end procedure READ;
-
- procedure READ (L : inout LINE; VALUE : out UNRESOLVED_float; GOOD : out BOOLEAN) is
- -- Possible data: 0:0000:0000000
- -- 000000000000
- variable c : CHARACTER;
- variable mv : UNRESOLVED_float (VALUE'range);
- variable lastu : BOOLEAN := false; -- last character was an "_"
- variable i : INTEGER; -- index variable
- variable readOk : BOOLEAN;
- begin -- READ
- VALUE := (VALUE'range => 'U'); -- initialize to a "U"
- Skip_whitespace (L);
- READ (l, c, readOk);
- if VALUE'length > 0 then
- i := value'high;
- good := false;
- readloop : loop
- if readOk = false then -- Bail out if there was a bad read
- return;
- elsif c = ' ' or c = CR or c = HT then -- reading done
- return;
- elsif c = '_' then
- if i = 0 then -- Begins with an "_"
- return;
- elsif lastu then -- "__" detected
- return;
- else
- lastu := true;
- end if;
- elsif c = ':' or c = '.' then -- separator, ignore
- -- good := (i = -1 or i = value'high-1);
- lastu := false;
- elsif (char_to_MVL9plus(c) = error) then
- return;
- else
- mv (i) := char_to_MVL9(c);
- i := i - 1;
- if i < value'low then
- good := true;
- VALUE := mv;
- return;
- end if;
- lastu := false;
- end if;
- READ (l, c, readOk);
- end loop readloop;
- else
- good := true; -- read into a null array
- end if;
- end procedure READ;
-
- procedure OWRITE (
- L : inout LINE; -- access type (pointer)
- VALUE : in UNRESOLVED_float; -- value to write
- JUSTIFIED : in SIDE := right; -- which side to justify text
- FIELD : in WIDTH := 0) is -- width of field
- begin
- WRITE (L => L,
- VALUE => to_ostring(VALUE),
- JUSTIFIED => JUSTIFIED,
- FIELD => FIELD);
- end procedure OWRITE;
-
- procedure OREAD (L : inout LINE; VALUE : out UNRESOLVED_float) is
- constant ne : INTEGER := ((value'length+2)/3) * 3; -- pad
- variable slv : STD_LOGIC_VECTOR (ne-1 downto 0); -- slv
- variable slvu : ufixed (VALUE'range); -- Unsigned fixed point
- variable c : CHARACTER;
- variable ok : BOOLEAN;
- variable nybble : STD_LOGIC_VECTOR (2 downto 0); -- 3 bits
- variable colon, dot : BOOLEAN;
- begin
- VALUE := (VALUE'range => 'U'); -- initialize to a "U"
- Skip_whitespace (L);
- if VALUE'length > 0 then
- check_punctuation (arg => L.all,
- colon => colon,
- dot => dot,
- good => ok,
- chars => ne/3);
- if not ok then
- report "float_pkg:" & "OREAD: "
- & "short string encounted: " & L.all
- & " needs to have " & integer'image (ne/3)
- & " valid octal characters."
- severity error;
- return;
- elsif dot then
- OREAD (L, slvu, ok); -- read it like a UFIXED number
- if not ok then
- report "float_pkg:" & "OREAD: "
- & "error encounted reading STRING " & L.all
- severity error;
- return;
- else
- VALUE := UNRESOLVED_float (slvu);
- end if;
- elsif colon then
- OREAD (L, nybble, ok); -- read the sign bit
- if not ok then
- report "float_pkg:" & "OREAD: "
- & "End of string encountered"
- severity error;
- return;
- elsif nybble (2 downto 1) /= "00" then
- report "float_pkg:" & "OREAD: "
- & "Illegal sign bit STRING encounted "
- severity error;
- return;
- end if;
- read (l, c, ok); -- read the colon
- fix_colon (L.all, ne/3); -- replaces the colon with a ".".
- OREAD (L, slvu (slvu'high-1 downto slvu'low), ok); -- read it like a UFIXED number
- if not ok then
- report "float_pkg:" & "OREAD: "
- & "error encounted reading STRING " & L.all
- severity error;
- return;
- else
- slvu (slvu'high) := nybble (0);
- VALUE := UNRESOLVED_float (slvu);
- end if;
- else
- OREAD (L, slv, ok);
- if not ok then
- report "float_pkg:" & "OREAD: "
- & "Error encounted during read"
- severity error;
- return;
- end if;
- if (or_reduce (slv(ne-1 downto VALUE'high-VALUE'low+1)) = '1') then
- report "float_pkg:" & "OREAD: "
- & "Vector truncated."
- severity error;
- return;
- end if;
- VALUE := to_float (slv(VALUE'high-VALUE'low downto 0),
- VALUE'high, -VALUE'low);
- end if;
- end if;
- end procedure OREAD;
-
- procedure OREAD(L : inout LINE; VALUE : out UNRESOLVED_float; GOOD : out BOOLEAN) is
- constant ne : INTEGER := ((value'length+2)/3) * 3; -- pad
- variable slv : STD_LOGIC_VECTOR (ne-1 downto 0); -- slv
- variable slvu : ufixed (VALUE'range); -- Unsigned fixed point
- variable c : CHARACTER;
- variable ok : BOOLEAN;
- variable nybble : STD_LOGIC_VECTOR (2 downto 0); -- 3 bits
- variable colon, dot : BOOLEAN;
- begin
- VALUE := (VALUE'range => 'U'); -- initialize to a "U"
- GOOD := false;
- Skip_whitespace (L);
- if VALUE'length > 0 then
- check_punctuation (arg => L.all,
- colon => colon,
- dot => dot,
- good => ok,
- chars => ne/3);
- if not ok then
- return;
- elsif dot then
- OREAD (L, slvu, ok); -- read it like a UFIXED number
- if not ok then
- return;
- else
- VALUE := UNRESOLVED_float (slvu);
- end if;
- elsif colon then
- OREAD (L, nybble, ok); -- read the sign bit
- if not ok then
- return;
- elsif nybble (2 downto 1) /= "00" then
- return;
- end if;
- read (l, c, ok); -- read the colon
- fix_colon (L.all, ne/3); -- replaces the colon with a ".".
- OREAD (L, slvu (slvu'high-1 downto slvu'low), ok); -- read it like a UFIXED number
- if not ok then
- return;
- else
- slvu (slvu'high) := nybble (0);
- VALUE := UNRESOLVED_float (slvu);
- end if;
- else
- OREAD (L, slv, ok);
- if not ok then
- return;
- end if;
- if (or_reduce (slv(ne-1 downto VALUE'high-VALUE'low+1)) = '1') then
- return;
- end if;
- VALUE := to_float (slv(VALUE'high-VALUE'low downto 0),
- VALUE'high, -VALUE'low);
- end if;
- GOOD := true;
- end if;
- end procedure OREAD;
-
- procedure HWRITE (
- L : inout LINE; -- access type (pointer)
- VALUE : in UNRESOLVED_float; -- value to write
- JUSTIFIED : in SIDE := right; -- which side to justify text
- FIELD : in WIDTH := 0) is -- width of field
- begin
- WRITE (L => L,
- VALUE => to_hstring(VALUE),
- JUSTIFIED => JUSTIFIED,
- FIELD => FIELD);
- end procedure HWRITE;
-
- procedure HREAD (L : inout LINE; VALUE : out UNRESOLVED_float) is
- constant ne : INTEGER := ((value'length+3)/4) * 4; -- pad
- variable slv : STD_LOGIC_VECTOR (ne-1 downto 0); -- slv
- variable slvu : ufixed (VALUE'range); -- Unsigned fixed point
- variable c : CHARACTER;
- variable ok : BOOLEAN;
- variable nybble : STD_LOGIC_VECTOR (3 downto 0); -- 4 bits
- variable colon, dot : BOOLEAN;
- begin
- VALUE := (VALUE'range => 'U'); -- initialize to a "U"
- Skip_whitespace (L);
- if VALUE'length > 0 then
- check_punctuation (arg => L.all,
- colon => colon,
- dot => dot,
- good => ok,
- chars => ne/4);
- if not ok then
- report "float_pkg:" & "HREAD: "
- & "short string encounted: " & L.all
- & " needs to have " & integer'image (ne/4)
- & " valid hex characters."
- severity error;
- return;
- elsif dot then
- HREAD (L, slvu, ok); -- read it like a UFIXED number
- if not ok then
- report "float_pkg:" & "HREAD: "
- & "error encounted reading STRING " & L.all
- severity error;
- return;
- else
- VALUE := UNRESOLVED_float (slvu);
- end if;
- elsif colon then
- HREAD (L, nybble, ok); -- read the sign bit
- if not ok then
- report "float_pkg:" & "HREAD: "
- & "End of string encountered"
- severity error;
- return;
- elsif nybble (3 downto 1) /= "000" then
- report "float_pkg:" & "HREAD: "
- & "Illegal sign bit STRING encounted "
- severity error;
- return;
- end if;
- read (l, c, ok); -- read the colon
- fix_colon (L.all, ne/4); -- replaces the colon with a ".".
- HREAD (L, slvu (slvu'high-1 downto slvu'low), ok); -- read it like a UFIXED number
- if not ok then
- report "float_pkg:" & "HREAD: "
- & "error encounted reading STRING " & L.all
- severity error;
- return;
- else
- slvu (slvu'high) := nybble (0);
- VALUE := UNRESOLVED_float (slvu);
- end if;
- else
- HREAD (L, slv, ok);
- if not ok then
- report "float_pkg:" & "HREAD: "
- & "Error encounted during read"
- severity error;
- return;
- end if;
- if (or_reduce (slv(ne-1 downto VALUE'high-VALUE'low+1)) = '1') then
- report "float_pkg:" & "HREAD: "
- & "Vector truncated."
- severity error;
- return;
- end if;
- VALUE := to_float (slv(VALUE'high-VALUE'low downto 0),
- VALUE'high, -VALUE'low);
- end if;
- end if;
- end procedure HREAD;
-
- procedure HREAD (L : inout LINE; VALUE : out UNRESOLVED_float; GOOD : out BOOLEAN) is
- constant ne : INTEGER := ((value'length+3)/4) * 4; -- pad
- variable slv : STD_LOGIC_VECTOR (ne-1 downto 0); -- slv
- variable slvu : ufixed (VALUE'range); -- Unsigned fixed point
- variable c : CHARACTER;
- variable ok : BOOLEAN;
- variable nybble : STD_LOGIC_VECTOR (3 downto 0); -- 4 bits
- variable colon, dot : BOOLEAN;
- begin
- VALUE := (VALUE'range => 'U'); -- initialize to a "U"
- GOOD := false;
- Skip_whitespace (L);
- if VALUE'length > 0 then
- check_punctuation (arg => L.all,
- colon => colon,
- dot => dot,
- good => ok,
- chars => ne/4);
- if not ok then
- return;
- elsif dot then
- HREAD (L, slvu, ok); -- read it like a UFIXED number
- if not ok then
- return;
- else
- VALUE := UNRESOLVED_float (slvu);
- end if;
- elsif colon then
- HREAD (L, nybble, ok); -- read the sign bit
- if not ok then
- return;
- elsif nybble (3 downto 1) /= "000" then
- return;
- end if;
- read (l, c, ok); -- read the colon
- fix_colon (L.all, ne/4); -- replaces the colon with a ".".
- HREAD (L, slvu (slvu'high-1 downto slvu'low), ok); -- read it like a UFIXED number
- if not ok then
- return;
- else
- slvu (slvu'high) := nybble (0);
- VALUE := UNRESOLVED_float (slvu);
- end if;
- else
- HREAD (L, slv, ok);
- if not ok then
- return;
- end if;
- if (or_reduce (slv(ne-1 downto VALUE'high-VALUE'low+1)) = '1') then
- return;
- end if;
- VALUE := to_float (slv(VALUE'high-VALUE'low downto 0),
- VALUE'high, -VALUE'low);
- end if;
- GOOD := true;
- end if;
- end procedure HREAD;
-
- function to_string (value : UNRESOLVED_float) return STRING is
- variable s : STRING(1 to value'high - value'low +3);
- variable sindx : INTEGER;
- begin -- function write
- s(1) := MVL9_to_char(STD_ULOGIC(VALUE(VALUE'high)));
- s(2) := ':';
- sindx := 3;
- for i in VALUE'high-1 downto 0 loop
- s(sindx) := MVL9_to_char(STD_ULOGIC(VALUE(i)));
- sindx := sindx + 1;
- end loop;
- s(sindx) := ':';
- sindx := sindx + 1;
- for i in -1 downto VALUE'low loop
- s(sindx) := MVL9_to_char(STD_ULOGIC(VALUE(i)));
- sindx := sindx + 1;
- end loop;
- return s;
- end function to_string;
-
- function to_hstring (value : UNRESOLVED_float) return STRING is
- variable slv : STD_LOGIC_VECTOR (value'length-1 downto 0);
- begin
- floop : for i in slv'range loop
- slv(i) := to_X01Z (value(i + value'low));
- end loop floop;
- return to_hstring (slv);
- end function to_hstring;
-
- function to_ostring (value : UNRESOLVED_float) return STRING is
- variable slv : STD_LOGIC_VECTOR (value'length-1 downto 0);
- begin
- floop : for i in slv'range loop
- slv(i) := to_X01Z (value(i + value'low));
- end loop floop;
- return to_ostring (slv);
- end function to_ostring;
-
- function from_string (
- bstring : STRING; -- binary string
- constant exponent_width : NATURAL := float_exponent_width;
- constant fraction_width : NATURAL := float_fraction_width)
- return UNRESOLVED_float is
- variable result : UNRESOLVED_float (exponent_width downto -fraction_width);
- variable L : LINE;
- variable good : BOOLEAN;
- begin
- L := new STRING'(bstring);
- READ (L, result, good);
- deallocate (L);
- assert (good)
- report "float_pkg:"
- & "from_string: Bad string " & bstring
- severity error;
- return result;
- end function from_string;
-
- function from_ostring (
- ostring : STRING; -- Octal string
- constant exponent_width : NATURAL := float_exponent_width;
- constant fraction_width : NATURAL := float_fraction_width)
- return UNRESOLVED_float is
- variable result : UNRESOLVED_float (exponent_width downto -fraction_width);
- variable L : LINE;
- variable good : BOOLEAN;
- begin
- L := new STRING'(ostring);
- OREAD (L, result, good);
- deallocate (L);
- assert (good)
- report "float_pkg:"
- & "from_ostring: Bad string " & ostring
- severity error;
- return result;
- end function from_ostring;
-
- function from_hstring (
- hstring : STRING; -- hex string
- constant exponent_width : NATURAL := float_exponent_width;
- constant fraction_width : NATURAL := float_fraction_width)
- return UNRESOLVED_float is
- variable result : UNRESOLVED_float (exponent_width downto -fraction_width);
- variable L : LINE;
- variable good : BOOLEAN;
- begin
- L := new STRING'(hstring);
- HREAD (L, result, good);
- deallocate (L);
- assert (good)
- report "float_pkg:"
- & "from_hstring: Bad string " & hstring
- severity error;
- return result;
- end function from_hstring;
-
- function from_string (
- bstring : STRING; -- binary string
- size_res : UNRESOLVED_float) -- used for sizing only
- return UNRESOLVED_float is
- begin
- return from_string (bstring => bstring,
- exponent_width => size_res'high,
- fraction_width => -size_res'low);
- end function from_string;
-
- function from_ostring (
- ostring : STRING; -- Octal string
- size_res : UNRESOLVED_float) -- used for sizing only
- return UNRESOLVED_float is
- begin
- return from_ostring (ostring => ostring,
- exponent_width => size_res'high,
- fraction_width => -size_res'low);
- end function from_ostring;
-
- function from_hstring (
- hstring : STRING; -- hex string
- size_res : UNRESOLVED_float) -- used for sizing only
- return UNRESOLVED_float is
- begin
- return from_hstring (hstring => hstring,
- exponent_width => size_res'high,
- fraction_width => -size_res'low);
- end function from_hstring;
--- rtl_synthesis on
--- pragma synthesis_on
- function to_float (
- arg : STD_LOGIC_VECTOR;
- constant exponent_width : NATURAL := float_exponent_width; -- length of FP output exponent
- constant fraction_width : NATURAL := float_fraction_width) -- length of FP output fraction
- return UNRESOLVED_float is
- begin
- return to_float (
- arg => std_ulogic_vector (arg),
- exponent_width => exponent_width,
- fraction_width => fraction_width);
- end function to_float;
-
- function to_float (
- arg : STD_LOGIC_VECTOR;
- size_res : UNRESOLVED_float)
- return UNRESOLVED_float is
- begin
- return to_float (
- arg => std_ulogic_vector (arg),
- size_res => size_res);
- end function to_float;
-
- -- For Verilog compatability
- function realtobits (arg : REAL) return STD_LOGIC_VECTOR is
- variable result : float64; -- 64 bit floating point
- begin
- result := to_float (arg => arg,
- exponent_width => float64'high,
- fraction_width => -float64'low);
- return to_slv (result);
- end function realtobits;
-
- function bitstoreal (arg : STD_LOGIC_VECTOR) return REAL is
- variable arg64 : float64; -- arg converted to float
- begin
- arg64 := to_float (arg => arg,
- exponent_width => float64'high,
- fraction_width => -float64'low);
- return to_real (arg64);
- end function bitstoreal;
-
-end package body float_pkg;
diff --git a/ieee_proposed/rtl/numeric_std_additions.vhd b/ieee_proposed/rtl/numeric_std_additions.vhd
deleted file mode 100644
index 4440d27..0000000
--- a/ieee_proposed/rtl/numeric_std_additions.vhd
+++ /dev/null
@@ -1,2886 +0,0 @@
-------------------------------------------------------------------------------
--- "numeric_std_additions" package contains the additions to the standard
--- "numeric_std" package proposed by the VHDL-200X-ft working group.
--- This package should be compiled into "ieee_proposed" and used as follows:
--- use ieee.std_logic_1164.all;
--- use ieee.numeric_std.all;
--- use ieee_proposed.numeric_std_additions.all;
--- (this package is independant of "std_logic_1164_additions")
--- Last Modified: $Date: 2007/09/27 14:46:32 $
--- RCS ID: $Id: numeric_std_additions.vhdl,v 1.9 2007/09/27 14:46:32 l435385 Exp $
---
--- Created for VHDL-200X par, David Bishop (dbishop@vhdl.org)
-------------------------------------------------------------------------------
-library ieee;
-use ieee.std_logic_1164.all;
-use ieee.numeric_std.all;
-use std.textio.all;
-
-package numeric_std_additions is
- -- Make these a subtype of "signed" and "unsigned" for compatability
--- type UNRESOLVED_UNSIGNED is array (NATURAL range <>) of STD_ULOGIC;
--- type UNRESOLVED_SIGNED is array (NATURAL range <>) of STD_ULOGIC;
-
- subtype UNRESOLVED_UNSIGNED is UNSIGNED;
- subtype UNRESOLVED_SIGNED is SIGNED;
--- alias U_UNSIGNED is UNRESOLVED_UNSIGNED;
--- alias U_SIGNED is UNRESOLVED_SIGNED;
- subtype U_UNSIGNED is UNSIGNED;
- subtype U_SIGNED is SIGNED;
-
- -- Id: A.3R
- function "+"(L : UNSIGNED; R : STD_ULOGIC) return UNSIGNED;
- -- Result subtype: UNSIGNED(L'RANGE)
- -- Result: Similar to A.3 where R is a one bit UNSIGNED
-
- -- Id: A.3L
- function "+"(L : STD_ULOGIC; R : UNSIGNED) return UNSIGNED;
- -- Result subtype: UNSIGNED(R'RANGE)
- -- Result: Similar to A.3 where L is a one bit UNSIGNED
-
- -- Id: A.4R
- function "+"(L : SIGNED; R : STD_ULOGIC) return SIGNED;
- -- Result subtype: SIGNED(L'RANGE)
- -- Result: Similar to A.4 where R is bit 0 of a non-negative
- -- SIGNED
-
- -- Id: A.4L
- function "+"(L : STD_ULOGIC; R : SIGNED) return SIGNED;
- -- Result subtype: UNSIGNED(R'RANGE)
- -- Result: Similar to A.4 where L is bit 0 of a non-negative
- -- SIGNED
- -- Id: A.9R
- function "-"(L : UNSIGNED; R : STD_ULOGIC) return UNSIGNED;
- -- Result subtype: UNSIGNED(L'RANGE)
- -- Result: Similar to A.9 where R is a one bit UNSIGNED
-
- -- Id: A.9L
- function "-"(L : STD_ULOGIC; R : UNSIGNED) return UNSIGNED;
- -- Result subtype: UNSIGNED(R'RANGE)
- -- Result: Similar to A.9 where L is a one bit UNSIGNED
-
- -- Id: A.10R
- function "-"(L : SIGNED; R : STD_ULOGIC) return SIGNED;
- -- Result subtype: SIGNED(L'RANGE)
- -- Result: Similar to A.10 where R is bit 0 of a non-negative
- -- SIGNED
-
- -- Id: A.10L
- function "-"(L : STD_ULOGIC; R : SIGNED) return SIGNED;
- -- Result subtype: UNSIGNED(R'RANGE)
- -- Result: Similar to A.10 where R is bit 0 of a non-negative
- -- SIGNED
-
- -- Id: M.2B
- -- %%% function "?=" (L, R : UNSIGNED) return std_ulogic;
- -- %%% function "?/=" (L, R : UNSIGNED) return std_ulogic;
- -- %%% function "?>" (L, R : UNSIGNED) return std_ulogic;
- -- %%% function "?>=" (L, R : UNSIGNED) return std_ulogic;
- -- %%% function "?<" (L, R : UNSIGNED) return std_ulogic;
- -- %%% function "?<=" (L, R : UNSIGNED) return std_ulogic;
--- function \?=\ (L, R : UNSIGNED) return STD_ULOGIC;
--- function \?/=\ (L, R : UNSIGNED) return STD_ULOGIC;
- function \?>\ (L, R : UNSIGNED) return STD_ULOGIC;
- function \?>=\ (L, R : UNSIGNED) return STD_ULOGIC;
- function \?<\ (L, R : UNSIGNED) return STD_ULOGIC;
- function \?<=\ (L, R : UNSIGNED) return STD_ULOGIC;
--- function \?=\ (L : UNSIGNED; R : NATURAL) return STD_ULOGIC;
--- function \?/=\ (L : UNSIGNED; R : NATURAL) return STD_ULOGIC;
- function \?>\ (L : UNSIGNED; R : NATURAL) return STD_ULOGIC;
- function \?>=\ (L : UNSIGNED; R : NATURAL) return STD_ULOGIC;
- function \?<\ (L : UNSIGNED; R : NATURAL) return STD_ULOGIC;
- function \?<=\ (L : UNSIGNED; R : NATURAL) return STD_ULOGIC;
--- function \?=\ (L : NATURAL; R : UNSIGNED) return STD_ULOGIC;
--- function \?/=\ (L : NATURAL; R : UNSIGNED) return STD_ULOGIC;
- function \?>\ (L : NATURAL; R : UNSIGNED) return STD_ULOGIC;
- function \?>=\ (L : NATURAL; R : UNSIGNED) return STD_ULOGIC;
- function \?<\ (L : NATURAL; R : UNSIGNED) return STD_ULOGIC;
- function \?<=\ (L : NATURAL; R : UNSIGNED) return STD_ULOGIC;
- -- Result subtype: STD_ULOGIC
- -- Result: terms compared per STD_LOGIC_1164 intent,
- -- returns an 'X' if a metavalue is passed
-
- -- Id: M.3B
- -- %%% function "?=" (L, R : SIGNED) return std_ulogic;
- -- %%% function "?/=" (L, R : SIGNED) return std_ulogic;
- -- %%% function "?>" (L, R : SIGNED) return std_ulogic;
- -- %%% function "?>=" (L, R : SIGNED) return std_ulogic;
- -- %%% function "?<" (L, R : SIGNED) return std_ulogic;
- -- %%% function "?<=" (L, R : SIGNED) return std_ulogic;
--- function \?=\ (L, R : SIGNED) return STD_ULOGIC;
--- function \?/=\ (L, R : SIGNED) return STD_ULOGIC;
- function \?>\ (L, R : SIGNED) return STD_ULOGIC;
- function \?>=\ (L, R : SIGNED) return STD_ULOGIC;
- function \?<\ (L, R : SIGNED) return STD_ULOGIC;
- function \?<=\ (L, R : SIGNED) return STD_ULOGIC;
--- function \?=\ (L : SIGNED; R : INTEGER) return STD_ULOGIC;
--- function \?/=\ (L : SIGNED; R : INTEGER) return STD_ULOGIC;
- function \?>\ (L : SIGNED; R : INTEGER) return STD_ULOGIC;
- function \?>=\ (L : SIGNED; R : INTEGER) return STD_ULOGIC;
- function \?<\ (L : SIGNED; R : INTEGER) return STD_ULOGIC;
- function \?<=\ (L : SIGNED; R : INTEGER) return STD_ULOGIC;
--- function \?=\ (L : INTEGER; R : SIGNED) return STD_ULOGIC;
--- function \?/=\ (L : INTEGER; R : SIGNED) return STD_ULOGIC;
- function \?>\ (L : INTEGER; R : SIGNED) return STD_ULOGIC;
- function \?>=\ (L : INTEGER; R : SIGNED) return STD_ULOGIC;
- function \?<\ (L : INTEGER; R : SIGNED) return STD_ULOGIC;
- function \?<=\ (L : INTEGER; R : SIGNED) return STD_ULOGIC;
- -- Result subtype: std_ulogic
- -- Result: terms compared per STD_LOGIC_1164 intent,
- -- returns an 'X' if a metavalue is passed
-
- -- size_res versions of these functions (Bugzilla 165)
- function TO_UNSIGNED (ARG : NATURAL; SIZE_RES : UNSIGNED) return UNSIGNED;
- -- Result subtype: UNRESOLVED_UNSIGNED(SIZE_RES'length-1 downto 0)
- function TO_SIGNED (ARG : INTEGER; SIZE_RES : SIGNED) return SIGNED;
- -- Result subtype: UNRESOLVED_SIGNED(SIZE_RES'length-1 downto 0)
- function RESIZE (ARG, SIZE_RES : UNSIGNED) return UNSIGNED;
- -- Result subtype: UNRESOLVED_UNSIGNED (SIZE_RES'length-1 downto 0)
- function RESIZE (ARG, SIZE_RES : SIGNED) return SIGNED;
- -- Result subtype: UNRESOLVED_SIGNED (SIZE_RES'length-1 downto 0)
- -----------------------------------------------------------------------------
- -- New/updated funcitons for VHDL-200X fast track
- -----------------------------------------------------------------------------
-
- -- Overloaded functions from "std_logic_1164"
- function To_X01 (s : UNSIGNED) return UNSIGNED;
- function To_X01 (s : SIGNED) return SIGNED;
-
- function To_X01Z (s : UNSIGNED) return UNSIGNED;
- function To_X01Z (s : SIGNED) return SIGNED;
-
- function To_UX01 (s : UNSIGNED) return UNSIGNED;
- function To_UX01 (s : SIGNED) return SIGNED;
-
- function Is_X (s : UNSIGNED) return BOOLEAN;
- function Is_X (s : SIGNED) return BOOLEAN;
-
- function "sla" (ARG : SIGNED; COUNT : INTEGER) return SIGNED;
- function "sla" (ARG : UNSIGNED; COUNT : INTEGER) return UNSIGNED;
-
- function "sra" (ARG : SIGNED; COUNT : INTEGER) return SIGNED;
- function "sra" (ARG : UNSIGNED; COUNT : INTEGER) return UNSIGNED;
-
- -- Returns the maximum (or minimum) of the two numbers provided.
- -- All types (both inputs and the output) must be the same.
- -- These override the implicit funcitons, using the local ">" operator
- function maximum (
- l, r : UNSIGNED) -- inputs
- return UNSIGNED;
-
- function maximum (
- l, r : SIGNED) -- inputs
- return SIGNED;
-
- function minimum (
- l, r : UNSIGNED) -- inputs
- return UNSIGNED;
-
- function minimum (
- l, r : SIGNED) -- inputs
- return SIGNED;
-
- function maximum (
- l : UNSIGNED; r : NATURAL) -- inputs
- return UNSIGNED;
-
- function maximum (
- l : SIGNED; r : INTEGER) -- inputs
- return SIGNED;
-
- function minimum (
- l : UNSIGNED; r : NATURAL) -- inputs
- return UNSIGNED;
-
- function minimum (
- l : SIGNED; r : INTEGER) -- inputs
- return SIGNED;
-
- function maximum (
- l : NATURAL; r : UNSIGNED) -- inputs
- return UNSIGNED;
-
- function maximum (
- l : INTEGER; r : SIGNED) -- inputs
- return SIGNED;
-
- function minimum (
- l : NATURAL; r : UNSIGNED) -- inputs
- return UNSIGNED;
-
- function minimum (
- l : INTEGER; r : SIGNED) -- inputs
- return SIGNED;
- -- Finds the first "Y" in the input string. Returns an integer index
- -- into that string. If "Y" does not exist in the string, then the
- -- "find_rightmost" returns arg'low -1, and "find_leftmost" returns -1
- function find_rightmost (
- arg : UNSIGNED; -- vector argument
- y : STD_ULOGIC) -- look for this bit
- return INTEGER;
-
- function find_rightmost (
- arg : SIGNED; -- vector argument
- y : STD_ULOGIC) -- look for this bit
- return INTEGER;
-
- function find_leftmost (
- arg : UNSIGNED; -- vector argument
- y : STD_ULOGIC) -- look for this bit
- return INTEGER;
-
- function find_leftmost (
- arg : SIGNED; -- vector argument
- y : STD_ULOGIC) -- look for this bit
- return INTEGER;
-
- function TO_UNRESOLVED_UNSIGNED (ARG, SIZE : NATURAL) return UNRESOLVED_UNSIGNED;
- -- Result subtype: UNRESOLVED_UNSIGNED(SIZE-1 downto 0)
- -- Result: Converts a nonnegative INTEGER to an UNRESOLVED_UNSIGNED vector with
- -- the specified SIZE.
-
- alias TO_U_UNSIGNED is
- TO_UNRESOLVED_UNSIGNED[NATURAL, NATURAL return UNRESOLVED_UNSIGNED];
-
- function TO_UNRESOLVED_SIGNED (ARG : INTEGER; SIZE : NATURAL) return UNRESOLVED_SIGNED;
- -- Result subtype: UNRESOLVED_SIGNED(SIZE-1 downto 0)
- -- Result: Converts an INTEGER to an UNRESOLVED_SIGNED vector of the specified SIZE.
-
- alias TO_U_SIGNED is
- TO_UNRESOLVED_SIGNED[NATURAL, NATURAL return UNRESOLVED_SIGNED];
-
- -- L.15
- function "and" (L : STD_ULOGIC; R : UNSIGNED) return UNSIGNED;
-
--- L.16
- function "and" (L : UNSIGNED; R : STD_ULOGIC) return UNSIGNED;
-
--- L.17
- function "or" (L : STD_ULOGIC; R : UNSIGNED) return UNSIGNED;
-
--- L.18
- function "or" (L : UNSIGNED; R : STD_ULOGIC) return UNSIGNED;
-
--- L.19
- function "nand" (L : STD_ULOGIC; R : UNSIGNED) return UNSIGNED;
-
--- L.20
- function "nand" (L : UNSIGNED; R : STD_ULOGIC) return UNSIGNED;
-
--- L.21
- function "nor" (L : STD_ULOGIC; R : UNSIGNED) return UNSIGNED;
-
--- L.22
- function "nor" (L : UNSIGNED; R : STD_ULOGIC) return UNSIGNED;
-
--- L.23
- function "xor" (L : STD_ULOGIC; R : UNSIGNED) return UNSIGNED;
-
--- L.24
- function "xor" (L : UNSIGNED; R : STD_ULOGIC) return UNSIGNED;
-
--- L.25
- function "xnor" (L : STD_ULOGIC; R : UNSIGNED) return UNSIGNED;
-
--- L.26
- function "xnor" (L : UNSIGNED; R : STD_ULOGIC) return UNSIGNED;
-
--- L.27
- function "and" (L : STD_ULOGIC; R : SIGNED) return SIGNED;
-
--- L.28
- function "and" (L : SIGNED; R : STD_ULOGIC) return SIGNED;
-
--- L.29
- function "or" (L : STD_ULOGIC; R : SIGNED) return SIGNED;
-
--- L.30
- function "or" (L : SIGNED; R : STD_ULOGIC) return SIGNED;
-
--- L.31
- function "nand" (L : STD_ULOGIC; R : SIGNED) return SIGNED;
-
--- L.32
- function "nand" (L : SIGNED; R : STD_ULOGIC) return SIGNED;
-
--- L.33
- function "nor" (L : STD_ULOGIC; R : SIGNED) return SIGNED;
-
--- L.34
- function "nor" (L : SIGNED; R : STD_ULOGIC) return SIGNED;
-
--- L.35
- function "xor" (L : STD_ULOGIC; R : SIGNED) return SIGNED;
-
--- L.36
- function "xor" (L : SIGNED; R : STD_ULOGIC) return SIGNED;
-
--- L.37
- function "xnor" (L : STD_ULOGIC; R : SIGNED) return SIGNED;
-
--- L.38
- function "xnor" (L : SIGNED; R : STD_ULOGIC) return SIGNED;
-
- -- %%% remove 12 functions (old syntax)
- function and_reduce(l : SIGNED) return STD_ULOGIC;
- -- Result subtype: STD_LOGIC.
- -- Result: Result of and'ing all of the bits of the vector.
-
- function nand_reduce(l : SIGNED) return STD_ULOGIC;
- -- Result subtype: STD_LOGIC.
- -- Result: Result of nand'ing all of the bits of the vector.
-
- function or_reduce(l : SIGNED) return STD_ULOGIC;
- -- Result subtype: STD_LOGIC.
- -- Result: Result of or'ing all of the bits of the vector.
-
- function nor_reduce(l : SIGNED) return STD_ULOGIC;
- -- Result subtype: STD_LOGIC.
- -- Result: Result of nor'ing all of the bits of the vector.
-
- function xor_reduce(l : SIGNED) return STD_ULOGIC;
- -- Result subtype: STD_LOGIC.
- -- Result: Result of xor'ing all of the bits of the vector.
-
- function xnor_reduce(l : SIGNED) return STD_ULOGIC;
- -- Result subtype: STD_LOGIC.
- -- Result: Result of xnor'ing all of the bits of the vector.
-
- function and_reduce(l : UNSIGNED) return STD_ULOGIC;
- -- Result subtype: STD_LOGIC.
- -- Result: Result of and'ing all of the bits of the vector.
-
- function nand_reduce(l : UNSIGNED) return STD_ULOGIC;
- -- Result subtype: STD_LOGIC.
- -- Result: Result of nand'ing all of the bits of the vector.
-
- function or_reduce(l : UNSIGNED) return STD_ULOGIC;
- -- Result subtype: STD_LOGIC.
- -- Result: Result of or'ing all of the bits of the vector.
-
- function nor_reduce(l : UNSIGNED) return STD_ULOGIC;
- -- Result subtype: STD_LOGIC.
- -- Result: Result of nor'ing all of the bits of the vector.
-
- function xor_reduce(l : UNSIGNED) return STD_ULOGIC;
- -- Result subtype: STD_LOGIC.
- -- Result: Result of xor'ing all of the bits of the vector.
-
- function xnor_reduce(l : UNSIGNED) return STD_ULOGIC;
- -- Result subtype: STD_LOGIC.
- -- Result: Result of xnor'ing all of the bits of the vector.
-
- -- %%% Uncomment the following 12 functions (new syntax)
- -- function "and" ( l : SIGNED ) RETURN std_ulogic;
- -- function "nand" ( l : SIGNED ) RETURN std_ulogic;
- -- function "or" ( l : SIGNED ) RETURN std_ulogic;
- -- function "nor" ( l : SIGNED ) RETURN std_ulogic;
- -- function "xor" ( l : SIGNED ) RETURN std_ulogic;
- -- function "xnor" ( l : SIGNED ) RETURN std_ulogic;
- -- function "and" ( l : UNSIGNED ) RETURN std_ulogic;
- -- function "nand" ( l : UNSIGNED ) RETURN std_ulogic;
- -- function "or" ( l : UNSIGNED ) RETURN std_ulogic;
- -- function "nor" ( l : UNSIGNED ) RETURN std_ulogic;
- -- function "xor" ( l : UNSIGNED ) RETURN std_ulogic;
- -- function "xnor" ( l : UNSIGNED ) RETURN std_ulogic;
-
- -- rtl_synthesis off
--- pragma synthesis_off
- -------------------------------------------------------------------
- -- string functions
- -------------------------------------------------------------------
- function to_string (value : UNSIGNED) return STRING;
- function to_string (value : SIGNED) return STRING;
-
- -- explicitly defined operations
-
- alias to_bstring is to_string [UNSIGNED return STRING];
- alias to_bstring is to_string [SIGNED return STRING];
- alias to_binary_string is to_string [UNSIGNED return STRING];
- alias to_binary_string is to_string [SIGNED return STRING];
-
- function to_ostring (value : UNSIGNED) return STRING;
- function to_ostring (value : SIGNED) return STRING;
- alias to_octal_string is to_ostring [UNSIGNED return STRING];
- alias to_octal_string is to_ostring [SIGNED return STRING];
-
- function to_hstring (value : UNSIGNED) return STRING;
- function to_hstring (value : SIGNED) return STRING;
- alias to_hex_string is to_hstring [UNSIGNED return STRING];
- alias to_hex_string is to_hstring [SIGNED return STRING];
-
- procedure READ(L : inout LINE; VALUE : out UNSIGNED; GOOD : out BOOLEAN);
-
- procedure READ(L : inout LINE; VALUE : out UNSIGNED);
-
- procedure READ(L : inout LINE; VALUE : out SIGNED; GOOD : out BOOLEAN);
-
- procedure READ(L : inout LINE; VALUE : out SIGNED);
-
- procedure WRITE (L : inout LINE; VALUE : in UNSIGNED;
- JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0);
-
- procedure WRITE (L : inout LINE; VALUE : in SIGNED;
- JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0);
-
- alias BREAD is READ [LINE, UNSIGNED, BOOLEAN];
- alias BREAD is READ [LINE, SIGNED, BOOLEAN];
-
- alias BREAD is READ [LINE, UNSIGNED];
- alias BREAD is READ [LINE, SIGNED];
-
- alias BINARY_READ is READ [LINE, UNSIGNED, BOOLEAN];
- alias BINARY_READ is READ [LINE, SIGNED, BOOLEAN];
-
- alias BINARY_READ is READ [LINE, UNSIGNED];
- alias BINARY_READ is READ [LINE, SIGNED];
-
- procedure OREAD (L : inout LINE; VALUE : out UNSIGNED; GOOD : out BOOLEAN);
- procedure OREAD (L : inout LINE; VALUE : out SIGNED; GOOD : out BOOLEAN);
-
- procedure OREAD (L : inout LINE; VALUE : out UNSIGNED);
- procedure OREAD (L : inout LINE; VALUE : out SIGNED);
-
- alias OCTAL_READ is OREAD [LINE, UNSIGNED, BOOLEAN];
- alias OCTAL_READ is OREAD [LINE, SIGNED, BOOLEAN];
-
- alias OCTAL_READ is OREAD [LINE, UNSIGNED];
- alias OCTAL_READ is OREAD [LINE, SIGNED];
-
- procedure HREAD (L : inout LINE; VALUE : out UNSIGNED; GOOD : out BOOLEAN);
- procedure HREAD (L : inout LINE; VALUE : out SIGNED; GOOD : out BOOLEAN);
-
- procedure HREAD (L : inout LINE; VALUE : out UNSIGNED);
- procedure HREAD (L : inout LINE; VALUE : out SIGNED);
-
- alias HEX_READ is HREAD [LINE, UNSIGNED, BOOLEAN];
- alias HEX_READ is HREAD [LINE, SIGNED, BOOLEAN];
-
- alias HEX_READ is HREAD [LINE, UNSIGNED];
- alias HEX_READ is HREAD [LINE, SIGNED];
-
- alias BWRITE is WRITE [LINE, UNSIGNED, SIDE, WIDTH];
- alias BWRITE is WRITE [LINE, SIGNED, SIDE, WIDTH];
-
- alias BINARY_WRITE is WRITE [LINE, UNSIGNED, SIDE, WIDTH];
- alias BINARY_WRITE is WRITE [LINE, SIGNED, SIDE, WIDTH];
-
- procedure OWRITE (L : inout LINE; VALUE : in UNSIGNED;
- JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0);
-
- procedure OWRITE (L : inout LINE; VALUE : in SIGNED;
- JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0);
-
- alias OCTAL_WRITE is OWRITE [LINE, UNSIGNED, SIDE, WIDTH];
- alias OCTAL_WRITE is OWRITE [LINE, SIGNED, SIDE, WIDTH];
-
- procedure HWRITE (L : inout LINE; VALUE : in UNSIGNED;
- JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0);
-
- procedure HWRITE (L : inout LINE; VALUE : in SIGNED;
- JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0);
-
- alias HEX_WRITE is HWRITE [LINE, UNSIGNED, SIDE, WIDTH];
- alias HEX_WRITE is HWRITE [LINE, SIGNED, SIDE, WIDTH];
-
- -- rtl_synthesis on
--- pragma synthesis_on
-end package numeric_std_additions;
-
-package body numeric_std_additions is
- constant NAU : UNSIGNED(0 downto 1) := (others => '0');
- constant NAS : SIGNED(0 downto 1) := (others => '0');
- constant NO_WARNING : BOOLEAN := false; -- default to emit warnings
- function MAX (left, right : INTEGER) return INTEGER is
- begin
- if left > right then return left;
- else return right;
- end if;
- end function MAX;
-
- -- Id: A.3R
- function "+"(L : UNSIGNED; R: STD_ULOGIC) return UNSIGNED is
- variable XR : UNSIGNED(L'length-1 downto 0) := (others => '0');
- begin
- XR(0) := R;
- return (L + XR);
- end function "+";
-
- -- Id: A.3L
- function "+"(L : STD_ULOGIC; R: UNSIGNED) return UNSIGNED is
- variable XL : UNSIGNED(R'length-1 downto 0) := (others => '0');
- begin
- XL(0) := L;
- return (XL + R);
- end function "+";
-
- -- Id: A.4R
- function "+"(L : SIGNED; R: STD_ULOGIC) return SIGNED is
- variable XR : SIGNED(L'length-1 downto 0) := (others => '0');
- begin
- XR(0) := R;
- return (L + XR);
- end function "+";
-
- -- Id: A.4L
- function "+"(L : STD_ULOGIC; R: SIGNED) return SIGNED is
- variable XL : SIGNED(R'length-1 downto 0) := (others => '0');
- begin
- XL(0) := L;
- return (XL + R);
- end function "+";
-
- -- Id: A.9R
- function "-"(L : UNSIGNED; R: STD_ULOGIC) return UNSIGNED is
- variable XR : UNSIGNED(L'length-1 downto 0) := (others => '0');
- begin
- XR(0) := R;
- return (L - XR);
- end function "-";
-
- -- Id: A.9L
- function "-"(L : STD_ULOGIC; R: UNSIGNED) return UNSIGNED is
- variable XL : UNSIGNED(R'length-1 downto 0) := (others => '0');
- begin
- XL(0) := L;
- return (XL - R);
- end function "-";
-
- -- Id: A.10R
- function "-"(L : SIGNED; R: STD_ULOGIC) return SIGNED is
- variable XR : SIGNED(L'length-1 downto 0) := (others => '0');
- begin
- XR(0) := R;
- return (L - XR);
- end function "-";
-
- -- Id: A.10L
- function "-"(L : STD_ULOGIC; R: SIGNED) return SIGNED is
- variable XL : SIGNED(R'length-1 downto 0) := (others => '0');
- begin
- XL(0) := L;
- return (XL - R);
- end function "-";
-
--- type stdlogic_table is array(STD_ULOGIC, STD_ULOGIC) of STD_ULOGIC;
--- constant match_logic_table : stdlogic_table := (
--- -----------------------------------------------------
--- -- U X 0 1 Z W L H - | |
--- -----------------------------------------------------
--- ( 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', '1' ), -- | U |
--- ( 'U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', '1' ), -- | X |
--- ( 'U', 'X', '1', '0', 'X', 'X', '1', '0', '1' ), -- | 0 |
--- ( 'U', 'X', '0', '1', 'X', 'X', '0', '1', '1' ), -- | 1 |
--- ( 'U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', '1' ), -- | Z |
--- ( 'U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', '1' ), -- | W |
--- ( 'U', 'X', '1', '0', 'X', 'X', '1', '0', '1' ), -- | L |
--- ( 'U', 'X', '0', '1', 'X', 'X', '0', '1', '1' ), -- | H |
--- ( '1', '1', '1', '1', '1', '1', '1', '1', '1' ) -- | - |
--- );
--- constant no_match_logic_table : stdlogic_table := (
--- -----------------------------------------------------
--- -- U X 0 1 Z W L H - | |
--- -----------------------------------------------------
--- ('U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', '0'), -- | U |
--- ('U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', '0'), -- | X |
--- ('U', 'X', '0', '1', 'X', 'X', '0', '1', '0'), -- | 0 |
--- ('U', 'X', '1', '0', 'X', 'X', '1', '0', '0'), -- | 1 |
--- ('U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', '0'), -- | Z |
--- ('U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', '0'), -- | W |
--- ('U', 'X', '0', '1', 'X', 'X', '0', '1', '0'), -- | L |
--- ('U', 'X', '1', '0', 'X', 'X', '1', '0', '0'), -- | H |
--- ('0', '0', '0', '0', '0', '0', '0', '0', '0') -- | - |
--- );
-
--- %%% FUNCTION "?=" ( l, r : std_ulogic ) RETURN std_ulogic IS
--- function \?=\ ( l, r : STD_ULOGIC ) return STD_ULOGIC is
--- variable value : STD_ULOGIC;
--- begin
--- return match_logic_table (l, r);
--- end function \?=\;
--- function \?/=\ (l, r : STD_ULOGIC) return STD_ULOGIC is
--- begin
--- return no_match_logic_table (l, r);
--- end function \?/=\;
-
- -- "?=" operator is similar to "std_match", but returns a std_ulogic..
- -- Id: M.2B
--- function \?=\ (L, R: UNSIGNED) return STD_ULOGIC is
--- constant L_LEFT : INTEGER := L'length-1;
--- constant R_LEFT : INTEGER := R'length-1;
--- alias XL : UNSIGNED(L_LEFT downto 0) is L;
--- alias XR : UNSIGNED(R_LEFT downto 0) is R;
--- constant SIZE : NATURAL := MAX(L'length, R'length);
--- variable LX : UNSIGNED(SIZE-1 downto 0);
--- variable RX : UNSIGNED(SIZE-1 downto 0);
--- variable result, result1 : STD_ULOGIC; -- result
--- begin
--- -- Logically identical to an "=" operator.
--- if ((L'length < 1) or (R'length < 1)) then
--- assert NO_WARNING
--- report "NUMERIC_STD.""?="": null detected, returning X"
--- severity warning;
--- return 'X';
--- else
--- LX := RESIZE(XL, SIZE);
--- RX := RESIZE(XR, SIZE);
--- result := '1';
--- for i in LX'low to LX'high loop
--- result1 := \?=\(LX(i), RX(i));
--- if result1 = 'U' then
--- return 'U';
--- elsif result1 = 'X' or result = 'X' then
--- result := 'X';
--- else
--- result := result and result1;
--- end if;
--- end loop;
--- return result;
--- end if;
--- end function \?=\;
-
--- -- %%% Replace with the following function
--- -- function "?=" (L, R: UNSIGNED) return std_ulogic is
--- -- end function "?=";
-
--- -- Id: M.3B
--- function \?=\ (L, R: SIGNED) return STD_ULOGIC is
--- constant L_LEFT : INTEGER := L'length-1;
--- constant R_LEFT : INTEGER := R'length-1;
--- alias XL : SIGNED(L_LEFT downto 0) is L;
--- alias XR : SIGNED(R_LEFT downto 0) is R;
--- constant SIZE : NATURAL := MAX(L'length, R'length);
--- variable LX : SIGNED(SIZE-1 downto 0);
--- variable RX : SIGNED(SIZE-1 downto 0);
--- variable result, result1 : STD_ULOGIC; -- result
--- begin -- ?=
--- if ((L'length < 1) or (R'length < 1)) then
--- assert NO_WARNING
--- report "NUMERIC_STD.""?="": null detected, returning X"
--- severity warning;
--- return 'X';
--- else
--- LX := RESIZE(XL, SIZE);
--- RX := RESIZE(XR, SIZE);
--- result := '1';
--- for i in LX'low to LX'high loop
--- result1 := \?=\ (LX(i), RX(i));
--- if result1 = 'U' then
--- return 'U';
--- elsif result1 = 'X' or result = 'X' then
--- result := 'X';
--- else
--- result := result and result1;
--- end if;
--- end loop;
--- return result;
--- end if;
--- end function \?=\;
- -- %%% Replace with the following function
--- function "?=" (L, R: signed) return std_ulogic is
--- end function "?=";
-
- -- Id: C.75
--- function \?=\ (L : NATURAL; R : UNSIGNED) return STD_ULOGIC is
--- begin
--- return \?=\ (TO_UNSIGNED(L, R'length), R);
--- end function \?=\;
-
--- -- Id: C.76
--- function \?=\ (L : INTEGER; R : SIGNED) return STD_ULOGIC is
--- begin
--- return \?=\ (TO_SIGNED(L, R'length), R);
--- end function \?=\;
-
--- -- Id: C.77
--- function \?=\ (L : UNSIGNED; R : NATURAL) return STD_ULOGIC is
--- begin
--- return \?=\ (L, TO_UNSIGNED(R, L'length));
--- end function \?=\;
-
--- -- Id: C.78
--- function \?=\ (L : SIGNED; R : INTEGER) return STD_ULOGIC is
--- begin
--- return \?=\ (L, TO_SIGNED(R, L'length));
--- end function \?=\;
-
--- function \?/=\ (L, R : UNSIGNED) return STD_ULOGIC is
--- constant L_LEFT : INTEGER := L'length-1;
--- constant R_LEFT : INTEGER := R'length-1;
--- alias XL : UNSIGNED(L_LEFT downto 0) is L;
--- alias XR : UNSIGNED(R_LEFT downto 0) is R;
--- constant SIZE : NATURAL := MAX(L'length, R'length);
--- variable LX : UNSIGNED(SIZE-1 downto 0);
--- variable RX : UNSIGNED(SIZE-1 downto 0);
--- variable result, result1 : STD_ULOGIC; -- result
--- begin -- ?=
--- if ((L'length < 1) or (R'length < 1)) then
--- assert NO_WARNING
--- report "NUMERIC_STD.""?/="": null detected, returning X"
--- severity warning;
--- return 'X';
--- else
--- LX := RESIZE(XL, SIZE);
--- RX := RESIZE(XR, SIZE);
--- result := '0';
--- for i in LX'low to LX'high loop
--- result1 := \?/=\ (LX(i), RX(i));
--- if result1 = 'U' then
--- return 'U';
--- elsif result1 = 'X' or result = 'X' then
--- result := 'X';
--- else
--- result := result or result1;
--- end if;
--- end loop;
--- return result;
--- end if;
--- end function \?/=\;
--- -- %%% function "?/=" (L, R : UNSIGNED) return std_ulogic is
--- -- %%% end function "?/=";
--- function \?/=\ (L, R : SIGNED) return STD_ULOGIC is
--- constant L_LEFT : INTEGER := L'length-1;
--- constant R_LEFT : INTEGER := R'length-1;
--- alias XL : SIGNED(L_LEFT downto 0) is L;
--- alias XR : SIGNED(R_LEFT downto 0) is R;
--- constant SIZE : NATURAL := MAX(L'length, R'length);
--- variable LX : SIGNED(SIZE-1 downto 0);
--- variable RX : SIGNED(SIZE-1 downto 0);
--- variable result, result1 : STD_ULOGIC; -- result
--- begin -- ?=
--- if ((L'length < 1) or (R'length < 1)) then
--- assert NO_WARNING
--- report "NUMERIC_STD.""?/="": null detected, returning X"
--- severity warning;
--- return 'X';
--- else
--- LX := RESIZE(XL, SIZE);
--- RX := RESIZE(XR, SIZE);
--- result := '0';
--- for i in LX'low to LX'high loop
--- result1 := \?/=\ (LX(i), RX(i));
--- if result1 = 'U' then
--- return 'U';
--- elsif result1 = 'X' or result = 'X' then
--- result := 'X';
--- else
--- result := result or result1;
--- end if;
--- end loop;
--- return result;
--- end if;
--- end function \?/=\;
--- -- %%% function "?/=" (L, R : SIGNED) return std_ulogic is
--- -- %%% end function "?/=";
-
--- -- Id: C.75
--- function \?/=\ (L : NATURAL; R : UNSIGNED) return STD_ULOGIC is
--- begin
--- return \?/=\ (TO_UNSIGNED(L, R'length), R);
--- end function \?/=\;
-
--- -- Id: C.76
--- function \?/=\ (L : INTEGER; R : SIGNED) return STD_ULOGIC is
--- begin
--- return \?/=\ (TO_SIGNED(L, R'length), R);
--- end function \?/=\;
-
--- -- Id: C.77
--- function \?/=\ (L : UNSIGNED; R : NATURAL) return STD_ULOGIC is
--- begin
--- return \?/=\ (L, TO_UNSIGNED(R, L'length));
--- end function \?/=\;
-
--- -- Id: C.78
--- function \?/=\ (L : SIGNED; R : INTEGER) return STD_ULOGIC is
--- begin
--- return \?/=\ (L, TO_SIGNED(R, L'length));
--- end function \?/=\;
-
- function \?>\ (L, R : UNSIGNED) return STD_ULOGIC is
- begin
- if ((l'length < 1) or (r'length < 1)) then
- assert NO_WARNING
- report "NUMERIC_STD.""?>"": null detected, returning X"
- severity warning;
- return 'X';
- else
- for i in L'range loop
- if L(i) = '-' then
- report "NUMERIC_STD.""?>"": '-' found in compare string"
- severity error;
- return 'X';
- end if;
- end loop;
- for i in R'range loop
- if R(i) = '-' then
- report "NUMERIC_STD.""?>"": '-' found in compare string"
- severity error;
- return 'X';
- end if;
- end loop;
- if is_x(l) or is_x(r) then
- return 'X';
- elsif l > r then
- return '1';
- else
- return '0';
- end if;
- end if;
- end function \?>\;
- -- %%% function "?>" (L, R : UNSIGNED) return std_ulogic is
- -- %%% end function "?>"\;
- function \?>\ (L, R : SIGNED) return STD_ULOGIC is
- begin
- if ((l'length < 1) or (r'length < 1)) then
- assert NO_WARNING
- report "NUMERIC_STD.""?>"": null detected, returning X"
- severity warning;
- return 'X';
- else
- for i in L'range loop
- if L(i) = '-' then
- report "NUMERIC_STD.""?>"": '-' found in compare string"
- severity error;
- return 'X';
- end if;
- end loop;
- for i in R'range loop
- if R(i) = '-' then
- report "NUMERIC_STD.""?>"": '-' found in compare string"
- severity error;
- return 'X';
- end if;
- end loop;
- if is_x(l) or is_x(r) then
- return 'X';
- elsif l > r then
- return '1';
- else
- return '0';
- end if;
- end if;
- end function \?>\;
- -- %%% function "?>" (L, R : SIGNED) return std_ulogic is
- -- %%% end function "?>";
- -- Id: C.57
- function \?>\ (L : NATURAL; R : UNSIGNED) return STD_ULOGIC is
- begin
- return \?>\ (TO_UNSIGNED(L, R'length), R);
- end function \?>\;
-
- -- Id: C.58
- function \?>\ (L : INTEGER; R : SIGNED) return STD_ULOGIC is
- begin
- return \?>\ (TO_SIGNED(L, R'length),R);
- end function \?>\;
-
- -- Id: C.59
- function \?>\ (L : UNSIGNED; R : NATURAL) return STD_ULOGIC is
- begin
- return \?>\ (L, TO_UNSIGNED(R, L'length));
- end function \?>\;
-
- -- Id: C.60
- function \?>\ (L : SIGNED; R : INTEGER) return STD_ULOGIC is
- begin
- return \?>\ (L, TO_SIGNED(R, L'length));
- end function \?>\;
-
- function \?>=\ (L, R : UNSIGNED) return STD_ULOGIC is
- begin
- if ((l'length < 1) or (r'length < 1)) then
- assert NO_WARNING
- report "NUMERIC_STD.""?>="": null detected, returning X"
- severity warning;
- return 'X';
- else
- for i in L'range loop
- if L(i) = '-' then
- report "NUMERIC_STD.""?>="": '-' found in compare string"
- severity error;
- return 'X';
- end if;
- end loop;
- for i in R'range loop
- if R(i) = '-' then
- report "NUMERIC_STD.""?>="": '-' found in compare string"
- severity error;
- return 'X';
- end if;
- end loop;
- if is_x(l) or is_x(r) then
- return 'X';
- elsif l >= r then
- return '1';
- else
- return '0';
- end if;
- end if;
- end function \?>=\;
- -- %%% function "?>=" (L, R : UNSIGNED) return std_ulogic is
- -- %%% end function "?>=";
- function \?>=\ (L, R : SIGNED) return STD_ULOGIC is
- begin
- if ((l'length < 1) or (r'length < 1)) then
- assert NO_WARNING
- report "NUMERIC_STD.""?>="": null detected, returning X"
- severity warning;
- return 'X';
- else
- for i in L'range loop
- if L(i) = '-' then
- report "NUMERIC_STD.""?>="": '-' found in compare string"
- severity error;
- return 'X';
- end if;
- end loop;
- for i in R'range loop
- if R(i) = '-' then
- report "NUMERIC_STD.""?>="": '-' found in compare string"
- severity error;
- return 'X';
- end if;
- end loop;
- if is_x(l) or is_x(r) then
- return 'X';
- elsif l >= r then
- return '1';
- else
- return '0';
- end if;
- end if;
- end function \?>=\;
- -- %%% function "?>=" (L, R : SIGNED) return std_ulogic is
- -- %%% end function "?>=";
-
- function \?>=\ (L : NATURAL; R : UNSIGNED) return STD_ULOGIC is
- begin
- return \?>=\ (TO_UNSIGNED(L, R'length), R);
- end function \?>=\;
-
- -- Id: C.64
- function \?>=\ (L : INTEGER; R : SIGNED) return STD_ULOGIC is
- begin
- return \?>=\ (TO_SIGNED(L, R'length),R);
- end function \?>=\;
-
- -- Id: C.65
- function \?>=\ (L : UNSIGNED; R : NATURAL) return STD_ULOGIC is
- begin
- return \?>=\ (L, TO_UNSIGNED(R, L'length));
- end function \?>=\;
-
- -- Id: C.66
- function \?>=\ (L : SIGNED; R : INTEGER) return STD_ULOGIC is
- begin
- return \?>=\ (L, TO_SIGNED(R, L'length));
- end function \?>=\;
-
- function \?<\ (L, R : UNSIGNED) return STD_ULOGIC is
- begin
- if ((l'length < 1) or (r'length < 1)) then
- assert NO_WARNING
- report "NUMERIC_STD.""?<"": null detected, returning X"
- severity warning;
- return 'X';
- else
- for i in L'range loop
- if L(i) = '-' then
- report "NUMERIC_STD.""?<"": '-' found in compare string"
- severity error;
- return 'X';
- end if;
- end loop;
- for i in R'range loop
- if R(i) = '-' then
- report "NUMERIC_STD.""?<"": '-' found in compare string"
- severity error;
- return 'X';
- end if;
- end loop;
- if is_x(l) or is_x(r) then
- return 'X';
- elsif l < r then
- return '1';
- else
- return '0';
- end if;
- end if;
- end function \?<\;
- -- %%% function "?<" (L, R : UNSIGNED) return std_ulogic is
- -- %%% end function "?<";
- function \?<\ (L, R : SIGNED) return STD_ULOGIC is
- begin
- if ((l'length < 1) or (r'length < 1)) then
- assert NO_WARNING
- report "NUMERIC_STD.""?<"": null detected, returning X"
- severity warning;
- return 'X';
- else
- for i in L'range loop
- if L(i) = '-' then
- report "NUMERIC_STD.""?<"": '-' found in compare string"
- severity error;
- return 'X';
- end if;
- end loop;
- for i in R'range loop
- if R(i) = '-' then
- report "NUMERIC_STD.""?<"": '-' found in compare string"
- severity error;
- return 'X';
- end if;
- end loop;
- if is_x(l) or is_x(r) then
- return 'X';
- elsif l < r then
- return '1';
- else
- return '0';
- end if;
- end if;
- end function \?<\;
- -- %%% function "?<" (L, R : SIGNED) return std_ulogic is
- -- %%% end function "?<";
-
- -- Id: C.57
- function \?<\ (L : NATURAL; R : UNSIGNED) return STD_ULOGIC is
- begin
- return \?<\ (TO_UNSIGNED(L, R'length), R);
- end function \?<\;
-
- -- Id: C.58
- function \?<\ (L : INTEGER; R : SIGNED) return STD_ULOGIC is
- begin
- return \?<\ (TO_SIGNED(L, R'length),R);
- end function \?<\;
-
- -- Id: C.59
- function \?<\ (L : UNSIGNED; R : NATURAL) return STD_ULOGIC is
- begin
- return \?<\ (L, TO_UNSIGNED(R, L'length));
- end function \?<\;
-
- -- Id: C.60
- function \?<\ (L : SIGNED; R : INTEGER) return STD_ULOGIC is
- begin
- return \?<\ (L, TO_SIGNED(R, L'length));
- end function \?<\;
-
- function \?<=\ (L, R : UNSIGNED) return STD_ULOGIC is
- begin
- if ((l'length < 1) or (r'length < 1)) then
- assert NO_WARNING
- report "NUMERIC_STD.""?<="": null detected, returning X"
- severity warning;
- return 'X';
- else
- for i in L'range loop
- if L(i) = '-' then
- report "NUMERIC_STD.""?<="": '-' found in compare string"
- severity error;
- return 'X';
- end if;
- end loop;
- for i in R'range loop
- if R(i) = '-' then
- report "NUMERIC_STD.""?<="": '-' found in compare string"
- severity error;
- return 'X';
- end if;
- end loop;
- if is_x(l) or is_x(r) then
- return 'X';
- elsif l <= r then
- return '1';
- else
- return '0';
- end if;
- end if;
- end function \?<=\;
- -- %%% function "?<=" (L, R : UNSIGNED) return std_ulogic is
- -- %%% end function "?<=";
- function \?<=\ (L, R : SIGNED) return STD_ULOGIC is
- begin
- if ((l'length < 1) or (r'length < 1)) then
- assert NO_WARNING
- report "NUMERIC_STD.""?<="": null detected, returning X"
- severity warning;
- return 'X';
- else
- for i in L'range loop
- if L(i) = '-' then
- report "NUMERIC_STD.""?<="": '-' found in compare string"
- severity error;
- return 'X';
- end if;
- end loop;
- for i in R'range loop
- if R(i) = '-' then
- report "NUMERIC_STD.""?<="": '-' found in compare string"
- severity error;
- return 'X';
- end if;
- end loop;
- if is_x(l) or is_x(r) then
- return 'X';
- elsif l <= r then
- return '1';
- else
- return '0';
- end if;
- end if;
- end function \?<=\;
- -- %%% function "?<=" (L, R : SIGNED) return std_ulogic is
- -- %%% end function "?<=";
- -- Id: C.63
- function \?<=\ (L : NATURAL; R : UNSIGNED) return STD_ULOGIC is
- begin
- return \?<=\ (TO_UNSIGNED(L, R'length), R);
- end function \?<=\;
-
- -- Id: C.64
- function \?<=\ (L : INTEGER; R : SIGNED) return STD_ULOGIC is
- begin
- return \?<=\ (TO_SIGNED(L, R'length),R);
- end function \?<=\;
-
- -- Id: C.65
- function \?<=\ (L : UNSIGNED; R : NATURAL) return STD_ULOGIC is
- begin
- return \?<=\ (L, TO_UNSIGNED(R, L'length));
- end function \?<=\;
-
- -- Id: C.66
- function \?<=\ (L : SIGNED; R : INTEGER) return STD_ULOGIC is
- begin
- return \?<=\ (L, TO_SIGNED(R, L'length));
- end function \?<=\;
-
- -- size_res versions of these functions (Bugzilla 165)
- function TO_UNSIGNED (ARG : NATURAL; SIZE_RES : UNSIGNED)
- return UNSIGNED is
- begin
- return TO_UNSIGNED (ARG => ARG,
- SIZE => SIZE_RES'length);
- end function TO_UNSIGNED;
-
- function TO_SIGNED (ARG : INTEGER; SIZE_RES : SIGNED)
- return SIGNED is
- begin
- return TO_SIGNED (ARG => ARG,
- SIZE => SIZE_RES'length);
- end function TO_SIGNED;
-
- function RESIZE (ARG, SIZE_RES : SIGNED)
- return SIGNED is
- begin
- return RESIZE (ARG => ARG,
- NEW_SIZE => SIZE_RES'length);
- end function RESIZE;
-
- function RESIZE (ARG, SIZE_RES : UNSIGNED)
- return UNSIGNED is
- begin
- return RESIZE (ARG => ARG,
- NEW_SIZE => SIZE_RES'length);
- end function RESIZE;
-
- -- Id: S.9
- function "sll" (ARG : UNSIGNED; COUNT : INTEGER)
- return UNSIGNED is
- begin
- if (COUNT >= 0) then
- return SHIFT_LEFT(ARG, COUNT);
- else
- return SHIFT_RIGHT(ARG, -COUNT);
- end if;
- end function "sll";
-
- ------------------------------------------------------------------------------
- -- Note: Function S.10 is not compatible with IEEE Std 1076-1987. Comment
- -- out the function (declaration and body) for IEEE Std 1076-1987 compatibility.
- ------------------------------------------------------------------------------
- -- Id: S.10
- function "sll" (ARG : SIGNED; COUNT : INTEGER)
- return SIGNED is
- begin
- if (COUNT >= 0) then
- return SHIFT_LEFT(ARG, COUNT);
- else
- return SIGNED(SHIFT_RIGHT(UNSIGNED(ARG), -COUNT));
- end if;
- end function "sll";
-
- ------------------------------------------------------------------------------
- -- Note: Function S.11 is not compatible with IEEE Std 1076-1987. Comment
- -- out the function (declaration and body) for IEEE Std 1076-1987 compatibility.
- ------------------------------------------------------------------------------
- -- Id: S.11
- function "srl" (ARG : UNSIGNED; COUNT : INTEGER)
- return UNSIGNED is
- begin
- if (COUNT >= 0) then
- return SHIFT_RIGHT(ARG, COUNT);
- else
- return SHIFT_LEFT(ARG, -COUNT);
- end if;
- end function "srl";
-
- ------------------------------------------------------------------------------
- -- Note: Function S.12 is not compatible with IEEE Std 1076-1987. Comment
- -- out the function (declaration and body) for IEEE Std 1076-1987 compatibility.
- ------------------------------------------------------------------------------
- -- Id: S.12
- function "srl" (ARG : SIGNED; COUNT : INTEGER)
- return SIGNED is
- begin
- if (COUNT >= 0) then
- return SIGNED(SHIFT_RIGHT(UNSIGNED(ARG), COUNT));
- else
- return SHIFT_LEFT(ARG, -COUNT);
- end if;
- end function "srl";
-
- ------------------------------------------------------------------------------
- -- Note: Function S.13 is not compatible with IEEE Std 1076-1987. Comment
- -- out the function (declaration and body) for IEEE Std 1076-1987 compatibility.
- ------------------------------------------------------------------------------
- -- Id: S.13
- function "rol" (ARG : UNSIGNED; COUNT : INTEGER)
- return UNSIGNED is
- begin
- if (COUNT >= 0) then
- return ROTATE_LEFT(ARG, COUNT);
- else
- return ROTATE_RIGHT(ARG, -COUNT);
- end if;
- end function "rol";
-
- ------------------------------------------------------------------------------
- -- Note: Function S.14 is not compatible with IEEE Std 1076-1987. Comment
- -- out the function (declaration and body) for IEEE Std 1076-1987 compatibility.
- ------------------------------------------------------------------------------
- -- Id: S.14
- function "rol" (ARG : SIGNED; COUNT : INTEGER)
- return SIGNED is
- begin
- if (COUNT >= 0) then
- return ROTATE_LEFT(ARG, COUNT);
- else
- return ROTATE_RIGHT(ARG, -COUNT);
- end if;
- end function "rol";
-
- ------------------------------------------------------------------------------
- -- Note: Function S.15 is not compatible with IEEE Std 1076-1987. Comment
- -- out the function (declaration and body) for IEEE Std 1076-1987 compatibility.
- ------------------------------------------------------------------------------
- -- Id: S.15
- function "ror" (ARG : UNSIGNED; COUNT : INTEGER)
- return UNSIGNED is
- begin
- if (COUNT >= 0) then
- return ROTATE_RIGHT(ARG, COUNT);
- else
- return ROTATE_LEFT(ARG, -COUNT);
- end if;
- end function "ror";
-
- ------------------------------------------------------------------------------
- -- Note: Function S.16 is not compatible with IEEE Std 1076-1987. Comment
- -- out the function (declaration and body) for IEEE Std 1076-1987 compatibility.
- ------------------------------------------------------------------------------
- -- Id: S.16
- function "ror" (ARG : SIGNED; COUNT : INTEGER)
- return SIGNED is
- begin
- if (COUNT >= 0) then
- return ROTATE_RIGHT(ARG, COUNT);
- else
- return ROTATE_LEFT(ARG, -COUNT);
- end if;
- end function "ror";
-
--- begin LCS-2006-120
-
- ------------------------------------------------------------------------------
- -- Note: Function S.17 is not compatible with IEEE Std 1076-1987. Comment
- -- out the function (declaration and body) for IEEE Std 1076-1987 compatibility.
- ------------------------------------------------------------------------------
- -- Id: S.17
- function "sla" (ARG : UNSIGNED; COUNT : INTEGER)
- return UNSIGNED is
- begin
- if (COUNT >= 0) then
- return SHIFT_LEFT(ARG, COUNT);
- else
- return SHIFT_RIGHT(ARG, -COUNT);
- end if;
- end function "sla";
-
- ------------------------------------------------------------------------------
- -- Note: Function S.18 is not compatible with IEEE Std 1076-1987. Comment
- -- out the function (declaration and body) for IEEE Std 1076-1987 compatibility.
- ------------------------------------------------------------------------------
- -- Id: S.18
- function "sla" (ARG : SIGNED; COUNT : INTEGER)
- return SIGNED is
- begin
- if (COUNT >= 0) then
- return SHIFT_LEFT(ARG, COUNT);
- else
- return SHIFT_RIGHT(ARG, -COUNT);
- end if;
- end function "sla";
-
- ------------------------------------------------------------------------------
- -- Note: Function S.19 is not compatible with IEEE Std 1076-1987. Comment
- -- out the function (declaration and body) for IEEE Std 1076-1987 compatibility.
- ------------------------------------------------------------------------------
- -- Id: S.19
- function "sra" (ARG : UNSIGNED; COUNT : INTEGER)
- return UNSIGNED is
- begin
- if (COUNT >= 0) then
- return SHIFT_RIGHT(ARG, COUNT);
- else
- return SHIFT_LEFT(ARG, -COUNT);
- end if;
- end function "sra";
-
- ------------------------------------------------------------------------------
- -- Note: Function S.20 is not compatible with IEEE Std 1076-1987. Comment
- -- out the function (declaration and body) for IEEE Std 1076-1987 compatibility.
- ------------------------------------------------------------------------------
- -- Id: S.20
- function "sra" (ARG : SIGNED; COUNT : INTEGER)
- return SIGNED is
- begin
- if (COUNT >= 0) then
- return SHIFT_RIGHT(ARG, COUNT);
- else
- return SHIFT_LEFT(ARG, -COUNT);
- end if;
- end function "sra";
-
- -- These functions are in std_logic_1164 and are defined for
- -- std_logic_vector. They are overloaded here.
- function To_X01 ( s : UNSIGNED ) return UNSIGNED is
- begin
- return UNSIGNED (To_X01 (STD_LOGIC_VECTOR (s)));
- end function To_X01;
-
- function To_X01 ( s : SIGNED ) return SIGNED is
- begin
- return SIGNED (To_X01 (STD_LOGIC_VECTOR (s)));
- end function To_X01;
-
- function To_X01Z ( s : UNSIGNED ) return UNSIGNED is
- begin
- return UNSIGNED (To_X01Z (STD_LOGIC_VECTOR (s)));
- end function To_X01Z;
-
- function To_X01Z ( s : SIGNED ) return SIGNED is
- begin
- return SIGNED (To_X01Z (STD_LOGIC_VECTOR (s)));
- end function To_X01Z;
-
- function To_UX01 ( s : UNSIGNED ) return UNSIGNED is
- begin
- return UNSIGNED (To_UX01 (STD_LOGIC_VECTOR (s)));
- end function To_UX01;
-
- function To_UX01 ( s : SIGNED ) return SIGNED is
- begin
- return SIGNED (To_UX01 (STD_LOGIC_VECTOR (s)));
- end function To_UX01;
-
- function Is_X ( s : UNSIGNED ) return BOOLEAN is
- begin
- return Is_X (STD_LOGIC_VECTOR (s));
- end function Is_X;
-
- function Is_X ( s : SIGNED ) return BOOLEAN is
- begin
- return Is_X (STD_LOGIC_VECTOR (s));
- end function Is_X;
-
- -----------------------------------------------------------------------------
- -- New/updated functions for VHDL-200X fast track
- -----------------------------------------------------------------------------
-
- -- Returns the maximum (or minimum) of the two numbers provided.
- -- All types (both inputs and the output) must be the same.
- -- These override the implicit functions, using the local ">" operator
- -- UNSIGNED output
- function MAXIMUM (L, R : UNSIGNED) return UNSIGNED is
- constant SIZE : NATURAL := MAX(L'length, R'length);
- variable L01 : UNSIGNED(SIZE-1 downto 0);
- variable R01 : UNSIGNED(SIZE-1 downto 0);
- begin
- if ((L'length < 1) or (R'length < 1)) then return NAU;
- end if;
- L01 := TO_01(RESIZE(L, SIZE), 'X');
- if (L01(L01'left) = 'X') then return L01;
- end if;
- R01 := TO_01(RESIZE(R, SIZE), 'X');
- if (R01(R01'left) = 'X') then return R01;
- end if;
- if L01 < R01 then
- return R01;
- else
- return L01;
- end if;
- end function MAXIMUM;
-
- -- signed output
- function MAXIMUM (L, R : SIGNED) return SIGNED is
- constant SIZE : NATURAL := MAX(L'length, R'length);
- variable L01 : SIGNED(SIZE-1 downto 0);
- variable R01 : SIGNED(SIZE-1 downto 0);
- begin
- if ((L'length < 1) or (R'length < 1)) then return NAS;
- end if;
- L01 := TO_01(RESIZE(L, SIZE), 'X');
- if (L01(L01'left) = 'X') then return L01;
- end if;
- R01 := TO_01(RESIZE(R, SIZE), 'X');
- if (R01(R01'left) = 'X') then return R01;
- end if;
- if L01 < R01 then
- return R01;
- else
- return L01;
- end if;
- end function MAXIMUM;
-
- -- UNSIGNED output
- function MINIMUM (L, R : UNSIGNED) return UNSIGNED is
- constant SIZE : NATURAL := MAX(L'length, R'length);
- variable L01 : UNSIGNED(SIZE-1 downto 0);
- variable R01 : UNSIGNED(SIZE-1 downto 0);
- begin
- if ((L'length < 1) or (R'length < 1)) then return NAU;
- end if;
- L01 := TO_01(RESIZE(L, SIZE), 'X');
- if (L01(L01'left) = 'X') then return L01;
- end if;
- R01 := TO_01(RESIZE(R, SIZE), 'X');
- if (R01(R01'left) = 'X') then return R01;
- end if;
- if L01 < R01 then
- return L01;
- else
- return R01;
- end if;
- end function MINIMUM;
-
-
- -- signed output
- function MINIMUM (L, R : SIGNED) return SIGNED is
- constant SIZE : NATURAL := MAX(L'length, R'length);
- variable L01 : SIGNED(SIZE-1 downto 0);
- variable R01 : SIGNED(SIZE-1 downto 0);
- begin
- if ((L'length < 1) or (R'length < 1)) then return NAS;
- end if;
- L01 := TO_01(RESIZE(L, SIZE), 'X');
- if (L01(L01'left) = 'X') then return L01;
- end if;
- R01 := TO_01(RESIZE(R, SIZE), 'X');
- if (R01(R01'left) = 'X') then return R01;
- end if;
- if L01 < R01 then
- return L01;
- else
- return R01;
- end if;
- end function MINIMUM;
-
- -- Id: C.39
- function MINIMUM (L : NATURAL; R : UNSIGNED)
- return UNSIGNED is
- begin
- return MINIMUM(TO_UNSIGNED(L, R'length), R);
- end function MINIMUM;
-
- -- Id: C.40
- function MINIMUM (L : INTEGER; R : SIGNED)
- return SIGNED is
- begin
- return MINIMUM(TO_SIGNED(L, R'length), R);
- end function MINIMUM;
-
- -- Id: C.41
- function MINIMUM (L : UNSIGNED; R : NATURAL)
- return UNSIGNED is
- begin
- return MINIMUM(L, TO_UNSIGNED(R, L'length));
- end function MINIMUM;
-
- -- Id: C.42
- function MINIMUM (L : SIGNED; R : INTEGER)
- return SIGNED is
- begin
- return MINIMUM(L, TO_SIGNED(R, L'length));
- end function MINIMUM;
-
- -- Id: C.45
- function MAXIMUM (L : NATURAL; R : UNSIGNED)
- return UNSIGNED is
- begin
- return MAXIMUM(TO_UNSIGNED(L, R'length), R);
- end function MAXIMUM;
-
- -- Id: C.46
- function MAXIMUM (L : INTEGER; R : SIGNED)
- return SIGNED is
- begin
- return MAXIMUM(TO_SIGNED(L, R'length), R);
- end function MAXIMUM;
-
- -- Id: C.47
- function MAXIMUM (L : UNSIGNED; R : NATURAL)
- return UNSIGNED is
- begin
- return MAXIMUM(L, TO_UNSIGNED(R, L'length));
- end function MAXIMUM;
-
- -- Id: C.48
- function MAXIMUM (L : SIGNED; R : INTEGER)
- return SIGNED is
- begin
- return MAXIMUM(L, TO_SIGNED(R, L'length));
- end function MAXIMUM;
-
- function find_rightmost (
- arg : UNSIGNED; -- vector argument
- y : STD_ULOGIC) -- look for this bit
- return INTEGER is
- alias xarg : UNSIGNED(arg'length-1 downto 0) is arg;
- begin
- for_loop: for i in xarg'reverse_range loop
- if xarg(i) = y then
- return i;
- end if;
- end loop;
- return -1;
- end function find_rightmost;
-
- function find_rightmost (
- arg : SIGNED; -- vector argument
- y : STD_ULOGIC) -- look for this bit
- return INTEGER is
- alias xarg : SIGNED(arg'length-1 downto 0) is arg;
- begin
- for_loop: for i in xarg'reverse_range loop
- if xarg(i) = y then
- return i;
- end if;
- end loop;
- return -1;
- end function find_rightmost;
-
- function find_leftmost (
- arg : UNSIGNED; -- vector argument
- y : STD_ULOGIC) -- look for this bit
- return INTEGER is
- alias xarg : UNSIGNED(arg'length-1 downto 0) is arg;
- begin
- for_loop: for i in xarg'range loop
- if xarg(i) = y then
- return i;
- end if;
- end loop;
- return -1;
- end function find_leftmost;
-
- function find_leftmost (
- arg : SIGNED; -- vector argument
- y : STD_ULOGIC) -- look for this bit
- return INTEGER is
- alias xarg : SIGNED(arg'length-1 downto 0) is arg;
- begin
- for_loop: for i in xarg'range loop
- if xarg(i) = y then
- return i;
- end if;
- end loop;
- return -1;
- end function find_leftmost;
-
- function TO_UNRESOLVED_UNSIGNED (ARG, SIZE : NATURAL)
- return UNRESOLVED_UNSIGNED is
- begin
- return UNRESOLVED_UNSIGNED(to_unsigned (arg, size));
- end function TO_UNRESOLVED_UNSIGNED;
- -- Result subtype: UNRESOLVED_UNSIGNED(SIZE-1 downto 0)
- -- Result: Converts a nonnegative INTEGER to an UNRESOLVED_UNSIGNED vector with
- -- the specified SIZE.
-
-
- function TO_UNRESOLVED_SIGNED (ARG : INTEGER; SIZE : NATURAL)
- return UNRESOLVED_SIGNED is
- begin
- return UNRESOLVED_SIGNED(to_signed (arg, size));
- end function TO_UNRESOLVED_SIGNED;
- -- Result subtype: UNRESOLVED_SIGNED(SIZE-1 downto 0)
- -- Result: Converts an INTEGER to an UNRESOLVED_SIGNED vector of the specified SIZE.
-
- -- Performs the boolean operation on every bit in the vector
--- L.15
- function "and" (L: STD_ULOGIC; R: UNSIGNED) return UNSIGNED is
- alias rv : UNSIGNED ( 1 to r'length ) is r;
- variable result : UNSIGNED ( 1 to r'length );
- begin
- for i in result'range loop
- result(i) := "and" (l, rv(i));
- end loop;
- return result;
- end function "and";
-
--- L.16
- function "and" (L: UNSIGNED; R: STD_ULOGIC) return UNSIGNED is
- alias lv : UNSIGNED ( 1 to l'length ) is l;
- variable result : UNSIGNED ( 1 to l'length );
- begin
- for i in result'range loop
- result(i) := "and" (lv(i), r);
- end loop;
- return result;
- end function "and";
-
--- L.17
- function "or" (L: STD_ULOGIC; R: UNSIGNED) return UNSIGNED is
- alias rv : UNSIGNED ( 1 to r'length ) is r;
- variable result : UNSIGNED ( 1 to r'length );
- begin
- for i in result'range loop
- result(i) := "or" (l, rv(i));
- end loop;
- return result;
- end function "or";
-
--- L.18
- function "or" (L: UNSIGNED; R: STD_ULOGIC) return UNSIGNED is
- alias lv : UNSIGNED ( 1 to l'length ) is l;
- variable result : UNSIGNED ( 1 to l'length );
- begin
- for i in result'range loop
- result(i) := "or" (lv(i), r);
- end loop;
- return result;
- end function "or";
-
--- L.19
- function "nand" (L: STD_ULOGIC; R: UNSIGNED) return UNSIGNED is
- alias rv : UNSIGNED ( 1 to r'length ) is r;
- variable result : UNSIGNED ( 1 to r'length );
- begin
- for i in result'range loop
- result(i) := "not"("and" (l, rv(i)));
- end loop;
- return result;
- end function "nand";
-
--- L.20
- function "nand" (L: UNSIGNED; R: STD_ULOGIC) return UNSIGNED is
- alias lv : UNSIGNED ( 1 to l'length ) is l;
- variable result : UNSIGNED ( 1 to l'length );
- begin
- for i in result'range loop
- result(i) := "not"("and" (lv(i), r));
- end loop;
- return result;
- end function "nand";
-
--- L.21
- function "nor" (L: STD_ULOGIC; R: UNSIGNED) return UNSIGNED is
- alias rv : UNSIGNED ( 1 to r'length ) is r;
- variable result : UNSIGNED ( 1 to r'length );
- begin
- for i in result'range loop
- result(i) := "not"("or" (l, rv(i)));
- end loop;
- return result;
- end function "nor";
-
--- L.22
- function "nor" (L: UNSIGNED; R: STD_ULOGIC) return UNSIGNED is
- alias lv : UNSIGNED ( 1 to l'length ) is l;
- variable result : UNSIGNED ( 1 to l'length );
- begin
- for i in result'range loop
- result(i) := "not"("or" (lv(i), r));
- end loop;
- return result;
- end function "nor";
-
--- L.23
- function "xor" (L: STD_ULOGIC; R: UNSIGNED) return UNSIGNED is
- alias rv : UNSIGNED ( 1 to r'length ) is r;
- variable result : UNSIGNED ( 1 to r'length );
- begin
- for i in result'range loop
- result(i) := "xor" (l, rv(i));
- end loop;
- return result;
- end function "xor";
-
--- L.24
- function "xor" (L: UNSIGNED; R: STD_ULOGIC) return UNSIGNED is
- alias lv : UNSIGNED ( 1 to l'length ) is l;
- variable result : UNSIGNED ( 1 to l'length );
- begin
- for i in result'range loop
- result(i) := "xor" (lv(i), r);
- end loop;
- return result;
- end function "xor";
-
--- L.25
- function "xnor" (L: STD_ULOGIC; R: UNSIGNED) return UNSIGNED is
- alias rv : UNSIGNED ( 1 to r'length ) is r;
- variable result : UNSIGNED ( 1 to r'length );
- begin
- for i in result'range loop
- result(i) := "not"("xor" (l, rv(i)));
- end loop;
- return result;
- end function "xnor";
-
--- L.26
- function "xnor" (L: UNSIGNED; R: STD_ULOGIC) return UNSIGNED is
- alias lv : UNSIGNED ( 1 to l'length ) is l;
- variable result : UNSIGNED ( 1 to l'length );
- begin
- for i in result'range loop
- result(i) := "not"("xor" (lv(i), r));
- end loop;
- return result;
- end function "xnor";
-
--- L.27
- function "and" (L: STD_ULOGIC; R: SIGNED) return SIGNED is
- alias rv : SIGNED ( 1 to r'length ) is r;
- variable result : SIGNED ( 1 to r'length );
- begin
- for i in result'range loop
- result(i) := "and" (l, rv(i));
- end loop;
- return result;
- end function "and";
-
--- L.28
- function "and" (L: SIGNED; R: STD_ULOGIC) return SIGNED is
- alias lv : SIGNED ( 1 to l'length ) is l;
- variable result : SIGNED ( 1 to l'length );
- begin
- for i in result'range loop
- result(i) := "and" (lv(i), r);
- end loop;
- return result;
- end function "and";
-
--- L.29
- function "or" (L: STD_ULOGIC; R: SIGNED) return SIGNED is
- alias rv : SIGNED ( 1 to r'length ) is r;
- variable result : SIGNED ( 1 to r'length );
- begin
- for i in result'range loop
- result(i) := "or" (l, rv(i));
- end loop;
- return result;
- end function "or";
-
--- L.30
- function "or" (L: SIGNED; R: STD_ULOGIC) return SIGNED is
- alias lv : SIGNED ( 1 to l'length ) is l;
- variable result : SIGNED ( 1 to l'length );
- begin
- for i in result'range loop
- result(i) := "or" (lv(i), r);
- end loop;
- return result;
- end function "or";
-
--- L.31
- function "nand" (L: STD_ULOGIC; R: SIGNED) return SIGNED is
- alias rv : SIGNED ( 1 to r'length ) is r;
- variable result : SIGNED ( 1 to r'length );
- begin
- for i in result'range loop
- result(i) := "not"("and" (l, rv(i)));
- end loop;
- return result;
- end function "nand";
-
--- L.32
- function "nand" (L: SIGNED; R: STD_ULOGIC) return SIGNED is
- alias lv : SIGNED ( 1 to l'length ) is l;
- variable result : SIGNED ( 1 to l'length );
- begin
- for i in result'range loop
- result(i) := "not"("and" (lv(i), r));
- end loop;
- return result;
- end function "nand";
-
--- L.33
- function "nor" (L: STD_ULOGIC; R: SIGNED) return SIGNED is
- alias rv : SIGNED ( 1 to r'length ) is r;
- variable result : SIGNED ( 1 to r'length );
- begin
- for i in result'range loop
- result(i) := "not"("or" (l, rv(i)));
- end loop;
- return result;
- end function "nor";
-
--- L.34
- function "nor" (L: SIGNED; R: STD_ULOGIC) return SIGNED is
- alias lv : SIGNED ( 1 to l'length ) is l;
- variable result : SIGNED ( 1 to l'length );
- begin
- for i in result'range loop
- result(i) := "not"("or" (lv(i), r));
- end loop;
- return result;
- end function "nor";
-
--- L.35
- function "xor" (L: STD_ULOGIC; R: SIGNED) return SIGNED is
- alias rv : SIGNED ( 1 to r'length ) is r;
- variable result : SIGNED ( 1 to r'length );
- begin
- for i in result'range loop
- result(i) := "xor" (l, rv(i));
- end loop;
- return result;
- end function "xor";
-
--- L.36
- function "xor" (L: SIGNED; R: STD_ULOGIC) return SIGNED is
- alias lv : SIGNED ( 1 to l'length ) is l;
- variable result : SIGNED ( 1 to l'length );
- begin
- for i in result'range loop
- result(i) := "xor" (lv(i), r);
- end loop;
- return result;
- end function "xor";
-
--- L.37
- function "xnor" (L: STD_ULOGIC; R: SIGNED) return SIGNED is
- alias rv : SIGNED ( 1 to r'length ) is r;
- variable result : SIGNED ( 1 to r'length );
- begin
- for i in result'range loop
- result(i) := "not"("xor" (l, rv(i)));
- end loop;
- return result;
- end function "xnor";
-
--- L.38
- function "xnor" (L: SIGNED; R: STD_ULOGIC) return SIGNED is
- alias lv : SIGNED ( 1 to l'length ) is l;
- variable result : SIGNED ( 1 to l'length );
- begin
- for i in result'range loop
- result(i) := "not"("xor" (lv(i), r));
- end loop;
- return result;
- end function "xnor";
-
- --------------------------------------------------------------------------
- -- Reduction operations
- --------------------------------------------------------------------------
- -- %%% Remove the following 12 funcitons (old syntax)
- function and_reduce (l : SIGNED ) return STD_ULOGIC is
- begin
- return and_reduce (UNSIGNED ( l ));
- end function and_reduce;
-
- function and_reduce ( l : UNSIGNED ) return STD_ULOGIC is
- variable Upper, Lower : STD_ULOGIC;
- variable Half : INTEGER;
- variable BUS_int : UNSIGNED ( l'length - 1 downto 0 );
- variable Result : STD_ULOGIC := '1'; -- In the case of a NULL range
- begin
- if (l'length >= 1) then
- BUS_int := to_ux01 (l);
- if ( BUS_int'length = 1 ) then
- Result := BUS_int ( BUS_int'left );
- elsif ( BUS_int'length = 2 ) then
- Result := "and" (BUS_int(BUS_int'right),BUS_int(BUS_int'left));
- else
- Half := ( BUS_int'length + 1 ) / 2 + BUS_int'right;
- Upper := and_reduce ( BUS_int ( BUS_int'left downto Half ));
- Lower := and_reduce ( BUS_int ( Half - 1 downto BUS_int'right ));
- Result := "and" (Upper, Lower);
- end if;
- end if;
- return Result;
- end function and_reduce;
-
- function nand_reduce (l : SIGNED ) return STD_ULOGIC is
- begin
- return "not" (and_reduce ( l ));
- end function nand_reduce;
-
- function nand_reduce (l : UNSIGNED ) return STD_ULOGIC is
- begin
- return "not" (and_reduce (l ));
- end function nand_reduce;
-
- function or_reduce (l : SIGNED ) return STD_ULOGIC is
- begin
- return or_reduce (UNSIGNED ( l ));
- end function or_reduce;
-
- function or_reduce (l : UNSIGNED ) return STD_ULOGIC is
- variable Upper, Lower : STD_ULOGIC;
- variable Half : INTEGER;
- variable BUS_int : UNSIGNED ( l'length - 1 downto 0 );
- variable Result : STD_ULOGIC := '0'; -- In the case of a NULL range
- begin
- if (l'length >= 1) then
- BUS_int := to_ux01 (l);
- if ( BUS_int'length = 1 ) then
- Result := BUS_int ( BUS_int'left );
- elsif ( BUS_int'length = 2 ) then
- Result := "or" (BUS_int(BUS_int'right), BUS_int(BUS_int'left));
- else
- Half := ( BUS_int'length + 1 ) / 2 + BUS_int'right;
- Upper := or_reduce ( BUS_int ( BUS_int'left downto Half ));
- Lower := or_reduce ( BUS_int ( Half - 1 downto BUS_int'right ));
- Result := "or" (Upper, Lower);
- end if;
- end if;
- return Result;
- end function or_reduce;
-
- function nor_reduce (l : SIGNED ) return STD_ULOGIC is
- begin
- return "not"(or_reduce(l));
- end function nor_reduce;
-
- function nor_reduce (l : UNSIGNED ) return STD_ULOGIC is
- begin
- return "not"(or_reduce(l));
- end function nor_reduce;
-
- function xor_reduce (l : SIGNED ) return STD_ULOGIC is
- begin
- return xor_reduce (UNSIGNED ( l ));
- end function xor_reduce;
-
- function xor_reduce (l : UNSIGNED ) return STD_ULOGIC is
- variable Upper, Lower : STD_ULOGIC;
- variable Half : INTEGER;
- variable BUS_int : UNSIGNED ( l'length - 1 downto 0 );
- variable Result : STD_ULOGIC := '0'; -- In the case of a NULL range
- begin
- if (l'length >= 1) then
- BUS_int := to_ux01 (l);
- if ( BUS_int'length = 1 ) then
- Result := BUS_int ( BUS_int'left );
- elsif ( BUS_int'length = 2 ) then
- Result := "xor" (BUS_int(BUS_int'right), BUS_int(BUS_int'left));
- else
- Half := ( BUS_int'length + 1 ) / 2 + BUS_int'right;
- Upper := xor_reduce ( BUS_int ( BUS_int'left downto Half ));
- Lower := xor_reduce ( BUS_int ( Half - 1 downto BUS_int'right ));
- Result := "xor" (Upper, Lower);
- end if;
- end if;
- return Result;
- end function xor_reduce;
-
- function xnor_reduce (l : SIGNED ) return STD_ULOGIC is
- begin
- return "not"(xor_reduce(l));
- end function xnor_reduce;
-
- function xnor_reduce (l : UNSIGNED ) return STD_ULOGIC is
- begin
- return "not"(xor_reduce(l));
- end function xnor_reduce;
-
- -- %%% Replace the above with the following 12 functions (New syntax)
--- function "and" ( l : SIGNED ) return std_ulogic is
--- begin
--- return and (std_logic_vector ( l ));
--- end function "and";
-
--- function "and" ( l : UNSIGNED ) return std_ulogic is
--- begin
--- return and (std_logic_vector ( l ));
--- end function "and";
-
--- function "nand" ( l : SIGNED ) return std_ulogic is
--- begin
--- return nand (std_logic_vector ( l ));
--- end function "nand";
-
--- function "nand" ( l : UNSIGNED ) return std_ulogic is
--- begin
--- return nand (std_logic_vector ( l ));
--- end function "nand";
-
--- function "or" ( l : SIGNED ) return std_ulogic is
--- begin
--- return or (std_logic_vector ( l ));
--- end function "or";
-
--- function "or" ( l : UNSIGNED ) return std_ulogic is
--- begin
--- return or (std_logic_vector ( l ));
--- end function "or";
-
--- function "nor" ( l : SIGNED ) return std_ulogic is
--- begin
--- return nor (std_logic_vector ( l ));
--- end function "nor";
-
--- function "nor" ( l : UNSIGNED ) return std_ulogic is
--- begin
--- return nor (std_logic_vector ( l ));
--- end function "nor";
-
--- function "xor" ( l : SIGNED ) return std_ulogic is
--- begin
--- return xor (std_logic_vector ( l ));
--- end function "xor";
-
--- function "xor" ( l : UNSIGNED ) return std_ulogic is
--- begin
--- return xor (std_logic_vector ( l ));
--- end function "xor";
-
--- function "xnor" ( l : SIGNED ) return std_ulogic is
--- begin
--- return xnor (std_logic_vector ( l ));
--- end function "xnor";
-
--- function "xnor" ( l : UNSIGNED ) return std_ulogic is
--- begin
--- return xnor (std_logic_vector ( l ));
--- end function "xnor";
-
- -- rtl_synthesis off
--- pragma synthesis_off
- -------------------------------------------------------------------
- -- TO_STRING
- -------------------------------------------------------------------
- -- Type and constant definitions used to map STD_ULOGIC values
- -- into/from character values.
- type MVL9plus is ('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-', error);
- type char_indexed_by_MVL9 is array (STD_ULOGIC) of CHARACTER;
- type MVL9_indexed_by_char is array (CHARACTER) of STD_ULOGIC;
- type MVL9plus_indexed_by_char is array (CHARACTER) of MVL9plus;
- constant MVL9_to_char : char_indexed_by_MVL9 := "UX01ZWLH-";
- constant char_to_MVL9 : MVL9_indexed_by_char :=
- ('U' => 'U', 'X' => 'X', '0' => '0', '1' => '1', 'Z' => 'Z',
- 'W' => 'W', 'L' => 'L', 'H' => 'H', '-' => '-', others => 'U');
- constant char_to_MVL9plus : MVL9plus_indexed_by_char :=
- ('U' => 'U', 'X' => 'X', '0' => '0', '1' => '1', 'Z' => 'Z',
- 'W' => 'W', 'L' => 'L', 'H' => 'H', '-' => '-', others => error);
-
- constant NBSP : CHARACTER := CHARACTER'val(160); -- space character
- constant NUS : STRING(2 to 1) := (others => ' '); -- NULL array
-
- function to_string (value : UNSIGNED) return STRING is
- alias ivalue : UNSIGNED(1 to value'length) is value;
- variable result : STRING(1 to value'length);
- begin
- if value'length < 1 then
- return NUS;
- else
- for i in ivalue'range loop
- result(i) := MVL9_to_char( iValue(i) );
- end loop;
- return result;
- end if;
- end function to_string;
-
- function to_string (value : SIGNED) return STRING is
- alias ivalue : SIGNED(1 to value'length) is value;
- variable result : STRING(1 to value'length);
- begin
- if value'length < 1 then
- return NUS;
- else
- for i in ivalue'range loop
- result(i) := MVL9_to_char( iValue(i) );
- end loop;
- return result;
- end if;
- end function to_string;
-
- function to_hstring (value : SIGNED) return STRING is
- constant ne : INTEGER := (value'length+3)/4;
- variable pad : STD_LOGIC_VECTOR(0 to (ne*4 - value'length) - 1);
- variable ivalue : STD_LOGIC_VECTOR(0 to ne*4 - 1);
- variable result : STRING(1 to ne);
- variable quad : STD_LOGIC_VECTOR(0 to 3);
- begin
- if value'length < 1 then
- return NUS;
- else
- if value (value'left) = 'Z' then
- pad := (others => 'Z');
- else
- pad := (others => value(value'high)); -- Extend sign bit
- end if;
- ivalue := pad & STD_LOGIC_VECTOR (value);
- for i in 0 to ne-1 loop
- quad := To_X01Z(ivalue(4*i to 4*i+3));
- case quad is
- when x"0" => result(i+1) := '0';
- when x"1" => result(i+1) := '1';
- when x"2" => result(i+1) := '2';
- when x"3" => result(i+1) := '3';
- when x"4" => result(i+1) := '4';
- when x"5" => result(i+1) := '5';
- when x"6" => result(i+1) := '6';
- when x"7" => result(i+1) := '7';
- when x"8" => result(i+1) := '8';
- when x"9" => result(i+1) := '9';
- when x"A" => result(i+1) := 'A';
- when x"B" => result(i+1) := 'B';
- when x"C" => result(i+1) := 'C';
- when x"D" => result(i+1) := 'D';
- when x"E" => result(i+1) := 'E';
- when x"F" => result(i+1) := 'F';
- when "ZZZZ" => result(i+1) := 'Z';
- when others => result(i+1) := 'X';
- end case;
- end loop;
- return result;
- end if;
- end function to_hstring;
-
- function to_ostring (value : SIGNED) return STRING is
- constant ne : INTEGER := (value'length+2)/3;
- variable pad : STD_LOGIC_VECTOR(0 to (ne*3 - value'length) - 1);
- variable ivalue : STD_LOGIC_VECTOR(0 to ne*3 - 1);
- variable result : STRING(1 to ne);
- variable tri : STD_LOGIC_VECTOR(0 to 2);
- begin
- if value'length < 1 then
- return NUS;
- else
- if value (value'left) = 'Z' then
- pad := (others => 'Z');
- else
- pad := (others => value (value'high)); -- Extend sign bit
- end if;
- ivalue := pad & STD_LOGIC_VECTOR (value);
- for i in 0 to ne-1 loop
- tri := To_X01Z(ivalue(3*i to 3*i+2));
- case tri is
- when o"0" => result(i+1) := '0';
- when o"1" => result(i+1) := '1';
- when o"2" => result(i+1) := '2';
- when o"3" => result(i+1) := '3';
- when o"4" => result(i+1) := '4';
- when o"5" => result(i+1) := '5';
- when o"6" => result(i+1) := '6';
- when o"7" => result(i+1) := '7';
- when "ZZZ" => result(i+1) := 'Z';
- when others => result(i+1) := 'X';
- end case;
- end loop;
- return result;
- end if;
- end function to_ostring;
-
- function to_hstring (value : UNSIGNED) return STRING is
- constant ne : INTEGER := (value'length+3)/4;
- variable pad : STD_LOGIC_VECTOR(0 to (ne*4 - value'length) - 1);
- variable ivalue : STD_LOGIC_VECTOR(0 to ne*4 - 1);
- variable result : STRING(1 to ne);
- variable quad : STD_LOGIC_VECTOR(0 to 3);
- begin
- if value'length < 1 then
- return NUS;
- else
- if value (value'left) = 'Z' then
- pad := (others => 'Z');
- else
- pad := (others => '0');
- end if;
- ivalue := pad & STD_LOGIC_VECTOR (value);
- for i in 0 to ne-1 loop
- quad := To_X01Z(ivalue(4*i to 4*i+3));
- case quad is
- when x"0" => result(i+1) := '0';
- when x"1" => result(i+1) := '1';
- when x"2" => result(i+1) := '2';
- when x"3" => result(i+1) := '3';
- when x"4" => result(i+1) := '4';
- when x"5" => result(i+1) := '5';
- when x"6" => result(i+1) := '6';
- when x"7" => result(i+1) := '7';
- when x"8" => result(i+1) := '8';
- when x"9" => result(i+1) := '9';
- when x"A" => result(i+1) := 'A';
- when x"B" => result(i+1) := 'B';
- when x"C" => result(i+1) := 'C';
- when x"D" => result(i+1) := 'D';
- when x"E" => result(i+1) := 'E';
- when x"F" => result(i+1) := 'F';
- when "ZZZZ" => result(i+1) := 'Z';
- when others => result(i+1) := 'X';
- end case;
- end loop;
- return result;
- end if;
- end function to_hstring;
-
- function to_ostring (value : UNSIGNED) return STRING is
- constant ne : INTEGER := (value'length+2)/3;
- variable pad : STD_LOGIC_VECTOR(0 to (ne*3 - value'length) - 1);
- variable ivalue : STD_LOGIC_VECTOR(0 to ne*3 - 1);
- variable result : STRING(1 to ne);
- variable tri : STD_LOGIC_VECTOR(0 to 2);
- begin
- if value'length < 1 then
- return NUS;
- else
- if value (value'left) = 'Z' then
- pad := (others => 'Z');
- else
- pad := (others => '0');
- end if;
- ivalue := pad & STD_LOGIC_VECTOR (value);
- for i in 0 to ne-1 loop
- tri := To_X01Z(ivalue(3*i to 3*i+2));
- case tri is
- when o"0" => result(i+1) := '0';
- when o"1" => result(i+1) := '1';
- when o"2" => result(i+1) := '2';
- when o"3" => result(i+1) := '3';
- when o"4" => result(i+1) := '4';
- when o"5" => result(i+1) := '5';
- when o"6" => result(i+1) := '6';
- when o"7" => result(i+1) := '7';
- when "ZZZ" => result(i+1) := 'Z';
- when others => result(i+1) := 'X';
- end case;
- end loop;
- return result;
- end if;
- end function to_ostring;
-
- -----------------------------------------------------------------------------
- -- Read and Write routines
- -----------------------------------------------------------------------------
-
- -- Routines copied from the "std_logic_1164_additions" package
- -- purpose: Skips white space
- procedure skip_whitespace (
- L : inout LINE) is
- variable readOk : BOOLEAN;
- variable c : CHARACTER;
- begin
- while L /= null and L.all'length /= 0 loop
- if (L.all(1) = ' ' or L.all(1) = NBSP or L.all(1) = HT) then
- read (l, c, readOk);
- else
- exit;
- end if;
- end loop;
- end procedure skip_whitespace;
- procedure READ (L : inout LINE; VALUE : out STD_ULOGIC_VECTOR;
- GOOD : out BOOLEAN) is
- variable m : STD_ULOGIC;
- variable c : CHARACTER;
- variable mv : STD_ULOGIC_VECTOR(0 to VALUE'length-1);
- variable readOk : BOOLEAN;
- variable i : INTEGER;
- variable lastu : BOOLEAN := false; -- last character was an "_"
- begin
- VALUE := (VALUE'range => 'U'); -- initialize to a "U"
- Skip_whitespace (L);
- if VALUE'length > 0 then
- read (l, c, readOk);
- i := 0;
- good := true;
- while i < VALUE'length loop
- if not readOk then -- Bail out if there was a bad read
- good := false;
- return;
- elsif c = '_' then
- if i = 0 then
- good := false; -- Begins with an "_"
- return;
- elsif lastu then
- good := false; -- "__" detected
- return;
- else
- lastu := true;
- end if;
- elsif (char_to_MVL9plus(c) = error) then
- good := false; -- Illegal character
- return;
- else
- mv(i) := char_to_MVL9(c);
- i := i + 1;
- if i > mv'high then -- reading done
- VALUE := mv;
- return;
- end if;
- lastu := false;
- end if;
- read(L, c, readOk);
- end loop;
- else
- good := true; -- read into a null array
- end if;
- end procedure READ;
-
- procedure READ (L : inout LINE; VALUE : out STD_ULOGIC_VECTOR) is
- variable m : STD_ULOGIC;
- variable c : CHARACTER;
- variable readOk : BOOLEAN;
- variable mv : STD_ULOGIC_VECTOR(0 to VALUE'length-1);
- variable i : INTEGER;
- variable lastu : BOOLEAN := false; -- last character was an "_"
- begin
- VALUE := (VALUE'range => 'U'); -- initialize to a "U"
- Skip_whitespace (L);
- if VALUE'length > 0 then -- non Null input string
- read (l, c, readOk);
- i := 0;
- while i < VALUE'length loop
- if readOk = false then -- Bail out if there was a bad read
- report "STD_LOGIC_1164.READ(STD_ULOGIC_VECTOR) "
- & "End of string encountered"
- severity error;
- return;
- elsif c = '_' then
- if i = 0 then
- report "STD_LOGIC_1164.READ(STD_ULOGIC_VECTOR) "
- & "String begins with an ""_""" severity error;
- return;
- elsif lastu then
- report "STD_LOGIC_1164.READ(STD_ULOGIC_VECTOR) "
- & "Two underscores detected in input string ""__"""
- severity error;
- return;
- else
- lastu := true;
- end if;
- elsif char_to_MVL9plus(c) = error then
- report
- "STD_LOGIC_1164.READ(STD_ULOGIC_VECTOR) Error: Character '" &
- c & "' read, expected STD_ULOGIC literal."
- severity error;
- return;
- else
- mv(i) := char_to_MVL9(c);
- i := i + 1;
- if i > mv'high then
- VALUE := mv;
- return;
- end if;
- lastu := false;
- end if;
- read(L, c, readOk);
- end loop;
- end if;
- end procedure READ;
-
- -- purpose: or reduction
- function or_reduce (
- arg : STD_ULOGIC_VECTOR)
- return STD_ULOGIC is
- variable uarg : UNSIGNED (arg'range);
- begin
- uarg := unsigned(arg);
- return or_reduce (uarg);
- end function or_reduce;
-
- procedure Char2QuadBits (C : CHARACTER;
- RESULT : out STD_ULOGIC_VECTOR(3 downto 0);
- GOOD : out BOOLEAN;
- ISSUE_ERROR : in BOOLEAN) is
- begin
- case c is
- when '0' => result := x"0"; good := true;
- when '1' => result := x"1"; good := true;
- when '2' => result := x"2"; good := true;
- when '3' => result := x"3"; good := true;
- when '4' => result := x"4"; good := true;
- when '5' => result := x"5"; good := true;
- when '6' => result := x"6"; good := true;
- when '7' => result := x"7"; good := true;
- when '8' => result := x"8"; good := true;
- when '9' => result := x"9"; good := true;
- when 'A' | 'a' => result := x"A"; good := true;
- when 'B' | 'b' => result := x"B"; good := true;
- when 'C' | 'c' => result := x"C"; good := true;
- when 'D' | 'd' => result := x"D"; good := true;
- when 'E' | 'e' => result := x"E"; good := true;
- when 'F' | 'f' => result := x"F"; good := true;
- when 'Z' => result := "ZZZZ"; good := true;
- when 'X' => result := "XXXX"; good := true;
- when others =>
- assert not ISSUE_ERROR
- report
- "STD_LOGIC_1164.HREAD Read a '" & c &
- "', expected a Hex character (0-F)."
- severity error;
- good := false;
- end case;
- end procedure Char2QuadBits;
-
- procedure HREAD (L : inout LINE; VALUE : out STD_ULOGIC_VECTOR;
- GOOD : out BOOLEAN) is
- variable ok : BOOLEAN;
- variable c : CHARACTER;
- constant ne : INTEGER := (VALUE'length+3)/4;
- constant pad : INTEGER := ne*4 - VALUE'length;
- variable sv : STD_ULOGIC_VECTOR(0 to ne*4 - 1);
- variable i : INTEGER;
- variable lastu : BOOLEAN := false; -- last character was an "_"
- begin
- VALUE := (VALUE'range => 'U'); -- initialize to a "U"
- Skip_whitespace (L);
- if VALUE'length > 0 then
- read (l, c, ok);
- i := 0;
- while i < ne loop
- -- Bail out if there was a bad read
- if not ok then
- good := false;
- return;
- elsif c = '_' then
- if i = 0 then
- good := false; -- Begins with an "_"
- return;
- elsif lastu then
- good := false; -- "__" detected
- return;
- else
- lastu := true;
- end if;
- else
- Char2QuadBits(c, sv(4*i to 4*i+3), ok, false);
- if not ok then
- good := false;
- return;
- end if;
- i := i + 1;
- lastu := false;
- end if;
- if i < ne then
- read(L, c, ok);
- end if;
- end loop;
- if or_reduce (sv (0 to pad-1)) = '1' then -- %%% replace with "or"
- good := false; -- vector was truncated.
- else
- good := true;
- VALUE := sv (pad to sv'high);
- end if;
- else
- good := true; -- Null input string, skips whitespace
- end if;
- end procedure HREAD;
-
- procedure HREAD (L : inout LINE; VALUE : out STD_ULOGIC_VECTOR) is
- variable ok : BOOLEAN;
- variable c : CHARACTER;
- constant ne : INTEGER := (VALUE'length+3)/4;
- constant pad : INTEGER := ne*4 - VALUE'length;
- variable sv : STD_ULOGIC_VECTOR(0 to ne*4 - 1);
- variable i : INTEGER;
- variable lastu : BOOLEAN := false; -- last character was an "_"
- begin
- VALUE := (VALUE'range => 'U'); -- initialize to a "U"
- Skip_whitespace (L);
- if VALUE'length > 0 then -- non Null input string
- read (l, c, ok);
- i := 0;
- while i < ne loop
- -- Bail out if there was a bad read
- if not ok then
- report "STD_LOGIC_1164.HREAD "
- & "End of string encountered"
- severity error;
- return;
- end if;
- if c = '_' then
- if i = 0 then
- report "STD_LOGIC_1164.HREAD "
- & "String begins with an ""_""" severity error;
- return;
- elsif lastu then
- report "STD_LOGIC_1164.HREAD "
- & "Two underscores detected in input string ""__"""
- severity error;
- return;
- else
- lastu := true;
- end if;
- else
- Char2QuadBits(c, sv(4*i to 4*i+3), ok, true);
- if not ok then
- return;
- end if;
- i := i + 1;
- lastu := false;
- end if;
- if i < ne then
- read(L, c, ok);
- end if;
- end loop;
- if or_reduce (sv (0 to pad-1)) = '1' then -- %%% replace with "or"
- report "STD_LOGIC_1164.HREAD Vector truncated"
- severity error;
- else
- VALUE := sv (pad to sv'high);
- end if;
- end if;
- end procedure HREAD;
-
- -- Octal Read and Write procedures for STD_ULOGIC_VECTOR.
- -- Modified from the original to be more forgiving.
-
- procedure Char2TriBits (C : CHARACTER;
- RESULT : out STD_ULOGIC_VECTOR(2 downto 0);
- GOOD : out BOOLEAN;
- ISSUE_ERROR : in BOOLEAN) is
- begin
- case c is
- when '0' => result := o"0"; good := true;
- when '1' => result := o"1"; good := true;
- when '2' => result := o"2"; good := true;
- when '3' => result := o"3"; good := true;
- when '4' => result := o"4"; good := true;
- when '5' => result := o"5"; good := true;
- when '6' => result := o"6"; good := true;
- when '7' => result := o"7"; good := true;
- when 'Z' => result := "ZZZ"; good := true;
- when 'X' => result := "XXX"; good := true;
- when others =>
- assert not ISSUE_ERROR
- report
- "STD_LOGIC_1164.OREAD Error: Read a '" & c &
- "', expected an Octal character (0-7)."
- severity error;
- good := false;
- end case;
- end procedure Char2TriBits;
-
- procedure OREAD (L : inout LINE; VALUE : out STD_ULOGIC_VECTOR;
- GOOD : out BOOLEAN) is
- variable ok : BOOLEAN;
- variable c : CHARACTER;
- constant ne : INTEGER := (VALUE'length+2)/3;
- constant pad : INTEGER := ne*3 - VALUE'length;
- variable sv : STD_ULOGIC_VECTOR(0 to ne*3 - 1);
- variable i : INTEGER;
- variable lastu : BOOLEAN := false; -- last character was an "_"
- begin
- VALUE := (VALUE'range => 'U'); -- initialize to a "U"
- Skip_whitespace (L);
- if VALUE'length > 0 then
- read (l, c, ok);
- i := 0;
- while i < ne loop
- -- Bail out if there was a bad read
- if not ok then
- good := false;
- return;
- elsif c = '_' then
- if i = 0 then
- good := false; -- Begins with an "_"
- return;
- elsif lastu then
- good := false; -- "__" detected
- return;
- else
- lastu := true;
- end if;
- else
- Char2TriBits(c, sv(3*i to 3*i+2), ok, false);
- if not ok then
- good := false;
- return;
- end if;
- i := i + 1;
- lastu := false;
- end if;
- if i < ne then
- read(L, c, ok);
- end if;
- end loop;
- if or_reduce (sv (0 to pad-1)) = '1' then -- %%% replace with "or"
- good := false; -- vector was truncated.
- else
- good := true;
- VALUE := sv (pad to sv'high);
- end if;
- else
- good := true; -- read into a null array
- end if;
- end procedure OREAD;
-
- procedure OREAD (L : inout LINE; VALUE : out STD_ULOGIC_VECTOR) is
- variable c : CHARACTER;
- variable ok : BOOLEAN;
- constant ne : INTEGER := (VALUE'length+2)/3;
- constant pad : INTEGER := ne*3 - VALUE'length;
- variable sv : STD_ULOGIC_VECTOR(0 to ne*3 - 1);
- variable i : INTEGER;
- variable lastu : BOOLEAN := false; -- last character was an "_"
- begin
- VALUE := (VALUE'range => 'U'); -- initialize to a "U"
- Skip_whitespace (L);
- if VALUE'length > 0 then
- read (l, c, ok);
- i := 0;
- while i < ne loop
- -- Bail out if there was a bad read
- if not ok then
- report "STD_LOGIC_1164.OREAD "
- & "End of string encountered"
- severity error;
- return;
- elsif c = '_' then
- if i = 0 then
- report "STD_LOGIC_1164.OREAD "
- & "String begins with an ""_""" severity error;
- return;
- elsif lastu then
- report "STD_LOGIC_1164.OREAD "
- & "Two underscores detected in input string ""__"""
- severity error;
- return;
- else
- lastu := true;
- end if;
- else
- Char2TriBits(c, sv(3*i to 3*i+2), ok, true);
- if not ok then
- return;
- end if;
- i := i + 1;
- lastu := false;
- end if;
- if i < ne then
- read(L, c, ok);
- end if;
- end loop;
- if or_reduce (sv (0 to pad-1)) = '1' then -- %%% replace with "or"
- report "STD_LOGIC_1164.OREAD Vector truncated"
- severity error;
- else
- VALUE := sv (pad to sv'high);
- end if;
- end if;
- end procedure OREAD;
- -- End copied code.
-
- procedure READ (L : inout LINE; VALUE : out UNSIGNED;
- GOOD : out BOOLEAN) is
- variable ivalue : STD_ULOGIC_VECTOR(value'range);
- begin
- READ (L => L,
- VALUE => ivalue,
- GOOD => GOOD);
- VALUE := UNSIGNED(ivalue);
- end procedure READ;
-
- procedure READ (L : inout LINE; VALUE : out UNSIGNED) is
- variable ivalue : STD_ULOGIC_VECTOR(value'range);
- begin
- READ (L => L,
- VALUE => ivalue);
- VALUE := UNSIGNED (ivalue);
- end procedure READ;
-
- procedure READ (L : inout LINE; VALUE : out SIGNED;
- GOOD : out BOOLEAN) is
- variable ivalue : STD_ULOGIC_VECTOR(value'range);
- begin
- READ (L => L,
- VALUE => ivalue,
- GOOD => GOOD);
- VALUE := SIGNED(ivalue);
- end procedure READ;
-
- procedure READ (L : inout LINE; VALUE : out SIGNED) is
- variable ivalue : STD_ULOGIC_VECTOR(value'range);
- begin
- READ (L => L,
- VALUE => ivalue);
- VALUE := SIGNED (ivalue);
- end procedure READ;
-
- procedure WRITE (L : inout LINE; VALUE : in UNSIGNED;
- JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0) is
- begin
- write (L, to_string(VALUE), JUSTIFIED, FIELD);
- end procedure WRITE;
-
- procedure WRITE (L : inout LINE; VALUE : in SIGNED;
- JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0) is
- begin
- write (L, to_string(VALUE), JUSTIFIED, FIELD);
- end procedure WRITE;
-
- procedure OREAD (L : inout LINE; VALUE : out UNSIGNED;
- GOOD : out BOOLEAN) is
- variable ivalue : STD_ULOGIC_VECTOR(value'range);
- begin
- OREAD (L => L,
- VALUE => ivalue,
- GOOD => GOOD);
- VALUE := UNSIGNED(ivalue);
- end procedure OREAD;
-
- procedure OREAD (L : inout LINE; VALUE : out SIGNED;
- GOOD : out BOOLEAN) is
- constant ne : INTEGER := (value'length+2)/3;
- constant pad : INTEGER := ne*3 - value'length;
- variable ivalue : STD_ULOGIC_VECTOR(0 to ne*3-1);
- variable ok : BOOLEAN;
- variable expected_padding : STD_ULOGIC_VECTOR(0 to pad-1);
- begin
- OREAD (L => L,
- VALUE => ivalue, -- Read padded STRING
- GOOD => ok);
- -- Bail out if there was a bad read
- if not ok then
- GOOD := false;
- return;
- end if;
- expected_padding := (others => ivalue(pad));
- if ivalue(0 to pad-1) /= expected_padding then
- GOOD := false;
- else
- GOOD := true;
- VALUE := UNRESOLVED_SIGNED (ivalue (pad to ivalue'high));
- end if;
- end procedure OREAD;
-
- procedure OREAD (L : inout LINE; VALUE : out UNSIGNED) is
- variable ivalue : STD_ULOGIC_VECTOR(value'range);
- begin
- OREAD (L => L,
- VALUE => ivalue);
- VALUE := UNSIGNED (ivalue);
- end procedure OREAD;
-
- procedure OREAD (L : inout LINE; VALUE : out SIGNED) is
- constant ne : INTEGER := (value'length+2)/3;
- constant pad : INTEGER := ne*3 - value'length;
- variable ivalue : STD_ULOGIC_VECTOR(0 to ne*3-1);
- variable expected_padding : STD_ULOGIC_VECTOR(0 to pad-1);
- begin
- OREAD (L => L,
- VALUE => ivalue); -- Read padded string
- expected_padding := (others => ivalue(pad));
- if ivalue(0 to pad-1) /= expected_padding then
- assert false
- report "NUMERIC_STD.OREAD Error: Signed vector truncated"
- severity error;
- else
- VALUE := UNRESOLVED_SIGNED (ivalue (pad to ivalue'high));
- end if;
- end procedure OREAD;
-
- procedure HREAD (L : inout LINE; VALUE : out UNSIGNED;
- GOOD : out BOOLEAN) is
- variable ivalue : STD_ULOGIC_VECTOR(value'range);
- begin
- HREAD (L => L,
- VALUE => ivalue,
- GOOD => GOOD);
- VALUE := UNSIGNED(ivalue);
- end procedure HREAD;
-
- procedure HREAD (L : inout LINE; VALUE : out SIGNED;
- GOOD : out BOOLEAN) is
- constant ne : INTEGER := (value'length+3)/4;
- constant pad : INTEGER := ne*4 - value'length;
- variable ivalue : STD_ULOGIC_VECTOR(0 to ne*4-1);
- variable ok : BOOLEAN;
- variable expected_padding : STD_ULOGIC_VECTOR(0 to pad-1);
- begin
- HREAD (L => L,
- VALUE => ivalue, -- Read padded STRING
- GOOD => ok);
- if not ok then
- GOOD := false;
- return;
- end if;
- expected_padding := (others => ivalue(pad));
- if ivalue(0 to pad-1) /= expected_padding then
- GOOD := false;
- else
- GOOD := true;
- VALUE := UNRESOLVED_SIGNED (ivalue (pad to ivalue'high));
- end if;
- end procedure HREAD;
-
- procedure HREAD (L : inout LINE; VALUE : out UNSIGNED) is
- variable ivalue : STD_ULOGIC_VECTOR(value'range);
- begin
- HREAD (L => L,
- VALUE => ivalue);
- VALUE := UNSIGNED (ivalue);
- end procedure HREAD;
-
- procedure HREAD (L : inout LINE; VALUE : out SIGNED) is
- constant ne : INTEGER := (value'length+3)/4;
- constant pad : INTEGER := ne*4 - value'length;
- variable ivalue : STD_ULOGIC_VECTOR(0 to ne*4-1);
- variable expected_padding : STD_ULOGIC_VECTOR(0 to pad-1);
- begin
- HREAD (L => L,
- VALUE => ivalue); -- Read padded string
- expected_padding := (others => ivalue(pad));
- if ivalue(0 to pad-1) /= expected_padding then
- assert false
- report "NUMERIC_STD.HREAD Error: Signed vector truncated"
- severity error;
- else
- VALUE := UNRESOLVED_SIGNED (ivalue (pad to ivalue'high));
- end if;
- end procedure HREAD;
-
- procedure OWRITE (L : inout LINE; VALUE : in UNSIGNED;
- JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0) is
- begin
- write (L, to_ostring(VALUE), JUSTIFIED, FIELD);
- end procedure OWRITE;
-
- procedure OWRITE (L : inout LINE; VALUE : in SIGNED;
- JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0) is
- begin
- write (L, to_ostring(VALUE), JUSTIFIED, FIELD);
- end procedure OWRITE;
-
- procedure HWRITE (L : inout LINE; VALUE : in UNSIGNED;
- JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0) is
- begin
- write (L, to_hstring (VALUE), JUSTIFIED, FIELD);
- end procedure HWRITE;
-
- procedure HWRITE (L : inout LINE; VALUE : in SIGNED;
- JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0) is
- begin
- write (L, to_hstring (VALUE), JUSTIFIED, FIELD);
- end procedure HWRITE;
-
- -- rtl_synthesis on
--- pragma synthesis_on
-end package body numeric_std_additions;
diff --git a/ieee_proposed/rtl/numeric_std_unsigned_c.vhd b/ieee_proposed/rtl/numeric_std_unsigned_c.vhd
deleted file mode 100644
index 30e65ee..0000000
--- a/ieee_proposed/rtl/numeric_std_unsigned_c.vhd
+++ /dev/null
@@ -1,2207 +0,0 @@
--- --------------------------------------------------------------------
--- Title : Standard VHDL Synthesis Packages (1076.3, NUMERIC_STD_UNSIGNED)
---
--- This package overloaded the arithmetic operaters for
--- "STD_ULOGIC_VECTOR", and treats this vector like an
--- "UNSIGNED" from "numeric_std".
---
--- This is the updated (proposed) new package to be
--- balloted in January.
---
--- New subprograms are at the end of the package header
--- and the package body. These are to be revised, ID's
--- assigned, and voted into the ballot version.
---
--- Other changes will be noted here.
---
--- Created for VHDL-200X par, David Bishop (dbishop@vhdl.org)
-------------------------------------------------------------------------------
-
-library IEEE;
-use IEEE.STD_LOGIC_1164.all;
-package NUMERIC_STD_UNSIGNED is
-
--- begin LCS-2006-141
- -- Replace all subsequent occurrences of STD_LOGIC_VECTOR
- -- with STD_ULOGIC_ECTOR.
--- end LCS-2006-141
- -- Id: A.3
- function "+" (L, R : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
- -- Result subtype: STD_ULOGIC_VECTOR(MAXIMUM(L'LENGTH, R'LENGTH)-1 downto 0).
- -- Result: Adds two UNSIGNED vectors that may be of different lengths.
-
- -- Id: A.3R
- function "+"(L : STD_ULOGIC_VECTOR; R : STD_ULOGIC) return STD_ULOGIC_VECTOR;
- -- Result subtype: STD_ULOGIC_VECTOR(L'LENGTH-1 downto 0)
- -- Result: Similar to A.3 where R is a one bit STD_ULOGIC_VECTOR
-
- -- Id: A.3L
- function "+"(L : STD_ULOGIC; R : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
- -- Result subtype: STD_ULOGIC_VECTOR(R'LENGTH-1 downto 0)
- -- Result: Similar to A.3 where L is a one bit UNSIGNED
-
- -- Id: A.5
- function "+" (L : STD_ULOGIC_VECTOR; R : NATURAL) return STD_ULOGIC_VECTOR;
- -- Result subtype: STD_ULOGIC_VECTOR(L'LENGTH-1 downto 0).
- -- Result: Adds an UNSIGNED vector, L, with a non-negative INTEGER, R.
-
- -- Id: A.6
- function "+" (L : NATURAL; R : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
- -- Result subtype: STD_ULOGIC_VECTOR(R'LENGTH-1 downto 0).
- -- Result: Adds a non-negative INTEGER, L, with an UNSIGNED vector, R.
-
- --============================================================================
-
- -- Id: A.9
- function "-" (L, R : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
- -- Result subtype: UNSIGNED(MAXIMUM(L'LENGTH, R'LENGTH)-1 downto 0).
- -- Result: Subtracts two UNSIGNED vectors that may be of different lengths.
-
- -- Id: A.9R
- function "-"(L : STD_ULOGIC_VECTOR; R : STD_ULOGIC) return STD_ULOGIC_VECTOR;
- -- Result subtype: STD_ULOGIC_VECTOR(L'LENGTH-1 downto 0)
- -- Result: Similar to A.9 where R is a one bit UNSIGNED
-
- -- Id: A.9L
- function "-"(L : STD_ULOGIC; R : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
- -- Result subtype: STD_ULOGIC_VECTOR(R'LENGTH-1 downto 0)
- -- Result: Similar to A.9 where L is a one bit UNSIGNED
-
- -- Id: A.11
- function "-" (L : STD_ULOGIC_VECTOR; R : NATURAL) return STD_ULOGIC_VECTOR;
- -- Result subtype: STD_ULOGIC_VECTOR(L'LENGTH-1 downto 0).
- -- Result: Subtracts a non-negative INTEGER, R, from an UNSIGNED vector, L.
-
- -- Id: A.12
- function "-" (L : NATURAL; R : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
- -- Result subtype: STD_ULOGIC_VECTOR(R'LENGTH-1 downto 0).
- -- Result: Subtracts an UNSIGNED vector, R, from a non-negative INTEGER, L.
-
- --============================================================================
-
- -- Id: A.15
- function "*" (L, R : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
- -- Result subtype: STD_ULOGIC_VECTOR((L'LENGTH+R'LENGTH-1) downto 0).
- -- Result: Performs the multiplication operation on two UNSIGNED vectors
- -- that may possibly be of different lengths.
-
- -- Id: A.17
- function "*" (L : STD_ULOGIC_VECTOR; R : NATURAL) return STD_ULOGIC_VECTOR;
- -- Result subtype: STD_ULOGIC_VECTOR((L'LENGTH+L'LENGTH-1) downto 0).
- -- Result: Multiplies an UNSIGNED vector, L, with a non-negative
- -- INTEGER, R. R is converted to an UNSIGNED vector of
- -- SIZE L'LENGTH before multiplication.
-
- -- Id: A.18
- function "*" (L : NATURAL; R : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
- -- Result subtype: STD_ULOGIC_VECTOR((R'LENGTH+R'LENGTH-1) downto 0).
- -- Result: Multiplies an UNSIGNED vector, R, with a non-negative
- -- INTEGER, L. L is converted to an UNSIGNED vector of
- -- SIZE R'LENGTH before multiplication.
-
- --============================================================================
- --
- -- NOTE: If second argument is zero for "/" operator, a severity level
- -- of ERROR is issued.
-
- -- Id: A.21
- function "/" (L, R : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
- -- Result subtype: STD_ULOGIC_VECTOR(L'LENGTH-1 downto 0)
- -- Result: Divides an UNSIGNED vector, L, by another UNSIGNED vector, R.
-
- -- Id: A.23
- function "/" (L : STD_ULOGIC_VECTOR; R : NATURAL) return STD_ULOGIC_VECTOR;
- -- Result subtype: STD_ULOGIC_VECTOR(L'LENGTH-1 downto 0)
- -- Result: Divides an UNSIGNED vector, L, by a non-negative INTEGER, R.
- -- If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH.
-
- -- Id: A.24
- function "/" (L : NATURAL; R : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
- -- Result subtype: STD_ULOGIC_VECTOR(R'LENGTH-1 downto 0)
- -- Result: Divides a non-negative INTEGER, L, by an UNSIGNED vector, R.
- -- If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH.
-
- --============================================================================
- --
- -- NOTE: If second argument is zero for "rem" operator, a severity level
- -- of ERROR is issued.
-
- -- Id: A.27
- function "rem" (L, R : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
- -- Result subtype: STD_ULOGIC_VECTOR(R'LENGTH-1 downto 0)
- -- Result: Computes "L rem R" where L and R are UNSIGNED vectors.
-
- -- Id: A.29
- function "rem" (L : STD_ULOGIC_VECTOR; R : NATURAL) return STD_ULOGIC_VECTOR;
- -- Result subtype: STD_ULOGIC_VECTOR(L'LENGTH-1 downto 0)
- -- Result: Computes "L rem R" where L is an UNSIGNED vector and R is a
- -- non-negative INTEGER.
- -- If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH.
-
- -- Id: A.30
- function "rem" (L : NATURAL; R : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
- -- Result subtype: STD_ULOGIC_VECTOR(R'LENGTH-1 downto 0)
- -- Result: Computes "L rem R" where R is an UNSIGNED vector and L is a
- -- non-negative INTEGER.
- -- If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH.
-
- --============================================================================
- --
- -- NOTE: If second argument is zero for "mod" operator, a severity level
- -- of ERROR is issued.
-
- -- Id: A.33
- function "mod" (L, R : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
- -- Result subtype: STD_ULOGIC_VECTOR(R'LENGTH-1 downto 0)
- -- Result: Computes "L mod R" where L and R are UNSIGNED vectors.
-
- -- Id: A.35
- function "mod" (L : STD_ULOGIC_VECTOR; R : NATURAL) return STD_ULOGIC_VECTOR;
- -- Result subtype: STD_ULOGIC_VECTOR(L'LENGTH-1 downto 0)
- -- Result: Computes "L mod R" where L is an UNSIGNED vector and R
- -- is a non-negative INTEGER.
- -- If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH.
-
- -- Id: A.36
- function "mod" (L : NATURAL; R : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
- -- Result subtype: STD_ULOGIC_VECTOR(R'LENGTH-1 downto 0)
- -- Result: Computes "L mod R" where R is an UNSIGNED vector and L
- -- is a non-negative INTEGER.
- -- If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH.
-
--- begin LCS-2006-129
- --============================================================================
- -- Id: A.39
- function find_leftmost (ARG : STD_ULOGIC_VECTOR; Y : STD_ULOGIC) return INTEGER;
- -- Result subtype: INTEGER
- -- Result: Finds the leftmost occurrence of the value of Y in ARG.
- -- Returns the index of the occurrence if it exists, or -1 otherwise.
-
- -- Id: A.41
- function find_rightmost (ARG : STD_ULOGIC_VECTOR; Y : STD_ULOGIC) return INTEGER;
- -- Result subtype: INTEGER
- -- Result: Finds the leftmost occurrence of the value of Y in ARG.
- -- Returns the index of the occurrence if it exists, or -1 otherwise.
-
--- end LCS-2006-129
- --============================================================================
- -- Comparison Operators
- --============================================================================
-
- -- Id: C.1
- function ">" (L, R : STD_ULOGIC_VECTOR) return BOOLEAN;
- -- Result subtype: BOOLEAN
- -- Result: Computes "L > R" where L and R are UNSIGNED vectors possibly
- -- of different lengths.
-
- -- Id: C.3
- function ">" (L : NATURAL; R : STD_ULOGIC_VECTOR) return BOOLEAN;
- -- Result subtype: BOOLEAN
- -- Result: Computes "L > R" where L is a non-negative INTEGER and
- -- R is an UNSIGNED vector.
-
- -- Id: C.5
- function ">" (L : STD_ULOGIC_VECTOR; R : NATURAL) return BOOLEAN;
- -- Result subtype: BOOLEAN
- -- Result: Computes "L > R" where L is an UNSIGNED vector and
- -- R is a non-negative INTEGER.
-
- --============================================================================
-
- -- Id: C.7
- function "<" (L, R : STD_ULOGIC_VECTOR) return BOOLEAN;
- -- Result subtype: BOOLEAN
- -- Result: Computes "L < R" where L and R are UNSIGNED vectors possibly
- -- of different lengths.
-
- -- Id: C.9
- function "<" (L : NATURAL; R : STD_ULOGIC_VECTOR) return BOOLEAN;
- -- Result subtype: BOOLEAN
- -- Result: Computes "L < R" where L is a non-negative INTEGER and
- -- R is an UNSIGNED vector.
-
- -- Id: C.11
- function "<" (L : STD_ULOGIC_VECTOR; R : NATURAL) return BOOLEAN;
- -- Result subtype: BOOLEAN
- -- Result: Computes "L < R" where L is an UNSIGNED vector and
- -- R is a non-negative INTEGER.
-
- --============================================================================
-
- -- Id: C.13
- function "<=" (L, R : STD_ULOGIC_VECTOR) return BOOLEAN;
- -- Result subtype: BOOLEAN
- -- Result: Computes "L <= R" where L and R are UNSIGNED vectors possibly
- -- of different lengths.
-
- -- Id: C.15
- function "<=" (L : NATURAL; R : STD_ULOGIC_VECTOR) return BOOLEAN;
- -- Result subtype: BOOLEAN
- -- Result: Computes "L <= R" where L is a non-negative INTEGER and
- -- R is an UNSIGNED vector.
-
- -- Id: C.17
- function "<=" (L : STD_ULOGIC_VECTOR; R : NATURAL) return BOOLEAN;
- -- Result subtype: BOOLEAN
- -- Result: Computes "L <= R" where L is an UNSIGNED vector and
- -- R is a non-negative INTEGER.
-
- --============================================================================
-
- -- Id: C.19
- function ">=" (L, R : STD_ULOGIC_VECTOR) return BOOLEAN;
- -- Result subtype: BOOLEAN
- -- Result: Computes "L >= R" where L and R are UNSIGNED vectors possibly
- -- of different lengths.
-
- -- Id: C.21
- function ">=" (L : NATURAL; R : STD_ULOGIC_VECTOR) return BOOLEAN;
- -- Result subtype: BOOLEAN
- -- Result: Computes "L >= R" where L is a non-negative INTEGER and
- -- R is an UNSIGNED vector.
-
- -- Id: C.23
- function ">=" (L : STD_ULOGIC_VECTOR; R : NATURAL) return BOOLEAN;
- -- Result subtype: BOOLEAN
- -- Result: Computes "L >= R" where L is an UNSIGNED vector and
- -- R is a non-negative INTEGER.
-
- --============================================================================
-
- -- Id: C.25
- function "=" (L, R : STD_ULOGIC_VECTOR) return BOOLEAN;
- -- Result subtype: BOOLEAN
- -- Result: Computes "L = R" where L and R are UNSIGNED vectors possibly
- -- of different lengths.
-
- -- Id: C.27
- function "=" (L : NATURAL; R : STD_ULOGIC_VECTOR) return BOOLEAN;
- -- Result subtype: BOOLEAN
- -- Result: Computes "L = R" where L is a non-negative INTEGER and
- -- R is an UNSIGNED vector.
-
- -- Id: C.29
- function "=" (L : STD_ULOGIC_VECTOR; R : NATURAL) return BOOLEAN;
- -- Result subtype: BOOLEAN
- -- Result: Computes "L = R" where L is an UNSIGNED vector and
- -- R is a non-negative INTEGER.
-
- --============================================================================
-
- -- Id: C.31
- function "/=" (L, R : STD_ULOGIC_VECTOR) return BOOLEAN;
- -- Result subtype: BOOLEAN
- -- Result: Computes "L /= R" where L and R are UNSIGNED vectors possibly
- -- of different lengths.
-
- -- Id: C.33
- function "/=" (L : NATURAL; R : STD_ULOGIC_VECTOR) return BOOLEAN;
- -- Result subtype: BOOLEAN
- -- Result: Computes "L /= R" where L is a non-negative INTEGER and
- -- R is an UNSIGNED vector.
-
- -- Id: C.35
- function "/=" (L : STD_ULOGIC_VECTOR; R : NATURAL) return BOOLEAN;
- -- Result subtype: BOOLEAN
- -- Result: Computes "L /= R" where L is an UNSIGNED vector and
- -- R is a non-negative INTEGER.
-
- --============================================================================
-
- -- Id: C.37
- function MINIMUM (L, R : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
- -- Result subtype: STD_ULOGIC_VECTOR
- -- Result: Returns the lesser of two UNSIGNED vectors that may be
- -- of different lengths.
-
- -- Id: C.39
- function MINIMUM (L : NATURAL; R : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
- -- Result subtype: STD_ULOGIC_VECTOR
- -- Result: Returns the lesser of a nonnegative INTEGER, L, and
- -- an UNSIGNED vector, R.
-
- -- Id: C.41
- function MINIMUM (L : STD_ULOGIC_VECTOR; R : NATURAL) return STD_ULOGIC_VECTOR;
- -- Result subtype: STD_ULOGIC_VECTOR
- -- Result: Returns the lesser of an UNSIGNED vector, L, and
- -- a nonnegative INTEGER, R.
-
- --============================================================================
-
- -- Id: C.43
- function MAXIMUM (L, R : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
- -- Result subtype: STD_ULOGIC_VECTOR
- -- Result: Returns the greater of two UNSIGNED vectors that may be
- -- of different lengths.
-
- -- Id: C.45
- function MAXIMUM (L : NATURAL; R : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
- -- Result subtype: STD_ULOGIC_VECTOR
- -- Result: Returns the greater of a nonnegative INTEGER, L, and
- -- an UNSIGNED vector, R.
-
- -- Id: C.47
- function MAXIMUM (L : STD_ULOGIC_VECTOR; R : NATURAL) return STD_ULOGIC_VECTOR;
- -- Result subtype: STD_ULOGIC_VECTOR
- -- Result: Returns the greater of an UNSIGNED vector, L, and
- -- a nonnegative INTEGER, R.
-
- --============================================================================
- -- Id: C.49
- function \?>\ (L, R : STD_ULOGIC_VECTOR) return STD_ULOGIC;
- -- Result subtype: STD_ULOGIC
- -- Result: Computes "L > R" where L and R are UNSIGNED vectors possibly
- -- of different lengths.
-
- -- Id: C.51
- function \?>\ (L : NATURAL; R : STD_ULOGIC_VECTOR) return STD_ULOGIC;
- -- Result subtype: STD_ULOGIC
- -- Result: Computes "L > R" where L is a nonnegative INTEGER and
- -- R is an UNSIGNED vector.
-
- -- Id: C.53
- function \?>\ (L : STD_ULOGIC_VECTOR; R : NATURAL) return STD_ULOGIC;
- -- Result subtype: STD_ULOGIC
- -- Result: Computes "L > R" where L is an UNSIGNED vector and
- -- R is a nonnegative INTEGER.
-
- --============================================================================
-
- -- Id: C.55
- function \?<\ (L, R : STD_ULOGIC_VECTOR) return STD_ULOGIC;
- -- Result subtype: STD_ULOGIC
- -- Result: Computes "L < R" where L and R are UNSIGNED vectors possibly
- -- of different lengths.
-
- -- Id: C.57
- function \?<\ (L : NATURAL; R : STD_ULOGIC_VECTOR) return STD_ULOGIC;
- -- Result subtype: STD_ULOGIC
- -- Result: Computes "L < R" where L is a nonnegative INTEGER and
- -- R is an UNSIGNED vector.
-
- -- Id: C.59
- function \?<\ (L : STD_ULOGIC_VECTOR; R : NATURAL) return STD_ULOGIC;
- -- Result subtype: STD_ULOGIC
- -- Result: Computes "L < R" where L is an UNSIGNED vector and
- -- R is a nonnegative INTEGER.
-
- --============================================================================
-
- -- Id: C.61
- function \?<=\ (L, R : STD_ULOGIC_VECTOR) return STD_ULOGIC;
- -- Result subtype: STD_ULOGIC
- -- Result: Computes "L <= R" where L and R are UNSIGNED vectors possibly
- -- of different lengths.
-
- -- Id: C.63
- function \?<=\ (L : NATURAL; R : STD_ULOGIC_VECTOR) return STD_ULOGIC;
- -- Result subtype: STD_ULOGIC
- -- Result: Computes "L <= R" where L is a nonnegative INTEGER and
- -- R is an UNSIGNED vector.
-
- -- Id: C.65
- function \?<=\ (L : STD_ULOGIC_VECTOR; R : NATURAL) return STD_ULOGIC;
- -- Result subtype: STD_ULOGIC
- -- Result: Computes "L <= R" where L is an UNSIGNED vector and
- -- R is a nonnegative INTEGER.
-
- --============================================================================
-
- -- Id: C.67
- function \?>=\ (L, R : STD_ULOGIC_VECTOR) return STD_ULOGIC;
- -- Result subtype: STD_ULOGIC
- -- Result: Computes "L >= R" where L and R are UNSIGNED vectors possibly
- -- of different lengths.
-
- -- Id: C.69
- function \?>=\ (L : NATURAL; R : STD_ULOGIC_VECTOR) return STD_ULOGIC;
- -- Result subtype: STD_ULOGIC
- -- Result: Computes "L >= R" where L is a nonnegative INTEGER and
- -- R is an UNSIGNED vector.
-
- -- Id: C.71
- function \?>=\ (L : STD_ULOGIC_VECTOR; R : NATURAL) return STD_ULOGIC;
- -- Result subtype: STD_ULOGIC
- -- Result: Computes "L >= R" where L is an UNSIGNED vector and
- -- R is a nonnegative INTEGER.
-
- --============================================================================
-
- -- Id: C.73
--- function \?=\ (L, R : STD_ULOGIC_VECTOR) return STD_ULOGIC;
- -- Result subtype: STD_ULOGIC
- -- Result: Computes "L = R" where L and R are UNSIGNED vectors possibly
- -- of different lengths.
-
- -- Id: C.75
--- function \?=\ (L : NATURAL; R : STD_ULOGIC_VECTOR) return STD_ULOGIC;
- -- Result subtype: STD_ULOGIC
- -- Result: Computes "L = R" where L is a nonnegative INTEGER and
- -- R is an UNSIGNED vector.
-
- -- Id: C.77
--- function \?=\ (L : STD_ULOGIC_VECTOR; R : NATURAL) return STD_ULOGIC;
- -- Result subtype: STD_ULOGIC
- -- Result: Computes "L = R" where L is an UNSIGNED vector and
- -- R is a nonnegative INTEGER.
-
- --============================================================================
-
- -- Id: C.79
--- function \?/=\ (L, R : STD_ULOGIC_VECTOR) return STD_ULOGIC;
- -- Result subtype: STD_ULOGIC
- -- Result: Computes "L /= R" where L and R are UNSIGNED vectors possibly
- -- of different lengths.
-
- -- Id: C.81
--- function \?/=\ (L : NATURAL; R : STD_ULOGIC_VECTOR) return STD_ULOGIC;
- -- Result subtype: STD_ULOGIC
- -- Result: Computes "L /= R" where L is a nonnegative INTEGER and
- -- R is an UNSIGNED vector.
-
- -- Id: C.83
--- function \?/=\ (L : STD_ULOGIC_VECTOR; R : NATURAL) return STD_ULOGIC;
- -- Result subtype: STD_ULOGIC
- -- Result: Computes "L /= R" where L is an UNSIGNED vector and
- -- R is a nonnegative INTEGER.
-
- --============================================================================
- -- Shift and Rotate Functions
- --============================================================================
-
- -- Id: S.1
- function SHIFT_LEFT (ARG : STD_ULOGIC_VECTOR; COUNT : NATURAL)
- return STD_ULOGIC_VECTOR;
- -- Result subtype: STD_ULOGIC_VECTOR(ARG'LENGTH-1 downto 0)
- -- Result: Performs a shift-left on an UNSIGNED vector COUNT times.
- -- The vacated positions are filled with '0'.
- -- The COUNT leftmost elements are lost.
-
- -- Id: S.2
- function SHIFT_RIGHT (ARG : STD_ULOGIC_VECTOR; COUNT : NATURAL)
- return STD_ULOGIC_VECTOR;
- -- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0)
- -- Result: Performs a shift-right on an UNSIGNED vector COUNT times.
- -- The vacated positions are filled with '0'.
- -- The COUNT rightmost elements are lost.
- --============================================================================
-
- -- Id: S.5
- function ROTATE_LEFT (ARG : STD_ULOGIC_VECTOR; COUNT : NATURAL)
- return STD_ULOGIC_VECTOR;
- -- Result subtype: STD_ULOGIC_VECTOR(ARG'LENGTH-1 downto 0)
- -- Result: Performs a rotate-left of an UNSIGNED vector COUNT times.
-
- -- Id: S.6
- function ROTATE_RIGHT (ARG : STD_ULOGIC_VECTOR; COUNT : NATURAL)
- return STD_ULOGIC_VECTOR;
- -- Result subtype: STD_ULOGIC_VECTOR(ARG'LENGTH-1 downto 0)
- -- Result: Performs a rotate-right of an UNSIGNED vector COUNT times.
-
- ------------------------------------------------------------------------------
- -- Note: Function S.17 is not compatible with IEEE Std 1076-1987. Comment
- -- out the function (declaration and body) for IEEE Std 1076-1987 compatibility.
- ------------------------------------------------------------------------------
- -- Id: S.17
- function "sla" (ARG : STD_ULOGIC_VECTOR; COUNT : INTEGER) return STD_ULOGIC_VECTOR;
- -- Result subtype: STD_ULOGIC_VECTOR(ARG'LENGTH-1 downto 0)
- -- Result: SHIFT_LEFT(ARG, COUNT)
-
- ------------------------------------------------------------------------------
- -- Note: Function S.19 is not compatible with IEEE Std 1076-1987. Comment
- -- out the function (declaration and body) for IEEE Std 1076-1987 compatibility.
- ------------------------------------------------------------------------------
- -- Id: S.19
- function "sra" (ARG : STD_ULOGIC_VECTOR; COUNT : INTEGER) return STD_ULOGIC_VECTOR;
- -- Result subtype: STD_ULOGIC_VECTOR(ARG'LENGTH-1 downto 0)
- -- Result: SHIFT_RIGHT(ARG, COUNT)
-
-
- --============================================================================
- -- RESIZE Functions
- --============================================================================
-
- -- Id: R.2
- function RESIZE (ARG : STD_ULOGIC_VECTOR; NEW_SIZE : NATURAL)
- return STD_ULOGIC_VECTOR;
- -- Result subtype: STD_ULOGIC_VECTOR(NEW_SIZE-1 downto 0)
- -- Result: Resizes the UNSIGNED vector ARG to the specified size.
- -- To create a larger vector, the new [leftmost] bit positions
- -- are filled with '0'. When truncating, the leftmost bits
- -- are dropped.
-
- -- size_res versions of these functions (Bugzilla 165)
- function RESIZE (ARG, SIZE_RES : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
- -- Result subtype: STD_ULOGIC_VECTOR (SIZE_RES'length-1 downto 0)
- --============================================================================
- -- Conversion Functions
- --============================================================================
-
- -- Id: D.1
- function TO_INTEGER (ARG : STD_ULOGIC_VECTOR) return NATURAL;
- -- Result subtype: NATURAL. Value cannot be negative since parameter is an
- -- UNSIGNED vector.
- -- Result: Converts the UNSIGNED vector to an INTEGER.
-
- -- Id: D.3
- function To_StdLogicVector (ARG, SIZE : NATURAL) return STD_LOGIC_VECTOR;
- -- Result subtype: STD_LOGIC_VECTOR(SIZE-1 downto 0)
- -- Result: Converts a non-negative INTEGER to an UNSIGNED vector with
- -- the specified SIZE.
-
--- begin LCS-2006-130
- alias To_Std_Logic_Vector is
- To_StdLogicVector[NATURAL, NATURAL return STD_LOGIC_VECTOR];
- alias To_SLV is
- To_StdLogicVector[NATURAL, NATURAL return STD_LOGIC_VECTOR];
- -- size_res versions of these functions (Bugzilla 165)
- function To_StdLogicVector (ARG : NATURAL; SIZE_RES : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
- -- Result subtype: STD_LOGIC_VECTOR(SIZE_RES'length-1 downto 0)
--- end LCS-2006-130
- -- Id: D.5
- function To_StdULogicVector (ARG, SIZE : NATURAL) return STD_ULOGIC_VECTOR;
- -- Result subtype: STD_ULOGIC_VECTOR(SIZE-1 downto 0)
- -- Result: Converts a non-negative INTEGER to an UNSIGNED vector with
- -- the specified SIZE.
- -- size_res versions of these functions (Bugzilla 165)
- function To_StdULogicVector (ARG : NATURAL; SIZE_RES : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
- -- Result subtype: STD_LOGIC_VECTOR(SIZE_RES'length-1 downto 0)
--- begin LCS-2006-130
- alias To_Std_ULogic_Vector is
- To_StdULogicVector[NATURAL, NATURAL return STD_ULOGIC_VECTOR];
- alias To_SULV is
- To_StdULogicVector[NATURAL, NATURAL return STD_ULOGIC_VECTOR];
- alias To_Std_ULogic_Vector is
- To_StdULogicVector[NATURAL, STD_ULOGIC_VECTOR return STD_ULOGIC_VECTOR];
- alias To_SULV is
- To_StdULogicVector[NATURAL, STD_ULOGIC_VECTOR return STD_ULOGIC_VECTOR];
-
--- end LCS-2006-130
- --============================================================================
- -- Translation Functions
- --============================================================================
-
- -- Id: T.1
- function TO_01 (S : STD_ULOGIC_VECTOR; XMAP : STD_ULOGIC := '0')
- return STD_ULOGIC_VECTOR;
- -- Result subtype: STD_ULOGIC_VECTOR(S'RANGE)
- -- Result: Termwise, 'H' is translated to '1', and 'L' is translated
- -- to '0'. If a value other than '0'|'1'|'H'|'L' is found,
- -- the array is set to (others => XMAP), and a warning is
- -- issued.
--- begin LCS-2006-141
- -- Replace all subsequent occurrences of STD_LOGIC_VECTOR
- -- with STD_ULOGIC_ECTOR.
--- end LCS-2006-141
- -- Id: A.3
- function "+" (L, R : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
- -- Result subtype: STD_LOGIC_VECTOR(MAXIMUM(L'LENGTH, R'LENGTH)-1 downto 0).
- -- Result: Adds two UNSIGNED vectors that may be of different lengths.
-
- -- Id: A.3R
- function "+"(L : STD_LOGIC_VECTOR; R : STD_ULOGIC) return STD_LOGIC_VECTOR;
- -- Result subtype: STD_LOGIC_VECTOR(L'LENGTH-1 downto 0)
- -- Result: Similar to A.3 where R is a one bit STD_LOGIC_VECTOR
-
- -- Id: A.3L
- function "+"(L : STD_ULOGIC; R : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
- -- Result subtype: STD_LOGIC_VECTOR(R'LENGTH-1 downto 0)
- -- Result: Similar to A.3 where L is a one bit UNSIGNED
-
- -- Id: A.5
- function "+" (L : STD_LOGIC_VECTOR; R : NATURAL) return STD_LOGIC_VECTOR;
- -- Result subtype: STD_LOGIC_VECTOR(L'LENGTH-1 downto 0).
- -- Result: Adds an UNSIGNED vector, L, with a non-negative INTEGER, R.
-
- -- Id: A.6
- function "+" (L : NATURAL; R : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
- -- Result subtype: STD_LOGIC_VECTOR(R'LENGTH-1 downto 0).
- -- Result: Adds a non-negative INTEGER, L, with an UNSIGNED vector, R.
-
- --============================================================================
-
- -- Id: A.9
- function "-" (L, R : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
- -- Result subtype: UNSIGNED(MAXIMUM(L'LENGTH, R'LENGTH)-1 downto 0).
- -- Result: Subtracts two UNSIGNED vectors that may be of different lengths.
-
- -- Id: A.9R
- function "-"(L : STD_LOGIC_VECTOR; R : STD_ULOGIC) return STD_LOGIC_VECTOR;
- -- Result subtype: STD_LOGIC_VECTOR(L'LENGTH-1 downto 0)
- -- Result: Similar to A.9 where R is a one bit UNSIGNED
-
- -- Id: A.9L
- function "-"(L : STD_ULOGIC; R : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
- -- Result subtype: STD_LOGIC_VECTOR(R'LENGTH-1 downto 0)
- -- Result: Similar to A.9 where L is a one bit UNSIGNED
-
- -- Id: A.11
- function "-" (L : STD_LOGIC_VECTOR; R : NATURAL) return STD_LOGIC_VECTOR;
- -- Result subtype: STD_LOGIC_VECTOR(L'LENGTH-1 downto 0).
- -- Result: Subtracts a non-negative INTEGER, R, from an UNSIGNED vector, L.
-
- -- Id: A.12
- function "-" (L : NATURAL; R : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
- -- Result subtype: STD_LOGIC_VECTOR(R'LENGTH-1 downto 0).
- -- Result: Subtracts an UNSIGNED vector, R, from a non-negative INTEGER, L.
-
- --============================================================================
-
- -- Id: A.15
- function "*" (L, R : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
- -- Result subtype: STD_LOGIC_VECTOR((L'LENGTH+R'LENGTH-1) downto 0).
- -- Result: Performs the multiplication operation on two UNSIGNED vectors
- -- that may possibly be of different lengths.
-
- -- Id: A.17
- function "*" (L : STD_LOGIC_VECTOR; R : NATURAL) return STD_LOGIC_VECTOR;
- -- Result subtype: STD_LOGIC_VECTOR((L'LENGTH+L'LENGTH-1) downto 0).
- -- Result: Multiplies an UNSIGNED vector, L, with a non-negative
- -- INTEGER, R. R is converted to an UNSIGNED vector of
- -- SIZE L'LENGTH before multiplication.
-
- -- Id: A.18
- function "*" (L : NATURAL; R : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
- -- Result subtype: STD_LOGIC_VECTOR((R'LENGTH+R'LENGTH-1) downto 0).
- -- Result: Multiplies an UNSIGNED vector, R, with a non-negative
- -- INTEGER, L. L is converted to an UNSIGNED vector of
- -- SIZE R'LENGTH before multiplication.
-
- --============================================================================
- --
- -- NOTE: If second argument is zero for "/" operator, a severity level
- -- of ERROR is issued.
-
- -- Id: A.21
- function "/" (L, R : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
- -- Result subtype: STD_LOGIC_VECTOR(L'LENGTH-1 downto 0)
- -- Result: Divides an UNSIGNED vector, L, by another UNSIGNED vector, R.
-
- -- Id: A.23
- function "/" (L : STD_LOGIC_VECTOR; R : NATURAL) return STD_LOGIC_VECTOR;
- -- Result subtype: STD_LOGIC_VECTOR(L'LENGTH-1 downto 0)
- -- Result: Divides an UNSIGNED vector, L, by a non-negative INTEGER, R.
- -- If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH.
-
- -- Id: A.24
- function "/" (L : NATURAL; R : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
- -- Result subtype: STD_LOGIC_VECTOR(R'LENGTH-1 downto 0)
- -- Result: Divides a non-negative INTEGER, L, by an UNSIGNED vector, R.
- -- If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH.
-
- --============================================================================
- --
- -- NOTE: If second argument is zero for "rem" operator, a severity level
- -- of ERROR is issued.
-
- -- Id: A.27
- function "rem" (L, R : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
- -- Result subtype: STD_LOGIC_VECTOR(R'LENGTH-1 downto 0)
- -- Result: Computes "L rem R" where L and R are UNSIGNED vectors.
-
- -- Id: A.29
- function "rem" (L : STD_LOGIC_VECTOR; R : NATURAL) return STD_LOGIC_VECTOR;
- -- Result subtype: STD_LOGIC_VECTOR(L'LENGTH-1 downto 0)
- -- Result: Computes "L rem R" where L is an UNSIGNED vector and R is a
- -- non-negative INTEGER.
- -- If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH.
-
- -- Id: A.30
- function "rem" (L : NATURAL; R : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
- -- Result subtype: STD_LOGIC_VECTOR(R'LENGTH-1 downto 0)
- -- Result: Computes "L rem R" where R is an UNSIGNED vector and L is a
- -- non-negative INTEGER.
- -- If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH.
-
- --============================================================================
- --
- -- NOTE: If second argument is zero for "mod" operator, a severity level
- -- of ERROR is issued.
-
- -- Id: A.33
- function "mod" (L, R : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
- -- Result subtype: STD_LOGIC_VECTOR(R'LENGTH-1 downto 0)
- -- Result: Computes "L mod R" where L and R are UNSIGNED vectors.
-
- -- Id: A.35
- function "mod" (L : STD_LOGIC_VECTOR; R : NATURAL) return STD_LOGIC_VECTOR;
- -- Result subtype: STD_LOGIC_VECTOR(L'LENGTH-1 downto 0)
- -- Result: Computes "L mod R" where L is an UNSIGNED vector and R
- -- is a non-negative INTEGER.
- -- If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH.
-
- -- Id: A.36
- function "mod" (L : NATURAL; R : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
- -- Result subtype: STD_LOGIC_VECTOR(R'LENGTH-1 downto 0)
- -- Result: Computes "L mod R" where R is an UNSIGNED vector and L
- -- is a non-negative INTEGER.
- -- If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH.
-
--- begin LCS-2006-129
- --============================================================================
- -- Id: A.39
- function find_leftmost (ARG : STD_LOGIC_VECTOR; Y : STD_ULOGIC) return INTEGER;
- -- Result subtype: INTEGER
- -- Result: Finds the leftmost occurrence of the value of Y in ARG.
- -- Returns the index of the occurrence if it exists, or -1 otherwise.
-
- -- Id: A.41
- function find_rightmost (ARG : STD_LOGIC_VECTOR; Y : STD_ULOGIC) return INTEGER;
- -- Result subtype: INTEGER
- -- Result: Finds the leftmost occurrence of the value of Y in ARG.
- -- Returns the index of the occurrence if it exists, or -1 otherwise.
-
--- end LCS-2006-129
- --============================================================================
- -- Comparison Operators
- --============================================================================
-
- -- Id: C.1
- function ">" (L, R : STD_LOGIC_VECTOR) return BOOLEAN;
- -- Result subtype: BOOLEAN
- -- Result: Computes "L > R" where L and R are UNSIGNED vectors possibly
- -- of different lengths.
-
- -- Id: C.3
- function ">" (L : NATURAL; R : STD_LOGIC_VECTOR) return BOOLEAN;
- -- Result subtype: BOOLEAN
- -- Result: Computes "L > R" where L is a non-negative INTEGER and
- -- R is an UNSIGNED vector.
-
- -- Id: C.5
- function ">" (L : STD_LOGIC_VECTOR; R : NATURAL) return BOOLEAN;
- -- Result subtype: BOOLEAN
- -- Result: Computes "L > R" where L is an UNSIGNED vector and
- -- R is a non-negative INTEGER.
-
- --============================================================================
-
- -- Id: C.7
- function "<" (L, R : STD_LOGIC_VECTOR) return BOOLEAN;
- -- Result subtype: BOOLEAN
- -- Result: Computes "L < R" where L and R are UNSIGNED vectors possibly
- -- of different lengths.
-
- -- Id: C.9
- function "<" (L : NATURAL; R : STD_LOGIC_VECTOR) return BOOLEAN;
- -- Result subtype: BOOLEAN
- -- Result: Computes "L < R" where L is a non-negative INTEGER and
- -- R is an UNSIGNED vector.
-
- -- Id: C.11
- function "<" (L : STD_LOGIC_VECTOR; R : NATURAL) return BOOLEAN;
- -- Result subtype: BOOLEAN
- -- Result: Computes "L < R" where L is an UNSIGNED vector and
- -- R is a non-negative INTEGER.
-
- --============================================================================
-
- -- Id: C.13
- function "<=" (L, R : STD_LOGIC_VECTOR) return BOOLEAN;
- -- Result subtype: BOOLEAN
- -- Result: Computes "L <= R" where L and R are UNSIGNED vectors possibly
- -- of different lengths.
-
- -- Id: C.15
- function "<=" (L : NATURAL; R : STD_LOGIC_VECTOR) return BOOLEAN;
- -- Result subtype: BOOLEAN
- -- Result: Computes "L <= R" where L is a non-negative INTEGER and
- -- R is an UNSIGNED vector.
-
- -- Id: C.17
- function "<=" (L : STD_LOGIC_VECTOR; R : NATURAL) return BOOLEAN;
- -- Result subtype: BOOLEAN
- -- Result: Computes "L <= R" where L is an UNSIGNED vector and
- -- R is a non-negative INTEGER.
-
- --============================================================================
-
- -- Id: C.19
- function ">=" (L, R : STD_LOGIC_VECTOR) return BOOLEAN;
- -- Result subtype: BOOLEAN
- -- Result: Computes "L >= R" where L and R are UNSIGNED vectors possibly
- -- of different lengths.
-
- -- Id: C.21
- function ">=" (L : NATURAL; R : STD_LOGIC_VECTOR) return BOOLEAN;
- -- Result subtype: BOOLEAN
- -- Result: Computes "L >= R" where L is a non-negative INTEGER and
- -- R is an UNSIGNED vector.
-
- -- Id: C.23
- function ">=" (L : STD_LOGIC_VECTOR; R : NATURAL) return BOOLEAN;
- -- Result subtype: BOOLEAN
- -- Result: Computes "L >= R" where L is an UNSIGNED vector and
- -- R is a non-negative INTEGER.
-
- --============================================================================
-
- -- Id: C.25
- function "=" (L, R : STD_LOGIC_VECTOR) return BOOLEAN;
- -- Result subtype: BOOLEAN
- -- Result: Computes "L = R" where L and R are UNSIGNED vectors possibly
- -- of different lengths.
-
- -- Id: C.27
- function "=" (L : NATURAL; R : STD_LOGIC_VECTOR) return BOOLEAN;
- -- Result subtype: BOOLEAN
- -- Result: Computes "L = R" where L is a non-negative INTEGER and
- -- R is an UNSIGNED vector.
-
- -- Id: C.29
- function "=" (L : STD_LOGIC_VECTOR; R : NATURAL) return BOOLEAN;
- -- Result subtype: BOOLEAN
- -- Result: Computes "L = R" where L is an UNSIGNED vector and
- -- R is a non-negative INTEGER.
-
- --============================================================================
-
- -- Id: C.31
- function "/=" (L, R : STD_LOGIC_VECTOR) return BOOLEAN;
- -- Result subtype: BOOLEAN
- -- Result: Computes "L /= R" where L and R are UNSIGNED vectors possibly
- -- of different lengths.
-
- -- Id: C.33
- function "/=" (L : NATURAL; R : STD_LOGIC_VECTOR) return BOOLEAN;
- -- Result subtype: BOOLEAN
- -- Result: Computes "L /= R" where L is a non-negative INTEGER and
- -- R is an UNSIGNED vector.
-
- -- Id: C.35
- function "/=" (L : STD_LOGIC_VECTOR; R : NATURAL) return BOOLEAN;
- -- Result subtype: BOOLEAN
- -- Result: Computes "L /= R" where L is an UNSIGNED vector and
- -- R is a non-negative INTEGER.
-
- --============================================================================
-
- -- Id: C.37
- function MINIMUM (L, R : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
- -- Result subtype: STD_LOGIC_VECTOR
- -- Result: Returns the lesser of two UNSIGNED vectors that may be
- -- of different lengths.
-
- -- Id: C.39
- function MINIMUM (L : NATURAL; R : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
- -- Result subtype: STD_LOGIC_VECTOR
- -- Result: Returns the lesser of a nonnegative INTEGER, L, and
- -- an UNSIGNED vector, R.
-
- -- Id: C.41
- function MINIMUM (L : STD_LOGIC_VECTOR; R : NATURAL) return STD_LOGIC_VECTOR;
- -- Result subtype: STD_LOGIC_VECTOR
- -- Result: Returns the lesser of an UNSIGNED vector, L, and
- -- a nonnegative INTEGER, R.
-
- --============================================================================
-
- -- Id: C.43
- function MAXIMUM (L, R : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
- -- Result subtype: STD_LOGIC_VECTOR
- -- Result: Returns the greater of two UNSIGNED vectors that may be
- -- of different lengths.
-
- -- Id: C.45
- function MAXIMUM (L : NATURAL; R : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
- -- Result subtype: STD_LOGIC_VECTOR
- -- Result: Returns the greater of a nonnegative INTEGER, L, and
- -- an UNSIGNED vector, R.
-
- -- Id: C.47
- function MAXIMUM (L : STD_LOGIC_VECTOR; R : NATURAL) return STD_LOGIC_VECTOR;
- -- Result subtype: STD_LOGIC_VECTOR
- -- Result: Returns the greater of an UNSIGNED vector, L, and
- -- a nonnegative INTEGER, R.
-
- --============================================================================
- -- Id: C.49
- function \?>\ (L, R : STD_LOGIC_VECTOR) return STD_ULOGIC;
- -- Result subtype: STD_ULOGIC
- -- Result: Computes "L > R" where L and R are UNSIGNED vectors possibly
- -- of different lengths.
-
- -- Id: C.51
- function \?>\ (L : NATURAL; R : STD_LOGIC_VECTOR) return STD_ULOGIC;
- -- Result subtype: STD_ULOGIC
- -- Result: Computes "L > R" where L is a nonnegative INTEGER and
- -- R is an UNSIGNED vector.
-
- -- Id: C.53
- function \?>\ (L : STD_LOGIC_VECTOR; R : NATURAL) return STD_ULOGIC;
- -- Result subtype: STD_ULOGIC
- -- Result: Computes "L > R" where L is an UNSIGNED vector and
- -- R is a nonnegative INTEGER.
-
- --============================================================================
-
- -- Id: C.55
- function \?<\ (L, R : STD_LOGIC_VECTOR) return STD_ULOGIC;
- -- Result subtype: STD_ULOGIC
- -- Result: Computes "L < R" where L and R are UNSIGNED vectors possibly
- -- of different lengths.
-
- -- Id: C.57
- function \?<\ (L : NATURAL; R : STD_LOGIC_VECTOR) return STD_ULOGIC;
- -- Result subtype: STD_ULOGIC
- -- Result: Computes "L < R" where L is a nonnegative INTEGER and
- -- R is an UNSIGNED vector.
-
- -- Id: C.59
- function \?<\ (L : STD_LOGIC_VECTOR; R : NATURAL) return STD_ULOGIC;
- -- Result subtype: STD_ULOGIC
- -- Result: Computes "L < R" where L is an UNSIGNED vector and
- -- R is a nonnegative INTEGER.
-
- --============================================================================
-
- -- Id: C.61
- function \?<=\ (L, R : STD_LOGIC_VECTOR) return STD_ULOGIC;
- -- Result subtype: STD_ULOGIC
- -- Result: Computes "L <= R" where L and R are UNSIGNED vectors possibly
- -- of different lengths.
-
- -- Id: C.63
- function \?<=\ (L : NATURAL; R : STD_LOGIC_VECTOR) return STD_ULOGIC;
- -- Result subtype: STD_ULOGIC
- -- Result: Computes "L <= R" where L is a nonnegative INTEGER and
- -- R is an UNSIGNED vector.
-
- -- Id: C.65
- function \?<=\ (L : STD_LOGIC_VECTOR; R : NATURAL) return STD_ULOGIC;
- -- Result subtype: STD_ULOGIC
- -- Result: Computes "L <= R" where L is an UNSIGNED vector and
- -- R is a nonnegative INTEGER.
-
- --============================================================================
-
- -- Id: C.67
- function \?>=\ (L, R : STD_LOGIC_VECTOR) return STD_ULOGIC;
- -- Result subtype: STD_ULOGIC
- -- Result: Computes "L >= R" where L and R are UNSIGNED vectors possibly
- -- of different lengths.
-
- -- Id: C.69
- function \?>=\ (L : NATURAL; R : STD_LOGIC_VECTOR) return STD_ULOGIC;
- -- Result subtype: STD_ULOGIC
- -- Result: Computes "L >= R" where L is a nonnegative INTEGER and
- -- R is an UNSIGNED vector.
-
- -- Id: C.71
- function \?>=\ (L : STD_LOGIC_VECTOR; R : NATURAL) return STD_ULOGIC;
- -- Result subtype: STD_ULOGIC
- -- Result: Computes "L >= R" where L is an UNSIGNED vector and
- -- R is a nonnegative INTEGER.
-
- --============================================================================
-
- -- Id: C.73
--- function \?=\ (L, R : STD_LOGIC_VECTOR) return STD_ULOGIC;
- -- Result subtype: STD_ULOGIC
- -- Result: Computes "L = R" where L and R are UNSIGNED vectors possibly
- -- of different lengths.
-
- -- Id: C.75
--- function \?=\ (L : NATURAL; R : STD_LOGIC_VECTOR) return STD_ULOGIC;
- -- Result subtype: STD_ULOGIC
- -- Result: Computes "L = R" where L is a nonnegative INTEGER and
- -- R is an UNSIGNED vector.
-
- -- Id: C.77
--- function \?=\ (L : STD_LOGIC_VECTOR; R : NATURAL) return STD_ULOGIC;
- -- Result subtype: STD_ULOGIC
- -- Result: Computes "L = R" where L is an UNSIGNED vector and
- -- R is a nonnegative INTEGER.
-
- --============================================================================
-
- -- Id: C.79
--- function \?/=\ (L, R : STD_LOGIC_VECTOR) return STD_ULOGIC;
- -- Result subtype: STD_ULOGIC
- -- Result: Computes "L /= R" where L and R are UNSIGNED vectors possibly
- -- of different lengths.
-
- -- Id: C.81
--- function \?/=\ (L : NATURAL; R : STD_LOGIC_VECTOR) return STD_ULOGIC;
- -- Result subtype: STD_ULOGIC
- -- Result: Computes "L /= R" where L is a nonnegative INTEGER and
- -- R is an UNSIGNED vector.
-
- -- Id: C.83
--- function \?/=\ (L : STD_LOGIC_VECTOR; R : NATURAL) return STD_ULOGIC;
- -- Result subtype: STD_ULOGIC
- -- Result: Computes "L /= R" where L is an UNSIGNED vector and
- -- R is a nonnegative INTEGER.
-
- --============================================================================
- -- Shift and Rotate Functions
- --============================================================================
-
- -- Id: S.1
- function SHIFT_LEFT (ARG : STD_LOGIC_VECTOR; COUNT : NATURAL)
- return STD_LOGIC_VECTOR;
- -- Result subtype: STD_LOGIC_VECTOR(ARG'LENGTH-1 downto 0)
- -- Result: Performs a shift-left on an UNSIGNED vector COUNT times.
- -- The vacated positions are filled with '0'.
- -- The COUNT leftmost elements are lost.
-
- -- Id: S.2
- function SHIFT_RIGHT (ARG : STD_LOGIC_VECTOR; COUNT : NATURAL)
- return STD_LOGIC_VECTOR;
- -- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0)
- -- Result: Performs a shift-right on an UNSIGNED vector COUNT times.
- -- The vacated positions are filled with '0'.
- -- The COUNT rightmost elements are lost.
- --============================================================================
-
- -- Id: S.5
- function ROTATE_LEFT (ARG : STD_LOGIC_VECTOR; COUNT : NATURAL)
- return STD_LOGIC_VECTOR;
- -- Result subtype: STD_LOGIC_VECTOR(ARG'LENGTH-1 downto 0)
- -- Result: Performs a rotate-left of an UNSIGNED vector COUNT times.
-
- -- Id: S.6
- function ROTATE_RIGHT (ARG : STD_LOGIC_VECTOR; COUNT : NATURAL)
- return STD_LOGIC_VECTOR;
- -- Result subtype: STD_LOGIC_VECTOR(ARG'LENGTH-1 downto 0)
- -- Result: Performs a rotate-right of an UNSIGNED vector COUNT times.
-
- ------------------------------------------------------------------------------
- -- Note: Function S.17 is not compatible with IEEE Std 1076-1987. Comment
- -- out the function (declaration and body) for IEEE Std 1076-1987 compatibility.
- ------------------------------------------------------------------------------
- -- Id: S.17
- function "sla" (ARG : STD_LOGIC_VECTOR; COUNT : INTEGER) return STD_LOGIC_VECTOR;
- -- Result subtype: STD_LOGIC_VECTOR(ARG'LENGTH-1 downto 0)
- -- Result: SHIFT_LEFT(ARG, COUNT)
-
- ------------------------------------------------------------------------------
- -- Note: Function S.19 is not compatible with IEEE Std 1076-1987. Comment
- -- out the function (declaration and body) for IEEE Std 1076-1987 compatibility.
- ------------------------------------------------------------------------------
- -- Id: S.19
- function "sra" (ARG : STD_LOGIC_VECTOR; COUNT : INTEGER) return STD_LOGIC_VECTOR;
- -- Result subtype: STD_LOGIC_VECTOR(ARG'LENGTH-1 downto 0)
- -- Result: SHIFT_RIGHT(ARG, COUNT)
-
-
- --============================================================================
- -- RESIZE Functions
- --============================================================================
-
- -- Id: R.2
- function RESIZE (ARG : STD_LOGIC_VECTOR; NEW_SIZE : NATURAL)
- return STD_LOGIC_VECTOR;
- -- Result subtype: STD_LOGIC_VECTOR(NEW_SIZE-1 downto 0)
- -- Result: Resizes the UNSIGNED vector ARG to the specified size.
- -- To create a larger vector, the new [leftmost] bit positions
- -- are filled with '0'. When truncating, the leftmost bits
- -- are dropped.
-
- -- size_res versions of these functions (Bugzilla 165)
- function RESIZE (ARG, SIZE_RES : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
- -- Result subtype: STD_ULOGIC_VECTOR (SIZE_RES'length-1 downto 0)
- --============================================================================
- -- Conversion Functions
- --============================================================================
-
- -- Id: D.1
- function TO_INTEGER (ARG : STD_LOGIC_VECTOR) return NATURAL;
- -- Result subtype: NATURAL. Value cannot be negative since parameter is an
- -- UNSIGNED vector.
- -- Result: Converts the UNSIGNED vector to an INTEGER.
-
--- end LCS-2006-130
-
- --============================================================================
- -- Translation Functions
- --============================================================================
-
- -- Id: T.1
- function TO_01 (S : STD_LOGIC_VECTOR; XMAP : STD_ULOGIC := '0')
- return STD_LOGIC_VECTOR;
- -- Result subtype: STD_LOGIC_VECTOR(S'RANGE)
- -- Result: Termwise, 'H' is translated to '1', and 'L' is translated
- -- to '0'. If a value other than '0'|'1'|'H'|'L' is found,
- -- the array is set to (others => XMAP), and a warning is
- -- issued.
-end package NUMERIC_STD_UNSIGNED;
--------------------------------------------------------------------------------
--- Proposed package body for the VHDL-200x-FT NUMERIC_STD_UNSIGNED package
--- This package body supplies a recommended implementation of these functions
--- Version: $Revision: 1.4 $
--- Date: $Date: 2009/08/26 19:56:30 $
---
--- Created for VHDL-200X par, David Bishop (dbishop@vhdl.org)
--------------------------------------------------------------------------------
-library ieee;
-use ieee.numeric_std.all;
-use work.numeric_std_additions.all;
-
-package body NUMERIC_STD_UNSIGNED is
-
- -- Id: A.3
- function "+" (L, R : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR is
- begin
- return STD_ULOGIC_VECTOR (UNSIGNED(L) + UNSIGNED(R));
- end function "+";
-
- -- Id: A.3R
- function "+"(L : STD_ULOGIC_VECTOR; R : STD_ULOGIC) return STD_ULOGIC_VECTOR is
- begin
- return STD_ULOGIC_VECTOR (UNSIGNED(L) + R);
- end function "+";
-
- -- Id: A.3L
- function "+"(L : STD_ULOGIC; R : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR is
- begin
- return STD_ULOGIC_VECTOR (L + UNSIGNED(R));
- end function "+";
-
- -- Id: A.5
- function "+" (L : STD_ULOGIC_VECTOR; R : NATURAL) return STD_ULOGIC_VECTOR is
- begin
- return STD_ULOGIC_VECTOR (UNSIGNED(L) + R);
- end function "+";
-
- -- Id: A.6
- function "+" (L : NATURAL; R : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR is
- begin
- return STD_ULOGIC_VECTOR (L + UNSIGNED(R));
- end function "+";
-
- --============================================================================
-
- -- Id: A.9
- function "-" (L, R : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR is
- begin
- return STD_ULOGIC_VECTOR (UNSIGNED(L) - UNSIGNED(R));
- end function "-";
-
- -- Id: A.9R
- function "-"(L : STD_ULOGIC_VECTOR; R : STD_ULOGIC) return STD_ULOGIC_VECTOR is
- begin
- return STD_ULOGIC_VECTOR (UNSIGNED(L) - R);
- end function "-";
-
- -- Id: A.9L
- function "-"(L : STD_ULOGIC; R : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR is
- begin
- return STD_ULOGIC_VECTOR (L - UNSIGNED(R));
- end function "-";
-
- -- Id: A.11
- function "-" (L : STD_ULOGIC_VECTOR; R : NATURAL) return STD_ULOGIC_VECTOR is
- begin
- return STD_ULOGIC_VECTOR (UNSIGNED(L) - R);
- end function "-";
-
- -- Id: A.12
- function "-" (L : NATURAL; R : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR is
- begin
- return STD_ULOGIC_VECTOR (L - UNSIGNED(R));
- end function "-";
-
- --============================================================================
-
- -- Id: A.15
- function "*" (L, R : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR is
- begin
- return STD_ULOGIC_VECTOR (UNSIGNED(L) * UNSIGNED(R));
- end function "*";
-
- -- Id: A.17
- function "*" (L : STD_ULOGIC_VECTOR; R : NATURAL) return STD_ULOGIC_VECTOR is
- begin
- return STD_ULOGIC_VECTOR (UNSIGNED(L) * R);
- end function "*";
-
- -- Id: A.18
- function "*" (L : NATURAL; R : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR is
- begin
- return STD_ULOGIC_VECTOR (L * UNSIGNED(R));
- end function "*";
-
- --============================================================================
-
- -- Id: A.21
- function "/" (L, R : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR is
- begin
- return STD_ULOGIC_VECTOR (UNSIGNED(L) / UNSIGNED(R));
- end function "/";
-
- -- Id: A.23
- function "/" (L : STD_ULOGIC_VECTOR; R : NATURAL) return STD_ULOGIC_VECTOR is
- begin
- return STD_ULOGIC_VECTOR (UNSIGNED(L) / R);
- end function "/";
-
- -- Id: A.24
- function "/" (L : NATURAL; R : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR is
- begin
- return STD_ULOGIC_VECTOR (L / UNSIGNED(R));
- end function "/";
-
- --============================================================================
-
- -- Id: A.27
- function "rem" (L, R : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR is
- begin
- return STD_ULOGIC_VECTOR (UNSIGNED(L) rem UNSIGNED(R));
- end function "rem";
-
- -- Id: A.29
- function "rem" (L : STD_ULOGIC_VECTOR; R : NATURAL) return STD_ULOGIC_VECTOR is
- begin
- return STD_ULOGIC_VECTOR (UNSIGNED(L) rem R);
- end function "rem";
-
- -- Id: A.30
- function "rem" (L : NATURAL; R : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR is
- begin
- return STD_ULOGIC_VECTOR (L rem UNSIGNED(R));
- end function "rem";
-
- --============================================================================
-
- -- Id: A.33
- function "mod" (L, R : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR is
- begin
- return STD_ULOGIC_VECTOR (UNSIGNED(L) mod UNSIGNED(R));
- end function "mod";
-
- -- Id: A.35
- function "mod" (L : STD_ULOGIC_VECTOR; R : NATURAL) return STD_ULOGIC_VECTOR is
- begin
- return STD_ULOGIC_VECTOR (UNSIGNED(L) mod R);
- end function "mod";
-
- -- Id: A.36
- function "mod" (L : NATURAL; R : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR is
- begin
- return STD_ULOGIC_VECTOR (L mod UNSIGNED(R));
- end function "mod";
-
--- begin LCS-2006-129
- --============================================================================
- -- Id: A.39
- function find_leftmost (ARG: STD_ULOGIC_VECTOR; Y: STD_ULOGIC) return INTEGER is
- begin
- return find_leftmost(UNSIGNED(ARG), Y);
- end function find_leftmost;
-
- -- Id: A.41
- function find_rightmost (ARG: STD_ULOGIC_VECTOR; Y: STD_ULOGIC) return INTEGER is
- begin
- return find_rightmost(UNSIGNED(ARG), Y);
- end function find_rightmost;
-
--- end LCS-2006-129
- --============================================================================
-
- -- Id: C.1
- function ">" (L, R : STD_ULOGIC_VECTOR) return BOOLEAN is
- begin
- return UNSIGNED(L) > UNSIGNED(R);
- end function ">";
-
- -- Id: C.3
- function ">" (L : NATURAL; R : STD_ULOGIC_VECTOR) return BOOLEAN is
- begin
- return L > UNSIGNED(R);
- end function ">";
-
- -- Id: C.5
- function ">" (L : STD_ULOGIC_VECTOR; R : NATURAL) return BOOLEAN is
- begin
- return UNSIGNED(L) > R;
- end function ">";
-
- --============================================================================
-
- -- Id: C.7
- function "<" (L, R : STD_ULOGIC_VECTOR) return BOOLEAN is
- begin
- return UNSIGNED(L) < UNSIGNED(R);
- end function "<";
-
- -- Id: C.9
- function "<" (L : NATURAL; R : STD_ULOGIC_VECTOR) return BOOLEAN is
- begin
- return L < UNSIGNED(R);
- end function "<";
-
- -- Id: C.11
- function "<" (L : STD_ULOGIC_VECTOR; R : NATURAL) return BOOLEAN is
- begin
- return UNSIGNED(L) < R;
- end function "<";
-
- --============================================================================
-
- -- Id: C.13
- function "<=" (L, R : STD_ULOGIC_VECTOR) return BOOLEAN is
- begin
- return UNSIGNED(L) <= UNSIGNED(R);
- end function "<=";
-
- -- Id: C.15
- function "<=" (L : NATURAL; R : STD_ULOGIC_VECTOR) return BOOLEAN is
- begin
- return L <= UNSIGNED(R);
- end function "<=";
-
- -- Id: C.17
- function "<=" (L : STD_ULOGIC_VECTOR; R : NATURAL) return BOOLEAN is
- begin
- return UNSIGNED(L) <= R;
- end function "<=";
-
- --============================================================================
-
- -- Id: C.19
- function ">=" (L, R : STD_ULOGIC_VECTOR) return BOOLEAN is
- begin
- return UNSIGNED(L) >= UNSIGNED(R);
- end function ">=";
-
- -- Id: C.21
- function ">=" (L : NATURAL; R : STD_ULOGIC_VECTOR) return BOOLEAN is
- begin
- return L >= UNSIGNED(R);
- end function ">=";
-
- -- Id: C.23
- function ">=" (L : STD_ULOGIC_VECTOR; R : NATURAL) return BOOLEAN is
- begin
- return UNSIGNED(L) >= R;
- end function ">=";
-
- --============================================================================
-
- -- Id: C.25
- function "=" (L, R : STD_ULOGIC_VECTOR) return BOOLEAN is
- begin
- return UNSIGNED(L) = UNSIGNED(R);
- end function "=";
-
- -- Id: C.27
- function "=" (L : NATURAL; R : STD_ULOGIC_VECTOR) return BOOLEAN is
- begin
- return L = UNSIGNED(R);
- end function "=";
-
- -- Id: C.29
- function "=" (L : STD_ULOGIC_VECTOR; R : NATURAL) return BOOLEAN is
- begin
- return UNSIGNED(L) = R;
- end function "=";
-
- --============================================================================
-
- -- Id: C.31
- function "/=" (L, R : STD_ULOGIC_VECTOR) return BOOLEAN is
- begin
- return UNSIGNED(L) /= UNSIGNED(R);
- end function "/=";
-
- -- Id: C.33
- function "/=" (L : NATURAL; R : STD_ULOGIC_VECTOR) return BOOLEAN is
- begin
- return L /= UNSIGNED(R);
- end function "/=";
-
- -- Id: C.35
- function "/=" (L : STD_ULOGIC_VECTOR; R : NATURAL) return BOOLEAN is
- begin
- return UNSIGNED(L) /= R;
- end function "/=";
-
- --============================================================================
-
- -- Id: C.37
- function MINIMUM (L, R: STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR is
- begin
- return STD_ULOGIC_VECTOR (MINIMUM(UNSIGNED(L), UNSIGNED(R)));
- end function MINIMUM;
-
- -- Id: C.39
- function MINIMUM (L: NATURAL; R: STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR is
- begin
- return STD_ULOGIC_VECTOR (MINIMUM(L, UNSIGNED(R)));
- end function MINIMUM;
-
- -- Id: C.41
- function MINIMUM (L: STD_ULOGIC_VECTOR; R: NATURAL) return STD_ULOGIC_VECTOR is
- begin
- return STD_ULOGIC_VECTOR (MINIMUM(UNSIGNED(L), R));
- end function MINIMUM;
-
- --============================================================================
- -- Id: C.43
- function MAXIMUM (L, R: STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR is
- begin
- return STD_ULOGIC_VECTOR (MAXIMUM(UNSIGNED(L), UNSIGNED(R)));
- end function MAXIMUM;
-
- -- Id: C.45
- function MAXIMUM (L: NATURAL; R: STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR is
- begin
- return STD_ULOGIC_VECTOR (MAXIMUM(L, UNSIGNED(R)));
- end function MAXIMUM;
-
- -- Id: C.47
- function MAXIMUM (L: STD_ULOGIC_VECTOR; R: NATURAL) return STD_ULOGIC_VECTOR is
- begin
- return STD_ULOGIC_VECTOR (MAXIMUM(UNSIGNED(L), R));
- end function MAXIMUM;
-
- --============================================================================
-
- -- Id: C.49
- function \?>\ (L, R: STD_ULOGIC_VECTOR) return STD_ULOGIC is
- begin
- return \?>\ (UNSIGNED(L), UNSIGNED(R));
- end function \?>\;
-
- -- Id: C.51
- function \?>\ (L: NATURAL; R: STD_ULOGIC_VECTOR) return STD_ULOGIC is
- begin
- return \?>\ (L, UNSIGNED(R));
- end function \?>\;
-
- -- Id: C.53
- function \?>\ (L: STD_ULOGIC_VECTOR; R: NATURAL) return STD_ULOGIC is
- begin
- return \?>\ (UNSIGNED(L), R);
- end function \?>\;
-
- --============================================================================
-
- -- Id: C.55
- function \?<\ (L, R: STD_ULOGIC_VECTOR) return STD_ULOGIC is
- begin
- return \?<\ (UNSIGNED(L), UNSIGNED(R));
- end function \?<\;
-
- -- Id: C.57
- function \?<\ (L: NATURAL; R: STD_ULOGIC_VECTOR) return STD_ULOGIC is
- begin
- return \?<\ (L, UNSIGNED(R));
- end function \?<\;
-
- -- Id: C.59
- function \?<\ (L: STD_ULOGIC_VECTOR; R: NATURAL) return STD_ULOGIC is
- begin
- return \?<\ (UNSIGNED(L), R);
- end function \?<\;
-
- --============================================================================
-
- -- Id: C.61
- function \?<=\ (L, R: STD_ULOGIC_VECTOR) return STD_ULOGIC is
- begin
- return \?<=\ (UNSIGNED(L), UNSIGNED(R));
- end function \?<=\;
-
- -- Id: C.63
- function \?<=\ (L: NATURAL; R: STD_ULOGIC_VECTOR) return STD_ULOGIC is
- begin
- return \?<=\ (L, UNSIGNED(R));
- end function \?<=\;
-
- -- Id: C.65
- function \?<=\ (L: STD_ULOGIC_VECTOR; R: NATURAL) return STD_ULOGIC is
- begin
- return \?<=\ (UNSIGNED(L), R);
- end function \?<=\;
-
- --============================================================================
-
- -- Id: C.67
- function \?>=\ (L, R: STD_ULOGIC_VECTOR) return STD_ULOGIC is
- begin
- return \?>=\ (UNSIGNED(L), UNSIGNED(R));
- end function \?>=\;
-
- -- Id: C.69
- function \?>=\ (L: NATURAL; R: STD_ULOGIC_VECTOR) return STD_ULOGIC is
- begin
- return \?>=\ (L, UNSIGNED(R));
- end function \?>=\;
-
- -- Id: C.71
- function \?>=\ (L: STD_ULOGIC_VECTOR; R: NATURAL) return STD_ULOGIC is
- begin
- return \?>=\ (UNSIGNED(L), R);
- end function \?>=\;
-
- --============================================================================
-
- -- Id: C.73
--- function \?=\ (L, R: STD_ULOGIC_VECTOR) return STD_ULOGIC is
--- begin
--- return \?=\ (UNSIGNED(L), UNSIGNED(R));
--- end function \?=\;
-
--- -- Id: C.75
--- function \?=\ (L: NATURAL; R: STD_ULOGIC_VECTOR) return STD_ULOGIC is
--- begin
--- return \?=\ (L, UNSIGNED(R));
--- end function \?=\;
-
--- -- Id: C.77
--- function \?=\ (L: STD_ULOGIC_VECTOR; R: NATURAL) return STD_ULOGIC is
--- begin
--- return \?=\ (UNSIGNED(L), R);
--- end function \?=\;
-
--- --============================================================================
-
--- -- Id: C.79
--- function \?/=\ (L, R: STD_ULOGIC_VECTOR) return STD_ULOGIC is
--- begin
--- return \?/=\ (UNSIGNED(L), UNSIGNED(R));
--- end function \?/=\;
-
--- -- Id: C.81
--- function \?/=\ (L: NATURAL; R: STD_ULOGIC_VECTOR) return STD_ULOGIC is
--- begin
--- return \?/=\ (L, UNSIGNED(R));
--- end function \?/=\;
-
--- -- Id: C.83
--- function \?/=\ (L: STD_ULOGIC_VECTOR; R: NATURAL) return STD_ULOGIC is
--- begin
--- return \?/=\ (UNSIGNED(L), R);
--- end function \?/=\;
-
- --============================================================================
-
- -- Id: S.1
- function SHIFT_LEFT (ARG : STD_ULOGIC_VECTOR; COUNT : NATURAL) return STD_ULOGIC_VECTOR is
- begin
- return std_ulogic_vector (SHIFT_LEFT(unsigned(ARG), COUNT));
- end function SHIFT_LEFT;
-
- -- Id: S.2
- function SHIFT_RIGHT (ARG : STD_ULOGIC_VECTOR; COUNT : NATURAL) return STD_ULOGIC_VECTOR is
- begin
- return std_ulogic_vector (SHIFT_RIGHT(unsigned(ARG), COUNT));
- end function SHIFT_RIGHT;
-
- --============================================================================
-
- -- Id: S.5
- function ROTATE_LEFT (ARG : STD_ULOGIC_VECTOR; COUNT : NATURAL) return STD_ULOGIC_VECTOR is
- begin
- return std_ulogic_vector (ROTATE_LEFT(unsigned(ARG), COUNT));
- end function ROTATE_LEFT;
-
- -- Id: S.6
- function ROTATE_RIGHT (ARG : STD_ULOGIC_VECTOR; COUNT : NATURAL) return STD_ULOGIC_VECTOR is
- begin
- return std_ulogic_vector (ROTATE_RIGHT(unsigned(ARG), COUNT));
- end function ROTATE_RIGHT;
-
- --============================================================================
-
- -- Id: S.17
- function "sla" (ARG: STD_ULOGIC_VECTOR; COUNT: INTEGER) return STD_ULOGIC_VECTOR is
- begin
- return STD_ULOGIC_VECTOR (UNSIGNED(ARG) sla COUNT);
- end function "sla";
-
- -- Id: S.19
- function "sra" (ARG: STD_ULOGIC_VECTOR; COUNT: INTEGER) return STD_ULOGIC_VECTOR is
- begin
- return STD_ULOGIC_VECTOR (UNSIGNED(ARG) sra COUNT);
- end function "sra";
-
- --============================================================================
-
- -- Id: R.2
- function RESIZE (ARG : STD_ULOGIC_VECTOR; NEW_SIZE : NATURAL)
- return STD_ULOGIC_VECTOR is
- begin
- return STD_ULOGIC_VECTOR (
- RESIZE (ARG => UNSIGNED(ARG),
- NEW_SIZE => NEW_SIZE));
- end function RESIZE;
-
- function RESIZE (ARG, SIZE_RES : STD_ULOGIC_VECTOR)
- return STD_ULOGIC_VECTOR is
- begin
- return STD_ULOGIC_VECTOR (
- RESIZE (ARG => UNSIGNED(ARG),
- NEW_SIZE => SIZE_RES'length));
- end function RESIZE;
- --============================================================================
-
- -- Id: D.1
- function TO_INTEGER (ARG : STD_ULOGIC_VECTOR) return NATURAL is
- begin
- return TO_INTEGER(UNSIGNED(ARG));
- end function TO_INTEGER;
-
- -- Id: D.3
- function To_StdLogicVector (ARG, SIZE : NATURAL) return STD_LOGIC_VECTOR is
- begin
- return STD_LOGIC_VECTOR (TO_UNSIGNED(ARG => ARG,
- SIZE => SIZE));
- end function To_StdLogicVector;
-
- function To_StdLogicVector (ARG : NATURAL; SIZE_RES : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
- begin
- return STD_LOGIC_VECTOR (TO_UNSIGNED(ARG => ARG,
- SIZE => SIZE_RES'length));
- end function To_StdLogicVector;
- -- Id: D.5
- function To_StdULogicVector (ARG, SIZE : NATURAL) return STD_ULOGIC_VECTOR is
- begin
- return STD_ULOGIC_VECTOR (TO_UNSIGNED(ARG => ARG,
- SIZE => SIZE));
- end function To_StdULogicVector;
-
- function To_StdULogicVector (ARG : NATURAL; SIZE_RES : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR is
- begin
- return STD_ULOGIC_VECTOR (TO_UNSIGNED(ARG => ARG,
- SIZE => SIZE_RES'length));
- end function To_StdULogicVector;
- --============================================================================
-
- -- function TO_01 is used to convert vectors to the
- -- correct form for exported functions,
- -- and to report if there is an element which
- -- is not in (0, 1, H, L).
-
- -- Id: T.1
- function TO_01 (S : STD_ULOGIC_VECTOR; XMAP : STD_ULOGIC := '0')
- return STD_ULOGIC_VECTOR is
- begin
- return STD_ULOGIC_VECTOR (
- TO_01 (S => UNSIGNED(S),
- XMAP => XMAP));
- end function TO_01;
-
- -- Id: A.3
- function "+" (L, R : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
- begin
- return STD_LOGIC_VECTOR (UNSIGNED(L) + UNSIGNED(R));
- end function "+";
-
- -- Id: A.3R
- function "+"(L : STD_LOGIC_VECTOR; R : STD_ULOGIC) return STD_LOGIC_VECTOR is
- begin
- return STD_LOGIC_VECTOR (UNSIGNED(L) + R);
- end function "+";
-
- -- Id: A.3L
- function "+"(L : STD_ULOGIC; R : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
- begin
- return STD_LOGIC_VECTOR (L + UNSIGNED(R));
- end function "+";
-
- -- Id: A.5
- function "+" (L : STD_LOGIC_VECTOR; R : NATURAL) return STD_LOGIC_VECTOR is
- begin
- return STD_LOGIC_VECTOR (UNSIGNED(L) + R);
- end function "+";
-
- -- Id: A.6
- function "+" (L : NATURAL; R : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
- begin
- return STD_LOGIC_VECTOR (L + UNSIGNED(R));
- end function "+";
-
- --============================================================================
-
- -- Id: A.9
- function "-" (L, R : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
- begin
- return STD_LOGIC_VECTOR (UNSIGNED(L) - UNSIGNED(R));
- end function "-";
-
- -- Id: A.9R
- function "-"(L : STD_LOGIC_VECTOR; R : STD_ULOGIC) return STD_LOGIC_VECTOR is
- begin
- return STD_LOGIC_VECTOR (UNSIGNED(L) - R);
- end function "-";
-
- -- Id: A.9L
- function "-"(L : STD_ULOGIC; R : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
- begin
- return STD_LOGIC_VECTOR (L - UNSIGNED(R));
- end function "-";
-
- -- Id: A.11
- function "-" (L : STD_LOGIC_VECTOR; R : NATURAL) return STD_LOGIC_VECTOR is
- begin
- return STD_LOGIC_VECTOR (UNSIGNED(L) - R);
- end function "-";
-
- -- Id: A.12
- function "-" (L : NATURAL; R : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
- begin
- return STD_LOGIC_VECTOR (L - UNSIGNED(R));
- end function "-";
-
- --============================================================================
-
- -- Id: A.15
- function "*" (L, R : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
- begin
- return STD_LOGIC_VECTOR (UNSIGNED(L) * UNSIGNED(R));
- end function "*";
-
- -- Id: A.17
- function "*" (L : STD_LOGIC_VECTOR; R : NATURAL) return STD_LOGIC_VECTOR is
- begin
- return STD_LOGIC_VECTOR (UNSIGNED(L) * R);
- end function "*";
-
- -- Id: A.18
- function "*" (L : NATURAL; R : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
- begin
- return STD_LOGIC_VECTOR (L * UNSIGNED(R));
- end function "*";
-
- --============================================================================
-
- -- Id: A.21
- function "/" (L, R : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
- begin
- return STD_LOGIC_VECTOR (UNSIGNED(L) / UNSIGNED(R));
- end function "/";
-
- -- Id: A.23
- function "/" (L : STD_LOGIC_VECTOR; R : NATURAL) return STD_LOGIC_VECTOR is
- begin
- return STD_LOGIC_VECTOR (UNSIGNED(L) / R);
- end function "/";
-
- -- Id: A.24
- function "/" (L : NATURAL; R : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
- begin
- return STD_LOGIC_VECTOR (L / UNSIGNED(R));
- end function "/";
-
- --============================================================================
-
- -- Id: A.27
- function "rem" (L, R : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
- begin
- return STD_LOGIC_VECTOR (UNSIGNED(L) rem UNSIGNED(R));
- end function "rem";
-
- -- Id: A.29
- function "rem" (L : STD_LOGIC_VECTOR; R : NATURAL) return STD_LOGIC_VECTOR is
- begin
- return STD_LOGIC_VECTOR (UNSIGNED(L) rem R);
- end function "rem";
-
- -- Id: A.30
- function "rem" (L : NATURAL; R : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
- begin
- return STD_LOGIC_VECTOR (L rem UNSIGNED(R));
- end function "rem";
-
- --============================================================================
-
- -- Id: A.33
- function "mod" (L, R : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
- begin
- return STD_LOGIC_VECTOR (UNSIGNED(L) mod UNSIGNED(R));
- end function "mod";
-
- -- Id: A.35
- function "mod" (L : STD_LOGIC_VECTOR; R : NATURAL) return STD_LOGIC_VECTOR is
- begin
- return STD_LOGIC_VECTOR (UNSIGNED(L) mod R);
- end function "mod";
-
- -- Id: A.36
- function "mod" (L : NATURAL; R : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
- begin
- return STD_LOGIC_VECTOR (L mod UNSIGNED(R));
- end function "mod";
-
--- begin LCS-2006-129
- --============================================================================
- -- Id: A.39
- function find_leftmost (ARG: STD_LOGIC_VECTOR; Y: STD_ULOGIC) return INTEGER is
- begin
- return find_leftmost(UNSIGNED(ARG), Y);
- end function find_leftmost;
-
- -- Id: A.41
- function find_rightmost (ARG: STD_LOGIC_VECTOR; Y: STD_ULOGIC) return INTEGER is
- begin
- return find_rightmost(UNSIGNED(ARG), Y);
- end function find_rightmost;
-
--- end LCS-2006-129
- --============================================================================
-
- -- Id: C.1
- function ">" (L, R : STD_LOGIC_VECTOR) return BOOLEAN is
- begin
- return UNSIGNED(L) > UNSIGNED(R);
- end function ">";
-
- -- Id: C.3
- function ">" (L : NATURAL; R : STD_LOGIC_VECTOR) return BOOLEAN is
- begin
- return L > UNSIGNED(R);
- end function ">";
-
- -- Id: C.5
- function ">" (L : STD_LOGIC_VECTOR; R : NATURAL) return BOOLEAN is
- begin
- return UNSIGNED(L) > R;
- end function ">";
-
- --============================================================================
-
- -- Id: C.7
- function "<" (L, R : STD_LOGIC_VECTOR) return BOOLEAN is
- begin
- return UNSIGNED(L) < UNSIGNED(R);
- end function "<";
-
- -- Id: C.9
- function "<" (L : NATURAL; R : STD_LOGIC_VECTOR) return BOOLEAN is
- begin
- return L < UNSIGNED(R);
- end function "<";
-
- -- Id: C.11
- function "<" (L : STD_LOGIC_VECTOR; R : NATURAL) return BOOLEAN is
- begin
- return UNSIGNED(L) < R;
- end function "<";
-
- --============================================================================
-
- -- Id: C.13
- function "<=" (L, R : STD_LOGIC_VECTOR) return BOOLEAN is
- begin
- return UNSIGNED(L) <= UNSIGNED(R);
- end function "<=";
-
- -- Id: C.15
- function "<=" (L : NATURAL; R : STD_LOGIC_VECTOR) return BOOLEAN is
- begin
- return L <= UNSIGNED(R);
- end function "<=";
-
- -- Id: C.17
- function "<=" (L : STD_LOGIC_VECTOR; R : NATURAL) return BOOLEAN is
- begin
- return UNSIGNED(L) <= R;
- end function "<=";
-
- --============================================================================
-
- -- Id: C.19
- function ">=" (L, R : STD_LOGIC_VECTOR) return BOOLEAN is
- begin
- return UNSIGNED(L) >= UNSIGNED(R);
- end function ">=";
-
- -- Id: C.21
- function ">=" (L : NATURAL; R : STD_LOGIC_VECTOR) return BOOLEAN is
- begin
- return L >= UNSIGNED(R);
- end function ">=";
-
- -- Id: C.23
- function ">=" (L : STD_LOGIC_VECTOR; R : NATURAL) return BOOLEAN is
- begin
- return UNSIGNED(L) >= R;
- end function ">=";
-
- --============================================================================
-
- -- Id: C.25
- function "=" (L, R : STD_LOGIC_VECTOR) return BOOLEAN is
- begin
- return UNSIGNED(L) = UNSIGNED(R);
- end function "=";
-
- -- Id: C.27
- function "=" (L : NATURAL; R : STD_LOGIC_VECTOR) return BOOLEAN is
- begin
- return L = UNSIGNED(R);
- end function "=";
-
- -- Id: C.29
- function "=" (L : STD_LOGIC_VECTOR; R : NATURAL) return BOOLEAN is
- begin
- return UNSIGNED(L) = R;
- end function "=";
-
- --============================================================================
-
- -- Id: C.31
- function "/=" (L, R : STD_LOGIC_VECTOR) return BOOLEAN is
- begin
- return UNSIGNED(L) /= UNSIGNED(R);
- end function "/=";
-
- -- Id: C.33
- function "/=" (L : NATURAL; R : STD_LOGIC_VECTOR) return BOOLEAN is
- begin
- return L /= UNSIGNED(R);
- end function "/=";
-
- -- Id: C.35
- function "/=" (L : STD_LOGIC_VECTOR; R : NATURAL) return BOOLEAN is
- begin
- return UNSIGNED(L) /= R;
- end function "/=";
-
- --============================================================================
-
- -- Id: C.37
- function MINIMUM (L, R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
- begin
- return STD_LOGIC_VECTOR (MINIMUM(UNSIGNED(L), UNSIGNED(R)));
- end function MINIMUM;
-
- -- Id: C.39
- function MINIMUM (L: NATURAL; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
- begin
- return STD_LOGIC_VECTOR (MINIMUM(L, UNSIGNED(R)));
- end function MINIMUM;
-
- -- Id: C.41
- function MINIMUM (L: STD_LOGIC_VECTOR; R: NATURAL) return STD_LOGIC_VECTOR is
- begin
- return STD_LOGIC_VECTOR (MINIMUM(UNSIGNED(L), R));
- end function MINIMUM;
-
- --============================================================================
- -- Id: C.43
- function MAXIMUM (L, R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
- begin
- return STD_LOGIC_VECTOR (MAXIMUM(UNSIGNED(L), UNSIGNED(R)));
- end function MAXIMUM;
-
- -- Id: C.45
- function MAXIMUM (L: NATURAL; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
- begin
- return STD_LOGIC_VECTOR (MAXIMUM(L, UNSIGNED(R)));
- end function MAXIMUM;
-
- -- Id: C.47
- function MAXIMUM (L: STD_LOGIC_VECTOR; R: NATURAL) return STD_LOGIC_VECTOR is
- begin
- return STD_LOGIC_VECTOR (MAXIMUM(UNSIGNED(L), R));
- end function MAXIMUM;
-
- --============================================================================
-
- -- Id: C.49
- function \?>\ (L, R: STD_LOGIC_VECTOR) return STD_ULOGIC is
- begin
- return \?>\ (UNSIGNED(L), UNSIGNED(R));
- end function \?>\;
-
- -- Id: C.51
- function \?>\ (L: NATURAL; R: STD_LOGIC_VECTOR) return STD_ULOGIC is
- begin
- return \?>\ (L, UNSIGNED(R));
- end function \?>\;
-
- -- Id: C.53
- function \?>\ (L: STD_LOGIC_VECTOR; R: NATURAL) return STD_ULOGIC is
- begin
- return \?>\ (UNSIGNED(L), R);
- end function \?>\;
-
- --============================================================================
-
- -- Id: C.55
- function \?<\ (L, R: STD_LOGIC_VECTOR) return STD_ULOGIC is
- begin
- return \?<\ (UNSIGNED(L), UNSIGNED(R));
- end function \?<\;
-
- -- Id: C.57
- function \?<\ (L: NATURAL; R: STD_LOGIC_VECTOR) return STD_ULOGIC is
- begin
- return \?<\ (L, UNSIGNED(R));
- end function \?<\;
-
- -- Id: C.59
- function \?<\ (L: STD_LOGIC_VECTOR; R: NATURAL) return STD_ULOGIC is
- begin
- return \?<\ (UNSIGNED(L), R);
- end function \?<\;
-
- --============================================================================
-
- -- Id: C.61
- function \?<=\ (L, R: STD_LOGIC_VECTOR) return STD_ULOGIC is
- begin
- return \?<=\ (UNSIGNED(L), UNSIGNED(R));
- end function \?<=\;
-
- -- Id: C.63
- function \?<=\ (L: NATURAL; R: STD_LOGIC_VECTOR) return STD_ULOGIC is
- begin
- return \?<=\ (L, UNSIGNED(R));
- end function \?<=\;
-
- -- Id: C.65
- function \?<=\ (L: STD_LOGIC_VECTOR; R: NATURAL) return STD_ULOGIC is
- begin
- return \?<=\ (UNSIGNED(L), R);
- end function \?<=\;
-
- --============================================================================
-
- -- Id: C.67
- function \?>=\ (L, R: STD_LOGIC_VECTOR) return STD_ULOGIC is
- begin
- return \?>=\ (UNSIGNED(L), UNSIGNED(R));
- end function \?>=\;
-
- -- Id: C.69
- function \?>=\ (L: NATURAL; R: STD_LOGIC_VECTOR) return STD_ULOGIC is
- begin
- return \?>=\ (L, UNSIGNED(R));
- end function \?>=\;
-
- -- Id: C.71
- function \?>=\ (L: STD_LOGIC_VECTOR; R: NATURAL) return STD_ULOGIC is
- begin
- return \?>=\ (UNSIGNED(L), R);
- end function \?>=\;
-
- --============================================================================
-
- -- Id: C.73
--- function \?=\ (L, R: STD_LOGIC_VECTOR) return STD_ULOGIC is
--- begin
--- return \?=\ (UNSIGNED(L), UNSIGNED(R));
--- end function \?=\;
-
--- -- Id: C.75
--- function \?=\ (L: NATURAL; R: STD_LOGIC_VECTOR) return STD_ULOGIC is
--- begin
--- return \?=\ (L, UNSIGNED(R));
--- end function \?=\;
-
--- -- Id: C.77
--- function \?=\ (L: STD_LOGIC_VECTOR; R: NATURAL) return STD_ULOGIC is
--- begin
--- return \?=\ (UNSIGNED(L), R);
--- end function \?=\;
-
--- --============================================================================
-
--- -- Id: C.79
--- function \?/=\ (L, R: STD_LOGIC_VECTOR) return STD_ULOGIC is
--- begin
--- return \?/=\ (UNSIGNED(L), UNSIGNED(R));
--- end function \?/=\;
-
--- -- Id: C.81
--- function \?/=\ (L: NATURAL; R: STD_LOGIC_VECTOR) return STD_ULOGIC is
--- begin
--- return \?/=\ (L, UNSIGNED(R));
--- end function \?/=\;
-
--- -- Id: C.83
--- function \?/=\ (L: STD_LOGIC_VECTOR; R: NATURAL) return STD_ULOGIC is
--- begin
--- return \?/=\ (UNSIGNED(L), R);
--- end function \?/=\;
-
- --============================================================================
-
- -- Id: S.1
- function SHIFT_LEFT (ARG : STD_LOGIC_VECTOR; COUNT : NATURAL) return STD_LOGIC_VECTOR is
- begin
- return STD_LOGIC_VECTOR (SHIFT_LEFT(unsigned(ARG), COUNT));
- end function SHIFT_LEFT;
-
- -- Id: S.2
- function SHIFT_RIGHT (ARG : STD_LOGIC_VECTOR; COUNT : NATURAL) return STD_LOGIC_VECTOR is
- begin
- return STD_LOGIC_VECTOR (SHIFT_RIGHT(unsigned(ARG), COUNT));
- end function SHIFT_RIGHT;
-
- --============================================================================
-
- -- Id: S.5
- function ROTATE_LEFT (ARG : STD_LOGIC_VECTOR; COUNT : NATURAL) return STD_LOGIC_VECTOR is
- begin
- return STD_LOGIC_VECTOR (ROTATE_LEFT(unsigned(ARG), COUNT));
- end function ROTATE_LEFT;
-
- -- Id: S.6
- function ROTATE_RIGHT (ARG : STD_LOGIC_VECTOR; COUNT : NATURAL) return STD_LOGIC_VECTOR is
- begin
- return STD_LOGIC_VECTOR (ROTATE_RIGHT(unsigned(ARG), COUNT));
- end function ROTATE_RIGHT;
-
- --============================================================================
-
- -- Id: S.17
- function "sla" (ARG: STD_LOGIC_VECTOR; COUNT: INTEGER) return STD_LOGIC_VECTOR is
- begin
- return STD_LOGIC_VECTOR (UNSIGNED(ARG) sla COUNT);
- end function "sla";
-
- -- Id: S.19
- function "sra" (ARG: STD_LOGIC_VECTOR; COUNT: INTEGER) return STD_LOGIC_VECTOR is
- begin
- return STD_LOGIC_VECTOR (UNSIGNED(ARG) sra COUNT);
- end function "sra";
-
- --============================================================================
-
- -- Id: R.2
- function RESIZE (ARG : STD_LOGIC_VECTOR; NEW_SIZE : NATURAL)
- return STD_LOGIC_VECTOR is
- begin
- return STD_LOGIC_VECTOR (
- RESIZE (ARG => UNSIGNED(ARG),
- NEW_SIZE => NEW_SIZE));
- end function RESIZE;
-
- function RESIZE (ARG, SIZE_RES : STD_LOGIC_VECTOR)
- return STD_LOGIC_VECTOR is
- begin
- return STD_LOGIC_VECTOR (
- RESIZE (ARG => UNSIGNED(ARG),
- NEW_SIZE => SIZE_RES'length));
- end function RESIZE;
- --============================================================================
-
- -- Id: D.1
- function TO_INTEGER (ARG : STD_LOGIC_VECTOR) return NATURAL is
- begin
- return TO_INTEGER(UNSIGNED(ARG));
- end function TO_INTEGER;
-
- --============================================================================
-
- -- function TO_01 is used to convert vectors to the
- -- correct form for exported functions,
- -- and to report if there is an element which
- -- is not in (0, 1, H, L).
-
- -- Id: T.1
- function TO_01 (S : STD_LOGIC_VECTOR; XMAP : STD_ULOGIC := '0')
- return STD_LOGIC_VECTOR is
- begin
- return STD_LOGIC_VECTOR (
- TO_01 (S => UNSIGNED(S),
- XMAP => XMAP));
- end function TO_01;
-
-end package body NUMERIC_STD_UNSIGNED;
diff --git a/ieee_proposed/rtl/standard_additions_c.vhd b/ieee_proposed/rtl/standard_additions_c.vhd
deleted file mode 100644
index 97016af..0000000
--- a/ieee_proposed/rtl/standard_additions_c.vhd
+++ /dev/null
@@ -1,2073 +0,0 @@
-------------------------------------------------------------------------------
--- "standard_additions" package contains the additions to the built in
--- "standard.std" package. In the final version this package will be implicit.
--- Created for VHDL-200X par, David Bishop (dbishop@vhdl.org)
-------------------------------------------------------------------------------
-package standard_additions is
-
- function \?=\ (L, R : BOOLEAN) return BOOLEAN;
- function \?/=\ (L, R : BOOLEAN) return BOOLEAN;
- function \?<\ (L, R : BOOLEAN) return BOOLEAN;
- function \?<=\ (L, R : BOOLEAN) return BOOLEAN;
- function \?>\ (L, R : BOOLEAN) return BOOLEAN;
- function \?>=\ (L, R : BOOLEAN) return BOOLEAN;
-
- function MINIMUM (L, R : BOOLEAN) return BOOLEAN;
- function MAXIMUM (L, R : BOOLEAN) return BOOLEAN;
-
- function RISING_EDGE (signal S : BOOLEAN) return BOOLEAN;
- function FALLING_EDGE (signal S : BOOLEAN) return BOOLEAN;
-
- function \?=\ (L, R : BIT) return BIT;
- function \?/=\ (L, R : BIT) return BIT;
- function \?<\ (L, R : BIT) return BIT;
- function \?<=\ (L, R : BIT) return BIT;
- function \?>\ (L, R : BIT) return BIT;
- function \?>=\ (L, R : BIT) return BIT;
-
- function MINIMUM (L, R : BIT) return BIT;
- function MAXIMUM (L, R : BIT) return BIT;
-
- function \??\ (L : BIT) return BOOLEAN;
-
- function RISING_EDGE (signal S : BIT) return BOOLEAN;
- function FALLING_EDGE (signal S : BIT) return BOOLEAN;
-
- function MINIMUM (L, R : CHARACTER) return CHARACTER;
- function MAXIMUM (L, R : CHARACTER) return CHARACTER;
-
- function MINIMUM (L, R : SEVERITY_LEVEL) return SEVERITY_LEVEL;
- function MAXIMUM (L, R : SEVERITY_LEVEL) return SEVERITY_LEVEL;
-
- function MINIMUM (L, R : INTEGER) return INTEGER;
- function MAXIMUM (L, R : INTEGER) return INTEGER;
-
- function MINIMUM (L, R : REAL) return REAL;
- function MAXIMUM (L, R : REAL) return REAL;
-
- function "mod" (L, R : TIME) return TIME;
- function "rem" (L, R : TIME) return TIME;
-
- function MINIMUM (L, R : TIME) return TIME;
- function MAXIMUM (L, R : TIME) return TIME;
-
- function MINIMUM (L, R : STRING) return STRING;
- function MAXIMUM (L, R : STRING) return STRING;
-
- function MINIMUM (L : STRING) return CHARACTER;
- function MAXIMUM (L : STRING) return CHARACTER;
-
- type BOOLEAN_VECTOR is array (NATURAL range <>) of BOOLEAN;
-
- -- The predefined operations for this type are as follows:
-
- function "and" (L, R : BOOLEAN_VECTOR) return BOOLEAN_VECTOR;
- function "or" (L, R : BOOLEAN_VECTOR) return BOOLEAN_VECTOR;
- function "nand" (L, R : BOOLEAN_VECTOR) return BOOLEAN_VECTOR;
- function "nor" (L, R : BOOLEAN_VECTOR) return BOOLEAN_VECTOR;
- function "xor" (L, R : BOOLEAN_VECTOR) return BOOLEAN_VECTOR;
- function "xnor" (L, R : BOOLEAN_VECTOR) return BOOLEAN_VECTOR;
-
- function "not" (L : BOOLEAN_VECTOR) return BOOLEAN_VECTOR;
-
- function "and" (L : BOOLEAN_VECTOR; R : BOOLEAN)
- return BOOLEAN_VECTOR;
- function "and" (L : BOOLEAN; R : BOOLEAN_VECTOR)
- return BOOLEAN_VECTOR;
- function "or" (L : BOOLEAN_VECTOR; R : BOOLEAN)
- return BOOLEAN_VECTOR;
- function "or" (L : BOOLEAN; R : BOOLEAN_VECTOR)
- return BOOLEAN_VECTOR;
- function "nand" (L : BOOLEAN_VECTOR; R : BOOLEAN)
- return BOOLEAN_VECTOR;
- function "nand" (L : BOOLEAN; R : BOOLEAN_VECTOR)
- return BOOLEAN_VECTOR;
- function "nor" (L : BOOLEAN_VECTOR; R : BOOLEAN)
- return BOOLEAN_VECTOR;
- function "nor" (L : BOOLEAN; R : BOOLEAN_VECTOR)
- return BOOLEAN_VECTOR;
- function "xor" (L : BOOLEAN_VECTOR; R : BOOLEAN)
- return BOOLEAN_VECTOR;
- function "xor" (L : BOOLEAN; R : BOOLEAN_VECTOR)
- return BOOLEAN_VECTOR;
- function "xnor" (L : BOOLEAN_VECTOR; R : BOOLEAN)
- return BOOLEAN_VECTOR;
- function "xnor" (L : BOOLEAN; R : BOOLEAN_VECTOR)
- return BOOLEAN_VECTOR;
-
- function and_reduce (L : BOOLEAN_VECTOR) return BOOLEAN;
- function or_reduce (L : BOOLEAN_VECTOR) return BOOLEAN;
- function nand_reduce (L : BOOLEAN_VECTOR) return BOOLEAN;
- function nor_reduce (L : BOOLEAN_VECTOR) return BOOLEAN;
- function xor_reduce (L : BOOLEAN_VECTOR) return BOOLEAN;
- function xnor_reduce (L : BOOLEAN_VECTOR) return BOOLEAN;
-
- function "sll" (L : BOOLEAN_VECTOR; R : INTEGER)
- return BOOLEAN_VECTOR;
- function "srl" (L : BOOLEAN_VECTOR; R : INTEGER)
- return BOOLEAN_VECTOR;
- function "sla" (L : BOOLEAN_VECTOR; R : INTEGER)
- return BOOLEAN_VECTOR;
- function "sra" (L : BOOLEAN_VECTOR; R : INTEGER)
- return BOOLEAN_VECTOR;
- function "rol" (L : BOOLEAN_VECTOR; R : INTEGER)
- return BOOLEAN_VECTOR;
- function "ror" (L : BOOLEAN_VECTOR; R : INTEGER)
- return BOOLEAN_VECTOR;
-
--- function "=" (L, R : BOOLEAN_VECTOR) return BOOLEAN;
--- function "/=" (L, R : BOOLEAN_VECTOR) return BOOLEAN;
--- function "<" (L, R : BOOLEAN_VECTOR) return BOOLEAN;
--- function "<=" (L, R : BOOLEAN_VECTOR) return BOOLEAN;
--- function ">" (L, R : BOOLEAN_VECTOR) return BOOLEAN;
--- function ">=" (L, R : BOOLEAN_VECTOR) return BOOLEAN;
-
- function \?=\ (L, R : BOOLEAN_VECTOR) return BOOLEAN;
- function \?/=\ (L, R : BOOLEAN_VECTOR) return BOOLEAN;
-
--- function "&" (L : BOOLEAN_VECTOR; R : BOOLEAN_VECTOR)
- -- return BOOLEAN_VECTOR;
--- function "&" (L : BOOLEAN_VECTOR; R : BOOLEAN) -- return BOOLEAN_VECTOR;
--- function "&" (L : BOOLEAN; R : BOOLEAN_VECTOR) -- return BOOLEAN_VECTOR;
--- function "&" (L : BOOLEAN; R : BOOLEAN) -- return BOOLEAN_VECTOR;
-
- function MINIMUM (L, R : BOOLEAN_VECTOR) return BOOLEAN_VECTOR;
- function MAXIMUM (L, R : BOOLEAN_VECTOR) return BOOLEAN_VECTOR;
-
- function MINIMUM (L : BOOLEAN_VECTOR) return BOOLEAN;
- function MAXIMUM (L : BOOLEAN_VECTOR) return BOOLEAN;
-
- function "and" (L : BIT_VECTOR; R : BIT) return BIT_VECTOR;
- function "and" (L : BIT; R : BIT_VECTOR) return BIT_VECTOR;
- function "or" (L : BIT_VECTOR; R : BIT) return BIT_VECTOR;
- function "or" (L : BIT; R : BIT_VECTOR) return BIT_VECTOR;
- function "nand" (L : BIT_VECTOR; R : BIT) return BIT_VECTOR;
- function "nand" (L : BIT; R : BIT_VECTOR) return BIT_VECTOR;
- function "nor" (L : BIT_VECTOR; R : BIT) return BIT_VECTOR;
- function "nor" (L : BIT; R : BIT_VECTOR) return BIT_VECTOR;
- function "xor" (L : BIT_VECTOR; R : BIT) return BIT_VECTOR;
- function "xor" (L : BIT; R : BIT_VECTOR) return BIT_VECTOR;
- function "xnor" (L : BIT_VECTOR; R : BIT) return BIT_VECTOR;
- function "xnor" (L : BIT; R : BIT_VECTOR) return BIT_VECTOR;
-
- function and_reduce (L : BIT_VECTOR) return BIT;
- function or_reduce (L : BIT_VECTOR) return BIT;
- function nand_reduce (L : BIT_VECTOR) return BIT;
- function nor_reduce (L : BIT_VECTOR) return BIT;
- function xor_reduce (L : BIT_VECTOR) return BIT;
- function xnor_reduce (L : BIT_VECTOR) return BIT;
-
- function \?=\ (L, R : BIT_VECTOR) return BIT;
- function \?/=\ (L, R : BIT_VECTOR) return BIT;
-
- function MINIMUM (L, R : BIT_VECTOR) return BIT_VECTOR;
- function MAXIMUM (L, R : BIT_VECTOR) return BIT_VECTOR;
-
- function MINIMUM (L : BIT_VECTOR) return BIT;
- function MAXIMUM (L : BIT_VECTOR) return BIT;
-
- function TO_STRING (VALUE : BIT_VECTOR) return STRING;
-
- alias TO_BSTRING is TO_STRING [BIT_VECTOR return STRING];
- alias TO_BINARY_STRING is TO_STRING [BIT_VECTOR return STRING];
- function TO_OSTRING (VALUE : BIT_VECTOR) return STRING;
- alias TO_OCTAL_STRING is TO_OSTRING [BIT_VECTOR return STRING];
- function TO_HSTRING (VALUE : BIT_VECTOR) return STRING;
- alias TO_HEX_STRING is TO_HSTRING [BIT_VECTOR return STRING];
-
- type INTEGER_VECTOR is array (NATURAL range <>) of INTEGER;
-
- -- The predefined operations for this type are as follows:
- function "=" (L, R : INTEGER_VECTOR) return BOOLEAN;
- function "/=" (L, R : INTEGER_VECTOR) return BOOLEAN;
- function "<" (L, R : INTEGER_VECTOR) return BOOLEAN;
- function "<=" (L, R : INTEGER_VECTOR) return BOOLEAN;
- function ">" (L, R : INTEGER_VECTOR) return BOOLEAN;
- function ">=" (L, R : INTEGER_VECTOR) return BOOLEAN;
-
--- function "&" (L : INTEGER_VECTOR; R : INTEGER_VECTOR)
--- return INTEGER_VECTOR;
--- function "&" (L : INTEGER_VECTOR; R : INTEGER) return INTEGER_VECTOR;
--- function "&" (L : INTEGER; R : INTEGER_VECTOR) return INTEGER_VECTOR;
--- function "&" (L : INTEGER; R : INTEGER) return INTEGER_VECTOR;
-
- function MINIMUM (L, R : INTEGER_VECTOR) return INTEGER_VECTOR;
- function MAXIMUM (L, R : INTEGER_VECTOR) return INTEGER_VECTOR;
-
- function MINIMUM (L : INTEGER_VECTOR) return INTEGER;
- function MAXIMUM (L : INTEGER_VECTOR) return INTEGER;
-
- type REAL_VECTOR is array (NATURAL range <>) of REAL;
-
- -- The predefined operations for this type are as follows:
- function "=" (L, R : REAL_VECTOR) return BOOLEAN;
- function "/=" (L, R : REAL_VECTOR) return BOOLEAN;
- function "<" (L, R : REAL_VECTOR) return BOOLEAN;
- function "<=" (L, R : REAL_VECTOR) return BOOLEAN;
- function ">" (L, R : REAL_VECTOR) return BOOLEAN;
- function ">=" (L, R : REAL_VECTOR) return BOOLEAN;
-
--- function "&" (L : REAL_VECTOR; R : REAL_VECTOR)
--- return REAL_VECTOR;
--- function "&" (L : REAL_VECTOR; R : REAL) return REAL_VECTOR;
--- function "&" (L : REAL; R : REAL_VECTOR) return REAL_VECTOR;
--- function "&" (L : REAL; R : REAL) return REAL_VECTOR;
-
- function MINIMUM (L, R : REAL_VECTOR) return REAL_VECTOR;
- function MAXIMUM (L, R : REAL_VECTOR) return REAL_VECTOR;
-
- function MINIMUM (L : REAL_VECTOR) return REAL;
- function MAXIMUM (L : REAL_VECTOR) return REAL;
-
- type TIME_VECTOR is array (NATURAL range <>) of TIME;
-
- -- The predefined operations for this type are as follows:
- function "=" (L, R : TIME_VECTOR) return BOOLEAN;
- function "/=" (L, R : TIME_VECTOR) return BOOLEAN;
- function "<" (L, R : TIME_VECTOR) return BOOLEAN;
- function "<=" (L, R : TIME_VECTOR) return BOOLEAN;
- function ">" (L, R : TIME_VECTOR) return BOOLEAN;
- function ">=" (L, R : TIME_VECTOR) return BOOLEAN;
-
--- function "&" (L : TIME_VECTOR; R : TIME_VECTOR)
--- return TIME_VECTOR;
--- function "&" (L : TIME_VECTOR; R : TIME) return TIME_VECTOR;
--- function "&" (L : TIME; R : TIME_VECTOR) return TIME_VECTOR;
--- function "&" (L : TIME; R : TIME) return TIME_VECTOR;
-
- function MINIMUM (L, R : TIME_VECTOR) return TIME_VECTOR;
- function MAXIMUM (L, R : TIME_VECTOR) return TIME_VECTOR;
-
- function MINIMUM (L : TIME_VECTOR) return TIME;
- function MAXIMUM (L : TIME_VECTOR) return TIME;
-
- function MINIMUM (L, R : FILE_OPEN_KIND) return FILE_OPEN_KIND;
- function MAXIMUM (L, R : FILE_OPEN_KIND) return FILE_OPEN_KIND;
-
- function MINIMUM (L, R : FILE_OPEN_STATUS) return FILE_OPEN_STATUS;
- function MAXIMUM (L, R : FILE_OPEN_STATUS) return FILE_OPEN_STATUS;
-
- -- predefined TO_STRING operations on scalar types
- function TO_STRING (VALUE : BOOLEAN) return STRING;
- function TO_STRING (VALUE : BIT) return STRING;
- function TO_STRING (VALUE : CHARACTER) return STRING;
- function TO_STRING (VALUE : SEVERITY_LEVEL) return STRING;
- function TO_STRING (VALUE : INTEGER) return STRING;
- function TO_STRING (VALUE : REAL) return STRING;
- function TO_STRING (VALUE : TIME) return STRING;
- function TO_STRING (VALUE : FILE_OPEN_KIND) return STRING;
- function TO_STRING (VALUE : FILE_OPEN_STATUS) return STRING;
-
- -- predefined overloaded TO_STRING operations
- function TO_STRING (VALUE : REAL; DIGITS : NATURAL) return STRING;
- function TO_STRING (VALUE : REAL; FORMAT : STRING) return STRING;
- function TO_STRING (VALUE : TIME; UNIT : TIME) return STRING;
-end package standard_additions;
-
-------------------------------------------------------------------------------
--- "standard_additions" package contains the additions to the built in
--- "standard.std" package. In the final version this package will be implicit.
--- Created for VHDL-200X par, David Bishop (dbishop@vhdl.org)
-------------------------------------------------------------------------------
-use std.textio.all;
-package body standard_additions is
-
- function \?=\ (L, R : BOOLEAN) return BOOLEAN is
- begin
- return L = R;
- end function \?=\;
-
- function \?/=\ (L, R : BOOLEAN) return BOOLEAN is
- begin
- return L /= R;
- end function \?/=\;
-
- function \?<\ (L, R : BOOLEAN) return BOOLEAN is
- begin
- return L < R;
- end function \?<\;
-
- function \?<=\ (L, R : BOOLEAN) return BOOLEAN is
- begin
- return L <= R;
- end function \?<=\;
-
- function \?>\ (L, R : BOOLEAN) return BOOLEAN is
- begin
- return L > R;
- end function \?>\;
-
- function \?>=\ (L, R : BOOLEAN) return BOOLEAN is
- begin
- return L >= R;
- end function \?>=\;
-
- function MINIMUM (L, R : BOOLEAN) return BOOLEAN is
- begin
- if L > R then return R;
- else return L;
- end if;
- end function MINIMUM;
- function MAXIMUM (L, R : BOOLEAN) return BOOLEAN is
- begin
- if L > R then return L;
- else return R;
- end if;
- end function MAXIMUM;
-
- function TO_STRING (VALUE : BOOLEAN) return STRING is
- begin
- return BOOLEAN'image(VALUE);
- end function TO_STRING;
-
- function RISING_EDGE (signal S : BOOLEAN) return BOOLEAN is
- begin
- return (s'event and (s = true) and (s'last_value = false));
- end function rising_edge;
-
- function FALLING_EDGE (signal S : BOOLEAN) return BOOLEAN is
- begin
- return (s'event and (s = false) and (s'last_value = true));
- end function falling_edge;
-
- function \?=\ (L, R : BIT) return BIT is
- begin
- if L = R then
- return '1';
- else
- return '0';
- end if;
- end function \?=\;
-
- function \?/=\ (L, R : BIT) return BIT is
- begin
- if L /= R then
- return '1';
- else
- return '0';
- end if;
- end function \?/=\;
-
- function \?<\ (L, R : BIT) return BIT is
- begin
- if L < R then
- return '1';
- else
- return '0';
- end if;
- end function \?<\;
-
- function \?<=\ (L, R : BIT) return BIT is
- begin
- if L <= R then
- return '1';
- else
- return '0';
- end if;
- end function \?<=\;
-
- function \?>\ (L, R : BIT) return BIT is
- begin
- if L > R then
- return '1';
- else
- return '0';
- end if;
- end function \?>\;
-
- function \?>=\ (L, R : BIT) return BIT is
- begin
- if L >= R then
- return '1';
- else
- return '0';
- end if;
- end function \?>=\;
-
- function MINIMUM (L, R : BIT) return BIT is
- begin
- if L > R then return R;
- else return L;
- end if;
- end function MINIMUM;
-
- function MAXIMUM (L, R : BIT) return BIT is
- begin
- if L > R then return L;
- else return R;
- end if;
- end function MAXIMUM;
-
- function TO_STRING (VALUE : BIT) return STRING is
- begin
- if VALUE = '1' then
- return "1";
- else
- return "0";
- end if;
- end function TO_STRING;
-
- function \??\ (L : BIT) return BOOLEAN is
- begin
- return L = '1';
- end function \??\;
-
- function RISING_EDGE (signal S : BIT) return BOOLEAN is
- begin
- return (s'event and (s = '1') and (s'last_value = '0'));
- end function rising_edge;
-
- function FALLING_EDGE (signal S : BIT) return BOOLEAN is
- begin
- return (s'event and (s = '0') and (s'last_value = '1'));
- end function falling_edge;
-
- function MINIMUM (L, R : CHARACTER) return CHARACTER is
- begin
- if L > R then return R;
- else return L;
- end if;
- end function MINIMUM;
-
- function MAXIMUM (L, R : CHARACTER) return CHARACTER is
- begin
- if L > R then return L;
- else return R;
- end if;
- end function MAXIMUM;
-
- function TO_STRING (VALUE : CHARACTER) return STRING is
- variable result : STRING (1 to 1);
- begin
- result (1) := VALUE;
- return result;
- end function TO_STRING;
-
- function MINIMUM (L, R : SEVERITY_LEVEL) return SEVERITY_LEVEL is
- begin
- if L > R then return R;
- else return L;
- end if;
- end function MINIMUM;
-
- function MAXIMUM (L, R : SEVERITY_LEVEL) return SEVERITY_LEVEL is
- begin
- if L > R then return L;
- else return R;
- end if;
- end function MAXIMUM;
-
- function TO_STRING (VALUE : SEVERITY_LEVEL) return STRING is
- begin
- return SEVERITY_LEVEL'image(VALUE);
- end function TO_STRING;
-
- function MINIMUM (L, R : INTEGER) return INTEGER is
- begin
- if L > R then return R;
- else return L;
- end if;
- end function MINIMUM;
-
- function MAXIMUM (L, R : INTEGER) return INTEGER is
- begin
- if L > R then return L;
- else return R;
- end if;
- end function MAXIMUM;
-
- function TO_STRING (VALUE : INTEGER) return STRING is
- begin
- return INTEGER'image(VALUE);
- end function TO_STRING;
-
- function MINIMUM (L, R : REAL) return REAL is
- begin
- if L > R then return R;
- else return L;
- end if;
- end function MINIMUM;
-
- function MAXIMUM (L, R : REAL) return REAL is
- begin
- if L > R then return L;
- else return R;
- end if;
- end function MAXIMUM;
-
- function TO_STRING (VALUE : REAL) return STRING is
- begin
- return REAL'image (VALUE);
- end function TO_STRING;
-
- function TO_STRING (VALUE : REAL; DIGITS : NATURAL) return STRING is
- begin
- return to_string (VALUE, "%1." & INTEGER'image(DIGITS) & "f");
- end function TO_STRING;
-
- function "mod" (L, R : TIME) return TIME is
- variable lint, rint : INTEGER;
- begin
- lint := L / 1.0 ns;
- rint := R / 1.0 ns;
- return (lint mod rint) * 1.0 ns;
- end function "mod";
-
- function "rem" (L, R : TIME) return TIME is
- variable lint, rint : INTEGER;
- begin
- lint := L / 1.0 ns;
- rint := R / 1.0 ns;
- return (lint rem rint) * 1.0 ns;
- end function "rem";
-
- function MINIMUM (L, R : TIME) return TIME is
- begin
- if L > R then return R;
- else return L;
- end if;
- end function MINIMUM;
-
- function MAXIMUM (L, R : TIME) return TIME is
- begin
- if L > R then return L;
- else return R;
- end if;
- end function MAXIMUM;
-
- function TO_STRING (VALUE : TIME) return STRING is
- begin
- return TIME'image (VALUE);
- end function TO_STRING;
-
- function MINIMUM (L, R : STRING) return STRING is
- begin
- if L > R then return R;
- else return L;
- end if;
- end function MINIMUM;
-
- function MAXIMUM (L, R : STRING) return STRING is
- begin
- if L > R then return L;
- else return R;
- end if;
- end function MAXIMUM;
-
- function MINIMUM (L : STRING) return CHARACTER is
- variable result : CHARACTER := CHARACTER'high;
- begin
- for i in l'range loop
- result := minimum (l(i), result);
- end loop;
- return result;
- end function MINIMUM;
-
- function MAXIMUM (L : STRING) return CHARACTER is
- variable result : CHARACTER := CHARACTER'low;
- begin
- for i in l'range loop
- result := maximum (l(i), result);
- end loop;
- return result;
- end function MAXIMUM;
-
- -- type BOOLEAN_VECTOR is array (NATURAL range <>) of BOOLEAN;
- -- The predefined operations for this type are as follows:
- function "and" (L, R : BOOLEAN_VECTOR) return BOOLEAN_VECTOR is
- alias lv : BOOLEAN_VECTOR (1 to l'length) is l;
- alias rv : BOOLEAN_VECTOR (1 to r'length) is r;
- variable result : BOOLEAN_VECTOR (1 to l'length);
- begin
- if (l'length /= r'length) then
- assert false
- report "STD.""and"": "
- & "arguments of overloaded 'and' operator are not of the same length"
- severity failure;
- else
- for i in result'range loop
- result(i) := (lv(i) and rv(i));
- end loop;
- end if;
- return result;
- end function "and";
-
- function "or" (L, R : BOOLEAN_VECTOR) return BOOLEAN_VECTOR is
- alias lv : BOOLEAN_VECTOR (1 to l'length) is l;
- alias rv : BOOLEAN_VECTOR (1 to r'length) is r;
- variable result : BOOLEAN_VECTOR (1 to l'length);
- begin
- if (l'length /= r'length) then
- assert false
- report "STD.""or"": "
- & "arguments of overloaded 'or' operator are not of the same length"
- severity failure;
- else
- for i in result'range loop
- result(i) := (lv(i) or rv(i));
- end loop;
- end if;
- return result;
- end function "or";
-
- function "nand" (L, R : BOOLEAN_VECTOR) return BOOLEAN_VECTOR is
- alias lv : BOOLEAN_VECTOR (1 to l'length) is l;
- alias rv : BOOLEAN_VECTOR (1 to r'length) is r;
- variable result : BOOLEAN_VECTOR (1 to l'length);
- begin
- if (l'length /= r'length) then
- assert false
- report "STD.""nand"": "
- & "arguments of overloaded 'nand' operator are not of the same length"
- severity failure;
- else
- for i in result'range loop
- result(i) := (lv(i) nand rv(i));
- end loop;
- end if;
- return result;
- end function "nand";
-
- function "nor" (L, R : BOOLEAN_VECTOR) return BOOLEAN_VECTOR is
- alias lv : BOOLEAN_VECTOR (1 to l'length) is l;
- alias rv : BOOLEAN_VECTOR (1 to r'length) is r;
- variable result : BOOLEAN_VECTOR (1 to l'length);
- begin
- if (l'length /= r'length) then
- assert false
- report "STD.""nor"": "
- & "arguments of overloaded 'nor' operator are not of the same length"
- severity failure;
- else
- for i in result'range loop
- result(i) := (lv(i) nor rv(i));
- end loop;
- end if;
- return result;
- end function "nor";
-
- function "xor" (L, R : BOOLEAN_VECTOR) return BOOLEAN_VECTOR is
- alias lv : BOOLEAN_VECTOR (1 to l'length) is l;
- alias rv : BOOLEAN_VECTOR (1 to r'length) is r;
- variable result : BOOLEAN_VECTOR (1 to l'length);
- begin
- if (l'length /= r'length) then
- assert false
- report "STD.""xor"": "
- & "arguments of overloaded 'xor' operator are not of the same length"
- severity failure;
- else
- for i in result'range loop
- result(i) := (lv(i) xor rv(i));
- end loop;
- end if;
- return result;
- end function "xor";
-
- function "xnor" (L, R : BOOLEAN_VECTOR) return BOOLEAN_VECTOR is
- alias lv : BOOLEAN_VECTOR (1 to l'length) is l;
- alias rv : BOOLEAN_VECTOR (1 to r'length) is r;
- variable result : BOOLEAN_VECTOR (1 to l'length);
- begin
- if (l'length /= r'length) then
- assert false
- report "STD.""xnor"": "
- & "arguments of overloaded 'xnor' operator are not of the same length"
- severity failure;
- else
- for i in result'range loop
- result(i) := (lv(i) xnor rv(i));
- end loop;
- end if;
- return result;
- end function "xnor";
-
- function "not" (L : BOOLEAN_VECTOR) return BOOLEAN_VECTOR is
- alias lv : BOOLEAN_VECTOR (1 to l'length) is l;
- variable result : BOOLEAN_VECTOR (1 to l'length);
- begin
- for i in result'range loop
- result(i) := not (lv(i));
- end loop;
- return result;
- end function "not";
-
- function "and" (L : BOOLEAN_VECTOR; R : BOOLEAN)
- return BOOLEAN_VECTOR is
- alias lv : BOOLEAN_VECTOR (1 to l'length) is l;
- variable result : BOOLEAN_VECTOR (1 to l'length);
- begin
- for i in result'range loop
- result(i) := lv(i) and r;
- end loop;
- return result;
- end function "and";
-
- function "and" (L : BOOLEAN; R : BOOLEAN_VECTOR)
- return BOOLEAN_VECTOR is
- alias rv : BOOLEAN_VECTOR (1 to r'length) is r;
- variable result : BOOLEAN_VECTOR (1 to r'length);
- begin
- for i in result'range loop
- result(i) := l and rv(i);
- end loop;
- return result;
- end function "and";
-
- function "or" (L : BOOLEAN_VECTOR; R : BOOLEAN)
- return BOOLEAN_VECTOR is
- alias lv : BOOLEAN_VECTOR (1 to l'length) is l;
- variable result : BOOLEAN_VECTOR (1 to l'length);
- begin
- for i in result'range loop
- result(i) := lv(i) or r;
- end loop;
- return result;
- end function "or";
-
- function "or" (L : BOOLEAN; R : BOOLEAN_VECTOR)
- return BOOLEAN_VECTOR is
- alias rv : BOOLEAN_VECTOR (1 to r'length) is r;
- variable result : BOOLEAN_VECTOR (1 to r'length);
- begin
- for i in result'range loop
- result(i) := l or rv(i);
- end loop;
- return result;
- end function "or";
-
- function "nand" (L : BOOLEAN_VECTOR; R : BOOLEAN)
- return BOOLEAN_VECTOR is
- alias lv : BOOLEAN_VECTOR (1 to l'length) is l;
- variable result : BOOLEAN_VECTOR (1 to l'length);
- begin
- for i in result'range loop
- result(i) := lv(i) nand r;
- end loop;
- return result;
- end function "nand";
-
- function "nand" (L : BOOLEAN; R : BOOLEAN_VECTOR)
- return BOOLEAN_VECTOR is
- alias rv : BOOLEAN_VECTOR (1 to r'length) is r;
- variable result : BOOLEAN_VECTOR (1 to r'length);
- begin
- for i in result'range loop
- result(i) := l nand rv(i);
- end loop;
- return result;
- end function "nand";
-
- function "nor" (L : BOOLEAN_VECTOR; R : BOOLEAN)
- return BOOLEAN_VECTOR is
- alias lv : BOOLEAN_VECTOR (1 to l'length) is l;
- variable result : BOOLEAN_VECTOR (1 to l'length);
- begin
- for i in result'range loop
- result(i) := lv(i) nor r;
- end loop;
- return result;
- end function "nor";
-
- function "nor" (L : BOOLEAN; R : BOOLEAN_VECTOR)
- return BOOLEAN_VECTOR is
- alias rv : BOOLEAN_VECTOR (1 to r'length) is r;
- variable result : BOOLEAN_VECTOR (1 to r'length);
- begin
- for i in result'range loop
- result(i) := l nor rv(i);
- end loop;
- return result;
- end function "nor";
-
- function "xor" (L : BOOLEAN_VECTOR; R : BOOLEAN)
- return BOOLEAN_VECTOR is
- alias lv : BOOLEAN_VECTOR (1 to l'length) is l;
- variable result : BOOLEAN_VECTOR (1 to l'length);
- begin
- for i in result'range loop
- result(i) := lv(i) xor r;
- end loop;
- return result;
- end function "xor";
-
- function "xor" (L : BOOLEAN; R : BOOLEAN_VECTOR)
- return BOOLEAN_VECTOR is
- alias rv : BOOLEAN_VECTOR (1 to r'length) is r;
- variable result : BOOLEAN_VECTOR (1 to r'length);
- begin
- for i in result'range loop
- result(i) := l xor rv(i);
- end loop;
- return result;
- end function "xor";
-
- function "xnor" (L : BOOLEAN_VECTOR; R : BOOLEAN)
- return BOOLEAN_VECTOR is
- alias lv : BOOLEAN_VECTOR (1 to l'length) is l;
- variable result : BOOLEAN_VECTOR (1 to l'length);
- begin
- for i in result'range loop
- result(i) := lv(i) xnor r;
- end loop;
- return result;
- end function "xnor";
-
- function "xnor" (L : BOOLEAN; R : BOOLEAN_VECTOR)
- return BOOLEAN_VECTOR is
- alias rv : BOOLEAN_VECTOR (1 to r'length) is r;
- variable result : BOOLEAN_VECTOR (1 to r'length);
- begin
- for i in result'range loop
- result(i) := l xnor rv(i);
- end loop;
- return result;
- end function "xnor";
-
- function and_reduce (L : BOOLEAN_VECTOR) return BOOLEAN is
- variable result : BOOLEAN := true;
- begin
- for i in l'reverse_range loop
- result := l(i) and result;
- end loop;
- return result;
- end function and_reduce;
-
- function or_reduce (L : BOOLEAN_VECTOR) return BOOLEAN is
- variable result : BOOLEAN := false;
- begin
- for i in l'reverse_range loop
- result := l(i) or result;
- end loop;
- return result;
- end function or_reduce;
-
- function nand_reduce (L : BOOLEAN_VECTOR) return BOOLEAN is
- variable result : BOOLEAN := true;
- begin
- for i in l'reverse_range loop
- result := l(i) and result;
- end loop;
- return not result;
- end function nand_reduce;
-
- function nor_reduce (L : BOOLEAN_VECTOR) return BOOLEAN is
- variable result : BOOLEAN := false;
- begin
- for i in l'reverse_range loop
- result := l(i) or result;
- end loop;
- return not result;
- end function nor_reduce;
-
- function xor_reduce (L : BOOLEAN_VECTOR) return BOOLEAN is
- variable result : BOOLEAN := false;
- begin
- for i in l'reverse_range loop
- result := l(i) xor result;
- end loop;
- return result;
- end function xor_reduce;
-
- function xnor_reduce (L : BOOLEAN_VECTOR) return BOOLEAN is
- variable result : BOOLEAN := false;
- begin
- for i in l'reverse_range loop
- result := l(i) xor result;
- end loop;
- return not result;
- end function xnor_reduce;
-
- function "sll" (L : BOOLEAN_VECTOR; R : INTEGER)
- return BOOLEAN_VECTOR is
- alias lv : BOOLEAN_VECTOR (1 to l'length) is l;
- variable result : BOOLEAN_VECTOR (1 to l'length);
- begin
- if r >= 0 then
- result(1 to l'length - r) := lv(r + 1 to l'length);
- else
- result := l srl -r;
- end if;
- return result;
- end function "sll";
-
- function "srl" (L : BOOLEAN_VECTOR; R : INTEGER)
- return BOOLEAN_VECTOR is
- alias lv : BOOLEAN_VECTOR (1 to l'length) is l;
- variable result : BOOLEAN_VECTOR (1 to l'length);
- begin
- if r >= 0 then
- result(r + 1 to l'length) := lv(1 to l'length - r);
- else
- result := l sll -r;
- end if;
- return result;
- end function "srl";
-
- function "sla" (L : BOOLEAN_VECTOR; R : INTEGER)
- return BOOLEAN_VECTOR is
- alias lv : BOOLEAN_VECTOR (1 to l'length) is l;
- variable result : BOOLEAN_VECTOR (1 to l'length);
- begin
- for i in L'range loop
- result (i) := L(L'high);
- end loop;
- if r >= 0 then
- result(1 to l'length - r) := lv(r + 1 to l'length);
- else
- result := l sra -r;
- end if;
- return result;
- end function "sla";
-
- function "sra" (L : BOOLEAN_VECTOR; R : INTEGER)
- return BOOLEAN_VECTOR is
- alias lv : BOOLEAN_VECTOR (1 to l'length) is l;
- variable result : BOOLEAN_VECTOR (1 to l'length);
- begin
- for i in L'range loop
- result (i) := L(L'low);
- end loop;
- if r >= 0 then
- result(1 to l'length - r) := lv(r + 1 to l'length);
- else
- result := l sra -r;
- end if;
- return result;
- end function "sra";
-
- function "rol" (L : BOOLEAN_VECTOR; R : INTEGER)
- return BOOLEAN_VECTOR is
- alias lv : BOOLEAN_VECTOR (1 to l'length) is l;
- variable result : BOOLEAN_VECTOR (1 to l'length);
- constant rm : INTEGER := r mod l'length;
- begin
- if r >= 0 then
- result(1 to l'length - rm) := lv(rm + 1 to l'length);
- result(l'length - rm + 1 to l'length) := lv(1 to rm);
- else
- result := l ror -r;
- end if;
- return result;
- end function "rol";
-
- function "ror" (L : BOOLEAN_VECTOR; R : INTEGER)
- return BOOLEAN_VECTOR is
- alias lv : BOOLEAN_VECTOR (1 to l'length) is l;
- variable result : BOOLEAN_VECTOR (1 to l'length);
- constant rm : INTEGER := r mod l'length;
- begin
- if r >= 0 then
- result(rm + 1 to l'length) := lv(1 to l'length - rm);
- result(1 to rm) := lv(l'length - rm + 1 to l'length);
- else
- result := l rol -r;
- end if;
- return result;
- end function "ror";
--- function "=" (L, R: BOOLEAN_VECTOR) return BOOLEAN;
--- function "/=" (L, R: BOOLEAN_VECTOR) return BOOLEAN;
--- function "<" (L, R: BOOLEAN_VECTOR) return BOOLEAN;
--- function "<=" (L, R: BOOLEAN_VECTOR) return BOOLEAN;
--- function ">" (L, R: BOOLEAN_VECTOR) return BOOLEAN;
--- function ">=" (L, R: BOOLEAN_VECTOR) return BOOLEAN;
-
- function \?=\ (L, R : BOOLEAN_VECTOR) return BOOLEAN is
- begin
- return L = R;
- end function \?=\;
-
- function \?/=\ (L, R : BOOLEAN_VECTOR) return BOOLEAN is
- begin
- return L /= R;
- end function \?/=\;
--- function "&" (L: BOOLEAN_VECTOR; R: BOOLEAN_VECTOR)
--- return BOOLEAN_VECTOR;
--- function "&" (L: BOOLEAN_VECTOR; R: BOOLEAN) return BOOLEAN_VECTOR;
--- function "&" (L: BOOLEAN; R: BOOLEAN_VECTOR) return BOOLEAN_VECTOR;
--- function "&" (L: BOOLEAN; R: BOOLEAN) return BOOLEAN_VECTOR;
-
- function MINIMUM (L, R : BOOLEAN_VECTOR) return BOOLEAN_VECTOR is
- begin
- if L > R then return R;
- else return L;
- end if;
- end function MINIMUM;
-
- function MAXIMUM (L, R : BOOLEAN_VECTOR) return BOOLEAN_VECTOR is
- begin
- if L > R then return L;
- else return R;
- end if;
- end function MAXIMUM;
-
- function MINIMUM (L : BOOLEAN_VECTOR) return BOOLEAN is
- variable result : BOOLEAN := BOOLEAN'high;
- begin
- for i in l'range loop
- result := minimum (l(i), result);
- end loop;
- return result;
- end function MINIMUM;
-
- function MAXIMUM (L : BOOLEAN_VECTOR) return BOOLEAN is
- variable result : BOOLEAN := BOOLEAN'low;
- begin
- for i in l'range loop
- result := maximum (l(i), result);
- end loop;
- return result;
- end function MAXIMUM;
-
- function "and" (L : BIT_VECTOR; R : BIT) return BIT_VECTOR is
- alias lv : BIT_VECTOR (1 to l'length) is l;
- variable result : BIT_VECTOR (1 to l'length);
- begin
- for i in result'range loop
- result(i) := lv(i) and r;
- end loop;
- return result;
- end function "and";
-
- function "and" (L : BIT; R : BIT_VECTOR) return BIT_VECTOR is
- alias rv : BIT_VECTOR (1 to r'length) is r;
- variable result : BIT_VECTOR (1 to r'length);
- begin
- for i in result'range loop
- result(i) := l and rv(i);
- end loop;
- return result;
- end function "and";
-
- function "or" (L : BIT_VECTOR; R : BIT) return BIT_VECTOR is
- alias lv : BIT_VECTOR (1 to l'length) is l;
- variable result : BIT_VECTOR (1 to l'length);
- begin
- for i in result'range loop
- result(i) := lv(i) or r;
- end loop;
- return result;
- end function "or";
-
- function "or" (L : BIT; R : BIT_VECTOR) return BIT_VECTOR is
- alias rv : BIT_VECTOR (1 to r'length) is r;
- variable result : BIT_VECTOR (1 to r'length);
- begin
- for i in result'range loop
- result(i) := l or rv(i);
- end loop;
- return result;
- end function "or";
-
- function "nand" (L : BIT_VECTOR; R : BIT) return BIT_VECTOR is
- alias lv : BIT_VECTOR (1 to l'length) is l;
- variable result : BIT_VECTOR (1 to l'length);
- begin
- for i in result'range loop
- result(i) := lv(i) and r;
- end loop;
- return not result;
- end function "nand";
-
- function "nand" (L : BIT; R : BIT_VECTOR) return BIT_VECTOR is
- alias rv : BIT_VECTOR (1 to r'length) is r;
- variable result : BIT_VECTOR (1 to r'length);
- begin
- for i in result'range loop
- result(i) := l and rv(i);
- end loop;
- return not result;
- end function "nand";
-
- function "nor" (L : BIT_VECTOR; R : BIT) return BIT_VECTOR is
- alias lv : BIT_VECTOR (1 to l'length) is l;
- variable result : BIT_VECTOR (1 to l'length);
- begin
- for i in result'range loop
- result(i) := lv(i) or r;
- end loop;
- return not result;
- end function "nor";
-
- function "nor" (L : BIT; R : BIT_VECTOR) return BIT_VECTOR is
- alias rv : BIT_VECTOR (1 to r'length) is r;
- variable result : BIT_VECTOR (1 to r'length);
- begin
- for i in result'range loop
- result(i) := l or rv(i);
- end loop;
- return not result;
- end function "nor";
-
- function "xor" (L : BIT_VECTOR; R : BIT) return BIT_VECTOR is
- alias lv : BIT_VECTOR (1 to l'length) is l;
- variable result : BIT_VECTOR (1 to l'length);
- begin
- for i in result'range loop
- result(i) := lv(i) xor r;
- end loop;
- return result;
- end function "xor";
-
- function "xor" (L : BIT; R : BIT_VECTOR) return BIT_VECTOR is
- alias rv : BIT_VECTOR (1 to r'length) is r;
- variable result : BIT_VECTOR (1 to r'length);
- begin
- for i in result'range loop
- result(i) := l xor rv(i);
- end loop;
- return result;
- end function "xor";
-
- function "xnor" (L : BIT_VECTOR; R : BIT) return BIT_VECTOR is
- alias lv : BIT_VECTOR (1 to l'length) is l;
- variable result : BIT_VECTOR (1 to l'length);
- begin
- for i in result'range loop
- result(i) := lv(i) xor r;
- end loop;
- return not result;
- end function "xnor";
-
- function "xnor" (L : BIT; R : BIT_VECTOR) return BIT_VECTOR is
- alias rv : BIT_VECTOR (1 to r'length) is r;
- variable result : BIT_VECTOR (1 to r'length);
- begin
- for i in result'range loop
- result(i) := l xor rv(i);
- end loop;
- return not result;
- end function "xnor";
-
- function and_reduce (L : BIT_VECTOR) return BIT is
- variable result : BIT := '1';
- begin
- for i in l'reverse_range loop
- result := l(i) and result;
- end loop;
- return result;
- end function and_reduce;
-
- function or_reduce (L : BIT_VECTOR) return BIT is
- variable result : BIT := '0';
- begin
- for i in l'reverse_range loop
- result := l(i) or result;
- end loop;
- return result;
- end function or_reduce;
-
- function nand_reduce (L : BIT_VECTOR) return BIT is
- variable result : BIT := '1';
- begin
- for i in l'reverse_range loop
- result := l(i) and result;
- end loop;
- return not result;
- end function nand_reduce;
-
- function nor_reduce (L : BIT_VECTOR) return BIT is
- variable result : BIT := '0';
- begin
- for i in l'reverse_range loop
- result := l(i) or result;
- end loop;
- return not result;
- end function nor_reduce;
-
- function xor_reduce (L : BIT_VECTOR) return BIT is
- variable result : BIT := '0';
- begin
- for i in l'reverse_range loop
- result := l(i) xor result;
- end loop;
- return result;
- end function xor_reduce;
-
- function xnor_reduce (L : BIT_VECTOR) return BIT is
- variable result : BIT := '0';
- begin
- for i in l'reverse_range loop
- result := l(i) xor result;
- end loop;
- return not result;
- end function xnor_reduce;
-
- function \?=\ (L, R : BIT_VECTOR) return BIT is
- begin
- if L = R then
- return '1';
- else
- return '0';
- end if;
- end function \?=\;
-
- function \?/=\ (L, R : BIT_VECTOR) return BIT is
- begin
- if L /= R then
- return '1';
- else
- return '0';
- end if;
- end function \?/=\;
-
- function MINIMUM (L, R : BIT_VECTOR) return BIT_VECTOR is
- begin
- if L > R then return R;
- else return L;
- end if;
- end function MINIMUM;
-
- function MAXIMUM (L, R : BIT_VECTOR) return BIT_VECTOR is
- begin
- if L > R then return L;
- else return R;
- end if;
- end function MAXIMUM;
-
- function MINIMUM (L : BIT_VECTOR) return BIT is
- variable result : BIT := BIT'high;
- begin
- for i in l'range loop
- result := minimum (l(i), result);
- end loop;
- return result;
- end function MINIMUM;
-
- function MAXIMUM (L : BIT_VECTOR) return BIT is
- variable result : BIT := BIT'low;
- begin
- for i in l'range loop
- result := maximum (l(i), result);
- end loop;
- return result;
- end function MAXIMUM;
-
- function TO_STRING (VALUE : BIT_VECTOR) return STRING is
- alias ivalue : BIT_VECTOR(1 to value'length) is value;
- variable result : STRING(1 to value'length);
- begin
- if value'length < 1 then
- return "";
- else
- for i in ivalue'range loop
- if iValue(i) = '0' then
- result(i) := '0';
- else
- result(i) := '1';
- end if;
- end loop;
- return result;
- end if;
- end function to_string;
-
--- alias TO_BSTRING is TO_STRING [BIT_VECTOR return STRING];
--- alias TO_BINARY_STRING is TO_STRING [BIT_VECTOR return STRING];
-
- function TO_OSTRING (VALUE : BIT_VECTOR) return STRING is
- constant ne : INTEGER := (value'length+2)/3;
- constant pad : BIT_VECTOR(0 to (ne*3 - value'length) - 1) := (others => '0');
- variable ivalue : BIT_VECTOR(0 to ne*3 - 1);
- variable result : STRING(1 to ne);
- variable tri : BIT_VECTOR(0 to 2);
- begin
- if value'length < 1 then
- return "";
- end if;
- ivalue := pad & value;
- for i in 0 to ne-1 loop
- tri := ivalue(3*i to 3*i+2);
- case tri is
- when o"0" => result(i+1) := '0';
- when o"1" => result(i+1) := '1';
- when o"2" => result(i+1) := '2';
- when o"3" => result(i+1) := '3';
- when o"4" => result(i+1) := '4';
- when o"5" => result(i+1) := '5';
- when o"6" => result(i+1) := '6';
- when o"7" => result(i+1) := '7';
- end case;
- end loop;
- return result;
- end function to_ostring;
--- alias TO_OCTAL_STRING is TO_OSTRING [BIT_VECTOR return STRING];
-
- function TO_HSTRING (VALUE : BIT_VECTOR) return STRING is
- constant ne : INTEGER := (value'length+3)/4;
- constant pad : BIT_VECTOR(0 to (ne*4 - value'length) - 1) := (others => '0');
- variable ivalue : BIT_VECTOR(0 to ne*4 - 1);
- variable result : STRING(1 to ne);
- variable quad : BIT_VECTOR(0 to 3);
- begin
- if value'length < 1 then
- return "";
- end if;
- ivalue := pad & value;
- for i in 0 to ne-1 loop
- quad := ivalue(4*i to 4*i+3);
- case quad is
- when x"0" => result(i+1) := '0';
- when x"1" => result(i+1) := '1';
- when x"2" => result(i+1) := '2';
- when x"3" => result(i+1) := '3';
- when x"4" => result(i+1) := '4';
- when x"5" => result(i+1) := '5';
- when x"6" => result(i+1) := '6';
- when x"7" => result(i+1) := '7';
- when x"8" => result(i+1) := '8';
- when x"9" => result(i+1) := '9';
- when x"A" => result(i+1) := 'A';
- when x"B" => result(i+1) := 'B';
- when x"C" => result(i+1) := 'C';
- when x"D" => result(i+1) := 'D';
- when x"E" => result(i+1) := 'E';
- when x"F" => result(i+1) := 'F';
- end case;
- end loop;
- return result;
- end function to_hstring;
--- alias TO_HEX_STRING is TO_HSTRING [BIT_VECTOR return STRING];
-
--- type INTEGER_VECTOR is array (NATURAL range <>) of INTEGER;
- -- The predefined operations for this type are as follows:
-
- function "=" (L, R : INTEGER_VECTOR) return BOOLEAN is
- begin
- if L'length /= R'length or L'length < 1 or R'length < 1 then
- return false;
- else
- for i in l'range loop
- if L(i) /= R(i) then
- return false;
- end if;
- end loop;
- return true;
- end if;
- end function "=";
-
- function "/=" (L, R : INTEGER_VECTOR) return BOOLEAN is
- begin
- return not (L = R);
- end function "/=";
-
- function "<" (L, R : INTEGER_VECTOR) return BOOLEAN is
- begin
- if L'length /= R'length then
- return L'length < R'length;
- else
- for i in l'range loop
- if L(i) /= R(i) then
- if L(i) < R(i) then
- return true;
- else
- return false;
- end if;
- end if;
- end loop;
- return false;
- end if;
- end function "<";
-
- function "<=" (L, R : INTEGER_VECTOR) return BOOLEAN is
- begin
- if L'length /= R'length then
- return L'length < R'length;
- else
- for i in l'range loop
- if L(i) /= R(i) then
- if L(i) < R(i) then
- return true;
- else
- return false;
- end if;
- end if;
- end loop;
- return true;
- end if;
- end function "<=";
-
- function ">" (L, R : INTEGER_VECTOR) return BOOLEAN is
- begin
- if L'length /= R'length then
- return L'length > R'length;
- else
- for i in l'range loop
- if L(i) /= R(i) then
- if L(i) > R(i) then
- return true;
- else
- return false;
- end if;
- end if;
- end loop;
- return false;
- end if;
- end function ">";
-
- function ">=" (L, R : INTEGER_VECTOR) return BOOLEAN is
- begin
- if L'length /= R'length then
- return L'length > R'length;
- else
- for i in l'range loop
- if L(i) /= R(i) then
- if L(i) > R(i) then
- return true;
- else
- return false;
- end if;
- end if;
- end loop;
- return true;
- end if;
- end function ">=";
--- function "&" (L: INTEGER_VECTOR; R: INTEGER_VECTOR)
--- return INTEGER_VECTOR;
--- function "&" (L: INTEGER_VECTOR; R: INTEGER) return INTEGER_VECTOR;
--- function "&" (L: INTEGER; R: INTEGER_VECTOR) return INTEGER_VECTOR;
--- function "&" (L: INTEGER; R: INTEGER) return INTEGER_VECTOR;
-
- function MINIMUM (L, R : INTEGER_VECTOR) return INTEGER_VECTOR is
- begin
- if L > R then return R;
- else return L;
- end if;
- end function MINIMUM;
-
- function MAXIMUM (L, R : INTEGER_VECTOR) return INTEGER_VECTOR is
- begin
- if L > R then return L;
- else return R;
- end if;
- end function MAXIMUM;
-
- function MINIMUM (L : INTEGER_VECTOR) return INTEGER is
- variable result : INTEGER := INTEGER'high;
- begin
- for i in l'range loop
- result := minimum (l(i), result);
- end loop;
- return result;
- end function MINIMUM;
-
- function MAXIMUM (L : INTEGER_VECTOR) return INTEGER is
- variable result : INTEGER := INTEGER'low;
- begin
- for i in l'range loop
- result := maximum (l(i), result);
- end loop;
- return result;
- end function MAXIMUM;
-
- -- type REAL_VECTOR is array (NATURAL range <>) of REAL;
- -- The predefined operations for this type are as follows:
- function "=" (L, R : REAL_VECTOR) return BOOLEAN is
- begin
- if L'length /= R'length or L'length < 1 or R'length < 1 then
- return false;
- else
- for i in l'range loop
- if L(i) /= R(i) then
- return false;
- end if;
- end loop;
- return true;
- end if;
- end function "=";
-
- function "/=" (L, R : REAL_VECTOR) return BOOLEAN is
- begin
- return not (L = R);
- end function "/=";
-
- function "<" (L, R : REAL_VECTOR) return BOOLEAN is
- begin
- if L'length /= R'length then
- return L'length < R'length;
- else
- for i in l'range loop
- if L(i) /= R(i) then
- if L(i) < R(i) then
- return true;
- else
- return false;
- end if;
- end if;
- end loop;
- return false;
- end if;
- end function "<";
-
- function "<=" (L, R : REAL_VECTOR) return BOOLEAN is
- begin
- if L'length /= R'length then
- return L'length < R'length;
- else
- for i in l'range loop
- if L(i) /= R(i) then
- if L(i) < R(i) then
- return true;
- else
- return false;
- end if;
- end if;
- end loop;
- return true;
- end if;
- end function "<=";
-
- function ">" (L, R : REAL_VECTOR) return BOOLEAN is
- begin
- if L'length /= R'length then
- return L'length > R'length;
- else
- for i in l'range loop
- if L(i) /= R(i) then
- if L(i) > R(i) then
- return true;
- else
- return false;
- end if;
- end if;
- end loop;
- return false;
- end if;
- end function ">";
-
- function ">=" (L, R : REAL_VECTOR) return BOOLEAN is
- begin
- if L'length /= R'length then
- return L'length > R'length;
- else
- for i in l'range loop
- if L(i) /= R(i) then
- if L(i) > R(i) then
- return true;
- else
- return false;
- end if;
- end if;
- end loop;
- return true;
- end if;
- end function ">=";
--- function "&" (L: REAL_VECTOR; R: REAL_VECTOR)
--- return REAL_VECTOR;
--- function "&" (L: REAL_VECTOR; R: REAL) return REAL_VECTOR;
--- function "&" (L: REAL; R: REAL_VECTOR) return REAL_VECTOR;
--- function "&" (L: REAL; R: REAL) return REAL_VECTOR;
-
- function MINIMUM (L, R : REAL_VECTOR) return REAL_VECTOR is
- begin
- if L > R then return R;
- else return L;
- end if;
- end function MINIMUM;
-
- function MAXIMUM (L, R : REAL_VECTOR) return REAL_VECTOR is
- begin
- if L > R then return L;
- else return R;
- end if;
- end function MAXIMUM;
-
- function MINIMUM (L : REAL_VECTOR) return REAL is
- variable result : REAL := REAL'high;
- begin
- for i in l'range loop
- result := minimum (l(i), result);
- end loop;
- return result;
- end function MINIMUM;
-
- function MAXIMUM (L : REAL_VECTOR) return REAL is
- variable result : REAL := REAL'low;
- begin
- for i in l'range loop
- result := maximum (l(i), result);
- end loop;
- return result;
- end function MAXIMUM;
-
- -- type TIME_VECTOR is array (NATURAL range <>) of TIME;
- -- The predefined implicit operations for this type are as follows:
- function "=" (L, R : TIME_VECTOR) return BOOLEAN is
- begin
- if L'length /= R'length or L'length < 1 or R'length < 1 then
- return false;
- else
- for i in l'range loop
- if L(i) /= R(i) then
- return false;
- end if;
- end loop;
- return true;
- end if;
- end function "=";
-
- function "/=" (L, R : TIME_VECTOR) return BOOLEAN is
- begin
- return not (L = R);
- end function "/=";
-
- function "<" (L, R : TIME_VECTOR) return BOOLEAN is
- begin
- if L'length /= R'length then
- return L'length < R'length;
- else
- for i in l'range loop
- if L(i) /= R(i) then
- if L(i) < R(i) then
- return true;
- else
- return false;
- end if;
- end if;
- end loop;
- return false;
- end if;
- end function "<";
-
- function "<=" (L, R : TIME_VECTOR) return BOOLEAN is
- begin
- if L'length /= R'length then
- return L'length < R'length;
- else
- for i in l'range loop
- if L(i) /= R(i) then
- if L(i) < R(i) then
- return true;
- else
- return false;
- end if;
- end if;
- end loop;
- return true;
- end if;
- end function "<=";
-
- function ">" (L, R : TIME_VECTOR) return BOOLEAN is
- begin
- if L'length /= R'length then
- return L'length > R'length;
- else
- for i in l'range loop
- if L(i) /= R(i) then
- if L(i) > R(i) then
- return true;
- else
- return false;
- end if;
- end if;
- end loop;
- return false;
- end if;
- end function ">";
-
- function ">=" (L, R : TIME_VECTOR) return BOOLEAN is
- begin
- if L'length /= R'length then
- return L'length > R'length;
- else
- for i in l'range loop
- if L(i) /= R(i) then
- if L(i) > R(i) then
- return true;
- else
- return false;
- end if;
- end if;
- end loop;
- return true;
- end if;
- end function ">=";
--- function "&" (L: TIME_VECTOR; R: TIME_VECTOR)
--- return TIME_VECTOR;
--- function "&" (L: TIME_VECTOR; R: TIME) return TIME_VECTOR;
--- function "&" (L: TIME; R: TIME_VECTOR) return TIME_VECTOR;
--- function "&" (L: TIME; R: TIME) return TIME_VECTOR;
-
- function MINIMUM (L, R : TIME_VECTOR) return TIME_VECTOR is
- begin
- if L > R then return R;
- else return L;
- end if;
- end function MINIMUM;
-
- function MAXIMUM (L, R : TIME_VECTOR) return TIME_VECTOR is
- begin
- if L > R then return L;
- else return R;
- end if;
- end function MAXIMUM;
-
- function MINIMUM (L : TIME_VECTOR) return TIME is
- variable result : TIME := TIME'high;
- begin
- for i in l'range loop
- result := minimum (l(i), result);
- end loop;
- return result;
- end function MINIMUM;
-
- function MAXIMUM (L : TIME_VECTOR) return TIME is
- variable result : TIME := TIME'low;
- begin
- for i in l'range loop
- result := maximum (l(i), result);
- end loop;
- return result;
- end function MAXIMUM;
-
- function MINIMUM (L, R : FILE_OPEN_KIND) return FILE_OPEN_KIND is
- begin
- if L > R then return R;
- else return L;
- end if;
- end function MINIMUM;
-
- function MAXIMUM (L, R : FILE_OPEN_KIND) return FILE_OPEN_KIND is
- begin
- if L > R then return L;
- else return R;
- end if;
- end function MAXIMUM;
-
- function TO_STRING (VALUE : FILE_OPEN_KIND) return STRING is
- begin
- return FILE_OPEN_KIND'image(VALUE);
- end function TO_STRING;
-
- function MINIMUM (L, R : FILE_OPEN_STATUS) return FILE_OPEN_STATUS is
- begin
- if L > R then return R;
- else return L;
- end if;
- end function MINIMUM;
-
- function MAXIMUM (L, R : FILE_OPEN_STATUS) return FILE_OPEN_STATUS is
- begin
- if L > R then return L;
- else return R;
- end if;
- end function MAXIMUM;
-
- function TO_STRING (VALUE : FILE_OPEN_STATUS) return STRING is
- begin
- return FILE_OPEN_STATUS'image(VALUE);
- end function TO_STRING;
-
- -- USED INTERNALLY!
- function justify (
- value : in STRING;
- justified : in SIDE := right;
- field : in width := 0)
- return STRING is
- constant VAL_LEN : INTEGER := value'length;
- variable result : STRING (1 to field) := (others => ' ');
- begin -- function justify
- -- return value if field is too small
- if VAL_LEN >= field then
- return value;
- end if;
- if justified = left then
- result(1 to VAL_LEN) := value;
- elsif justified = right then
- result(field - VAL_LEN + 1 to field) := value;
- end if;
- return result;
- end function justify;
-
- function TO_STRING (VALUE : TIME; UNIT : TIME) return STRING is
- variable L : LINE; -- pointer
- begin
- deallocate (L);
- write (L => L,
- VALUE => VALUE,
- UNIT => UNIT);
- return L.all;
- end function to_string;
-
- function TO_STRING (VALUE : REAL; FORMAT : STRING) return STRING is
- constant czero : CHARACTER := '0'; -- zero
- constant half : REAL := 0.4999999999; -- almost 0.5
- -- Log10 funciton
- function log10 (arg : REAL) return INTEGER is
- variable i : INTEGER := 1;
- begin
- if ((arg = 0.0)) then
- return 0;
- elsif arg >= 1.0 then
- while arg >= 10.0**i loop
- i := i + 1;
- end loop;
- return (i-1);
- else
- while arg < 10.0**i loop
- i := i - 1;
- end loop;
- return i;
- end if;
- end function log10;
- -- purpose: writes a fractional real number into a line
- procedure writefrc (
- variable L : inout LINE; -- LINE
- variable cdes : in CHARACTER;
- variable precision : in INTEGER; -- number of decimal places
- variable value : in REAL) is -- real value
- variable rvar : REAL; -- temp variable
- variable xint : INTEGER;
- variable xreal : REAL;
- begin
- xreal := (10.0**(-precision));
- write (L, '.');
- rvar := value;
- for i in 1 to precision loop
- rvar := rvar * 10.0;
- xint := INTEGER(rvar-0.49999999999); -- round
- write (L, xint);
- rvar := rvar - REAL(xint);
- xreal := xreal * 10.0;
- if (cdes = 'g') and (rvar < xreal) then
- exit;
- end if;
- end loop;
- end procedure writefrc;
- -- purpose: replace the "." with a "@", and "e" with "j" to get around
- -- read ("6.") and read ("2e") issues.
- function subdot (
- constant format : STRING)
- return STRING is
- variable result : STRING (format'range);
- begin
- for i in format'range loop
- if (format(i) = '.') then
- result(i) := '@'; -- Because the parser reads 6.2 as REAL
- elsif (format(i) = 'e') then
- result(i) := 'j'; -- Because the parser read 2e as REAL
- elsif (format(i) = 'E') then
- result(i) := 'J'; -- Because the parser reads 2E as REAL
- else
- result(i) := format(i);
- end if;
- end loop;
- return result;
- end function subdot;
- -- purpose: find a . in a STRING
- function isdot (
- constant format : STRING)
- return BOOLEAN is
- begin
- for i in format'range loop
- if (format(i) = '@') then
- return true;
- end if;
- end loop;
- return false;
- end function isdot;
- variable exp : INTEGER; -- integer version of baseexp
- variable bvalue : REAL; -- base value
- variable roundvar, tvar : REAL; -- Rounding values
- variable frcptr : INTEGER; -- integer version of number
- variable fwidth, dwidth : INTEGER; -- field width and decimal width
- variable dash, dot : BOOLEAN := false;
- variable cdes, ddes : CHARACTER := ' ';
- variable L : LINE; -- line type
- begin
- -- Perform the same function that "printf" does
- -- examples "%6.2f" "%-7e" "%g"
- if not (format(format'left) = '%') then
- report "to_string: Illegal format string """ & format & '"'
- severity error;
- return "";
- end if;
- L := new STRING'(subdot(format));
- read (L, ddes); -- toss the '%'
- case L.all(1) is
- when '-' => dash := true;
- when '@' => dash := true; -- in FP, a "-" and a "." are the same
- when 'f' => cdes := 'f';
- when 'F' => cdes := 'F';
- when 'g' => cdes := 'g';
- when 'G' => cdes := 'G';
- when 'j' => cdes := 'e'; -- parser reads 5e as real, thus we sub j
- when 'J' => cdes := 'E';
- when '0'|'1'|'2'|'3'|'4'|'5'|'6'|'7'|'8'|'9' => null;
- when others =>
- report "to_string: Illegal format string """ & format & '"'
- severity error;
- return "";
- end case;
- if (dash or (cdes /= ' ')) then
- read (L, ddes); -- toss the next character
- end if;
- if (cdes = ' ') then
- if (isdot(L.all)) then -- if you see a . two numbers
- read (L, fwidth); -- read field width
- read (L, ddes); -- toss the next character .
- read (L, dwidth); -- read decimal width
- else
- read (L, fwidth); -- read field width
- dwidth := 6; -- the default decimal width is 6
- end if;
- read (L, cdes);
- if (cdes = 'j') then
- cdes := 'e'; -- because 2e reads as "REAL".
- elsif (cdes = 'J') then
- cdes := 'E';
- end if;
- else
- if (cdes = 'E' or cdes = 'e') then
- fwidth := 10; -- default for e and E is %10.6e
- else
- fwidth := 0; -- default for f and g is %0.6f
- end if;
- dwidth := 6;
- end if;
- deallocate (L); -- reclame the pointer L.
--- assert (not debug) report "Format: " & format & " "
--- & INTEGER'image(fwidth) & "." & INTEGER'image(dwidth) & cdes
--- severity note;
- if (not (cdes = 'f' or cdes = 'F' or cdes = 'g' or cdes = 'G'
- or cdes = 'e' or cdes = 'E')) then
- report "to_string: Illegal format """ & format & '"' severity error;
- return "";
- end if;
- if (VALUE < 0.0) then
- bvalue := -value;
- write (L, '-');
- else
- bvalue := value;
- end if;
- case cdes is
- when 'e' | 'E' => -- 7.000E+01
- exp := log10(bvalue);
- roundvar := half*(10.0**(exp-dwidth));
- bvalue := bvalue + roundvar; -- round
- exp := log10(bvalue); -- because we CAN overflow
- bvalue := bvalue * (10.0**(-exp)); -- result is D.XXXXXX
- frcptr := INTEGER(bvalue-half); -- Write a single digit.
- write (L, frcptr);
- bvalue := bvalue - REAL(frcptr);
- writefrc (-- Write out the fraction
- L => L,
- cdes => cdes,
- precision => dwidth,
- value => bvalue);
- write (L, cdes); -- e or E
- if (exp < 0) then
- write (L, '-');
- else
- write (L, '+');
- end if;
- exp := abs(exp);
- if (exp < 10) then -- we need another "0".
- write (L, czero);
- end if;
- write (L, exp);
- when 'f' | 'F' => -- 70.0
- exp := log10(bvalue);
- roundvar := half*(10.0**(-dwidth));
- bvalue := bvalue + roundvar; -- round
- exp := log10(bvalue); -- because we CAN overflow
- if (exp < 0) then -- 0.X case
- write (L, czero);
- else -- loop because real'high > integer'high
- while (exp >= 0) loop
- frcptr := INTEGER(bvalue * (10.0**(-exp)) - half);
- write (L, frcptr);
- bvalue := bvalue - (REAL(frcptr) * (10.0**exp));
- exp := exp-1;
- end loop;
- end if;
- writefrc (
- L => L,
- cdes => cdes,
- precision => dwidth,
- value => bvalue);
- when 'g' | 'G' => -- 70
- exp := log10(bvalue);
- roundvar := half*(10.0**(exp-dwidth)); -- small number
- bvalue := bvalue + roundvar; -- round
- exp := log10(bvalue); -- because we CAN overflow
- frcptr := INTEGER(bvalue-half);
- tvar := bvalue-roundvar - REAL(frcptr); -- even smaller number
- if (exp < dwidth)
- and (tvar < roundvar and tvar > -roundvar) then
--- and ((bvalue-roundvar) = real(frcptr)) then
- write (L, frcptr); -- Just a short integer, write it.
- elsif (exp >= dwidth) or (exp < -4) then
- -- in "e" format (modified)
- bvalue := bvalue * (10.0**(-exp)); -- result is D.XXXXXX
- frcptr := INTEGER(bvalue-half);
- write (L, frcptr);
- bvalue := bvalue - REAL(frcptr);
- if (bvalue > (10.0**(1-dwidth))) then
- dwidth := dwidth - 1;
- writefrc (
- L => L,
- cdes => cdes,
- precision => dwidth,
- value => bvalue);
- end if;
- if (cdes = 'G') then
- write (L, 'E');
- else
- write (L, 'e');
- end if;
- if (exp < 0) then
- write (L, '-');
- else
- write (L, '+');
- end if;
- exp := abs(exp);
- if (exp < 10) then
- write (L, czero);
- end if;
- write (L, exp);
- else
- -- in "f" format (modified)
- if (exp < 0) then
- write (L, czero);
- dwidth := maximum (dwidth, 4); -- if exp < -4 or > precision.
- bvalue := bvalue - roundvar; -- recalculate rounding
- roundvar := half*(10.0**(-dwidth));
- bvalue := bvalue + roundvar;
- else
- write (L, frcptr); -- integer part (always small)
- bvalue := bvalue - (REAL(frcptr));
- dwidth := dwidth - exp - 1;
- end if;
- if (bvalue > roundvar) then
- writefrc (
- L => L,
- cdes => cdes,
- precision => dwidth,
- value => bvalue);
- end if;
- end if;
- when others => return "";
- end case;
- -- You don't truncate real numbers.
--- if (dot) then -- truncate
--- if (L.all'length > fwidth) then
--- return justify (value => L.all (1 to fwidth),
--- justified => RIGHT,
--- field => fwidth);
--- else
--- return justify (value => L.all,
--- justified => RIGHT,
--- field => fwidth);
--- end if;
- if (dash) then -- fill to fwidth
- return justify (value => L.all,
- justified => left,
- field => fwidth);
- else
- return justify (value => L.all,
- justified => right,
- field => fwidth);
- end if;
- end function to_string;
-
-end package body standard_additions;
diff --git a/ieee_proposed/rtl/standard_textio_additions_c.vhd b/ieee_proposed/rtl/standard_textio_additions_c.vhd
deleted file mode 100644
index 35ed5d0..0000000
--- a/ieee_proposed/rtl/standard_textio_additions_c.vhd
+++ /dev/null
@@ -1,478 +0,0 @@
-------------------------------------------------------------------------------
--- "standard_textio_additions" package contains the additions to the built in
--- "standard.textio" package.
--- This package should be compiled into "ieee_proposed" and used as follows:
--- use ieee_proposed.standard_textio_additions.all;
--- Last Modified: $Date: 2007-03-13 14:25:58-04 $
--- RCS ID: $Id: standard_textio_additions_c.vhdl,v 1.5 2007-03-13 14:25:58-04 l435385 Exp $
---
--- Created for VHDL-200X par, David Bishop (dbishop@vhdl.org)
-------------------------------------------------------------------------------
-use std.textio.all;
-package standard_textio_additions is
-
--- procedure DEALLOCATE (P : inout LINE);
-
- procedure FLUSH (file F : TEXT);
-
- function MINIMUM (L, R : SIDE) return SIDE;
- function MAXIMUM (L, R : SIDE) return SIDE;
-
- function TO_STRING (VALUE : SIDE) return STRING;
-
- function JUSTIFY (VALUE : STRING; JUSTIFIED : SIDE := right; FIELD : WIDTH := 0) return STRING;
-
- procedure SREAD (L : inout LINE; VALUE : out STRING; STRLEN : out NATURAL);
- alias STRING_READ is SREAD [LINE, STRING, NATURAL];
- alias BREAD is READ [LINE, BIT_VECTOR, BOOLEAN];
- alias BREAD is READ [LINE, BIT_VECTOR];
- alias BINARY_READ is READ [LINE, BIT_VECTOR, BOOLEAN];
- alias BINARY_READ is READ [LINE, BIT_VECTOR];
- procedure OREAD (L : inout LINE; VALUE : out BIT_VECTOR; GOOD : out BOOLEAN);
- procedure OREAD (L : inout LINE; VALUE : out BIT_VECTOR);
- alias OCTAL_READ is OREAD [LINE, BIT_VECTOR, BOOLEAN];
- alias OCTAL_READ is OREAD [LINE, BIT_VECTOR];
- procedure HREAD (L : inout LINE; VALUE : out BIT_VECTOR; GOOD : out BOOLEAN);
- procedure HREAD (L : inout LINE; VALUE : out BIT_VECTOR);
- alias HEX_READ is HREAD [LINE, BIT_VECTOR, BOOLEAN];
- alias HEX_READ is HREAD [LINE, BIT_VECTOR];
- procedure TEE (file F : TEXT; L : inout LINE);
- procedure WRITE (L : inout LINE; VALUE : in REAL;
- FORMAT : in STRING);
- alias SWRITE is WRITE [LINE, STRING, SIDE, WIDTH];
- alias STRING_WRITE is WRITE [LINE, STRING, SIDE, WIDTH];
- alias BWRITE is WRITE [LINE, BIT_VECTOR, SIDE, WIDTH];
- alias BINARY_WRITE is WRITE [LINE, BIT_VECTOR, SIDE, WIDTH];
- procedure OWRITE (L : inout LINE; VALUE : in BIT_VECTOR;
- JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0);
- alias OCTAL_WRITE is OWRITE [LINE, BIT_VECTOR, SIDE, WIDTH];
- procedure HWRITE (L : inout LINE; VALUE : in BIT_VECTOR;
- JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0);
- alias HEX_WRITE is HWRITE [LINE, BIT_VECTOR, SIDE, WIDTH];
-
-end package standard_textio_additions;
-
-library ieee_proposed;
-use ieee_proposed.standard_additions.all;
-
-package body standard_textio_additions is
--- pragma synthesis_off
- constant NUS : STRING(2 to 1) := (others => ' '); -- NULL array
- constant NBSP : CHARACTER := CHARACTER'val(160); -- space character
-
- -- Writes L to a file without modifying the contents of the line
- procedure TEE (file F : TEXT; L : inout LINE) is
- begin
- write (OUTPUT, L.all & LF);
- writeline(F, L);
- end procedure TEE;
-
- procedure FLUSH (file F: TEXT) is -- Implicit
- begin
- file_close (F);
- end procedure FLUSH;
-
- -- Read and Write procedure for strings
- procedure SREAD (L : inout LINE;
- VALUE : out STRING;
- STRLEN : out natural) is
- variable ok : BOOLEAN;
- variable c : CHARACTER;
- -- Result is padded with space characters
- variable result : STRING (1 to VALUE'length) := (others => ' ');
- begin
- VALUE := result;
- loop -- skip white space
- read(L, c, ok);
- exit when (ok = false) or ((c /= ' ') and (c /= NBSP) and (c /= HT));
- end loop;
- -- Bail out if there was a bad read
- if not ok then
- STRLEN := 0;
- return;
- end if;
- result (1) := c;
- STRLEN := 1;
- for i in 2 to VALUE'length loop
- read(L, c, ok);
- if (ok = false) or ((c = ' ') or (c = NBSP) or (c = HT)) then
- exit;
- else
- result (i) := c;
- end if;
- STRLEN := i;
- end loop;
- VALUE := result;
- end procedure SREAD;
-
- -- Hex Read and Write procedures for bit_vector.
- -- Procedure only visible internally.
- procedure Char2QuadBits (C : CHARACTER;
- RESULT : out BIT_VECTOR(3 downto 0);
- GOOD : out BOOLEAN;
- ISSUE_ERROR : in BOOLEAN) is
- begin
- case c is
- when '0' => result := x"0"; good := true;
- when '1' => result := x"1"; good := true;
- when '2' => result := x"2"; good := true;
- when '3' => result := x"3"; good := true;
- when '4' => result := x"4"; good := true;
- when '5' => result := x"5"; good := true;
- when '6' => result := x"6"; good := true;
- when '7' => result := x"7"; good := true;
- when '8' => result := x"8"; good := true;
- when '9' => result := x"9"; good := true;
- when 'A' | 'a' => result := x"A"; good := true;
- when 'B' | 'b' => result := x"B"; good := true;
- when 'C' | 'c' => result := x"C"; good := true;
- when 'D' | 'd' => result := x"D"; good := true;
- when 'E' | 'e' => result := x"E"; good := true;
- when 'F' | 'f' => result := x"F"; good := true;
- when others =>
- assert not ISSUE_ERROR report
- "TEXTIO.HREAD Error: Read a '" & c &
- "', expected a Hex character (0-F)." severity error;
- GOOD := false;
- end case;
- end procedure Char2QuadBits;
-
- procedure HREAD (L : inout LINE;
- VALUE : out BIT_VECTOR;
- GOOD : out BOOLEAN) is
- variable ok : BOOLEAN;
- variable c : CHARACTER;
- constant ne : INTEGER := (VALUE'length+3)/4;
- constant pad : INTEGER := ne*4 - VALUE'length;
- variable sv : BIT_VECTOR (0 to ne*4 - 1) := (others => '0');
- variable s : STRING(1 to ne-1);
- begin
- VALUE := (VALUE'range => '0');
- loop -- skip white space
- read(l, c, ok);
- exit when (ok = false) or ((c /= ' ') and (c /= NBSP) and (c /= HT));
- end loop;
- -- Bail out if there was a bad read
- if not ok then
- GOOD := false;
- return;
- end if;
- Char2QuadBits(c, sv(0 to 3), ok, false);
- if not ok then
- GOOD := false;
- return;
- end if;
- read(L, s, ok);
- if not ok then
- GOOD := false;
- return;
- end if;
- for i in 1 to ne-1 loop
- Char2QuadBits(s(i), sv(4*i to 4*i+3), ok, false);
- if not ok then
- GOOD := false;
- return;
- end if;
- end loop;
- if or_reduce (sv (0 to pad-1)) = '1' then
- GOOD := false; -- vector was truncated.
- else
- GOOD := true;
- VALUE := sv (pad to sv'high);
- end if;
- end procedure HREAD;
-
- procedure HREAD (L : inout LINE;
- VALUE : out BIT_VECTOR) is
- variable ok : BOOLEAN;
- variable c : CHARACTER;
- constant ne : INTEGER := (VALUE'length+3)/4;
- constant pad : INTEGER := ne*4 - VALUE'length;
- variable sv : BIT_VECTOR(0 to ne*4 - 1) := (others => '0');
- variable s : STRING(1 to ne-1);
- begin
- VALUE := (VALUE'range => '0');
- loop -- skip white space
- read(l, c, ok);
- exit when (ok = false) or ((c /= ' ') and (c /= NBSP) and (c /= HT));
- end loop;
- -- Bail out if there was a bad read
- if not ok then
- report "TEXTIO.HREAD Error: Failed skipping white space"
- severity error;
- return;
- end if;
- Char2QuadBits(c, sv(0 to 3), ok, true);
- if not ok then
- return;
- end if;
- read(L, s, ok);
- if not ok then
- report "TEXTIO.HREAD Error: Failed to read the STRING"
- severity error;
- return;
- end if;
- for i in 1 to ne-1 loop
- Char2QuadBits(s(i), sv(4*i to 4*i+3), ok, true);
- if not ok then
- return;
- end if;
- end loop;
- if or_reduce (sv (0 to pad-1)) = '1' then
- report "TEXTIO.HREAD Error: Vector truncated"
- severity error;
- else
- VALUE := sv (pad to sv'high);
- end if;
- end procedure HREAD;
-
- procedure HWRITE (L : inout LINE;
- VALUE : in BIT_VECTOR;
- JUSTIFIED : in SIDE := right;
- FIELD : in WIDTH := 0) is
- begin
- write (L => L,
- VALUE => to_hstring(VALUE),
- JUSTIFIED => JUSTIFIED,
- FIELD => FIELD);
- end procedure HWRITE;
-
- -- Procedure only visible internally.
- procedure Char2TriBits (C : CHARACTER;
- RESULT : out BIT_VECTOR(2 downto 0);
- GOOD : out BOOLEAN;
- ISSUE_ERROR : in BOOLEAN) is
- begin
- case c is
- when '0' => result := o"0"; good := true;
- when '1' => result := o"1"; good := true;
- when '2' => result := o"2"; good := true;
- when '3' => result := o"3"; good := true;
- when '4' => result := o"4"; good := true;
- when '5' => result := o"5"; good := true;
- when '6' => result := o"6"; good := true;
- when '7' => result := o"7"; good := true;
- when others =>
- assert not ISSUE_ERROR
- report
- "TEXTIO.OREAD Error: Read a '" & c &
- "', expected an Octal character (0-7)."
- severity error;
- GOOD := false;
- end case;
- end procedure Char2TriBits;
-
- -- Read and Write procedures for Octal values
- procedure OREAD (L : inout LINE;
- VALUE : out BIT_VECTOR;
- GOOD : out BOOLEAN) is
- variable ok : BOOLEAN;
- variable c : CHARACTER;
- constant ne : INTEGER := (VALUE'length+2)/3;
- constant pad : INTEGER := ne*3 - VALUE'length;
- variable sv : BIT_VECTOR(0 to ne*3 - 1) := (others => '0');
- variable s : STRING(1 to ne-1);
- begin
- VALUE := (VALUE'range => '0');
- loop -- skip white space
- read(l, c, ok);
- exit when (ok = false) or ((c /= ' ') and (c /= NBSP) and (c /= HT));
- end loop;
- -- Bail out if there was a bad read
- if not ok then
- GOOD := false;
- return;
- end if;
- Char2TriBits(c, sv(0 to 2), ok, false);
- if not ok then
- GOOD := false;
- return;
- end if;
- read(L, s, ok);
- if not ok then
- GOOD := false;
- return;
- end if;
- for i in 1 to ne-1 loop
- Char2TriBits(s(i), sv(3*i to 3*i+2), ok, false);
- if not ok then
- GOOD := false;
- return;
- end if;
- end loop;
- if or_reduce (sv (0 to pad-1)) = '1' then
- GOOD := false; -- vector was truncated.
- else
- GOOD := true;
- VALUE := sv (pad to sv'high);
- end if;
- end procedure OREAD;
-
- procedure OREAD (L : inout LINE;
- VALUE : out BIT_VECTOR) is
- variable c : CHARACTER;
- variable ok : BOOLEAN;
- constant ne : INTEGER := (VALUE'length+2)/3;
- constant pad : INTEGER := ne*3 - VALUE'length;
- variable sv : BIT_VECTOR(0 to ne*3 - 1) := (others => '0');
- variable s : STRING(1 to ne-1);
- begin
- VALUE := (VALUE'range => '0');
- loop -- skip white space
- read(l, c, ok);
- exit when (ok = false) or ((c /= ' ') and (c /= NBSP) and (c /= HT));
- end loop;
- -- Bail out if there was a bad read
- if not ok then
- report "TEXTIO.OREAD Error: Failed skipping white space"
- severity error;
- return;
- end if;
- Char2TriBits(c, sv(0 to 2), ok, true);
- if not ok then
- return;
- end if;
- read(L, s, ok);
- if not ok then
- report "TEXTIO.OREAD Error: Failed to read the STRING"
- severity error;
- return;
- end if;
- for i in 1 to ne-1 loop
- Char2TriBits(s(i), sv(3*i to 3*i+2), ok, true);
- if not ok then
- return;
- end if;
- end loop;
- if or_reduce (sv (0 to pad-1)) = '1' then
- report "TEXTIO.OREAD Error: Vector truncated"
- severity error;
- else
- VALUE := sv (pad to sv'high);
- end if;
- end procedure OREAD;
-
- procedure OWRITE (L : inout LINE;
- VALUE : in BIT_VECTOR;
- JUSTIFIED : in SIDE := right;
- FIELD : in WIDTH := 0) is
- begin
- write (L => L,
- VALUE => to_ostring(VALUE),
- JUSTIFIED => JUSTIFIED,
- FIELD => FIELD);
- end procedure OWRITE;
-
- -- read and write for vector versions
- -- These versions produce "value1, value2, value3 ...."
- procedure read (L : inout LINE;
- VALUE : out boolean_vector;
- GOOD : out BOOLEAN) is
- variable dummy : CHARACTER;
- variable igood : BOOLEAN := true;
- begin
- for i in VALUE'range loop
- read (L => L,
- VALUE => VALUE(i),
- GOOD => igood);
- if (igood) and (i /= value'right) then
- read (L => L,
- VALUE => dummy, -- Toss the comma or seperator
- good => igood);
- end if;
- if (not igood) then
- good := false;
- return;
- end if;
- end loop;
- good := true;
- end procedure read;
-
- procedure read (L : inout LINE;
- VALUE : out boolean_vector) is
- variable dummy : CHARACTER;
- variable igood : BOOLEAN;
- begin
- for i in VALUE'range loop
- read (L => L,
- VALUE => VALUE(i),
- good => igood);
- if (igood) and (i /= value'right) then
- read (L => L,
- VALUE => dummy, -- Toss the comma or seperator
- good => igood);
- end if;
- if (not igood) then
- report "STANDARD.STD_TEXTIO(BOOLEAN_VECTOR) "
- & "Read error ecounted during vector read" severity error;
- return;
- end if;
- end loop;
- end procedure read;
-
- procedure write (L : inout LINE;
- VALUE : in boolean_vector;
- JUSTIFIED : in SIDE := right;
- FIELD : in WIDTH := 0) is
- begin
- for i in VALUE'range loop
- write (L => L,
- VALUE => VALUE(i),
- JUSTIFIED => JUSTIFIED,
- FIELD => FIELD);
- if (i /= value'right) then
- swrite (L, ", ");
- end if;
- end loop;
- end procedure write;
-
- procedure WRITE (L: inout LINE; VALUE: in REAL;
- FORMAT: in STRING) is
- begin
- swrite ( L => L,
- VALUE => to_string (VALUE, FORMAT));
- end procedure WRITE;
-
- function justify (
- value : STRING;
- justified : SIDE := right;
- field : width := 0)
- return STRING is
- constant VAL_LEN : INTEGER := value'length;
- variable result : STRING (1 to field) := (others => ' ');
- begin -- function justify
- -- return value if field is too small
- if VAL_LEN >= field then
- return value;
- end if;
- if justified = left then
- result(1 to VAL_LEN) := value;
- elsif justified = right then
- result(field - VAL_LEN + 1 to field) := value;
- end if;
- return result;
- end function justify;
-
- function to_string (
- VALUE : SIDE) return STRING is
- begin
- return SIDE'image(VALUE);
- end function to_string;
-
- -- pragma synthesis_on
- -- Will be implicit
- function minimum (L, R : SIDE) return SIDE is
- begin
- if L > R then return R;
- else return L;
- end if;
- end function minimum;
-
- function maximum (L, R : SIDE) return SIDE is
- begin
- if L > R then return L;
- else return R;
- end if;
- end function maximum;
-
-end package body standard_textio_additions;
diff --git a/ieee_proposed/rtl/std_logic_1164_additions.vhd b/ieee_proposed/rtl/std_logic_1164_additions.vhd
deleted file mode 100644
index 0c71490..0000000
--- a/ieee_proposed/rtl/std_logic_1164_additions.vhd
+++ /dev/null
@@ -1,1808 +0,0 @@
-------------------------------------------------------------------------------
--- "std_logic_1164_additions" package contains the additions to the standard
--- "std_logic_1164" package proposed by the VHDL-200X-ft working group.
--- This package should be compiled into "ieee_proposed" and used as follows:
--- use ieee.std_logic_1164.all;
--- use ieee_proposed.std_logic_1164_additions.all;
--- Last Modified: $Date: 2007-09-11 14:52:13-04 $
--- RCS ID: $Id: std_logic_1164_additions.vhdl,v 1.12 2007-09-11 14:52:13-04 l435385 Exp $
---
--- Created for VHDL-200X par, David Bishop (dbishop@vhdl.org)
-------------------------------------------------------------------------------
-library ieee;
-use ieee.std_logic_1164.all;
-use std.textio.all;
-package std_logic_1164_additions is
-
- -- NOTE that in the new std_logic_1164, STD_LOGIC_VECTOR is a resolved
- -- subtype of STD_ULOGIC_VECTOR. Thus there is no need for funcitons which
- -- take inputs in STD_LOGIC_VECTOR.
- -- For compatability with VHDL-2002, I have replicated all of these funcitons
- -- here for STD_LOGIC_VECTOR.
- -- new aliases
--- alias to_bv is ieee.std_logic_1164.To_bitvector [STD_LOGIC_VECTOR, BIT return BIT_VECTOR];
--- alias to_bv is ieee.std_logic_1164.To_bitvector [STD_ULOGIC_VECTOR, BIT return BIT_VECTOR];
--- alias to_bit_vector is ieee.std_logic_1164.To_bitvector [STD_LOGIC_VECTOR, BIT return BIT_VECTOR];
--- alias to_bit_vector is ieee.std_logic_1164.To_bitvector [STD_ULOGIC_VECTOR, BIT return BIT_VECTOR];
--- alias to_slv is ieee.std_logic_1164.To_StdLogicVector [BIT_VECTOR return STD_LOGIC_VECTOR];
--- alias to_slv is ieee.std_logic_1164.To_StdLogicVector [STD_ULOGIC_VECTOR return STD_LOGIC_VECTOR];
--- alias to_std_logic_vector is ieee.std_logic_1164.To_StdLogicVector [BIT_VECTOR return STD_LOGIC_VECTOR];
--- alias to_std_logic_vector is ieee.std_logic_1164.To_StdLogicVector [STD_ULOGIC_VECTOR return STD_LOGIC_VECTOR];
--- alias to_sulv is ieee.std_logic_1164.To_StdULogicVector [BIT_VECTOR return STD_ULOGIC_VECTOR];
--- alias to_sulv is ieee.std_logic_1164.To_StdULogicVector [STD_LOGIC_VECTOR return STD_ULOGIC_VECTOR];
--- alias to_std_ulogic_vector is ieee.std_logic_1164.To_StdULogicVector [BIT_VECTOR return STD_ULOGIC_VECTOR];
--- alias to_std_ulogic_vector is ieee.std_logic_1164.To_StdULogicVector [STD_LOGIC_VECTOR return STD_ULOGIC_VECTOR];
-
- function TO_01 (s : STD_ULOGIC_VECTOR; xmap : STD_ULOGIC := '0')
- return STD_ULOGIC_VECTOR;
- function TO_01 (s : STD_ULOGIC; xmap : STD_ULOGIC := '0')
- return STD_ULOGIC;
- function TO_01 (s : BIT_VECTOR; xmap : STD_ULOGIC := '0')
- return STD_ULOGIC_VECTOR;
- function TO_01 (s : BIT; xmap : STD_ULOGIC := '0')
- return STD_ULOGIC;
-
- -------------------------------------------------------------------
- -- overloaded shift operators
- -------------------------------------------------------------------
-
- function "sll" (l : STD_LOGIC_VECTOR; r : INTEGER) return STD_LOGIC_VECTOR;
- function "sll" (l : STD_ULOGIC_VECTOR; r : INTEGER) return STD_ULOGIC_VECTOR;
-
- function "srl" (l : STD_LOGIC_VECTOR; r : INTEGER) return STD_LOGIC_VECTOR;
- function "srl" (l : STD_ULOGIC_VECTOR; r : INTEGER) return STD_ULOGIC_VECTOR;
-
- function "rol" (l : STD_LOGIC_VECTOR; r : INTEGER) return STD_LOGIC_VECTOR;
- function "rol" (l : STD_ULOGIC_VECTOR; r : INTEGER) return STD_ULOGIC_VECTOR;
-
- function "ror" (l : STD_LOGIC_VECTOR; r : INTEGER) return STD_LOGIC_VECTOR;
- function "ror" (l : STD_ULOGIC_VECTOR; r : INTEGER) return STD_ULOGIC_VECTOR;
- -------------------------------------------------------------------
- -- vector/scalar overloaded logical operators
- -------------------------------------------------------------------
- function "and" (l : STD_LOGIC_VECTOR; r : STD_ULOGIC) return STD_LOGIC_VECTOR;
- function "and" (l : STD_ULOGIC_VECTOR; r : STD_ULOGIC) return STD_ULOGIC_VECTOR;
- function "and" (l : STD_ULOGIC; r : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
- function "and" (l : STD_ULOGIC; r : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
- function "nand" (l : STD_LOGIC_VECTOR; r : STD_ULOGIC) return STD_LOGIC_VECTOR;
- function "nand" (l : STD_ULOGIC_VECTOR; r : STD_ULOGIC) return STD_ULOGIC_VECTOR;
- function "nand" (l : STD_ULOGIC; r : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
- function "nand" (l : STD_ULOGIC; r : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
- function "or" (l : STD_LOGIC_VECTOR; r : STD_ULOGIC) return STD_LOGIC_VECTOR;
- function "or" (l : STD_ULOGIC_VECTOR; r : STD_ULOGIC) return STD_ULOGIC_VECTOR;
- function "or" (l : STD_ULOGIC; r : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
- function "or" (l : STD_ULOGIC; r : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
- function "nor" (l : STD_LOGIC_VECTOR; r : STD_ULOGIC) return STD_LOGIC_VECTOR;
- function "nor" (l : STD_ULOGIC_VECTOR; r : STD_ULOGIC) return STD_ULOGIC_VECTOR;
- function "nor" (l : STD_ULOGIC; r : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
- function "nor" (l : STD_ULOGIC; r : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
- function "xor" (l : STD_LOGIC_VECTOR; r : STD_ULOGIC) return STD_LOGIC_VECTOR;
- function "xor" (l : STD_ULOGIC_VECTOR; r : STD_ULOGIC) return STD_ULOGIC_VECTOR;
- function "xor" (l : STD_ULOGIC; r : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
- function "xor" (l : STD_ULOGIC; r : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
- function "xnor" (l : STD_LOGIC_VECTOR; r : STD_ULOGIC) return STD_LOGIC_VECTOR;
- function "xnor" (l : STD_ULOGIC_VECTOR; r : STD_ULOGIC) return STD_ULOGIC_VECTOR;
- function "xnor" (l : STD_ULOGIC; r : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
- function "xnor" (l : STD_ULOGIC; r : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
-
- -------------------------------------------------------------------
- -- vector-reduction functions.
- -- "and" functions default to "1", or defaults to "0"
- -------------------------------------------------------------------
- -----------------------------------------------------------------------------
- -- %%% Replace the "_reduce" functions with the ones commented out below.
- -----------------------------------------------------------------------------
- -- function "and" ( l : std_logic_vector ) RETURN std_ulogic;
- -- function "and" ( l : std_ulogic_vector ) RETURN std_ulogic;
- -- function "nand" ( l : std_logic_vector ) RETURN std_ulogic;
- -- function "nand" ( l : std_ulogic_vector ) RETURN std_ulogic;
- -- function "or" ( l : std_logic_vector ) RETURN std_ulogic;
- -- function "or" ( l : std_ulogic_vector ) RETURN std_ulogic;
- -- function "nor" ( l : std_logic_vector ) RETURN std_ulogic;
- -- function "nor" ( l : std_ulogic_vector ) RETURN std_ulogic;
- -- function "xor" ( l : std_logic_vector ) RETURN std_ulogic;
- -- function "xor" ( l : std_ulogic_vector ) RETURN std_ulogic;
- -- function "xnor" ( l : std_logic_vector ) RETURN std_ulogic;
- -- function "xnor" ( l : std_ulogic_vector ) RETURN std_ulogic;
- function and_reduce (l : STD_LOGIC_VECTOR) return STD_ULOGIC;
- function and_reduce (l : STD_ULOGIC_VECTOR) return STD_ULOGIC;
- function nand_reduce (l : STD_LOGIC_VECTOR) return STD_ULOGIC;
- function nand_reduce (l : STD_ULOGIC_VECTOR) return STD_ULOGIC;
- function or_reduce (l : STD_LOGIC_VECTOR) return STD_ULOGIC;
- function or_reduce (l : STD_ULOGIC_VECTOR) return STD_ULOGIC;
- function nor_reduce (l : STD_LOGIC_VECTOR) return STD_ULOGIC;
- function nor_reduce (l : STD_ULOGIC_VECTOR) return STD_ULOGIC;
- function xor_reduce (l : STD_LOGIC_VECTOR) return STD_ULOGIC;
- function xor_reduce (l : STD_ULOGIC_VECTOR) return STD_ULOGIC;
- function xnor_reduce (l : STD_LOGIC_VECTOR) return STD_ULOGIC;
- function xnor_reduce (l : STD_ULOGIC_VECTOR) return STD_ULOGIC;
- -------------------------------------------------------------------
- -- ?= operators, same functionality as 1076.3 1994 std_match
- -------------------------------------------------------------------
--- FUNCTION "?=" ( l, r : std_ulogic ) RETURN std_ulogic;
--- FUNCTION "?=" ( l, r : std_logic_vector ) RETURN std_ulogic;
--- FUNCTION "?=" ( l, r : std_ulogic_vector ) RETURN std_ulogic;
--- FUNCTION "?/=" ( l, r : std_ulogic ) RETURN std_ulogic;
--- FUNCTION "?/=" ( l, r : std_logic_vector ) RETURN std_ulogic;
--- FUNCTION "?/=" ( l, r : std_ulogic_vector ) RETURN std_ulogic;
--- FUNCTION "?>" ( l, r : std_ulogic ) RETURN std_ulogic;
--- FUNCTION "?>=" ( l, r : std_ulogic ) RETURN std_ulogic;
--- FUNCTION "?<" ( l, r : std_ulogic ) RETURN std_ulogic;
--- FUNCTION "?<=" ( l, r : std_ulogic ) RETURN std_ulogic;
-
--- function \?=\ (l, r : STD_ULOGIC) return STD_ULOGIC;
--- function \?=\ (l, r : STD_LOGIC_VECTOR) return STD_ULOGIC;
--- function \?=\ (l, r : STD_ULOGIC_VECTOR) return STD_ULOGIC;
--- function \?/=\ (l, r : STD_ULOGIC) return STD_ULOGIC;
--- function \?/=\ (l, r : STD_LOGIC_VECTOR) return STD_ULOGIC;
--- function \?/=\ (l, r : STD_ULOGIC_VECTOR) return STD_ULOGIC;
- function \?>\ (l, r : STD_ULOGIC) return STD_ULOGIC;
- function \?>=\ (l, r : STD_ULOGIC) return STD_ULOGIC;
- function \?<\ (l, r : STD_ULOGIC) return STD_ULOGIC;
- function \?<=\ (l, r : STD_ULOGIC) return STD_ULOGIC;
-
-
- -- "??" operator, converts a std_ulogic to a boolean.
- --%%% Uncomment the following operators
- -- FUNCTION "??" (S : STD_ULOGIC) RETURN BOOLEAN;
- --%%% REMOVE the following funciton (for testing only)
- function \??\ (S : STD_ULOGIC) return BOOLEAN;
-
- -- rtl_synthesis off
--- pragma synthesis_off
- function to_string (value : STD_ULOGIC) return STRING;
- function to_string (value : STD_ULOGIC_VECTOR) return STRING;
- function to_string (value : STD_LOGIC_VECTOR) return STRING;
-
- -- explicitly defined operations
-
- alias TO_BSTRING is TO_STRING [STD_ULOGIC_VECTOR return STRING];
- alias TO_BINARY_STRING is TO_STRING [STD_ULOGIC_VECTOR return STRING];
- function TO_OSTRING (VALUE : STD_ULOGIC_VECTOR) return STRING;
- alias TO_OCTAL_STRING is TO_OSTRING [STD_ULOGIC_VECTOR return STRING];
- function TO_HSTRING (VALUE : STD_ULOGIC_VECTOR) return STRING;
- alias TO_HEX_STRING is TO_HSTRING [STD_ULOGIC_VECTOR return STRING];
-
- procedure READ (L : inout LINE; VALUE : out STD_ULOGIC; GOOD : out BOOLEAN);
- procedure READ (L : inout LINE; VALUE : out STD_ULOGIC);
-
- procedure READ (L : inout LINE; VALUE : out STD_ULOGIC_VECTOR; GOOD : out BOOLEAN);
- procedure READ (L : inout LINE; VALUE : out STD_ULOGIC_VECTOR);
-
- procedure WRITE (L : inout LINE; VALUE : in STD_ULOGIC;
- JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0);
-
- procedure WRITE (L : inout LINE; VALUE : in STD_ULOGIC_VECTOR;
- JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0);
-
- alias BREAD is READ [LINE, STD_ULOGIC_VECTOR, BOOLEAN];
- alias BREAD is READ [LINE, STD_ULOGIC_VECTOR];
- alias BINARY_READ is READ [LINE, STD_ULOGIC_VECTOR, BOOLEAN];
- alias BINARY_READ is READ [LINE, STD_ULOGIC_VECTOR];
-
- procedure OREAD (L : inout LINE; VALUE : out STD_ULOGIC_VECTOR; GOOD : out BOOLEAN);
- procedure OREAD (L : inout LINE; VALUE : out STD_ULOGIC_VECTOR);
- alias OCTAL_READ is OREAD [LINE, STD_ULOGIC_VECTOR, BOOLEAN];
- alias OCTAL_READ is OREAD [LINE, STD_ULOGIC_VECTOR];
-
- procedure HREAD (L : inout LINE; VALUE : out STD_ULOGIC_VECTOR; GOOD : out BOOLEAN);
- procedure HREAD (L : inout LINE; VALUE : out STD_ULOGIC_VECTOR);
- alias HEX_READ is HREAD [LINE, STD_ULOGIC_VECTOR, BOOLEAN];
- alias HEX_READ is HREAD [LINE, STD_ULOGIC_VECTOR];
-
- alias BWRITE is WRITE [LINE, STD_ULOGIC_VECTOR, SIDE, WIDTH];
- alias BINARY_WRITE is WRITE [LINE, STD_ULOGIC_VECTOR, SIDE, WIDTH];
-
- procedure OWRITE (L : inout LINE; VALUE : in STD_ULOGIC_VECTOR;
- JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0);
- alias OCTAL_WRITE is OWRITE [LINE, STD_ULOGIC_VECTOR, SIDE, WIDTH];
-
- procedure HWRITE (L : inout LINE; VALUE : in STD_ULOGIC_VECTOR;
- JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0);
- alias HEX_WRITE is HWRITE [LINE, STD_ULOGIC_VECTOR, SIDE, WIDTH];
-
- alias TO_BSTRING is TO_STRING [STD_LOGIC_VECTOR return STRING];
- alias TO_BINARY_STRING is TO_STRING [STD_LOGIC_VECTOR return STRING];
- function TO_OSTRING (VALUE : STD_LOGIC_VECTOR) return STRING;
- alias TO_OCTAL_STRING is TO_OSTRING [STD_LOGIC_VECTOR return STRING];
- function TO_HSTRING (VALUE : STD_LOGIC_VECTOR) return STRING;
- alias TO_HEX_STRING is TO_HSTRING [STD_LOGIC_VECTOR return STRING];
-
- procedure READ (L : inout LINE; VALUE : out STD_LOGIC_VECTOR; GOOD : out BOOLEAN);
- procedure READ (L : inout LINE; VALUE : out STD_LOGIC_VECTOR);
-
- procedure WRITE (L : inout LINE; VALUE : in STD_LOGIC_VECTOR;
- JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0);
-
- alias BREAD is READ [LINE, STD_LOGIC_VECTOR, BOOLEAN];
- alias BREAD is READ [LINE, STD_LOGIC_VECTOR];
- alias BINARY_READ is READ [LINE, STD_LOGIC_VECTOR, BOOLEAN];
- alias BINARY_READ is READ [LINE, STD_LOGIC_VECTOR];
-
- procedure OREAD (L : inout LINE; VALUE : out STD_LOGIC_VECTOR; GOOD : out BOOLEAN);
- procedure OREAD (L : inout LINE; VALUE : out STD_LOGIC_VECTOR);
- alias OCTAL_READ is OREAD [LINE, STD_LOGIC_VECTOR, BOOLEAN];
- alias OCTAL_READ is OREAD [LINE, STD_LOGIC_VECTOR];
-
- procedure HREAD (L : inout LINE; VALUE : out STD_LOGIC_VECTOR; GOOD : out BOOLEAN);
- procedure HREAD (L : inout LINE; VALUE : out STD_LOGIC_VECTOR);
- alias HEX_READ is HREAD [LINE, STD_LOGIC_VECTOR, BOOLEAN];
- alias HEX_READ is HREAD [LINE, STD_LOGIC_VECTOR];
-
- alias BWRITE is WRITE [LINE, STD_LOGIC_VECTOR, SIDE, WIDTH];
- alias BINARY_WRITE is WRITE [LINE, STD_LOGIC_VECTOR, SIDE, WIDTH];
-
- procedure OWRITE (L : inout LINE; VALUE : in STD_LOGIC_VECTOR;
- JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0);
- alias OCTAL_WRITE is OWRITE [LINE, STD_LOGIC_VECTOR, SIDE, WIDTH];
-
- procedure HWRITE (L : inout LINE; VALUE : in STD_LOGIC_VECTOR;
- JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0);
- alias HEX_WRITE is HWRITE [LINE, STD_LOGIC_VECTOR, SIDE, WIDTH];
- -- rtl_synthesis on
--- pragma synthesis_on
- function maximum (l, r : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
- function maximum (l, r : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
- function maximum (l, r : STD_ULOGIC) return STD_ULOGIC;
- function minimum (l, r : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
- function minimum (l, r : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
- function minimum (l, r : STD_ULOGIC) return STD_ULOGIC;
-end package std_logic_1164_additions;
-
-package body std_logic_1164_additions is
--- type stdlogic_table is array(STD_ULOGIC, STD_ULOGIC) of STD_ULOGIC;
- -----------------------------------------------------------------------------
- -- New/updated funcitons for VHDL-200X fast track
- -----------------------------------------------------------------------------
- -- to_01
- -------------------------------------------------------------------
- function TO_01 (s : STD_ULOGIC_VECTOR; xmap : STD_ULOGIC := '0')
- return STD_ULOGIC_VECTOR is
- variable RESULT : STD_ULOGIC_VECTOR(s'length-1 downto 0);
- variable BAD_ELEMENT : BOOLEAN := false;
- alias XS : STD_ULOGIC_VECTOR(s'length-1 downto 0) is s;
- begin
- for I in RESULT'range loop
- case XS(I) is
- when '0' | 'L' => RESULT(I) := '0';
- when '1' | 'H' => RESULT(I) := '1';
- when others => BAD_ELEMENT := true;
- end case;
- end loop;
- if BAD_ELEMENT then
- for I in RESULT'range loop
- RESULT(I) := XMAP; -- standard fixup
- end loop;
- end if;
- return RESULT;
- end function TO_01;
- -------------------------------------------------------------------
- function TO_01 (s : STD_ULOGIC; xmap : STD_ULOGIC := '0')
- return STD_ULOGIC is
- begin
- case s is
- when '0' | 'L' => RETURN '0';
- when '1' | 'H' => RETURN '1';
- when others => return xmap;
- end case;
- end function TO_01;
- -------------------------------------------------------------------
- function TO_01 (s : BIT_VECTOR; xmap : STD_ULOGIC := '0')
- return STD_ULOGIC_VECTOR is
- variable RESULT : STD_ULOGIC_VECTOR(s'length-1 downto 0);
- alias XS : BIT_VECTOR(s'length-1 downto 0) is s;
- begin
- for I in RESULT'range loop
- case XS(I) is
- when '0' => RESULT(I) := '0';
- when '1' => RESULT(I) := '1';
- end case;
- end loop;
- return RESULT;
- end function TO_01;
- -------------------------------------------------------------------
- function TO_01 (s : BIT; xmap : STD_ULOGIC := '0')
- return STD_ULOGIC is
- begin
- case s is
- when '0' => RETURN '0';
- when '1' => RETURN '1';
- end case;
- end function TO_01;
--- end Bugzilla issue #148
- -------------------------------------------------------------------
-
- -------------------------------------------------------------------
- -- overloaded shift operators
- -------------------------------------------------------------------
-
- -------------------------------------------------------------------
- -- sll
- -------------------------------------------------------------------
- function "sll" (l : STD_LOGIC_VECTOR; r : INTEGER) return STD_LOGIC_VECTOR is
- alias lv : STD_LOGIC_VECTOR (1 to l'length) is l;
- variable result : STD_LOGIC_VECTOR (1 to l'length) := (others => '0');
- begin
- if r >= 0 then
- result(1 to l'length - r) := lv(r + 1 to l'length);
- else
- result := l srl -r;
- end if;
- return result;
- end function "sll";
- -------------------------------------------------------------------
- function "sll" (l : STD_ULOGIC_VECTOR; r : INTEGER) return STD_ULOGIC_VECTOR is
- alias lv : STD_ULOGIC_VECTOR (1 to l'length) is l;
- variable result : STD_ULOGIC_VECTOR (1 to l'length) := (others => '0');
- begin
- if r >= 0 then
- result(1 to l'length - r) := lv(r + 1 to l'length);
- else
- result := l srl -r;
- end if;
- return result;
- end function "sll";
-
- -------------------------------------------------------------------
- -- srl
- -------------------------------------------------------------------
- function "srl" (l : STD_LOGIC_VECTOR; r : INTEGER) return STD_LOGIC_VECTOR is
- alias lv : STD_LOGIC_VECTOR (1 to l'length) is l;
- variable result : STD_LOGIC_VECTOR (1 to l'length) := (others => '0');
- begin
- if r >= 0 then
- result(r + 1 to l'length) := lv(1 to l'length - r);
- else
- result := l sll -r;
- end if;
- return result;
- end function "srl";
- -------------------------------------------------------------------
- function "srl" (l : STD_ULOGIC_VECTOR; r : INTEGER) return STD_ULOGIC_VECTOR is
- alias lv : STD_ULOGIC_VECTOR (1 to l'length) is l;
- variable result : STD_ULOGIC_VECTOR (1 to l'length) := (others => '0');
- begin
- if r >= 0 then
- result(r + 1 to l'length) := lv(1 to l'length - r);
- else
- result := l sll -r;
- end if;
- return result;
- end function "srl";
-
- -------------------------------------------------------------------
- -- rol
- -------------------------------------------------------------------
- function "rol" (l : STD_LOGIC_VECTOR; r : INTEGER) return STD_LOGIC_VECTOR is
- alias lv : STD_LOGIC_VECTOR (1 to l'length) is l;
- variable result : STD_LOGIC_VECTOR (1 to l'length);
- constant rm : INTEGER := r mod l'length;
- begin
- if r >= 0 then
- result(1 to l'length - rm) := lv(rm + 1 to l'length);
- result(l'length - rm + 1 to l'length) := lv(1 to rm);
- else
- result := l ror -r;
- end if;
- return result;
- end function "rol";
- -------------------------------------------------------------------
- function "rol" (l : STD_ULOGIC_VECTOR; r : INTEGER) return STD_ULOGIC_VECTOR is
- alias lv : STD_ULOGIC_VECTOR (1 to l'length) is l;
- variable result : STD_ULOGIC_VECTOR (1 to l'length);
- constant rm : INTEGER := r mod l'length;
- begin
- if r >= 0 then
- result(1 to l'length - rm) := lv(rm + 1 to l'length);
- result(l'length - rm + 1 to l'length) := lv(1 to rm);
- else
- result := l ror -r;
- end if;
- return result;
- end function "rol";
-
- -------------------------------------------------------------------
- -- ror
- -------------------------------------------------------------------
- function "ror" (l : STD_LOGIC_VECTOR; r : INTEGER) return STD_LOGIC_VECTOR is
- alias lv : STD_LOGIC_VECTOR (1 to l'length) is l;
- variable result : STD_LOGIC_VECTOR (1 to l'length) := (others => '0');
- constant rm : INTEGER := r mod l'length;
- begin
- if r >= 0 then
- result(rm + 1 to l'length) := lv(1 to l'length - rm);
- result(1 to rm) := lv(l'length - rm + 1 to l'length);
- else
- result := l rol -r;
- end if;
- return result;
- end function "ror";
- -------------------------------------------------------------------
- function "ror" (l : STD_ULOGIC_VECTOR; r : INTEGER) return STD_ULOGIC_VECTOR is
- alias lv : STD_ULOGIC_VECTOR (1 to l'length) is l;
- variable result : STD_ULOGIC_VECTOR (1 to l'length) := (others => '0');
- constant rm : INTEGER := r mod l'length;
- begin
- if r >= 0 then
- result(rm + 1 to l'length) := lv(1 to l'length - rm);
- result(1 to rm) := lv(l'length - rm + 1 to l'length);
- else
- result := l rol -r;
- end if;
- return result;
- end function "ror";
- -------------------------------------------------------------------
- -- vector/scalar overloaded logical operators
- -------------------------------------------------------------------
-
- -------------------------------------------------------------------
- -- and
- -------------------------------------------------------------------
- function "and" (l : STD_LOGIC_VECTOR; r : STD_ULOGIC) return STD_LOGIC_VECTOR is
- alias lv : STD_LOGIC_VECTOR (1 to l'length) is l;
- variable result : STD_LOGIC_VECTOR (1 to l'length);
- begin
- for i in result'range loop
- result(i) := "and" (lv(i), r);
- end loop;
- return result;
- end function "and";
- -------------------------------------------------------------------
- function "and" (l : STD_ULOGIC_VECTOR; r : STD_ULOGIC) return STD_ULOGIC_VECTOR is
- alias lv : STD_ULOGIC_VECTOR (1 to l'length) is l;
- variable result : STD_ULOGIC_VECTOR (1 to l'length);
- begin
- for i in result'range loop
- result(i) := "and" (lv(i), r);
- end loop;
- return result;
- end function "and";
- -------------------------------------------------------------------
- function "and" (l : STD_ULOGIC; r : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
- alias rv : STD_LOGIC_VECTOR (1 to r'length) is r;
- variable result : STD_LOGIC_VECTOR (1 to r'length);
- begin
- for i in result'range loop
- result(i) := "and" (l, rv(i));
- end loop;
- return result;
- end function "and";
- -------------------------------------------------------------------
- function "and" (l : STD_ULOGIC; r : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR is
- alias rv : STD_ULOGIC_VECTOR (1 to r'length) is r;
- variable result : STD_ULOGIC_VECTOR (1 to r'length);
- begin
- for i in result'range loop
- result(i) := "and" (l, rv(i));
- end loop;
- return result;
- end function "and";
-
- -------------------------------------------------------------------
- -- nand
- -------------------------------------------------------------------
- function "nand" (l : STD_LOGIC_VECTOR; r : STD_ULOGIC) return STD_LOGIC_VECTOR is
- alias lv : STD_LOGIC_VECTOR (1 to l'length) is l;
- variable result : STD_LOGIC_VECTOR (1 to l'length);
- begin
- for i in result'range loop
- result(i) := "not"("and" (lv(i), r));
- end loop;
- return result;
- end function "nand";
- -------------------------------------------------------------------
- function "nand" (l : STD_ULOGIC_VECTOR; r : STD_ULOGIC) return STD_ULOGIC_VECTOR is
- alias lv : STD_ULOGIC_VECTOR (1 to l'length) is l;
- variable result : STD_ULOGIC_VECTOR (1 to l'length);
- begin
- for i in result'range loop
- result(i) := "not"("and" (lv(i), r));
- end loop;
- return result;
- end function "nand";
- -------------------------------------------------------------------
- function "nand" (l : STD_ULOGIC; r : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
- alias rv : STD_LOGIC_VECTOR (1 to r'length) is r;
- variable result : STD_LOGIC_VECTOR (1 to r'length);
- begin
- for i in result'range loop
- result(i) := "not"("and" (l, rv(i)));
- end loop;
- return result;
- end function "nand";
- -------------------------------------------------------------------
- function "nand" (l : STD_ULOGIC; r : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR is
- alias rv : STD_ULOGIC_VECTOR (1 to r'length) is r;
- variable result : STD_ULOGIC_VECTOR (1 to r'length);
- begin
- for i in result'range loop
- result(i) := "not"("and" (l, rv(i)));
- end loop;
- return result;
- end function "nand";
-
- -------------------------------------------------------------------
- -- or
- -------------------------------------------------------------------
- function "or" (l : STD_LOGIC_VECTOR; r : STD_ULOGIC) return STD_LOGIC_VECTOR is
- alias lv : STD_LOGIC_VECTOR (1 to l'length) is l;
- variable result : STD_LOGIC_VECTOR (1 to l'length);
- begin
- for i in result'range loop
- result(i) := "or" (lv(i), r);
- end loop;
- return result;
- end function "or";
- -------------------------------------------------------------------
- function "or" (l : STD_ULOGIC_VECTOR; r : STD_ULOGIC) return STD_ULOGIC_VECTOR is
- alias lv : STD_ULOGIC_VECTOR (1 to l'length) is l;
- variable result : STD_ULOGIC_VECTOR (1 to l'length);
- begin
- for i in result'range loop
- result(i) := "or" (lv(i), r);
- end loop;
- return result;
- end function "or";
- -------------------------------------------------------------------
- function "or" (l : STD_ULOGIC; r : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
- alias rv : STD_LOGIC_VECTOR (1 to r'length) is r;
- variable result : STD_LOGIC_VECTOR (1 to r'length);
- begin
- for i in result'range loop
- result(i) := "or" (l, rv(i));
- end loop;
- return result;
- end function "or";
- -------------------------------------------------------------------
- function "or" (l : STD_ULOGIC; r : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR is
- alias rv : STD_ULOGIC_VECTOR (1 to r'length) is r;
- variable result : STD_ULOGIC_VECTOR (1 to r'length);
- begin
- for i in result'range loop
- result(i) := "or" (l, rv(i));
- end loop;
- return result;
- end function "or";
-
- -------------------------------------------------------------------
- -- nor
- -------------------------------------------------------------------
- function "nor" (l : STD_LOGIC_VECTOR; r : STD_ULOGIC) return STD_LOGIC_VECTOR is
- alias lv : STD_LOGIC_VECTOR (1 to l'length) is l;
- variable result : STD_LOGIC_VECTOR (1 to l'length);
- begin
- for i in result'range loop
- result(i) := "not"("or" (lv(i), r));
- end loop;
- return result;
- end function "nor";
- -------------------------------------------------------------------
- function "nor" (l : STD_ULOGIC_VECTOR; r : STD_ULOGIC) return STD_ULOGIC_VECTOR is
- alias lv : STD_ULOGIC_VECTOR (1 to l'length) is l;
- variable result : STD_ULOGIC_VECTOR (1 to l'length);
- begin
- for i in result'range loop
- result(i) := "not"("or" (lv(i), r));
- end loop;
- return result;
- end function "nor";
- -------------------------------------------------------------------
- function "nor" (l : STD_ULOGIC; r : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
- alias rv : STD_LOGIC_VECTOR (1 to r'length) is r;
- variable result : STD_LOGIC_VECTOR (1 to r'length);
- begin
- for i in result'range loop
- result(i) := "not"("or" (l, rv(i)));
- end loop;
- return result;
- end function "nor";
- -------------------------------------------------------------------
- function "nor" (l : STD_ULOGIC; r : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR is
- alias rv : STD_ULOGIC_VECTOR (1 to r'length) is r;
- variable result : STD_ULOGIC_VECTOR (1 to r'length);
- begin
- for i in result'range loop
- result(i) := "not"("or" (l, rv(i)));
- end loop;
- return result;
- end function "nor";
-
- -------------------------------------------------------------------
- -- xor
- -------------------------------------------------------------------
- function "xor" (l : STD_LOGIC_VECTOR; r : STD_ULOGIC) return STD_LOGIC_VECTOR is
- alias lv : STD_LOGIC_VECTOR (1 to l'length) is l;
- variable result : STD_LOGIC_VECTOR (1 to l'length);
- begin
- for i in result'range loop
- result(i) := "xor" (lv(i), r);
- end loop;
- return result;
- end function "xor";
- -------------------------------------------------------------------
- function "xor" (l : STD_ULOGIC_VECTOR; r : STD_ULOGIC) return STD_ULOGIC_VECTOR is
- alias lv : STD_ULOGIC_VECTOR (1 to l'length) is l;
- variable result : STD_ULOGIC_VECTOR (1 to l'length);
- begin
- for i in result'range loop
- result(i) := "xor" (lv(i), r);
- end loop;
- return result;
- end function "xor";
- -------------------------------------------------------------------
- function "xor" (l : STD_ULOGIC; r : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
- alias rv : STD_LOGIC_VECTOR (1 to r'length) is r;
- variable result : STD_LOGIC_VECTOR (1 to r'length);
- begin
- for i in result'range loop
- result(i) := "xor" (l, rv(i));
- end loop;
- return result;
- end function "xor";
- -------------------------------------------------------------------
- function "xor" (l : STD_ULOGIC; r : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR is
- alias rv : STD_ULOGIC_VECTOR (1 to r'length) is r;
- variable result : STD_ULOGIC_VECTOR (1 to r'length);
- begin
- for i in result'range loop
- result(i) := "xor" (l, rv(i));
- end loop;
- return result;
- end function "xor";
-
- -------------------------------------------------------------------
- -- xnor
- -------------------------------------------------------------------
- function "xnor" (l : STD_LOGIC_VECTOR; r : STD_ULOGIC) return STD_LOGIC_VECTOR is
- alias lv : STD_LOGIC_VECTOR (1 to l'length) is l;
- variable result : STD_LOGIC_VECTOR (1 to l'length);
- begin
- for i in result'range loop
- result(i) := "not"("xor" (lv(i), r));
- end loop;
- return result;
- end function "xnor";
- -------------------------------------------------------------------
- function "xnor" (l : STD_ULOGIC_VECTOR; r : STD_ULOGIC) return STD_ULOGIC_VECTOR is
- alias lv : STD_ULOGIC_VECTOR (1 to l'length) is l;
- variable result : STD_ULOGIC_VECTOR (1 to l'length);
- begin
- for i in result'range loop
- result(i) := "not"("xor" (lv(i), r));
- end loop;
- return result;
- end function "xnor";
- -------------------------------------------------------------------
- function "xnor" (l : STD_ULOGIC; r : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
- alias rv : STD_LOGIC_VECTOR (1 to r'length) is r;
- variable result : STD_LOGIC_VECTOR (1 to r'length);
- begin
- for i in result'range loop
- result(i) := "not"("xor" (l, rv(i)));
- end loop;
- return result;
- end function "xnor";
- -------------------------------------------------------------------
- function "xnor" (l : STD_ULOGIC; r : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR is
- alias rv : STD_ULOGIC_VECTOR (1 to r'length) is r;
- variable result : STD_ULOGIC_VECTOR (1 to r'length);
- begin
- for i in result'range loop
- result(i) := "not"("xor" (l, rv(i)));
- end loop;
- return result;
- end function "xnor";
-
- -------------------------------------------------------------------
- -- vector-reduction functions
- -------------------------------------------------------------------
-
- -------------------------------------------------------------------
- -- and
- -------------------------------------------------------------------
- function and_reduce (l : STD_LOGIC_VECTOR) return STD_ULOGIC is
- begin
- return and_reduce (to_StdULogicVector (l));
- end function and_reduce;
- -------------------------------------------------------------------
- function and_reduce (l : STD_ULOGIC_VECTOR) return STD_ULOGIC is
- variable result : STD_ULOGIC := '1';
- begin
- for i in l'reverse_range loop
- result := (l(i) and result);
- end loop;
- return result;
- end function and_reduce;
-
- -------------------------------------------------------------------
- -- nand
- -------------------------------------------------------------------
- function nand_reduce (l : STD_LOGIC_VECTOR) return STD_ULOGIC is
- begin
- return not (and_reduce(to_StdULogicVector(l)));
- end function nand_reduce;
- -------------------------------------------------------------------
- function nand_reduce (l : STD_ULOGIC_VECTOR) return STD_ULOGIC is
- begin
- return not (and_reduce(l));
- end function nand_reduce;
-
- -------------------------------------------------------------------
- -- or
- -------------------------------------------------------------------
- function or_reduce (l : STD_LOGIC_VECTOR) return STD_ULOGIC is
- begin
- return or_reduce (to_StdULogicVector (l));
- end function or_reduce;
- -------------------------------------------------------------------
- function or_reduce (l : STD_ULOGIC_VECTOR) return STD_ULOGIC is
- variable result : STD_ULOGIC := '0';
- begin
- for i in l'reverse_range loop
- result := (l(i) or result);
- end loop;
- return result;
- end function or_reduce;
-
- -------------------------------------------------------------------
- -- nor
- -------------------------------------------------------------------
- function nor_reduce (l : STD_LOGIC_VECTOR) return STD_ULOGIC is
- begin
- return "not"(or_reduce(To_StdULogicVector(l)));
- end function nor_reduce;
- -------------------------------------------------------------------
- function nor_reduce (l : STD_ULOGIC_VECTOR) return STD_ULOGIC is
- begin
- return "not"(or_reduce(l));
- end function nor_reduce;
-
- -------------------------------------------------------------------
- -- xor
- -------------------------------------------------------------------
- function xor_reduce (l : STD_LOGIC_VECTOR) return STD_ULOGIC is
- begin
- return xor_reduce (to_StdULogicVector (l));
- end function xor_reduce;
- -------------------------------------------------------------------
- function xor_reduce (l : STD_ULOGIC_VECTOR) return STD_ULOGIC is
- variable result : STD_ULOGIC := '0';
- begin
- for i in l'reverse_range loop
- result := (l(i) xor result);
- end loop;
- return result;
- end function xor_reduce;
-
- -------------------------------------------------------------------
- -- xnor
- -------------------------------------------------------------------
- function xnor_reduce (l : STD_LOGIC_VECTOR) return STD_ULOGIC is
- begin
- return "not"(xor_reduce(To_StdULogicVector(l)));
- end function xnor_reduce;
- -------------------------------------------------------------------
- function xnor_reduce (l : STD_ULOGIC_VECTOR) return STD_ULOGIC is
- begin
- return "not"(xor_reduce(l));
- end function xnor_reduce;
- -- %%% End "remove the following functions"
-
-
- -- The following functions are implicity in 1076-2006
- -- truth table for "?=" function
--- constant match_logic_table : stdlogic_table := (
--- -----------------------------------------------------
--- -- U X 0 1 Z W L H - | |
--- -----------------------------------------------------
--- ('U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', '1'), -- | U |
--- ('U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', '1'), -- | X |
--- ('U', 'X', '1', '0', 'X', 'X', '1', '0', '1'), -- | 0 |
--- ('U', 'X', '0', '1', 'X', 'X', '0', '1', '1'), -- | 1 |
--- ('U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', '1'), -- | Z |
--- ('U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', '1'), -- | W |
--- ('U', 'X', '1', '0', 'X', 'X', '1', '0', '1'), -- | L |
--- ('U', 'X', '0', '1', 'X', 'X', '0', '1', '1'), -- | H |
--- ('1', '1', '1', '1', '1', '1', '1', '1', '1') -- | - |
--- );
-
--- constant no_match_logic_table : stdlogic_table := (
--- -----------------------------------------------------
--- -- U X 0 1 Z W L H - | |
--- -----------------------------------------------------
--- ('U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', '0'), -- | U |
--- ('U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', '0'), -- | X |
--- ('U', 'X', '0', '1', 'X', 'X', '0', '1', '0'), -- | 0 |
--- ('U', 'X', '1', '0', 'X', 'X', '1', '0', '0'), -- | 1 |
--- ('U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', '0'), -- | Z |
--- ('U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', '0'), -- | W |
--- ('U', 'X', '0', '1', 'X', 'X', '0', '1', '0'), -- | L |
--- ('U', 'X', '1', '0', 'X', 'X', '1', '0', '0'), -- | H |
--- ('0', '0', '0', '0', '0', '0', '0', '0', '0') -- | - |
--- );
-
- -------------------------------------------------------------------
- -- ?= functions, Similar to "std_match", but returns "std_ulogic".
- -------------------------------------------------------------------
- -- %%% FUNCTION "?=" ( l, r : std_ulogic ) RETURN std_ulogic IS
--- function \?=\ (l, r : STD_ULOGIC) return STD_ULOGIC is
--- begin
--- return match_logic_table (l, r);
--- end function \?=\;
--- -- %%% END FUNCTION "?=";
--- -------------------------------------------------------------------
--- -- %%% FUNCTION "?=" ( l, r : std_logic_vector ) RETURN std_ulogic IS
--- function \?=\ (l, r : STD_LOGIC_VECTOR) return STD_ULOGIC is
--- alias lv : STD_LOGIC_VECTOR(1 to l'length) is l;
--- alias rv : STD_LOGIC_VECTOR(1 to r'length) is r;
--- variable result, result1 : STD_ULOGIC; -- result
--- begin
--- -- Logically identical to an "=" operator.
--- if ((l'length < 1) or (r'length < 1)) then
--- report "STD_LOGIC_1164.""?="": null detected, returning X"
--- severity warning;
--- return 'X';
--- end if;
--- if lv'length /= rv'length then
--- report "STD_LOGIC_1164.""?="": L'LENGTH /= R'LENGTH, returning X"
--- severity warning;
--- return 'X';
--- else
--- result := '1';
--- for i in lv'low to lv'high loop
--- result1 := match_logic_table(lv(i), rv(i));
--- if result1 = 'U' then
--- return 'U';
--- elsif result1 = 'X' or result = 'X' then
--- result := 'X';
--- else
--- result := result and result1;
--- end if;
--- end loop;
--- return result;
--- end if;
--- end function \?=\;
--- -- %%% END FUNCTION "?=";
--- -------------------------------------------------------------------
--- -- %%% FUNCTION "?=" ( l, r : std_ulogic_vector ) RETURN std_ulogic IS
--- function \?=\ (l, r : STD_ULOGIC_VECTOR) return STD_ULOGIC is
--- alias lv : STD_ULOGIC_VECTOR(1 to l'length) is l;
--- alias rv : STD_ULOGIC_VECTOR(1 to r'length) is r;
--- variable result, result1 : STD_ULOGIC;
--- begin
--- if ((l'length < 1) or (r'length < 1)) then
--- report "STD_LOGIC_1164.""?="": null detected, returning X"
--- severity warning;
--- return 'X';
--- end if;
--- if lv'length /= rv'length then
--- report "STD_LOGIC_1164.""?="": L'LENGTH /= R'LENGTH, returning X"
--- severity warning;
--- return 'X';
--- else
--- result := '1';
--- for i in lv'low to lv'high loop
--- result1 := match_logic_table(lv(i), rv(i));
--- if result1 = 'U' then
--- return 'U';
--- elsif result1 = 'X' or result = 'X' then
--- result := 'X';
--- else
--- result := result and result1;
--- end if;
--- end loop;
--- return result;
--- end if;
--- end function \?=\;
--- -- %%% END FUNCTION "?=";
--- -- %%% FUNCTION "?/=" ( l, r : std_ulogic ) RETURN std_ulogic is
--- function \?/=\ (l, r : STD_ULOGIC) return STD_ULOGIC is
--- begin
--- return no_match_logic_table (l, r);
--- end function \?/=\;
--- -- %%% END FUNCTION "?/=";
--- -- %%% FUNCTION "?/=" ( l, r : std_logic_vector ) RETURN std_ulogic is
--- function \?/=\ (l, r : STD_LOGIC_VECTOR) return STD_ULOGIC is
--- alias lv : STD_LOGIC_VECTOR(1 to l'length) is l;
--- alias rv : STD_LOGIC_VECTOR(1 to r'length) is r;
--- variable result, result1 : STD_ULOGIC; -- result
--- begin
--- if ((l'length < 1) or (r'length < 1)) then
--- report "STD_LOGIC_1164.""?/="": null detected, returning X"
--- severity warning;
--- return 'X';
--- end if;
--- if lv'length /= rv'length then
--- report "STD_LOGIC_1164.""?/="": L'LENGTH /= R'LENGTH, returning X"
--- severity warning;
--- return 'X';
--- else
--- result := '0';
--- for i in lv'low to lv'high loop
--- result1 := no_match_logic_table(lv(i), rv(i));
--- if result1 = 'U' then
--- return 'U';
--- elsif result1 = 'X' or result = 'X' then
--- result := 'X';
--- else
--- result := result or result1;
--- end if;
--- end loop;
--- return result;
--- end if;
--- end function \?/=\;
--- -- %%% END FUNCTION "?/=";
--- -- %%% FUNCTION "?/=" ( l, r : std_ulogic_vector ) RETURN std_ulogic is
--- function \?/=\ (l, r : STD_ULOGIC_VECTOR) return STD_ULOGIC is
--- alias lv : STD_ULOGIC_VECTOR(1 to l'length) is l;
--- alias rv : STD_ULOGIC_VECTOR(1 to r'length) is r;
--- variable result, result1 : STD_ULOGIC;
--- begin
--- if ((l'length < 1) or (r'length < 1)) then
--- report "STD_LOGIC_1164.""?/="": null detected, returning X"
--- severity warning;
--- return 'X';
--- end if;
--- if lv'length /= rv'length then
--- report "STD_LOGIC_1164.""?/="": L'LENGTH /= R'LENGTH, returning X"
--- severity warning;
--- return 'X';
--- else
--- result := '0';
--- for i in lv'low to lv'high loop
--- result1 := no_match_logic_table(lv(i), rv(i));
--- if result1 = 'U' then
--- return 'U';
--- elsif result1 = 'X' or result = 'X' then
--- result := 'X';
--- else
--- result := result or result1;
--- end if;
--- end loop;
--- return result;
--- end if;
--- end function \?/=\;
--- -- %%% END FUNCTION "?/=";
- -- %%% FUNCTION "?>" ( l, r : std_ulogic ) RETURN std_ulogic is
- function \?>\ (l, r : STD_ULOGIC) return STD_ULOGIC is
- variable lx, rx : STD_ULOGIC;
- begin
- if (l = '-') or (r = '-') then
- report "STD_LOGIC_1164.""?>"": '-' found in compare string"
- severity error;
- return 'X';
- else
- lx := to_x01 (l);
- rx := to_x01 (r);
- if lx = 'X' or rx = 'X' then
- return 'X';
- elsif lx > rx then
- return '1';
- else
- return '0';
- end if;
- end if;
- end function \?>\;
- -- %%% END FUNCTION "?>";
-
- -- %%% FUNCTION "?>=" ( l, r : std_ulogic ) RETURN std_ulogic is
- function \?>=\ (l, r : STD_ULOGIC) return STD_ULOGIC is
- variable lx, rx : STD_ULOGIC;
- begin
- if (l = '-') or (r = '-') then
- report "STD_LOGIC_1164.""?>="": '-' found in compare string"
- severity error;
- return 'X';
- else
- lx := to_x01 (l);
- rx := to_x01 (r);
- if lx = 'X' or rx = 'X' then
- return 'X';
- elsif lx >= rx then
- return '1';
- else
- return '0';
- end if;
- end if;
- end function \?>=\;
- -- %%% END FUNCTION "?/>=";
-
- -- %%% FUNCTION "?<" ( l, r : std_ulogic ) RETURN std_ulogic is
- function \?<\ (l, r : STD_ULOGIC) return STD_ULOGIC is
- variable lx, rx : STD_ULOGIC;
- begin
- if (l = '-') or (r = '-') then
- report "STD_LOGIC_1164.""?<"": '-' found in compare string"
- severity error;
- return 'X';
- else
- lx := to_x01 (l);
- rx := to_x01 (r);
- if lx = 'X' or rx = 'X' then
- return 'X';
- elsif lx < rx then
- return '1';
- else
- return '0';
- end if;
- end if;
- end function \?<\;
- -- %%% END FUNCTION "?/<";
-
- -- %%% FUNCTION "?<=" ( l, r : std_ulogic ) RETURN std_ulogic is
- function \?<=\ (l, r : STD_ULOGIC) return STD_ULOGIC is
- variable lx, rx : STD_ULOGIC;
- begin
- if (l = '-') or (r = '-') then
- report "STD_LOGIC_1164.""?<="": '-' found in compare string"
- severity error;
- return 'X';
- else
- lx := to_x01 (l);
- rx := to_x01 (r);
- if lx = 'X' or rx = 'X' then
- return 'X';
- elsif lx <= rx then
- return '1';
- else
- return '0';
- end if;
- end if;
- end function \?<=\;
- -- %%% END FUNCTION "?/<=";
-
- -- "??" operator, converts a std_ulogic to a boolean.
--- %%% FUNCTION "??"
- function \??\ (S : STD_ULOGIC) return BOOLEAN is
- begin
- return S = '1' or S = 'H';
- end function \??\;
--- %%% END FUNCTION "??";
-
- -- rtl_synthesis off
--- pragma synthesis_off
- -----------------------------------------------------------------------------
- -- This section copied from "std_logic_textio"
- -----------------------------------------------------------------------------
- -- Type and constant definitions used to map STD_ULOGIC values
- -- into/from character values.
- type MVL9plus is ('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-', error);
- type char_indexed_by_MVL9 is array (STD_ULOGIC) of CHARACTER;
- type MVL9_indexed_by_char is array (CHARACTER) of STD_ULOGIC;
- type MVL9plus_indexed_by_char is array (CHARACTER) of MVL9plus;
- constant MVL9_to_char : char_indexed_by_MVL9 := "UX01ZWLH-";
- constant char_to_MVL9 : MVL9_indexed_by_char :=
- ('U' => 'U', 'X' => 'X', '0' => '0', '1' => '1', 'Z' => 'Z',
- 'W' => 'W', 'L' => 'L', 'H' => 'H', '-' => '-', others => 'U');
- constant char_to_MVL9plus : MVL9plus_indexed_by_char :=
- ('U' => 'U', 'X' => 'X', '0' => '0', '1' => '1', 'Z' => 'Z',
- 'W' => 'W', 'L' => 'L', 'H' => 'H', '-' => '-', others => error);
-
- constant NBSP : CHARACTER := CHARACTER'val(160); -- space character
- constant NUS : STRING(2 to 1) := (others => ' '); -- null STRING
-
- -- purpose: Skips white space
- procedure skip_whitespace (
- L : inout LINE) is
- variable readOk : BOOLEAN;
- variable c : CHARACTER;
- begin
- while L /= null and L.all'length /= 0 loop
- if (L.all(1) = ' ' or L.all(1) = NBSP or L.all(1) = HT) then
- read (l, c, readOk);
- else
- exit;
- end if;
- end loop;
- end procedure skip_whitespace;
-
- procedure READ (L : inout LINE; VALUE : out STD_ULOGIC;
- GOOD : out BOOLEAN) is
- variable c : CHARACTER;
- variable readOk : BOOLEAN;
- begin
- VALUE := 'U'; -- initialize to a "U"
- Skip_whitespace (L);
- read (l, c, readOk);
- if not readOk then
- good := false;
- else
- if char_to_MVL9plus(c) = error then
- good := false;
- else
- VALUE := char_to_MVL9(c);
- good := true;
- end if;
- end if;
- end procedure READ;
-
- procedure READ (L : inout LINE; VALUE : out STD_ULOGIC_VECTOR;
- GOOD : out BOOLEAN) is
- variable m : STD_ULOGIC;
- variable c : CHARACTER;
- variable mv : STD_ULOGIC_VECTOR(0 to VALUE'length-1);
- variable readOk : BOOLEAN;
- variable i : INTEGER;
- variable lastu : BOOLEAN := false; -- last character was an "_"
- begin
- VALUE := (VALUE'range => 'U'); -- initialize to a "U"
- Skip_whitespace (L);
- if VALUE'length > 0 then
- read (l, c, readOk);
- i := 0;
- good := false;
- while i < VALUE'length loop
- if not readOk then -- Bail out if there was a bad read
- return;
- elsif c = '_' then
- if i = 0 then -- Begins with an "_"
- return;
- elsif lastu then -- "__" detected
- return;
- else
- lastu := true;
- end if;
- elsif (char_to_MVL9plus(c) = error) then -- Illegal character
- return;
- else
- mv(i) := char_to_MVL9(c);
- i := i + 1;
- if i > mv'high then -- reading done
- good := true;
- VALUE := mv;
- return;
- end if;
- lastu := false;
- end if;
- read(L, c, readOk);
- end loop;
- else
- good := true; -- read into a null array
- end if;
- end procedure READ;
-
- procedure READ (L : inout LINE; VALUE : out STD_ULOGIC) is
- variable c : CHARACTER;
- variable readOk : BOOLEAN;
- begin
- VALUE := 'U'; -- initialize to a "U"
- Skip_whitespace (L);
- read (l, c, readOk);
- if not readOk then
- report "STD_LOGIC_1164.READ(STD_ULOGIC) "
- & "End of string encountered"
- severity error;
- return;
- elsif char_to_MVL9plus(c) = error then
- report
- "STD_LOGIC_1164.READ(STD_ULOGIC) Error: Character '" &
- c & "' read, expected STD_ULOGIC literal."
- severity error;
- else
- VALUE := char_to_MVL9(c);
- end if;
- end procedure READ;
-
- procedure READ (L : inout LINE; VALUE : out STD_ULOGIC_VECTOR) is
- variable m : STD_ULOGIC;
- variable c : CHARACTER;
- variable readOk : BOOLEAN;
- variable mv : STD_ULOGIC_VECTOR(0 to VALUE'length-1);
- variable i : INTEGER;
- variable lastu : BOOLEAN := false; -- last character was an "_"
- begin
- VALUE := (VALUE'range => 'U'); -- initialize to a "U"
- Skip_whitespace (L);
- if VALUE'length > 0 then -- non Null input string
- read (l, c, readOk);
- i := 0;
- while i < VALUE'length loop
- if readOk = false then -- Bail out if there was a bad read
- report "STD_LOGIC_1164.READ(STD_ULOGIC_VECTOR) "
- & "End of string encountered"
- severity error;
- return;
- elsif c = '_' then
- if i = 0 then
- report "STD_LOGIC_1164.READ(STD_ULOGIC_VECTOR) "
- & "String begins with an ""_""" severity error;
- return;
- elsif lastu then
- report "STD_LOGIC_1164.READ(STD_ULOGIC_VECTOR) "
- & "Two underscores detected in input string ""__"""
- severity error;
- return;
- else
- lastu := true;
- end if;
- elsif c = ' ' or c = NBSP or c = HT then -- reading done.
- report "STD_LOGIC_1164.READ(STD_ULOGIC_VECTOR) "
- & "Short read, Space encounted in input string"
- severity error;
- return;
- elsif char_to_MVL9plus(c) = error then
- report "STD_LOGIC_1164.READ(STD_ULOGIC_VECTOR) "
- & "Error: Character '" &
- c & "' read, expected STD_ULOGIC literal."
- severity error;
- return;
- else
- mv(i) := char_to_MVL9(c);
- i := i + 1;
- if i > mv'high then
- VALUE := mv;
- return;
- end if;
- lastu := false;
- end if;
- read(L, c, readOk);
- end loop;
- end if;
- end procedure READ;
-
- procedure WRITE (L : inout LINE; VALUE : in STD_ULOGIC;
- JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0) is
- begin
- write(l, MVL9_to_char(VALUE), justified, field);
- end procedure WRITE;
-
- procedure WRITE (L : inout LINE; VALUE : in STD_ULOGIC_VECTOR;
- JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0) is
- variable s : STRING(1 to VALUE'length);
- variable m : STD_ULOGIC_VECTOR(1 to VALUE'length) := VALUE;
- begin
- for i in 1 to VALUE'length loop
- s(i) := MVL9_to_char(m(i));
- end loop;
- write(l, s, justified, field);
- end procedure WRITE;
-
- -- Read and Write procedures for STD_LOGIC_VECTOR
-
- procedure READ (L : inout LINE; VALUE : out STD_LOGIC_VECTOR;
- GOOD : out BOOLEAN) is
- variable ivalue : STD_ULOGIC_VECTOR (VALUE'range);
- begin
- READ (L => L, VALUE => ivalue, GOOD => GOOD);
- VALUE := to_stdlogicvector (ivalue);
- end procedure READ;
-
- procedure READ (L : inout LINE; VALUE : out STD_LOGIC_VECTOR) is
- variable ivalue : STD_ULOGIC_VECTOR (VALUE'range);
- begin
- READ (L => L, VALUE => ivalue);
- VALUE := to_stdlogicvector (ivalue);
- end procedure READ;
-
- procedure WRITE (L : inout LINE; VALUE : in STD_LOGIC_VECTOR;
- JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0) is
- variable s : STRING(1 to VALUE'length);
- variable m : STD_LOGIC_VECTOR(1 to VALUE'length) := VALUE;
- begin
- for i in 1 to VALUE'length loop
- s(i) := MVL9_to_char(m(i));
- end loop;
- write(L, s, justified, field);
- end procedure WRITE;
-
- -----------------------------------------------------------------------
- -- Alias for bread and bwrite are provided with call out the read and
- -- write functions.
- -----------------------------------------------------------------------
-
- -- Hex Read and Write procedures for STD_ULOGIC_VECTOR.
- -- Modified from the original to be more forgiving.
-
- procedure Char2QuadBits (C : CHARACTER;
- RESULT : out STD_ULOGIC_VECTOR(3 downto 0);
- GOOD : out BOOLEAN;
- ISSUE_ERROR : in BOOLEAN) is
- begin
- case c is
- when '0' => result := x"0"; good := true;
- when '1' => result := x"1"; good := true;
- when '2' => result := x"2"; good := true;
- when '3' => result := x"3"; good := true;
- when '4' => result := x"4"; good := true;
- when '5' => result := x"5"; good := true;
- when '6' => result := x"6"; good := true;
- when '7' => result := x"7"; good := true;
- when '8' => result := x"8"; good := true;
- when '9' => result := x"9"; good := true;
- when 'A' | 'a' => result := x"A"; good := true;
- when 'B' | 'b' => result := x"B"; good := true;
- when 'C' | 'c' => result := x"C"; good := true;
- when 'D' | 'd' => result := x"D"; good := true;
- when 'E' | 'e' => result := x"E"; good := true;
- when 'F' | 'f' => result := x"F"; good := true;
- when 'Z' => result := "ZZZZ"; good := true;
- when 'X' => result := "XXXX"; good := true;
- when others =>
- assert not ISSUE_ERROR
- report
- "STD_LOGIC_1164.HREAD Read a '" & c &
- "', expected a Hex character (0-F)."
- severity error;
- good := false;
- end case;
- end procedure Char2QuadBits;
-
- procedure HREAD (L : inout LINE; VALUE : out STD_ULOGIC_VECTOR;
- GOOD : out BOOLEAN) is
- variable ok : BOOLEAN;
- variable c : CHARACTER;
- constant ne : INTEGER := (VALUE'length+3)/4;
- constant pad : INTEGER := ne*4 - VALUE'length;
- variable sv : STD_ULOGIC_VECTOR(0 to ne*4 - 1);
- variable i : INTEGER;
- variable lastu : BOOLEAN := false; -- last character was an "_"
- begin
- VALUE := (VALUE'range => 'U'); -- initialize to a "U"
- Skip_whitespace (L);
- if VALUE'length > 0 then
- read (l, c, ok);
- i := 0;
- while i < ne loop
- -- Bail out if there was a bad read
- if not ok then
- good := false;
- return;
- elsif c = '_' then
- if i = 0 then
- good := false; -- Begins with an "_"
- return;
- elsif lastu then
- good := false; -- "__" detected
- return;
- else
- lastu := true;
- end if;
- else
- Char2QuadBits(c, sv(4*i to 4*i+3), ok, false);
- if not ok then
- good := false;
- return;
- end if;
- i := i + 1;
- lastu := false;
- end if;
- if i < ne then
- read(L, c, ok);
- end if;
- end loop;
- if or_reduce (sv (0 to pad-1)) = '1' then -- %%% replace with "or"
- good := false; -- vector was truncated.
- else
- good := true;
- VALUE := sv (pad to sv'high);
- end if;
- else
- good := true; -- Null input string, skips whitespace
- end if;
- end procedure HREAD;
-
- procedure HREAD (L : inout LINE; VALUE : out STD_ULOGIC_VECTOR) is
- variable ok : BOOLEAN;
- variable c : CHARACTER;
- constant ne : INTEGER := (VALUE'length+3)/4;
- constant pad : INTEGER := ne*4 - VALUE'length;
- variable sv : STD_ULOGIC_VECTOR(0 to ne*4 - 1);
- variable i : INTEGER;
- variable lastu : BOOLEAN := false; -- last character was an "_"
- begin
- VALUE := (VALUE'range => 'U'); -- initialize to a "U"
- Skip_whitespace (L);
- if VALUE'length > 0 then -- non Null input string
- read (l, c, ok);
- i := 0;
- while i < ne loop
- -- Bail out if there was a bad read
- if not ok then
- report "STD_LOGIC_1164.HREAD "
- & "End of string encountered"
- severity error;
- return;
- end if;
- if c = '_' then
- if i = 0 then
- report "STD_LOGIC_1164.HREAD "
- & "String begins with an ""_""" severity error;
- return;
- elsif lastu then
- report "STD_LOGIC_1164.HREAD "
- & "Two underscores detected in input string ""__"""
- severity error;
- return;
- else
- lastu := true;
- end if;
- else
- Char2QuadBits(c, sv(4*i to 4*i+3), ok, true);
- if not ok then
- return;
- end if;
- i := i + 1;
- lastu := false;
- end if;
- if i < ne then
- read(L, c, ok);
- end if;
- end loop;
- if or_reduce (sv (0 to pad-1)) = '1' then -- %%% replace with "or"
- report "STD_LOGIC_1164.HREAD Vector truncated"
- severity error;
- else
- VALUE := sv (pad to sv'high);
- end if;
- end if;
- end procedure HREAD;
-
- procedure HWRITE (L : inout LINE; VALUE : in STD_ULOGIC_VECTOR;
- JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0) is
- begin
- write (L, to_hstring (VALUE), JUSTIFIED, FIELD);
- end procedure HWRITE;
-
-
- -- Octal Read and Write procedures for STD_ULOGIC_VECTOR.
- -- Modified from the original to be more forgiving.
-
- procedure Char2TriBits (C : CHARACTER;
- RESULT : out STD_ULOGIC_VECTOR(2 downto 0);
- GOOD : out BOOLEAN;
- ISSUE_ERROR : in BOOLEAN) is
- begin
- case c is
- when '0' => result := o"0"; good := true;
- when '1' => result := o"1"; good := true;
- when '2' => result := o"2"; good := true;
- when '3' => result := o"3"; good := true;
- when '4' => result := o"4"; good := true;
- when '5' => result := o"5"; good := true;
- when '6' => result := o"6"; good := true;
- when '7' => result := o"7"; good := true;
- when 'Z' => result := "ZZZ"; good := true;
- when 'X' => result := "XXX"; good := true;
- when others =>
- assert not ISSUE_ERROR
- report
- "STD_LOGIC_1164.OREAD Error: Read a '" & c &
- "', expected an Octal character (0-7)."
- severity error;
- good := false;
- end case;
- end procedure Char2TriBits;
-
- procedure OREAD (L : inout LINE; VALUE : out STD_ULOGIC_VECTOR;
- GOOD : out BOOLEAN) is
- variable ok : BOOLEAN;
- variable c : CHARACTER;
- constant ne : INTEGER := (VALUE'length+2)/3;
- constant pad : INTEGER := ne*3 - VALUE'length;
- variable sv : STD_ULOGIC_VECTOR(0 to ne*3 - 1);
- variable i : INTEGER;
- variable lastu : BOOLEAN := false; -- last character was an "_"
- begin
- VALUE := (VALUE'range => 'U'); -- initialize to a "U"
- Skip_whitespace (L);
- if VALUE'length > 0 then
- read (l, c, ok);
- i := 0;
- while i < ne loop
- -- Bail out if there was a bad read
- if not ok then
- good := false;
- return;
- elsif c = '_' then
- if i = 0 then
- good := false; -- Begins with an "_"
- return;
- elsif lastu then
- good := false; -- "__" detected
- return;
- else
- lastu := true;
- end if;
- else
- Char2TriBits(c, sv(3*i to 3*i+2), ok, false);
- if not ok then
- good := false;
- return;
- end if;
- i := i + 1;
- lastu := false;
- end if;
- if i < ne then
- read(L, c, ok);
- end if;
- end loop;
- if or_reduce (sv (0 to pad-1)) = '1' then -- %%% replace with "or"
- good := false; -- vector was truncated.
- else
- good := true;
- VALUE := sv (pad to sv'high);
- end if;
- else
- good := true; -- read into a null array
- end if;
- end procedure OREAD;
-
- procedure OREAD (L : inout LINE; VALUE : out STD_ULOGIC_VECTOR) is
- variable c : CHARACTER;
- variable ok : BOOLEAN;
- constant ne : INTEGER := (VALUE'length+2)/3;
- constant pad : INTEGER := ne*3 - VALUE'length;
- variable sv : STD_ULOGIC_VECTOR(0 to ne*3 - 1);
- variable i : INTEGER;
- variable lastu : BOOLEAN := false; -- last character was an "_"
- begin
- VALUE := (VALUE'range => 'U'); -- initialize to a "U"
- Skip_whitespace (L);
- if VALUE'length > 0 then
- read (l, c, ok);
- i := 0;
- while i < ne loop
- -- Bail out if there was a bad read
- if not ok then
- report "STD_LOGIC_1164.OREAD "
- & "End of string encountered"
- severity error;
- return;
- elsif c = '_' then
- if i = 0 then
- report "STD_LOGIC_1164.OREAD "
- & "String begins with an ""_""" severity error;
- return;
- elsif lastu then
- report "STD_LOGIC_1164.OREAD "
- & "Two underscores detected in input string ""__"""
- severity error;
- return;
- else
- lastu := true;
- end if;
- else
- Char2TriBits(c, sv(3*i to 3*i+2), ok, true);
- if not ok then
- return;
- end if;
- i := i + 1;
- lastu := false;
- end if;
- if i < ne then
- read(L, c, ok);
- end if;
- end loop;
- if or_reduce (sv (0 to pad-1)) = '1' then -- %%% replace with "or"
- report "STD_LOGIC_1164.OREAD Vector truncated"
- severity error;
- else
- VALUE := sv (pad to sv'high);
- end if;
- end if;
- end procedure OREAD;
-
- procedure OWRITE (L : inout LINE; VALUE : in STD_ULOGIC_VECTOR;
- JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0) is
- begin
- write (L, to_ostring(VALUE), JUSTIFIED, FIELD);
- end procedure OWRITE;
-
- -- Hex Read and Write procedures for STD_LOGIC_VECTOR
-
- procedure HREAD (L : inout LINE; VALUE : out STD_LOGIC_VECTOR;
- GOOD : out BOOLEAN) is
- variable ivalue : STD_ULOGIC_VECTOR (VALUE'range);
- begin
- HREAD (L => L, VALUE => ivalue, GOOD => GOOD);
- VALUE := to_stdlogicvector (ivalue);
- end procedure HREAD;
-
- procedure HREAD (L : inout LINE; VALUE : out STD_LOGIC_VECTOR) is
- variable ivalue : STD_ULOGIC_VECTOR (VALUE'range);
- begin
- HREAD (L => L, VALUE => ivalue);
- VALUE := to_stdlogicvector (ivalue);
- end procedure HREAD;
-
- procedure HWRITE (L : inout LINE; VALUE : in STD_LOGIC_VECTOR;
- JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0) is
- begin
- write (L, to_hstring(VALUE), JUSTIFIED, FIELD);
- end procedure HWRITE;
-
- -- Octal Read and Write procedures for STD_LOGIC_VECTOR
-
- procedure OREAD (L : inout LINE; VALUE : out STD_LOGIC_VECTOR;
- GOOD : out BOOLEAN) is
- variable ivalue : STD_ULOGIC_VECTOR (VALUE'range);
- begin
- OREAD (L => L, VALUE => ivalue, GOOD => GOOD);
- VALUE := to_stdlogicvector (ivalue);
- end procedure OREAD;
-
- procedure OREAD (L : inout LINE; VALUE : out STD_LOGIC_VECTOR) is
- variable ivalue : STD_ULOGIC_VECTOR (VALUE'range);
- begin
- OREAD (L => L, VALUE => ivalue);
- VALUE := to_stdlogicvector (ivalue);
- end procedure OREAD;
-
- procedure OWRITE (L : inout LINE; VALUE : in STD_LOGIC_VECTOR;
- JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0) is
- begin
- write (L, to_ostring(VALUE), JUSTIFIED, FIELD);
- end procedure OWRITE;
-
- -----------------------------------------------------------------------------
- -- New string functions for vhdl-200x fast track
- -----------------------------------------------------------------------------
- function to_string (value : STD_ULOGIC) return STRING is
- variable result : STRING (1 to 1);
- begin
- result (1) := MVL9_to_char (value);
- return result;
- end function to_string;
- -------------------------------------------------------------------
- -- TO_STRING (an alias called "to_bstring" is provide)
- -------------------------------------------------------------------
- function to_string (value : STD_ULOGIC_VECTOR) return STRING is
- alias ivalue : STD_ULOGIC_VECTOR(1 to value'length) is value;
- variable result : STRING(1 to value'length);
- begin
- if value'length < 1 then
- return NUS;
- else
- for i in ivalue'range loop
- result(i) := MVL9_to_char(iValue(i));
- end loop;
- return result;
- end if;
- end function to_string;
-
- -------------------------------------------------------------------
- -- TO_HSTRING
- -------------------------------------------------------------------
- function to_hstring (value : STD_ULOGIC_VECTOR) return STRING is
- constant ne : INTEGER := (value'length+3)/4;
- variable pad : STD_ULOGIC_VECTOR(0 to (ne*4 - value'length) - 1);
- variable ivalue : STD_ULOGIC_VECTOR(0 to ne*4 - 1);
- variable result : STRING(1 to ne);
- variable quad : STD_ULOGIC_VECTOR(0 to 3);
- begin
- if value'length < 1 then
- return NUS;
- else
- if value (value'left) = 'Z' then
- pad := (others => 'Z');
- else
- pad := (others => '0');
- end if;
- ivalue := pad & value;
- for i in 0 to ne-1 loop
- quad := To_X01Z(ivalue(4*i to 4*i+3));
- case quad is
- when x"0" => result(i+1) := '0';
- when x"1" => result(i+1) := '1';
- when x"2" => result(i+1) := '2';
- when x"3" => result(i+1) := '3';
- when x"4" => result(i+1) := '4';
- when x"5" => result(i+1) := '5';
- when x"6" => result(i+1) := '6';
- when x"7" => result(i+1) := '7';
- when x"8" => result(i+1) := '8';
- when x"9" => result(i+1) := '9';
- when x"A" => result(i+1) := 'A';
- when x"B" => result(i+1) := 'B';
- when x"C" => result(i+1) := 'C';
- when x"D" => result(i+1) := 'D';
- when x"E" => result(i+1) := 'E';
- when x"F" => result(i+1) := 'F';
- when "ZZZZ" => result(i+1) := 'Z';
- when others => result(i+1) := 'X';
- end case;
- end loop;
- return result;
- end if;
- end function to_hstring;
-
- -------------------------------------------------------------------
- -- TO_OSTRING
- -------------------------------------------------------------------
- function to_ostring (value : STD_ULOGIC_VECTOR) return STRING is
- constant ne : INTEGER := (value'length+2)/3;
- variable pad : STD_ULOGIC_VECTOR(0 to (ne*3 - value'length) - 1);
- variable ivalue : STD_ULOGIC_VECTOR(0 to ne*3 - 1);
- variable result : STRING(1 to ne);
- variable tri : STD_ULOGIC_VECTOR(0 to 2);
- begin
- if value'length < 1 then
- return NUS;
- else
- if value (value'left) = 'Z' then
- pad := (others => 'Z');
- else
- pad := (others => '0');
- end if;
- ivalue := pad & value;
- for i in 0 to ne-1 loop
- tri := To_X01Z(ivalue(3*i to 3*i+2));
- case tri is
- when o"0" => result(i+1) := '0';
- when o"1" => result(i+1) := '1';
- when o"2" => result(i+1) := '2';
- when o"3" => result(i+1) := '3';
- when o"4" => result(i+1) := '4';
- when o"5" => result(i+1) := '5';
- when o"6" => result(i+1) := '6';
- when o"7" => result(i+1) := '7';
- when "ZZZ" => result(i+1) := 'Z';
- when others => result(i+1) := 'X';
- end case;
- end loop;
- return result;
- end if;
- end function to_ostring;
-
- function to_string (value : STD_LOGIC_VECTOR) return STRING is
- begin
- return to_string (to_stdulogicvector (value));
- end function to_string;
-
- function to_hstring (value : STD_LOGIC_VECTOR) return STRING is
- begin
- return to_hstring (to_stdulogicvector (value));
- end function to_hstring;
-
- function to_ostring (value : STD_LOGIC_VECTOR) return STRING is
- begin
- return to_ostring (to_stdulogicvector (value));
- end function to_ostring;
-
- -- rtl_synthesis on
--- pragma synthesis_on
- function maximum (L, R : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR is
- begin -- function maximum
- if L > R then return L;
- else return R;
- end if;
- end function maximum;
-
- -- std_logic_vector output
- function minimum (L, R : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR is
- begin -- function minimum
- if L > R then return R;
- else return L;
- end if;
- end function minimum;
-
- function maximum (L, R : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
- begin -- function maximum
- if L > R then return L;
- else return R;
- end if;
- end function maximum;
-
- -- std_logic_vector output
- function minimum (L, R : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
- begin -- function minimum
- if L > R then return R;
- else return L;
- end if;
- end function minimum;
-
- function maximum (L, R : STD_ULOGIC) return STD_ULOGIC is
- begin -- function maximum
- if L > R then return L;
- else return R;
- end if;
- end function maximum;
-
- -- std_logic_vector output
- function minimum (L, R : STD_ULOGIC) return STD_ULOGIC is
- begin -- function minimum
- if L > R then return R;
- else return L;
- end if;
- end function minimum;
-end package body std_logic_1164_additions;
diff --git a/ieee_proposed/rtl_tb/fixed_synth.vhd b/ieee_proposed/rtl_tb/fixed_synth.vhd
deleted file mode 100644
index 67ea7a4..0000000
--- a/ieee_proposed/rtl_tb/fixed_synth.vhd
+++ /dev/null
@@ -1,741 +0,0 @@
--- Synthesis test for the fixed point math package
--- This test is designed to be synthesizable and exercise much of the package.
--- Created for vhdl-200x by David Bishop (dbishop@vhdl.org)
--- --------------------------------------------------------------------
--- modification history : Last Modified $Date: 2006-06-08 10:49:35-04 $
--- Version $Id: fixed_synth.vhdl,v 1.1 2006-06-08 10:49:35-04 l435385 Exp $
--- --------------------------------------------------------------------
-
-
-library ieee, ieee_proposed;
-use ieee.std_logic_1164.all;
-use ieee.numeric_std.all;
-use ieee_proposed.fixed_float_types.all;
-use ieee_proposed.fixed_pkg.all;
-entity fixed_synth is
-
- port (
- in1, in2 : in STD_LOGIC_VECTOR (15 downto 0); -- inputs
- out1 : out STD_LOGIC_VECTOR (15 downto 0); -- output
- cmd : in STD_LOGIC_VECTOR (3 downto 0);
- clk, rst_n : in STD_ULOGIC); -- clk and reset
-
-end entity fixed_synth;
-
-architecture rtl of fixed_synth is
-
- subtype sfixed7 is sfixed (3 downto -3); -- 7 bit
- subtype sfixed16 is sfixed (7 downto -8); -- 16 bit
- type cmd_type is array (1 to 15) of STD_ULOGIC_VECTOR (cmd'range); -- cmd
- signal cmdarray : cmd_type; -- command pipeline
--- type cry_type is array (0 to 4) of sfixed16; -- arrays
- signal outarray0, outarray1, outarray2, outarray3, outarray4,
- outarray5, outarray6, outarray7, outarray8, outarray9, outarray10,
- outarray11, outarray12, outarray13, outarray14, outarray15 : sfixed16;
- signal in1reg3, in2reg3 : sfixed16; -- register stages
-begin -- architecture rtl
-
- -- purpose: "0000" test the "+" operator
- cmd0reg : process (clk, rst_n) is
- variable in1pin2 : sfixed (SFixed_high(7, -8, '+', 7, -8) downto
- SFixed_low(7, -8, '+', 7, -8));
--- variable outarray : cry_type; -- array for output
--- variable in1array, in2array : cry_type; -- array for input
- begin -- process cmd0reg
- if rst_n = '0' then -- asynchronous reset (active low)
- outarray0 <= (others => '0');
--- jrloop : for j in 0 to 4 loop
--- outarray (j) := (others => '0');
--- in1array (j) := (others => '0');
--- in2array (j) := (others => '0');
--- end loop jrloop;
- elsif rising_edge(clk) then -- rising clock edge
--- outarray0 <= outarray(4);
--- jcloop : for j in 4 downto 1 loop
--- outarray (j) := outarray(j-1);
--- end loop jcloop;
--- j1loop : for j in 3 downto 1 loop
--- in1array (j) := in1array(j-1);
--- end loop j1loop;
--- j2loop : for j in 3 downto 1 loop
--- in2array (j) := in2array(j-1);
--- end loop j2loop;
--- in1array(0) := in1reg3;
--- in2array(0) := in2reg3;
- in1pin2 := in1reg3 + in2reg3;
- outarray0 <= resize (in1pin2, outarray0);
- end if;
- end process cmd0reg;
-
- -- purpose: "0001" test the "-" operator
- cmd1reg : process (clk, rst_n) is
--- variable outarray : cry_type; -- array for output
--- variable in1array, in2array : cry_type; -- array for input
--- variable in1min2 : sfixed (SFixed_high(in1reg3, '-', in2reg3) downto
--- SFixed_low(in1reg3, '-', in2reg3));
- variable in1min2 : sfixed (SFixed_high(7, -8, '-', 7, -8) downto
- SFixed_low(7, -8, '-', 7, -8));
- begin -- process cmd0reg
- if rst_n = '0' then -- asynchronous reset (active low)
- outarray1 <= (others => '0');
--- jrloop : for j in 0 to 4 loop
--- outarray (j) := (others => '0');
--- in1array (j) := (others => '0');
--- in2array (j) := (others => '0');
--- end loop jrloop;
- elsif rising_edge(clk) then -- rising clock edge
--- outarray1 <= outarray(4);
--- jcloop : for j in 4 downto 1 loop
--- outarray (j) := outarray(j-1);
--- end loop jcloop;
--- j1loop : for j in 3 downto 1 loop
--- in1array (j) := in1array(j-1);
--- end loop j1loop;
--- j2loop : for j in 3 downto 1 loop
--- in2array (j) := in2array(j-1);
--- end loop j2loop;
--- in1array(0) := in1reg3;
--- in2array(0) := in2reg3;
- in1min2 := in1reg3 - in2reg3;
- outarray1 <= resize (in1min2, outarray1);
- end if;
- end process cmd1reg;
-
- -- purpose: "0010" test the "*" operator
- cmd2reg : process (clk, rst_n) is
--- variable in1min2 : sfixed (SFixed_high(in1reg3, '*', in2reg3) downto
--- SFixed_low(in1reg3, '*', in2reg3));
- variable in1min2 : sfixed (SFixed_high(7, -8, '*', 7, -8) downto
- SFixed_low(7, -8, '*', 7, -8));
--- variable outarray : cry_type; -- array for output
--- variable in1array, in2array : cry_type; -- array for input
- begin -- process cmd0reg
- if rst_n = '0' then -- asynchronous reset (active low)
- outarray2 <= (others => '0');
--- jrloop : for j in 0 to 4 loop
--- outarray (j) := (others => '0');
--- in1array (j) := (others => '0');
--- in2array (j) := (others => '0');
--- end loop jrloop;
- elsif rising_edge(clk) then -- rising clock edge
--- outarray2 <= outarray(4);
--- jcloop : for j in 4 downto 1 loop
--- outarray (j) := outarray(j-1);
--- end loop jcloop;
--- j1loop : for j in 3 downto 1 loop
--- in1array (j) := in1array(j-1);
--- end loop j1loop;
--- j2loop : for j in 3 downto 1 loop
--- in2array (j) := in2array(j-1);
--- end loop j2loop;
--- in1array(0) := in1reg3;
--- in2array(0) := in2reg3;
- in1min2 := in1reg3 * in2reg3;
- outarray2 <= resize (in1min2, outarray2);
- end if;
- end process cmd2reg;
-
- -- purpose: "0011" test the "/" operator
--- cmd3reg : process (clk, rst_n) is
--- variable in1min2 : sfixed (SFixed_high(in1reg3'high, in1reg3'low,
--- '/', in2reg3'high, in2reg3'low)
--- downto
--- SFixed_low(in1reg3'high, in1reg3'low,
--- '/', in2reg3'high, in2reg3'low));
--- variable outarray : cry_type; -- array for output
--- variable in1array, in2array : cry_type; -- array for input
--- begin -- process cmd3reg
--- if rst_n = '0' then -- asynchronous reset (active low)
--- outarray3 <= (others => '0');
--- jrloop : for j in 0 to 4 loop
--- outarray (j) := (others => '0');
--- in1array (j) := (others => '0');
--- in2array (j) := to_sfixed(1, in2array(0));
--- end loop jrloop;
--- elsif rising_edge(clk) then -- rising clock edge
--- outarray3 <= outarray(4);
--- jcloop : for j in 4 downto 1 loop
--- outarray (j) := outarray(j-1);
--- end loop jcloop;
--- j1loop : for j in 3 downto 1 loop
--- in1array (j) := in1array(j-1);
--- end loop j1loop;
--- j2loop : for j in 3 downto 1 loop
--- in2array (j) := in2array(j-1);
--- end loop j2loop;
--- in1array(0) := in1reg3;
--- if (in2reg3 = 0) then
--- in2array(0) := to_sfixed(1, in2array(0));
--- else
--- in2array(0) := in2reg3;
--- end if;
--- in1min2 := in1array(3) / in2array(3);
--- outarray(0) := resize (in1min2, outarray(0));
--- end if;
--- end process cmd3reg;
- outarray3 <= (others => '0');
-
- -- purpose: "0100" test the "+" operator
- cmd4reg : process (clk, rst_n) is
- variable in1pin2 : ufixed (uFixed_high(7, -8, '+', 7, -8) downto
- uFixed_low(7, -8, '+', 7, -8));
--- variable outarray : cry_type; -- array for output
--- variable in1array, in2array : cry_type; -- array for input
- begin -- process cmd0reg
- if rst_n = '0' then -- asynchronous reset (active low)
- outarray4 <= (others => '0');
--- jrloop : for j in 0 to 4 loop
--- outarray (j) := (others => '0');
--- in1array (j) := (others => '0');
--- in2array (j) := (others => '0');
--- end loop jrloop;
- elsif rising_edge(clk) then -- rising clock edge
--- outarray4 <= outarray(4);
--- jcloop : for j in 4 downto 1 loop
--- outarray (j) := outarray(j-1);
--- end loop jcloop;
--- j1loop : for j in 3 downto 1 loop
--- in1array (j) := in1array(j-1);
--- end loop j1loop;
--- j2loop : for j in 3 downto 1 loop
--- in2array (j) := in2array(j-1);
--- end loop j2loop;
--- in1array(0) := in1reg3;
--- in2array(0) := in2reg3;
- in1pin2 := ufixed(in1reg3) + ufixed(in2reg3);
- outarray4 <= sfixed (resize (in1pin2, outarray4'high, outarray4'low));
- end if;
- end process cmd4reg;
-
- -- purpose: "0101" test the "-" operator
- cmd5reg : process (clk, rst_n) is
- variable in1min2 : ufixed (uFixed_high(7, -8, '-', 7, -8) downto
- uFixed_low(7, -8, '-', 7, -8));
--- variable outarray : cry_type; -- array for output
--- variable in1array, in2array : cry_type; -- array for input
- begin -- process cmd0reg
- if rst_n = '0' then -- asynchronous reset (active low)
- outarray5 <= (others => '0');
--- jrloop : for j in 0 to 4 loop
--- outarray (j) := (others => '0');
--- in1array (j) := (others => '0');
--- in2array (j) := (others => '0');
--- end loop jrloop;
- elsif rising_edge(clk) then -- rising clock edge
--- outarray5 <= outarray(4);
--- jcloop : for j in 4 downto 1 loop
--- outarray (j) := outarray(j-1);
--- end loop jcloop;
--- j1loop : for j in 3 downto 1 loop
--- in1array (j) := in1array(j-1);
--- end loop j1loop;
--- j2loop : for j in 3 downto 1 loop
--- in2array (j) := in2array(j-1);
--- end loop j2loop;
--- in1array(0) := in1reg3;
--- in2array(0) := in2reg3;
- in1min2 := ufixed(in1reg3) - ufixed(in2reg3);
- outarray5 <= sfixed(resize (in1min2, outarray5'high, outarray5'low));
- end if;
- end process cmd5reg;
-
- -- purpose: "0110" test the "*" operator
- cmd6reg : process (clk, rst_n) is
- variable in1min2 : ufixed (uFixed_high(7, -8, '*', 7, -8) downto
- uFixed_low(7, -8, '*', 7, -8));
--- variable outarray : cry_type; -- array for output
--- variable in1array, in2array : cry_type; -- array for input
- begin -- process cmd0reg
- if rst_n = '0' then -- asynchronous reset (active low)
- outarray6 <= (others => '0');
--- jrloop : for j in 0 to 4 loop
--- outarray (j) := (others => '0');
--- in1array (j) := (others => '0');
--- in2array (j) := (others => '0');
--- end loop jrloop;
- elsif rising_edge(clk) then -- rising clock edge
--- outarray6 <= outarray(4);
--- jcloop : for j in 4 downto 1 loop
--- outarray (j) := outarray(j-1);
--- end loop jcloop;
--- j1loop : for j in 3 downto 1 loop
--- in1array (j) := in1array(j-1);
--- end loop j1loop;
--- j2loop : for j in 3 downto 1 loop
--- in2array (j) := in2array(j-1);
--- end loop j2loop;
--- in1array(0) := in1reg3;
--- in2array(0) := in2reg3;
- in1min2 := ufixed(in1reg3) * ufixed(in2reg3);
- outarray6 <= sfixed(resize (in1min2, outarray6'high, outarray6'low));
- end if;
- end process cmd6reg;
-
- -- purpose: "0111" test the "/" operator
--- cmd7reg : process (clk, rst_n) is
--- variable in1min2 : ufixed (uFixed_high(7, -8, '/', 7, -8) downto
--- uFixed_low(7, -8, '/', 7, -8));
--- variable outarray : cry_type; -- array for output
--- variable in1array, in2array : cry_type; -- array for input
--- begin -- process cmd0reg
--- if rst_n = '0' then -- asynchronous reset (active low)
--- outarray7 <= (others => '0');
--- jrloop : for j in 0 to 4 loop
--- outarray (j) := (others => '0');
--- in1array (j) := (others => '0');
--- in2array (j) := sfixed(to_ufixed(1, in2reg3'high, in2reg3'low));
--- end loop jrloop;
--- elsif rising_edge(clk) then -- rising clock edge
--- outarray7 <= outarray(4);
--- jcloop : for j in 4 downto 1 loop
--- outarray (j) := outarray(j-1);
--- end loop jcloop;
--- j1loop : for j in 3 downto 1 loop
--- in1array (j) := in1array(j-1);
--- end loop j1loop;
--- j2loop : for j in 3 downto 1 loop
--- in2array (j) := in2array(j-1);
--- end loop j2loop;
--- in1array(0) := in1reg3;
--- if (in2reg3 = 0) then
--- in2array(0) := sfixed(to_ufixed(1, in2reg3'high, in2reg3'low));
--- else
--- in2array(0) := in2reg3;
--- end if;
--- in1min2 := ufixed(in1array(3)) / ufixed(in2array(3));
--- outarray(0) := sfixed(resize (in1min2, outarray7'high, outarray7'low));
--- end if;
--- end process cmd7reg;
- outarray7 <= (others => '0');
-
- -- purpose: "1000" test the resize test
- cmd8reg : process (clk, rst_n) is
- variable tmpfp71, tmpfp72 : sfixed7; -- 8 bit fp number
--- variable outarray : cry_type; -- array for output
--- variable in1array, in2array : cry_type; -- array for input
- begin -- process cmd0reg
- if rst_n = '0' then -- asynchronous reset (active low)
- outarray8 <= (others => '0');
--- jrloop : for j in 0 to 4 loop
--- outarray (j) := (others => '0');
--- in1array (j) := (others => '0');
--- in2array (j) := (others => '0');
--- end loop jrloop;
- elsif rising_edge(clk) then -- rising clock edge
--- outarray8 <= outarray(4);
--- jcloop : for j in 4 downto 1 loop
--- outarray (j) := outarray(j-1);
--- end loop jcloop;
--- j1loop : for j in 3 downto 1 loop
--- in1array (j) := in1array(j-1);
--- end loop j1loop;
--- j2loop : for j in 3 downto 1 loop
--- in2array (j) := in2array(j-1);
--- end loop j2loop;
--- in1array(0) := in1reg3;
--- in2array(0) := in2reg3;
- -- Resize test Convert inputs into two 8 bit numbers
- tmpfp71 := resize (in1reg3, tmpfp71'high, tmpfp71'low,
- fixed_wrap, fixed_truncate);
- tmpfp72 := resize (in2reg3, tmpfp72'high, tmpfp72'low,
- fixed_saturate, fixed_round);
- outarray8 <= (others => '0');
- fx1 : for i in tmpfp71'range loop
- outarray8(i+4) <= tmpfp71(i);
- end loop fx1;
- fx2 : for i in tmpfp72'range loop
- outarray8(i-4) <= tmpfp72(i);
- end loop fx2;
- end if;
- end process cmd8reg;
-
- -- purpose: "1001" test the to_signed/unsigned test
- cmd9reg : process (clk, rst_n) is
- variable tmp : STD_LOGIC_VECTOR (1 downto 0); -- temp
- variable tmpsig : SIGNED (7 downto 0); -- signed number
- variable tmpuns : UNSIGNED (15 downto 0); -- unsigned number
- variable tmpint : INTEGER;
--- variable outarray : cry_type; -- array for output
--- variable in1array, in2array : cry_type; -- array for input
- begin -- process cmd0reg
- if rst_n = '0' then -- asynchronous reset (active low)
- outarray9 <= (others => '0');
--- jrloop : for j in 0 to 4 loop
--- outarray (j) := (others => '0');
--- in1array (j) := (others => '0');
--- in2array (j) := (others => '0');
--- end loop jrloop;
- elsif rising_edge(clk) then -- rising clock edge
--- outarray9 <= outarray(4);
--- jcloop : for j in 4 downto 1 loop
--- outarray (j) := outarray(j-1);
--- end loop jcloop;
--- j1loop : for j in 3 downto 1 loop
--- in1array (j) := in1array(j-1);
--- end loop j1loop;
--- j2loop : for j in 3 downto 1 loop
--- in2array (j) := in2array(j-1);
--- end loop j2loop;
--- in1array(0) := in1reg3;
--- in2array(0) := in2reg3;
- tmp := to_slv (in2reg3(in2reg3'high downto in2reg3'high-1));
- if (tmp = "00") then
- -- Signed to sfixed and back
- tmpsig := to_signed (in1reg3, tmpsig'length);
- outarray9 <= to_sfixed (tmpsig, outarray9);
- elsif (tmp = "01") then
- -- unsigned to ufixed and back
- tmpuns := to_unsigned (ufixed(in1reg3), tmpuns'length);
- outarray9 <= sfixed(to_ufixed (tmpuns, outarray9'high,
- outarray9'low));
- elsif (tmp = "10") then
- tmpint := to_integer (in1reg3);
- outarray9 <= to_sfixed (tmpint, outarray9);
- else
- tmpint := to_integer (ufixed(in1reg3));
- outarray9 <= sfixed(to_ufixed (tmpint, outarray9'high,
- outarray9'low));
-
- end if;
- end if;
- end process cmd9reg;
-
- -- purpose: "1010" test the reciprocal, abs, - test
--- cmd10reg : process (clk, rst_n) is
--- variable tmp : STD_LOGIC_VECTOR (1 downto 0); -- temp
--- variable in1recip : sfixed (-in1reg3'low+1 downto -in1reg3'high);
--- variable uin1recip : ufixed (-in1reg3'low downto -in1reg3'high-1);
--- variable in1pin2 : sfixed (SFixed_high(7, -8, '+', 7, -8) downto
--- SFixed_low(7, -8, '+', 7, -8));
--- variable outarray : cry_type; -- array for output
--- variable in1array, in2array : cry_type; -- array for input
--- begin -- process cmd0reg
--- if rst_n = '0' then -- asynchronous reset (active low)
--- outarray10 <= (others => '0');
--- jrloop : for j in 0 to 4 loop
--- outarray (j) := (others => '0');
--- in1array (j) := to_sfixed(1, in1reg3);
--- in2array (j) := (others => '0');
--- end loop jrloop;
--- elsif rising_edge(clk) then -- rising clock edge
--- outarray10 <= outarray(4);
--- jcloop : for j in 4 downto 1 loop
--- outarray (j) := outarray(j-1);
--- end loop jcloop;
--- j1loop : for j in 3 downto 1 loop
--- in1array (j) := in1array(j-1);
--- end loop j1loop;
--- j2loop : for j in 3 downto 1 loop
--- in2array (j) := in2array(j-1);
--- end loop j2loop;
--- if (in1reg3 = 0) then
--- in1array(0) := to_sfixed(1, in1reg3);
--- else
--- in1array(0) := in1reg3;
--- end if;
--- in2array(0) := in2reg3;
--- tmp := to_slv (in2array(3)(in2reg3'high downto in2reg3'high-1));
--- if (tmp = "00") then
--- in1recip := reciprocal (in1reg3);
--- outarray(0) := resize (in1recip, outarray(0)'high,
--- outarray(0)'low);
--- elsif (tmp = "01") then
--- uin1recip := reciprocal (ufixed(in1reg3));
--- outarray(0) := sfixed(resize (uin1recip, outarray(0)'high,
--- outarray(0)'low));
--- elsif (tmp = "10") then
--- -- abs
--- in1pin2 := abs(in1reg3);
--- outarray(0) := resize (in1pin2,
--- outarray(0)'high,
--- outarray(0)'low);
--- else
--- -- -
--- in1pin2 := - in1reg3;
--- outarray(0) := resize (in1pin2,
--- outarray(0)'high,
--- outarray(0)'low);
--- end if;
--- end if;
--- end process cmd10reg;
- outarray10 <= (others => '0');
-
- -- purpose: "1011" test the mod operator
--- cmd11reg : process (clk, rst_n) is
--- variable in1min2 : sfixed (SFixed_high(7, -8, 'M', 7, -8) downto
--- SFixed_low(7, -8, 'm', 7, -8));
--- variable outarray : cry_type; -- array for output
--- variable in1array, in2array : cry_type; -- array for input
--- begin -- process cmd0reg
--- if rst_n = '0' then -- asynchronous reset (active low)
--- outarray11 <= (others => '0');
--- jrloop : for j in 0 to 4 loop
--- outarray (j) := (others => '0');
--- in1array (j) := (others => '0');
--- in2array (j) := to_sfixed(1, in2array(0));
--- end loop jrloop;
--- elsif rising_edge(clk) then -- rising clock edge
--- outarray11 <= outarray(4);
--- jcloop : for j in 4 downto 1 loop
--- outarray (j) := outarray(j-1);
--- end loop jcloop;
--- j1loop : for j in 3 downto 1 loop
--- in1array (j) := in1array(j-1);
--- end loop j1loop;
--- j2loop : for j in 3 downto 1 loop
--- in2array (j) := in2array(j-1);
--- end loop j2loop;
--- in1array(0) := in1reg3;
--- if (in2reg3 = 0) then
--- in2array(0) := to_sfixed(1, in2array(0));
--- else
--- in2array(0) := in2reg3;
--- end if;
--- in1min2 := in1reg3 mod in2array(3);
--- outarray(0) := resize (in1min2, outarray(0));
--- end if;
--- end process cmd11reg;
- outarray11 <= (others => '0');
-
- -- purpose: "1100" test the rem operator
--- cmd12reg : process (clk, rst_n) is
--- variable in1min2 : sfixed (SFixed_high(7, -8, 'R', 7, -8) downto
--- SFixed_low(7, -8, 'r', 7, -8));
--- variable outarray : cry_type; -- array for output
--- variable in1array, in2array : cry_type; -- array for input
--- begin -- process cmd0reg
--- if rst_n = '0' then -- asynchronous reset (active low)
--- outarray12 <= (others => '0');
--- jrloop : for j in 0 to 4 loop
--- outarray (j) := (others => '0');
--- in1array (j) := (others => '0');
--- in2array (j) := to_sfixed(1, in2array(0));
--- end loop jrloop;
--- elsif rising_edge(clk) then -- rising clock edge
--- outarray12 <= outarray(4);
--- jcloop : for j in 4 downto 1 loop
--- outarray (j) := outarray(j-1);
--- end loop jcloop;
--- j1loop : for j in 3 downto 1 loop
--- in1array (j) := in1array(j-1);
--- end loop j1loop;
--- j2loop : for j in 3 downto 1 loop
--- in2array (j) := in2array(j-1);
--- end loop j2loop;
--- in1array(0) := in1reg3;
--- if (in2reg3 = 0) then
--- in2array(0) := to_sfixed(1, in2array(0));
--- else
--- in2array(0) := in2reg3;
--- end if;
--- in1min2 := in1reg3 rem in2array(3);
--- outarray(0) := resize (in1min2, outarray(0));
--- end if;
--- end process cmd12reg;
- outarray12 <= (others => '0');
-
- -- purpose: "1101" test the srl operator
- cmd13reg : process (clk, rst_n) is
--- variable outarray : cry_type; -- array for output
--- variable in1array, in2array : cry_type; -- array for input
- begin -- process cmd0reg
- if rst_n = '0' then -- asynchronous reset (active low)
- outarray13 <= (others => '0');
--- jrloop : for j in 0 to 4 loop
--- outarray (j) := (others => '0');
--- in1array (j) := (others => '0');
--- in2array (j) := (others => '0');
--- end loop jrloop;
- elsif rising_edge(clk) then -- rising clock edge
--- outarray13 <= outarray(4);
--- jcloop : for j in 4 downto 1 loop
--- outarray (j) := outarray(j-1);
--- end loop jcloop;
--- j1loop : for j in 3 downto 1 loop
--- in1array (j) := in1array(j-1);
--- end loop j1loop;
--- j2loop : for j in 3 downto 1 loop
--- in2array (j) := in2array(j-1);
--- end loop j2loop;
--- in1array(0) := in1reg3;
--- in2array(0) := in2reg3;
- outarray13 <= in1reg3 srl to_integer(in2reg3);
- end if;
- end process cmd13reg;
-
- -- purpose: "1110" test the sra operator
- cmd14reg : process (clk, rst_n) is
--- variable outarray : cry_type; -- array for output
--- variable in1array, in2array : cry_type; -- array for input
- begin -- process cmd0reg
- if rst_n = '0' then -- asynchronous reset (active low)
- outarray14 <= (others => '0');
--- jrloop : for j in 0 to 4 loop
--- outarray (j) := (others => '0');
--- in1array (j) := (others => '0');
--- in2array (j) := (others => '0');
--- end loop jrloop;
- elsif rising_edge(clk) then -- rising clock edge
--- outarray14 <= outarray(4);
--- jcloop : for j in 4 downto 1 loop
--- outarray (j) := outarray(j-1);
--- end loop jcloop;
--- j1loop : for j in 3 downto 1 loop
--- in1array (j) := in1array(j-1);
--- end loop j1loop;
--- j2loop : for j in 3 downto 1 loop
--- in2array (j) := in2array(j-1);
--- end loop j2loop;
--- in1array(0) := in1reg3;
--- in2array(0) := in2reg3;
- outarray14 <= in1reg3 sra to_integer(in2reg3);
- end if;
- end process cmd14reg;
-
- -- purpose: "1111" test the sra operator
- cmd15reg : process (clk, rst_n) is
- constant match_data : sfixed16 := "01HL----10HL----"; -- for ?= command
--- variable outarray : cry_type; -- array for output
--- variable in1array, in2array : cry_type; -- array for input
- begin -- process cmd0reg
- if rst_n = '0' then -- asynchronous reset (active low)
- outarray15 <= (others => '0');
--- jrloop : for j in 0 to 4 loop
--- outarray (j) := (others => '0');
--- in1array (j) := (others => '0');
--- in2array (j) := (others => '0');
--- end loop jrloop;
- elsif rising_edge(clk) then -- rising clock edge
--- outarray15 <= outarray(4);
--- jcloop : for j in 4 downto 1 loop
--- outarray (j) := outarray(j-1);
--- end loop jcloop;
--- j1loop : for j in 3 downto 1 loop
--- in1array (j) := in1array(j-1);
--- end loop j1loop;
--- j2loop : for j in 3 downto 1 loop
--- in2array (j) := in2array(j-1);
--- end loop j2loop;
--- in1array(0) := in1reg3;
--- in2array(0) := in2reg3;
- -- compare test
- if (in1reg3 = in2reg3) then
- outarray15(-8) <= '1';
- else
- outarray15(-8) <= '0';
- end if;
- if (in1reg3 /= in2reg3) then
- outarray15(-7) <= '1';
- else
- outarray15(-7) <= '0';
- end if;
- if (in1reg3 < in2reg3) then
- outarray15(-6) <= '1';
- else
- outarray15(-6) <= '0';
- end if;
- if (in1reg3 > in2reg3) then
- outarray15(-5) <= '1';
- else
- outarray15(-5) <= '0';
- end if;
- if (in1reg3 <= in2reg3) then
- outarray15(-4) <= '1';
- else
- outarray15(-4) <= '0';
- end if;
- if (in1reg3 >= in2reg3) then
- outarray15(-3) <= '1';
- else
- outarray15(-3) <= '0';
- end if;
- if (in1reg3 = 45) then
- outarray15(-2) <= '1';
- else
- outarray15(-2) <= '0';
- end if;
- if (in1reg3 = 3.125) then
- outarray15(-1) <= '1';
- else
- outarray15(-1) <= '0';
- end if;
- -- add integer and real
- outarray15(0) <= \?=\ (in1reg3, in2reg3 + 45);
- if (in1reg3 = in2reg3 + 3.125) then
- outarray15(1) <= '1';
- else
- outarray15(1) <= '0';
- end if;
- if (std_match (in1reg3, match_data)) then
- outarray15(2) <= '1';
- else
- outarray15(2) <= '0';
- end if;
- outarray15(3) <= nor_reduce (in1reg3 or in2reg3);
- outarray15(4) <= xnor_reduce (in1reg3 xor in2reg3);
- outarray15(5) <= nand_reduce (not in1reg3);
- outarray15(6) <= or_reduce ('1' and ufixed(in1reg3));
- if find_leftmost(in1reg3, '1') = 3 then
- outarray15(7) <= '1';
- else
- outarray15(7) <= '0';
- end if;
- end if;
- end process cmd15reg;
-
- -- purpose: register the inputs and the outputs
- -- type : sequential
- -- inputs : clk, rst_n, in1, in2
- -- outputs: out1
- cmdreg : process (clk, rst_n) is
- variable outreg : sfixed16; -- register stages
- variable in1reg, in2reg : sfixed16; -- register stages
- variable in1reg2, in2reg2 : sfixed16; -- register stages
- begin -- process mulreg
- if rst_n = '0' then -- asynchronous reset (active low)
- in1reg := (others => '0');
- in2reg := (others => '0');
- in1reg2 := (others => '0');
- in2reg2 := (others => '0');
- in1reg3 <= (others => '0');
- in2reg3 <= (others => '0');
- out1 <= (others => '0');
- outreg := (others => '0');
- rcloop : for i in 1 to 15 loop
- cmdarray (i) <= (others => '0');
- end loop rcloop;
- elsif rising_edge(clk) then -- rising clock edge
- out1 <= to_slv (outreg);
- outregc : case cmdarray (13) is
- when "0000" => outreg := outarray0;
- when "0001" => outreg := outarray1;
- when "0010" => outreg := outarray2;
- when "0011" => outreg := outarray3;
- when "0100" => outreg := outarray4;
- when "0101" => outreg := outarray5;
- when "0110" => outreg := outarray6;
- when "0111" => outreg := outarray7;
- when "1000" => outreg := outarray8;
- when "1001" => outreg := outarray9;
- when "1010" => outreg := outarray10;
- when "1011" => outreg := outarray11;
- when "1100" => outreg := outarray12;
- when "1101" => outreg := outarray13;
- when "1110" => outreg := outarray14;
- when "1111" => outreg := outarray15;
- when others => null;
- end case outregc;
- cmdpipe : for i in 15 downto 3 loop
- cmdarray (i) <= cmdarray (i-1);
- end loop cmdpipe;
- cmdarray (2) <= STD_ULOGIC_VECTOR(cmd);
- in1reg3 <= in1reg2;
- in2reg3 <= in2reg2;
- in1reg2 := in1reg;
- in2reg2 := in2reg;
- in1reg := to_sfixed (in1, in1reg);
- in2reg := to_sfixed (in2, in2reg);
- end if;
- end process cmdreg;
-
-end architecture rtl;
diff --git a/ieee_proposed/rtl_tb/float_synth.vhd b/ieee_proposed/rtl_tb/float_synth.vhd
deleted file mode 100644
index be9786e..0000000
--- a/ieee_proposed/rtl_tb/float_synth.vhd
+++ /dev/null
@@ -1,712 +0,0 @@
--------------------------------------------------------------------------------
--- Synthesis test for the floating point math package
--- This test is designed to be synthesizable and exercise much of the package.
--- Created for vhdl-200x by David Bishop (dbishop@vhdl.org)
--- --------------------------------------------------------------------
--- modification history : Last Modified $Date: 2006-06-08 10:50:32-04 $
--- Version $Id: float_synth.vhdl,v 1.1 2006-06-08 10:50:32-04 l435385 Exp $
--------------------------------------------------------------------------------
-library ieee, ieee_proposed;
-use ieee.std_logic_1164.all;
-use ieee.numeric_std.all;
-use ieee_proposed.fixed_float_types.all;
-use ieee_proposed.fixed_pkg.all;
-use ieee_proposed.float_pkg.all;
-use ieee.math_real.all;
-entity float_synth is
-
- port (
- in1, in2 : in std_logic_vector (31 downto 0); -- inputs
- out1 : out std_logic_vector (31 downto 0); -- output
- cmd : in std_logic_vector (3 downto 0);
- clk, rst_n : in std_ulogic); -- clk and reset
-
-end entity float_synth;
-
-architecture rtl of float_synth is
- subtype fp16 is float (6 downto -9); -- 16 bit
-
- type cmd_type is array (1 to 15) of std_ulogic_vector (cmd'range); -- cmd
- signal cmdarray : cmd_type; -- command pipeline
- type cry_type is array (0 to 15) of float32; -- arrays
- signal outx : cry_type;
- signal in1reg3, in2reg3 : float32; -- register stages
-
-begin -- architecture rtl
-
- -- purpose: "0000" test the "+" operator
- cmd0reg: process (clk, rst_n) is
- variable outarray : cry_type; -- array for output
- begin -- process cmd0reg
-
- if rst_n = '0' then -- asynchronous reset (active low)
- outx(0) <= ( others => '0');
- jrloop: for j in 0 to 7 loop
- outarray (j) := (others => '0');
- end loop jrloop;
- elsif rising_edge(clk) then -- rising clock edge
- outx(0) <= outarray(7);
- jcloop: for j in 7 downto 1 loop
- outarray (j) := outarray(j-1);
- end loop jcloop;
- outarray(0) := in1reg3 + in2reg3;
- end if;
-
- end process cmd0reg;
-
- -- purpose: "0001" test the "-" operator
- cmd1reg: process (clk, rst_n) is
- variable outarray : cry_type; -- array for output
- begin -- process cmd1reg
-
- if rst_n = '0' then -- asynchronous reset (active low)
- outx(1) <= ( others => '0');
- jrloop: for j in 0 to 7 loop
- outarray (j) := (others => '0');
- end loop jrloop;
- elsif rising_edge(clk) then -- rising clock edge
- outx(1) <= outarray(7);
- jcloop: for j in 7 downto 1 loop
- outarray (j) := outarray(j-1);
- end loop jcloop;
- outarray(0) := in1reg3 - in2reg3;
- end if;
-
- end process cmd1reg;
-
- -- purpose: "0010" test the "*" operator
- cmd2reg: process (clk, rst_n) is
- variable outarray : cry_type; -- array for output
- begin -- process cmd2reg
-
- if rst_n = '0' then -- asynchronous reset (active low)
- outx(2) <= ( others => '0');
- jrloop: for j in 0 to 7 loop
- outarray (j) := (others => '0');
- end loop jrloop;
- elsif rising_edge(clk) then -- rising clock edge
- outx(2) <= outarray(7);
- jcloop: for j in 7 downto 1 loop
- outarray (j) := outarray(j-1);
- end loop jcloop;
- outarray(0) := in1reg3 * in2reg3;
- end if;
-
- end process cmd2reg;
-
- -- purpose: "0011" performs test the "/" operator
- cmd3reg: process (clk, rst_n) is
- variable outarray : cry_type; -- array for output
- begin -- process cmd1reg
- if rst_n = '0' then -- asynchronous reset (active low)
- outx(3) <= ( others => '0');
- jrloop: for j in 0 to 7 loop
- outarray (j) := (others => '0');
- end loop jrloop;
- elsif rising_edge(clk) then -- rising clock edge
- outx(3) <= outarray(7);
- jcloop: for j in 7 downto 1 loop
- outarray (j) := outarray(j-1);
- end loop jcloop;
- if (cmdarray(4) = "0011") then
- outarray(0) := in1reg3 / in2reg3;
- else
- outarray(0) := (others => '0');
- end if;
- end if;
- end process cmd3reg;
-
- -- purpose: "0100" test the "resize" function
- cmd4reg: process (clk, rst_n) is
- variable tmpfp161, tmpfp162 : fp16; -- 16 bit fp number
- variable outarray : cry_type; -- array for output
- variable tmpcmd : STD_LOGIC_VECTOR (2 downto 0);
- begin -- process cmd1reg
- if rst_n = '0' then -- asynchronous reset (active low)
- outx(4) <= ( others => '0');
- jrloop: for j in 0 to 7 loop
- outarray (j) := (others => '0');
- end loop jrloop;
- elsif rising_edge(clk) then -- rising clock edge
- outx(4) <= outarray(7);
- jcloop: for j in 7 downto 1 loop
- outarray (j) := outarray(j-1);
- end loop jcloop;
- tmpcmd := to_slv (in2reg3 (in2reg3'low+2 downto in2reg3'low));
- case tmpcmd is
- when "000" =>
- tmpfp161 := resize ( arg => in1reg3,
- exponent_width => tmpfp161'high,
- fraction_width => -tmpfp161'low,
- denormalize_in => true,
- denormalize => false,
- round_style => round_zero);
- when "001" =>
- tmpfp161 := resize ( arg => in1reg3,
--- size_res => tmpfp161,
- exponent_width => tmpfp161'high,
- fraction_width => -tmpfp161'low,
- denormalize_in => false,
- denormalize => false);
- when "010" =>
- tmpfp161 := resize ( arg => in1reg3,
- exponent_width => tmpfp161'high,
- fraction_width => -tmpfp161'low,
- denormalize_in => false,
- denormalize => false);
- when "011" =>
- tmpfp161 := resize ( arg => in1reg3,
--- size_res => tmpfp161,
- exponent_width => tmpfp161'high,
- fraction_width => -tmpfp161'low,
- denormalize_in => true,
- denormalize => false,
- round_style => round_inf);
- when "100" =>
- tmpfp161 := resize ( arg => in1reg3,
- exponent_width => tmpfp161'high,
- fraction_width => -tmpfp161'low,
- denormalize_in => true,
- denormalize => false,
- round_style => round_neginf);
- when "101" =>
- tmpfp161 := resize ( arg => in1reg3,
--- size_res => tmpfp161,
- exponent_width => tmpfp161'high,
- fraction_width => -tmpfp161'low,
- denormalize_in => true,
- denormalize => false,
- check_error => false,
- round_style => round_zero);
- when "110" =>
- tmpfp161 := resize ( arg => in1reg3,
- exponent_width => tmpfp161'high,
- fraction_width => -tmpfp161'low);
- when "111" =>
- tmpfp161 := resize ( arg => in1reg3,
- exponent_width => tmpfp161'high,
- fraction_width => -tmpfp161'low
--- size_res => tmpfp161
- );
- when others => null;
- end case;
- outarray(0)(-8 downto -23) := tmpfp161;
- outarray(0)(8 downto 6) := float(tmpcmd);
- outarray(0)(6 downto -7) := (others => '0');
- end if;
- end process cmd4reg;
-
- -- purpose: "0101" Conversion function test
- cmd5reg: process (clk, rst_n) is
- variable uns : unsigned (15 downto 0); -- unsigned number
- variable s : signed (15 downto 0); -- signed number
- variable uf : ufixed (8 downto -7); -- unsigned fixed
- variable sf : sfixed (8 downto -7); -- signed fixed point
- variable outarray : cry_type; -- array for output
- variable tmpcmd : STD_LOGIC_VECTOR (2 downto 0);
- begin -- process cmd1reg
- if rst_n = '0' then -- asynchronous reset (active low)
- outx(5) <= ( others => '0');
- jrloop: for j in 0 to 7 loop
- outarray (j) := (others => '0');
- end loop jrloop;
- elsif rising_edge(clk) then -- rising clock edge
- outx(5) <= outarray(7);
- jcloop: for j in 7 downto 1 loop
- outarray (j) := outarray(j-1);
- end loop jcloop;
- tmpcmd := to_slv (in2reg3 (in2reg3'low+2 downto in2reg3'low));
- case tmpcmd is
- when "000" =>
- uns := to_unsigned (in1reg3, uns'length);
- outarray(0)(-8 downto -23) := float(std_logic_vector(uns));
- when "001" =>
- uns := to_unsigned (in1reg3, uns);
- outarray(0)(-8 downto -23) := float(std_logic_vector(uns));
- when "010" =>
- s := to_signed (in1reg3, s'length);
- outarray(0)(-8 downto -23) := float(std_logic_vector(s));
- when "011" =>
- s := to_signed (in1reg3, s);
- outarray(0)(-8 downto -23) := float(std_logic_vector(s));
- when "100" =>
- uf := to_ufixed (in1reg3, uf'high, uf'low);
- outarray(0)(-8 downto -23) := float(to_slv(uf));
- when "101" =>
- uf := to_ufixed (in1reg3, uf);
- outarray(0)(-8 downto -23) := float(to_slv(uf));
- when "110" =>
- sf := to_sfixed (in1reg3, sf'high, sf'low);
- outarray(0)(-8 downto -23) := float(to_slv(sf));
- when "111" =>
- sf := to_sfixed (in1reg3, sf);
- outarray(0)(-8 downto -23) := float(to_slv(sf));
- when others => null;
- end case;
- outarray(0)(8 downto 6) := float(tmpcmd);
- outarray(0)(5 downto -7) := (others => '0');
- end if;
- end process cmd5reg;
-
- -- purpose: "0110" to_float()
- cmd6reg: process (clk, rst_n) is
- variable uns : unsigned (15 downto 0); -- unsigned number
- variable s : signed (15 downto 0); -- signed number
- variable uf : ufixed (8 downto -7); -- unsigned fixed
- variable sf : sfixed (8 downto -7); -- signed fixed point
- variable outarray : cry_type; -- array for output
- variable tmpcmd : STD_LOGIC_VECTOR (2 downto 0);
- begin -- process cmd1reg
- if rst_n = '0' then -- asynchronous reset (active low)
- outx(6) <= ( others => '0');
- jrloop: for j in 0 to 7 loop
- outarray (j) := (others => '0');
- end loop jrloop;
- elsif rising_edge(clk) then -- rising clock edge
- outx(6) <= outarray(7);
- jcloop: for j in 7 downto 1 loop
- outarray (j) := outarray(j-1);
- end loop jcloop;
- tmpcmd := to_slv (in2reg3 (in2reg3'low+2 downto in2reg3'low));
- case tmpcmd is
- when "000" =>
- uns := UNSIGNED (to_slv (in1reg3(-8 downto -23)));
- outarray(0) := to_float(uns, 8, 23);
- when "001" =>
- uns := UNSIGNED (to_slv (in1reg3(-8 downto -23)));
- outarray(0) := to_float(uns, in1reg3);
- when "010" =>
- s := SIGNED (to_slv (in1reg3(-8 downto -23)));
- outarray(0) := to_float(s, 8, 23);
- when "011" =>
- s := SIGNED (to_slv (in1reg3(-8 downto -23)));
- outarray(0) := to_float(s, in1reg3);
- when "100" =>
- uf := to_ufixed (to_slv (in1reg3(-8 downto -23)), uf'high, uf'low);
- outarray(0) := to_float(uf, 8, 23);
- when "101" =>
- uf := to_ufixed (to_slv (in1reg3(-8 downto -23)), uf);
- outarray(0) := to_float(uf, in1reg3);
- when "110" =>
- sf := to_sfixed (to_slv (in1reg3(-8 downto -23)), sf'high, sf'low);
- outarray(0) := to_float(sf, 8, 23);
- when "111" =>
- sf := to_sfixed (to_slv (in1reg3(-8 downto -23)), sf);
- outarray(0) := to_float(sf, in1reg3);
- when others => null;
- end case;
- end if;
- end process cmd6reg;
-
- -- purpose: "0111" mod function
--- cmd7reg: process (clk, rst_n) is
--- variable tmpuns : unsigned (31 downto 0); -- unsigned number
--- variable outarray : cry_type; -- array for output
--- begin -- process cmd1reg
--- if rst_n = '0' then -- asynchronous reset (active low)
--- outx(7) <= ( others => '0');
--- jrloop: for j in 0 to 7 loop
--- outarray (j) := (others => '0');
--- end loop jrloop;
--- elsif rising_edge(clk) then -- rising clock edge
--- outx(7) <= outarray(7);
--- jcloop: for j in 7 downto 1 loop
--- outarray (j) := outarray(j-1);
--- end loop jcloop;
--- outarray(0) := in1reg3 mod in2reg3;
--- end if;
--- end process cmd7reg;
- outx(7) <= (others => '0');
-
- -- purpose: "1000" rem function
--- cmd8reg: process (clk, rst_n) is
--- variable outarray : cry_type; -- array for output
--- begin -- process cmd2reg
-
--- if rst_n = '0' then -- asynchronous reset (active low)
--- outx(8) <= ( others => '0');
--- jrloop: for j in 0 to 7 loop
--- outarray (j) := (others => '0');
--- end loop jrloop;
--- elsif rising_edge(clk) then -- rising clock edge
--- outx(8) <= outarray(7);
--- jcloop: for j in 7 downto 1 loop
--- outarray (j) := outarray(j-1);
--- end loop jcloop;
--- outarray(0) := in1reg3 rem in2reg3;
--- end if;
-
--- end process cmd8reg;
- outx(8) <= (others => '0');
-
- -- purpose: "1001" to_float (constants) test
- cmd9reg: process (clk, rst_n) is
- variable outarray : cry_type; -- array for output
- variable tmpcmd : STD_LOGIC_VECTOR (2 downto 0);
- begin -- process cmd2reg
-
- if rst_n = '0' then -- asynchronous reset (active low)
- outx(9) <= ( others => '0');
- jrloop: for j in 0 to 7 loop
- outarray (j) := (others => '0');
- end loop jrloop;
- elsif rising_edge(clk) then -- rising clock edge
- outx(9) <= outarray(7);
- jcloop: for j in 7 downto 1 loop
- outarray (j) := outarray(j-1);
- end loop jcloop;
- tmpcmd := to_slv (in2reg3 (in2reg3'low+2 downto in2reg3'low));
- case tmpcmd is
- when "000" =>
- outarray(0) := to_float(0, 8, 23);
- when "001" =>
- outarray(0) := to_float(0.0, 8, 23);
- when "010" =>
- outarray(0) := to_float(8, in1reg3);
- when "011" =>
- outarray(0) := to_float(8.0, in1reg3);
- when "100" =>
- outarray(0) := to_float(-8, 8, 23);
- when "101" =>
- outarray(0) := to_float(-8.0, 8, 23);
- when "110" =>
- outarray(0) := to_float(27000, in2reg3);
- when "111" =>
--- outarray(0) := "01000000010010010000111111011011";
- outarray(0) := to_float(MATH_PI, in2reg3);
- when others => null;
- end case;
- end if;
-
- end process cmd9reg;
-
- -- purpose: "1010" data manipulation (+, -, scalb, etc)
- cmd10reg: process (clk, rst_n) is
- variable tmpcmd : STD_LOGIC_VECTOR (2 downto 0);
- variable s : SIGNED (7 downto 0); -- signed number
- variable outarray : cry_type; -- array for output
- constant posinf : float32 := "01111111100000000000000000000000"; -- +inf
- constant neginf : float32 := "11111111100000000000000000000000"; -- +inf
- constant onept5 : float32 := "00111111110000000000000000000000"; -- 1.5
- begin -- process cmd2reg
-
- if rst_n = '0' then -- asynchronous reset (active low)
- outx(10) <= ( others => '0');
- jrloop: for j in 0 to 7 loop
- outarray (j) := (others => '0');
- end loop jrloop;
- elsif rising_edge(clk) then -- rising clock edge
- outx(10) <= outarray(7);
- jcloop: for j in 7 downto 1 loop
- outarray (j) := outarray(j-1);
- end loop jcloop;
- tmpcmd := to_slv (in2reg3 (in2reg3'low+2 downto in2reg3'low));
- case tmpcmd is
- when "000" =>
- outarray(0) := - in1reg3;
- when "001" =>
- outarray(0) := abs( in1reg3);
- when "010" =>
- if (cmdarray(4) = "1010") then
- s := resize (SIGNED (to_slv (in2reg3(8 downto 5))), s'length);
- outarray(0) := Scalb (in1reg3, s);
- else
- outarray(0) := (others => '0');
- end if;
- when "011" =>
- if (cmdarray(4) = "1010") then
- s := logb (in1reg3);
- outarray(0) := (others => '0');
- outarray(0)(-16 downto -23) := float(std_logic_vector(s));
- else
- outarray(0) := (others => '0');
- end if;
--- when "100" =>
--- outarray(0) := Nextafter ( in1reg3, onept5);
--- when "101" =>
--- outarray(0) := Nextafter ( in1reg3, -onept5);
--- when "110" =>
--- outarray(0) := Nextafter ( x => in1reg3, y => posinf,
--- check_error => false,
--- denormalize => false);
--- when "111" =>
--- outarray(0) := Nextafter (x => in1reg3, y => neginf,
--- check_error => false,
--- denormalize => false);
- when others =>
- outarray(0) := (others => '0');
- end case;
- end if;
-
- end process cmd10reg;
-
- -- purpose "1011" copysign
- cmd11reg: process (clk, rst_n) is
- variable outarray : cry_type; -- array for output
- begin -- process cmd2reg
- if rst_n = '0' then -- asynchronous reset (active low)
- outx(11) <= ( others => '0');
- jrloop: for j in 0 to 7 loop
- outarray (j) := (others => '0');
- end loop jrloop;
- elsif rising_edge(clk) then -- rising clock edge
- outx(11) <= outarray(7);
- jcloop: for j in 7 downto 1 loop
- outarray (j) := outarray(j-1);
- end loop jcloop;
- outarray(0) := Copysign (in1reg3, in2reg3);
- end if;
- end process cmd11reg;
-
- -- purpose "1100" compare test
- cmd12reg: process (clk, rst_n) is
- variable outarray : cry_type; -- array for output
- constant fifteenpt5 : float32 := "01000001011110000000000000000000";-- 15.5
- begin -- process cmd2reg
-
- if rst_n = '0' then -- asynchronous reset (active low)
- outx(12) <= ( others => '0');
- jrloop: for j in 0 to 7 loop
- outarray (j) := (others => '0');
- end loop jrloop;
- elsif rising_edge(clk) then -- rising clock edge
- outx(12) <= outarray(7);
- jcloop: for j in 7 downto 1 loop
- outarray (j) := outarray(j-1);
- end loop jcloop;
- outarray(0) := (others => '0');
- if (in1reg3 = in2reg3) then
- outarray(0)(outarray(0)'high) := '1';
- else
- outarray(0)(outarray(0)'high) := '0';
- end if;
- if (in1reg3 /= in2reg3) then
- outarray(0)(outarray(0)'high-1) := '1';
- else
- outarray(0)(outarray(0)'high-1) := '0';
- end if;
- if (in1reg3 > in2reg3) then
- outarray(0)(outarray(0)'high-2) := '1';
- else
- outarray(0)(outarray(0)'high-2) := '0';
- end if;
- if (in1reg3 < in2reg3) then
- outarray(0)(outarray(0)'high-3) := '1';
- else
- outarray(0)(outarray(0)'high-3) := '0';
- end if;
- if (in1reg3 >= in2reg3) then
- outarray(0)(outarray(0)'high-4) := '1';
- else
- outarray(0)(outarray(0)'high-4) := '0';
- end if;
- if (in1reg3 <= in2reg3) then
- outarray(0)(outarray(0)'high-5) := '1';
- else
- outarray(0)(outarray(0)'high-5) := '0';
- end if;
- outarray(0)(outarray(0)'high-6) := \?=\ (in1reg3, 15);
- outarray(0)(outarray(0)'high-7) := \?=\ (in1reg3, 15.5);
- if (Unordered (in1reg3, in2reg3)) then
- outarray(0)(outarray(0)'high-8) := '1';
- else
- outarray(0)(outarray(0)'high-8) := '0';
- end if;
- if (Finite (in1reg3)) then
- outarray(0)(outarray(0)'high-9) := '1';
- else
- outarray(0)(outarray(0)'high-9) := '0';
- end if;
- if (Isnan (in1reg3)) then
- outarray(0)(outarray(0)'high-10) := '1';
- else
- outarray(0)(outarray(0)'high-10) := '0';
- end if;
- end if;
-
- end process cmd12reg;
-
- -- purpose "1101" boolean test
- cmd13reg: process (clk, rst_n) is
- variable tmpcmd : STD_LOGIC_VECTOR (2 downto 0);
- variable outarray : cry_type; -- array for output
- begin -- process cmd2reg
-
- if rst_n = '0' then -- asynchronous reset (active low)
- outx(13) <= ( others => '0');
- jrloop: for j in 0 to 7 loop
- outarray (j) := (others => '0');
- end loop jrloop;
- elsif rising_edge(clk) then -- rising clock edge
- outx(13) <= outarray(7);
- jcloop: for j in 7 downto 1 loop
- outarray (j) := outarray(j-1);
- end loop jcloop;
- tmpcmd := to_slv (in2reg3 (in2reg3'low+2 downto in2reg3'low));
- case tmpcmd is
- when "000" =>
- outarray(0) := not (in1reg3);
- when "001" =>
- outarray(0) := in1reg3 and in2reg3;
- when "010" =>
- outarray(0) := in1reg3 or in2reg3;
- when "011" =>
- outarray(0) := in1reg3 nand in2reg3;
- when "100" =>
- outarray(0) := in1reg3 nor in2reg3;
- when "101" =>
- outarray(0) := in1reg3 xor in2reg3;
- when "110" =>
- outarray(0) := in1reg3 xnor in2reg3;
- when "111" =>
- outarray(0) := in1reg3 xor '1';
- when others => null;
- end case;
- end if;
-
- end process cmd13reg;
-
- -- purpose "1110" reduce and vector test
- cmd14reg: process (clk, rst_n) is
- variable tmpcmd : STD_LOGIC_VECTOR (2 downto 0);
- variable outarray : cry_type; -- array for output
- begin -- process cmd2reg
-
- if rst_n = '0' then -- asynchronous reset (active low)
- outx(14) <= ( others => '0');
- jrloop: for j in 0 to 7 loop
- outarray (j) := (others => '0');
- end loop jrloop;
- elsif rising_edge(clk) then -- rising clock edge
- outx(14) <= outarray(7);
- jcloop: for j in 7 downto 1 loop
- outarray (j) := outarray(j-1);
- end loop jcloop;
- tmpcmd := to_slv (in2reg3 (in2reg3'low+2 downto in2reg3'low));
- case tmpcmd is
- when "000" =>
- outarray(0) := (others => '0');
- outarray(0)(outarray(0)'high) := and_reduce (in1reg3);
- outarray(0)(outarray(0)'high-1) := nand_reduce (in1reg3);
- outarray(0)(outarray(0)'high-2) := or_reduce (in1reg3);
- outarray(0)(outarray(0)'high-3) := nor_reduce (in1reg3);
- outarray(0)(outarray(0)'high-4) := xor_reduce (in1reg3);
- outarray(0)(outarray(0)'high-5) := xnor_reduce (in1reg3);
- when "001" =>
- outarray(0) := in1reg3 and in2reg3(in2reg3'high);
- when "010" =>
- outarray(0) := in1reg3 or in2reg3(in2reg3'high);
- when "011" =>
- outarray(0) := in1reg3 nand in2reg3(in2reg3'high);
- when "100" =>
- outarray(0) := in1reg3 nor in2reg3(in2reg3'high);
- when "101" =>
- outarray(0) := in2reg3(in2reg3'high) xor in1reg3;
- when "110" =>
- outarray(0) := in2reg3(in2reg3'high) xnor in1reg3;
- when "111" =>
- outarray(0) := in2reg3(in2reg3'high) and in1reg3;
- when others => null;
- end case;
- end if;
-
- end process cmd14reg;
-
- -- purpose "1111" + constant
- cmd15reg: process (clk, rst_n) is
- variable tmpcmd : STD_LOGIC_VECTOR (2 downto 0);
- variable outarray : cry_type; -- array for output
- begin -- process cmd2reg
-
- if rst_n = '0' then -- asynchronous reset (active low)
- outx(15) <= ( others => '0');
- jrloop: for j in 0 to 7 loop
- outarray (j) := (others => '0');
- end loop jrloop;
- elsif rising_edge(clk) then -- rising clock edge
- outx(15) <= outarray(7);
- jcloop: for j in 7 downto 1 loop
- outarray (j) := outarray(j-1);
- end loop jcloop;
- tmpcmd := to_slv (in2reg3 (in2reg3'low+2 downto in2reg3'low));
- case tmpcmd is
- when "000" =>
- outarray(0) := in1reg3 + 1;
- when "001" =>
- outarray(0) := 1 + in1reg3;
- when "010" =>
- outarray(0) := in1reg3 + 1.0;
- when "011" =>
- outarray(0) := 1.0 + in1reg3;
- when "100" =>
- outarray(0) := in1reg3 * 1;
- when "101" =>
- outarray(0) := 1 * in1reg3;
- when "110" =>
- outarray(0) := in1reg3 * 1.0;
- when "111" =>
- outarray(0) := 1.0 * in1reg3;
- when others => null;
- end case;
- end if;
-
- end process cmd15reg;
-
- -- purpose: multiply floating point
- -- type : sequential
- -- inputs : clk, rst_n, in1, in2
- -- outputs: out1
- cmdreg: process (clk, rst_n) is
- variable outreg : float32; -- register stages
- variable in1reg, in2reg : float32; -- register stages
- variable in1reg2, in2reg2 : float32; -- register stages
- begin -- process mulreg
-
- if rst_n = '0' then -- asynchronous reset (active low)
- in1reg := ( others => '0');
- in2reg := ( others => '0');
- in1reg2 := ( others => '0');
- in2reg2 := ( others => '0');
- in1reg3 <= ( others => '0');
- in2reg3 <= ( others => '0');
- out1 <= ( others => '0');
- outreg := (others => '0');
- rcloop: for i in 1 to 15 loop
- cmdarray (i) <= (others => '0');
- end loop rcloop;
- elsif rising_edge(clk) then -- rising clock edge
- out1 <= to_slv (outreg);
- outregc: case cmdarray (13) is
- when "0000" => outreg := outx (0);
- when "0001" => outreg := outx (1);
- when "0010" => outreg := outx (2);
- when "0011" => outreg := outx (3);
- when "0100" => outreg := outx (4);
- when "0101" => outreg := outx (5);
- when "0110" => outreg := outx (6);
- when "0111" => outreg := outx (7);
- when "1000" => outreg := outx (8);
- when "1001" => outreg := outx (9);
- when "1010" => outreg := outx (10);
- when "1011" => outreg := outx (11);
- when "1100" => outreg := outx (12);
- when "1101" => outreg := outx (13);
- when "1110" => outreg := outx (14);
- when "1111" => outreg := outx (15);
- when others => null;
- end case outregc;
- cmdpipe: for i in 15 downto 3 loop
- cmdarray (i) <= cmdarray (i-1);
- end loop cmdpipe;
- cmdarray (2) <= std_ulogic_vector(cmd);
- in1reg3 <= in1reg2;
- in2reg3 <= in2reg2;
- in1reg2 := in1reg;
- in2reg2 := in2reg;
- in1reg := to_float (in1, in1reg);
- in2reg := to_float (in2, in2reg);
- end if;
-
- end process cmdreg;
-
-end architecture rtl;
diff --git a/ieee_proposed/rtl_tb/test_fixed_synth.vhd b/ieee_proposed/rtl_tb/test_fixed_synth.vhd
deleted file mode 100644
index 182875d..0000000
--- a/ieee_proposed/rtl_tb/test_fixed_synth.vhd
+++ /dev/null
@@ -1,439 +0,0 @@
--- Test vectors for the synthesis test for the fixed point math package
--- This test is designed to test fixed_synth and exercise much of the entity.
--- Created for vhdl-200x by David Bishop (dbishop@vhdl.org)
--- --------------------------------------------------------------------
--- modification history : Last Modified $Date: 2006-06-08 10:55:54-04 $
--- Version $Id: test_fixed_synth.vhdl,v 1.1 2006-06-08 10:55:54-04 l435385 Exp $
--- --------------------------------------------------------------------
-
-entity test_fixed_synth is
- generic (
- quiet : boolean := false); -- make the simulation quiet
-end entity test_fixed_synth;
-
-library ieee, ieee_proposed;
-use ieee.std_logic_1164.all;
-use ieee.numeric_std.all;
-use ieee_proposed.fixed_pkg.all;
-architecture testbench of test_fixed_synth is
-
- procedure report_error (
- constant errmes : in string; -- error message
- actual : in sfixed; -- data from algorithm
- constant expected : in sfixed) is -- reference data
- begin -- function report_error
- assert actual = expected
- report errmes & CR
- & "Actual: " & to_string(actual)
- & " (" & real'image(to_real(actual)) & ")" & CR
- & " /= " & to_string(expected)
- & " (" & real'image(to_real(expected)) & ")"
- severity error;
- return;
- end procedure report_error;
-
- -- Device under test. Note that all inputs and outputs are std_logic_vector.
- -- This entity can be use both pre and post synthesis.
- component fixed_synth is
- port (
- in1, in2 : in std_logic_vector (15 downto 0); -- inputs
- out1 : out std_logic_vector (15 downto 0); -- output
- cmd : in std_logic_vector (3 downto 0);
- clk, rst_n : in std_ulogic); -- clk and reset
- end component fixed_synth;
- constant clock_period : time := 500 ns; -- clock period
- subtype sfixed7 is sfixed (3 downto -3); -- 7 bit
- subtype sfixed16 is sfixed (7 downto -8); -- 16 bit
- signal stop_clock : boolean := false; -- stop the clock
- signal clk, rst_n : std_ulogic; -- clk and reset
- signal in1slv, in2slv, out1slv : std_logic_vector(15 downto 0);
- signal in1, in2 : sfixed16; -- inputs
- signal out1 : sfixed16; -- output
- signal cmd : std_logic_vector (3 downto 0); -- command string
-begin -- architecture testbench
-
- -- From fixed point to Std_logic_vector
- in1slv <= to_slv(in1);
- in2slv <= to_slv(in2);
- -- Std_logic_vector to fixed point.
- out1 <= to_sfixed(out1slv, out1'high, out1'low);
- DUT: fixed_synth
- port map (
- in1 => in1slv, -- [in std_logic_vector (15 downto 0)] inputs
- in2 => in2slv, -- [in std_logic_vector (15 downto 0)] inputs
- out1 => out1slv, -- [out std_logic_vector (15 downto 0)] output
- cmd => cmd, -- [in std_logic_vector (2 downto 0)]
- clk => clk, -- [in std_ulogic] clk and reset
- rst_n => rst_n); -- [in std_ulogic] clk and reset
-
- -- purpose: clock driver
- clkprc: process is
- begin -- process clkprc
- if (not stop_clock) then
- clk <= '0';
- wait for clock_period/2.0;
- clk <= '1';
- wait for clock_period/2.0;
- else
- wait;
- end if;
- end process clkprc;
-
- -- purpose: reset driver
- reset_proc: process is
- begin -- process reset_proc
- rst_n <= '0';
- wait for clock_period * 2.0;
- rst_n <= '1';
- wait;
- end process reset_proc;
-
- -- purpose: main test loop
- tester: process is
- begin -- process tester
- cmd <= "0000"; -- add mode
- in1 <= (others => '0');
- in2 <= (others => '0');
- wait for clock_period;
- wait for clock_period;
- wait for clock_period;
- wait for clock_period;
- in1 <= "0000011010000000"; -- 6.5
- in2 <= "0000001100000000"; -- 3
- wait for clock_period;
- cmd <= "0001"; -- subtract mode
- in1 <= "0000011010000000"; -- 6.5
- in2 <= "0000001100000000"; -- 3
- wait for clock_period;
- cmd <= "0010"; -- multiply mode
- in1 <= "0000011010000000"; -- 6.5
- in2 <= "0000001100000000"; -- 3
- wait for clock_period;
- cmd <= "0000"; -- add mode
- in1 <= "0000000010000000"; -- 0.5
- in2 <= "0000000010000000"; -- 0.5
- wait for clock_period;
- in1 <= to_sfixed (3.14, sfixed16'high, sfixed16'low);
- in2 <= "0000001100000000"; -- 3
- wait for clock_period;
- cmd <= "0011"; -- divide
- in1 <= "0000000010000000"; -- 0.5
- in2 <= "0000000010000000"; -- 0.5
- wait for clock_period;
- in1 <= to_sfixed (-0.5, sfixed16'high, sfixed16'low); -- -0.5
- in2 <= "0000000010000000"; -- 0.5
- wait for clock_period;
- cmd <= "0100"; -- unsigned add
- in1 <= "0000011010000000"; -- 6.5
- in2 <= "0000001100000000"; -- 3
- wait for clock_period;
- cmd <= "0101"; -- subtract mode
- in1 <= "0000011010000000"; -- 6.5
- in2 <= "0000001100000000"; -- 3
- wait for clock_period;
- cmd <= "0110"; -- multiply mode
- in1 <= "0000011010000000"; -- 6.5
- in2 <= "0000001100000000"; -- 3
- wait for clock_period;
- cmd <= "0100"; -- add mode
- in1 <= "0000000010000000"; -- 0.5
- in2 <= "0000000010000000"; -- 0.5
- wait for clock_period;
- in1 <= to_sfixed (3.14, sfixed16'high, sfixed16'low);
- in2 <= "0000001100000000"; -- 3
- wait for clock_period;
- cmd <= "0111"; -- divide
- in1 <= "0000000010000000"; -- 0.5
- in2 <= "0000000010000000"; -- 0.5
- wait for clock_period;
- in1 <= to_sfixed (6.5, sfixed16'high, sfixed16'low); -- 6.5
- in2 <= "0000000010000000"; -- 0.5
- wait for clock_period;
- -- resize
- cmd <= "1000";
- in1 <= to_sfixed (5.25, in1);
- in2 <= to_sfixed (-5.25, in2);
- wait for clock_period;
- in1 <= to_sfixed (21.125, in1);
- in2 <= to_sfixed (21.125, in2);
- wait for clock_period;
- in2 <= (in2'high => '0', in2'high-1 => '0', others => '0');
- cmd <= "1001"; -- SIGNED
- in1 <= to_sfixed (6.25, in1);
- wait for clock_period;
- in2 <= (in2'high => '0', in2'high-1 => '1', others => '0');
- cmd <= "1001"; -- UNSIGNED
- in1 <= to_sfixed (7.25, in1);
- wait for clock_period;
- in2 <= (in2'high => '1', in2'high-1 => '0', others => '0');
- cmd <= "1001"; -- SIGNED
- in1 <= to_sfixed (6.25, in1);
- wait for clock_period;
- in2 <= (in2'high => '1', in2'high-1 => '1', others => '0');
- cmd <= "1001"; -- UNSIGNED
- in1 <= to_sfixed (7.25, in1);
- wait for clock_period;
- cmd <= "1010";
- in2 <= (in2'high => '0', in2'high-1 => '0', others => '0');
- in1 <= to_sfixed (3, in1);
- wait for clock_period;
- cmd <= "1010";
- in2 <= (in2'high => '0', in2'high-1 => '1', others => '0');
- in1 <= to_sfixed (5, in1);
- wait for clock_period;
- cmd <= "1010";
- in2 <= (in2'high => '1', in2'high-1 => '0', others => '0');
- in1 <= to_sfixed (-5.5, in1);
- wait for clock_period;
- cmd <= "1010";
- in2 <= (in2'high => '1', in2'high-1 => '1', others => '0');
- in1 <= to_sfixed (7.25, in1);
- wait for clock_period;
- cmd <= "1010"; -- abs (mod)
- in2 <= (in2'high => '1', in2'high-1 => '0', others => '0');
- in1 <= to_sfixed (-42, in1);
- wait for clock_period;
- cmd <= "1011"; -- mod
- in1 <= to_sfixed (6.25, in1);
- in2 <= to_sfixed (6, in2);
- wait for clock_period;
- cmd <= "1100"; -- REM
- in1 <= to_sfixed (6.25, in1);
- in2 <= to_sfixed (6, in2);
- wait for clock_period;
- cmd <= "1101"; -- srl
- in1 <= to_sfixed (5.25, in1);
- in2 <= to_sfixed (-1, in2);
- wait for clock_period;
- cmd <= "1110"; -- sra
- in1 <= to_sfixed (-7.25, in1);
- in2 <= to_sfixed (1, in2);
- wait for clock_period;
- cmd <= "1111"; -- compare
- in1 <= to_sfixed (42, in1);
- in2 <= to_sfixed (42, in1);
- wait for clock_period;
- in1 <= to_sfixed (45, in1);
- in2 <= to_sfixed (90, in1);
- wait for clock_period;
- in1 <= to_sfixed (3.125, in1);
- in2 <= (others => '0');
- wait for clock_period;
- in1 <= "0110111110101111";
- in2 <= "1111111111111111";
- wait for clock_period;
- in1 <= (others => '0');
- in2 <= (others => '0');
- wait for clock_period;
- in1 <= "0000111000000000";
- in2 <= "0000111000000000";
- wait for clock_period;
- in1 <= (others => '1');
- in2 <= (others => '1');
- wait for clock_period;
- wait for clock_period;
-
- wait for clock_period;
- cmd <= "0000"; -- add mode
- in1 <= (others => '0');
- in2 <= (others => '0');
- wait for clock_period;
- wait for clock_period;
- wait for clock_period;
- wait for clock_period;
- wait for clock_period;
- wait for clock_period;
- wait for clock_period;
- wait for clock_period;
- wait;
- end process tester;
-
- -- purpose: check the output of the tester
- -- type : combinational
- -- inputs :
- -- outputs:
- checktest: process is
- constant fxzero : sfixed16 := (others => '0'); -- zero
- variable chks16 : sfixed16; -- variable
- variable sm1, sm2 : sfixed7; -- small fixed point
- begin -- process checktest
- wait for clock_period/2.0;
- wait for clock_period;
- wait for clock_period;
- waitloop: while (out1 = fxzero) loop
- wait for clock_period;
- end loop waitloop;
- chks16 := to_sfixed ((3.0+6.5), sfixed16'high, sfixed16'low);
- report_error ( "3.0 + 6.5 error",
- out1,
- chks16);
- wait for clock_period;
- chks16 := to_sfixed ((6.5 - 3.0), sfixed16'high, sfixed16'low);
- report_error ( "6.5 - 3.0 error",
- out1,
- chks16);
- wait for clock_period;
- chks16 := to_sfixed ((6.5 * 3.0), sfixed16'high, sfixed16'low);
- report_error ( "6.5 * 3.0 error",
- out1,
- chks16);
- wait for clock_period;
- chks16 := to_sfixed (1, sfixed16'high, sfixed16'low);
- report_error ( "0.5 + 0.5 error",
- out1,
- chks16);
- wait for clock_period;
- chks16 := to_sfixed (6.14, sfixed16'high, sfixed16'low);
- report_error ( "3.14 + 3 error",
- out1,
- chks16);
- wait for clock_period;
- chks16 := "0000000100000000";
- report_error ( "0.5/0.5 error",
- out1,
- chks16);
- wait for clock_period;
- chks16 := to_sfixed (-1, sfixed16'high, sfixed16'low);
- report_error ( "-0.5/0.5 error",
- out1,
- chks16);
- wait for clock_period;
- chks16 := to_sfixed ((3.0+6.5), sfixed16'high, sfixed16'low);
- report_error ( "3.0 + 6.5 error",
- out1,
- chks16);
- wait for clock_period;
- chks16 := to_sfixed ((6.5 - 3.0), sfixed16'high, sfixed16'low);
- report_error ( "6.5 - 3.0 error",
- out1,
- chks16);
- wait for clock_period;
- chks16 := to_sfixed ((6.5 * 3.0), sfixed16'high, sfixed16'low);
- report_error ( "6.5 * 3.0 error",
- out1,
- chks16);
- wait for clock_period;
- chks16 := to_sfixed (1, sfixed16'high, sfixed16'low);
- report_error ( "0.5 + 0.5 error",
- out1,
- chks16);
- wait for clock_period;
- chks16 := to_sfixed (6.14, sfixed16'high, sfixed16'low);
- report_error ( "3.14 + 3 error",
- out1,
- chks16);
- wait for clock_period;
- chks16 := "0000000100000000";
- report_error ( "0.5/0.5 error",
- out1,
- chks16);
- wait for clock_period;
- chks16 := to_sfixed (13, sfixed16'high, sfixed16'low);
- report_error ( "6.5/0.5 error",
- out1,
- chks16);
- wait for clock_period;
- -- resize test
- sm1 := out1 (7 downto 1);
- sm2 := to_sfixed (5.25, sm2);
- report_error ( "resize 1 error", sm1, sm2);
- sm1 := out1 (-1 downto -7);
- sm2 := to_sfixed (-5.25, sm2);
- report_error ( "resize 2 error", sm1, sm2);
- wait for clock_period;
- sm1 := out1 (7 downto 1);
- sm2 := "0101001"; -- wrapped
--- sm2 := to_sfixed (21.125, sm2, 0, false, false); -- wrap, no round
- report_error ( "resize 1 error", sm1, sm2);
- sm1 := out1 (-1 downto -7);
- sm2 := "0111111"; -- saturate
- report_error ( "resize 2 error", sm1, sm2);
- wait for clock_period;
- -- to_signed and back
- report_error ("to_signed(6.25)", out1, to_sfixed (6, out1));
- wait for clock_period;
- -- to_unsigned and back
- report_error ("to_unsigned(7.25)", out1, to_sfixed (7, out1));
- wait for clock_period;
- -- to_integer and back
- report_error ("to_signed(6.25)", out1, to_sfixed (6, out1));
- wait for clock_period;
- -- to_integer(ufixed) and back
- report_error ("to_unsigned(7.25)", out1, to_sfixed (7, out1));
- wait for clock_period;
- report_error ("1/3", out1, to_sfixed (1.0/3.0, out1'high, -7));
- wait for clock_period;
- report_error ("unsigned 1/5", out1, to_sfixed (1.0/5.0, out1));
- wait for clock_period;
- report_error ("abs (-5.5)", out1, to_sfixed (5.5, out1));
- wait for clock_period;
- report_error ("-7.25", out1, to_sfixed (-7.25, out1));
- wait for clock_period;
- report_error ("abs(-42)", out1, to_sfixed (42, out1));
- wait for clock_period;
- report_error ("6.25 mod 6", out1, to_sfixed (0.25, out1));
- wait for clock_period;
- report_error ("6.25 rem 6", out1, to_sfixed (0.25, out1));
- wait for clock_period;
- chks16 := "0000101010000000";
- report_error ("5.25 srl -1", out1, chks16);
- wait for clock_period;
- chks16 := "1111110001100000";
- report_error ("-7.25 sra 1", out1, chks16);
- wait for clock_period;
- -- 7654321012345678
- chks16 := "0111000000110001";
- assert (std_match (out1, chks16))
- report "42=42 compare " & CR
- & "Actual " & to_string(out1) & CR
- & "Expected " & to_string(chks16) severity error;
- wait for clock_period;
- chks16 := "------0001010110";
- assert (std_match (out1, chks16))
- report "45=90 compare " & CR
- & "Actual " & to_string(out1) & CR
- & "Expected " & to_string(chks16) severity error;
- wait for clock_period;
- chks16 := "------1010101010";
- assert (std_match (out1, chks16))
- report "3.125=0 compare " & CR
- & "Actual " & to_string(out1) & CR
- & "Expected " & to_string(chks16) severity error;
- wait for clock_period;
- -- 7654321012345678
- chks16 := "0--1010000101010";
- assert (std_match (out1, chks16))
- report "pattern1 compare " & CR
- & "Actual " & to_string(out1) & CR
- & "Expected " & to_string(chks16) severity error;
- wait for clock_period;
- -- 7654321012345678
- chks16 := "0001100000110001";
- assert (std_match (out1, chks16))
- report "zero = zero " & CR
- & "Actual " & to_string(out1) & CR
- & "Expected " & to_string(chks16) severity error;
- wait for clock_period;
- -- 7654321012345678
- chks16 := "1111000000110001";
- assert (std_match (out1, chks16))
- report "pattern2 compare " & CR
- & "Actual " & to_string(out1) & CR
- & "Expected " & to_string(chks16) severity error;
- wait for clock_period;
- -- 7654321012345678
- chks16 := "0111000000110001";
- assert (std_match (out1, chks16))
- report "-1 = -1 " & CR
- & "Actual " & to_string(out1) & CR
- & "Expected " & to_string(chks16) severity error;
- wait for clock_period;
- wait for clock_period;
- wait for clock_period;
- wait for clock_period;
- wait for clock_period;
- assert (false) report "Testing complete" severity note;
- stop_clock <= true;
- wait;
- end process checktest;
-end architecture testbench;
diff --git a/ieee_proposed/rtl_tb/test_float_synth.vhd b/ieee_proposed/rtl_tb/test_float_synth.vhd
deleted file mode 100644
index 90b40e8..0000000
--- a/ieee_proposed/rtl_tb/test_float_synth.vhd
+++ /dev/null
@@ -1,892 +0,0 @@
--------------------------------------------------------------------------------
--- test routine for the post synthesis 32 bit multiply
--------------------------------------------------------------------------------
-
-entity test_float_synth is
- generic (
- quiet : BOOLEAN := false);
-end entity test_float_synth;
-
-use std.textio.all;
-library ieee, ieee_proposed;
-use ieee.math_real.all;
-use ieee.std_logic_1164.all;
-use ieee.numeric_std.all;
-use ieee_proposed.fixed_float_types.all;
-use ieee_proposed.fixed_pkg.all;
-use ieee_proposed.float_pkg.all;
-
---library modelsim_lib;
---use modelsim_lib.util.all;
-
-architecture testbench of test_float_synth is
- subtype fp16 is float (6 downto -9); -- 16 bit
- function reverse (
- inpvec : STD_LOGIC_VECTOR (0 to 31))
- return float32 is
- variable result : float32;
- begin
- for i in 0 to 31 loop
- result (i-23) := inpvec(i);
- end loop; -- i
- return result;
- end function reverse;
-
- -- purpose: converts an float32 into a std_logic_vector
--- function to_slv (
--- input : float32) -- float32 input
--- return std_logic_vector is
--- variable result : std_logic_vector (31 downto 0); -- result
--- begin -- function to_slv
--- floop: for i in float32'range loop
--- result (i + fp_fraction_width) := input (i);
--- end loop floop;
--- return result;
--- end function to_slv;
-
- -- purpose: converts a std_logic_vector to an float32
- function to_float32x (
- signal input : STD_LOGIC_VECTOR (31 downto 0))
- return float32 is
- variable result : float32;
- begin -- function to_float32x
- return to_float (input, float32'high, -float32'low);
- end function to_float32x;
-
- procedure report_error (
- constant errmes : STRING; -- error message
- actual : in float32; -- data from algorithm
- constant expected : float32) is -- reference data
- begin -- function report_error
- assert actual = expected
- report errmes & " miscompare" & CR &
- "Actual " & to_string (actual) & " ("
- & REAL'image(to_real(actual))& ") /= " & CR &
- "Expected " & to_string (expected) & " ("
- & REAL'image(to_real(expected))& ")"
- severity error;
- return;
- end procedure report_error;
- procedure report_error16 (
- constant errmes : STRING; -- error message
- actual : in fp16; -- data from algorithm
- constant expected : fp16) is -- reference data
- begin -- function report_error
- assert actual = expected
- report errmes & " miscompare" & CR &
- "Actual " & to_string (actual) & " ("
- & REAL'image(to_real(actual))& ") /= " & CR &
- "Expected " & to_string (expected) & " ("
- & REAL'image(to_real(expected))& ")"
- severity error;
- return;
- end procedure report_error16;
-
- component float_synth is
- port (
- in1, in2 : in STD_LOGIC_VECTOR(31 downto 0); -- inputs
- out1 : out STD_LOGIC_VECTOR(31 downto 0); -- output
- cmd : in STD_LOGIC_VECTOR (3 downto 0);
- clk, rst_n : in STD_ULOGIC); -- clk and reset
- end component float_synth;
- for all : float_synth
- use entity work.float_synth(rtl);
- constant clock_period : TIME := 500 ns; -- clock period
- signal stop_clock : BOOLEAN := false; -- stop the clock
- signal out1real : REAL; -- real version
- signal in1, in2 : float32; -- inputs
- signal out1 : float32; -- output
- constant zero0 : float32 := (others => '0'); -- zero
- signal cmd : STD_LOGIC_VECTOR (3 downto 0); -- command
- signal clk, rst_n : STD_ULOGIC; -- clk and reset
- signal in1slv, in2slv, out1slv : STD_LOGIC_VECTOR(31 downto 0);
- signal indelay : float32; -- spied signal
-begin -- architecture testbench
- out1real <= to_real (out1);
- in1slv <= to_slv(in1);
- in2slv <= to_slv(in2);
- out1 <= to_float32x(out1slv);
- DUT : float_synth
- port map (
- in1 => in1slv, -- [in float32] inputs
- in2 => in2slv, -- [in float32] inputs
- out1 => out1slv, -- [out float32] output
- cmd => cmd,
- clk => clk, -- [in std_ulogic] clk and reset
- rst_n => rst_n); -- [in std_ulogic] clk and reset
-
--- spy_process : process
--- begin
--- signal_force ("/DUT/in2reg3", "00000000000000000000000000000000",
--- 500 ns, freeze, 5000 ns, 1);
--- wait;
--- end process spy_process;
-
- -- purpose: clock driver
- -- type : combinational
- -- inputs :
- -- outputs:
- clkprc : process is
-
- begin -- process clkprc
- if (not stop_clock) then
- clk <= '0';
- wait for clock_period/2.0;
- clk <= '1';
- wait for clock_period/2.0;
- else
- wait;
- end if;
- end process clkprc;
-
- -- purpose: reset driver
- -- type : combinational
- -- inputs :
- -- outputs:
- reset_proc : process is
-
- begin -- process reset_proc
-
- rst_n <= '0';
- wait for clock_period * 2.0;
- rst_n <= '1';
- wait;
- end process reset_proc;
-
- -- purpose: main test loop
- -- type : combinational
- -- inputs :
- -- outputs:
- tester : process is
-
- begin -- process tester
- cmd <= "0110"; -- 16 bit to float32 mode
- in1 <= "10000000000000000000001000101111"; -- 4.33 ufixed
- in2 <= "00000000000000000000000000000100"; -- 4
- floop1: for i in 1 to 100 loop
- wait for clock_period;
- end loop floop1;
- cmd <= "0110"; -- 16 bit to float32 mode
- in1 <= "10000000000000000000001000101011"; -- 4.33 ufixed
- in2 <= "00000000000000000000000000000100"; -- 4
- floop2: for i in 1 to 100 loop
- wait for clock_period;
- end loop floop2;
- cmd <= "0010";
- in1 <= reverse("00000000000000000000101100000010"); -- 6.5
- in2 <= reverse("00000000000000000001010001000010"); -- 42
- wait for clock_period;
- in1 <= reverse("00000000000000000001010001000010"); -- 42
- in2 <= reverse("00000000000000000000101100000010"); -- 6.5
- wait for clock_period;
- in1 <= reverse("00000000000000000000101100000010"); -- 6.5
- in2 <= reverse("00000000000000000000101100000010"); -- 6.5
- wait for clock_period;
- in1 <= reverse("00000000000000000001010001000010"); -- 42
- in2 <= "01000000000000000000000000000000"; -- 2
- wait for clock_period;
- in1 <= "00111110101010101010101010101011"; -- 1/3
- in2 <= "01000000000000000000000000000000"; -- 2
- wait for clock_period;
- in1 <= reverse("00000000000000000001010001000010"); -- 42
- in2 <= reverse("00000000000000000000101100000011"); -- -6.5
- wait for clock_period;
- in1 <= reverse("10000000000000000000000000000000"); -- 2**-149
- in2 <= "11000000000000000000000000000000"; -- -2.0
- wait for clock_period;
- in1 <= reverse("00000000000000000000001000000000"); -- 2**-127
- in2 <= "00111110100000000000000000000000"; -- 0.25
- wait for clock_period;
- in1 <= reverse("00000000000000000001010001000010"); -- 42
- in2 <= reverse("00000000000000000000101100000010"); -- 6.5
- wait for clock_period;
- cmd <= "0001"; -- subtract mode
- in2 <= "01001011111001110011000110011011"; -- 30303030
- in1 <= "01001011111001110011000110011100"; -- 30303033
- wait for clock_period;
- in1 <= reverse("00000000000000000000101100000010"); -- 6.5
- in2 <= "01000000100000000000000000000000"; -- 4
- wait for clock_period;
- in2 <= reverse("00000000000000000000101100000010"); -- 6.5
- in1 <= "01000000100000000000000000000000"; -- 4
- wait for clock_period;
- in1 <= "01000000100010101010101010101011"; -- 4.333333
- in2 <= "00111110101010101010101010101011"; -- 1/3
- wait for clock_period;
- cmd <= "0000"; -- add mode
- in1 <= "00111110101010101010101010101011"; -- 1/3
- in2 <= "01000000000000000000000000000000"; -- 2
- wait for clock_period;
- in2 <= "00111110101010101010101010101011"; -- 1/3
- in1 <= "01000000000000000000000000000000"; -- 2
- wait for clock_period;
- in1 <= "00000000100000000000000000000001"; -- 2**-126
- in2 <= "01000000100000000000000000000001"; -- 4+
- wait for clock_period;
- cmd <= "0011"; -- divide mode
- in1 <= "00111111100000000000000000000000"; -- 1.0
- in2 <= "01000000010000000000000000000000"; -- 3.0
- wait for clock_period;
- in1 <= "01001100000011001011110001001111"; -- 36892987
- in2 <= "00000000010000000000000000000000"; -- 2**-127
- wait for clock_period;
- in1 <= "10111110101010101010101010101011"; -- -1/3
- in2 <= "01000000000000000000000000000000"; -- 2
- wait for clock_period;
- cmd <= "0100"; -- 32 to 16 conversion mode
- in1 <= "00111111100000000000000000000000"; -- 1.0
- in2 <= (others => '0');
- wait for clock_period;
- in1 <= "10111110101010101010101010101011"; -- -1/3, no round
- wait for clock_period;
- in1 <= "10111110101010101010101010101011"; -- -1/3
- in2 <= "00000000000000000000000000000001"; -- opcode 1
- wait for clock_period;
- cmd <= "0101"; -- conversion mode
- in1 <= "00111111100000000000000000000000"; -- 1.0
- in2 <= "01000000000000000000000000000000"; -- opcode zero
- wait for clock_period;
- in1 <= "01000010001010000000000000000000"; -- 42.0
- in2 <= "00000000000000000000000000000001"; -- opcode 1
- wait for clock_period;
- in1 <= "10111111100000000000000000000000"; -- -1.0
- in2 <= "00000000000000000000000000000010"; -- 2
- wait for clock_period;
- in1 <= "00111111100000000000000000000000"; -- 1.0
- in2 <= "00000000000000000000000000000011"; -- 3
- wait for clock_period;
- in1 <= "01000000100010101010101010101011"; -- 4.333333
- in2 <= "00000000000000000000000000000100"; -- 4
- wait for clock_period;
- in1 <= "00111111100000000000000000000000"; -- 1.0
- in2 <= "00000000000000000000000000000101"; -- 5
- wait for clock_period;
- in1 <= "11000000100010101010101010101011"; -- -4.333333
- in2 <= "00000000000000000000000000000110"; -- 6 to_sfixed
- wait for clock_period;
- in1 <= "00111111100000000000000000000000"; -- 1.0
- in2 <= "00000000000000000000000000000111"; -- 7 to_sfixed
- wait for clock_period;
- cmd <= "0110"; -- 16 bit to float32 mode
- in1 <= "00000000000000000000000000000011"; -- 3
- in2 <= "01000000000000000000000000000000"; -- mode 0
- wait for clock_period;
- in1 <= "00000000000000000000000000000100"; -- 4
- in2 <= "01000000000000000000000000000001"; -- 1
- wait for clock_period;
- in1 <= "00000000000000001111111111111110"; -- -2
- in2 <= "01000000000000000000000000000010"; -- 2 to_float(signed)
- wait for clock_period;
- in1 <= "00000000000000000000000000000100"; -- 4
- in2 <= "01000000000000000000000000000011"; -- mode 3
- wait for clock_period;
- in1 <= "10000000000000000000001000101011"; -- 4.33 ufixed
- in2 <= "00000000000000000000000000000100"; -- 4
- wait for clock_period;
- in1 <= "10100000000000000000000010000000"; -- 1.0 ufixed
- in2 <= "00000000000000000000000000000101"; -- 5
- wait for clock_period;
- in1 <= "11000000000000001111110111010101"; -- -4.333 sfixed
- in2 <= "00000000000000000000000000000110"; -- 6
- wait for clock_period;
- in1 <= "10100000000000000000000010000000"; -- 1.0 sfixed
- in2 <= "00000000000000000000000000000111"; -- 7
- wait for clock_period;
- cmd <= "0111"; -- Mod
- in1 <= "00000000000000000000000000000011"; --
- in2 <= "00000000000000000000000000000011"; --
- wait for clock_period;
- in1 <= "00000010001100101111000100111011"; -- 36892987
- in2 <= "00000010001100101111000100111011"; -- 36892987
- wait for clock_period;
- in1 <= "11000000100010101010101010101011"; -- -4.333333
- in2 <= "01000000100000000000000000000000"; -- 4
- wait for clock_period;
- cmd <= "1000"; -- rem
- in1 <= "00000000000000000000000000000011"; --
- in2 <= "00000000000000000000000000000011"; --
- wait for clock_period;
- in1 <= "00000010001100101111000100111011"; -- 36892987
- in2 <= "00000010001100101111000100111011"; -- 36892987
- wait for clock_period;
- in1 <= "11000000100010101010101010101011"; -- -4.333333
- in2 <= "01000000100000000000000000000000"; -- 4
- wait for clock_period;
- cmd <= "1001"; -- constants conversion
- in2 <= "11000000000000000000000000000000"; -- command 0
- wait for clock_period;
- in2 <= "11000000000000000000000000000001"; -- command 1
- wait for clock_period;
- in2 <= "11000000000000000000000000000010"; -- command 2
- wait for clock_period;
- in2 <= "11000000000000000000000000000011"; -- command 3
- wait for clock_period;
- in2 <= "11000000000000000000000000000100"; -- command 4
- wait for clock_period;
- in2 <= "11000000000000000000000000000101"; -- command 5
- wait for clock_period;
- in2 <= "11000000000000000000000000000110"; -- command 6
- wait for clock_period;
- in2 <= "11000000000000000000000000000111"; -- command 7
- wait for clock_period;
- cmd <= "1010"; -- conversions
- in1 <= to_float (1, in1);
- in2 <= "11000000000000000000000000000000"; -- command 0
- wait for clock_period;
- in1 <= to_float (-2, in1);
- wait for clock_period;
- in2 <= "11000000000000000000000000000001"; -- command 1
- wait for clock_period;
- in1 <= to_float (1, in1);
- wait for clock_period;
- in2 <= "00010000000000000000000000000010"; -- command 2 scalb
- in1 <= to_float (1, in1);
- wait for clock_period;
- in2 <= "11110000000000000000000000000010"; -- command 2 scalb
- in1 <= to_float (1, in1);
- wait for clock_period;
- in2 <= "11000000000000000000000000000011"; -- command 3 logb
- in1 <= to_float (1, in1);
- wait for clock_period;
- in2 <= "11000000000000000000000000000011"; -- command 3 logb
- in1 <= to_float (0.25, in1);
- wait for clock_period;
- in2 <= "11000000000000000000000000000100"; -- 4 nextafter
- in1 <= to_float (1, in1);
- wait for clock_period;
- in1 <= to_float (4, in1);
- wait for clock_period;
- in2 <= "11000000000000000000000000000101"; -- 5 nextafter
- in1 <= to_float (1, in1);
- wait for clock_period;
- in1 <= to_float (-4, in1);
- wait for clock_period;
- in2 <= "11000000000000000000000000000110"; -- 6 nextafter
- in1 <= to_float (1, in1);
- wait for clock_period;
- in1 <= to_float (4, in1);
- wait for clock_period;
- in2 <= "11000000000000000000000000000111"; -- 7 nextafter
- in1 <= to_float (1, in1);
- wait for clock_period;
- in1 <= to_float (-4, in1);
- wait for clock_period;
- cmd <= "1011"; -- copy sign
- in1 <= to_float (2, in1);
- in2 <= to_float (2, in1);
- wait for clock_period;
- in1 <= to_float (-3, in1);
- in2 <= to_float (3, in1);
- wait for clock_period;
- in1 <= to_float (4, in1);
- in2 <= to_float (-4, in1);
- wait for clock_period;
- in1 <= to_float (-5, in1);
- in2 <= to_float (-5, in1);
- wait for clock_period;
- cmd <= "1100"; -- compare test
- in1 <= to_float (15, in1);
- in2 <= to_float (15, in1);
- wait for clock_period;
- in1 <= to_float (15.5, in1);
- in2 <= to_float (-2, in1);
- wait for clock_period;
- in1 <= to_float (-2, in1);
- in2 <= to_float (2, in1);
- wait for clock_period;
- in1 <= "01111111100000000000000000000000"; -- + inf
- in2 <= to_float (-2, in1);
- wait for clock_period;
- in1 <= "01111111100000000000000000000001"; -- NAN
- in2 <= to_float (-2, in1);
- wait for clock_period;
- cmd <= "1101"; -- boolean test
- in1 <= "01111111100000000000000000000000"; -- + inf
- in2 <= "00111111100000000000000000000000"; -- command 0 , not
- wait for clock_period;
- in1 <= "01111111100000000000000000000000"; -- + inf
- in2 <= "00111111100000000000000000000001"; -- command 1, and
- wait for clock_period;
- in1 <= "01111111000000000000000000000000"; -- + inf
- in2 <= "00111111000000000000000000000010"; -- command 2, or
- wait for clock_period;
- in1 <= "01111111100000000000000000000000"; -- + inf
- in2 <= "00111111100000000000000000000011"; -- command 3, nand
- wait for clock_period;
- in1 <= "01111111100000000000000000000000"; -- + inf
- in2 <= "00111111100000000000000000000100"; -- command 4, nor
- wait for clock_period;
- in1 <= "01111111100000000000000000000000"; -- + inf
- in2 <= "00111111100000000000000000000101"; -- command 5, xor
- wait for clock_period;
- in1 <= "01111111100000000000000000000000"; -- + inf
- in2 <= "00111111100000000000000000000110"; -- command 6, xnor
- wait for clock_period;
- in1 <= "01111111100000000000000000000000"; -- + inf
- in2 <= "00111111100000000000000000000111"; -- command 7, xor '1'
- wait for clock_period;
- cmd <= "1110"; -- reduce and vector test test
- in1 <= "01111111100000000000000000000000"; -- + inf
- in2 <= "00111111100000000000000000000000"; -- command 0,
- wait for clock_period;
- in1 <= "11111111111111111111111111111111"; -- all 1
- wait for clock_period;
- in1 <= "10000000000000000000000000000000"; -- -0
- wait for clock_period;
- in1 <= "00000000000000000000000000000000"; -- 0
- wait for clock_period;
- in1 <= "01111111100000000000000000000000"; -- + inf
- in2 <= "00111111100000000000000000000001"; -- command 1, and '0'
- wait for clock_period;
- in2 <= "10111111100000000000000000000001"; -- command 1, and '1'
- wait for clock_period;
- in2 <= "00111111100000000000000000000010"; -- command 2, or '0'
- wait for clock_period;
- in2 <= "10111111100000000000000000000010"; -- command 2, or '1'
- wait for clock_period;
- in2 <= "00111111100000000000000000000011"; -- command 3, nand '0'
- wait for clock_period;
- in2 <= "10111111100000000000000000000011"; -- command 3, nand '1'
- wait for clock_period;
- in2 <= "00111111100000000000000000000100"; -- command 4, nor '0'
- wait for clock_period;
- in2 <= "10111111100000000000000000000100"; -- command 4, nor '1'
- wait for clock_period;
- in2 <= "00111111100000000000000000000101"; -- command 5, xor '0'
- wait for clock_period;
- in2 <= "10111111100000000000000000000101"; -- command 5, xor '1'
- wait for clock_period;
- in2 <= "00111111100000000000000000000110"; -- command 6, xnor '0'
- wait for clock_period;
- in2 <= "10111111100000000000000000000110"; -- command 6, xnor '1'
- wait for clock_period;
- in2 <= "00111111100000000000000000000111"; -- command 7, and '0'
- wait for clock_period;
- in2 <= "10111111100000000000000000000111"; -- command 7, and '1'
- wait for clock_period;
- cmd <= "1111"; -- add and mult by constant
- in2 <= "10111111100000000000000000000000"; -- command 0, + 1
- in1 <= to_float (2, in1);
- wait for clock_period;
- in2 <= "10111111100000000000000000000001"; -- command 1, 1 +
- wait for clock_period;
- in2 <= "10111111100000000000000000000010"; -- command 2, + 1.0
- wait for clock_period;
- in2 <= "10111111100000000000000000000011"; -- command 3, 1.0 +
- wait for clock_period;
- in2 <= "10111111100000000000000000000100"; -- command 4, * 1
- wait for clock_period;
- in2 <= "10111111100000000000000000000101"; -- command 5, 1 *
- wait for clock_period;
- in2 <= "10111111100000000000000000000110"; -- command 6, * 1.0
- wait for clock_period;
- in2 <= "10111111100000000000000000000111"; -- command 7, 1.0 *
- wait for clock_period;
-
-
- wait for clock_period;
- cmd <= "0000"; -- add mode
- in1 <= (others => '0');
- in2 <= (others => '0');
- wait for clock_period;
- wait for clock_period;
- wait for clock_period;
- wait for clock_period;
- wait for clock_period;
- wait for clock_period;
- wait for clock_period;
- wait for clock_period;
- wait;
- end process tester;
-
- -- purpose: check the output of the tester
- -- type : combinational
- -- inputs :
- -- outputs:
- checktest : process is
- variable out16, out16t : fp16; -- 16 bit fp variables
- variable out1t, out2t : float32; -- 32 bit float
- variable s16, s16t : SIGNED(7 downto 0); -- 7 bit SIGNED
- variable latency : INTEGER := 0;
- begin -- process checktest
- wait for clock_period/2.0;
- floop3: for i in 1 to 100 loop
- wait for clock_period;
- end loop floop3;
- latency := 0;
- out2t := "01000000100010101100000000000000";
- wl1: while out1 /= out2t loop
- wait for clock_period;
- latency := latency + 1;
- assert latency /= 100 report "After 100 loops, pattern never found"
- severity failure;
- end loop wl1;
- report "Latency was " & INTEGER'image(latency) severity note;
- floop4: for i in 1 to 100 loop
- wait for clock_period;
- end loop floop4;
- report_error ("42 * 6.5 error",
- out1,
- to_float (273, out1));
- wait for clock_period;
- report_error ("6.5 * 42 error",
- out1,
- to_float (273, out1'high, -out1'low));
- wait for clock_period;
- report_error ("Multiply 42.25 miscompare",
- out1,
- "01000010001010010000000000000000"); -- 42.25
- wait for clock_period;
- report_error ("Multiply 84 miscompare",
- out1,
- "01000010101010000000000000000000"); -- 84
- wait for clock_period;
- report_error ("Multiply 2/3 miscompare",
- out1,
- "00111111001010101010101010101011"); -- 2/3
- wait for clock_period;
- report_error ("Multiply -273 miscompare",
- out1,
- "11000011100010001000000000000000"); -- -273
- wait for clock_period;
- report_error ("mult 2**-148 test miscompare",
- out1,
- reverse("01000000000000000000000000000001")); -- -2*-148
- wait for clock_period;
- report_error ("Multiply 2**-129 miscompare",
- out1,
- reverse("00000000000000000000100000000000")); -- 2**-129
- wait for clock_period;
- report_error ("6.5 * 42 error",
- out1,
- to_float (273, out1));
- wait for clock_period;
- report_error ("Subtract 30303033 - 30303030 miscompare",
- out1,
- "01000000000000000000000000000000"); -- 2 (not 3, rounding)
- wait for clock_period;
- report_error ("Subtract 6.5 - 4 miscompare",
- out1,
- "01000000001000000000000000000000"); -- 2.5
- wait for clock_period;
- report_error ("Subtract 4 - 6.5 miscompare",
- out1,
- "11000000001000000000000000000000"); -- -2.5
- wait for clock_period;
- report_error ("Subtract 4.333 - 1/3 miscompare",
- out1,
- "01000000100000000000000000000000"); -- 4
- wait for clock_period;
- report_error ("Add 2.333 miscompare",
- out1,
- "01000000000101010101010101010101"); -- 2.333333
- wait for clock_period;
- report_error ("Add 2.333 rev miscompare",
- out1,
- "01000000000101010101010101010101"); -- 2.333333
- wait for clock_period;
- report_error ("Add 4 + miscompare",
- out1,
- "01000000100000000000000000000001"); -- 4
- wait for clock_period;
- report_error ("div 1/3 test miscompare",
- out1,
- "00111110101010101010101010101011"); -- 1/3
- wait for clock_period;
- report_error ("div 369297/2**-126 test miscompare",
- out1,
- "01111111100000000000000000000000");
- wait for clock_period;
- report_error ("-1/6 test miscompare",
- out1, "10111110001010101010101010101011"); -- -1/6
- wait for clock_period;
- -- resize function
- out16 := to_float (to_slv (out1(-8 downto -23)), 6, 9);
- out16t := to_float (1, out16t);
- report_error16 ("1.0 fp16 converserion",
- out16, out16t);
- wait for clock_period;
- out16 := to_float (to_slv (out1(-8 downto -23)), 6, 9);
- out16t := to_float (arg => -1.0/3.0, size_res => out16t,
- round_style => round_zero);
- report_error16 ("-1/3 not rounded fp16 converserion",
- out16, out16t);
- wait for clock_period;
- out16 := to_float (to_slv (out1(-8 downto -23)), 6, 9);
- out16t := to_float (-1.0/3.0, out16t);
- report_error16 ("-1/3 fp16 converserion",
- out16, out16t);
- -- conversion test
- wait for clock_period;
- report_error ("1.0 to unsigned miscompare",
- out1, "00000000000000000000000000000001");
- wait for clock_period;
- report_error ("42 to unsigned miscompare",
- out1, "00100000000000000000000000101010");
- wait for clock_period;
- report_error ("-1.0 to signed miscompare",
- out1, "01000000000000001111111111111111");
- wait for clock_period;
- report_error ("1.0 to signed miscompare",
- out1, "01100000000000000000000000000001");
- wait for clock_period;
- report_error ("4.33 to ufixed miscompare",
- out1, "10000000000000000000001000101011");
- wait for clock_period;
- report_error ("1.0 to ufixed miscompare",
- out1, "10100000000000000000000010000000");
- wait for clock_period;
- report_error ("4.333 to sfixed miscompare",
- out1, "11000000000000001111110111010101");
- wait for clock_period;
- report_error ("1.0 to sfixed miscompare",
- out1, "11100000000000000000000010000000");
- wait for clock_period;
- report_error ("unsigned 3 to float miscompare",
- out1, to_float(3, out1));
- wait for clock_period;
- report_error ("unsigned 4 to float miscompare",
- out1, to_float(4, out1));
- wait for clock_period;
- report_error ("signed -2 to float miscompare",
- out1, to_float(-2, out1));
- wait for clock_period;
- report_error ("signed 4 to float miscompare",
- out1, to_float(4, out1));
- wait for clock_period;
- report_error ("ufixed 4.333 to float miscompare",
- out1, "01000000100010101100000000000000"); -- 4.333333
- wait for clock_period;
- report_error ("ufixed 1.0 to float miscompare",
- out1, "00111111100000000000000000000000"); -- 1.0
- wait for clock_period;
- report_error ("sfixed -4.333 to float miscompare",
- out1, "11000000100010101100000000000000"); -- -4.333333
- wait for clock_period;
- report_error ("sfixed 1.0 to float miscompare",
- out1, "00111111100000000000000000000000"); -- 1.0
- wait for clock_period;
- report_error ("denormal mod denormal miscompare",
- out1, zero0);
- wait for clock_period;
- report_error ("large mod large miscompare",
- out1, zero0);
- wait for clock_period;
- report_error ("-4.333 mod 4 miscompare",
- out1,
- from_string ("01000000011010101010101010101010", out1));
- wait for clock_period;
- report_error ("denormal rem denormal miscompare",
- out1, zero0);
- wait for clock_period;
- report_error ("large rem large miscompare",
- out1, zero0);
- wait for clock_period;
- out1t := "10111110101010101010101010110000";
- report_error ("-4.333 rem 4 miscompare",
- out1, out1t);
- wait for clock_period;
- report_error ("to_float(0) miscompare",
- out1, zero0);
- wait for clock_period;
- report_error ("to_float(0.0) miscompare",
- out1, zero0);
- wait for clock_period;
- report_error ("to_float(8) miscompare",
- out1, to_float(8.0, out1));
- wait for clock_period;
- report_error ("to_float(8.0) miscompare",
- out1, to_float(8, out1));
- wait for clock_period;
- report_error ("to_float(-8) miscompare",
- out1, to_float(-8.0, out1));
- wait for clock_period;
- report_error ("to_float(-8.0) miscompare",
- out1, to_float(-8, out1));
- wait for clock_period;
- report_error ("to_float(27000) miscompare",
- out1, to_float(27000.0, out1));
- wait for clock_period;
- report_error ("to_float(PI) miscompare",
- out1, to_float(3.141592653589, out1));
- -- Conversion test
- wait for clock_period;
- report_error ("-1 miscompare",
- out1, to_float(-1, out1));
- wait for clock_period;
- report_error ("-(-2) miscompare",
- out1, to_float(2, out1));
- wait for clock_period;
- report_error ("abs(-2) miscompare",
- out1, to_float(2, out1));
- wait for clock_period;
- report_error ("abs(1) miscompare",
- out1, to_float(1, out1));
- wait for clock_period;
- report_error ("scalb (1, 1) miscompare",
- out1, to_float(2, out1));
- wait for clock_period;
- report_error ("scalb (1, -1) miscompare",
- out1, to_float(0.5, out1));
- wait for clock_period;
- s16 := SIGNED (to_slv (out1(-16 downto -23)));
- assert (s16 = 0) report "logb (1) returned "
- & to_string(to_sfixed(s16)) severity error;
- wait for clock_period;
- s16 := SIGNED (to_slv (out1(-16 downto -23)));
- assert (s16 = -2) report "logb (0.25) returned "
- & to_string(to_sfixed(s16)) severity error;
- wait for clock_period;
- out1t := "00111111100000000000000000000001";
- report_error ("nextafter (1, 1.5)", out1, out1t);
- wait for clock_period;
- out1t := "01000000011111111111111111111111";
- report_error ("nextafter (4, 1.5)", out1, out1t);
- wait for clock_period;
- out1t := "00111111011111111111111111111111";
- report_error ("nextafter (1, -1.5)", out1, out1t);
- wait for clock_period;
- out1t := "11000000011111111111111111111111";
- report_error ("nextafter (-4, -1.5)", out1, out1t);
- wait for clock_period;
- out1t := "00111111100000000000000000000001";
- report_error ("nextafter (1, inf)", out1, out1t);
- wait for clock_period;
- out1t := "01000000100000000000000000000001";
- report_error ("nextafter (4, inf)", out1, out1t);
- wait for clock_period;
- out1t := "00111111011111111111111111111111";
- report_error ("nextafter (1, neginf)", out1, out1t);
- wait for clock_period;
- out1t := "11000000100000000000000000000001";
- report_error ("nextafter (-4, neginf)", out1, out1t);
- wait for clock_period;
- report_error ("Copysign (2,2)", out1, to_float(2, out1));
- wait for clock_period;
- report_error ("Copysign (-3,3)", out1, to_float(3, out1));
- wait for clock_period;
- report_error ("Copysign (4,-4)", out1, to_float(-4, out1));
- wait for clock_period;
- report_error ("Copysign (-5,-5)", out1, to_float(-5, out1));
- wait for clock_period;
- out1t := "10001110000000000000000000000000";
- report_error ("compare test 15, 15", out1, out1t);
- wait for clock_period;
- out1t := "01101001000000000000000000000000";
- report_error ("compare test 15.5, -2", out1, out1t);
- wait for clock_period;
- out1t := "01010100000000000000000000000000";
- report_error ("compare test -2, 2", out1, out1t);
- wait for clock_period;
- out1t := "01101000010000000000000000000000";
- report_error ("compare test inf, -2", out1, out1t);
- wait for clock_period;
- out1t := "01000000101000000000000000000000";
- report_error ("compare test NAN, -2", out1, out1t);
- wait for clock_period;
- out1t := "10000000011111111111111111111111"; -- not + inf
- report_error ("not +inf", out1, out1t);
- wait for clock_period;
- out1t := "00111111100000000000000000000000"; -- and
- report_error ("and +inf", out1, out1t);
- wait for clock_period;
- out1t := "01111111000000000000000000000010"; -- or
- report_error ("or +inf", out1, out1t);
- wait for clock_period;
- out1t := "11000000011111111111111111111111"; -- nand
- report_error ("nand +inf", out1, out1t);
- wait for clock_period;
- out1t := "10000000011111111111111111111011"; -- nor
- report_error ("nor +inf", out1, out1t);
- wait for clock_period;
- out1t := "01000000000000000000000000000101"; -- xor
- report_error ("xor +inf", out1, out1t);
- wait for clock_period;
- out1t := "10111111111111111111111111111001"; -- xnor
- report_error ("xnor +inf", out1, out1t);
- wait for clock_period;
- out1t := "10000000011111111111111111111111"; -- xnor '1'
- report_error ("+inf xor '1'", out1, out1t);
- wait for clock_period;
- out1t := "01100100000000000000000000000000"; -- reduce test
- report_error ("_reduce test", out1, out1t);
- wait for clock_period;
- out1t := "10100100000000000000000000000000"; -- reduce test
- report_error ("_reduce all 1 test", out1, out1t);
- wait for clock_period;
- out1t := "01101000000000000000000000000000"; -- reduce test
- report_error ("_reduce -0 test", out1, out1t);
- wait for clock_period;
- out1t := "01010100000000000000000000000000"; -- reduce test
- report_error ("_reduce 0 test", out1, out1t);
- wait for clock_period;
- out1t := "00000000000000000000000000000000"; -- 0
- report_error ("and 0 test", out1, out1t);
- wait for clock_period;
- out1t := "01111111100000000000000000000000"; -- + inf
- report_error ("and 1 test", out1, out1t);
- wait for clock_period;
- out1t := "01111111100000000000000000000000"; -- + inf
- report_error ("or 0 test", out1, out1t);
- wait for clock_period;
- out1t := "11111111111111111111111111111111"; -- all 1
- assert (to_slv (out1) = to_slv (out1t))
- report "or 1 test error " & to_string (out1) & " /= "
- & to_string (out1t) severity error;
- wait for clock_period;
- out1t := "11111111111111111111111111111111"; -- all 1
- assert (to_slv (out1) = to_slv (out1t))
- report "nand 0 test error " & to_string (out1) & " /= "
- & to_string (out1t) severity error;
- wait for clock_period;
- out1t := "10000000011111111111111111111111"; -- - denormal
- report_error ("nand 1 test", out1, out1t);
- wait for clock_period;
- out1t := "10000000011111111111111111111111"; -- - denormal
- report_error ("nor 0 test", out1, out1t);
- wait for clock_period;
- out1t := "00000000000000000000000000000000"; -- 0
- report_error ("nor 1 test", out1, out1t);
- wait for clock_period;
- out1t := "01111111100000000000000000000000"; -- + inf
- report_error ("xor 0 test", out1, out1t);
- wait for clock_period;
- out1t := "10000000011111111111111111111111"; -- - denormal
- report_error ("xor 1 test", out1, out1t);
- wait for clock_period;
- out1t := "10000000011111111111111111111111"; -- - denormal
- report_error ("xnor 0 test", out1, out1t);
- wait for clock_period;
- out1t := "01111111100000000000000000000000"; -- + inf
- report_error ("xnor 1 test", out1, out1t);
- wait for clock_period;
- out1t := "00000000000000000000000000000000"; -- 0
- report_error ("and 0 test", out1, out1t);
- wait for clock_period;
- out1t := "01111111100000000000000000000000"; -- + inf
- report_error ("and 1 test", out1, out1t);
- wait for clock_period;
- out1t := to_float(3, out1t);
- report_error ("2 + 1 test", out1, out1t);
- wait for clock_period;
- report_error ("1 + 2 test", out1, out1t);
- wait for clock_period;
- report_error ("2 + 1.0 test", out1, out1t);
- wait for clock_period;
- report_error ("1.0 + 2 test", out1, out1t);
- wait for clock_period;
- out1t := to_float(2, out1t);
- report_error ("2 * 1 test", out1, out1t);
- wait for clock_period;
- report_error ("1 * 2 test", out1, out1t);
- wait for clock_period;
- report_error ("2 * 1.0 test", out1, out1t);
- wait for clock_period;
- report_error ("1.0 * 2 test", out1, out1t);
-
- wait for clock_period;
- assert (false) report "Testing complete" severity note;
- stop_clock <= true;
- wait;
- end process checktest;
-end architecture testbench;
diff --git a/ieee_proposed/simulation/modelsim.ini b/ieee_proposed/simulation/modelsim.ini
deleted file mode 100644
index e1ef935..0000000
--- a/ieee_proposed/simulation/modelsim.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[Library]
-others = $MODEL_TECH/../modelsim.ini
-ieee_proposed = ./work
diff --git a/library_dependencies.dot b/library_dependencies.dot
deleted file mode 100644
index ff4aabb..0000000
--- a/library_dependencies.dot
+++ /dev/null
@@ -1,8 +0,0 @@
-digraph G {
- s3estarter -> gaisler
- s3estarter -> zpu
- s3estarter -> global
- gaisler -> techmap
- zpu -> grlib
- techmap -> grlib
-}
diff --git a/library_dependencies.pdf b/library_dependencies.pdf
deleted file mode 100644
index e7a013a..0000000
--- a/library_dependencies.pdf
+++ /dev/null
Binary files differ
diff --git a/mig_test/readme.txt b/mig_test/readme.txt
deleted file mode 100644
index eba2fe9..0000000
--- a/mig_test/readme.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-Frage: Warum geht der Speicher auf den Trenz-Boards nicht richtig?
-
-Hardware:
-Trenz Giagabee
-FTDI-Kabel
-Stromversorgung
-
-Firmware:
-MIG-Design
-ZPU mit AHB2MIG und UART
-Chipscope
-
-Software:
-MEM-Test
diff --git a/mig_test/rtl/Makefile b/mig_test/rtl/Makefile
deleted file mode 100644
index 17336cd..0000000
--- a/mig_test/rtl/Makefile
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# $HeadURL: https://svn.fzd.de/repo/concast/FWF_Projects/FWF_Internals/FPGA/hw_sp601/bsp_zpuahb/rtl/Makefile $
-# $Date$
-# $Author$
-# $Revision$
-#
-
-
-DATE = $(shell date +"%b %e %Y %X")
-DATELENGTH = $(shell expr length "$(DATE)")
-
-SVNREV = $(shell svnversion | awk '{printf "%-21s", $$0}')
-SVNLENGTH = $(shell expr length "$(SVNREV)")
-
-
-all: timestamp.vhd
-
-timestamp.vhd:
- @echo "updating $@ ($(DATE); $(SVNREV))"
- @rm -f $@
- @echo "package timestamp is" >> $@
- @echo "" >> $@
- @echo " constant version_time_c : string( 1 to $(DATELENGTH)) := \"$(DATE)\";" >> $@
- @echo " constant svnrevision_c : string( 1 to $(SVNLENGTH)) := \"$(SVNREV)\";" >> $@
- @echo "" >> $@
- @echo "end package timestamp;" >> $@
-
-
-clean:
- rm timestamp.vhd
diff --git a/mig_test/rtl/box.vhd b/mig_test/rtl/box.vhd
deleted file mode 100644
index 229954a..0000000
--- a/mig_test/rtl/box.vhd
+++ /dev/null
@@ -1,432 +0,0 @@
---------------------------------------------------------------------------------
--- $Date$
--- $Author$
--- $Revision$
---------------------------------------------------------------------------------
-
-library ieee;
-use ieee.std_logic_1164.all;
-use ieee.std_logic_misc.or_reduce; -- by synopsis
-use ieee.numeric_std.all;
-
-library grlib;
-use grlib.amba.all;
-
-library gaisler;
-use gaisler.misc.all; -- types
-use gaisler.uart.all; -- types
-use gaisler.net.all; -- types
-use gaisler.memctrl.all; -- spimctrl types + spmictrl component
-
--- components
-library gaisler;
-use gaisler.uart.apbuart;
-use gaisler.misc.ahbdpram;
-use gaisler.misc.gptimer;
-use gaisler.misc.grgpio;
-use gaisler.misc.apbvga;
-use gaisler.misc.ahbram;
-use gaisler.memoryctrl.mctrl; -- original in esa lib
-use gaisler.net.greth;
-
-library techmap;
-use techmap.gencomp.all; -- constants
-
-library zpu;
-use zpu.zpu_wrapper_package.all; -- types
-use zpu.zpu_config.all;
-use zpu.zpupkg.all;
-use zpu.zpu_wrapper_package.zpu_ahb;
-use zpu.zpu_wrapper_package.dualport_ram_ahb_wrapper; -- for medium zpu
-
-library hzdr;
-use hzdr.component_package.debug_con_apb;
-
-library work;
-use work.timestamp.all;
-
-
-
-entity box is
- generic (
- system_frequency : integer;
- simulation_active : std_ulogic
- );
- port (
- clk : in std_ulogic; -- clock
- reset_n : in std_ulogic; -- synchronous reset (low active)
- break : out std_ulogic; -- to stop simulation
- --
- uarti : in uart_in_type; -- UART
- uarto : out uart_out_type;
- --
- gpioi : in gpio_in_type; -- GPIO (button, switches, LED, header pins)
- gpioo : out gpio_out_type
- );
-end entity box;
-
-
-
-
-architecture rtl of box is
-
- signal box_reset : std_ulogic;
- signal box_reset_n : std_ulogic;
- --
- signal debug_con_apb_i0_softreset : std_ulogic;
- --
- signal ahbctrl_i0_msti : ahb_mst_in_type;
- signal ahbmo : ahb_mst_out_vector := (others => ahbm_none);
- signal ahbctrl_i0_slvi : ahb_slv_in_type;
- signal ahbso : ahb_slv_out_vector := (others => ahbs_none);
- signal apbctrl_i0_apbi : apb_slv_in_type;
- signal apbo : apb_slv_out_vector := (others => apb_none);
- --
- signal gpti : gptimer_in_type;
- signal gptimer_i0_gpto : gptimer_out_type;
- --
- signal grgpio_i0_gpioo : gpio_out_type;
- --
- signal box_mctrl_wpo : wprot_out_type := (wprothit => '0');
- --
- -- put these signals in entity (later)
- signal ethi : eth_in_type; -- ethernet PHY
- signal etho : eth_out_type;
-
-begin
-
- ---------------------------------------------------------------------
- -- reset
-
- box_reset <= (not reset_n) or debug_con_apb_i0_softreset;
- box_reset_n <= not box_reset;
-
- ---------------------------------------------------------------------
- -- AHB bus masters
- ---------------------------------------------------------------------
-
- ---------------------------------------------------------------------
- -- zpu
-
- zpu_ahb_i0: zpu_ahb
- generic map (
- hindex => 0, -- : integer := 0
- zpu_small => false -- : boolean := true
- )
- port map (
- clk => clk, -- : in std_ulogic;
- reset => box_reset, -- : in std_ulogic;
- ahbi => ahbctrl_i0_msti, -- : in ahb_mst_in_type;
- ahbo => ahbmo(0), -- : out ahb_mst_out_type;
- irq => or_reduce(ahbctrl_i0_msti.hirq), -- : in std_ulogic;
- break => break -- : out std_ulogic
- );
- ---------------------------------------------------------------------
-
-
- ---------------------------------------------------------------------
- -- ethernet (ahb master + apb slave)
-
- greth_i0: greth
- generic map (
- hindex => 1,
- pindex => 5,
- paddr => 5,
- pirq => 5,
- memtech => inferred,
- mdcscaler => 20,
- enable_mdio => 1,
- fifosize => 32,
- nsync => 1,
- phyrstadr => 7 -- depends on used hardware
- )
- port map (
- rst => reset_n,
- clk => clk,
- ahbmi => ahbctrl_i0_msti,
- ahbmo => ahbmo(1),
- apbi => apbctrl_i0_apbi,
- apbo => apbo(5),
- ethi => ethi,
- etho => etho
- );
- ---------------------------------------------------------------------
-
-
- ---------------------------------------------------------------------
- -- AHB CONTROLLER
-
- --ahbmo(0) <= (ahbm_none); -- zpu_ahb_i0
- --ahbmo(1) <= (ahbm_none); -- greth_i0
- ahbmo( 2) <= ahbm_none;
- ahbmo( 3) <= ahbm_none;
- ahbmo( 4) <= ahbm_none;
- ahbmo( 5) <= ahbm_none;
- ahbmo( 6) <= ahbm_none;
- ahbmo( 7) <= ahbm_none;
- ahbmo( 8) <= ahbm_none;
- ahbmo( 9) <= ahbm_none;
- ahbmo(10) <= ahbm_none;
- ahbmo(11) <= ahbm_none;
- ahbmo(12) <= ahbm_none;
- ahbmo(13) <= ahbm_none;
- ahbmo(14) <= ahbm_none;
- ahbmo(15) <= ahbm_none;
- --
- --ahbso(0) <= (ahbs_none); -- apbctrl_i0
- --ahbso(1) <= (ahbs_none); -- ahbram_i0
- ahbso( 2) <= (ahbs_none);
- --ahbso(3) <= (ahbs_none); -- dualport_ram_ahb_wrapper_i0
- ahbso( 4) <= (ahbs_none); -- spimctrl
- ahbso( 5) <= (ahbs_none);
- ahbso( 6) <= (ahbs_none);
- ahbso( 7) <= (ahbs_none);
- ahbso( 8) <= (ahbs_none);
- ahbso( 9) <= (ahbs_none);
- ahbso(10) <= (ahbs_none);
- ahbso(11) <= (ahbs_none);
- ahbso(12) <= (ahbs_none);
- ahbso(13) <= (ahbs_none);
- ahbso(14) <= (ahbs_none);
- ahbso(15) <= (ahbs_none);
-
- ahbctrl_i0 : ahbctrl -- AHB arbiter/multiplexer
- generic map (
- defmast => 0, -- default master
- timeout => 11,
- disirq => 0, -- enable interrupt routing
- enbusmon => 0, -- enable bus monitor
- rrobin => 0,
- assertwarn => 1, -- enable assertions for warnings
- asserterr => 1 -- enable assertions for errors
- )
- port map (
- rst => box_reset_n, -- : in std_ulogic;
- clk => clk, -- : in std_ulogic;
- msti => ahbctrl_i0_msti, -- : out ahb_mst_in_type;
- msto => ahbmo, -- : in ahb_mst_out_vector;
- slvi => ahbctrl_i0_slvi, -- : out ahb_slv_in_type;
- slvo => ahbso, -- : in ahb_slv_out_vector;
- testen => '0',
- testrst => '1',
- scanen => '0',
- testoen => '1'
- );
- ----------------------------------------------------------------------
-
-
- ---------------------------------------------------------------------
- -- AHB bus slaves
- ---------------------------------------------------------------------
-
-
- ---------------------------------------------------------------------
- -- AHB RAM (internal 4k BRAM)
-
- ahbram_i0 : ahbram
- generic map (
- hindex => 1,
- haddr => 16#a00#,
- hmask => 16#FFF#,
- tech => inferred,
- kbytes => 4
- )
- port map (
- rst => box_reset_n,
- clk => clk,
- ahbsi => ahbctrl_i0_slvi,
- ahbso => ahbso(1)
- );
- ----------------------------------------------------------------------
-
-
- ---------------------------------------------------------------------
- -- AHB ZPU memory (instruction + data memory)
-
- dualport_ram_ahb_wrapper_i0 : dualport_ram_ahb_wrapper
- generic map (
- hindex => 3,
- haddr => 16#000#
- )
- port map (
- clk => clk,
- reset => box_reset,
- ahbsi => ahbctrl_i0_slvi,
- ahbso => ahbso(3)
- );
- ----------------------------------------------------------------------
-
-
--- ---------------------------------------------------------------------
--- -- AHB SPI memory controller
--- -- for SPI X4 (Winbond W25Q64VSFIG) 64-Mbit flash memory
--- spimctrl_i0 : spimctrl
--- generic map (
--- hindex => 4, -- : integer := 0; -- AHB slave index
--- faddr => 16#E00#, -- : integer := 16#000#; -- Flash map base address
--- fmask => 16#FF8#, -- : integer := 16#fff#; -- Flash area mask
--- ioaddr => 16#002#, -- : integer := 16#000#; -- I/O base address
--- iomask => 16#fff#, -- : integer := 16#fff#; -- I/O mask
--- readcmd => 16#3b#, -- : integer range 0 to 255 := 16#0B#; -- Mem. dev. READ command
--- dummybyte => 1, -- : integer range 0 to 1 := 1; -- Dummy byte after cmd
--- dualoutput => 1 -- : integer range 0 to 1 := 0; -- Enable dual output
--- )
--- port map (
--- rstn => box_reset_n, -- : in std_ulogic;
--- clk => clk, -- : in std_ulogic;
--- ahbsi => ahbctrl_i0_slvi, -- : in ahb_slv_in_type;
--- ahbso => ahbso(4), -- : out ahb_slv_out_type;
--- spii => spmi, -- : in spimctrl_in_type;
--- spio => spmo -- : out spimctrl_out_type
--- );
--- ---------------------------------------------------------------------
-
-
-
-
- ---------------------------------------------------------------------
- -- AHB/APB bridge
-
- --apbo( 0) <= (apb_none); -- debug_con_apb_i0
- --apbo( 1) <= (apb_none); -- apbuart_i0
- --apbo( 2) <= (apb_none); -- gptimer_i0
- apbo( 3) <= (apb_none);
- --apbo( 4) <= (apb_none); -- grgpio_i0
- --apbo( 5) <= (apb_none); -- greth_i0
- apbo( 6) <= (apb_none); -- no apbvga_i0
- apbo( 7) <= (apb_none); -- no i2cmst_i0
- apbo( 8) <= (apb_none);
- apbo( 9) <= (apb_none);
- apbo(10) <= (apb_none);
- apbo(11) <= (apb_none);
- apbo(12) <= (apb_none);
- apbo(13) <= (apb_none);
- apbo(14) <= (apb_none);
- apbo(15) <= (apb_none);
-
- apbctrl_i0: apbctrl
- generic map (
- hindex => 0, -- : integer := 0;
- haddr => 16#800#, -- : integer := 0;
- nslaves => 16, -- : integer range 1 to NAPBSLV := NAPBSLV;
- asserterr => 1,
- assertwarn => 1
- )
- port map (
- rst => box_reset_n, -- : in std_ulogic;
- clk => clk, -- : in std_ulogic;
- ahbi => ahbctrl_i0_slvi, -- : in ahb_slv_in_type;
- ahbo => ahbso(0), -- : out ahb_slv_out_type;
- apbi => apbctrl_i0_apbi, -- : out apb_slv_in_type;
- apbo => apbo -- : in apb_slv_out_vector
- );
- ----------------------------------------------------------------------
-
-
- ---------------------------------------------------------------------
- -- APB bus slaves
- ---------------------------------------------------------------------
-
-
- ---------------------------------------------------------------------
- -- debug console (for fast simulation output)
- debug_con_apb_i0: debug_con_apb
- generic map (
- pindex => 0, -- : integer := 0;
- paddr => 0, -- : integer := 0;
- -- values taken from timestamp.vhd:
- svnrevision => svnrevision_c, -- : string( 1 to 21) := "unknown SVN revision ";
- version_time => version_time_c, -- : string( 1 to 21) := "undefined version "
- system_frequency => system_frequency -- : integer
- )
- port map (
- rst => box_reset_n, -- : in std_ulogic;
- clk => clk, -- : in std_ulogic;
- apbi => apbctrl_i0_apbi, -- : in apb_slv_in_type;
- apbo => apbo(0), -- : out apb_slv_out_type;
- softreset => debug_con_apb_i0_softreset -- : out std_ulogic
- );
- ---------------------------------------------------------------------
-
-
- ---------------------------------------------------------------------
- -- uart
- apbuart_i0: apbuart
- generic map (
- pindex => 1,
- paddr => 1,
- console => 1, -- fast simulation output
- parity => 0, -- no parity
- flow => 1, -- hardware handshake
- fifosize => 16
- )
- port map (
- rst => box_reset_n, -- : in std_ulogic;
- clk => clk, -- : in std_ulogic;
- apbi => apbctrl_i0_apbi, -- : in apb_slv_in_type;
- apbo => apbo(1), -- : out apb_slv_out_type;
- uarti => uarti, -- : in uart_in_type;
- uarto => uarto -- : out uart_out_type);
- );
- ---------------------------------------------------------------------
-
-
- ---------------------------------------------------------------------
- -- GP timer (grip.pdf p. 279)
-
- gpti.extclk <= '0'; -- alternativ timer clock
- gpti.dhalt <= '0'; -- debug halt
- gpti.wdogen <= '0'; -- watchdog enable
-
- gptimer_i0: gptimer
- generic map (
- pindex => 2,
- paddr => 2,
- pirq => 3,
- sepirq => 0, -- use separate interupts for each timer
- sbits => 8, -- prescaler bits
- ntimers => 2, -- number of timers
- nbits => 24 -- timer bits
- )
- port map (
- rst => box_reset_n,
- clk => clk,
- apbi => apbctrl_i0_apbi,
- apbo => apbo(2),
- gpti => gpti,
- gpto => gptimer_i0_gpto
- );
- ---------------------------------------------------------------------
-
-
- ---------------------------------------------------------------------
- -- GPIO
- grgpio_i0: grgpio
- generic map (
- pindex => 4,
- paddr => 4,
--- imask => 16#00000FF0#, -- interrupt mask (+ enable per software)
- syncrst => 1, -- only synchronous reset
- nbits => 32 -- number of port bits
- )
- port map (
- rst => box_reset_n,
- clk => clk,
- apbi => apbctrl_i0_apbi,
- apbo => apbo(4),
- gpioi => gpioi,
- gpioo => grgpio_i0_gpioo
- );
- gpioo <= grgpio_i0_gpioo;
- -- gpio.dout gpio.din
- ---------------------------------------------------------------------
- -- 3 - 0 LED unused
- -- 4 MAC_DATA MAC_DATA
- -- 5 user_led unused
- -- 15 - 8 unused unused
- -- 30 - 16 unused unused
- -- 31 unused simulation_active
- ---------------------------------------------------------------------
-
-
-end architecture rtl;
diff --git a/mig_test/rtl/top.vhd b/mig_test/rtl/top.vhd
deleted file mode 100644
index 872af28..0000000
--- a/mig_test/rtl/top.vhd
+++ /dev/null
@@ -1,697 +0,0 @@
--- top-level beam position monitor
--- für Trenz TE0600
---
--- FPGA: LX45, LX100 or LX150
--- 10/100/1000 Gigabit Ethernet
--- 2*64 MByte DDR3 SDRAM
--- 8 MByte SPI Flash
---
--- enthält alle Buffer/Treiber für die FPGA-Pins
---
---
-
---------------------------------------------------------------------------------
--- $Date$
--- $Author$
--- $Revision$
---------------------------------------------------------------------------------
-
-library ieee;
-use ieee.std_logic_1164.all;
-
-entity top is
- port (
- -- pragma translate_off
- simulation_break : out std_logic;
- -- pragma translate_on
- -- system stuff
- CLK : in std_logic; -- 125 MHz
- --RESET_N : in std_logic;
- POWER_FAIL_N : in std_logic;
- WATCHDOG : out std_logic;
- REPROG_N : out std_logic;
- -- user clock
- USER_CLK : in std_logic;
- --
- -- DDR3 SDRAM
- MCB1_DRAM_A : out std_logic_vector(14 downto 0);
- MCB1_DRAM_BA : out std_logic_vector(2 downto 0);
- MCB1_DRAM_CAS_B : out std_logic;
- MCB1_DRAM_RAS_B : out std_logic;
- MCB1_DRAM_WE_B : out std_logic;
- MCB1_DRAM_CKE : out std_logic;
- MCB1_DRAM_CK_N : out std_logic;
- MCB1_DRAM_CK_P : out std_logic;
- MCB1_DRAM_DQ : inout std_logic_vector(15 downto 0);
- MCB1_DRAM_LDM : out std_logic;
- MCB1_DRAM_UDM : out std_logic;
- MCB1_DRAM_DQS_N : inout std_logic_vector(1 downto 0);
- MCB1_DRAM_DQS_P : inout std_logic_vector(1 downto 0);
- MCB1_DRAM_ODT : out std_logic;
- MCB1_DRAM_RESET_B : out std_logic;
- MCB1_RZQ : inout std_logic;
- MCB1_ZIO : inout std_logic;
- --
- MCB3_DRAM_A : out std_logic_vector(14 downto 0);
- MCB3_DRAM_BA : out std_logic_vector(2 downto 0);
- MCB3_DRAM_CAS_B : out std_logic;
- MCB3_DRAM_RAS_B : out std_logic;
- MCB3_DRAM_WE_B : out std_logic;
- MCB3_DRAM_CKE : out std_logic;
- MCB3_DRAM_CK_N : out std_logic;
- MCB3_DRAM_CK_P : out std_logic;
- MCB3_DRAM_DQ : inout std_logic_vector(15 downto 0);
- MCB3_DRAM_LDM : out std_logic;
- MCB3_DRAM_UDM : out std_logic;
- MCB3_DRAM_DQS_N : inout std_logic_vector(1 downto 0);
- MCB3_DRAM_DQS_P : inout std_logic_vector(1 downto 0);
- MCB3_DRAM_ODT : out std_logic;
- MCB3_DRAM_RESET_B : out std_logic;
- MCB3_RZQ : inout std_logic;
- MCB3_ZIO : inout std_logic;
- --
- -- Ethernet PHY
- -- phy address = 0b00111
- -- config(0) = '1'
- -- config(1) = '0'
- -- config(2) = '1'
- -- config(3) = PHY_L10
- -- config(4) = '1'
- -- config(5) = '1'
- -- config(6) = PHY_LED_RX
- --PHY_125 : in std_logic; -- 125 MHz from phy, used as clk
- PHY_MDIO : inout std_logic;
- PHY_MDC : out std_logic;
- PHY_INT : in std_logic;
- PHY_RESET_B : out std_logic;
- PHY_CRS : in std_logic;
- PHY_COL : inout std_logic;
- PHY_TXEN : out std_logic;
- PHY_TXCLK : in std_logic;
- PHY_TXER : out std_logic;
- PHY_TXD : out std_logic_vector(7 downto 0);
- PHY_GTXCLK : out std_logic;
- PHY_RXCLK : in std_logic;
- PHY_RXER : in std_logic;
- PHY_RXDV : in std_logic;
- PHY_RXD : in std_logic_vector(7 downto 0);
- --
- -- quad SPI Flash (W25Q64BV)
- SPI_FLASH_CSO_B : out std_logic;
- SPI_FLASH_CCLK : out std_logic;
- SPI_FLASH_IO : inout std_logic_vector(3 downto 0); -- ( 0=di, 1=do, 2=wp_n, 3=hold_n)
- --
- -- EEPROM (48bit MAC address, DS2502-E48)
- MAC_DATA : inout std_logic;
- --
- -- B2B J1 user IO
- B2B_B2_L57_N : inout std_logic;
- B2B_B2_L57_P : inout std_logic;
- B2B_B2_L49_N : inout std_logic;
- B2B_B2_L49_P : inout std_logic;
- B2B_B2_L48_N : inout std_logic;
- B2B_B2_L48_P : inout std_logic;
- B2B_B2_L45_N : inout std_logic;
- B2B_B2_L45_P : inout std_logic;
- B2B_B2_L43_N : inout std_logic;
- B2B_B2_L43_P : inout std_logic;
- B2B_B2_L41_N : inout std_logic;
- B2B_B2_L41_P : inout std_logic;
- B2B_B2_L21_P : inout std_logic;
- B2B_B2_L21_N : inout std_logic;
- B2B_B2_L15_P : inout std_logic;
- B2B_B2_L15_N : inout std_logic;
- B2B_B2_L31_N : inout std_logic; -- single ended
- B2B_B2_L32_N : inout std_logic; -- single ended
- B2B_B2_L60_P : inout std_logic;
- B2B_B2_L60_N : inout std_logic;
- B2B_B2_L59_N : inout std_logic;
- B2B_B2_L59_P : inout std_logic;
- B2B_B2_L44_N : inout std_logic;
- B2B_B2_L44_P : inout std_logic;
- B2B_B2_L42_N : inout std_logic;
- B2B_B2_L42_P : inout std_logic;
- B2B_B2_L18_P : inout std_logic;
- B2B_B2_L18_N : inout std_logic;
- B2B_B2_L8_N : inout std_logic;
- B2B_B2_L8_P : inout std_logic;
- B2B_B2_L11_P : inout std_logic;
- B2B_B2_L11_N : inout std_logic;
- B2B_B2_L6_P : inout std_logic;
- B2B_B2_L6_N : inout std_logic;
- B2B_B2_L5_P : inout std_logic;
- B2B_B2_L5_N : inout std_logic;
- B2B_B2_L9_N : inout std_logic;
- B2B_B2_L9_P : inout std_logic;
- B2B_B2_L4_N : inout std_logic;
- B2B_B2_L4_P : inout std_logic;
- B2B_B2_L29_N : inout std_logic; -- single ended
- B2B_B2_L10_N : inout std_logic;
- B2B_B2_L10_P : inout std_logic;
- B2B_B2_L2_N : inout std_logic;
- B2B_B2_L2_P : inout std_logic;
- --
- -- B2B J2 user IO
- B2B_B3_L60_N : inout std_logic;
- B2B_B3_L60_P : inout std_logic;
- B2B_B3_L9_N : inout std_logic;
- B2B_B3_L9_P : inout std_logic;
- B2B_B0_L3_P : inout std_logic;
- B2B_B0_L3_N : inout std_logic;
- B2B_B3_L59_P : inout std_logic;
- B2B_B3_L59_N : inout std_logic;
- B2B_B0_L32_P : inout std_logic;
- B2B_B0_L32_N : inout std_logic;
- B2B_B0_L7_N : inout std_logic;
- B2B_B0_L7_P : inout std_logic;
- B2B_B0_L33_N : inout std_logic;
- B2B_B0_L33_P : inout std_logic;
- B2B_B0_L36_P : inout std_logic;
- B2B_B0_L36_N : inout std_logic;
- B2B_B0_L49_P : inout std_logic;
- B2B_B0_L49_N : inout std_logic;
- B2B_B0_L62_P : inout std_logic;
- B2B_B0_L62_N : inout std_logic;
- B2B_B0_L66_P : inout std_logic;
- B2B_B0_L66_N : inout std_logic;
- B2B_B1_L10_P : inout std_logic;
- B2B_B1_L10_N : inout std_logic;
- B2B_B1_L9_P : inout std_logic;
- B2B_B1_L9_N : inout std_logic;
- B2B_B1_L21_N : inout std_logic;
- B2B_B1_L21_P : inout std_logic;
- B2B_B1_L61_P : inout std_logic;
- B2B_B1_L61_N : inout std_logic;
- B2B_B0_L1 : inout std_logic; -- used as reset_n
- B2B_B0_L2_P : inout std_logic;
- B2B_B0_L2_N : inout std_logic;
- B2B_B0_L4_N : inout std_logic;
- B2B_B0_L4_P : inout std_logic;
- B2B_B0_L5_N : inout std_logic;
- B2B_B0_L5_P : inout std_logic;
- B2B_B0_L6_N : inout std_logic;
- B2B_B0_L6_P : inout std_logic;
- B2B_B0_L8_N : inout std_logic;
- B2B_B0_L8_P : inout std_logic;
- B2B_B0_L34_N : inout std_logic;
- B2B_B0_L34_P : inout std_logic;
- B2B_B0_L35_N : inout std_logic;
- B2B_B0_L35_P : inout std_logic;
- B2B_B0_L37_N : inout std_logic;
- B2B_B0_L37_P : inout std_logic;
- B2B_B0_L38_N : inout std_logic;
- B2B_B0_L38_P : inout std_logic;
- B2B_B0_L50_N : inout std_logic;
- B2B_B0_L50_P : inout std_logic;
- B2B_B0_L51_N : inout std_logic;
- B2B_B0_L51_P : inout std_logic;
- B2B_B0_L63_N : inout std_logic;
- B2B_B0_L63_P : inout std_logic;
- B2B_B0_L64_N : inout std_logic;
- B2B_B0_L64_P : inout std_logic;
- B2B_B0_L65_N : inout std_logic;
- B2B_B0_L65_P : inout std_logic;
- B2B_B1_L20_P : inout std_logic;
- B2B_B1_L20_N : inout std_logic;
- B2B_B1_L19_P : inout std_logic;
- B2B_B1_L19_N : inout std_logic;
- B2B_B1_L59 : inout std_logic;
- --
- -- misc
- USER_LED_N : out std_logic;
- AV : in std_logic_vector(3 downto 0);
- BR : in std_logic_vector(3 downto 0)
- );
-end entity top;
-
-
-
-library ieee;
-use ieee.std_logic_1164.all;
-use ieee.numeric_std.all;
-
-library gaisler;
-use gaisler.misc.all; -- types
-use gaisler.uart.all; -- types
-use gaisler.net.all; -- types
-use gaisler.memctrl.all; -- spimctrl types
-
-
-architecture Behavioral of top is
-
- function simulation_active return std_ulogic is
- variable result : std_ulogic;
- begin
- result := '0';
- -- pragma translate_off
- result := '1';
- -- pragma translate_on
- return result;
- end function simulation_active;
-
-
-
- alias CARRIER_LED0 : std_logic is B2B_B3_L59_N;
- alias CARRIER_LED1 : std_logic is B2B_B3_L59_P;
- alias CARRIER_LED2 : std_logic is B2B_B3_L9_P;
- alias CARRIER_LED3 : std_logic is B2B_B3_L9_N;
- --
- alias UART_RX : std_logic is B2B_B2_L9_N;
- alias UART_TX : std_logic is B2B_B2_L6_P;
-
-
- constant system_frequency_c : natural := 125_000_000;
-
- -- system signals
- signal clk_box : std_ulogic;
- signal clk_ready : std_ulogic := '1';
- --
- signal reset_shreg : std_ulogic_vector(3 downto 0) := (others => '1');
- signal reset : std_ulogic := '1';
- signal reset_n : std_ulogic := '0';
- --
- -- io signals
- signal box_i0_break : std_ulogic;
- signal gpioi : gpio_in_type;
- signal uarti : uart_in_type;
- --
- signal box_i0_gpioo : gpio_out_type;
- signal box_i0_uarto : uart_out_type;
-
-
-begin
-
- -- default output drivers
- -- for unused blocks
- PHY_MDC <= '1';
- PHY_TXEN <= '0';
- PHY_TXER <= '0';
- PHY_TXD <= (others => '1');
- PHY_GTXCLK <= '0';
- PHY_RESET_B <= '0';
- PHY_COL <= 'Z';
- PHY_MDIO <= 'Z';
-
- MCB1_DRAM_RESET_B <= '0';
- MCB1_DRAM_A <= (others => '1');
- MCB1_DRAM_BA <= (others => '1');
- MCB1_DRAM_CAS_B <= '1';
- MCB1_DRAM_RAS_B <= '1';
- MCB1_DRAM_WE_B <= '1';
- MCB1_DRAM_CKE <= '0';
- MCB1_DRAM_CK_N <= '0';
- MCB1_DRAM_CK_P <= '1';
- MCB1_DRAM_LDM <= '0';
- MCB1_DRAM_UDM <= '0';
- MCB1_DRAM_ODT <= '1';
- MCB1_DRAM_DQS_N <= (others => 'Z');
- MCB1_DRAM_DQS_P <= (others => 'Z');
- MCB1_DRAM_DQ <= (others => 'Z');
-
- MCB3_DRAM_RESET_B <= '0';
- MCB3_DRAM_A <= (others => '1');
- MCB3_DRAM_BA <= (others => '1');
- MCB3_DRAM_CAS_B <= '1';
- MCB3_DRAM_RAS_B <= '1';
- MCB3_DRAM_WE_B <= '1';
- MCB3_DRAM_CKE <= '0';
- MCB3_DRAM_CK_N <= '0';
- MCB3_DRAM_CK_P <= '1';
- MCB3_DRAM_LDM <= '0';
- MCB3_DRAM_UDM <= '0';
- MCB3_DRAM_ODT <= '1';
- MCB3_DRAM_DQS_N <= (others => 'Z');
- MCB3_DRAM_DQS_P <= (others => 'Z');
- MCB3_DRAM_DQ <= (others => 'Z');
-
- SPI_FLASH_CSO_B <= '1';
- SPI_FLASH_CCLK <= '1';
- SPI_FLASH_IO <= (others => 'Z');
-
- WATCHDOG <= 'Z'; -- disable watchdog
- --REPROG_N <= '1';
-
- MAC_DATA <= 'Z';
-
- -- B2B J1 user IO
- B2B_B2_L57_N <= 'Z';
- B2B_B2_L57_P <= 'Z';
- B2B_B2_L49_N <= 'Z';
- B2B_B2_L49_P <= 'Z';
- B2B_B2_L48_N <= 'Z';
- B2B_B2_L48_P <= 'Z';
- B2B_B2_L45_N <= 'Z';
- B2B_B2_L45_P <= 'Z';
- B2B_B2_L43_N <= 'Z';
- B2B_B2_L43_P <= 'Z';
- B2B_B2_L41_N <= 'Z';
- B2B_B2_L41_P <= 'Z';
- B2B_B2_L21_P <= 'Z';
- B2B_B2_L21_N <= 'Z';
- B2B_B2_L15_P <= 'Z';
- B2B_B2_L15_N <= 'Z';
- B2B_B2_L31_N <= 'Z';
- B2B_B2_L32_N <= 'Z';
- B2B_B2_L60_P <= 'Z';
- B2B_B2_L60_N <= 'Z';
- B2B_B2_L59_N <= 'Z';
- B2B_B2_L59_P <= 'Z';
- B2B_B2_L44_N <= 'Z';
- B2B_B2_L44_P <= 'Z';
- B2B_B2_L42_N <= 'Z';
- B2B_B2_L42_P <= 'Z';
- B2B_B2_L18_P <= 'Z';
- B2B_B2_L18_N <= 'Z';
- B2B_B2_L8_N <= 'Z';
- B2B_B2_L8_P <= 'Z';
- B2B_B2_L11_P <= 'Z';
- B2B_B2_L11_N <= 'Z';
- B2B_B2_L6_P <= 'Z';
- B2B_B2_L6_N <= 'Z';
- B2B_B2_L5_P <= 'Z';
- B2B_B2_L5_N <= 'Z';
- B2B_B2_L9_N <= 'Z';
- B2B_B2_L9_P <= 'Z';
- B2B_B2_L4_N <= 'Z';
- B2B_B2_L4_P <= 'Z';
- B2B_B2_L29_N <= 'Z';
- B2B_B2_L10_N <= 'Z';
- B2B_B2_L10_P <= 'Z';
- B2B_B2_L2_N <= 'Z';
- B2B_B2_L2_P <= 'Z';
- B2B_B3_L60_N <= 'Z';
- B2B_B3_L60_P <= 'Z';
- --B2B_B3_L9_N <= 'Z';
- --B2B_B3_L9_P <= 'Z';
- B2B_B0_L3_P <= 'Z';
- B2B_B0_L3_N <= 'Z';
-
- -- B2B J2 user IO
- --B2B_B3_L59_P <= 'Z';
- --B2B_B3_L59_N <= 'Z';
- B2B_B0_L32_P <= 'Z';
- B2B_B0_L32_N <= 'Z';
- B2B_B0_L7_N <= 'Z';
- B2B_B0_L7_P <= 'Z';
- B2B_B0_L33_N <= 'Z';
- B2B_B0_L33_P <= 'Z';
- B2B_B0_L36_P <= 'Z';
- B2B_B0_L36_N <= 'Z';
- B2B_B0_L49_P <= 'Z';
- B2B_B0_L49_N <= 'Z';
- B2B_B0_L62_P <= 'Z';
- B2B_B0_L62_N <= 'Z';
- B2B_B0_L66_P <= 'Z';
- B2B_B0_L66_N <= 'Z';
- B2B_B1_L10_P <= 'Z';
- B2B_B1_L10_N <= 'Z';
- B2B_B1_L9_P <= 'Z';
- B2B_B1_L9_N <= 'Z';
- B2B_B1_L21_N <= 'Z';
- B2B_B1_L21_P <= 'Z';
- B2B_B1_L61_P <= 'Z';
- B2B_B1_L61_N <= 'Z';
- B2B_B0_L2_P <= 'Z';
- B2B_B0_L2_N <= 'Z';
- B2B_B0_L4_N <= 'Z';
- B2B_B0_L4_P <= 'Z';
- B2B_B0_L5_N <= 'Z';
- B2B_B0_L5_P <= 'Z';
- B2B_B0_L6_N <= 'Z';
- B2B_B0_L6_P <= 'Z';
- B2B_B0_L8_N <= 'Z';
- B2B_B0_L8_P <= 'Z';
- B2B_B0_L34_N <= 'Z';
- B2B_B0_L34_P <= 'Z';
- B2B_B0_L35_N <= 'Z';
- B2B_B0_L35_P <= 'Z';
- B2B_B0_L37_N <= 'Z';
- B2B_B0_L37_P <= 'Z';
- B2B_B0_L38_N <= 'Z';
- B2B_B0_L38_P <= 'Z';
- B2B_B0_L50_N <= 'Z';
- B2B_B0_L50_P <= 'Z';
- B2B_B0_L51_N <= 'Z';
- B2B_B0_L51_P <= 'Z';
- B2B_B0_L63_N <= 'Z';
- B2B_B0_L63_P <= 'Z';
- B2B_B0_L64_N <= 'Z';
- B2B_B0_L64_P <= 'Z';
- B2B_B0_L65_N <= 'Z';
- B2B_B0_L65_P <= 'Z';
- B2B_B1_L20_P <= 'Z';
- B2B_B1_L20_N <= 'Z';
- B2B_B1_L19_P <= 'Z';
- B2B_B1_L19_N <= 'Z';
- B2B_B1_L59 <= 'Z';
-
-
- ------------------------------------------------------------
- -- (internal) reset generation
- -- with wait for locked DCM
- reset_generator_p : process(clk_box, clk_ready)
- begin
- if clk_ready = '0' then
- reset_shreg <= (others => '1');
- elsif rising_edge(clk_box) then
- reset_shreg <= reset_shreg(reset_shreg'left-1 downto 0) & '0';
- end if;
- end process;
- reset <= reset_shreg(reset_shreg'left);
- reset_n <= not reset;
-
-
- ------------------------------------------------------------
- -- clock selection
- clk_box <= CLK; -- 125 MHz
-
- -- used IOs
- -- LEDs
- gpioi.sig_in <= (others => '0');
- gpioi.sig_en <= (others => '0');
- gpioi.din <= (4 => MAC_DATA,
- 31 => simulation_active,
- others => '0');
- CARRIER_LED0 <= not box_i0_gpioo.dout(0);
- CARRIER_LED1 <= not box_i0_gpioo.dout(1);
- CARRIER_LED2 <= not box_i0_gpioo.dout(2);
- CARRIER_LED3 <= not box_i0_gpioo.dout(3);
- user_led_n <= not box_i0_gpioo.dout(5);
- MAC_DATA <= box_i0_gpioo.dout(4) when box_i0_gpioo.oen(4) = '0' else 'Z';
-
- -- uart i/o
- uarti.rxd <= UART_RX;
- uarti.ctsn <= '0';
- uarti.extclk <= '0';
- --
- UART_TX <= box_i0_uarto.txd;
-
-
- ------------------------------------------------------------
- -- box system
- box_i0 : entity work.box
- generic map (
- simulation_active => simulation_active, --: std_ulogic;
- system_frequency => system_frequency_c --: integer
- )
- port map (
- clk => clk_box, --: in std_ulogic;
- reset_n => reset_n, --: in std_ulogic;
- break => box_i0_break, --: out std_ulogic;
- --
- uarti => uarti, --: in uart_in_type;
- uarto => box_i0_uarto, --: out uart_out_type;
- --
- gpioi => gpioi, --: in gpio_in_type;
- gpioo => box_i0_gpioo --: out gpio_out_type;
- );
-
-
- ------------------------------------------------------------
- -- break handling
- --
- -- pragma translate_off
- simulation_break <= box_i0_break;
- -- pragma translate_on
-
- -- reboot FPGA for real
- REPROG_N <= not box_i0_break;
-
-
- ------------------------------------------------------------
- -- MCB stuff
- --
- mcb_stuff_b : block
-
- begin
-
- memc1_tb_top_inst : memc1_tb_top
- generic map (
- C_SIMULATION => C1_SIMULATION,
- C_P0_MASK_SIZE => C1_P0_MASK_SIZE,
- C_P0_DATA_PORT_SIZE => C1_P0_DATA_PORT_SIZE,
- C_P1_MASK_SIZE => C1_P1_MASK_SIZE,
- C_P1_DATA_PORT_SIZE => C1_P1_DATA_PORT_SIZE,
- C_NUM_DQ_PINS => C1_NUM_DQ_PINS,
- C_MEM_BURST_LEN => C1_MEM_BURST_LEN,
- C_MEM_NUM_COL_BITS => C1_MEM_NUM_COL_BITS,
- C_p0_BEGIN_ADDRESS => C1_p0_BEGIN_ADDRESS,
- C_p0_DATA_MODE => C1_p0_DATA_MODE,
- C_p0_END_ADDRESS => C1_p0_END_ADDRESS,
- C_p0_PRBS_EADDR_MASK_POS => C1_p0_PRBS_EADDR_MASK_POS,
- C_p0_PRBS_SADDR_MASK_POS => C1_p0_PRBS_SADDR_MASK_POS,
- C_p1_BEGIN_ADDRESS => C1_p1_BEGIN_ADDRESS,
- C_p1_DATA_MODE => C1_p1_DATA_MODE,
- C_p1_END_ADDRESS => C1_p1_END_ADDRESS,
- C_p1_PRBS_EADDR_MASK_POS => C1_p1_PRBS_EADDR_MASK_POS,
- C_p1_PRBS_SADDR_MASK_POS => C1_p1_PRBS_SADDR_MASK_POS,
- C_p2_BEGIN_ADDRESS => C1_p2_BEGIN_ADDRESS,
- C_p2_DATA_MODE => C1_p2_DATA_MODE,
- C_p2_END_ADDRESS => C1_p2_END_ADDRESS,
- C_p2_PRBS_EADDR_MASK_POS => C1_p2_PRBS_EADDR_MASK_POS,
- C_p2_PRBS_SADDR_MASK_POS => C1_p2_PRBS_SADDR_MASK_POS
- )
- port map (
- error => c1_error,
- calib_done => c1_calib_done,
- clk0 => c1_clk0,
- rst0 => c1_rst0,
- cmp_error => c1_cmp_error,
- cmp_data_valid => c1_cmp_data_valid,
- vio_modify_enable => c1_vio_modify_enable,
- error_status => c1_error_status,
- vio_data_mode_value => c1_vio_data_mode_value,
- vio_addr_mode_value => c1_vio_addr_mode_value,
- cmp_data => c1_cmp_data,
- p0_mcb_cmd_en_o => c1_p0_cmd_en,
- p0_mcb_cmd_instr_o => c1_p0_cmd_instr,
- p0_mcb_cmd_bl_o => c1_p0_cmd_bl,
- p0_mcb_cmd_addr_o => c1_p0_cmd_byte_addr,
- p0_mcb_cmd_full_i => c1_p0_cmd_full,
- p0_mcb_wr_en_o => c1_p0_wr_en,
- p0_mcb_wr_mask_o => c1_p0_wr_mask,
- p0_mcb_wr_data_o => c1_p0_wr_data,
- p0_mcb_wr_full_i => c1_p0_wr_full,
- p0_mcb_wr_fifo_counts => c1_p0_wr_count,
- p0_mcb_rd_en_o => c1_p0_rd_en,
- p0_mcb_rd_data_i => c1_p0_rd_data,
- p0_mcb_rd_empty_i => c1_p0_rd_empty,
- p0_mcb_rd_fifo_counts => c1_p0_rd_count,
- p1_mcb_cmd_en_o => c1_p1_cmd_en,
- p1_mcb_cmd_instr_o => c1_p1_cmd_instr,
- p1_mcb_cmd_bl_o => c1_p1_cmd_bl,
- p1_mcb_cmd_addr_o => c1_p1_cmd_byte_addr,
- p1_mcb_cmd_full_i => c1_p1_cmd_full,
- p1_mcb_wr_en_o => c1_p1_wr_en,
- p1_mcb_wr_mask_o => c1_p1_wr_mask,
- p1_mcb_wr_data_o => c1_p1_wr_data,
- p1_mcb_wr_full_i => c1_p1_wr_full,
- p1_mcb_wr_fifo_counts => c1_p1_wr_count,
- p1_mcb_rd_en_o => c1_p1_rd_en,
- p1_mcb_rd_data_i => c1_p1_rd_data,
- p1_mcb_rd_empty_i => c1_p1_rd_empty,
- p1_mcb_rd_fifo_counts => c1_p1_rd_count,
- p2_mcb_cmd_en_o => c1_p2_cmd_en,
- p2_mcb_cmd_instr_o => c1_p2_cmd_instr,
- p2_mcb_cmd_bl_o => c1_p2_cmd_bl,
- p2_mcb_cmd_addr_o => c1_p2_cmd_byte_addr,
- p2_mcb_cmd_full_i => c1_p2_cmd_full,
- p2_mcb_wr_en_o => c1_p2_wr_en,
- p2_mcb_wr_mask_o => c1_p2_wr_mask,
- p2_mcb_wr_data_o => c1_p2_wr_data,
- p2_mcb_wr_full_i => c1_p2_wr_full,
- p2_mcb_wr_fifo_counts => c1_p2_wr_count,
- p2_mcb_rd_en_o => c1_p2_rd_en,
- p2_mcb_rd_data_i => c1_p2_rd_data,
- p2_mcb_rd_empty_i => c1_p2_rd_empty,
- p2_mcb_rd_fifo_counts => c1_p2_rd_count
- );
-
-
- memc3_tb_top_inst : memc3_tb_top
- generic map (
- C_SIMULATION => C3_SIMULATION,
- C_P0_MASK_SIZE => C3_P0_MASK_SIZE,
- C_P0_DATA_PORT_SIZE => C3_P0_DATA_PORT_SIZE,
- C_P1_MASK_SIZE => C3_P1_MASK_SIZE,
- C_P1_DATA_PORT_SIZE => C3_P1_DATA_PORT_SIZE,
- C_NUM_DQ_PINS => C3_NUM_DQ_PINS,
- C_MEM_BURST_LEN => C3_MEM_BURST_LEN,
- C_MEM_NUM_COL_BITS => C3_MEM_NUM_COL_BITS,
- C_p0_BEGIN_ADDRESS => C3_p0_BEGIN_ADDRESS,
- C_p0_DATA_MODE => C3_p0_DATA_MODE,
- C_p0_END_ADDRESS => C3_p0_END_ADDRESS,
- C_p0_PRBS_EADDR_MASK_POS => C3_p0_PRBS_EADDR_MASK_POS,
- C_p0_PRBS_SADDR_MASK_POS => C3_p0_PRBS_SADDR_MASK_POS,
- C_p1_BEGIN_ADDRESS => C3_p1_BEGIN_ADDRESS,
- C_p1_DATA_MODE => C3_p1_DATA_MODE,
- C_p1_END_ADDRESS => C3_p1_END_ADDRESS,
- C_p1_PRBS_EADDR_MASK_POS => C3_p1_PRBS_EADDR_MASK_POS,
- C_p1_PRBS_SADDR_MASK_POS => C3_p1_PRBS_SADDR_MASK_POS,
- C_p2_BEGIN_ADDRESS => C3_p2_BEGIN_ADDRESS,
- C_p2_DATA_MODE => C3_p2_DATA_MODE,
- C_p2_END_ADDRESS => C3_p2_END_ADDRESS,
- C_p2_PRBS_EADDR_MASK_POS => C3_p2_PRBS_EADDR_MASK_POS,
- C_p2_PRBS_SADDR_MASK_POS => C3_p2_PRBS_SADDR_MASK_POS
- )
- port map (
- error => c3_error,
- calib_done => c3_calib_done,
- clk0 => c3_clk0,
- rst0 => c3_rst0,
- cmp_error => c3_cmp_error,
- cmp_data_valid => c3_cmp_data_valid,
- vio_modify_enable => c3_vio_modify_enable,
- error_status => c3_error_status,
- vio_data_mode_value => c3_vio_data_mode_value,
- vio_addr_mode_value => c3_vio_addr_mode_value,
- cmp_data => c3_cmp_data,
- p0_mcb_cmd_en_o => c3_p0_cmd_en,
- p0_mcb_cmd_instr_o => c3_p0_cmd_instr,
- p0_mcb_cmd_bl_o => c3_p0_cmd_bl,
- p0_mcb_cmd_addr_o => c3_p0_cmd_byte_addr,
- p0_mcb_cmd_full_i => c3_p0_cmd_full,
- p0_mcb_wr_en_o => c3_p0_wr_en,
- p0_mcb_wr_mask_o => c3_p0_wr_mask,
- p0_mcb_wr_data_o => c3_p0_wr_data,
- p0_mcb_wr_full_i => c3_p0_wr_full,
- p0_mcb_wr_fifo_counts => c3_p0_wr_count,
- p0_mcb_rd_en_o => c3_p0_rd_en,
- p0_mcb_rd_data_i => c3_p0_rd_data,
- p0_mcb_rd_empty_i => c3_p0_rd_empty,
- p0_mcb_rd_fifo_counts => c3_p0_rd_count,
- p1_mcb_cmd_en_o => c3_p1_cmd_en,
- p1_mcb_cmd_instr_o => c3_p1_cmd_instr,
- p1_mcb_cmd_bl_o => c3_p1_cmd_bl,
- p1_mcb_cmd_addr_o => c3_p1_cmd_byte_addr,
- p1_mcb_cmd_full_i => c3_p1_cmd_full,
- p1_mcb_wr_en_o => c3_p1_wr_en,
- p1_mcb_wr_mask_o => c3_p1_wr_mask,
- p1_mcb_wr_data_o => c3_p1_wr_data,
- p1_mcb_wr_full_i => c3_p1_wr_full,
- p1_mcb_wr_fifo_counts => c3_p1_wr_count,
- p1_mcb_rd_en_o => c3_p1_rd_en,
- p1_mcb_rd_data_i => c3_p1_rd_data,
- p1_mcb_rd_empty_i => c3_p1_rd_empty,
- p1_mcb_rd_fifo_counts => c3_p1_rd_count,
- p2_mcb_cmd_en_o => c3_p2_cmd_en,
- p2_mcb_cmd_instr_o => c3_p2_cmd_instr,
- p2_mcb_cmd_bl_o => c3_p2_cmd_bl,
- p2_mcb_cmd_addr_o => c3_p2_cmd_byte_addr,
- p2_mcb_cmd_full_i => c3_p2_cmd_full,
- p2_mcb_wr_en_o => c3_p2_wr_en,
- p2_mcb_wr_mask_o => c3_p2_wr_mask,
- p2_mcb_wr_data_o => c3_p2_wr_data,
- p2_mcb_wr_full_i => c3_p2_wr_full,
- p2_mcb_wr_fifo_counts => c3_p2_wr_count,
- p2_mcb_rd_en_o => c3_p2_rd_en,
- p2_mcb_rd_data_i => c3_p2_rd_data,
- p2_mcb_rd_empty_i => c3_p2_rd_empty,
- p2_mcb_rd_fifo_counts => c3_p2_rd_count
- );
-
- end block mcb_stuff_b;
-
-
-end architecture Behavioral;
-
diff --git a/mig_test/rtl/zpu_config.vhd b/mig_test/rtl/zpu_config.vhd
deleted file mode 100644
index ae410e2..0000000
--- a/mig_test/rtl/zpu_config.vhd
+++ /dev/null
@@ -1,61 +0,0 @@
--- ZPU
---
--- Copyright 2004-2008 oharboe - Øyvind Harboe - oyvind.harboe@zylin.com
---
--- The FreeBSD license
---
--- Redistribution and use in source and binary forms, with or without
--- modification, are permitted provided that the following conditions
--- are met:
---
--- 1. Redistributions of source code must retain the above copyright
--- notice, this list of conditions and the following disclaimer.
--- 2. Redistributions in binary form must reproduce the above
--- copyright notice, this list of conditions and the following
--- disclaimer in the documentation and/or other materials
--- provided with the distribution.
---
--- THIS SOFTWARE IS PROVIDED BY THE ZPU PROJECT ``AS IS'' AND ANY
--- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
--- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
--- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
--- ZPU PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
--- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
--- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
--- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
--- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
--- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
--- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
--- ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---
--- The views and conclusions contained in the software and documentation
--- are those of the authors and should not be interpreted as representing
--- official policies, either expressed or implied, of the ZPU Project.
-
-library ieee;
-use ieee.std_logic_1164.all;
-use ieee.numeric_std.all;
-
-package zpu_config is
- -- generate trace output
- constant Generate_Trace : boolean := false;
- constant wordPower : integer := 5;
- -- during simulation, set this to '0' to get matching trace.txt
- constant DontCareValue : std_logic := '0';
- -- Clock frequency in MHz.
- constant ZPU_Frequency : std_ulogic_vector(7 downto 0) := std_ulogic_vector(to_unsigned(50, 8));
- -- This is the msb address bit. bytes=2^(maxAddrBitIncIO+1)
- constant maxAddrBitIncIO : integer := 31; -- BLa: 31 -- was: 27
- --constant maxAddrBitBRAM : integer := 13; -- 16k
- constant maxAddrBitBRAM : integer := 14; -- 32k
- --constant maxAddrBitBRAM : integer := 16;
-
- --
- -- derived constants
- constant bram_words : integer := 2 ** (maxAddrBitBRAM - 1);
-
- -- start byte address of stack.
- -- point to top of RAM - 2*words
- constant spStart : unsigned(maxAddrBitIncIO downto 0) :=
- to_unsigned((4*bram_words)-8, maxAddrBitIncIO+1);
-end zpu_config;
diff --git a/mig_test/rtl_tb/top_tb.vhd b/mig_test/rtl_tb/top_tb.vhd
deleted file mode 100644
index a8c3ead..0000000
--- a/mig_test/rtl_tb/top_tb.vhd
+++ /dev/null
@@ -1,408 +0,0 @@
-library ieee;
-use ieee.std_logic_1164.all;
-
-
-entity top_tb is
-end top_tb;
-
-
-architecture testbench of top_tb is
-
- constant system_frequency : integer := 125_000_000; -- MHz
- constant tb_clk_period : time := (1 sec) / system_frequency;
-
- signal simulation_run : boolean := true;
- signal tb_simulation_break : std_logic;
- --
- signal tb_clk : std_logic := '0';
- signal tb_reset_n : std_logic;
- signal tb_power_fail_n : std_logic;
- signal tb_watchdog : std_logic;
- signal tb_reprog_n : std_logic;
- --
- signal tb_user_clk : std_logic;
- --
- signal tb_mcb1_dram_a : std_logic_vector(14 downto 0);
- signal tb_mcb1_dram_ba : std_logic_vector(2 downto 0);
- signal tb_mcb1_dram_cas_b : std_logic;
- signal tb_mcb1_dram_ras_b : std_logic;
- signal tb_mcb1_dram_we_b : std_logic;
- signal tb_mcb1_dram_cke : std_logic;
- signal tb_mcb1_dram_ck_n : std_logic;
- signal tb_mcb1_dram_ck_p : std_logic;
- signal tb_mcb1_dram_dq : std_logic_vector(15 downto 0);
- signal tb_mcb1_dram_ldm : std_logic;
- signal tb_mcb1_dram_udm : std_logic;
- signal tb_mcb1_dram_dqs_n : std_logic_vector( 1 downto 0);
- signal tb_mcb1_dram_dqs_p : std_logic_vector( 1 downto 0);
- signal tb_mcb1_dram_odt : std_logic;
- signal tb_mcb1_dram_reset_b : std_logic;
- --
- signal tb_mcb3_dram_a : std_logic_vector(14 downto 0);
- signal tb_mcb3_dram_ba : std_logic_vector(2 downto 0);
- signal tb_mcb3_dram_cas_b : std_logic;
- signal tb_mcb3_dram_ras_b : std_logic;
- signal tb_mcb3_dram_we_b : std_logic;
- signal tb_mcb3_dram_cke : std_logic;
- signal tb_mcb3_dram_ck_n : std_logic;
- signal tb_mcb3_dram_ck_p : std_logic;
- signal tb_mcb3_dram_dq : std_logic_vector(15 downto 0);
- signal tb_mcb3_dram_ldm : std_logic;
- signal tb_mcb3_dram_udm : std_logic;
- signal tb_mcb3_dram_dqs_n : std_logic_vector( 1 downto 0);
- signal tb_mcb3_dram_dqs_p : std_logic_vector( 1 downto 0);
- signal tb_mcb3_dram_odt : std_logic;
- signal tb_mcb3_dram_reset_b : std_logic;
- --
- signal tb_phy_mdio : std_logic;
- signal tb_phy_mdc : std_logic;
- signal tb_phy_int : std_logic;
- signal tb_phy_reset_b : std_logic;
- signal tb_phy_crs : std_logic;
- signal tb_phy_col : std_logic;
- signal tb_phy_txen : std_logic;
- signal tb_phy_txclk : std_logic;
- signal tb_phy_txer : std_logic;
- signal tb_phy_txd : std_logic_vector(7 downto 0);
- signal tb_phy_gtxclk : std_logic;
- signal tb_phy_rxclk : std_logic;
- signal tb_phy_rxer : std_logic;
- signal tb_phy_rxdv : std_logic;
- signal tb_phy_rxd : std_logic_vector(7 downto 0);
- --
- signal tb_spi_flash_cso_b : std_logic;
- signal tb_spi_flash_cclk : std_logic;
- signal tb_spi_flash_io : std_logic_vector(3 downto 0); -- ( 0=di, 1=do, 2=wp_n, 3=hold_n)
- --
- signal tb_mac_data : std_logic;
- --
- signal tb_b2b_b2_l57_n : std_logic;
- signal tb_b2b_b2_l57_p : std_logic;
- signal tb_b2b_b2_l49_n : std_logic;
- signal tb_b2b_b2_l49_p : std_logic;
- signal tb_b2b_b2_l48_n : std_logic;
- signal tb_b2b_b2_l48_p : std_logic;
- signal tb_b2b_b2_l45_n : std_logic;
- signal tb_b2b_b2_l45_p : std_logic;
- signal tb_b2b_b2_l43_n : std_logic;
- signal tb_b2b_b2_l43_p : std_logic;
- signal tb_b2b_b2_l41_n : std_logic;
- signal tb_b2b_b2_l41_p : std_logic;
- signal tb_b2b_b2_l21_p : std_logic;
- signal tb_b2b_b2_l21_n : std_logic;
- signal tb_b2b_b2_l15_p : std_logic;
- signal tb_b2b_b2_l15_n : std_logic;
- signal tb_b2b_b2_l31_n : std_logic; -- single ended
- signal tb_b2b_b2_l32_n : std_logic; -- single ended
- signal tb_b2b_b2_l60_p : std_logic;
- signal tb_b2b_b2_l60_n : std_logic;
- signal tb_b2b_b2_l59_n : std_logic;
- signal tb_b2b_b2_l59_p : std_logic;
- signal tb_b2b_b2_l44_n : std_logic;
- signal tb_b2b_b2_l44_p : std_logic;
- signal tb_b2b_b2_l42_n : std_logic;
- signal tb_b2b_b2_l42_p : std_logic;
- signal tb_b2b_b2_l18_p : std_logic;
- signal tb_b2b_b2_l18_n : std_logic;
- signal tb_b2b_b2_l8_n : std_logic;
- signal tb_b2b_b2_l8_p : std_logic;
- signal tb_b2b_b2_l11_p : std_logic;
- signal tb_b2b_b2_l11_n : std_logic;
- signal tb_b2b_b2_l6_p : std_logic;
- signal tb_b2b_b2_l6_n : std_logic;
- signal tb_b2b_b2_l5_p : std_logic;
- signal tb_b2b_b2_l5_n : std_logic;
- signal tb_b2b_b2_l9_n : std_logic;
- signal tb_b2b_b2_l9_p : std_logic;
- signal tb_b2b_b2_l4_n : std_logic;
- signal tb_b2b_b2_l4_p : std_logic;
- signal tb_b2b_b2_l29_n : std_logic; -- single ended
- signal tb_b2b_b2_l10_n : std_logic;
- signal tb_b2b_b2_l10_p : std_logic;
- signal tb_b2b_b2_l2_n : std_logic;
- signal tb_b2b_b2_l2_p : std_logic;
- --
- signal tb_b2b_b3_l60_n : std_logic;
- signal tb_b2b_b3_l60_p : std_logic;
- signal tb_b2b_b3_l9_n : std_logic;
- signal tb_b2b_b3_l9_p : std_logic;
- signal tb_b2b_b0_l3_p : std_logic;
- signal tb_b2b_b0_l3_n : std_logic;
- signal tb_b2b_b3_l59_p : std_logic;
- signal tb_b2b_b3_l59_n : std_logic;
- signal tb_b2b_b0_l32_p : std_logic;
- signal tb_b2b_b0_l32_n : std_logic;
- signal tb_b2b_b0_l7_n : std_logic;
- signal tb_b2b_b0_l7_p : std_logic;
- signal tb_b2b_b0_l33_n : std_logic;
- signal tb_b2b_b0_l33_p : std_logic;
- signal tb_b2b_b0_l36_p : std_logic;
- signal tb_b2b_b0_l36_n : std_logic;
- signal tb_b2b_b0_l49_p : std_logic;
- signal tb_b2b_b0_l49_n : std_logic;
- signal tb_b2b_b0_l62_p : std_logic;
- signal tb_b2b_b0_l62_n : std_logic;
- signal tb_b2b_b0_l66_p : std_logic;
- signal tb_b2b_b0_l66_n : std_logic;
- signal tb_b2b_b1_l10_p : std_logic;
- signal tb_b2b_b1_l10_n : std_logic;
- signal tb_b2b_b1_l9_p : std_logic;
- signal tb_b2b_b1_l9_n : std_logic;
- signal tb_b2b_b1_l21_n : std_logic;
- signal tb_b2b_b1_l21_p : std_logic;
- signal tb_b2b_b1_l61_p : std_logic;
- signal tb_b2b_b1_l61_n : std_logic;
- --
- signal tb_b2b_b0_l2_p : std_logic;
- signal tb_b2b_b0_l2_n : std_logic;
- signal tb_b2b_b0_l4_n : std_logic;
- signal tb_b2b_b0_l4_p : std_logic;
- signal tb_b2b_b0_l5_n : std_logic;
- signal tb_b2b_b0_l5_p : std_logic;
- signal tb_b2b_b0_l6_n : std_logic;
- signal tb_b2b_b0_l6_p : std_logic;
- signal tb_b2b_b0_l8_n : std_logic;
- signal tb_b2b_b0_l8_p : std_logic;
- signal tb_b2b_b0_l34_n : std_logic;
- signal tb_b2b_b0_l34_p : std_logic;
- signal tb_b2b_b0_l35_n : std_logic;
- signal tb_b2b_b0_l35_p : std_logic;
- signal tb_b2b_b0_l37_n : std_logic;
- signal tb_b2b_b0_l37_p : std_logic;
- signal tb_b2b_b0_l38_n : std_logic;
- signal tb_b2b_b0_l38_p : std_logic;
- signal tb_b2b_b0_l50_n : std_logic;
- signal tb_b2b_b0_l50_p : std_logic;
- signal tb_b2b_b0_l51_n : std_logic;
- signal tb_b2b_b0_l51_p : std_logic;
- signal tb_b2b_b0_l63_n : std_logic;
- signal tb_b2b_b0_l63_p : std_logic;
- signal tb_b2b_b0_l64_n : std_logic;
- signal tb_b2b_b0_l64_p : std_logic;
- signal tb_b2b_b0_l65_n : std_logic;
- signal tb_b2b_b0_l65_p : std_logic;
- signal tb_b2b_b1_l20_p : std_logic;
- signal tb_b2b_b1_l20_n : std_logic;
- signal tb_b2b_b1_l19_p : std_logic;
- signal tb_b2b_b1_l19_n : std_logic;
- signal tb_b2b_b1_l59 : std_logic;
- --
- signal tb_user_led_n : std_logic;
- signal tb_av : std_logic_vector(3 downto 0);
- signal tb_br : std_logic_vector(3 downto 0);
-
-
-begin
-
- tb_clk <= not tb_clk after tb_clk_period / 2 when simulation_run;
- tb_reset_n <= '0', '1' after tb_clk_period * 6.66;
-
- top_i0: entity work.top
- port map (
- -- pragma translate_off
- simulation_break => tb_simulation_break, -- : out std_logic;
- -- pragma translate_on
- -- system stuff
- CLK => tb_clk, -- : in std_logic; -- 125 MHz
- --RESET_N => tb_reset_n, -- : in std_logic;
- POWER_FAIL_N => tb_power_fail_n, -- : in std_logic;
- WATCHDOG => tb_watchdog, -- : out std_logic;
- REPROG_N => tb_reprog_n, -- : out std_logic;
- -- user clock --
- USER_CLK => tb_user_clk, -- : in std_logic;
- -- --
- -- DDR3 SDRAM --
- MCB1_DRAM_A => tb_mcb1_dram_a, -- : out std_logic_vector(14 downto 0);
- MCB1_DRAM_BA => tb_mcb1_dram_ba, -- : out std_logic_vector(2 downto 0);
- MCB1_DRAM_CAS_B => tb_mcb1_dram_cas_b, -- : out std_logic;
- MCB1_DRAM_RAS_B => tb_mcb1_dram_ras_b, -- : out std_logic;
- MCB1_DRAM_WE_B => tb_mcb1_dram_we_b, -- : out std_logic;
- MCB1_DRAM_CKE => tb_mcb1_dram_cke, -- : out std_logic;
- MCB1_DRAM_CK_N => tb_mcb1_dram_ck_n, -- : out std_logic;
- MCB1_DRAM_CK_P => tb_mcb1_dram_ck_p, -- : out std_logic;
- MCB1_DRAM_DQ => tb_mcb1_dram_dq, -- : inout std_logic_vector(15 downto 0);
- MCB1_DRAM_LDM => tb_mcb1_dram_ldm, -- : out std_logic;
- MCB1_DRAM_UDM => tb_mcb1_dram_udm, -- : out std_logic;
- MCB1_DRAM_DQS_N => tb_mcb1_dram_dqs_n, -- : inout std_logic_vector;
- MCB1_DRAM_DQS_P => tb_mcb1_dram_dqs_p, -- : inout std_logic_vector;
- MCB1_DRAM_ODT => tb_mcb1_dram_odt, -- : out std_logic;
- MCB1_DRAM_RESET_B => tb_mcb1_dram_reset_b, -- : out std_logic;
- -- --
- MCB3_DRAM_A => tb_mcb3_dram_a, -- : out std_logic_vector(14 downto 0);
- MCB3_DRAM_BA => tb_mcb3_dram_ba, -- : out std_logic_vector(2 downto 0);
- MCB3_DRAM_CAS_B => tb_mcb3_dram_cas_b, -- : out std_logic;
- MCB3_DRAM_RAS_B => tb_mcb3_dram_ras_b, -- : out std_logic;
- MCB3_DRAM_WE_B => tb_mcb3_dram_we_b, -- : out std_logic;
- MCB3_DRAM_CKE => tb_mcb3_dram_cke, -- : out std_logic;
- MCB3_DRAM_CK_N => tb_mcb3_dram_ck_n, -- : out std_logic;
- MCB3_DRAM_CK_P => tb_mcb3_dram_ck_p, -- : out std_logic;
- MCB3_DRAM_DQ => tb_mcb3_dram_dq, -- : inout std_logic_vector(15 downto 0);
- MCB3_DRAM_LDM => tb_mcb3_dram_ldm, -- : out std_logic;
- MCB3_DRAM_UDM => tb_mcb3_dram_udm, -- : out std_logic;
- MCB3_DRAM_DQS_N => tb_mcb3_dram_dqs_n, -- : inout std_logic_vector;
- MCB3_DRAM_DQS_P => tb_mcb3_dram_dqs_p, -- : inout std_logic_vector;
- MCB3_DRAM_ODT => tb_mcb3_dram_odt, -- : out std_logic;
- MCB3_DRAM_RESET_B => tb_mcb3_dram_reset_b, -- : out std_logic;
- --
- -- Ethernet PHY
- -- phy address = 0b00111
- -- config(0) = '1'
- -- config(1) = '0'
- -- config(2) = '1'
- -- config(3) = PHY_L10
- -- config(4) = '1'
- -- config(5) = '1'
- -- config(6) = PHY_LED_RX
- --PHY_125 -- : in std_logic; -- 125 MHz from phy, used as clk
- PHY_MDIO => tb_phy_mdio, -- : inout std_logic;
- PHY_MDC => tb_phy_mdc, -- : out std_logic;
- PHY_INT => tb_phy_int, -- : in std_logic;
- PHY_RESET_B => tb_phy_reset_b, -- : out std_logic;
- PHY_CRS => tb_phy_crs, -- : in std_logic;
- PHY_COL => tb_phy_col, -- : inout std_logic;
- PHY_TXEN => tb_phy_txen, -- : out std_logic;
- PHY_TXCLK => tb_phy_txclk, -- : in std_logic;
- PHY_TXER => tb_phy_txer, -- : out std_logic;
- PHY_TXD => tb_phy_txd, -- : out std_logic_vector(7 downto 0);
- PHY_GTXCLK => tb_phy_gtxclk, -- : out std_logic;
- PHY_RXCLK => tb_phy_rxclk, -- : in std_logic;
- PHY_RXER => tb_phy_rxer, -- : in std_logic;
- PHY_RXDV => tb_phy_rxdv, -- : in std_logic;
- PHY_RXD => tb_phy_rxd, -- : in std_logic_vector(7 downto 0);
- --
- -- quad SPI Flash (W25Q64BV)
- SPI_FLASH_CSO_B => tb_spi_flash_cso_b, -- : out std_logic;
- SPI_FLASH_CCLK => tb_spi_flash_cclk, -- : out std_logic;
- SPI_FLASH_IO => tb_spi_flash_io, -- : inout std_logic_vector(3 downto 0); -- ( 0=di, 1=do, 2=wp_n, 3=hold_n)
- --
- -- EEPROM (48bit MAC address, DS2502-E48)
- MAC_DATA => tb_mac_data, -- : inout std_logic;
- --
- -- B2B J1 user IO
- B2B_B2_L57_N => tb_b2b_b2_l57_n, -- : inout std_logic;
- B2B_B2_L57_P => tb_b2b_b2_l57_p, -- : inout std_logic;
- B2B_B2_L49_N => tb_b2b_b2_l49_n, -- : inout std_logic;
- B2B_B2_L49_P => tb_b2b_b2_l49_p, -- : inout std_logic;
- B2B_B2_L48_N => tb_b2b_b2_l48_n, -- : inout std_logic;
- B2B_B2_L48_P => tb_b2b_b2_l48_p, -- : inout std_logic;
- B2B_B2_L45_N => tb_b2b_b2_l45_n, -- : inout std_logic;
- B2B_B2_L45_P => tb_b2b_b2_l45_p, -- : inout std_logic;
- B2B_B2_L43_N => tb_b2b_b2_l43_n, -- : inout std_logic;
- B2B_B2_L43_P => tb_b2b_b2_l43_p, -- : inout std_logic;
- B2B_B2_L41_N => tb_b2b_b2_l41_n, -- : inout std_logic;
- B2B_B2_L41_P => tb_b2b_b2_l41_p, -- : inout std_logic;
- B2B_B2_L21_P => tb_b2b_b2_l21_p, -- : inout std_logic;
- B2B_B2_L21_N => tb_b2b_b2_l21_n, -- : inout std_logic;
- B2B_B2_L15_P => tb_b2b_b2_l15_p, -- : inout std_logic;
- B2B_B2_L15_N => tb_b2b_b2_l15_n, -- : inout std_logic;
- B2B_B2_L31_N => tb_b2b_b2_l31_n, -- : inout std_logic; -- single ended
- B2B_B2_L32_N => tb_b2b_b2_l32_n, -- : inout std_logic; -- single ended
- B2B_B2_L60_P => tb_b2b_b2_l60_p, -- : inout std_logic;
- B2B_B2_L60_N => tb_b2b_b2_l60_n, -- : inout std_logic;
- B2B_B2_L59_N => tb_b2b_b2_l59_n, -- : inout std_logic;
- B2B_B2_L59_P => tb_b2b_b2_l59_p, -- : inout std_logic;
- B2B_B2_L44_N => tb_b2b_b2_l44_n, -- : inout std_logic;
- B2B_B2_L44_P => tb_b2b_b2_l44_p, -- : inout std_logic;
- B2B_B2_L42_N => tb_b2b_b2_l42_n, -- : inout std_logic;
- B2B_B2_L42_P => tb_b2b_b2_l42_p, -- : inout std_logic;
- B2B_B2_L18_P => tb_b2b_b2_l18_p, -- : inout std_logic;
- B2B_B2_L18_N => tb_b2b_b2_l18_n, -- : inout std_logic;
- B2B_B2_L8_N => tb_b2b_b2_l8_n, -- : inout std_logic;
- B2B_B2_L8_P => tb_b2b_b2_l8_p, -- : inout std_logic;
- B2B_B2_L11_P => tb_b2b_b2_l11_p, -- : inout std_logic;
- B2B_B2_L11_N => tb_b2b_b2_l11_n, -- : inout std_logic;
- B2B_B2_L6_P => tb_b2b_b2_l6_p, -- : inout std_logic;
- B2B_B2_L6_N => tb_b2b_b2_l6_n, -- : inout std_logic;
- B2B_B2_L5_P => tb_b2b_b2_l5_p, -- : inout std_logic;
- B2B_B2_L5_N => tb_b2b_b2_l5_n, -- : inout std_logic;
- B2B_B2_L9_N => tb_b2b_b2_l9_n, -- : inout std_logic;
- B2B_B2_L9_P => tb_b2b_b2_l9_p, -- : inout std_logic;
- B2B_B2_L4_N => tb_b2b_b2_l4_n, -- : inout std_logic;
- B2B_B2_L4_P => tb_b2b_b2_l4_p, -- : inout std_logic;
- B2B_B2_L29_N => tb_b2b_b2_l29_n, -- : inout std_logic; -- single ended
- B2B_B2_L10_N => tb_b2b_b2_l10_n, -- : inout std_logic;
- B2B_B2_L10_P => tb_b2b_b2_l10_p, -- : inout std_logic;
- B2B_B2_L2_N => tb_b2b_b2_l2_n, -- : inout std_logic;
- B2B_B2_L2_P => tb_b2b_b2_l2_p, -- : inout std_logic;
- --
- -- B2B J2 user IO
- B2B_B3_L60_N => tb_b2b_b3_l60_n, -- : inout std_logic;
- B2B_B3_L60_P => tb_b2b_b3_l60_p, -- : inout std_logic;
- B2B_B3_L9_N => tb_b2b_b3_l9_n, -- : inout std_logic;
- B2B_B3_L9_P => tb_b2b_b3_l9_p, -- : inout std_logic;
- B2B_B0_L3_P => tb_b2b_b0_l3_p, -- : inout std_logic;
- B2B_B0_L3_N => tb_b2b_b0_l3_n, -- : inout std_logic;
- B2B_B3_L59_P => tb_b2b_b3_l59_p, -- : inout std_logic;
- B2B_B3_L59_N => tb_b2b_b3_l59_n, -- : inout std_logic;
- B2B_B0_L32_P => tb_b2b_b0_l32_p, -- : inout std_logic;
- B2B_B0_L32_N => tb_b2b_b0_l32_n, -- : inout std_logic;
- B2B_B0_L7_N => tb_b2b_b0_l7_n, -- : inout std_logic;
- B2B_B0_L7_P => tb_b2b_b0_l7_p, -- : inout std_logic;
- B2B_B0_L33_N => tb_b2b_b0_l33_n, -- : inout std_logic;
- B2B_B0_L33_P => tb_b2b_b0_l33_p, -- : inout std_logic;
- B2B_B0_L36_P => tb_b2b_b0_l36_p, -- : inout std_logic;
- B2B_B0_L36_N => tb_b2b_b0_l36_n, -- : inout std_logic;
- B2B_B0_L49_P => tb_b2b_b0_l49_p, -- : inout std_logic;
- B2B_B0_L49_N => tb_b2b_b0_l49_n, -- : inout std_logic;
- B2B_B0_L62_P => tb_b2b_b0_l62_p, -- : inout std_logic;
- B2B_B0_L62_N => tb_b2b_b0_l62_n, -- : inout std_logic;
- B2B_B0_L66_P => tb_b2b_b0_l66_p, -- : inout std_logic;
- B2B_B0_L66_N => tb_b2b_b0_l66_n, -- : inout std_logic;
- B2B_B1_L10_P => tb_b2b_b1_l10_p, -- : inout std_logic;
- B2B_B1_L10_N => tb_b2b_b1_l10_n, -- : inout std_logic;
- B2B_B1_L9_P => tb_b2b_b1_l9_p, -- : inout std_logic;
- B2B_B1_L9_N => tb_b2b_b1_l9_n, -- : inout std_logic;
- B2B_B1_L21_N => tb_b2b_b1_l21_n, -- : inout std_logic;
- B2B_B1_L21_P => tb_b2b_b1_l21_p, -- : inout std_logic;
- B2B_B1_L61_P => tb_b2b_b1_l61_p, -- : inout std_logic;
- B2B_B1_L61_N => tb_b2b_b1_l61_n, -- : inout std_logic;
- --B2B_B0_L1 => -- : inout std_logic; -- used as reset_n
- B2B_B0_L2_P => tb_b2b_b0_l2_p, -- : inout std_logic;
- B2B_B0_L2_N => tb_b2b_b0_l2_n, -- : inout std_logic;
- B2B_B0_L4_N => tb_b2b_b0_l4_n, -- : inout std_logic;
- B2B_B0_L4_P => tb_b2b_b0_l4_p, -- : inout std_logic;
- B2B_B0_L5_N => tb_b2b_b0_l5_n, -- : inout std_logic;
- B2B_B0_L5_P => tb_b2b_b0_l5_p, -- : inout std_logic;
- B2B_B0_L6_N => tb_b2b_b0_l6_n, -- : inout std_logic;
- B2B_B0_L6_P => tb_b2b_b0_l6_p, -- : inout std_logic;
- B2B_B0_L8_N => tb_b2b_b0_l8_n, -- : inout std_logic;
- B2B_B0_L8_P => tb_b2b_b0_l8_p, -- : inout std_logic;
- B2B_B0_L34_N => tb_b2b_b0_l34_n, -- : inout std_logic;
- B2B_B0_L34_P => tb_b2b_b0_l34_p, -- : inout std_logic;
- B2B_B0_L35_N => tb_b2b_b0_l35_n, -- : inout std_logic;
- B2B_B0_L35_P => tb_b2b_b0_l35_p, -- : inout std_logic;
- B2B_B0_L37_N => tb_b2b_b0_l37_n, -- : inout std_logic;
- B2B_B0_L37_P => tb_b2b_b0_l37_p, -- : inout std_logic;
- B2B_B0_L38_N => tb_b2b_b0_l38_n, -- : inout std_logic;
- B2B_B0_L38_P => tb_b2b_b0_l38_p, -- : inout std_logic;
- B2B_B0_L50_N => tb_b2b_b0_l50_n, -- : inout std_logic;
- B2B_B0_L50_P => tb_b2b_b0_l50_p, -- : inout std_logic;
- B2B_B0_L51_N => tb_b2b_b0_l51_n, -- : inout std_logic;
- B2B_B0_L51_P => tb_b2b_b0_l51_p, -- : inout std_logic;
- B2B_B0_L63_N => tb_b2b_b0_l63_n, -- : inout std_logic;
- B2B_B0_L63_P => tb_b2b_b0_l63_p, -- : inout std_logic;
- B2B_B0_L64_N => tb_b2b_b0_l64_n, -- : inout std_logic;
- B2B_B0_L64_P => tb_b2b_b0_l64_p, -- : inout std_logic;
- B2B_B0_L65_N => tb_b2b_b0_l65_n, -- : inout std_logic;
- B2B_B0_L65_P => tb_b2b_b0_l65_p, -- : inout std_logic;
- B2B_B1_L20_P => tb_b2b_b1_l20_p, -- : inout std_logic;
- B2B_B1_L20_N => tb_b2b_b1_l20_n, -- : inout std_logic;
- B2B_B1_L19_P => tb_b2b_b1_l19_p, -- : inout std_logic;
- B2B_B1_L19_N => tb_b2b_b1_l19_n, -- : inout std_logic;
- B2B_B1_L59 => tb_b2b_b1_l59, -- : inout std_logic;
- --
- -- misc
- USER_LED_N => tb_user_led_n, -- : out std_logic;
- AV => tb_av, -- : in std_logic_vector(3 downto 0);
- BR => tb_br -- : in std_logic_vector(3 downto 0)
- );
-
- main: process
- begin
- wait until rising_edge( tb_simulation_break);
- simulation_run <= false;
- wait; -- forever
- end process;
-
-end architecture testbench;
-
diff --git a/mig_test/simulation/Makefile b/mig_test/simulation/Makefile
deleted file mode 100644
index b1a0b89..0000000
--- a/mig_test/simulation/Makefile
+++ /dev/null
@@ -1,67 +0,0 @@
-#
-# $HeadURL: https://svn.fzd.de/repo/concast/FWF_Projects/FWKE/beam_position_monitor/trunk/hardware/board_prototyp1/simulation/Makefile $
-# $Date$
-# $Author$
-# $Revision$
-#
-
-library = work
-top = top_tb
-
-software_dir = ../software
-
-
-# http://sourceforge.net/projects/vmk/
-VMK = vmk
-
-# generate list of used libs
-library_list = $(shell cut --field 1 --delimiter=" " --only-delimited ../vhdl_files.txt | grep --invert "\#" | sort --unique)
-#library_list += $(shell cut --field 1 --delimiter=" " --only-delimited ../verilog_files.txt | grep --invert "\#" | sort --unique)
-
-# list of verilog files
-#vlog_list = $(shell cut --field 3 --delimiter=" " --only-delimited ../verilog_files.txt | grep --invert "\#" | sort --unique)
-
-
-all: compile
-
-software:
- test ! -d $(software_dir) || make --directory $(software_dir) | ccze -A
-
-hw_timestamp:
- test ! -f ../rtl/Makefile || make --directory ../rtl
-
-compile: hw_timestamp Makefile.msim
- @# compile DDR3 memory model stuff
- #vlog -work nanya +define+x16 +define+sg15f +incdir++../rtl_tb $(vlog_list)
- @# normal vhdl compile
- export ANAFLAGS="-quiet -2008"; \
- make -f Makefile.msim | ccze -A
- @echo "Start the simulation with \"make simulate\" now."
-
-
-simulate:
- #mkdir -p data
- export top=$(top); \
- vsim -quiet -novopt -gui $(library).$(top) -do run.do -l transcript.log
-
-
-clean:
- @# modelsim stuff
- rm -f transcript.log
- rm -f bus_trace.txt
- rm -f *.wlf
- rm -f wlf*
- @# compile stuff
- -make -f Makefile.msim clean
- rm -rf $(library_list)
- rm -f Makefile.msim
- rm -f .stamp
-
-
-# generate Makefile.msim with vmk
-Makefile.msim: software ../vhdl_files.txt $(library_list)
- $(VMK) -t modelsim -O -w $(library) -F ../vhdl_files.txt
-
-$(library_list):
- vlib $@
-
diff --git a/mig_test/simulation/run.do b/mig_test/simulation/run.do
deleted file mode 100644
index bba55ac..0000000
--- a/mig_test/simulation/run.do
+++ /dev/null
@@ -1,65 +0,0 @@
-
-#
-# helper functions
-#
-
-# restart + run
-proc r {} {
- restart -f
- set sim_start [clock seconds]
-
- run -all
-
- puts "# simulation run time: [clock format [expr [clock seconds] - $sim_start] -gmt 1 -format %H:%M:%S] "
-}
-
-
-# restart with clear
-proc rc {} {
- .main clear
- r
-}
-
-# print varables
-proc my_debug {} {
- global env
- foreach key [array names env] {
- puts "$key=$env($key)"
- }
-}
-
-
-# fast exit
-proc e {} {
- exit -force
-}
-
-# fast exit
-proc x {} {
- exit -force
-}
-
-
-# get env variables
-global env
-quietly set top $env(top)
-
-
-if {[file exists wave.do]} {
- do wave.do
-} else {
- if {[file exists wave_$top.do]} {
- do wave_$top.do
- } else {
- puts "INFO: wave file (wave_$top.do) not found"
- }
- puts "INFO: no wave file (wave.do) found"
-}
-
-
-
-set sim_start [clock seconds]
-
-run -all
-
-puts "# simulation run time: [clock format [expr [clock seconds] - $sim_start] -gmt 1 -format %H:%M:%S] "
diff --git a/mig_test/simulation/wave.do b/mig_test/simulation/wave.do
deleted file mode 100644
index 607e5f3..0000000
--- a/mig_test/simulation/wave.do
+++ /dev/null
@@ -1,27 +0,0 @@
-onerror {resume}
-quietly WaveActivateNextPane {} 0
-add wave -noupdate /top_tb/simulation_run
-add wave -noupdate /top_tb/tb_clk
-add wave -noupdate /top_tb/tb_user_led_n
-add wave -noupdate -expand -group {carrier board LEDs} /top_tb/tb_b2b_b3_l59_n
-add wave -noupdate -expand -group {carrier board LEDs} /top_tb/tb_b2b_b3_l59_p
-add wave -noupdate -expand -group {carrier board LEDs} /top_tb/tb_b2b_b3_l9_p
-add wave -noupdate -expand -group {carrier board LEDs} /top_tb/tb_b2b_b3_l9_n
-TreeUpdate [SetDefaultTree]
-WaveRestoreCursors {{Cursor 1} {83164314 ps} 0}
-quietly wave cursor active 1
-configure wave -namecolwidth 150
-configure wave -valuecolwidth 100
-configure wave -justifyvalue left
-configure wave -signalnamewidth 1
-configure wave -snapdistance 10
-configure wave -datasetprefix 0
-configure wave -rowmargin 4
-configure wave -childrowmargin 2
-configure wave -gridoffset 0
-configure wave -gridperiod 1923
-configure wave -griddelta 32
-configure wave -timeline 1
-configure wave -timelineunits ns
-update
-WaveRestoreZoom {0 ps} {901530 ns}
diff --git a/mig_test/software/Makefile b/mig_test/software/Makefile
deleted file mode 100644
index 1246803..0000000
--- a/mig_test/software/Makefile
+++ /dev/null
@@ -1,89 +0,0 @@
-#
-# $HeadURL: https://svn.fzd.de/repo/concast/FWF_Projects/FWKE/hw_sp605/bsp_zpuahb/software/Makefile $
-# $Date$
-# $Author$
-# $Revision$
-#
-
-COMPILER_OPTIONS=-ffunction-sections -fdata-sections -Iinclude
-OBJCOPY_OPTIONS=--strip-debug --discard-locals
-
-ZPU_SUPPORT_DIR=../../zpu/support
-ZPU_ROM_GEN=$(ZPU_SUPPORT_DIR)/zpuromgen
-AHB_ROM_GEN=../../gaisler/support/ahbrom
-
-
-SVNPATH = ..
-SVNREV = $(shell svnversion -n $(SVNPATH))
-
-all: software
-
-help:
- @echo "software - build main software"
- @echo
- @echo "clean - clean up"
-
-
-startup = lib/crt0.S
-objs = lib/crt0.o
-lib_src = lib/premain.c lib/divmod.c lib/udivmodsi4.c
-#ldflags = -nostartfiles -nostdlib -nodefaultlibs $(objs) -Wl,--relax -Wl,--gc-sections -Wl,-lhal -Wl,-Llibhal
-ldflags = -nostartfiles $(objs) -Wl,--relax,--gc-sections,-lhal,-Llibhal
-
-
-zpu_rom_vhdl = ../rtl/dualport_ram.vhd
-ahb_rom_vhdl = ../rtl/ahbrom.vhd
-c_files += main.c
-c_files += timestamp.c
-c_files += monitor.c
-c_files += schedule.c
-c_files += ambainfo.c
-c_files += monitor_functions.c
-c_files += $(lib_src)
-h_files = *.h include/peripherie.h
-
-
-software: $(zpu_rom_vhdl) $(ahb_rom_vhdl)
-
-
-main.bin: $(c_files) $(h_files) $(objs)
- make --directory libhal
- @# normal compile command (emulate instructions)
- zpu-elf-gcc $(COMPILER_OPTIONS) -O3 -phi $(c_files) $(ldflags) -o main.elf
-
- zpu-elf-size main.elf
- print_mem_zpu.sh main.elf
- zpu-elf-objdump -D -S main.elf > main.lst
- zpu-elf-objcopy $(OBJCOPY_OPTIONS) -O binary main.elf main.bin
-
-$(zpu_rom_vhdl): main.bin $(ZPU_ROM_GEN)
- # concat parts
- cat > $(zpu_rom_vhdl) $(ZPU_SUPPORT_DIR)/dualport_ram.vhd_header
- $(ZPU_ROM_GEN) main.bin >> $(zpu_rom_vhdl)
- cat >> $(zpu_rom_vhdl) $(ZPU_SUPPORT_DIR)/dualport_ram.vhd_footer
-
-$(ahb_rom_vhdl): main.bin $(AHB_ROM_GEN)
- $(AHB_ROM_GEN) main.bin $(ahb_rom_vhdl)
-
-
-$(startup:.S=.o): $(startup)
- zpu-elf-gcc -c $< -o $@
-
-clean:
- rm -f *.bin
- rm -f *.elf
- rm -f *.lst
- rm -f *.o
- rm -f lib/*.o
-
-
-timestamp: timestamp.c
-timestamp.c:
- @echo "updating $@ ($(SVNREV))"
- @rm -f $@
- @echo "const char* sw_svn_revision = \"$(SVNREV)\"; " >> $@
-
-
-# disable implicit rule for c files
-.SUFFIXES:
-%.c: %.w %.ch
diff --git a/mig_test/software/ambainfo.c b/mig_test/software/ambainfo.c
deleted file mode 100644
index 83813b0..0000000
--- a/mig_test/software/ambainfo.c
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * $HeadURL: https://svn.fzd.de/repo/concast/FWF_Projects/FWKE/hw_sp605/bsp_zpuahb/software/ambainfo.c $
- * $Date$
- * $Author$
- * $Revision$
- */
-
-#include <types.h>
-
-
-/*
- print some spaces to make output alignment columnwise
-*/
-void fill(uint8_t length, uint8_t fillupto)
-{
- while (length < fillupto)
- {
- putchar(' ');
- length++;
- }
-}
-
-
-
-////////////////////////////////////////////////////////////
-// print vendor
-void print_vendor_device( uint8_t vendor, uint8_t device)
-{
- switch( vendor)
- {
- case 0x01: putstr("gaisler ");
- switch( device)
- {
- case 0x06: putstr("AHB/APB Bridge"); break;
- case 0x0c: putstr("Generic UART"); break;
- case 0x0f: putstr("Dual-port AHB SRAM module"); break;
- case 0x11: putstr("Modular Timer Unit"); break;
- case 0x1a: putstr("General Purpose I/O port"); break;
- case 0x1d: putstr("GR 10/100 Mbit Ethernet MAC"); break;
- case 0x28: putstr("AMBA Wrapper for OC I2C-master");break;
- case 0x45: putstr("SPI Memory Controller"); break;
- case 0x61: putstr("VGA controller"); break;
- case 0x87: putstr("General Purpose Register"); break;
- default : putstr("unknown device"); break;
- }
- break;
- case 0x04: putstr("ESA ");
- switch( device)
- {
- case 0x0f: putstr("Leon2 Memory Controller"); break;
- default : putstr("unknown device"); break;
- }
- break;
- case 0x55: putstr("HZDR ");
- switch( device)
- {
- case 0x01: putstr("ZPU AHB Wrapper"); break;
- case 0x02: putstr("ZPU Memory wrapper"); break;
- case 0x03: putstr("DCM phase shift control"); break;
- case 0x04: putstr("debug console"); break;
- case 0x05: putstr("trigger generator"); break;
- case 0x06: putstr("beam position monitor"); break;
- case 0x07: putstr("debug buffer control"); break;
- case 0x08: putstr("EA-DOGS display driver"); break;
- case 0x09: putstr("debug tracer memory"); break;
- case 0x0a: putstr("differential current monitor"); break;
- default : putstr("unknown device"); break;
- }
- break;
- default : putstr("vendor? "); break;
- }
-}
-
-////////////////////////////////////////////////////////////
-// apb info
-void apb_info( uint32_t* addr, uint8_t verbose)
-{
- // identification register
- uint16_t vendor;
- uint16_t device;
- uint16_t version;
- uint16_t irq;
- uint32_t dev_addr;
-
- uint32_t* config;
- uint32_t* idreg_addr;
- uint32_t idreg_word;
- uint32_t* bar_addr;
- uint32_t bar_word;
-
- uint32_t apb_addr;
- uint32_t apb_unit;
-
- config = addr;
- apb_addr = (*config & 0xfff00000); // get apb address
-
- // we can have up to 512 slaves, but we scan only 16
- // to avoid double scans at the moment
- for (apb_unit = 0; apb_unit < 16; apb_unit++)
- {
- idreg_addr = (uint32_t*) (apb_addr | 0x000ff000 | (apb_unit << 3));
- idreg_word = *idreg_addr;
- bar_addr = idreg_addr + 1;
- bar_word = *bar_addr;
-
- dev_addr = apb_addr | ((bar_word & 0xfff00000) >> 12);
- vendor = (idreg_word >> 24) & 0xff;
- device = (idreg_word >> 12) & 0xfff;
- version = (idreg_word >> 5) & 0xf;
- irq = (idreg_word >> 0) & 0x1f;
-
- if (vendor > 0)
- {
- putstr(" apbslv");
- fill( putint( apb_unit), 4);
-
- // print idreg word
- putstr("vend 0x"); fill( puthex( 8, vendor), 4);
- putstr("dev 0x"); fill( puthex(16, device), 6);
- putstr("ver "); fill( putint( version), 4);
- putstr("irq "); fill( putint( irq), 4);
- putstr("addr 0x"); fill( puthex(32, dev_addr), 10);
- if (verbose)
- print_vendor_device( vendor, device);
- putchar('\n');
- }
- }
-}
-
-void ahb_info( uint8_t verbose)
-{
- uint16_t vendor;
- uint16_t device;
- uint16_t version;
- uint16_t irq;
-
- uint32_t address;
- uint16_t cp;
- uint16_t mask;
- uint16_t type;
-
- uint32_t config_word;
- uint32_t bar;
- uint32_t ahb_unit;
-
- uint8_t i;
-
- uint32_t* config_addr = (uint32_t*) 0xfffff000;
- uint32_t* bar_addr = (uint32_t*) 0xfffff010;
-
-
- // check for 64 master and 64 slaves
- for (ahb_unit = 0; ahb_unit < 128; ahb_unit++)
- {
- config_addr = (uint32_t*) (0xfffff000 + (ahb_unit << 5));
- bar_addr = (uint32_t*) config_addr + 4;
-
- config_word = *config_addr;
-
- vendor = (config_word >> 24) & 0xff;
- device = (config_word >> 12) & 0xfff;
- version = (config_word >> 5) & 0xf;
- irq = (config_word >> 0) & 0x1f;
-
- if (vendor > 0)
- {
- if (ahb_unit < 64)
- {
- putstr("ahbmst");
- fill( putint( ahb_unit), 6);
- }
- else
- {
- putstr("ahbslv");
- fill( putint( ahb_unit - 64), 6);
- }
-
- // print config word
- putstr("vend 0x"); fill( puthex( 8, vendor), 4);
- putstr("dev 0x"); fill( puthex(16, device), 6);
- putstr("ver "); fill( putint( version), 4);
- putstr("irq "); fill( putint( irq), 4);
- putstr("addr 0x"); fill( puthex(32, *bar_addr & 0xfff00000), 10);
- if (verbose)
- print_vendor_device( vendor, device);
- putchar('\n');
-
- if ((vendor == 1) && (device == 6))
- apb_info( bar_addr, verbose);
-
- /*
- // check all 4 bank address registers
- for (i = 0; i < 4; i++)
- {
- bar = *bar_addr;
-
- address = bar & 0xfff0000;
- cp = (bar >> 16) & 0xf;
- mask = (bar >> 4) & 0xfff;
- type = (bar >> 0) & 0xf;
-
- // print bank address register
- putstr("address 0x"); fill( puthex( 32, address), 6);
- putstr("c/p 0x"); fill( puthex( 8, cp), 6);
- putstr("mask 0x"); fill( puthex( 16, mask), 6);
- putstr("type 0x"); fill( puthex( 8, type), 6);
- putchar('\n');
-
- bar_addr++;
- } // for i
- */
-
- } // vendor > 0
- } // for ahb_unit
-}
-
diff --git a/mig_test/software/ambainfo.h b/mig_test/software/ambainfo.h
deleted file mode 100644
index e9828f1..0000000
--- a/mig_test/software/ambainfo.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * $HeadURL: https://svn.fzd.de/repo/concast/FWF_Projects/FWKE/hw_sp605/bsp_zpuahb/software/ambainfo.h $
- * $Date$
- * $Author$
- * $Revision$
- */
-
-
-#ifndef AMBAINFO_H
-#define AMBAINFO_H
-
-void print_vendor_device( uint8_t vendor, uint8_t device);
-void apb_info( uint32_t* addr, uint8_t verbose);
-void ahb_info( uint8_t verbose);
-
-#endif // AMBAINFO_H
diff --git a/mig_test/software/include/common.h b/mig_test/software/include/common.h
deleted file mode 100644
index 9028a90..0000000
--- a/mig_test/software/include/common.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * $HeadURL: https://svn.fzd.de/repo/concast/FWF_Projects/FWKE/hw_sp605/bsp_zpuahb/software/include/common.h $
- * $Date$
- * $Author$
- * $Revision$
- */
-
-#ifndef COMMON_H
-#define COMMON_H
-
-////////////////////////////////////////
-// specific stuff
-
-char putchar ( char c);
-void putstr ( const char *s);
-void putbin ( unsigned char dataType, unsigned long data);
-unsigned char puthex ( unsigned char dataType, unsigned long data);
-unsigned char itoa ( int z, char* Buffer );
-unsigned char putint ( unsigned long data);
-unsigned char putuint ( long data);
-void putpfloat( unsigned long data);
-
-#endif // COMMON_H
diff --git a/mig_test/software/include/lcd-routines.h b/mig_test/software/include/lcd-routines.h
deleted file mode 100644
index e3516cf..0000000
--- a/mig_test/software/include/lcd-routines.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * $HeadURL: https://svn.fzd.de/repo/concast/FWF_Projects/FWKE/hw_sp605/bsp_zpuahb/software/include/lcd-routines.h $
- * $Date$
- * $Author$
- * $Revision$
- */
-
-
-// Ansteuerung eines HD44780 kompatiblen LCD im 4-Bit-Interfacemodus
-// http://www.mikrocontroller.net/articles/AVR-GCC-Tutorial/LCD-Ansteuerung
-//
-
-#ifndef LCD_ROUTINES_H
-#define LCD_ROUTINES_H
-
-#include "peripherie.h"
-
-////////////////////////////////////////////////////////////////////////////////
-// Hier die verwendete Taktfrequenz in Hz eintragen, wichtig!
-
-#ifndef F_CPU
-#define F_CPU 50000000
-#endif
-
-////////////////////////////////////////////////////////////////////////////////
-// Pinbelegung für das LCD, an verwendete Pins anpassen
-// Alle LCD Pins müssen an einem Port angeschlossen sein und die 4
-// Datenleitungen müssen auf aufeinanderfolgenden Pins liegen
-
-// LCD DB4-DB7 <--> PORTD Bit PD0-PD3
-#define LCD_PORT (gpio0->ioout)
-#define LCD_DDR (gpio0->iodir)
-#define LCD_DB (8)
-
-// LCD RS <--> PORTD Bit PD4 (RS: 0=Data, 1=Command)
-#define LCD_RS (14)
-
-// LCD EN <--> PORTD Bit PD5 (EN: 1-Impuls für Daten)
-#define LCD_EN (13)
-
-#define LCD_RW (15)
-
-////////////////////////////////////////////////////////////////////////////////
-// LCD Ausführungszeiten (MS=Millisekunden, US=Mikrosekunden)
-
-#define LCD_BOOTUP_MS 15
-#define LCD_ENABLE_US 1
-#define LCD_WRITEDATA_US 46
-#define LCD_COMMAND_US 42
-
-#define LCD_SOFT_RESET_MS1 5
-#define LCD_SOFT_RESET_MS2 1
-#define LCD_SOFT_RESET_MS3 1
-#define LCD_SET_4BITMODE_MS 5
-
-#define LCD_CLEAR_DISPLAY_MS 2
-#define LCD_CURSOR_HOME_MS 2
-
-////////////////////////////////////////////////////////////////////////////////
-// Zeilendefinitionen des verwendeten LCD
-// Die Einträge hier sollten für ein LCD mit einer Zeilenlänge von 16 Zeichen passen
-// Bei anderen Zeilenlängen müssen diese Einträge angepasst werden
-
-#define LCD_DDADR_LINE1 0x00
-#define LCD_DDADR_LINE2 0x40
-#define LCD_DDADR_LINE3 0x10
-#define LCD_DDADR_LINE4 0x50
-
-////////////////////////////////////////////////////////////////////////////////
-// Initialisierung: muss ganz am Anfang des Programms aufgerufen werden.
-void lcd_init( void );
-
-////////////////////////////////////////////////////////////////////////////////
-// LCD löschen
-void lcd_clear( void );
-
-////////////////////////////////////////////////////////////////////////////////
-// Cursor in die 1. Zeile, 0-te Spalte
-void lcd_home( void );
-
-////////////////////////////////////////////////////////////////////////////////
-// Cursor an eine beliebige Position
-void lcd_setcursor( uint8_t spalte, uint8_t zeile );
-
-////////////////////////////////////////////////////////////////////////////////
-// Ausgabe eines einzelnen Zeichens an der aktuellen Cursorposition
-void lcd_data( uint8_t data );
-
-////////////////////////////////////////////////////////////////////////////////
-// Ausgabe eines Strings an der aktuellen Cursorposition
-void lcd_string( const char *data );
-
-////////////////////////////////////////////////////////////////////////////////
-// Definition eines benutzerdefinierten Sonderzeichens.
-// data muss auf ein Array[5] mit den Spaltencodes des zu definierenden Zeichens
-// zeigen
-void lcd_generatechar( uint8_t code, const uint8_t *data );
-
-////////////////////////////////////////////////////////////////////////////////
-// Ausgabe eines Kommandos an das LCD.
-void lcd_command( uint8_t data );
-
-
-////////////////////////////////////////////////////////////////////////////////
-// LCD Befehle und Argumente.
-// Zur Verwendung in lcd_command
-
-// Clear Display -------------- 0b00000001
-#define LCD_CLEAR_DISPLAY 0x01
-
-// Cursor Home ---------------- 0b0000001x
-#define LCD_CURSOR_HOME 0x02
-
-// Set Entry Mode ------------- 0b000001xx
-#define LCD_SET_ENTRY 0x04
-
-#define LCD_ENTRY_DECREASE 0x00
-#define LCD_ENTRY_INCREASE 0x02
-#define LCD_ENTRY_NOSHIFT 0x00
-#define LCD_ENTRY_SHIFT 0x01
-
-// Set Display ---------------- 0b00001xxx
-#define LCD_SET_DISPLAY 0x08
-
-#define LCD_DISPLAY_OFF 0x00
-#define LCD_DISPLAY_ON 0x04
-#define LCD_CURSOR_OFF 0x00
-#define LCD_CURSOR_ON 0x02
-#define LCD_BLINKING_OFF 0x00
-#define LCD_BLINKING_ON 0x01
-
-// Set Shift ------------------ 0b0001xxxx
-#define LCD_SET_SHIFT 0x10
-
-#define LCD_CURSOR_MOVE 0x00
-#define LCD_DISPLAY_SHIFT 0x08
-#define LCD_SHIFT_LEFT 0x00
-#define LCD_SHIFT_RIGHT 0x04
-
-// Set Function --------------- 0b001xxxxx
-#define LCD_SET_FUNCTION 0x20
-
-#define LCD_FUNCTION_4BIT 0x00
-#define LCD_FUNCTION_8BIT 0x10
-#define LCD_FUNCTION_1LINE 0x00
-#define LCD_FUNCTION_2LINE 0x08
-#define LCD_FUNCTION_5X7 0x00
-#define LCD_FUNCTION_5X10 0x04
-
-#define LCD_SOFT_RESET 0x30
-
-// Set CG RAM Address --------- 0b01xxxxxx (Character Generator RAM)
-#define LCD_SET_CGADR 0x40
-
-#define LCD_GC_CHAR0 0
-#define LCD_GC_CHAR1 1
-#define LCD_GC_CHAR2 2
-#define LCD_GC_CHAR3 3
-#define LCD_GC_CHAR4 4
-#define LCD_GC_CHAR5 5
-#define LCD_GC_CHAR6 6
-#define LCD_GC_CHAR7 7
-
-// Set DD RAM Address --------- 0b1xxxxxxx (Display Data RAM)
-#define LCD_SET_DDADR 0x80
-
-#endif
diff --git a/mig_test/software/include/peripherie.h b/mig_test/software/include/peripherie.h
deleted file mode 100644
index 9734d4c..0000000
--- a/mig_test/software/include/peripherie.h
+++ /dev/null
@@ -1,323 +0,0 @@
-/*
- * $HeadURL: https://svn.fzd.de/repo/concast/FWF_Projects/FWKE/hw_sp605/bsp_zpuahb/software/include/peripherie.h $
- * $Date$
- * $Author$
- * $Revision$
- */
-
-
-#ifndef PERIPHERIE_H
-#define PERIPHERIE_H
-
-#include <types.h>
-
-////////////////////
-// hardware types
-
-// gpio
-typedef struct {
- volatile uint32_t iodata; // 000
- volatile uint32_t ioout; // 001
- volatile uint32_t iodir; // 010, for bidir port bits
- volatile uint32_t irqmask; // 011
- volatile uint32_t irqpol; // 100
- volatile uint32_t irqedge; // 101
- volatile uint32_t bypass; // 110
-} grgpio_t;
-
-
-// uart
-#define UART_STATUS_DATA_READY (1<< 0)
-#define UART_STATUS_TX_SHREG_EMPTY (1<< 1)
-#define UART_STATUS_TX_REG_EMPTY (1<< 2)
-#define UART_STATUS_BREAK_RECEIVED (1<< 3)
-#define UART_STATUS_OVERRUN (1<< 4)
-#define UART_STATUS_PARITY_ERROR (1<< 5)
-#define UART_STATUS_FRAMING_ERROR (1<< 6)
-#define UART_STATUS_TX_FIFO_HALF_FULL (1<< 7)
-#define UART_STATUS_RX_FIFO_HALF_FULL (1<< 8)
-#define UART_STATUS_TX_FIFO_FULL (1<< 9)
-#define UART_STATUS_RX_FIFO_FULL (1<<10)
-
-#define UART_CONTROL_RX_ENABLE (1<< 0)
-#define UART_CONTROL_TX_ENABLE (1<< 1)
-#define UART_CONTROL_RX_INT_ENABLE (1<< 2)
-#define UART_CONTROL_TX_INT_ENABLE (1<< 3)
-#define UART_CONTROL_PARITY_SELECT (1<< 4)
-#define UART_CONTROL_PARITY_ENABLE (1<< 5)
-#define UART_CONTROL_FLOW_CONTROL (1<< 6)
-#define UART_CONTROL_LOOP_BACK (1<< 7)
-#define UART_CONTROL_EXTERNAL_CLOCK (1<< 8)
-#define UART_CONTROL_TX_FIFO_INT_ENABLE (1<< 9)
-#define UART_CONTROL_RX_FIFO_INT_ENABLE (1<<10)
-#define UART_CONTROL_FIFO_DEBUG_MODE (1<<11)
-#define UART_CONTROL_BREAK_INT_ENABLE (1<<12)
-#define UART_CONTROL_DELAYED_INT_ENABLE (1<<13)
-#define UART_CONTROL_TX_REG_EMPTY_INT_ENABLE (1<<14)
-#define UART_CONTROL_FIFO_AVAILIBLE (1<<31)
-
-typedef struct {
- volatile uint32_t data; // 000000
- volatile uint32_t status; // 000001
- volatile uint32_t ctrl; // 000010
- volatile uint32_t scaler; // 000011
- volatile uint32_t fifo_debug; // 000100
-} apbuart_t;
-
-
-// timer (grip.pdf p. 279)
-#define TIMER_ENABLE (1<<0)
-#define TIMER_RESTART (1<<1)
-#define TIMER_LOAD (1<<2)
-#define TIMER_INT_ENABLE (1<<3)
-#define TIMER_INT_PENDING (1<<4)
-#define TIMER_CHAIN (1<<5)
-#define TIMER_DEBUG_HALT (1<<6)
-typedef struct {
- volatile uint32_t value;
- volatile uint32_t reload;
- volatile uint32_t ctrl;
- volatile uint32_t unused;
-} gptimer_element_t;
-
-#define TIMER_CONFIG_DISABLE_FREEZE (1<<8)
-typedef struct {
- volatile uint32_t scaler; // 00000
- volatile uint32_t scaler_reload; // 00001
- volatile uint32_t config; // 00010 ntimers, pirq
- volatile uint32_t unused; // 00011
- gptimer_element_t e[8];
-} gptimer_t;
-
-#define CLOCKS_PER_SECOND (1000)
-void usleep( uint32_t nsec);
-void msleep( uint32_t msec);
-void sleep( uint32_t sec);
-void timer_init( void);
-
-
-// i2c
-// control register
-#define I2C_CORE_ENABLE (1<<7)
-#define I2C_INT_ENABLE (1<<6)
-// command register
-#define I2C_START (1<<7)
-#define I2C_STOP (1<<6)
-#define I2C_READ (1<<5)
-#define I2C_WRITE (1<<4)
-#define I2C_ACK (1<<3)
-#define I2C_INT_ACK (1<<0)
-// status register
-#define I2C_RX_ACK (1<<7)
-#define I2C_BUSY (1<<6)
-#define I2C_ARB_LOST (1<<5)
-#define I2C_TIP (1<<1)
-#define I2C_INT (1<<0)
-
-typedef struct {
- volatile uint32_t clock_prescaler; // prer 0x00
- volatile uint32_t control; // ctr 0x04
- volatile uint32_t data; // xr 0x08 write -> transmit, read -> receive
- volatile uint32_t command; // csr 0x0c write -> command, read -> status
-} i2cmst_t; // i2cmstregs
-
-
-// vga
-typedef struct {
- volatile uint32_t data;
- volatile uint32_t background_color;
- volatile uint32_t foreground_color;
-} apbvga_t;
-
-
-// ethernet
-#define ETHER_DESCRIPTOR_ENABLE (1<<11)
-#define ETHER_DESCRIPTOR_WRAP (1<<12)
-#define ETHER_DESCRIPTOR_INT_ENABLE (1<<13)
-#define ETHER_DESCRIPTOR_UNDERRUN_ERR (1<<14)
-#define ETHER_DESCRIPTOR_ATTEMEPT_LIMIT_ERR (1<<15)
-typedef struct {
- volatile uint32_t control;
- volatile uint32_t address;
-} greth_tx_descriptor_t;
-
-#define ETHER_CONTROL_TX_ENABLE (1<< 0)
-#define ETHER_CONTROL_RX_ENABLE (1<< 1)
-#define ETHER_CONTROL_TX_INT (1<< 2)
-#define ETHER_CONTROL_RX_INT (1<< 3)
-#define ETHER_CONTROL_FULL_DUPLEX (1<< 4)
-#define ETHER_CONTROL_PROMISCUOUS_MODE (1<< 5)
-#define ETHER_CONTROL_RESET (1<< 6)
-#define ETHER_CONTROL_SPEED (1<< 7)
-#define ETHER_CONTROL_EDCL_AVAILABLE (1<<31)
-
-#define ETHER_STATUS_RX_ERROR (1<< 0)
-#define ETHER_STATUS_TX_ERROR (1<< 1)
-#define ETHER_STATUS_RX_INT (1<< 2)
-#define ETHER_STATUS_TX_INT (1<< 3)
-#define ETHER_STATUS_RX_AHB_ERROR (1<< 4)
-#define ETHER_STATUS_TX_AHB_ERROR (1<< 5)
-#define ETHER_STATUS_RX_TOO_SMALL (1<< 6)
-#define ETHER_STATUS_INVALID_ADDRESS (1<< 7)
-
-#define ETHER_MDIO_WR (1<< 0)
-#define ETHER_MDIO_RD (1<< 1)
-#define ETHER_MDIO_LINKFAIL (1<< 2)
-#define ETHER_MDIO_BUSY (1<< 3)
-#define ETHER_MDIO_NOT_VALID (1<< 4)
-
-typedef struct {
- volatile uint32_t control; // 0x00
- volatile uint32_t status; // 0x04
- volatile uint32_t mac_msb; // 0x08
- volatile uint32_t mac_lsb; // 0x0C
- volatile uint32_t mdio_control; // 0x10
- volatile uint32_t tx_pointer; // 0x14
- volatile uint32_t rx_pointer; // 0x18
- volatile uint32_t edcl_ip; // 0x1C
- volatile uint32_t hash_msb; // 0x20
- volatile uint32_t hash_lsb; // 0x24
-} greth_t;
-
-
-struct udp_header_st {
- uint16_t source_port;
- uint16_t dest_port;
- uint16_t length;
- uint16_t checksum;
- uint8_t data[1500];//[data_length];
-} __attribute((packed));
-
-typedef struct udp_header_st udp_header_t;
-
-
-//uint32_t data_length = 64; // minimum size is 46 (w/o vlan tag) or 42 (with vlan tag)
-
-#define PROTOCOL_UDP (17)
-#define FLAG_DF (1<<14)
-#define FLAG_MF (1<<15)
-struct ip_header_st {
- uint8_t version; // +ihl (ip header length)
- uint8_t tos;
- uint16_t length;
- uint16_t identification;
- uint16_t fragment_offset; // +flags
- uint8_t ttl;
- uint8_t protocol_id; // udp = 17, tcp = 6
- uint16_t checksum;
- uint32_t source_ip;
- uint32_t dest_ip;
- udp_header_t udp_header;
-} __attribute((packed));
-
-typedef struct ip_header_st ip_header_t;
-
-#define ETHERTYPE_IPv4 (0x0800)
-#define ETHERTYPE_ARP (0x0806)
-struct mac_header_st {
- uint8_t dest_mac[6];
- uint8_t source_mac[6];
- uint16_t ethertype; // length or eg. 0x800 IPv4, 0x0806 ARP, 0x8892 Profinet, 0x88a4 etherCat
- ip_header_t ip_header;
-} __attribute((packed));
-typedef struct mac_header_st mac_header_t;
-
-
-// ddr control register set
-typedef struct {
- volatile uint32_t sdram_control;
- volatile uint32_t sdram_config;
- volatile uint32_t sdram_power_saving;
- volatile uint32_t reserved;
- volatile uint32_t status_read;
- volatile uint32_t phy_config_0;
- volatile uint32_t phy_config_1;
-} ddrspa_t;
-
-
-// dcm control
-typedef struct {
- volatile uint32_t psstatus;
- volatile int32_t psdec;
- volatile int32_t psinc;
- volatile int32_t psvalue;
-} dcm_ctrl_t;
-
-
-// debug console (for simulation)
-char debug_putchar( char c);
-
-// function pointer for putchar
-extern char (* stdout) ( char);
-
-
-// iqr
-typedef struct {
- volatile uint32_t irq_level; // 0x00
- volatile uint32_t irq_pending; // 0x04
- volatile uint32_t irq_force; // 0x08
- volatile uint32_t irq_clear; // 0x0c
- volatile uint32_t mp_status; // 0x10
- volatile uint32_t broadcast; // 0x14 (NCPU > 1)
- volatile uint32_t dummy[10]; // 0x18 - 0x3c
- volatile uint32_t irq_mask; // 0x40
- // open: interrupt force, extended interrupt acknowledge
-} irqmp_t;
-
-
-// mctrl
-typedef struct {
- volatile uint32_t mcfg1; // 0x00
- volatile uint32_t mcfg2; // 0x04
- volatile uint32_t mcfg3; // 0x08
- volatile uint32_t mcfg4; // 0x0c
-} mctrl_t;
-
-
-////////////////////
-// hardware units
-
-// ZPU frequency
-#define F_CPU (125000000)
-
-// set min prescaler to ntimers+1
-#define TIMER_PRESCALER (8)
-
-// scaler for uart
-#define UART_BAUD_RATE (115200)
-//#define UART_BAUD_RATE (9600)
-#define UART_SCALER (F_CPU/(8 * UART_BAUD_RATE))
-#define UART_FIFOSIZE (16)
-
-// scaler for i2c
-#define I2C_PRESCALER_100K (F_CPU/(5 * 100000)-1)
-#define I2C_PRESCALER_400K (F_CPU/(5 * 400000)-1)
-
-
-extern apbuart_t *uart0;
-extern gptimer_t *timer0;
-extern irqmp_t *irqmp0;
-extern apbvga_t *vga0;
-extern grgpio_t *gpio0;
-extern greth_t *ether0;
-extern mctrl_t *mctrl0;
-volatile extern uint32_t *debug_con0;
-volatile extern uint32_t *reset_reg;
-extern ddrspa_t *ddr0;
-
-extern i2cmst_t *i2c_dvi;
-extern i2cmst_t *i2c_fmc;
-
-//char *debug_con0 = (char *) 0x80000000;
-//uint32_t *reset_reg = (uint32_t *) 0x80000004;
-//apbuart_t *uart0 = (apbuart_t *) 0x80000100;
-//gptimer_t *timer0 = (gptimer_t *) 0x80000200;
-//grgpio_t *gpio0 = (grgpio_t *) 0x80000400;
-//apbvga_t *vga0 = (apbvga_t *) 0x80000600;
-//i2cmst_t *i2cmst0 = (i2cmst_t *) 0x80000700;
-
-//greth_t *ether0 = (greth_t *) 0x80000c00;
-//dcm_ctrl_t *dcm_ctrl0 = (dcm_ctrl_t *) 0x80000e00;
-//ddrspa_t *ddr0 = (ddrspa_t *) 0xfff00000;
-
-#endif // PERIPHERIE_H
diff --git a/mig_test/software/include/timer.h b/mig_test/software/include/timer.h
deleted file mode 100644
index fa4875f..0000000
--- a/mig_test/software/include/timer.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * $HeadURL: https://svn.fzd.de/repo/concast/FWF_Projects/FWKE/hw_sp605/bsp_zpuahb/software/include/timer.h $
- * $Date$
- * $Author$
- * $Revision$
- */
-
-
-#include "peripherie.h"
-
-#ifndef TIMER_H
-#define TIMER_H
-
-
-////////////////////////////////////////
-// timer functions
-
-
-// wait for a given time in micro seconds
-void usleep(uint32_t usec);
-
-// wait for given time in milli seconds
-void msleep(uint32_t msec);
-
-
-// wait for given time in seconds
-void sleep(uint32_t sec);
-
-
-// deliver the milli seconds from timer 0.1
-uint32_t msecs( void);
-
-// deliver the seconds from timer 0.2
-uint32_t seconds( void);
-
-// deliver the time (in seconds and fraction) from timer
-uint32_t get_time( void);
-
-// just a loop
-void wait( uint32_t value);
-
-
-// initialisation for the timer
-void timer_init( void);
-
-#define TIMER_STOP timer0->e[1].ctrl &= ~TIMER_ENABLE;
-#define TIMER_RUN timer0->e[1].ctrl |= TIMER_ENABLE;
-
-#endif // TIMER_H
diff --git a/mig_test/software/include/types.h b/mig_test/software/include/types.h
deleted file mode 100644
index d8e6862..0000000
--- a/mig_test/software/include/types.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * $HeadURL: https://svn.fzd.de/repo/concast/FWF_Projects/FWKE/hw_sp605/bsp_zpuahb/software/include/types.h $
- * $Date$
- * $Author$
- * $Revision$
- */
-
-
-#ifndef TYPES_H
-#define TYPES_H
-
-////////////////////
-// common types
-
-typedef signed char int8_t;
-typedef unsigned char uint8_t;
-
-typedef short int16_t;
-typedef unsigned short uint16_t;
-
-typedef long int32_t;
-typedef unsigned long uint32_t;
-
-typedef long long int64_t;
-typedef unsigned long long uint64_t;
-
-#define TRUE (1==1)
-#define FALSE (1==0)
-
-
-////////////////////////////////////////
-// common defines
-
-#define set_bit(mem, bv) ((mem) |= bv)
-#define clear_bit(mem, bv) ((mem) &= ~bv)
-#define toggle_bit(mem, bv) ((mem) ^= bv)
-#define bit_is_set(mem, bv) (mem & bv)
-#define bit_is_clear(mem, bv) (!(mem & bv))
-#define loop_until_bit_is_set(mem, bv) do {} while( bit_is_clear(mem, bv))
-#define loop_until_bit_is_clear(mem, bv) do {} while( bit_is_set(mem, bv))
-
-
-#endif // TYPES_H
diff --git a/mig_test/software/include/uart.h b/mig_test/software/include/uart.h
deleted file mode 100644
index ca040e4..0000000
--- a/mig_test/software/include/uart.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * $HeadURL: https://svn.fzd.de/repo/concast/FWF_Projects/FWKE/hw_sp605/bsp_zpuahb/software/include/uart.h $
- * $Date$
- * $Author$
- * $Revision$
- */
-
-
-#ifndef UART_H
-#define UART_H
-
-
-////////////////////////////////////////
-// uart functions
-
-#define UART_HW_HANDSHAKE_ON (uart0-> ctrl |= UART_CONTROL_FLOW_CONTROL)
-#define UART_HW_HANDSHAKE_OFF (uart0-> ctrl &= ~UART_CONTROL_FLOW_CONTROL)
-
-void uart_init( void);
-unsigned int uart_check_receiver();
-char uart_getchar();
-void uart_putchar_raw( char c);
-char uart_putchar( char c);
-
-#endif // UART_H
diff --git a/mig_test/software/include/vga.h b/mig_test/software/include/vga.h
deleted file mode 100644
index f4d3914..0000000
--- a/mig_test/software/include/vga.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * $HeadURL: https://svn.fzd.de/repo/concast/FWF_Projects/FWKE/hw_sp605/bsp_zpuahb/software/include/vga.h $
- * $Date$
- * $Author$
- * $Revision$
- */
-
-
-#include "peripherie.h"
-
-
-extern uint8_t vga_line;
-extern uint8_t vga_column;
-
-void vga_init( void);
-void vga_clear( void);
-void vga_putchar( char c);
-
diff --git a/mig_test/software/lib/crt0.S b/mig_test/software/lib/crt0.S
deleted file mode 100644
index 9c9e199..0000000
--- a/mig_test/software/lib/crt0.S
+++ /dev/null
@@ -1,973 +0,0 @@
-/* Startup code for ZPU
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 2, or (at your option) any
-later version.
-
-In addition to the permissions in the GNU General Public License, the
-Free Software Foundation gives you unlimited permission to link the
-compiled version of this file with other programs, and to distribute
-those programs without any restriction coming from the use of this
-file. (The General Public License restrictions do apply in other
-respects; for example, they cover modification of the file, and
-distribution when not linked into another program.)
-
-This file is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
- .file "crt0.S"
-
-
-; cleaned BLa
-
-
-; .section ".fixed_vectors","ax"
-; KLUDGE!!! we remove the executable bit to avoid relaxation
- .section ".fixed_vectors","a"
-
-; DANGER!!!!
-; we need to align these code sections to 32 bytes, which
-; means we must not use any assembler instructions that are relaxed
-; at linker time
-; DANGER!!!!
-
- .macro fixedim value
- im \value
- .endm
-
- .macro jsr address
- im _memreg ; save R0
- load
- im _memreg+4 ; save R1
- load
- im _memreg+8 ; save R2
- load
- fixedim \address
- call
- im _memreg+8
- store ; restore R2
- im _memreg+4
- store ; restore R1
- im _memreg
- store ; restore R0
- .endm
-
-
- .macro jmp address
- fixedim \address
- poppc
- .endm
-
-
- .macro fast_neg
- not
- im 1
- add
- .endm
-
- .macro cimpl funcname
- ; save R0
- im _memreg
- load
-
- ; save R1
- im _memreg+4
- load
-
- ; save R2
- im _memreg+8
- load
-
- loadsp 20
- loadsp 20
-
- fixedim \funcname
- call
-
- ; destroy arguments on stack
- storesp 0
- storesp 0
-
- im _memreg
- load
-
- ; poke the result into the right slot
- storesp 24
-
- ; restore R2
- im _memreg+8
- store
-
- ; restore R1
- im _memreg+4
- store
-
- ; restore r0
- im _memreg
- store
-
-
- storesp 4
- poppc
- .endm
-
- .macro mult1bit
- ; create mask of lowest bit in A
- loadsp 8 ; A
- im 1
- and
- im -1
- add
- not
- loadsp 8 ; B
- and
- add ; accumulate in C
-
- ; shift B left 1 bit
- loadsp 4 ; B
- addsp 0
- storesp 8 ; B
-
- ; shift A right 1 bit
- loadsp 8 ; A
- flip
- addsp 0
- flip
- storesp 12 ; A
- .endm
-
-
-
-/* vectors */
- .balign 32,0
-# offset 0x0000 0000
- .globl _start
-_start:
- ; intSp must be 0 when we jump to _premain; aha BLa
-
- ;im ZPU_ID
- ;loadsp 0
- ;im _cpu_config
- ;store
- ;config
- jmp _premain
-
-
- .balign 32,0
-# offset 0x0000 0020
- .globl _zpu_interrupt_vector
-_zpu_interrupt_vector:
- jmp ___zpu_interrupt_vector
-
-# memreg moved Bla
-# offset 0x0000 0030
- .balign 16,0
- .globl _memreg
- .weak _memreg
-_memreg:
-
-
-
-/* instruction emulation code */
-
-# opcode 34
-# offset 0x0000 0040
- .balign 32,0
-_loadh:
- loadsp 4
- ; by not masking out bit 0, we cause a memory access error
- ; on unaligned access
- im ~0x2
- and
- load
-
- ; mult 8
- loadsp 8
- im 3
- and
- fast_neg
- im 2
- add
- im 3
- ashiftleft
- ; shift right addr&3 * 8
- lshiftright
- im 0xffff
- and
- storesp 8
-
- poppc
-
-# opcode 35
-# offset 0x0000 0060
- .balign 32,0
-_storeh:
- loadsp 4
- ; by not masking out bit 0, we cause a memory access error
- ; on unaligned access
- im ~0x2
- and
- load
-
- ; mask
- im 0xffff
- loadsp 12
- im 3
- and
- fast_neg
- im 2
- add
- im 3
- ashiftleft
- ashiftleft
- not
-
- and
-
- loadsp 12
- im 0xffff
-
- nop
-
- fixedim _storehtail
- poppc
-
-
-# opcode 36
-# offset 0x0000 0080
- .balign 32,0
-_lessthan:
- loadsp 8
- fast_neg
- loadsp 8
- add
-
- ; DANGER!!!!
- ; 0x80000000 will overflow when negated, so we need to mask
- ; the result above with the compare positive to negative
- ; number case
- loadsp 12
- loadsp 12
- not
- and
- not
- and
-
-
- ; handle case where we are comparing a negative number
- ; and positve number. This can underflow. E.g. consider 0x8000000 < 0x1000
- loadsp 12
- not
- loadsp 12
- and
-
- or
-
-
-
- flip
- im 1
- and
-
-
- storesp 12
- storesp 4
- poppc
-
-
-# opcode 37
-# offset 0x0000 00a0
- .balign 32,0
-_lessthanorequal:
- loadsp 8
- loadsp 8
- lessthan
- loadsp 12
- loadsp 12
- eq
- or
-
- storesp 12
- storesp 4
- poppc
-
-
-# opcode 38
-# offset 0x0000 00c0
- .balign 32,0
-_ulessthan:
- ; fish up arguments
- loadsp 4
- loadsp 12
-
- /* low: -1 if low bit dif is negative 0 otherwise: neg (not x&1 and (y&1))
- x&1 y&1 neg (not x&1 and (y&1))
- 1 1 0
- 1 0 0
- 0 1 -1
- 0 0 0
-
- */
- loadsp 4
- not
- loadsp 4
- and
- im 1
- and
- neg
-
-
- /* high: upper 31-bit diff is only wrong when diff is 0 and low=-1
- high=x>>1 - y>>1 + low
-
- extremes
-
- 0000 - 1111:
- low= neg(not 0 and 1) = 1111 (-1)
- high=000+ neg(111) +low = 000 + 1001 + low = 1000
- OK
-
- 1111 - 0000
- low=neg(not 1 and 0) = 0
- high=111+neg(000) + low = 0111
- OK
-
-
- */
- loadsp 8
-
- flip
- addsp 0
- flip
-
- loadsp 8
-
- flip
- addsp 0
- flip
-
- sub
-
- ; if they are equal, then the last bit decides...
- add
-
- /* test if negative: result = flip(diff) & 1 */
- flip
- im 1
- and
-
- ; destroy a&b which are on stack
- storesp 4
- storesp 4
-
- storesp 12
- storesp 4
- poppc
-
-# opcode 39
-# offset 0x0000 00e0
- .balign 32,0
-_ulessthanorequal:
- loadsp 8
- loadsp 8
- ulessthan
- loadsp 12
- loadsp 12
- eq
- or
-
- storesp 12
- storesp 4
- poppc
-
-
-# opcode 40
-# offset 0x0000 0100
- .balign 32,0
- .globl _swap
-_swap:
- breakpoint ; tbd
-
-# opcode 41
-# offset 0x0000 0120
- .balign 32,0
-_slowmult:
- im _slowmultImpl
- poppc
-
-# opcode 42
-# offset 0x0000 0140
- .balign 32,0
-_lshiftright:
- loadsp 8
- flip
-
- loadsp 8
- ashiftleft
- flip
-
- storesp 12
- storesp 4
-
- poppc
-
-
-# opcode 43
-# offset 0x0000 0160
- .balign 32,0
-_ashiftleft:
- loadsp 8
-
- loadsp 8
- im 0x1f
- and
- fast_neg
- im _ashiftleftEnd
- add
- poppc
-
-
-
-# opcode 44
-# offset 0x0000 0180
- .balign 32,0
-_ashiftright:
- loadsp 8
- loadsp 8
- lshiftright
-
- ; handle signed value
- im -1
- loadsp 12
- im 0x1f
- and
- lshiftright
- not ; now we have an integer on the stack with the signed
- ; bits in the right position
-
- ; mask these bits with the signed bit.
- loadsp 16
- not
- flip
- im 1
- and
- im -1
- add
-
- and
-
- ; stuff in the signed bits...
- or
-
- ; store result into correct stack slot
- storesp 12
-
- ; move up return value
- storesp 4
- poppc
-
-# opcode 45
-# offset 0x0000 01a0
- .balign 32,0
-_call:
- ; fn
- loadsp 4
-
- ; return address
- loadsp 4
-
- ; store return address
- storesp 12
-
- ; fn to call
- storesp 4
-
- pushsp ; flush internal stack
- popsp
-
- poppc
-
-_storehtail:
-
- and
- loadsp 12
- im 3
- and
- fast_neg
- im 2
- add
- im 3
- ashiftleft
- nop
- ashiftleft
-
- or
-
- loadsp 8
- im ~0x3
- and
-
- store
-
- storesp 4
- storesp 4
- poppc
-
-
-# opcode 46
-# offset 0x0000 01c0
- .balign 32,0
-_eq:
- loadsp 8
- fast_neg
- loadsp 8
- add
-
- not
- loadsp 0
- im 1
- add
- not
- and
- flip
- im 1
- and
-
- storesp 12
- storesp 4
- poppc
-
-# opcode 47
-# offset 0x0000 01e0
- .balign 32,0
-_neq:
- loadsp 8
- fast_neg
- loadsp 8
- add
-
- not
- loadsp 0
- im 1
- add
- not
- and
- flip
-
- not
-
- im 1
- and
-
- storesp 12
- storesp 4
- poppc
-
-
-# opcode 48
-# offset 0x0000 0200
- .balign 32,0
-_neg:
- loadsp 4
- not
- im 1
- add
- storesp 8
-
- poppc
-
-
-# opcode 49
-# offset 0x0000 0220
- .balign 32,0
-_sub:
- loadsp 8
- loadsp 8
- fast_neg
- add
- storesp 12
-
- storesp 4
-
- poppc
-
-
-# opcode 50
-# offset 0x0000 0240
- .balign 32,0
-_xor:
- loadsp 8
- not
- loadsp 8
- and
-
- loadsp 12
- loadsp 12
- not
- and
-
- or
-
- storesp 12
- storesp 4
- poppc
-
-# opcode 51
-# offset 0x0000 0260
- .balign 32,0
-_loadb:
- loadsp 4
- im ~0x3
- and
- load
-
- loadsp 8
- im 3
- and
- fast_neg
- im 3
- add
- ; x8
- addsp 0
- addsp 0
- addsp 0
-
- lshiftright
-
- im 0xff
- and
- storesp 8
-
- poppc
-
-
-# opcode 52
-# offset 0x0000 0280
- .balign 32,0
-_storeb:
- loadsp 4
- im ~0x3
- and
- load
-
- ; mask away destination
- im _mask
- loadsp 12
- im 3
- and
- addsp 0
- addsp 0
- add
- load
-
- and
-
-
- im _storebtail
- poppc
-
-# opcode 53
-# offset 0x0000 02a0
- .balign 32,0
-_div:
- jmp ___div
-
-# opcode 54
-# offset 0x0000 02c0
- .balign 32,0
-_mod:
- jmp ___mod
-
-# opcode 55
-# offset 0x0000 02e0
- .balign 32,0
- .globl _eqbranch
-_eqbranch:
- loadsp 8
-
- ; eq
-
- not
- loadsp 0
- im 1
- add
- not
- and
- flip
- im 1
- and
-
- ; mask
- im -1
- add
- loadsp 0
- storesp 16
-
- ; no branch address
- loadsp 4
-
- and
-
- ; fetch boolean & neg mask
- loadsp 12
- not
-
- ; calc address & mask for branch
- loadsp 8
- loadsp 16
- add
- ; subtract 1 to find PC of branch instruction
- im -1
- add
-
- and
-
- or
-
- storesp 4
- storesp 4
- storesp 4
- poppc
-
-
-# opcode 56
-# offset 0x0000 0300
- .balign 32,0
- .globl _neqbranch
-_neqbranch:
- loadsp 8
-
- ; neq
-
- not
- loadsp 0
- im 1
- add
- not
- and
- flip
-
- not
-
- im 1
- and
-
- ; mask
- im -1
- add
- loadsp 0
- storesp 16
-
- ; no branch address
- loadsp 4
-
- and
-
- ; fetch boolean & neg mask
- loadsp 12
- not
-
- ; calc address & mask for branch
- loadsp 8
- loadsp 16
- add
- ; find address of branch instruction
- im -1
- add
-
- and
-
- or
-
- storesp 4
- storesp 4
- storesp 4
- poppc
-
-# opcode 57
-# offset 0x0000 0320
- .balign 32,0
- .globl _poppcrel
-_poppcrel:
- add
- ; address of poppcrel
- im -1
- add
- poppc
-
-# opcode 58
-# offset 0x0000 0340
- .balign 32,0
- .globl _config
-_config:
- im 1
- nop
- im _hardware
- store
- storesp 4
- poppc
-
-# opcode 59
-# offset 0x0000 0360
- .balign 32,0
-_pushpc:
- loadsp 4
- im 1
- add
- storesp 8
- poppc
-
-# opcode 60
-# offset 0x0000 0380
- .balign 32,0
-_syscall_emulate:
- .byte 0
-
-# opcode 61
-# offset 0x0000 03a0
- .balign 32,0
-_pushspadd:
- pushsp
- im 4
- add
- loadsp 8
- addsp 0
- addsp 0
- add
- storesp 8
-
- poppc
-
-# opcode 62
-# offset 0x0000 03c0
- .balign 32,0
-_halfmult:
- breakpoint
-
-# opcode 63
-# offset 0x0000 03e0
- .balign 32,0
-_callpcrel:
- loadsp 4
- loadsp 4
- add
- im -1
- add
- loadsp 4
-
- storesp 12 ; return address
- storesp 4
- pushsp ; this will flush the internal stack.
- popsp
- poppc
-
- .text
-
-
-
-
-_ashiftleftBegin:
- .rept 0x1f
- addsp 0
- .endr
-_ashiftleftEnd:
- storesp 12
- storesp 4
- poppc
-
-_storebtail:
- loadsp 12
- im 0xff
- and
- loadsp 12
- im 3
- and
-
- fast_neg
- im 3
- add
- ; x8
- addsp 0
- addsp 0
- addsp 0
-
- ashiftleft
-
- or
-
- loadsp 8
- im ~0x3
- and
-
- store
-
- storesp 4
- storesp 4
- poppc
-
-
-
-
-; NB! this is not an EMULATE instruction. It is a varargs fn.
- .globl _syscall
-_syscall:
- syscall
- poppc
-
-_slowmultImpl:
-
- loadsp 8 ; A
- loadsp 8 ; B
- im 0 ; C
-
-.LmoreMult:
- mult1bit
-
- ; cutoff
- loadsp 8
- .byte (.LmoreMult-.Lbranch)&0x7f+0x80
-.Lbranch:
- neqbranch
-
- storesp 4
- storesp 4
- storesp 12
- storesp 4
- poppc
-
-___mod:
- cimpl __modsi3
-___div:
- cimpl __divsi3
-
- .globl ___zpu_interrupt_vector
- .weak ___zpu_interrupt_vector
-
-___zpu_interrupt_vector:
- jsr _zpu_interrupt
- poppc
-
- .data
- .balign 4,0
-_mask:
- .long 0x00ffffff
- .long 0xff00ffff
- .long 0xffff00ff
- .long 0xffffff00
-
-
- .globl _hardware
-_hardware:
- .long 0
- .globl _cpu_config
-_cpu_config:
- .long 0
-
diff --git a/mig_test/software/lib/divmod.c b/mig_test/software/lib/divmod.c
deleted file mode 100644
index e810ea7..0000000
--- a/mig_test/software/lib/divmod.c
+++ /dev/null
@@ -1,50 +0,0 @@
-long udivmodsi4 ();
-
-long
-__divsi3 (long a, long b)
-{
- int neg = 0;
- long res;
-
- if (a < 0)
- {
- a = -a;
- neg = !neg;
- }
-
- if (b < 0)
- {
- b = -b;
- neg = !neg;
- }
-
- res = udivmodsi4 (a, b, 0);
-
- if (neg)
- res = -res;
-
- return res;
-}
-
-long
-__modsi3 (long a, long b)
-{
- int neg = 0;
- long res;
-
- if (a < 0)
- {
- a = -a;
- neg = 1;
- }
-
- if (b < 0)
- b = -b;
-
- res = udivmodsi4 (a, b, 1);
-
- if (neg)
- res = -res;
-
- return res;
-}
diff --git a/mig_test/software/lib/premain.c b/mig_test/software/lib/premain.c
deleted file mode 100644
index 6206c06..0000000
--- a/mig_test/software/lib/premain.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
-extern char _data_start;
-extern char _data_end;
-extern char _data_start_rom;
-*/
-
-
-void _premain( void)
-{
-/*
- int count;
- char *dst = (char *) &_data_start;
- char *src = (char *) &_data_start_rom;
-
- if ( (&_data_start) != (&_data_start_rom) )
- {
- count = &_data_end - &_data_start;
- while (count--)
- {
- *dst++ = *src++;
- }
- }
-*/
-
- main();
-}
diff --git a/mig_test/software/lib/udivmodsi4.c b/mig_test/software/lib/udivmodsi4.c
deleted file mode 100644
index 7d1cb67..0000000
--- a/mig_test/software/lib/udivmodsi4.c
+++ /dev/null
@@ -1,24 +0,0 @@
-unsigned long
-udivmodsi4(unsigned long num, unsigned long den, int modwanted)
-{
- unsigned long bit = 1;
- unsigned long res = 0;
-
- while (den < num && bit && !(den & (1L<<31)))
- {
- den <<=1;
- bit <<=1;
- }
- while (bit)
- {
- if (num >= den)
- {
- num -= den;
- res |= bit;
- }
- bit >>=1;
- den >>=1;
- }
- if (modwanted) return num;
- return res;
-}
diff --git a/mig_test/software/libhal/Makefile b/mig_test/software/libhal/Makefile
deleted file mode 100644
index fe149c1..0000000
--- a/mig_test/software/libhal/Makefile
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# $HeadURL: https://svn.fzd.de/repo/concast/FWF_Projects/FWKE/hw_sp605/bsp_zpuahb/software/libhal/Makefile $
-# $Date$
-# $Author$
-# $Revision$
-#
-
-DIR=..
-include include.mak
-
-
-C_FILES=hw.c common.c timer.c uart.c vga.c
-OBJECTS=hw.o common.o timer.o uart.o vga.o
-INCLUDES=../include/peripherie.h
-
-
-all: libhal.a
-
-
-libhal.a: $(OBJECTS) $(INCLUDES)
- $(AR) clr libhal.a $(OBJECTS)
- $(RANLIB) libhal.a
-
-
-%.o: %.c $(INCLUDES)
- $(CC) -c -o $@ $< $(CFLAGS)
-
-
-clean:
- rm -f *.o
- rm -f libhal.a
diff --git a/mig_test/software/libhal/common.c b/mig_test/software/libhal/common.c
deleted file mode 100644
index 941c7e4..0000000
--- a/mig_test/software/libhal/common.c
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * $HeadURL: https://svn.fzd.de/repo/concast/FWF_Projects/FWF_Internals/FPGA/hw_sp605/bsp_zpuahb/software/libhal/common.c $
- * $Date$
- * $Author$
- * $Revision$
- */
-
-
-#include <peripherie.h>
-#include <stdlib.h> // utoa, dtostrf (actually not implemented)
-
-////////////////////////////////////////
-// common stuff
-
-
-// libgloss/zpu/syscalls.c work with inbyte and outbyte
-char putchar( char c)
-{
- return stdout( c);
-}
-
-
-
-void putstr(const char *s)
-{
- while (*s)
- putchar( *s++);
-}
-
-
-/*
- print data in binary format
- prepend 0b
- parameter: dataType - number of bits
-*/
-void putbin( unsigned char dataType, unsigned long data)
-{
- unsigned char i, temp;
- char dataString[] = "0b ";
-
- for(i=dataType; i>0; i--)
- {
- temp = data % 2;
- dataString [i+1] = temp + 0x30;
- data = data/2;
- }
- putstr( dataString);
-}
-
-
-// http://asalt-vehicle.googlecode.com/svn› trunk› src› uart.c
-unsigned char puthex( unsigned char dataType, unsigned long data)
-{
- unsigned char count = 8; // number of chars
- unsigned char i;
- unsigned char temp;
- char dataString[] = " ";
-
- // dataType = bit width
- if (dataType == 4) count = 1;
- if (dataType == 8) count = 2;
- if (dataType == 16) count = 4;
-
- for(i=count; i>0; i--)
- {
- temp = data % 16;
- if (temp<10) dataString [i-1] = temp + 0x30;
- else dataString [i-1] = (temp - 10) + 0x41;
-
- data = data/16;
- }
- dataString[count] = '\0';
- putstr( dataString);
-
- return count; // return length
-}
-
-
-
-// http://www.mikrocontroller.net/articles/FAQ#itoa.28.29
-unsigned char itoa( long z, char* Buffer )
-{
- int i = 0;
- int j;
- char tmp;
- unsigned u; // In u bearbeiten wir den Absolutbetrag von z.
-
- // ist die Zahl negativ?
- // gleich mal ein - hinterlassen und die Zahl positiv machen
- if( z < 0 ) {
- Buffer[0] = '-';
- Buffer++;
- // -INT_MIN ist idR. größer als INT_MAX und nicht mehr
- // als int darstellbar! Man muss daher bei der Bildung
- // des Absolutbetrages aufpassen.
- u = ( (unsigned)-(z+1) ) + 1;
- }
- else {
- u = (unsigned)z;
- }
- // die einzelnen Stellen der Zahl berechnen
- do {
- Buffer[i++] = '0' + u % 10;
- u /= 10;
- } while( u > 0 );
-
- // den String in sich spiegeln
- for( j = 0; j < i / 2; ++j ) {
- tmp = Buffer[j];
- Buffer[j] = Buffer[i-j-1];
- Buffer[i-j-1] = tmp;
- }
- Buffer[i] = '\0';
- // Laengenkorrektur wg. Vorzeichen
- if (z < 0)
- i++;
- return i; // BLa: Laenge des Buffers zurueckgeben
-}
-
-unsigned char utoa( unsigned long i, char *p)
-{
- unsigned char length;
-
- length = 0;
- do {
- *--p = '0' + i % 10;
- i /= 10;
- length++;
- } while (i > 0);
- return length;
-}
-
-
-unsigned char putuint( unsigned long data)
-{
- char str[20];
- unsigned char length;
-
- length = utoa( data, str);
- putstr( str);
- return length;
-}
-
-
-unsigned char putint( long data)
-{
- char str[20];
- unsigned char length;
-
- length = itoa( data, str);
- putstr( str);
- return length;
-}
-/*
- putint( 1000); putchar('\n'); // ok
- putint( 10000); putchar('\n'); // ok
- putint( 100000); putchar('\n'); // ok
- putint( 1000000); putchar('\n'); // ok
- putint( 10000000); putchar('\n'); // ok
- putint( 100000000); putchar('\n'); // ok
- putint( 200000000); putchar('\n'); // ok
- putint( 400000000); putchar('\n'); // ok
- putint( 800000000); putchar('\n'); // ok
- putint( 1000000000); putchar('\n'); // ok
- putint( 2000000000); putchar('\n'); // ok
- putint( 4000000000); putchar('\n'); // -294967296 warning: this decimal constant is unsigned only in ISO C90
- putint( 8000000000); putchar('\n'); // -589934592 warning: integer constant is too large for "long" type
-*/
-
-unsigned char putfloat( float data)
-{
- char str[20];
- unsigned char length;
-
- length = dtostrf( data, 2, 1, str);
- putstr( str);
- return length;
-}
-
-
-// p means pseudo float
-// (an integer with 3 significant digits after the point)
-void putpfloat( unsigned long data)
-{
- putint( data/1000);
- putchar( '.');
- putint( data%1000 );
-}
-
-
-unsigned char putbool( int data)
-{
- if (data)
- {
- putstr( "yes");
- }
- else
- {
- putstr( "no");
- }
- return 0;
-}
-
diff --git a/mig_test/software/libhal/hw.c b/mig_test/software/libhal/hw.c
deleted file mode 100644
index 8401010..0000000
--- a/mig_test/software/libhal/hw.c
+++ /dev/null
@@ -1,28 +0,0 @@
-#include "peripherie.h"
-
-volatile uint32_t *debug_con0 = (uint32_t *) 0x80000000;
-volatile uint32_t *reset_reg = (uint32_t *) 0x80000004;
-apbuart_t *uart0 = (apbuart_t *) 0x80000100;
-gptimer_t *timer0 = (gptimer_t *) 0x80000200;
-irqmp_t *irqmp0 = (irqmp_t *) 0x80000300;
-grgpio_t *gpio0 = (grgpio_t *) 0x80000400;
-apbvga_t *vga0 = (apbvga_t *) 0x80000600;
-i2cmst_t *i2c_dvi = (i2cmst_t *) 0x80000700;
-i2cmst_t *i2c_fmc = (i2cmst_t *) 0x80000a00;
-
-mctrl_t *mctrl0 = (mctrl_t *) 0x80000f00;
-/*
-greth_t *ether0 = (greth_t *) 0x80000c00;
-dcm_ctrl_t *dcm_ctrl0 = (dcm_ctrl_t *) 0x80000e00;
-ddrspa_t *ddr0 = (ddrspa_t *) 0xfff00000;
-*/
-
-char debug_putchar( char c)
-{
- *debug_con0 = (uint32_t) c;
- return 0;
-}
-
-char (* stdout) (char) = debug_putchar;
-
-
diff --git a/mig_test/software/libhal/include.mak b/mig_test/software/libhal/include.mak
deleted file mode 100644
index 226ca66..0000000
--- a/mig_test/software/libhal/include.mak
+++ /dev/null
@@ -1,16 +0,0 @@
-AS=zpu-elf-as
-CC=zpu-elf-gcc
-LD=zpu-elf-ld
-OBJCOPY=zpu-elf-objcopy
-OBJDUMP=zpu-elf-objdump
-AR=zpu-elf-ar
-RANLIB=zpu-elf-ranlib
-SIZE=zpu-elf-size
-
-ROMGEN=$(DIR)/support/zpuromgen
-
-INLCUDES=-I$(DIR)/include
-ASFLAGS=-adhls -g $(INLCUDES)
-CFLAGS=-O3 -phi -Wall -ffunction-sections -fdata-sections $(INLCUDES)
-LDFLAGS=--relax --gc-sections
-OBJCOPYFLAGS=--strip-debug --discard-locals
diff --git a/mig_test/software/libhal/timer.c b/mig_test/software/libhal/timer.c
deleted file mode 100644
index 789c565..0000000
--- a/mig_test/software/libhal/timer.c
+++ /dev/null
@@ -1,132 +0,0 @@
-#include "peripherie.h"
-
-#include "timer.h"
-
-////////////////////////////////////////
-// timer functions
-// timer 0.0 is used for usleep
-// timer 0.0 is used for msleep
-// timer 0.0 is used for sleep (via msleep)
-//
-// timer 0.0 ticks with milliseconds
-// timer 0.1 ticks with seconds
-
-
-// wait for a given time in micro seconds
-void usleep(uint32_t usec)
-{
- uint32_t tcr;
-
- // 1 usec = 6
- timer0->e[0].reload = (F_CPU/TIMER_PRESCALER/1000000)*usec;
- timer0->e[0].ctrl = TIMER_ENABLE | TIMER_LOAD;
-
- do
- {
- tcr = timer0->e[0].ctrl;
- } while ( (tcr & TIMER_ENABLE));
-}
-
-
-// wait for given time in milli seconds
-void msleep(uint32_t msec)
-{
- uint32_t tcr;
-
- // some values for 50MHz @ Spartan 3e
- // 1 msec = 6250
- // 167 msec = 2**20 (20 bit counter) 391 slices
- // 2684 msec = 2**24 (24 bit counter) 450 slices
- // = 2**32 (32 bit counter) 572 slices
- // some values for 52MHz @ Spartan 6
- // 1 msec = 6500
- // 161 msec = 2**20 (20 bit counter)
- // 2581 msec = 2**24 (24 bit counter) 450 slices
- // 660 sec = 2**32 (32 bit counter) 572 slices
- timer0->e[0].reload = (F_CPU/TIMER_PRESCALER/1000)*msec;
- timer0->e[0].ctrl = TIMER_ENABLE | TIMER_LOAD;
-
- do
- {
- tcr = timer0->e[0].ctrl;
- } while ( (tcr & TIMER_ENABLE));
-}
-
-
-// wait for given time in seconds
-void sleep(uint32_t sec)
-{
- uint32_t timer;
-
- for (timer=0; timer<sec; timer++)
- {
- msleep( 100);
- msleep( 100);
- msleep( 100);
- msleep( 100);
- msleep( 100);
- msleep( 100);
- msleep( 100);
- msleep( 100);
- msleep( 100);
- msleep( 100);
- }
-}
-
-
-
-// deliver the milliseconds from timer 0.0
-uint32_t msecs( void)
-{
- return( timer0->e[0].value);
-}
-
-
-// deliver the seconds from timer 0.1
-uint32_t seconds( void)
-{
- return( timer0->e[1].value);
-}
-
-
-// deliver the time (in seconds and fraction) from timer
-uint32_t get_time( void)
-{
- uint32_t value;
-
- TIMER_STOP;
-
- // combine values (seconds.milliseconds)
- value = timer0->e[1].value * 1000 + timer0->e[0].value;
-
- TIMER_RUN;
-
- return( value);
-}
-
-
-// just a loop
-void wait( uint32_t value)
-{
- uint32_t i;
-
- for (i=0; i<value; i++) {}
-}
-
-
-// initialisation for the timer
-void timer_init( void)
-{
- timer0->scaler_reload = TIMER_PRESCALER-1; // set prescaler
-
- // set timer 0.1 in chain mode to timer 0.0
- // so it counts in seconds
- timer0->e[1].reload = 0xffffffff;
- timer0->e[1].ctrl = TIMER_ENABLE | TIMER_RESTART | TIMER_LOAD | TIMER_CHAIN;
-
- // set timer 0.0 to free running in msec
- timer0->e[0].reload = (F_CPU/TIMER_PRESCALER/CLOCKS_PER_SECOND);
- timer0->e[0].ctrl = TIMER_ENABLE | TIMER_RESTART | TIMER_LOAD;
-}
-
-
diff --git a/mig_test/software/libhal/uart.c b/mig_test/software/libhal/uart.c
deleted file mode 100644
index d1290b5..0000000
--- a/mig_test/software/libhal/uart.c
+++ /dev/null
@@ -1,56 +0,0 @@
-//#include <stdio.h>
-
-#include "peripherie.h"
-
-////////////////////////////////////////
-// common defines
-
-#define bit_is_set(mem, bv) (mem & bv)
-#define bit_is_clear(mem, bv) (!(mem & bv))
-#define loop_until_bit_is_set(mem, bv) do {} while( bit_is_clear(mem, bv))
-#define loop_until_bit_is_clear(mem, bv) do {} while( bit_is_set(mem, bv))
-
-
-////////////////////////////////////////
-// uart functions
-
-
-void uart_init( void)
-{
- uart0->scaler = UART_SCALER;
- uart0->ctrl = UART_CONTROL_TX_ENABLE | UART_CONTROL_RX_ENABLE;
-}
-
-
-unsigned int uart_check_receiver()
-{
- return ( bit_is_set( uart0->status, UART_STATUS_DATA_READY) != 0);
-}
-
-
-char uart_getchar()
-{
- loop_until_bit_is_set(uart0->status, UART_STATUS_DATA_READY);
- return uart0->data;
-}
-
-
-void uart_putchar_raw( char c)
-{
- #if UART_FIFOSIZE==1 || !defined(UART_FIFOSIZE)
- loop_until_bit_is_set( uart0->status, UART_STATUS_TX_REG_EMPTY);
- #else
- loop_until_bit_is_clear( uart0->status, UART_STATUS_TX_FIFO_FULL);
- #endif
- uart0->data = c;
-}
-
-
-char uart_putchar( char c)
-{
- if (c == '\n')
- uart_putchar_raw( '\r');
- uart_putchar_raw( c);
- return 0;
-}
-
diff --git a/mig_test/software/libhal/vga.c b/mig_test/software/libhal/vga.c
deleted file mode 100644
index 8cc55b9..0000000
--- a/mig_test/software/libhal/vga.c
+++ /dev/null
@@ -1,67 +0,0 @@
-//#include <stdio.h>
-
-#include "peripherie.h"
-
-
-////////////////////////////////////////
-// common defines
-
-#define bit_is_set(mem, bv) (mem & bv)
-#define bit_is_clear(mem, bv) (!(mem & bv))
-#define loop_until_bit_is_set(mem, bv) do {} while( bit_is_clear(mem, bv))
-#define loop_until_bit_is_clear(mem, bv) do {} while( bit_is_set(mem, bv))
-
-
-
-
-uint8_t vga_line;
-uint8_t vga_column;
-
-void vga_init( void)
-{
- vga0->background_color = 0x00000000;
- vga0->foreground_color = 0x0000ff00;
- vga_line = 0;
- vga_column = 0;
-}
-
-
-
-void vga_clear( void)
-{
- uint32_t count;
- uint32_t count_max = 37*80;
-
- for(count = 0; count< count_max; count++)
- vga0->data = count<<8;
-
- vga_line = 0;
- vga_column = 0;
-}
-
-
-void vga_putchar( char c)
-{
-
- vga0->data = (( vga_line * 80 + vga_column)<<8) | c;
- if ( (c == '\n') || (vga_column == 79) ) // line feed (+ carrige return)
- {
- if (vga_line<36)
- vga_line++;
- else
- vga_line = 0;
-
- vga_column = 0;
- }
- else if (c == '\f') // form feed
- {
- vga_clear();
- }
- else
- {
- vga_column++;
- }
-
-}
-
-
diff --git a/mig_test/software/main.c b/mig_test/software/main.c
deleted file mode 100644
index 535abf2..0000000
--- a/mig_test/software/main.c
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
- * $Date$
- * $Author$
- * $Revision$
- */
-
-//#include <stdio.h>
-
-#define BOARD_GIGABEE
-
-#include "../include/peripherie.h"
-#include <common.h>
-#include <timer.h> // sleep
-#include <uart.h>
-#include "schedule.h" // scheduler_init, scheduler_task_*
-#include "monitor.h" // monitor_init, monitor_add_command, monitor_mainloop
-#include "monitor_functions.h" // x_function, wmem_function, clear_function, quit_function
-
-
-////////////////////////////////////////
-// named IOs
-// input
-#define MAC_DATA (1<< 4)
-#define SIMULATION_ACTIVE (1<< 31)
-// output
-#define LED0 (1<< 0)
-#define LED1 (1<< 1)
-#define LED2 (1<< 2)
-#define LED3 (1<< 3)
-#define LED_USER (1<< 5)
-
-
-
-
-
-
-
-////////////////////////////////////////////////////////////
-
-uint32_t simulation_active;
-volatile uint8_t timer_tick;
-uint8_t end_simulation = FALSE;
-
-
-////////////////////////////////////////
-// prototypes
-
-void running_light( uint32_t simulation_active);
-
-uint32_t run_light_function( void);
-
-
-
-
-////////////////////////////////////////
-// combined print functions
-
-/*
-char uart_lcd_putchar( char c, FILE *stream)
-{
- uart_putchar( c, stream);
- lcd_putc( c, stream);
-}
-*/
-
-
-
-
-// helper functions ////////////////////////////////////////
-////////////////////////////////////////////////////////////
-
-// monitor functions ///////////////////////////////////////
-////////////////////////////////////////////////////////////
-
-////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////
-
-void running_light( uint32_t simulation_active)
-{
- unsigned int pattern = 0x80300700;
-
- while (1)
- {
-
- gpio0->ioout = 0x0000000f & pattern;
- pattern = (pattern << 1) | (pattern >> 31);
-
-
- if ( simulation_active)
- {
- // do only limited runs
- if ( timer_tick)
- {
- timer_tick = FALSE;
- scheduler_task_check();
-
- if ( end_simulation) break;
- }
- }
- else
- {
- msleep( 125);
- }
- }
-
-}
-
-
-////////////////////////////////////////////////////////////
-
-
-////////////////////////////////////////////////////////////
-
-////////////////////////////////////////////////////////////
-// functions for scheduler
-
-void end_simulation_task( void)
-{
- end_simulation = TRUE;
-}
-
-
-
-void running_light_task( void)
-{
- static unsigned int pattern = 0x80300700;
-
- gpio0->ioout = 0x0000000f & pattern;
- pattern = (pattern << 1) | (pattern >> 31);
-
- scheduler_task_add( running_light_task, SECONDS( 0.125));
-}
-
-
-
-////////////////////////////////////////////////////////////
-// start running light
-uint32_t run_light_function( void)
-{
- scheduler_task_add( running_light_task, 1);
- return 0;
-}
-
-
-
-//
-// process serial commands
-//
-void uart_monitor( void)
-{
- uint8_t c;
- uint8_t key_time_out = 250;
- uint32_t key_state;
-
- putchar( '\n');
-
- monitor_init();
-
-
-// monitor_add_command("reset", "system reset", reset_function);
- monitor_add_command("sysinfo", "show system info <verbose>", system_info_function);
-
- monitor_add_command("run", "running light", run_light_function);
-
- monitor_add_command("wmem", "write word <addr> <length> <value(s)>", wmem_function);
- monitor_add_command("x", "eXamine memory <addr> <length>", x_function);
- monitor_add_command("task", "print tasklist", scheduler_tasklist);
-
- monitor_add_command("help", "", help_function);
-
-
- // initial help
- help_function();
-
- monitor_prompt();
-
- monitor_run = TRUE;
-
- while( monitor_run)
- {
- // process scheduler
- if ( timer_tick)
- {
- timer_tick = FALSE;
- scheduler_task_check();
- }
-
- // process uart
- if ( uart_check_receiver() )
- {
- monitor_input( uart_getchar() );
- }
-
- // process commands
- monitor_mainloop();
- }
-}
-
-
-
-////////////////////////////////////////////////////////////
-
-void banner( void)
-{
- putstr("\n\n");
- putstr("BSP Trenz Gigabee");
-
- char *hw_revision = (char *)0x80000000;
- char *svn_revision = (char *)0x80000020;
- int32_t *hw_frequency = (int32_t *)0x80000040;
-
- if (simulation_active)
- {
- putstr(" (on sim)\n");
- }
- else
- {
- putstr("\nSVN revision : "); putstr( svn_revision);
- putstr("\nHW synthesized: "); putstr( hw_revision);
- putstr("\nHW frequency : "); putint( *hw_frequency/1000000); putstr(" MHz");
- putstr("\nSW compiled : " __DATE__ " " __TIME__ );
- putstr("\nSW frequency : "); putint( F_CPU/1000000); putstr(" MHz");
- putchar('\n');
- }
-}
-
-
-////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////
-void _zpu_interrupt( void)
-{
- uint32_t reg_val;
-
- // check for timer 0.0 interrupt
- reg_val = timer0->e[0].ctrl;
- if bit_is_set( reg_val, TIMER_INT_PENDING)
- {
- // clear interrupt pending bit
- clear_bit( reg_val, TIMER_INT_PENDING);
- timer0->e[0].ctrl = reg_val;
-
- timer_tick = TRUE;
- }
- return;
-}
-
-////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////
-
-int main(void)
-{
-
- // check if on simulator or on hardware
- simulation_active = bit_is_set( gpio0->iodata, (1<<31));
-
- ////////////////////////////////////////////////////////////
- // init stuff
- timer_init();
- uart_init();
- scheduler_init();
-
-
- // enable timer interrupt, for scheduler
- set_bit( timer0->e[0].ctrl, TIMER_INT_ENABLE);
-
-
- if (!simulation_active)
- {
- stdout = uart_putchar;
- }
- else
- {
- // debug_putchar is for simulator
- stdout = debug_putchar;
- }
-
- ////////////////////////////////////////////////////////////
- banner();
-
- ////////////////////////////////////////////////////////////
- // decide which main function to use
-
- if ( !simulation_active)
- {
- uart_monitor();
- }
-
- // test of scheduler
- scheduler_task_add( end_simulation_task, 1);
- running_light( simulation_active);
-
- ////////////////////////////////////////////////////////////
- // end simulation
- abort();
-
-}
diff --git a/mig_test/software/monitor.c b/mig_test/software/monitor.c
deleted file mode 100644
index c5131e6..0000000
--- a/mig_test/software/monitor.c
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * $HeadURL: https://svn.fzd.de/repo/concast/FWF_Projects/FWKE/hw_sp605/bsp_zpuahb/software/monitor.c $
- * $Date$
- * $Author$
- * $Revision$
- */
-
-#include "monitor.h"
-
-////////////////////////////////////////////////////////////
-// monitor functions
-
-static char command_list[MAX_COMMANDS][MAX_COMMAND_LENGTH];
-static char help_list [MAX_COMMANDS][MAX_HELP_LENGTH];
-static command_ptr_t command_ptr_list[MAX_COMMANDS];
-
-uint8_t buffer[BUFFER_LENGTH];
-uint8_t command_number;
-uint8_t buffer_position;
-command_ptr_t exec_function;
-
-
-
-/*
- reset some values for monitor
-*/
-void monitor_init( void)
-{
- buffer_position = 0;
- command_number = 0;
- exec_function = 0;
-}
-
-
-/*
- add an command to the monitor list
-*/
-void monitor_add_command(char* new_command, char* new_help, command_ptr_t new_command_ptr)
-{
- if (command_number < MAX_COMMANDS)
- {
- strcpy( command_list[ command_number], new_command);
- strcpy( help_list[ command_number], new_help);
- command_ptr_list[ command_number] = new_command_ptr;
- command_number++;
- }
- else
- {
- putstr("ERROR: too much commands.\n");
- }
-}
-
-
-/*
- print out a nice promt
-*/
-void monitor_prompt( void) {
- putstr("> ");
-}
-
-
-/*
- check the line buffer content and search command
-*/
-void process_buffer( void) {
- uint8_t command_index;
- uint8_t i;
-
- i = 0;
-
- while ( !((buffer[i] == ' ') || (buffer[i] == 0)) ) i++;
-
- if (!i) {
- monitor_prompt();
- return;
- }
-
- for ( command_index = 0; command_index < command_number; command_index++) {
- if ( !strncmp( command_list[ command_index], buffer, i) ) {
- exec_function = command_ptr_list[ command_index];
- return;
- }
- }
- putstr("command not found.\n");
- monitor_prompt();
-}
-
-
-uint8_t monitor_run;
-
-
-/*
- execute the command
-*/
-void monitor_mainloop( void)
-{
- uint32_t return_value;
-
- // execute selected function
- if (exec_function) {
- return_value = exec_function();
- exec_function = 0;
-
- // print return value (as hex)
- if (return_value > 0)
- {
- putstr("0x");
- if (return_value > 0xffff)
- puthex(32, return_value);
- else
- if (return_value > 0xff)
- puthex(16, return_value);
- else
- puthex(8, return_value);
- putchar('\n');
- }
-
- monitor_prompt();
- }
-}
-
-
-/*
- add an character to the monitor line buffer
-*/
-void monitor_input(uint8_t c) {
-
- // carrige return
- if (c == CR) {
- putchar( LF);
- buffer[ buffer_position++] = 0;
- process_buffer();
- buffer_position = 0;
-
- // backspace or delete
- } else if ( (c == BS) || (c == DEL)) {
- if (buffer_position > 0) {
- putchar( BS);
- putchar( ' ');
- putchar( BS);
- buffer_position--;
- }
- } else {
- // add to buffer
- if ((c >= 0x20) && (buffer_position < (BUFFER_LENGTH-1))) {
- putchar( c);
- buffer[ buffer_position++] = c;
- }
- }
-}
-
-
-/*
- parse the argument as string
-*/
-char* monitor_get_argument_string(uint8_t num)
-{
- uint8_t index;
- uint8_t arg;
-
- // example line:
- // " command arg1 arg2 arg3 "
-
- index = 0;
-
- // search for first char (non space)
- while (( buffer[ index] != 0) && (buffer[ index] == ' ')) index++;
-
- for ( arg = 0; arg < num; arg++)
- {
- // next space
- while (( buffer[ index] != 0) && (buffer[ index] != ' ')) index++;
- // next non space
- while (( buffer[ index] != 0) && (buffer[ index] == ' ')) index++;
- }
- return &buffer[ index];
-}
-
-
-/*
- parse the argument as integer
-*/
-int monitor_get_argument_int(uint8_t num)
-{
- char *endptr;
- return strtol( monitor_get_argument_string(num), &endptr, 0);
-}
-
-
-/*
- parse the argument as hex number
-*/
-uint32_t monitor_get_argument_hex(uint8_t num)
-{
- char *endptr;
- return strtoul( monitor_get_argument_string(num), &endptr, 16);
-}
-
-
-
-/*
- print all avalible functions as help screen
-*/
-uint32_t help_function( void)
-{
- uint8_t command_index;
- uint8_t i;
-
- putchar( LF);
- putstr("supported commands:\n\n");
- for ( command_index = 0; command_index < command_number; command_index++) {
- putstr( command_list[ command_index]);
- if (strlen( help_list[ command_index]) > 0 )
- {
- for (i = strlen( command_list[ command_index]); i < MAX_COMMAND_LENGTH; i++) putchar(' ');
- putstr( " - ");
- putstr( help_list[ command_index]);
- }
- putchar('\n');
- }
- putchar( LF);
- return command_number;
-}
-
-
diff --git a/mig_test/software/monitor.h b/mig_test/software/monitor.h
deleted file mode 100644
index 74d6472..0000000
--- a/mig_test/software/monitor.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * $HeadURL: https://svn.fzd.de/repo/concast/FWF_Projects/FWKE/hw_sp605/bsp_zpuahb/software/monitor.h $
- * $Date$
- * $Author$
- * $Revision$
- */
-
-
-#ifndef MONITOR_H
-#define MONITOR_H
-
-#include <types.h>
-
-////////////////////////////////////////////////////////////
-// monitor definitions
-
-#define MAX_COMMANDS (64)
-#define MAX_COMMAND_LENGTH (12)
-#define MAX_HELP_LENGTH (40)
-#define BUFFER_LENGTH (80)
-
-#define CR '\r'
-#define LF '\n'
-#define BS '\b'
-#define DEL (0x7f)
-
-#define SOH (0x01)
-#define EOT (0x04)
-#define ACK (0x06)
-#define NAK (0x15)
-#define CAN (0x18)
-#define EOF (0x1a)
-
-
-////////////////////////////////////////////////////////////
-// monitor variables
-
-typedef uint32_t (*command_ptr_t) (void);
-
-extern char command_list[MAX_COMMANDS][MAX_COMMAND_LENGTH];
-extern char help_list [MAX_COMMANDS][MAX_HELP_LENGTH];
-extern command_ptr_t command_ptr_list[MAX_COMMANDS];
-
-extern uint8_t buffer[BUFFER_LENGTH];
-extern uint8_t command_number;
-extern uint8_t buffer_position;
-extern command_ptr_t exec_function;
-
-
-////////////////////////////////////////////////////////////
-// monitor functions
-
-void monitor_init( void);
-void monitor_add_command(char* new_command, char* new_help, command_ptr_t new_command_ptr);
-void monitor_prompt( void);
-void process_buffer( void);
-extern uint8_t monitor_run;
-
-void monitor_mainloop( void);
-void monitor_input(uint8_t c);
-char* monitor_get_argument_string(uint8_t num);
-int monitor_get_argument_int(uint8_t num);
-uint32_t monitor_get_argument_hex(uint8_t num);
-
-uint32_t help_function( void);
-
-#endif // MONITOR_H
diff --git a/mig_test/software/monitor_functions.c b/mig_test/software/monitor_functions.c
deleted file mode 100644
index 5eda564..0000000
--- a/mig_test/software/monitor_functions.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * $HeadURL: https://svn.fzd.de/repo/concast/FWF_Projects/FWKE/hw_sp605/bsp_zpuahb/software/monitor_functions.c $
- * $Date$
- * $Author$
- * $Revision$
- */
-
-#include <types.h>
-#include "monitor.h"
-#include "ambainfo.h" // apb_info, ahb_info
-#include "peripherie.h"
-
-
-volatile uint8_t running_direction = 0;
-
-
-/*
- exit the monitor program
-*/
-uint32_t quit_function( void)
-{
- monitor_run = FALSE;
- return 0;
-}
-
-
-/*
- do a memory dump
- arguments:
- start address
- length
-*/
-uint32_t x_function( void)
-{
- uint32_t addr;
- uint32_t count;
- uint32_t index;
- uint32_t* ptr;
-
- addr = monitor_get_argument_hex(1);
- count = monitor_get_argument_hex(2);
-
- // set minimum count, if count is not set
- if (count == 0) count = 16;
-
- // we can only read at 32 bit aligned addresses
- ptr = (uint32_t*)(addr & 0xfffffffc);
-
- if (count != 1)
- {
- for (index = 0; index < count; index++)
- {
- if ( (index % 4) == 0)
- {
- putstr("\n0x"); puthex(32, (uint32_t)ptr); putstr(" : ");
- }
- putstr("0x"); puthex( 32, *ptr); putchar(' ');
- *ptr++;
- }
- }
- else
- // fast version without address
- {
- putstr("0x"); puthex( 32, *ptr);
- }
- putchar( '\n');
- return 0;
-}
-
-
-/*
- write specific value on memory
- arguments:
- address
- count
- value(0) .. value(n)
-*/
-uint32_t wmem_function( void)
-{
- uint32_t addr;
- uint8_t count;
- uint8_t index;
- uint32_t value;
- uint32_t* ptr;
-
- addr = monitor_get_argument_hex(1);
- count = monitor_get_argument_int(2);
-
- ptr = (uint32_t*)addr; // automatic word aligned
-
- index = 3;
- while (count > 0)
- {
- value = monitor_get_argument_hex(index);
- index++;
- count--;
- *ptr = value;
- ptr++;
- }
- return count;
-}
-
-
-/*
- clear screen
-*/
-uint32_t clear_function( void)
-{
- putchar('\f');
- return 0;
-}
-
-
-////////////////////////////////////////////////////////////
-// reset function
-uint32_t reset_function( void)
-{
- *reset_reg = 0x87654321;
- return 1;
-}
-
-
-////////////////////////////////////////////////////////////
-// system info
-uint32_t system_info_function( void)
-{
- uint8_t verbose;
-
- verbose = monitor_get_argument_int(1);
- ahb_info( verbose);
- return 0;
-}
-
-
diff --git a/mig_test/software/monitor_functions.h b/mig_test/software/monitor_functions.h
deleted file mode 100644
index 3061290..0000000
--- a/mig_test/software/monitor_functions.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * $HeadURL: https://svn.fzd.de/repo/concast/FWF_Projects/FWKE/hw_sp605/bsp_zpuahb/software/monitor_functions.h $
- * $Date$
- * $Author$
- * $Revision$
- */
-
-
-#ifndef MONITOR_FUNCTIONS_H
-#define MONITOR_FUNCTIONS_H
-
-extern volatile uint8_t running_direction;
-
-
-uint32_t quit_function( void);
-uint32_t x_function( void);
-uint32_t wmem_function( void);
-uint32_t clear_function( void);
-
-uint32_t reset_function( void);
-
-uint32_t system_info_function( void);
-
-#endif // MONITOR_FUNCTIONS_H
diff --git a/mig_test/software/schedule.c b/mig_test/software/schedule.c
deleted file mode 100644
index 41357eb..0000000
--- a/mig_test/software/schedule.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * $HeadURL: https://svn.fzd.de/repo/concast/FWF_Projects/FWKE/hw_sp605/bsp_zpuahb/software/schedule.c $
- * $Date$
- * $Author$
- * $Revision$
- */
-
-#include <types.h>
-#include "schedule.h"
-
-#define MAXTIMERS 10
-#define T_FREE 254 // > MAXTIMERS
-#define T_LAST 255
-
-typedef struct{
- uint8_t next; // next in list or end mark
- t_res delta; // delta to previous entry
- funcp func;
-} t_ctrl_struct;
-
-
-t_ctrl_struct t_ctrl_lst[MAXTIMERS];
-t_res t_delay; // count down until next service
-uint8_t t_first; // point to first entry
-
-
-void scheduler_task_check(void)
-{
- t_ctrl_struct *p; // for faster access
-
- --t_delay;
- while( t_delay == 0 ){ // serve if delay = 0
- if( t_first == T_LAST ) // no function to serve
- break;
- p = &t_ctrl_lst[t_first];
- t_first = p->next; // point to next
- p->next = T_FREE; // mark free
- t_delay = t_ctrl_lst[t_first].delta; // next delay delta
- p->func(); // execute function
- }
-}
-
-
-uint8_t scheduler_task_add( funcp func, t_res delay )
-{
- uint8_t n;
- uint8_t i; // index
- uint8_t ipre; // previous index
- t_res d1; // last delta delay
- t_ctrl_struct *p; // for faster access
-
- for( n = 0;; ){
- p = &t_ctrl_lst[n];
- if( p->next == T_FREE )
- break;
- n++;
- if( n == MAXTIMERS )
- return 1; // error, list full
- }
-
- i = t_first;
- d1 = t_delay;
- while( i != T_LAST ){ // check until end
- if( d1 >= delay ){ // last >= new
- t_ctrl_lst[i].delta = d1 - delay; // correct following entry
- break;
- }else{
- delay -= d1; // remaining delay
- ipre = i; // previous entry
- i = t_ctrl_lst[i].next; // index of next entry
- d1 = t_ctrl_lst[i].delta; // next delay delta
- }
- } // insert new entry
-
- p->next = i; // following entry
- p->delta = delay; // store remaining delay
- p->func = func;
-
- if( i == t_first ){ // insert at first
- t_first = n;
- t_delay = delay;
- }else{
- t_ctrl_lst[ipre].next = n; // previous entry
- }
- return 0; // successful
-}
-
-
-uint8_t scheduler_task_remove( funcp func )
-{
- uint8_t ipre; // previous index
- uint8_t irem; // index to be removed
- uint8_t ifol = t_first; // following index
- t_ctrl_struct *p; // for faster access
-
- do{
- if( ifol == T_LAST )
- return 1; // not found
- ipre = irem;
- irem = ifol;
- p = &t_ctrl_lst[irem];
- ifol = p->next; // get next
- }while( p->func != func ); // found it
-
- p->next = T_FREE; // mark it as free
- if( irem == t_first ){
- t_first = ifol; // serve next entry
- t_delay += t_ctrl_lst[ifol].delta; // correct current delta
- }else{
- t_ctrl_lst[ipre].next = ifol; // skip index
- if( ifol != T_LAST ) // correct following delta
- t_ctrl_lst[ifol].delta += p->delta;
- }
- return 0; // successful
-}
-
-
-void scheduler_init(void)
-{
- uint8_t i;
-
- for( i = MAXTIMERS; i; i-- )
- t_ctrl_lst[i-1].next = T_FREE; // mark all free
- t_first = T_LAST; // set no timer served
-}
-
-
-uint32_t scheduler_tasklist( void)
-{
- uint8_t i;
-
- for( i = MAXTIMERS; i; i-- )
- {
- if ( t_ctrl_lst[i-1].next != T_FREE)
- {
- putint( i);
- putstr(": func: ");
- puthex( 32, t_ctrl_lst[i-1].func);
- putchar('\n');
- }
- }
-
- return 0;
-}
diff --git a/mig_test/software/schedule.h b/mig_test/software/schedule.h
deleted file mode 100644
index cd9729d..0000000
--- a/mig_test/software/schedule.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * $HeadURL: https://svn.fzd.de/repo/concast/FWF_Projects/FWKE/hw_sp605/bsp_zpuahb/software/schedule.h $
- * $Date$
- * $Author$
- * $Revision$
- */
-
-
-#ifndef SCHEDULE_H
-#define SCHEDULE_H
-
-#define t_res uint32_t // resolution for time
-
-#define SECONDS(x) ((t_res)(CLOCKS_PER_SECOND * x + 0.5))
-
-
-typedef void (*funcp)(void);
-
-void scheduler_task_check(void);
-uint8_t scheduler_task_add( funcp func, t_res delay );
-uint8_t scheduler_task_remove( funcp func );
-void scheduler_init(void);
-uint32_t scheduler_tasklist( void);
-
-#endif // SCHEDULE_H
diff --git a/mig_test/synthesis/Makefile b/mig_test/synthesis/Makefile
deleted file mode 100644
index 66be99b..0000000
--- a/mig_test/synthesis/Makefile
+++ /dev/null
@@ -1,474 +0,0 @@
-#
-# $HeadURL: https://svn.fzd.de/repo/concast/FWF_Projects/FWKE/beam_position_monitor/trunk/hardware/board_prototyp1/synthesis/Makefile $
-# $Date$
-# $Author$
-# $Revision$
-#
-
-MODULE = top
-DEVICE = xc6slx100
-SPEEDGRADE = 2
-PACKAGE = fgg484
-UCF_FILE = top.ucf
-CORES = ../cores/
-SOFTWARE = ../software
-BMM_FILE = zpu.bmm
-BMM_BD_FILE = zpu_bd.bmm
-
-BUILDDIR = isebuild
-DEVICE_DPS = $(DEVICE)-$(PACKAGE)-$(SPEEDGRADE)
-DATE = $(shell date +"%Y-%m-%d__%H_%M")
-LOGFILE = synthesis_log_$(DATE).txt
-export XST_LOGFILE := $(LOGFILE)
-
-
-define XST_FILE
-set -tmpdir "projnav.tmp"
-set -xsthdpdir "xst"
-run
--ifn ../$(MODULE).prj
--ifmt mixed
--ofn $(MODULE)
--ofmt NGC
--p $(DEVICE)-$(SPEEDGRADE)-$(PACKAGE)
--top $(MODULE)
--opt_mode Speed
--opt_level 1
--power NO
--iuc NO
--keep_hierarchy No
--netlist_hierarchy As_Optimized
--rtlview Yes
--glob_opt AllClockNets
--read_cores YES
--write_timing_constraints NO
--cross_clock_analysis NO
--hierarchy_separator /
--bus_delimiter <>
--case Maintain
--slice_utilization_ratio 100
--bram_utilization_ratio 100
--dsp_utilization_ratio 100
--lc Auto
--reduce_control_sets Auto
--fsm_extract YES -fsm_encoding Auto
--safe_implementation No
--fsm_style LUT
--ram_extract Yes
--ram_style Auto
--rom_extract Yes
--shreg_extract YES
--rom_style Auto
--auto_bram_packing NO
--resource_sharing YES
--async_to_sync NO
--shreg_min_size 2
--use_dsp48 Auto
--iobuf YES
--max_fanout 100000
--bufg 16
--register_duplication YES
--register_balancing No
--optimize_primitives NO
--use_clock_enable Auto
--use_sync_set Auto
--use_sync_reset Auto
--iob Auto
--equivalent_register_removal YES
--slice_utilization_ratio_maxmargin 5
--infer_ramb8 No
-endef
-
-# 16k
-define BMM16
-ADDRESS_SPACE zpu_i0_memory
- RAMB16 [0x00000000:0x00003fff]
- BUS_BLOCK
- box_i0/dualport_ram_ahb_wrapper_i0/dualport_ram_i0/Mram_ram8 [31:28];
- box_i0/dualport_ram_ahb_wrapper_i0/dualport_ram_i0/Mram_ram7 [27:24];
- box_i0/dualport_ram_ahb_wrapper_i0/dualport_ram_i0/Mram_ram6 [23:20];
- box_i0/dualport_ram_ahb_wrapper_i0/dualport_ram_i0/Mram_ram5 [19:16];
- box_i0/dualport_ram_ahb_wrapper_i0/dualport_ram_i0/Mram_ram4 [15:12];
- box_i0/dualport_ram_ahb_wrapper_i0/dualport_ram_i0/Mram_ram3 [11: 8];
- box_i0/dualport_ram_ahb_wrapper_i0/dualport_ram_i0/Mram_ram2 [ 7: 4];
- box_i0/dualport_ram_ahb_wrapper_i0/dualport_ram_i0/Mram_ram1 [ 3: 0];
- END_BUS_BLOCK;
-END_ADDRESS_SPACE;
-endef
-
-# 32k
-define BMM
-ADDRESS_SPACE zpu_core_medium_i0_memory
- RAMB16 [0x00000000:0x00007fff]
- BUS_BLOCK
- box_i0/dualport_ram_ahb_wrapper_i0/dualport_ram_i0/Mram_ram16 [31:30];
- box_i0/dualport_ram_ahb_wrapper_i0/dualport_ram_i0/Mram_ram15 [29:28];
- box_i0/dualport_ram_ahb_wrapper_i0/dualport_ram_i0/Mram_ram14 [27:26];
- box_i0/dualport_ram_ahb_wrapper_i0/dualport_ram_i0/Mram_ram13 [25:24];
- box_i0/dualport_ram_ahb_wrapper_i0/dualport_ram_i0/Mram_ram12 [23:22];
- box_i0/dualport_ram_ahb_wrapper_i0/dualport_ram_i0/Mram_ram11 [21:20];
- box_i0/dualport_ram_ahb_wrapper_i0/dualport_ram_i0/Mram_ram10 [19:18];
- box_i0/dualport_ram_ahb_wrapper_i0/dualport_ram_i0/Mram_ram9 [17:16];
- box_i0/dualport_ram_ahb_wrapper_i0/dualport_ram_i0/Mram_ram8 [15:14];
- box_i0/dualport_ram_ahb_wrapper_i0/dualport_ram_i0/Mram_ram7 [13:12];
- box_i0/dualport_ram_ahb_wrapper_i0/dualport_ram_i0/Mram_ram6 [11:10];
- box_i0/dualport_ram_ahb_wrapper_i0/dualport_ram_i0/Mram_ram5 [ 9: 8];
- box_i0/dualport_ram_ahb_wrapper_i0/dualport_ram_i0/Mram_ram4 [ 7: 6];
- box_i0/dualport_ram_ahb_wrapper_i0/dualport_ram_i0/Mram_ram3 [ 5: 4];
- box_i0/dualport_ram_ahb_wrapper_i0/dualport_ram_i0/Mram_ram2 [ 3: 2];
- box_i0/dualport_ram_ahb_wrapper_i0/dualport_ram_i0/Mram_ram1 [ 1: 0];
- END_BUS_BLOCK;
-END_ADDRESS_SPACE;
-endef
-
-
-define UT_FILE
--w
--g INIT_9K:Yes
--g DebugBitstream:No
--g Binary:no
--g CRC:Enable
--g Reset_on_err:Yes
--g ConfigRate:26
--g ProgPin:PullUp
--g TckPin:PullUp
--g TdiPin:PullUp
--g TdoPin:PullUp
--g TmsPin:PullUp
--g UnusedPin:PullDown
--g UserID:0xFFFFFFFF
--g ExtMasterCclk_en:No
--g SPI_buswidth:4
--g TIMER_CFG:0xFFFF
--g multipin_wakeup:No
--g StartUpClk:CClk
--g DONE_cycle:4
--g GTS_cycle:5
--g GWE_cycle:6
--g LCK_cycle:NoWait
--g Security:None
--g DonePipe:No
--g DriveDone:No
--g en_sw_gsr:No
--g drive_awake:No
--g sw_clk:Startupclk
--g sw_gwe_cycle:5
--g sw_gts_cycle:4
-endef
-
-
-define PROGRAM_FPGA_FILE
-setMode -bscan
-setCable -port auto
-Identify
-assignFile -p 1 -file "$(MODULE)_update.bit"
-Program -p 1
-closeCable
-quit
-endef
-
-
-define PROGRAM_SPI_FILE
-setMode -bs
-setCable -port auto
-Identify -inferir
-identifyMPM
-attachflash -position 1 -spi "W25Q64BV"
-assignfiletoattachedflash -position 1 -file "$(MODULE)_update.mcs"
-Program -p 1 -dataWidth 4 -spionly -e -v -loadfpga
-closeCable
-quit
-endef
-
-
-export XST_FILE := $(XST_FILE)
-export BMM := $(BMM)
-export UT_FILE := $(UT_FILE)
-export PROGRAM_FPGA_FILE := $(PROGRAM_FPGA_FILE)
-export PROGRAM_SPI_FILE := $(PROGRAM_SPI_FILE)
-
-
-all:
- @echo "check - look for timing and other synthesis issues"
- @echo "xst - generate ngc file (netlist, replaces edif and netlist constrains)"
- @echo "translate - generate ngd file (native generic database [reduced to primitives])"
- @echo "map - generate ncd file (native ciruit description)"
- @echo "par - place&route ncd file (design implementation)"
- @echo "trace - generate timing report"
- @echo "bitgen - generate bit file (ncd -> bit)"
- @echo "update - update bitstream with elf file"
- @echo "program - program fpga with bit file"
- @echo "genmcs - genrate mcs file"
- @echo "genbin - genrate bin(ary) file"
- @echo "progspi - program spi flash with mcs file"
- @echo "clean"
- @echo "..."
- @echo "softflow - just update fpga with software (software update program)"
- @echo "testflow - time software bitgen trace update program check"
- @echo "finalflow - time software bitgen trace update progspi check"
-
-
-softflow:
- make software update program
-
-testflow:
- time $(MAKE) software bitgen trace update program check 2>&1 | tee $(XST_LOGFILE)
-
-finalflow:
- time $(MAKE) software bitgen trace update progspi check 2>&1 | tee $(XST_LOGFILE)
-
-
-check:
- @echo -e "Timing score: "
- @grep --with-filename "Timing Score" $(BUILDDIR)/*.par
- @echo -e "\nUnwanted Latches (737): "
- @grep --with-filename "WARNING:Xst:737" $(BUILDDIR)/*.syr || echo -n
- @echo -e "\nUnassigned signals (653): "
- @grep --with-filename "WARNING:Xst:653" $(BUILDDIR)/*.syr || echo -n
- @echo -e "\nInternal tristates (2042): "
- @grep --with-filename "WARNING:Xst:2042" $(BUILDDIR)/*.syr || echo -n
- @echo -e "\nCombinatoric loops (2170): "
- @grep --with-filename "WARNING:Xst:2170" $(BUILDDIR)/*.syr || echo -n
- @echo -e "\nGated clocks (372): "
- @grep --with-filename "WARNING:PhysDesignRules:372" $(BUILDDIR)/*.bgn || echo -n
-
-
-software: sw_timestamp
- ###
- #############################################################################
- ### (re)compile software
- ###
- test ! -d $(SOFTWARE) || make all --directory $(SOFTWARE)
-
-
-sw_timestamp:
- ###
- #############################################################################
- #### update sw timestamp
- ###
- test ! -d $(SOFTWARE) || make --always-make timestamp --directory $(SOFTWARE)
-
-
-update: $(BUILDDIR)/$(MODULE).bit
- ###
- #############################################################################
- ### update the bitfile
- ###
- test ! -d $(SOFTWARE) || data2mem -bm $(BMM_BD_FILE) -bd $(SOFTWARE)/*.elf -bt $(BUILDDIR)/$(MODULE).bit -o b $(MODULE)_update.bit
- test -d $(SOFTWARE) || cp $(BUILDDIR)/$(MODULE).bit $(MODULE)_update.bit
-
-
-program:
- ###
- #############################################################################
- ### configure FPGA
- ###
- echo "$$PROGRAM_FPGA_FILE" > program_fpga.cmd
- impact -batch program_fpga.cmd
-
-
-genbin: $(MODULE)_update.bin
-
-$(MODULE)_update.bin: $(MODULE)_update.bit
- ###
- #############################################################################
- ### generate flash file, bin format for manual flashing
- ###
- promgen -b -p bin -w -o $(MODULE)_update.bin -u 0 $(MODULE)_update.bit
-
-
-genmcs: $(MODULE)_update.mcs
-
-$(MODULE)_update.mcs: $(MODULE)_update.bit
- ###
- #############################################################################
- ### generate flash file
- ###
- promgen -spi -p mcs -w -o $(MODULE)_update.mcs -s 8192 -u 0 $(MODULE)_update.bit
-
-
-progspi: genmcs
- ###
- #############################################################################
- ### program flash
- ###
- echo "$$PROGRAM_SPI_FILE" > program_spi.cmd
- impact -batch program_spi.cmd
-
-
-clean:
- rm -f $(MODULE).prj
- rm -f *.log
- rm -f _impact.cmd
- rm -f *.cfi
- rm -f *.prm
- rm -rf $(BUILDDIR)
- rm -rf _ngo
- rm -rf _xmsgs
- rm -f $(BMM_FILE)
- rm -f $(BMM_BD_FILE)
- rm -f $(MODULE).xst
- rm -f $(MODULE).ut
- rm -f program_fpga.cmd
- rm -f program_spi.cmd
-
-
-dir: $(MODULE).prj
- ###
- #############################################################################
- ### generate build directory
- ###
- mkdir -p $(BUILDDIR)
- mkdir -p $(BUILDDIR)/projnav.tmp
-
-
-
-$(MODULE).prj: ../vhdl_files.txt
- ###
- #############################################################################
- ### generate project file
- ###
- grep --invert rtl_tb ../vhdl_files.txt | grep --invert "\#" | grep --invert "^$$" | awk '{printf "vhdl %s ../%s\n",$$1,$$2}' > $(MODULE).prj
-
-
-xst: $(MODULE).ngc
-translate: $(MODULE).ngd
-map: $(MODULE)_map.ncd
-par: $(MODULE).ncd
-
-
-hw_timestamp:
- ###
- #############################################################################
- #### update hw timestamp
- ###
- test ! -f ../rtl/Makefile || make --directory ../rtl
-
-$(MODULE).ngc: dir hw_timestamp
- ###
- #############################################################################
- ### synthesis
- ###
- echo "$$XST_FILE" > $(MODULE).xst
- cd $(BUILDDIR) ; xst -ifn ../$(MODULE).xst -ofn $(MODULE).syr
-
-
-$(MODULE).ngd: $(MODULE).ngc $(UCF_FILE)
- ###
- #############################################################################
- ### translate
- ###
- echo "$$BMM" > $(BMM_FILE)
- cd $(BUILDDIR) ; ngdbuild -dd _ngo -nt timestamp -uc ../$(UCF_FILE) -bm ../$(BMM_FILE) -p $(DEVICE_DPS) -sd ../$(CORES) $(MODULE).ngc $(MODULE).ngd
-
-$(MODULE)_map.ncd: $(MODULE).ngd
- ###
- #############################################################################
- ### map
- ###
- @# explanation of map parameters:
- @# -p part number
- @# -mt multi-threading
- @# -w overwrite existing files
- @# -logic_opt logic optimization
- @# -ol overall effor level (std|high)
- @# -t placer cost table
- @# -xt extra placer cost table (0..5)
- @# -register_duplication duplicate registers
- @# -global_opt Global Optimization (off|speed|area|power)
- @# -ir ignore RLOCs
- @# -pr pack registers in IO (off|i|o|b)
- @# -lc lut combining (auto|area|off)
- @# -power Virtex 6 Power Optimization (on|off|high|xe)
- @# -detail Generate Detailed MAP Report
- @# -o Output File Name
- @# -bp enables block RAM mapping
- cd $(BUILDDIR) ; export XIL_MAP_NODRC; export XIL_PAR_DESIGN_CHECK_VERBOSE=1; export XIL_PAR_ALLOW_LVDS_LOC_OVERRIDE=1; map -p $(DEVICE_DPS) -mt 1 -w -logic_opt off -ol high -t 22 -xt 5 -register_duplication on -global_opt off -ir off -pr b -lc off -power off -detail -o $(MODULE)_map.ncd $(MODULE).ngd $(MODULE).pcf
-
-
-$(MODULE).ncd: $(MODULE)_map.ncd
- ###
- #############################################################################
- ### place & route
- ###
- @# -ol = Overall effort level. high is maximum effort.
- @# Default: high except Virtex-4 and Spartan-3 architectures
- @# std (standard) for older architectures
- @# -pl = Placer effort level. high is maximum effort. Overrides
- @# any placer effort level implied by "-ol" option.
- @# Default: high for Virtex-4 and Spartan-3 architectures
- @# Not supported for newer architectures.
- @# -rl = Router effort level. high is maximum effort. Overrides
- @# any router effort level implied by "-ol" option.
- @# Default: high for Virtex-4 and Spartan-3 architectures
- @# Not supported for newer architectures
- @# -xe = Extra effort level. c (Continue on Impossible) is maximum effort.
- @# Default: none
- @# -mt = Multi-threading enabled. 4 is the maximum number of threads.
- @# Default: off except Virtex-4 and Spartan-3 architectures
- @# Supported only for newer architectures.
- @# -t = Placer cost table entry. Start at this entry.
- @# Default: 1 for Virtex-4 and Spartan-3 architectures
- @# Not supported for newer architectures
- @# -p = Don't run the placer. (Keep current placement)
- @# -k = Re-entrant route. Keep the current placement. Continue the routing
- @# using the existing routing as a starting point.
- @# -r = Don't run the router.
- @# -w = Overwrite. Allows overwrite of an existing file (including input
- @# file). If specified output is a directory, allows files in
- @# directory to be overwritten.
- @# -f = Read par command line arguments and switches from file.
- @# -filter = Message Filter file name (for example "filter.filter"). If
- @# specified, the contents of this file will be used to filter messages
- @# from this application. The filter file can be created using Xreport.
- @# -smartguide = Enables SmartGuide using guidefile.ncd as the guide file.
- @# -x = Ignore user timing constraints in physical constraints file and
- @# generate timing constraints automatically for all internal clocks to
- @# increase performance. Note: the level of performance achieved will
- @# be dictated by the effort level (-ol std|high) chosen.
- @# -nopad = Turns off generation of the pad report.
- @# Default: Pad Report Generated
- @# -power = Power Aware Par. Optimizes the capacitance of non-timing-driven
- @# design signals.
- @# Default: off
- @# -activityfile <activityfile.vcd|saif> = Switching activity data file to
- @# guide power optimization. This option is only valid if the
- @# "-power on" option has been used.
- @# -intstyle = Indicate contextual information when invoking Xilinx applications
- @# within a flow or project environment.
- @# The mode "xflow" indicates that the program is being run as part of a
- @# batch flow. The mode "silent" indicates that no output will be
- @# displayed to the screen. The mode "ise" indicates that the program is being
- @# run as part of an integrated design environment.
- @# Default: Program is run as a standalone application.
- @# -ise = Use supplied ISE project repository file.
- @# -ntd = Ignore Timing constraints in physical constraints file and do NOT
- @# generate timing constraints automatically.
- @# <infile> = Name of input NCD file.
- @# <outfile> = Name of output NCD file or output directory.
- @# Use format "<outfile>.ncd" or "<outfile>.dir".
- @# <pcffile> = Name of physical constraints file.
- cd $(BUILDDIR) ; par -w -ol high $(MODULE)_map.ncd $(MODULE).ncd $(MODULE).pcf
-
-
-trace:
- cd $(BUILDDIR) ; trce -v 5 -u 100 -fastpaths -xml $(MODULE).twx -o $(MODULE).twr $(MODULE).ncd $(MODULE).pcf
-
-
-bitgen: $(MODULE).ncd
- ###
- #############################################################################
- ### generate bitfile
- ###
- echo "$$UT_FILE" > $(MODULE).ut
- cd $(BUILDDIR) ; bitgen -f ../$(MODULE).ut $(MODULE).ncd
-
-
-firmware: $(MODULE)_update.mcs $(MODULE)_update.bin
- mkdir -p firmware_$(DATE)
- cp Makefile firmware_$(DATE)
- cp $(MODULE)_update.bit firmware_$(DATE)
- cp $(MODULE)_update.bin firmware_$(DATE)
- cp $(MODULE)_update.mcs firmware_$(DATE)
- zip -r firmware_$(DATE) firmware_$(DATE)/*
-
diff --git a/mig_test/synthesis/top.ucf b/mig_test/synthesis/top.ucf
deleted file mode 100644
index 6223064..0000000
--- a/mig_test/synthesis/top.ucf
+++ /dev/null
@@ -1,312 +0,0 @@
-# voltage
-CONFIG VCCAUX = "2.5";
-
-
-## system stuff
-#125MHz clock
-NET CLK LOC = AA12 | IOSTANDARD = LVCMOS33;
-#NET RESET_N LOC = A4 | IOSTANDARD = LVCMOS33 | PULLDOWN;
-NET POWER_FAIL_N LOC = A2; # IO_L83P_3
-NET WATCHDOG LOC = V9 | IOSTANDARD = LVCMOS33; # WATCHDOG INPUT, IO_L50N_2
-
-## user clock
-NET user_clk LOC = Y13; # U12
-
-## DDR3 SDRAM
-NET MCB1_DRAM_A<0> LOC = F21 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_A<1> LOC = F22 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_A<2> LOC = E22 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_A<3> LOC = G20 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_A<4> LOC = F20 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_A<5> LOC = K20 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_A<6> LOC = K19 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_A<7> LOC = E20 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_A<8> LOC = C20 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_A<9> LOC = C22 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_A<10> LOC = G19 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_A<11> LOC = F19 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_A<12> LOC = D22 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_A<13> LOC = D19 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_A<14> LOC = D20 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_BA<0> LOC = J17 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_BA<1> LOC = K17 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_BA<2> LOC = H18 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_CAS_B LOC = H22 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_CKE LOC = D21 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_CK_N LOC = J19 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_CK_P LOC = H20 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_DQ<0> LOC = N20 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_DQ<1> LOC = N22 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_DQ<2> LOC = M21 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_DQ<3> LOC = M22 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_DQ<4> LOC = J20 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_DQ<5> LOC = J22 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_DQ<6> LOC = K21 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_DQ<7> LOC = K22 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_DQ<8> LOC = P21 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_DQ<9> LOC = P22 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_DQ<10> LOC = R20 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_DQ<11> LOC = R22 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_DQ<12> LOC = U20 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_DQ<13> LOC = U22 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_DQ<14> LOC = V21 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_DQ<15> LOC = V22 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_LDM LOC = L19 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_DQS_N<0> LOC = L22 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_DQS_P<0> LOC = L20 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_ODT LOC = G22 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_RAS_B LOC = H21 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_RESET_B LOC = F18 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_UDM LOC = M20 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_DQS_N<1> LOC = T22 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_DQS_P<1> LOC = T21 | IOSTANDARD = SSTL15_II;
-NET MCB1_DRAM_WE_B LOC = H19 | IOSTANDARD = SSTL15_II;
-#
-NET MCB3_DRAM_A<0> LOC = H2 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_A<1> LOC = H1 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_A<2> LOC = H5 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_A<3> LOC = K6 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_A<4> LOC = F3 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_A<5> LOC = K3 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_A<6> LOC = J4 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_A<7> LOC = H6 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_A<8> LOC = E3 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_A<9> LOC = E1 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_A<10> LOC = G4 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_A<11> LOC = C1 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_A<12> LOC = D1 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_A<13> LOC = G6 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_A<14> LOC = F5 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_BA<0> LOC = G3 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_BA<1> LOC = G1 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_BA<2> LOC = F1 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_CAS_B LOC = K4 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_CKE LOC = D2 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_CK_N LOC = H3 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_CK_P LOC = H4 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_DQ<0> LOC = N3 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_DQ<1> LOC = N1 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_DQ<2> LOC = M2 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_DQ<3> LOC = M1 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_DQ<4> LOC = J3 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_DQ<5> LOC = J1 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_DQ<6> LOC = K2 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_DQ<7> LOC = K1 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_DQ<8> LOC = P2 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_DQ<9> LOC = P1 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_DQ<10> LOC = R3 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_DQ<11> LOC = R1 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_DQ<12> LOC = U3 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_DQ<13> LOC = U1 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_DQ<14> LOC = V2 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_DQ<15> LOC = V1 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_LDM LOC = L4 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_DQS_N<0> LOC = L1 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_DQS_P<0> LOC = L3 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_ODT LOC = J6 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_RAS_B LOC = K5 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_RESET_B LOC = C3 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_UDM LOC = M3 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_DQS_N<1> LOC = T1 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_DQS_P<1> LOC = T2 | IOSTANDARD = SSTL15_II;
-NET MCB3_DRAM_WE_B LOC = F2 | IOSTANDARD = SSTL15_II;
-
-## Ethernet PHY
-#NET PHY_125 LOC = AA12; # used as clk
-NET PHY_MDIO LOC = AB3;
-NET PHY_MDC LOC = AA2 | IOSTANDARD = LVCMOS33;
-NET PHY_INT LOC = AB2;
-NET PHY_RESET_B LOC = T15 | IOSTANDARD = LVCMOS33;
-NET PHY_CRS LOC = T14;
-NET PHY_COL LOC = R13;
-NET PHY_TXEN LOC = AB16 | IOSTANDARD = LVCMOS33;
-NET PHY_TXCLK LOC = W12;
-NET PHY_TXER LOC = AB18 | IOSTANDARD = LVCMOS33;
-NET PHY_TXD<0> LOC = AA18 | IOSTANDARD = LVCMOS33;
-NET PHY_TXD<1> LOC = AB14 | IOSTANDARD = LVCMOS33;
-NET PHY_TXD<2> LOC = AA16 | IOSTANDARD = LVCMOS33;
-NET PHY_TXD<3> LOC = W14 | IOSTANDARD = LVCMOS33;
-NET PHY_TXD<4> LOC = T16 | IOSTANDARD = LVCMOS33;
-NET PHY_TXD<5> LOC = Y14 | IOSTANDARD = LVCMOS33;
-NET PHY_TXD<6> LOC = V15 | IOSTANDARD = LVCMOS33;
-NET PHY_TXD<7> LOC = AA14 | IOSTANDARD = LVCMOS33;
-NET PHY_GTXCLK LOC = R11 | IOSTANDARD = LVCMOS33;
-NET PHY_RXCLK LOC = Y11;
-NET PHY_RXER LOC = Y8;
-NET PHY_RXDV LOC = Y4;
-NET PHY_RXD<0> LOC = Y3;
-NET PHY_RXD<1> LOC = W8;
-NET PHY_RXD<2> LOC = W4;
-NET PHY_RXD<3> LOC = U9;
-NET PHY_RXD<4> LOC = V7;
-NET PHY_RXD<5> LOC = V5;
-NET PHY_RXD<6> LOC = W9;
-NET PHY_RXD<7> LOC = U6;
-
-## quad SPI Flash (W25Q64BV)
-NET SPI_FLASH_CSO_B LOC = T5 | IOSTANDARD = LVCMOS33;
-NET SPI_FLASH_CCLK LOC = Y21 | IOSTANDARD = LVCMOS33;
-NET SPI_FLASH_IO<0> LOC = AB20; # MOSI/di
-NET SPI_FLASH_IO<1> LOC = AA20; # MISO/do
-NET SPI_FLASH_IO<2> LOC = U14; # MISO2/wp_n
-NET SPI_FLASH_IO<3> LOC = U13; # MISO3/hold_n
-
-## EEPROM (48bit MAC address, DS2502-E48)
-NET MAC_DATA LOC = T11 | IOSTANDARD = LVCMOS33;
-
-## B2B J1 user IO
-NET B2B_B2_L57_N LOC = AB4;
-NET B2B_B2_L57_P LOC = AA4;
-NET B2B_B2_L49_N LOC = AB6;
-NET B2B_B2_L49_P LOC = AA6;
-#
-NET B2B_B2_L48_N LOC = AB7;
-NET B2B_B2_L48_P LOC = Y7;
-NET B2B_B2_L45_N LOC = AB8;
-NET B2B_B2_L45_P LOC = AA8;
-#
-NET B2B_B2_L43_N LOC = AB9;
-NET B2B_B2_L43_P LOC = Y9;
-NET B2B_B2_L41_N LOC = AB10;
-NET B2B_B2_L41_P LOC = AA10;
-#
-NET B2B_B2_L21_P LOC = Y15;
-NET B2B_B2_L21_N LOC = AB15;
-NET B2B_B2_L15_P LOC = Y17;
-NET B2B_B2_L15_N LOC = AB17;
-#
-NET B2B_B2_L31_N LOC = AB12; # single ended
-#
-NET B2B_B2_L32_N LOC = AB11; # single ended
-#
-NET B2B_B2_L60_P LOC = T7;
-NET B2B_B2_L60_N LOC = R7;
-NET B2B_B2_L59_N LOC = R8;
-NET B2B_B2_L59_P LOC = R9;
-#
-NET B2B_B2_L44_N LOC = Y10;
-NET B2B_B2_L44_P LOC = W10;
-NET B2B_B2_L42_N LOC = W11;
-NET B2B_B2_L42_P LOC = V11;
-#
-NET B2B_B2_L18_P LOC = V13;
-NET B2B_B2_L18_N LOC = W13;
-NET B2B_B2_L8_N LOC = U16;
-NET B2B_B2_L8_P LOC = U17;
-#
-NET B2B_B2_L11_P LOC = V17;
-NET B2B_B2_L11_N LOC = W17;
-NET B2B_B2_L6_P LOC = W18 | IOSTANDARD = LVCMOS33;
-NET B2B_B2_L6_N LOC = Y18;
-#
-NET B2B_B2_L5_P LOC = Y19;
-NET B2B_B2_L5_N LOC = AB19;
-NET B2B_B2_L9_N LOC = V18;
-NET B2B_B2_L9_P LOC = V19;
-#
-NET B2B_B2_L4_N LOC = T17;
-NET B2B_B2_L4_P LOC = T18;
-#
-NET B2B_B2_L29_N LOC = Y12; # single ended
-#
-NET B2B_B2_L10_N LOC = R15;
-NET B2B_B2_L10_P LOC = R16;
-NET B2B_B2_L2_N LOC = AB21;
-NET B2B_B2_L2_P LOC = AA21;
-
-
-## B2B J2 user IO
-NET B2B_B3_L60_N LOC = B1;
-NET B2B_B3_L60_P LOC = B2;
-#
-NET B2B_B3_L9_N LOC = T3 | IOSTANDARD = LVCMOS15;
-NET B2B_B3_L9_P LOC = T4 | IOSTANDARD = LVCMOS15;
-NET B2B_B0_L3_P LOC = D6;
-NET B2B_B0_L3_N LOC = C6;
-#
-NET B2B_B3_L59_P LOC = J7 | IOSTANDARD = LVCMOS15;
-NET B2B_B3_L59_N LOC = H8 | IOSTANDARD = LVCMOS15;
-NET B2B_B0_L32_P LOC = D7;
-NET B2B_B0_L32_N LOC = D8;
-#
-NET B2B_B0_L7_N LOC = C8;
-NET B2B_B0_L7_P LOC = D9;
-NET B2B_B0_L33_N LOC = C10;
-NET B2B_B0_L33_P LOC = D10;
-#
-NET B2B_B0_L36_P LOC = D11;
-NET B2B_B0_L36_N LOC = C12;
-NET B2B_B0_L49_P LOC = D14;
-NET B2B_B0_L49_N LOC = C14;
-#
-NET B2B_B0_L62_P LOC = D15;
-NET B2B_B0_L62_N LOC = C16;
-NET B2B_B0_L66_P LOC = E16;
-NET B2B_B0_L66_N LOC = D17;
-#
-NET B2B_B1_L10_P LOC = F16;
-NET B2B_B1_L10_N LOC = F17;
-NET B2B_B1_L9_P LOC = G16;
-NET B2B_B1_L9_N LOC = G17;
-#
-NET B2B_B1_L21_N LOC = J16;
-NET B2B_B1_L21_P LOC = K16;
-NET B2B_B1_L61_P LOC = L17;
-NET B2B_B1_L61_N LOC = K18;
-#
-NET B2B_B0_L1 LOC = A4; # used as reset_n
-#
-NET B2B_B0_L2_P LOC = C5;
-NET B2B_B0_L2_N LOC = A5;
-NET B2B_B0_L4_N LOC = A6;
-NET B2B_B0_L4_P LOC = B6;
-#
-NET B2B_B0_L5_N LOC = A7;
-NET B2B_B0_L5_P LOC = C7;
-NET B2B_B0_L6_N LOC = A8;
-NET B2B_B0_L6_P LOC = B8;
-#
-NET B2B_B0_L8_N LOC = A9;
-NET B2B_B0_L8_P LOC = C9;
-NET B2B_B0_L34_N LOC = A10;
-NET B2B_B0_L34_P LOC = B10;
-#
-NET B2B_B0_L35_N LOC = A11;
-NET B2B_B0_L35_P LOC = C11;
-NET B2B_B0_L37_N LOC = A12;
-NET B2B_B0_L37_P LOC = B12;
-#
-NET B2B_B0_L38_N LOC = A13;
-NET B2B_B0_L38_P LOC = C13;
-NET B2B_B0_L50_N LOC = A14;
-NET B2B_B0_L50_P LOC = B14;
-#
-NET B2B_B0_L51_N LOC = A15;
-NET B2B_B0_L51_P LOC = C15;
-NET B2B_B0_L63_N LOC = A16;
-NET B2B_B0_L63_P LOC = B16;
-#
-NET B2B_B0_L64_N LOC = A17;
-NET B2B_B0_L64_P LOC = C17;
-NET B2B_B0_L65_N LOC = A18;
-NET B2B_B0_L65_P LOC = B18;
-#
-NET B2B_B1_L20_P LOC = A20;
-NET B2B_B1_L20_N LOC = A21;
-NET B2B_B1_L19_P LOC = B21;
-NET B2B_B1_L19_N LOC = B22;
-NET B2B_B1_L59 LOC = P19;
-
-
-## misc
-NET USER_LED_N LOC = T20 | IOSTANDARD = LVCMOS15; # on board LED
-NET AV<0> LOC = U19 | PULLUP | TIG;
-NET AV<1> LOC = V20 | PULLUP | TIG;
-NET AV<2> LOC = M17 | PULLUP | TIG;
-NET AV<3> LOC = M18 | PULLUP | TIG;
-NET BR<0> LOC = P17 | PULLUP | TIG;
-NET BR<1> LOC = N16 | PULLUP | TIG;
-NET BR<2> LOC = P18 | PULLUP | TIG;
-NET BR<3> LOC = R19 | PULLUP | TIG;
-
-NET reprog_n LOC = H16 | IOSTANDARD = "LVCMOS15"; #REPROGRAMMING
diff --git a/mig_test/vhdl_files.txt b/mig_test/vhdl_files.txt
deleted file mode 100644
index a94534a..0000000
--- a/mig_test/vhdl_files.txt
+++ /dev/null
@@ -1,93 +0,0 @@
-work rtl/top.vhd
-work rtl/box.vhd
-work rtl/timestamp.vhd
-work rtl_tb/top_tb.vhd
-
-grlib ../grlib/rtl/ahbctrl.vhd
-grlib ../grlib/rtl/amba.vhd
-grlib ../grlib/rtl/apbctrl.vhd
-grlib ../grlib/rtl/config.vhd
-grlib ../grlib/rtl/devices.vhd
-grlib ../grlib/rtl/stdlib.vhd
-grlib ../grlib/rtl/testlib.vhd
-grlib ../grlib/rtl/util.vhd
-grlib ../grlib/rtl/version.vhd
-grlib ../grlib/rtl_tb/stdio.vhd
-
-hzdr ../hzdr/rtl/devices_hzdr.vhd
-hzdr ../hzdr/rtl/component_package.vhd
-hzdr ../hzdr/rtl/debug_con_apb.vhd
-
-gaisler ../gaisler/rtl/ahbdpram.vhd
-gaisler ../gaisler/rtl/ahbram.vhd
-gaisler ../gaisler/rtl/apbuart.vhd
-gaisler ../gaisler/rtl/grgpio.vhd
-gaisler ../gaisler/rtl/uart.vhd
-gaisler ../gaisler/rtl/gptimer.vhd
-gaisler ../gaisler/rtl/misc.vhd
-gaisler ../gaisler/rtl/net.vhd
-gaisler ../gaisler/rtl/memctrl.vhd
-gaisler ../gaisler/rtl/memoryctrl.vhd
-gaisler ../gaisler/rtl_tb/sim.vhd
-gaisler ../gaisler/rtl/greth.vhd
-gaisler ../gaisler/rtl/ethernet_mac.vhd
-
-eth ../gaisler/rtl/greth_pkg.vhd
-eth ../gaisler/rtl/greth_rx.vhd
-eth ../gaisler/rtl/greth_tx.vhd
-eth ../gaisler/rtl/grethc.vhd
-eth ../gaisler/rtl/eth_ahb_mst.vhd
-eth ../gaisler/rtl/eth_rstgen.vhd
-eth ../gaisler/rtl/ethcomp.vhd
-
-techmap ../techmap/rtl/allmem.vhd
-techmap ../techmap/rtl/gencomp.vhd
-techmap ../techmap/rtl/memory_inferred.vhd
-techmap ../techmap/rtl/memory_unisim.vhd
-techmap ../techmap/rtl/syncram_2p.vhd
-techmap ../techmap/rtl/syncram_dp.vhd
-techmap ../techmap/rtl/syncrambw.vhd
-techmap ../techmap/rtl/syncram.vhd
-techmap ../techmap/rtl/netcomp.vhd
-
-zpu rtl/zpu_config.vhd
-zpu rtl/dualport_ram.vhd
-zpu ../zpu/rtl/dualport_ram_ahb_wrapper.vhd
-zpu ../zpu/rtl/zpu_ahb.vhd
-zpu ../zpu/rtl/zpu_bus_trace.vhd
-zpu ../zpu/rtl/zpu_core_medium.vhd
-zpu ../zpu/rtl/zpu_core_small.vhd
-zpu ../zpu/rtl/zpu_wrapper_package.vhd
-zpu ../zpu/rtl/zpupkg.vhd
-zpu ../zpu/rtl_tb/sim_small_fpga_top_noint.vhd
-zpu ../zpu/rtl_tb/txt_util.vhd
-
-
-# MIG example design
-work cores/mig_v3_61/example_design/rtl/example_top.vhd
-work cores/mig_v3_61/example_design/rtl/iodrp_controller.vhd
-work cores/mig_v3_61/example_design/rtl/iodrp_mcb_controller.vhd
-work cores/mig_v3_61/example_design/rtl/mcb_raw_wrapper.vhd
-work cores/mig_v3_61/example_design/rtl/mcb_soft_calibration.vhd
-work cores/mig_v3_61/example_design/rtl/mcb_soft_calibration_top.vhd
-work cores/mig_v3_61/example_design/rtl/memc1_infrastructure.vhd
-work cores/mig_v3_61/example_design/rtl/memc1_tb_top.vhd
-work cores/mig_v3_61/example_design/rtl/memc1_wrapper.vhd
-work cores/mig_v3_61/example_design/rtl/memc3_infrastructure.vhd
-work cores/mig_v3_61/example_design/rtl/memc3_tb_top.vhd
-work cores/mig_v3_61/example_design/rtl/memc3_wrapper.vhd
-work cores/mig_v3_61/example_design/rtl/traffic_gen/afifo.vhd
-work cores/mig_v3_61/example_design/rtl/traffic_gen/cmd_gen.vhd
-work cores/mig_v3_61/example_design/rtl/traffic_gen/cmd_prbs_gen.vhd
-work cores/mig_v3_61/example_design/rtl/traffic_gen/data_prbs_gen.vhd
-work cores/mig_v3_61/example_design/rtl/traffic_gen/init_mem_pattern_ctr.vhd
-work cores/mig_v3_61/example_design/rtl/traffic_gen/mcb_flow_control.vhd
-work cores/mig_v3_61/example_design/rtl/traffic_gen/mcb_traffic_gen.vhd
-work cores/mig_v3_61/example_design/rtl/traffic_gen/rd_data_gen.vhd
-work cores/mig_v3_61/example_design/rtl/traffic_gen/read_data_path.vhd
-work cores/mig_v3_61/example_design/rtl/traffic_gen/read_posted_fifo.vhd
-work cores/mig_v3_61/example_design/rtl/traffic_gen/sp6_data_gen.vhd
-work cores/mig_v3_61/example_design/rtl/traffic_gen/tg_status.vhd
-work cores/mig_v3_61/example_design/rtl/traffic_gen/v6_data_gen.vhd
-work cores/mig_v3_61/example_design/rtl/traffic_gen/wr_data_gen.vhd
-work cores/mig_v3_61/example_design/rtl/traffic_gen/write_data_path.vhd
diff --git a/rechner/uts/bin/wakeonlan b/rechner/uts/bin/wakeonlan
deleted file mode 100644
index 4b435ce..0000000
--- a/rechner/uts/bin/wakeonlan
+++ /dev/null
@@ -1,262 +0,0 @@
-#!/usr/bin/perl -w
-#
-# $Id: wakeonlan,v 1.4.2.3 2005/01/27 16:03:54 jpo Exp $
-#
-#########################################################################
-
-use strict;
-use Net::hostent;
-use Socket;
-use Getopt::Std;
-use vars qw($VERSION $opt_v $opt_h $opt_i $opt_p $opt_f);
-$VERSION = '0.41';
-
-my $DEFAULT_IP = '255.255.255.255';
-my $DEFAULT_PORT = getservbyname('discard', 'udp');
-
-#
-# Process the command line
-#
-
-getopts("hvp:i:f:");
-
-if ($opt_h) { usage(); exit(0); }
-if ($opt_v) { print "wakeonlan version $VERSION\n"; exit(0); }
-if (!$opt_f and !@ARGV) { usage(); exit(0); }
-if ($opt_i) { $DEFAULT_IP = $opt_i; } # override default value
-if ($opt_p) { $DEFAULT_PORT = $opt_p; } # override default value
-
-if ($opt_f) { process_file($opt_f); }
-
-# The rest of the command line is a list of hardware addresses
-
-foreach (@ARGV) {
- wake($_, $opt_i, $opt_p);
-}
-
-#
-# wake
-#
-# The 'magic packet' consists of 6 times 0xFF followed by 16 times
-# the hardware address of the NIC. This sequence can be encapsulated
-# in any kind of packet, in this case an UDP packet targeted at the
-# discard port (9).
-#
-
-sub wake
-{
- my $host = shift;
- my $ipaddr = shift || $DEFAULT_IP;
- my $port = shift || $DEFAULT_PORT;
-
- my ($raddr, $them, $proto);
- my ($hwaddr, $hwaddr_re, $pkt);
-
- # get the hardware address (ethernet address)
-
- $hwaddr_re = join(':', ('[0-9A-Fa-f]{1,2}') x 6);
- if ($host =~ m/^$hwaddr_re$/) {
- $hwaddr = $host;
- } else {
- # $host is not a hardware address, try to resolve it
- my $ip_re = join('\.', ('([0-9]|[1-9][0-9]|1[0-9]{2}|2([0-4][0-9]|5[0-5]))') x 4);
- my $ip_addr;
- if ($host =~ m/^$ip_re$/) {
- $ip_addr = $host;
- } else {
- my $h;
- unless ($h = gethost($host)) {
- warn "$host is not a hardware address and I could not resolve it as to an IP address.\n";
- return undef;
- }
- $ip_addr = inet_ntoa($h->addr);
- }
- # look up ip in /etc/ethers
- unless (open (ETHERS, '<', '/etc/ethers')) {
- warn "$host is not a hardware address and I could not open /etc/ethers.\n";
- return undef;
- }
- while (<ETHERS>) {
- if (($_ !~ m/^$/) && ($_ !~ m/^#/)) { # ignore comments
- my ($mac, $ip);
- ($mac, $ip) = split(' ', $_, 3);
- if ($ip =~ m/^$ip$/) {
- if ($ip eq $ip_addr) {
- $hwaddr = $mac;
- last;
- }
- next;
- } else {
- my $h2;
- unless ($h2 = gethost($ip)) {
- next;
- }
- if (inet_ntoa($h2->addr) eq $ip_addr) {
- $hwaddr = $mac;
- last;
- }
- }
- }
- }
- close (ETHERS);
- unless (defined($hwaddr)) {
- warn "Could not find $host in /etc/ethers\n";
- return undef;
- }
- }
-
- # Generate magic sequence
-
- foreach (split /:/, $hwaddr) {
- $pkt .= chr(hex($_));
- }
- $pkt = chr(0xFF) x 6 . $pkt x 16;
-
- # Allocate socket and send packet
-
- $raddr = gethostbyname($ipaddr)->addr;
- $them = pack_sockaddr_in($port, $raddr);
- $proto = getprotobyname('udp');
-
- socket(S, AF_INET, SOCK_DGRAM, $proto) or die "socket : $!";
- setsockopt(S, SOL_SOCKET, SO_BROADCAST, 1) or die "setsockopt : $!";
-
- print "Sending magic packet to $ipaddr:$port with $hwaddr\n";
-
- send(S, $pkt, 0, $them) or die "send : $!";
- close S;
-}
-
-#
-# process_file
-#
-
-sub process_file {
- my $filename = shift;
- my ($hwaddr, $ipaddr, $port);
-
- open (F, "<$filename") or die "open : $!";
- while(<F>) {
- next if /^\s*#/; # ignore comments
- next if /^\s*$/; # ignore empty lines
-
- chomp;
- ($hwaddr, $ipaddr, $port) = split;
-
- wake($hwaddr, $ipaddr, $port);
- }
- close F;
-}
-
-
-#
-# Usage
-#
-
-sub usage {
-print <<__USAGE__;
-Usage
- wakeonlan [-h] [-v] [-i IP_address] [-p port] [-f file] [[hardware_address] ...]
-
-Options
- -h
- this information
- -v
- displays the script version
- -i ip_address
- set the destination IP address
- default: 255.255.255.255 (the limited broadcast address)
- -p port
- set the destination port
- default: 9 (the discard port)
- -f file
- uses file as a source of hardware addresses
-
-See also
- wakeonlan(1)
-
-__USAGE__
-}
-
-
-__END__
-
-# Script documentation
-
-=head1 NAME
-
-wakeonlan - Perl script to wake up computers
-
-=head1 SYNOPSIS
-
-wakeonlan [-h] [-v] [-i IP_address] [-p port] [-f file] [[hardware_address] ...]
-
-=head1 DESCRIPTION
-
-This script sends 'magic packets' to wake-on-lan enabled ethernet adapters and motherboards, in order to switch on the called PC. Be sure to connect the NIC with the motherboard if neccesary, and enable the WOL function in the BIOS.
-
-The 'magic packet' consists of 6 times 0xFF followed by 16 times the hardware address of the NIC. This sequence can be encapsulated in any kind of packet. This script uses UDP packets.
-
-=head1 OPTIONS
-
-=over
-
-=item B<-h>
-
-Displays the help information.
-
-=item B<-v>
-
-Displays the script version.
-
-=item B<-i ip_address>
-
-Destination IP address. Unless you have static ARP tables you should
-use some kind of broadcast address (the broadcast address of the network where the computer resides or the limited broadcast address). Default: 255.255.255.255 (the limited broadcast address).
-
-=item B<-p port>
-
-Destination port. Default: 9 (the discard port).
-
-=item B<-f file>
-
-File with hardware addresses of wakeable computers. For an example check
-the file lab001.wol in the examples subdirectory.
-
-=back
-
-=head1 EXAMPLES
-
-Using the limited broadcast address (255.255.255.255):
-
- $ wakeonlan 01:02:03:04:05:06
- $ wakeonlan 01:02:03:04:05:06 01:02:03:04:05:07
-
-Using a subnet broadcast address:
-
- $ wakeonlan -i 192.168.1.255 01:02:03:04:05:06
-
-Using another destination port:
-
- $ wakeonlan -i 192.168.1.255 -p 1234 01:02:03:04:05:06
-
-Using a file as source of hardware and IP addresses:
-
- $ wakeonlan -f examples/lab001.wol
- $ wakeonlan -f examples/lab001.wol 01:02:03:04:05:06
-
-=head1 AUTHOR
-
-Jose Pedro Oliveira <jpo@di.uminho.pt> maintaining and expanding original work done by Ico Doornekamp <ico@edd.dhs.org>.
-
-=head1 COPYRIGHT
-
-Copyright (c) 2000-2005 Jose Pedro Oliveira.
-
-This is free software. You may modify it and distribute it under Perl's Artistic Licence. Modified versions must be clearly indicated.
-
-=head1 SEE ALSO
-
-For more information regarding this script and Wakeonlan technology just check the following address http://gsd.di.uminho.pt/jpo/software/wakeonlan/.
-
-=cut
diff --git a/rechner/uts/startconnection.sh b/rechner/uts/startconnection.sh
deleted file mode 100644
index bb53571..0000000
--- a/rechner/uts/startconnection.sh
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/bin/sh
-IP=172.16.24.3
-MAC=00:02:B3:4C:1F:5F
-TIME=75
-
-# W71XP-Praktik
-# 172.16.103.108
-#MAC=00:0F:EA:DE:DF:A9
-
-#Tine
-#IP=172.16.100.144
-#MAC=00:11:11:13:e7:12
-
-# Ute
-#IP=172.16.100.148
-#MAC=00:13:D3:62:F2:09
-
-# felix
-#MAC=00:30:05:cf:4a:62
-#IP=172.16.101.8
-
-warten()
-{
- i=0;
- while [ $i -lt $1 ] ;
- do echo -n "." ;
- let i++;
- sleep 1;
- done
-}
-
-echo "-------------------------"
-echo "preventive wake up"
-echo "-------------------------"
-~/bin/wakeonlan $MAC
-
-echo "-------------------------"
-echo $IP online?
-echo "-------------------------"
-ping -q -c 1 $IP
-
-while test $? -eq "1";
-do
-
- echo "-------------------------"
- echo "waiting $TIME s"
- echo "-------------------------"
- warten $TIME
-
- ping -q -c 1 $IP
-done
-
-echo "-------------------------"
-echo "$IP is already online!"
-echo "connect with ssh"
-echo "-------------------------"
-ssh $IP -X $*
diff --git a/set_mod_bits.sh b/set_mod_bits.sh
deleted file mode 100644
index 7f0af4b..0000000
--- a/set_mod_bits.sh
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/bin/sh
-
-find -iname "*.vhd" -type f -executable -print0 | xargs -0 chmod -x
-
-find -iname "*.txt" -type f -executable -print0 | xargs -0 chmod -x
-find -iname "*.pdf" -type f -executable -print0 | xargs -0 chmod -x
-find -iname "*.png" -type f -executable -print0 | xargs -0 chmod -x
-
-find -iname "*.vym" -type f -executable -print0 | xargs -0 chmod -x
-find -iname "*.dot" -type f -executable -print0 | xargs -0 chmod -x
-find -iname "*.odt" -type f -executable -print0 | xargs -0 chmod -x
-find -iname "*.odg" -type f -executable -print0 | xargs -0 chmod -x
-find -iname "*.doc" -type f -executable -print0 | xargs -0 chmod -x
-find -iname "*.docx" -type f -executable -print0 | xargs -0 chmod -x
-find -iname "*.xls" -type f -executable -print0 | xargs -0 chmod -x
-find -iname "*.xlsx" -type f -executable -print0 | xargs -0 chmod -x
-
-find -iname "*.ucf" -type f -executable -print0 | xargs -0 chmod -x
-find -iname "*.bmm" -type f -executable -print0 | xargs -0 chmod -x
-find -iname "*.cmd" -type f -executable -print0 | xargs -0 chmod -x
-find -iname "*.xise" -type f -executable -print0 | xargs -0 chmod -x
-
-find -iname "*.log" -type f -executable -print0 | xargs -0 chmod -x
-find -iname modelsim.ini -type f -executable -print0 | xargs -0 chmod -x
-
-find -iname "*.c" -type f -executable -print0 | xargs -0 chmod -x
-find -iname "*.cpp" -type f -executable -print0 | xargs -0 chmod -x
-find -iname "*.h" -type f -executable -print0 | xargs -0 chmod -x
-
-find -iname "*.in" -type f -executable -print0 | xargs -0 chmod -x
-find -iname "*.help" -type f -executable -print0 | xargs -0 chmod -x
-
-find -iname Makefile -type f -executable -print0 | xargs -0 chmod -x
-find -iname "*.do" -type f -executable -print0 | xargs -0 chmod -x
-
-find -iname "*.tar.gz" -type f -executable -print0 | xargs -0 chmod -x
-find -iname "*.zip" -type f -executable -print0 | xargs -0 chmod -x
-
-find -iname "*.php" -type f -executable -print0 | xargs -0 chmod -x
-find -iname "*.js" -type f -executable -print0 | xargs -0 chmod -x
-find -iname "*.css" -type f -executable -print0 | xargs -0 chmod -x
-
-find -iname "*.sch" -type f -executable -print0 | xargs -0 chmod -x
-find -iname "*.brd" -type f -executable -print0 | xargs -0 chmod -x
-find -iname "*.lbr" -type f -executable -print0 | xargs -0 chmod -x
-
-# fix group
-find -not -group None -print0 | xargs -0 chown :None
-
-# svn stuff
-DIR=.
-EXCLUDE=-and -not -path './xc3sprog'
-find $DIR -type f -name "Makefile" $EXCLUDE -exec svn propset svn:keywords "Date Author Id Revision HeadURL" {} \;
-find $DIR -type f -name "*.vhd" $EXCLUDE -exec svn propset svn:keywords "Date Author Id Revision HeadURL" {} \;
-find $DIR -type f -name "*.h" $EXCLUDE -exec svn propset svn:keywords "Date Author Id Revision HeadURL" {} \;
-find $DIR -type f -name "*.c" $EXCLUDE -exec svn propset svn:keywords "Date Author Id Revision HeadURL" {} \;
diff --git a/test_rrobin_problem/readme.txt b/test_rrobin_problem/readme.txt
deleted file mode 100644
index d4de6d8..0000000
--- a/test_rrobin_problem/readme.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-auf der Suche nach der Ursache warum am AHB mit mehreren Mastern
-und rrobin = 0 nix mehr geht
-
-offenbar baut XST Mist
-
-Testszenario:
-
-* zwei Master, die eine GPIO-LED umschalten
-* Hardware: Board SP601
-
-Problem: im Testszenario funktioniert alles erwartungsgemäß :-(
-
-
-Versuch auf neuer (alter) Hardware: Digilent S3E-Starterkit
-
--use_new_parser No
-mit rrobin = 1 --> work testflow ca. 180 sek
-mit rrobin = 0 --> fail testflow ca. 180 sek
-
--use_new_parser Yes
-mit rrobin = 1 --> work testflow ca. 85 sek
-mit rrobin = 0 --> work testflow ca. 65 sek
-
-
-Ergo: Problem tritt nur auf Spartan3E-Board mit "rrobin = 0" auf.
-evtl. testen Funktion auf Spartan 3
diff --git a/test_rrobin_problem/rtl/box.vhd b/test_rrobin_problem/rtl/box.vhd
deleted file mode 100644
index c651746..0000000
--- a/test_rrobin_problem/rtl/box.vhd
+++ /dev/null
@@ -1,229 +0,0 @@
---------------------------------------------------------------------------------
--- $Date$
--- $Author$
--- $Revision$
---------------------------------------------------------------------------------
-
-library ieee;
-use ieee.std_logic_1164.all;
-use ieee.numeric_std.all;
-
-library gaisler;
-use gaisler.misc.all; -- types
-use gaisler.uart.all; -- types
-use gaisler.net.all; -- types
-use gaisler.uart.apbuart;
-use gaisler.misc.grgpio;
-
-library grlib;
-use grlib.amba.all;
-
-library techmap;
-use techmap.gencomp.all; -- constants
-
-
-entity box is
- generic (
- time_factor : positive := 2500
- );
- port (
- clk : in std_ulogic;
- reset_n : in std_ulogic;
- --
- uarti : in uart_in_type;
- uarto : out uart_out_type;
- --
- gpioi : in gpio_in_type;
- gpioo : out gpio_out_type
- );
-end entity box;
-
-
-architecture rtl of box is
-
- signal ahbctrl_i0_msti : ahb_mst_in_type;
- signal ahbmo : ahb_mst_out_vector := (others => ahbm_none);
- signal ahbctrl_i0_slvi : ahb_slv_in_type;
- signal ahbso : ahb_slv_out_vector := (others => ahbs_none);
- signal apbctrl_i0_apbi : apb_slv_in_type;
- signal apbo : apb_slv_out_vector := (others => apb_none);
- --
- signal grgpio_i0_gpioo : gpio_out_type;
-
-
-begin
-
-
- ---------------------------------------------------------------------
- --
- led_control_ahb_i0: entity work.led_control_ahb
- generic map (
- hindex => 0, -- : integer := 0;
- count => 20 * time_factor, -- : natural := 0;
- gpio_data => x"00000000" -- : std_logic_vector(31 downto 0)
- )
- port map (
- -- system
- clk => clk, -- : in std_ulogic;
- -- ahb
- ahbi => ahbctrl_i0_msti, -- : in ahb_mst_in_type;
- ahbo => ahbmo(0) -- : out ahb_mst_out_type
- );
- ---------------------------------------------------------------------
-
-
- ---------------------------------------------------------------------
- --
- led_control_ahb_i1: entity work.led_control_ahb
- generic map (
- hindex => 1, -- : integer := 0;
- count => 20 * time_factor + 3, -- : natural := 0;
- gpio_data => x"0000000f" -- : std_logic_vector(31 downto 0)
- )
- port map (
- -- system
- clk => clk, -- : in std_ulogic;
- -- ahb
- ahbi => ahbctrl_i0_msti, -- : in ahb_mst_in_type;
- ahbo => ahbmo(1) -- : out ahb_mst_out_type
- );
- ---------------------------------------------------------------------
-
-
- ---------------------------------------------------------------------
- -- AHB CONTROLLER
-
- --ahbmo(0) <= (ahbm_none);
- --ahbmo(1) <= (ahbm_none);
- ahbmo(2) <= (ahbm_none);
- ahbmo(3) <= (ahbm_none);
- --
- --ahbso(0) <= (ahbs_none); -- apbctrl_i0
- ahbso(1) <= (ahbs_none);
- ahbso(2) <= (ahbs_none);
- ahbso(3) <= (ahbs_none);
- ahbso(4) <= (ahbs_none); -- spimctrl
- ahbso(5) <= (ahbs_none); -- mctrl
- ahbso(6) <= (ahbs_none);
- ahbso(7) <= (ahbs_none);
-
- ahbctrl_i0 : ahbctrl -- AHB arbiter/multiplexer
- generic map (
- defmast => 0, -- default master
- --
- --
- rrobin => 0, -- round robin arbitration
- --
- --
- timeout => 11,
- disirq => 0, -- enable interrupt routing
- enbusmon => 0, -- enable bus monitor
- assertwarn => 1, -- enable assertions for warnings
- asserterr => 1 -- enable assertions for errors
- )
- port map (
- rst => reset_n, -- : in std_ulogic;
- clk => clk, -- : in std_ulogic;
- msti => ahbctrl_i0_msti, -- : out ahb_mst_in_type;
- msto => ahbmo, -- : in ahb_mst_out_vector;
- slvi => ahbctrl_i0_slvi, -- : out ahb_slv_in_type;
- slvo => ahbso, -- : in ahb_slv_out_vector;
- testen => '0',
- testrst => '1',
- scanen => '0',
- testoen => '1'
- );
- ----------------------------------------------------------------------
-
-
-
-
- ---------------------------------------------------------------------
- -- AHB/APB bridge
-
- apbo( 0) <= (apb_none);
- --apbo( 1) <= (apb_none); -- apbuart_i0
- apbo( 2) <= (apb_none); -- no gptimer_i0
- apbo( 3) <= (apb_none);
- --apbo( 4) <= (apb_none); -- grgpio_i0
- apbo( 5) <= (apb_none);
- apbo( 6) <= (apb_none); -- no apbvga_i0
- apbo( 7) <= (apb_none); -- no i2cmst_i0
- apbo( 8) <= (apb_none);
- apbo( 9) <= (apb_none);
- apbo(10) <= (apb_none); -- no i2cmst_i1
- apbo(11) <= (apb_none);
- apbo(12) <= (apb_none);
- apbo(13) <= (apb_none);
- apbo(14) <= (apb_none);
- apbo(15) <= (apb_none); -- no mctrl_i0
-
- apbctrl_i0: apbctrl
- generic map (
- hindex => 0, -- : integer := 0;
- haddr => 16#800#, -- : integer := 0;
- nslaves => 16, -- : integer range 1 to NAPBSLV := NAPBSLV;
- asserterr => 1,
- assertwarn => 1
- )
- port map (
- rst => reset_n, -- : in std_ulogic;
- clk => clk, -- : in std_ulogic;
- ahbi => ahbctrl_i0_slvi, -- : in ahb_slv_in_type;
- ahbo => ahbso(0), -- : out ahb_slv_out_type;
- apbi => apbctrl_i0_apbi, -- : out apb_slv_in_type;
- apbo => apbo -- : in apb_slv_out_vector
- );
- ----------------------------------------------------------------------
-
-
- ---------------------------------------------------------------------
- -- uart
- apbuart_i0: apbuart
- generic map (
- pindex => 1,
- paddr => 1,
- console => 1, -- fast simulation output
- parity => 0, -- no parity
- flow => 1, -- hardware handshake
- fifosize => 16
- )
- port map (
- rst => reset_n, -- : in std_ulogic;
- clk => clk, -- : in std_ulogic;
- apbi => apbctrl_i0_apbi, -- : in apb_slv_in_type;
- apbo => apbo(1), -- : out apb_slv_out_type;
- uarti => uarti, -- : in uart_in_type;
- uarto => uarto -- : out uart_out_type);
- );
- ---------------------------------------------------------------------
-
-
- ---------------------------------------------------------------------
- -- GPIO
- grgpio_i0: grgpio
- generic map (
- pindex => 4,
- paddr => 4,
- syncrst => 1, -- only synchronous reset
- nbits => 32 -- number of port bits
- )
- port map (
- rst => reset_n,
- clk => clk,
- apbi => apbctrl_i0_apbi,
- apbo => apbo(4),
- gpioi => gpioi,
- gpioo => grgpio_i0_gpioo
- );
- gpioo <= grgpio_i0_gpioo;
- -- gpio.dout gpio.din
- ---------------------------------------------------------------------
- -- 3 - 0 LED gpio_switch
- -- 7 - 4 unused gpio_button
- -- 15 - 8 header gpio_header_ls
- -- 30 - 16 unused
- -- 31 unused simulation_active
- ---------------------------------------------------------------------
-
-end architecture rtl;
diff --git a/test_rrobin_problem/rtl/led_control_ahb.vhd b/test_rrobin_problem/rtl/led_control_ahb.vhd
deleted file mode 100644
index b1105a1..0000000
--- a/test_rrobin_problem/rtl/led_control_ahb.vhd
+++ /dev/null
@@ -1,137 +0,0 @@
---------------------------------------------------------------------------------
--- $Date$
--- $Author$
--- $Revision$
---------------------------------------------------------------------------------
-
-library ieee;
-use ieee.std_logic_1164.all;
-
-library grlib;
-use grlib.amba.all;
-use grlib.stdlib.all;
-use grlib.devices.all;
-
-library hzdr;
-use hzdr.devices_hzdr.all;
-
-
-entity led_control_ahb is
- generic(
- hindex : integer := 0;
- count : natural := 0;
- gpio_data : std_logic_vector(31 downto 0)
- );
- port (
- -- system
- clk : in std_ulogic;
- -- ahb
- ahbi : in ahb_mst_in_type;
- ahbo : out ahb_mst_out_type
- );
-end entity led_control_ahb;
-
-
-architecture rtl of led_control_ahb is
-
- constant revision_c : integer := 0;
- constant hconfig_c : ahb_config_type := (
- 0 => ahb_device_reg ( VENDOR_HZDR, 255, 0, revision_c, 0),
- others => (others => '0')
- );
-
- constant gpio_addr_c : std_ulogic_vector(31 downto 0) := x"80000404";
-
- constant default_ahb_mst_out_c : ahb_mst_out_type := (
- hbusreq => '0',
- hlock => '0',
- htrans => HTRANS_IDLE,
- haddr => (others => '0'),
- hwrite => '0',
- hsize => HSIZE_WORD,
- hburst => HBURST_SINGLE,
- hprot => "0001",
- hwdata => (others => '0'),
- hirq => (others => '0'),
- hconfig => hconfig_c,
- hindex => hindex
- );
-
- type state_t is (IDLE, ADDR_PHASE, DATA_PHASE);
-
- type reg_t is record
- state : state_t;
- counter : natural;
- ahbo : ahb_mst_out_type;
- end record;
- constant default_reg_c : reg_t := (
- state => IDLE,
- counter => 0,
- ahbo => default_ahb_mst_out_c
- );
-
- signal r : reg_t := default_reg_c;
- signal r_in : reg_t;
-
-begin
-
- comb: process(r, ahbi)
- variable v : reg_t;
- begin
- ahbo <= r.ahbo;
- v := r;
-
- case v.state is
- when IDLE =>
- -- have reach right time?
- if v.counter < count then
- v.counter := v.counter + 1;
- else
- -- bus write request
- v.ahbo.hbusreq := '1';
- v.ahbo.htrans := HTRANS_NONSEQ;
- v.ahbo.haddr := std_logic_vector( gpio_addr_c);
- v.ahbo.hwrite := '1';
- -- have grant?
- if ahbi.hgrant( hindex) = '1' then
- v.state := ADDR_PHASE;
- end if;
- end if;
-
- when ADDR_PHASE =>
- v.ahbo.hbusreq := '0';
- v.ahbo.htrans := HTRANS_IDLE;
- v.ahbo.haddr := (others => '0');
- v.ahbo.hwrite := '0';
- v.ahbo.hwdata := gpio_data;
- v.state := DATA_PHASE;
-
-
- when DATA_PHASE =>
- v.ahbo.hwdata := (others => '0');
- v.counter := 0;
- v.state := IDLE;
-
- end case;
-
- r_in <= v;
- end process comb;
-
-
- seq: process
- begin
- wait until rising_edge( clk);
- r <= r_in;
- end process seq;
-
-
- -- pragma translate_off
- bootmsg : report_version
- generic map (
- "led_control_ahb" & tost( hindex) & ": rev " & tost( revision_c) & ", gpio_data: " & tost( gpio_data)
- );
- -- pragma translate_on
-
-
-end architecture rtl;
-
diff --git a/test_rrobin_problem/rtl/top.vhd b/test_rrobin_problem/rtl/top.vhd
deleted file mode 100644
index 16a6fa8..0000000
--- a/test_rrobin_problem/rtl/top.vhd
+++ /dev/null
@@ -1,535 +0,0 @@
--- top level des beam position monitor
--- für SP601
---
--- enthält alle buffer/treiber für die FPGA-Pins
---
---
-
---------------------------------------------------------------------------------
--- $Date$
--- $Author$
--- $Revision$
---------------------------------------------------------------------------------
-
-
-
-library ieee;
-use ieee.std_logic_1164.all;
-
-library unisim;
-use unisim.vcomponents.bufg;
-use unisim.vcomponents.iddr2;
-use unisim.vcomponents.ibufgds_diff_out;
-use unisim.vcomponents.ibufgds;
-use unisim.vcomponents.ibufds;
-use unisim.vcomponents.dcm_sp;
-use unisim.vcomponents.bufgmux;
-
-
-entity top is
- generic (
- time_factor : positive := 2500
- );
- port (
- cpu_reset : in std_logic; -- SW9 pushbutton (active-high)
- --
- -- DDR2 memory 128 MB
- ddr2_a : out std_logic_vector(12 downto 0);
- ddr2_ba : out std_logic_vector(2 downto 0);
- ddr2_cas_b : out std_logic;
- ddr2_ras_b : out std_logic;
- ddr2_we_b : out std_logic;
- ddr2_cke : out std_logic;
- ddr2_clk_n : out std_logic;
- ddr2_clk_p : out std_logic;
- ddr2_dq : inout std_logic_vector(15 downto 0);
- ddr2_ldm : out std_logic;
- ddr2_udm : out std_logic;
- ddr2_ldqs_n : inout std_logic;
- ddr2_ldqs_p : inout std_logic;
- ddr2_udqs_n : inout std_logic;
- ddr2_udqs_p : inout std_logic;
- ddr2_odt : out std_logic;
- --
- -- flash memory
- flash_a : out std_logic_vector(24 downto 0);
- flash_d : inout std_logic_vector(7 downto 3);
- --
- fpga_d0_din_miso_miso1 : inout std_logic; -- dual use
- fpga_d1_miso2 : inout std_logic; -- dual use
- fpga_d2_miso3 : inout std_logic; -- dual use
- flash_we_b : out std_logic;
- flash_oe_b : out std_logic;
- flash_ce_b : out std_logic;
- --
- -- FCM connector
- -- M2C Mezzanine to Carrier
- -- C2M Carrier to Mezzanine
- fmc_clk0_m2c_n : in std_logic;
- fmc_clk0_m2c_p : in std_logic;
- fmc_clk1_m2c_n : in std_logic;
- fmc_clk1_m2c_p : in std_logic;
- -- IIC addresses:
- -- M24C08: 1010100..1010111
- -- 2kb EEPROM on FMC card: 1010010
- iic_scl_main : inout std_logic;
- iic_sda_main : inout std_logic;
- fmc_la00_cc_n : inout std_logic;
- fmc_la00_cc_p : inout std_logic;
- fmc_la01_cc_n : inout std_logic;
- fmc_la01_cc_p : inout std_logic;
- fmc_la02_n : inout std_logic;
- fmc_la02_p : inout std_logic;
- fmc_la03_n : inout std_logic;
- fmc_la03_p : inout std_logic;
- fmc_la04_n : inout std_logic;
- fmc_la04_p : inout std_logic;
- fmc_la05_n : inout std_logic;
- fmc_la05_p : inout std_logic;
- fmc_la06_n : inout std_logic;
- fmc_la06_p : inout std_logic;
- fmc_la07_n : inout std_logic;
- fmc_la07_p : inout std_logic;
- fmc_la08_n : inout std_logic;
- fmc_la08_p : inout std_logic;
- fmc_la09_n : inout std_logic;
- fmc_la09_p : inout std_logic;
- fmc_la10_n : inout std_logic;
- fmc_la10_p : inout std_logic;
- fmc_la11_n : inout std_logic;
- fmc_la11_p : inout std_logic;
- fmc_la12_n : inout std_logic;
- fmc_la12_p : inout std_logic;
- fmc_la13_n : inout std_logic;
- fmc_la13_p : inout std_logic;
- fmc_la14_n : inout std_logic;
- fmc_la14_p : inout std_logic;
- fmc_la15_n : inout std_logic;
- fmc_la15_p : inout std_logic;
- fmc_la16_n : inout std_logic;
- fmc_la16_p : inout std_logic;
- fmc_la17_cc_n : inout std_logic;
- fmc_la17_cc_p : inout std_logic;
- fmc_la18_cc_n : inout std_logic;
- fmc_la18_cc_p : inout std_logic;
- fmc_la19_n : inout std_logic;
- fmc_la19_p : inout std_logic;
- fmc_la20_n : inout std_logic;
- fmc_la20_p : inout std_logic;
- fmc_la21_n : inout std_logic;
- fmc_la21_p : inout std_logic;
- fmc_la22_n : inout std_logic;
- fmc_la22_p : inout std_logic;
- fmc_la23_n : inout std_logic;
- fmc_la23_p : inout std_logic;
- fmc_la24_n : inout std_logic;
- fmc_la24_p : inout std_logic;
- fmc_la25_n : inout std_logic;
- fmc_la25_p : inout std_logic;
- fmc_la26_n : inout std_logic;
- fmc_la26_p : inout std_logic;
- fmc_la27_n : inout std_logic;
- fmc_la27_p : inout std_logic;
- fmc_la28_n : inout std_logic;
- fmc_la28_p : inout std_logic;
- fmc_la29_n : inout std_logic;
- fmc_la29_p : inout std_logic;
- fmc_la30_n : inout std_logic;
- fmc_la30_p : inout std_logic;
- fmc_la31_n : inout std_logic;
- fmc_la31_p : inout std_logic;
- fmc_la32_n : inout std_logic;
- fmc_la32_p : inout std_logic;
- fmc_la33_n : inout std_logic;
- fmc_la33_p : inout std_logic;
- fmc_prsnt_m2c_l : in std_logic;
- fmc_pwr_good_flash_rst_b : out std_logic; -- multiple destinations: 1 of Q2 (LED DS1 driver), U1 AB2 FPGA_PROG (through series R260 DNP), 44 of U25
- --
- -- ???
- fpga_awake : out std_logic;
- fpga_cclk : out std_logic;
- fpga_cmp_clk : in std_logic;
- fpga_cmp_cs_b : in std_logic;
- fpga_cmp_mosi : in std_logic;
- --
- fpga_hswapen : in std_logic;
- fpga_init_b : out std_logic; -- low active
- fpga_m0_cmp_miso : in std_logic; -- mode DIP switch SW1 active high
- fpga_m1 : in std_logic; -- mode DIP switch SW1 active high
- fpga_mosi_csi_b_miso0 : inout std_logic;
- fpga_onchip_term1 : inout std_logic;
- fpga_onchip_term2 : inout std_logic;
- --fpga_suspend : in std_logic;
- fpga_vtemp : in std_logic;
- --
- -- GPIOs
- gpio_button : in std_logic_vector(3 downto 0); -- active high
- gpio_header_ls : inout std_logic_vector(7 downto 0); --
- gpio_led : out std_logic_vector(3 downto 0);
- gpio_switch : in std_logic_vector(3 downto 0); -- active high
- --
- -- Ethernet Gigabit PHY,
- -- default settings:
- -- phy address = 0b00111
- -- ANEG[3..0] = "1111"
- -- ENA_XC = 1
- -- DIS_125 = 1
- -- HWCFG_MD[3..0] = "1111"
- -- DIS_FC = 1
- -- DIS_SLEEP = 1
- -- SEL_BDT = 0
- -- INT_POL = 1
- -- 75/50Ohm = 0
- phy_col : in std_logic;
- phy_crs : in std_logic;
- phy_int : out std_logic;
- phy_mdc : out std_logic;
- phy_mdio : inout std_logic;
- phy_reset : out std_logic;
- phy_rxclk : in std_logic;
- phy_rxctl_rxdv : in std_logic;
- phy_rxd : in std_logic_vector(7 downto 0);
- phy_rxer : in std_logic;
- phy_txclk : in std_logic;
- phy_txctl_txen : out std_logic;
- phy_txc_gtxclk : out std_logic;
- phy_txd : out std_logic_vector(7 downto 0);
- phy_txer : out std_logic;
- --
- --
- spi_cs_b : out std_logic;
- --
- -- 200 MHz oscillator, jitter 50 ppm
- sysclk_n : in std_logic;
- sysclk_p : in std_logic;
- --
- -- RS232 via USB
- usb_1_cts : out std_logic; -- function: RTS output
- usb_1_rts : in std_logic; -- function: CTS input
- usb_1_rx : out std_logic; -- function: TX data out
- usb_1_tx : in std_logic; -- function: RX data in
- --
- -- 27 MHz, oscillator socket
- user_clock : in std_logic;
- --
- -- user clock provided per SMA
- user_sma_clock_p : inout std_logic;
- user_sma_clock_n : inout std_logic
- );
-end entity top;
-
-
-
-
-library gaisler;
-use gaisler.misc.all; -- types
-use gaisler.uart.all; -- types
-
-
-architecture rtl of top is
-
- constant system_frequency_c : natural := 200_000_000;
-
- function simulation_active return std_ulogic is
- variable result : std_ulogic;
- begin
- result := '0';
- -- pragma translate_off
- result := '1';
- -- pragma translate_on
- return result;
- end function simulation_active;
-
- --
- -- signal definitions to resolve inout signals
- --
- signal sys_clk : std_ulogic;
- signal clk_box : std_ulogic;
- --
- signal reset_shreg : std_ulogic_vector(3 downto 0) := (others => '1');
- signal reset : std_ulogic := '1';
- signal reset_n : std_ulogic := '0';
- --
- signal uarti : uart_in_type;
- signal gpioi : gpio_in_type;
- --
- signal box_i0_uarto : uart_out_type;
- signal box_i0_gpioo : gpio_out_type;
-
-
-begin
-
-
- ------------------------------------------------------------
- -- clock stuff
- --
- clk_driver_b : block
- signal clk_fb0 : std_ulogic;
- signal dcm_sp_i0_clk0 : std_ulogic;
- signal dcm_sp_i0_clkfx : std_ulogic;
- signal dcm_sp_i0_clkdv : std_ulogic;
- signal dcm_sp_i0_clkdv_n : std_ulogic;
- signal clk_fb1 : std_ulogic;
- signal dcm_sp_i1_clk0 : std_ulogic;
- signal dcm_sp_i1_clk180 : std_ulogic;
- signal dcm_sp_i1_locked : std_ulogic;
- signal dcm_sp_i1_status : std_logic_vector(7 downto 0);
- begin
-
- -- global differential input buffer
- ibufgds_i0 : ibufgds
- generic map (
- diff_term => true
- )
- port map (
- i => sysclk_p,
- ib => sysclk_n,
- o => sys_clk
- );
-
- -- DCM
- dcm_sp_i0: dcm_sp
- generic map (
- clkin_divide_by_2 => false,
- clkdv_divide => 4.0,
- clkfx_multiply => 13,
- clkfx_divide => 25,
- clk_feedback => "1x"
- )
- port map (
- clkin => sys_clk,
- clk0 => dcm_sp_i0_clk0,
- clkdv => dcm_sp_i0_clkdv,
- clkfx => dcm_sp_i0_clkfx,
- clkfb => clk_fb0
- );
-
- clk_fb0 <= dcm_sp_i0_clk0;
- --clk_box <= dcm_sp_i0_clkfx; -- 52 MHz
- clk_box <= dcm_sp_i0_clk0; -- 200 MHz
-
- end block;
-
-
- ------------------------------------------------------------
- -- reset generation
- reset_generator_p: process
- begin
- wait until rising_edge( clk_box);
- reset_shreg <= reset_shreg(reset_shreg'left-1 downto 0) & '0';
- reset <= reset_shreg(reset_shreg'left);
- if cpu_reset = '1' then
- reset_shreg <= (others => '1');
- end if;
- end process;
- reset_n <= not reset;
-
-
-
-
--- chipscope_i0 : chipscope
--- port map (
--- clk => adc_clk_buf, --: in std_ulogic;
--- data => adc_data_16bit, --: in std_ulogic_vector(15 downto 0);
--- trig => '1' --: in std_ulogic
--- );
-
-
- -- default output drivers
- --
- fmc_la00_cc_n <= 'Z';
- fmc_la00_cc_p <= 'Z';
- fmc_la01_cc_n <= 'Z';
- fmc_la01_cc_p <= 'Z';
- fmc_la02_n <= 'Z';
- fmc_la02_p <= 'Z';
- fmc_la03_n <= 'Z';
- fmc_la03_p <= 'Z';
- fmc_la04_n <= 'Z';
- fmc_la04_p <= 'Z';
- fmc_la05_n <= 'Z';
- fmc_la05_p <= 'Z';
- fmc_la06_n <= 'Z';
- fmc_la06_p <= 'Z';
- fmc_la07_n <= 'Z';
- fmc_la07_p <= 'Z';
- fmc_la08_n <= 'Z';
- fmc_la08_p <= 'Z';
- fmc_la09_n <= 'Z';
- fmc_la09_p <= 'Z';
- fmc_la10_n <= 'Z';
- fmc_la10_p <= 'Z';
- fmc_la11_n <= 'Z';
- fmc_la11_p <= 'Z';
- fmc_la12_n <= 'Z';
- fmc_la12_p <= 'Z';
- fmc_la13_n <= 'Z';
- fmc_la13_p <= 'Z';
- fmc_la14_n <= 'Z';
- fmc_la14_p <= 'Z';
- fmc_la15_n <= 'Z';
- fmc_la15_p <= 'Z';
- fmc_la16_n <= 'Z';
- fmc_la16_p <= 'Z';
- fmc_la17_cc_n <= 'Z';
- fmc_la17_cc_p <= 'Z';
- fmc_la18_cc_n <= 'Z';
- fmc_la18_cc_p <= 'Z';
- fmc_la19_n <= 'Z';
- fmc_la19_p <= 'Z';
- fmc_la20_n <= 'Z';
- fmc_la20_p <= 'Z';
- fmc_la21_n <= 'Z';
- fmc_la21_p <= 'Z';
- fmc_la22_n <= 'Z';
- fmc_la22_p <= 'Z';
- fmc_la23_n <= 'Z';
- fmc_la23_p <= 'Z';
- fmc_la24_n <= 'Z';
- fmc_la24_p <= 'Z';
- fmc_la25_n <= 'Z';
- fmc_la25_p <= 'Z';
- fmc_la26_n <= 'Z';
- fmc_la26_p <= 'Z';
- fmc_la27_n <= 'Z';
- fmc_la27_p <= 'Z';
- fmc_la28_n <= 'Z';
- fmc_la28_p <= 'Z';
- fmc_la29_n <= 'Z';
- fmc_la29_p <= 'Z';
- fmc_la30_n <= 'Z';
- fmc_la30_p <= 'Z';
- fmc_la31_n <= 'Z';
- fmc_la31_p <= 'Z';
- fmc_la32_n <= 'Z';
- fmc_la32_p <= 'Z';
- fmc_la33_n <= 'Z';
- fmc_la33_p <= 'Z';
- fpga_awake <= 'Z';
- fpga_init_b <= '1';
- fpga_onchip_term1 <= 'Z';
- fpga_onchip_term2 <= 'Z';
- --
- ddr2_a <= (others => '1');
- ddr2_ba <= (others => '1');
- ddr2_cas_b <= '1';
- ddr2_ras_b <= '1';
- ddr2_we_b <= '1';
- ddr2_cke <= '0';
- ddr2_clk_n <= '0';
- ddr2_clk_p <= '1';
- ddr2_dq <= (others => 'Z');
- ddr2_ldm <= '0';
- ddr2_udm <= '0';
- ddr2_ldqs_n <= 'Z';
- ddr2_ldqs_p <= 'Z';
- ddr2_udqs_n <= 'Z';
- ddr2_udqs_p <= 'Z';
- ddr2_odt <= '1';
- --
- phy_int <= 'Z';
- phy_mdc <= '0';
- phy_mdio <= 'Z';
- phy_reset <= '0';
- phy_txc_gtxclk <= '0';
- phy_txctl_txen <= '0';
- phy_txd <= (others => '1');
- phy_txer <= '0';
- --
- user_sma_clock_p <= 'Z';
- user_sma_clock_n <= 'Z';
-
-
-
-
- ------------------------------------------------------------
- -- SPI memory pads
- -- SPI X4 (Winbond W25Q64VSFIG) 64-Mbit flash memory
- fpga_d2_miso3 <= 'Z'; -- /hold
- fpga_d1_miso2 <= 'Z'; -- /write_protect
- fpga_cclk <= '0';
- fpga_mosi_csi_b_miso0 <= 'Z';
- spi_cs_b <= 'Z';
-
-
- ------------------------------------------------------------
- -- BPI parallel flash
-
- -- inout
- fpga_d0_din_miso_miso1 <= 'Z';
- fpga_d1_miso2 <= 'Z';
- fpga_d2_miso3 <= 'Z';
- flash_d(7 downto 3) <= "ZZZZZ";
- -- out
- fmc_pwr_good_flash_rst_b <= reset_n;
- flash_ce_b <= '1';
- flash_oe_b <= '1';
- flash_we_b <= '1';
-
- flash_a <= (others => 'Z');
-
-
-
- ------------------------------------------------------------
- -- gpio input pads
- gpioi.sig_in <= (others => '0');
- gpioi.sig_en <= (others => '0');
- gpioi.din( 3 downto 0) <= std_logic_vector( gpio_switch);
- gpioi.din( 7 downto 4) <= gpio_button;
- gpioi.din(15 downto 8) <= gpio_header_ls;
- gpioi.din(30 downto 16) <= (others => '0');
- gpioi.din(31) <= simulation_active;
-
-
- ------------------------------------------------------------
- -- uart input
- uarti.rxd <= usb_1_tx; -- function: RX data in
- uarti.ctsn <= usb_1_rts; -- not( usb_1_rts); function: CTS input
- uarti.extclk <= '0';
-
- ------------------------------------------------------------
- -- box system
- box_i0: entity work.box
- generic map (
- time_factor => time_factor --: positive
- )
- port map (
- clk => clk_box, --: in std_ulogic;
- reset_n => reset_n, --: in std_ulogic;
- --
- uarti => uarti, --: in uart_in_type;
- uarto => box_i0_uarto, --: out uart_out_type;
- --
- gpioi => gpioi, --: in gpio_in_type;
- gpioo => box_i0_gpioo --: out gpio_out_type;
- );
-
- ------------------------------------------------------------
- -- gpio output pads
- -- placement on board: LED0, LED1, LED2, LED3
- gpio_led <= box_i0_gpioo.dout( 3 downto 0);
- --gpio_header_ls <= box_i0_gpioo.dout(15 downto 8);
- gpio_header_ls(0) <= box_i0_gpioo.dout( 8) when box_i0_gpioo.oen( 8) = '0' else 'Z';
- gpio_header_ls(1) <= box_i0_gpioo.dout( 9) when box_i0_gpioo.oen( 9) = '0' else 'Z';
- gpio_header_ls(2) <= box_i0_gpioo.dout(10) when box_i0_gpioo.oen(10) = '0' else 'Z';
- gpio_header_ls(3) <= box_i0_gpioo.dout(11) when box_i0_gpioo.oen(11) = '0' else 'Z';
- gpio_header_ls(4) <= box_i0_gpioo.dout(12) when box_i0_gpioo.oen(12) = '0' else 'Z';
- gpio_header_ls(5) <= box_i0_gpioo.dout(13) when box_i0_gpioo.oen(13) = '0' else 'Z';
- gpio_header_ls(6) <= box_i0_gpioo.dout(14) when box_i0_gpioo.oen(14) = '0' else 'Z';
- gpio_header_ls(7) <= box_i0_gpioo.dout(15) when box_i0_gpioo.oen(15) = '0' else 'Z';
- fpga_awake <= not box_i0_gpioo.dout( 0);
-
-
- ------------------------------------------------------------
- -- uart output
- usb_1_rx <= box_i0_uarto.txd; -- function: TX data out
- usb_1_cts <= box_i0_uarto.rtsn; -- function: RTS
-
-
- ------------------------------------------------------------
- -- fmc/main i2c io pads
- iic_scl_main <= 'Z';
-
- iic_sda_main <= 'Z';
-
-end architecture rtl;
diff --git a/test_rrobin_problem/rtl_tb/top_tb.vhd b/test_rrobin_problem/rtl_tb/top_tb.vhd
deleted file mode 100644
index b4b9e16..0000000
--- a/test_rrobin_problem/rtl_tb/top_tb.vhd
+++ /dev/null
@@ -1,465 +0,0 @@
--- top testbench
---
--- contains:
---
--- +--------------+
--- | board_sp601 |
--- | |XFMCX
--- | |XLPCX
--- | FPGA |
--- +--------------+
---
--- +-------------------------------------------------------------------------+
--- | top_tb (= eval board sp605) |
--- | |
--- | +----------------+ |
--- | | top (= FPGA) | |
--- | | | |
--- | | | |
--- | +----------------+ |
--- | *FMC LPC* |
--- | |
--- +-------------------------------------------------------------------------+
-
---------------------------------------------------------------------------------
--- $Date$
--- $Author$
--- $Revision$
---------------------------------------------------------------------------------
-
-entity top_tb is
-end entity top_tb;
-
-
-library ieee;
-use ieee.std_logic_1164.all;
-use ieee.numeric_std.all;
-
-library std;
-use std.textio.all;
-
-
-
-architecture testbench of top_tb is
-
-
- constant me_c : string := testbench'path_name;
-
- constant gnd : std_logic := '0';
-
- signal simulation_run : boolean := true;
- signal tb_simulation_break : std_logic;
-
-
- signal tb_cpu_reset : std_logic; -- SW6 pushbutton (active-high)
- --
- -- DDR2 memory
- signal tb_ddr2_a : std_logic_vector(12 downto 0);
- signal tb_ddr2_ba : std_logic_vector(2 downto 0);
- signal tb_ddr2_cas_b : std_logic;
- signal tb_ddr2_ras_b : std_logic;
- signal tb_ddr2_we_b : std_logic;
- signal tb_ddr2_cke : std_logic;
- signal tb_ddr2_clk_n : std_logic;
- signal tb_ddr2_clk_p : std_logic;
- signal tb_ddr2_dq : std_logic_vector(15 downto 0);
- signal tb_ddr2_ldm : std_logic;
- signal tb_ddr2_udm : std_logic;
- signal tb_ddr2_ldqs_n : std_logic;
- signal tb_ddr2_ldqs_p : std_logic;
- signal tb_ddr2_udqs_n : std_logic;
- signal tb_ddr2_udqs_p : std_logic;
- signal tb_ddr2_odt : std_logic;
- --
- -- flash memory
- signal tb_flash_a : std_logic_vector(24 downto 0);
- signal tb_flash_d : std_logic_vector( 7 downto 0);
- --
- signal tb_fpga_d0_din_miso_miso1 : std_logic; -- dual use
- signal tb_fpga_d1_miso2 : std_logic; -- dual use
- signal tb_fpga_d2_miso3 : std_logic; -- dual use
- signal tb_flash_we_b : std_logic;
- signal tb_flash_oe_b : std_logic;
- signal tb_flash_ce_b : std_logic;
- --
- -- FCM connector
- -- M2C Mezzanine to Carrier
- -- C2M Carrier to Mezzanine
- signal tb_iic_scl_main : std_logic;
- signal tb_iic_sda_main : std_logic;
- signal tb_fmc_prsnt_m2c_l : std_logic;
- signal tb_FMC_PWR_GOOD_FLASH_RST_B : std_logic; -- multiple destinations: 1 of Q2 (LED DS1 driver), U1 AB2 FPGA_PROG (through series R260 DNP), 44 of U25
- --
- -- ???
- signal tb_FPGA_AWAKE : std_logic;
- signal tb_FPGA_CCLK : std_logic;
- signal tb_FPGA_CMP_CLK : std_logic;
- signal tb_FPGA_CMP_CS_B : std_logic;
- signal tb_FPGA_CMP_MOSI : std_logic;
- --
- signal tb_FPGA_HSWAPEN : std_logic;
- signal tb_FPGA_INIT_B : std_logic;
- signal tb_FPGA_M0_CMP_MISO : std_logic;
- signal tb_FPGA_M1 : std_logic;
- signal tb_FPGA_MOSI_CSI_B_MISO0 : std_logic;
- signal tb_FPGA_ONCHIP_TERM1 : std_logic;
- signal tb_FPGA_ONCHIP_TERM2 : std_logic;
- signal tb_FPGA_VTEMP : std_logic;
- --
- -- GPIOs
- signal tb_gpio_button : std_logic_vector(3 downto 0); -- active high
- signal tb_gpio_header_ls : std_logic_vector(7 downto 0);
- signal tb_gpio_led : std_logic_vector(3 downto 0);
- signal tb_gpio_switch : std_logic_vector(3 downto 0); -- active high
- --
- -- Ethernet Gigabit PHY
- signal tb_PHY_COL : std_logic;
- signal tb_PHY_CRS : std_logic;
- signal tb_PHY_INT : std_logic;
- signal tb_PHY_MDC : std_logic;
- signal tb_PHY_MDIO : std_logic;
- signal tb_PHY_RESET : std_logic;
- signal tb_PHY_RXCLK : std_logic;
- signal tb_PHY_RXCTL_RXDV : std_logic;
- signal tb_PHY_RXD : std_logic_vector(7 downto 0);
- signal tb_PHY_RXER : std_logic;
- signal tb_PHY_TXCLK : std_logic;
- signal tb_PHY_TXCTL_TXEN : std_logic;
- signal tb_PHY_TXC_GTXCLK : std_logic;
- signal tb_PHY_TXD : std_logic_vector(7 downto 0);
- signal tb_PHY_TXER : std_logic;
- --
- --
- signal tb_SPI_CS_B : std_logic;
- --
- -- 200 MHz oscillator
- constant tb_sysclk_period : time := (1 sec / 200_000_000);
- signal tb_sysclk_n : std_logic := '0';
- signal tb_sysclk_p : std_logic := '1';
- --
- -- RS232 via USB
- signal tb_usb_1_cts : std_logic;
- signal tb_usb_1_rts : std_logic;
- signal tb_usb_1_rx : std_logic;
- signal tb_usb_1_tx : std_logic;
- --
- -- 27 MHz, oscillator socket
- constant tb_user_clock_period : time := (1 sec / 27_000_000);
- signal tb_user_clock : std_logic := '0';
- signal tb_user_sma_clock_p : std_logic;
- signal tb_user_sma_clock_n : std_logic;
- --
- --
- --
- signal tb_fmc_lpc_row_c : std_logic_vector(40 downto 1);
- signal tb_fmc_lpc_row_d : std_logic_vector(40 downto 1);
- signal tb_fmc_lpc_row_g : std_logic_vector(40 downto 1);
- signal tb_fmc_lpc_row_h : std_logic_vector(40 downto 1);
-
-
-begin
-
- -- clock generators
- tb_user_clock <= not tb_user_clock after tb_user_clock_period / 2 when simulation_run;
- tb_sysclk_n <= not tb_sysclk_n after tb_sysclk_period / 2 when simulation_run;
- tb_sysclk_p <= not tb_sysclk_p after tb_sysclk_period / 2 when simulation_run;
-
-
- -- stimuli for buttons and switches
- tb_gpio_button <= "0000", "0001" after 500 us, "0000" after 700 us;
- tb_gpio_switch <= "0000", "1111" after 600 us;
-
-
- top_i0: entity work.top
- generic map (
- time_factor => 1 --: positive
- )
- port map (
- cpu_reset => tb_cpu_reset, --: in std_logic; -- SW6 pushbutton (active-high)
- --
- -- DDR2 memory
- ddr2_a => tb_ddr2_a, --: out std_logic_vector(12 downto 0);
- ddr2_ba => tb_ddr2_ba, --: out std_logic_vector(2 downto 0);
- ddr2_cas_b => tb_ddr2_cas_b, --: out std_logic;
- ddr2_ras_b => tb_ddr2_ras_b, --: out std_logic;
- ddr2_we_b => tb_ddr2_we_b, --: out std_logic;
- ddr2_cke => tb_ddr2_cke, --: out std_logic;
- ddr2_clk_n => tb_ddr2_clk_n, --: out std_logic;
- ddr2_clk_p => tb_ddr2_clk_p, --: out std_logic;
- ddr2_dq => tb_ddr2_dq, --: inout std_logic_vector(15 downto 0);
- ddr2_ldm => tb_ddr2_ldm, --: out std_logic;
- ddr2_udm => tb_ddr2_udm, --: out std_logic;
- ddr2_ldqs_n => tb_ddr2_ldqs_n, --: inout std_logic;
- ddr2_ldqs_p => tb_ddr2_ldqs_p, --: inout std_logic;
- ddr2_udqs_n => tb_ddr2_udqs_n, --: inout std_logic;
- ddr2_udqs_p => tb_ddr2_udqs_p, --: inout std_logic;
- ddr2_odt => tb_ddr2_odt, --: out std_logic;
- --
- -- flash memory
- flash_a => tb_flash_a, --: out std_logic_vector(24 downto 0);
- flash_d => tb_flash_d(7 downto 3), --: inout std_logic_vector( 7 downto 3);
- --
- fpga_d0_din_miso_miso1 => tb_fpga_d0_din_miso_miso1, --: inout std_logic; -- dual use
- fpga_d1_miso2 => tb_fpga_d1_miso2, --: inout std_logic; -- dual use
- fpga_d2_miso3 => tb_fpga_d2_miso3, --: inout std_logic; -- dual use
- flash_we_b => tb_flash_we_b, --: out std_logic;
- flash_oe_b => tb_flash_oe_b, --: out std_logic;
- flash_ce_b => tb_flash_ce_b, --: out std_logic;
- --
- -- FCM connector
- -- M2C Mezzanine to Carrier
- -- C2M Carrier to Mezzanine
- fmc_clk0_m2c_n => tb_fmc_lpc_row_h(5), --: std_logic;
- fmc_clk0_m2c_p => tb_fmc_lpc_row_h(4), --: std_logic;
- fmc_clk1_m2c_n => tb_fmc_lpc_row_g(3), --: std_logic;
- fmc_clk1_m2c_p => tb_fmc_lpc_row_g(2), --: std_logic;
- iic_scl_main => tb_fmc_lpc_row_c(30), --: inout std_logic;
- iic_sda_main => tb_fmc_lpc_row_c(31), --: inout std_logic;
- fmc_la00_cc_n => tb_fmc_lpc_row_g(7), --: std_logic;
- fmc_la00_cc_p => tb_fmc_lpc_row_g(6), --: std_logic;
- fmc_la01_cc_n => tb_fmc_lpc_row_d(9), --: std_logic := 'Z';
- fmc_la01_cc_p => tb_fmc_lpc_row_d(8), --: std_logic := 'Z';
- fmc_la02_n => tb_fmc_lpc_row_h(8), --: std_logic;
- fmc_la02_p => tb_fmc_lpc_row_h(7), --: std_logic;
- fmc_la03_n => tb_fmc_lpc_row_g(10), --: std_logic;
- fmc_la03_p => tb_fmc_lpc_row_g(9), --: std_logic;
- fmc_la04_n => tb_fmc_lpc_row_h(11), --: std_logic;
- fmc_la04_p => tb_fmc_lpc_row_h(10), --: std_logic;
- fmc_la05_n => tb_fmc_lpc_row_d(12), --: std_logic := 'Z';
- fmc_la05_p => tb_fmc_lpc_row_d(11), --: std_logic := 'Z';
- fmc_la06_n => tb_fmc_lpc_row_c(11), --: std_logic := 'Z';
- fmc_la06_p => tb_fmc_lpc_row_c(10), --: std_logic := 'Z';
- fmc_la07_n => tb_fmc_lpc_row_h(14), --: std_logic;
- fmc_la07_p => tb_fmc_lpc_row_h(13), --: std_logic;
- fmc_la08_n => tb_fmc_lpc_row_g(13), --: std_logic;
- fmc_la08_p => tb_fmc_lpc_row_g(12), --: std_logic;
- fmc_la09_n => tb_fmc_lpc_row_d(15), --: std_logic := 'Z';
- fmc_la09_p => tb_fmc_lpc_row_d(14), --: std_logic := 'Z';
- fmc_la10_n => tb_fmc_lpc_row_c(15), --: std_logic := 'Z';
- fmc_la10_p => tb_fmc_lpc_row_c(14), --: std_logic := 'Z';
- fmc_la11_n => tb_fmc_lpc_row_h(17), --: std_logic;
- fmc_la11_p => tb_fmc_lpc_row_h(16), --: std_logic;
- fmc_la12_n => tb_fmc_lpc_row_g(16), --: std_logic := 'Z';
- fmc_la12_p => tb_fmc_lpc_row_g(15), --: std_logic;
- fmc_la13_n => tb_fmc_lpc_row_d(18), --: std_logic := 'Z';
- fmc_la13_p => tb_fmc_lpc_row_d(17), --: std_logic := 'Z';
- fmc_la14_n => tb_fmc_lpc_row_c(19), --: std_logic := 'Z';
- fmc_la14_p => tb_fmc_lpc_row_c(18), --: std_logic := 'Z';
- fmc_la15_n => tb_fmc_lpc_row_h(20), --: std_logic;
- fmc_la15_p => tb_fmc_lpc_row_h(19), --: std_logic;
- fmc_la16_n => tb_fmc_lpc_row_g(19), --: std_logic := 'Z';
- fmc_la16_p => tb_fmc_lpc_row_g(18), --: std_logic := 'Z';
- fmc_la17_cc_n => tb_fmc_lpc_row_d(21), --: std_logic := 'Z';
- fmc_la17_cc_p => tb_fmc_lpc_row_d(20), --: std_logic := 'Z';
- fmc_la18_cc_n => tb_fmc_lpc_row_c(23), --: std_logic := 'Z';
- fmc_la18_cc_p => tb_fmc_lpc_row_c(22), --: std_logic := 'Z';
- fmc_la19_n => tb_fmc_lpc_row_h(23), --: std_logic;
- fmc_la19_p => tb_fmc_lpc_row_h(22), --: std_logic;
- fmc_la20_n => tb_fmc_lpc_row_g(22), --: std_logic := 'Z';
- fmc_la20_p => tb_fmc_lpc_row_g(21), --: std_logic := 'Z';
- fmc_la21_n => tb_fmc_lpc_row_h(26), --: std_logic;
- fmc_la21_p => tb_fmc_lpc_row_h(25), --: std_logic;
- fmc_la22_n => tb_fmc_lpc_row_g(25), --: std_logic := 'Z';
- fmc_la22_p => tb_fmc_lpc_row_g(24), --: std_logic := 'Z';
- fmc_la23_n => tb_fmc_lpc_row_d(24), --: std_logic := 'Z';
- fmc_la23_p => tb_fmc_lpc_row_d(23), --: std_logic := 'Z';
- fmc_la24_n => tb_fmc_lpc_row_h(29), --: std_logic;
- fmc_la24_p => tb_fmc_lpc_row_h(28), --: std_logic;
- fmc_la25_n => tb_fmc_lpc_row_g(28), --: std_logic := 'Z';
- fmc_la25_p => tb_fmc_lpc_row_g(27), --: std_logic := 'Z';
- fmc_la26_n => tb_fmc_lpc_row_d(27), --: std_logic := 'Z';
- fmc_la26_p => tb_fmc_lpc_row_d(26), --: std_logic := 'Z';
- fmc_la27_n => tb_fmc_lpc_row_c(27), --: std_logic := 'Z';
- fmc_la27_p => tb_fmc_lpc_row_c(26), --: std_logic := 'Z';
- fmc_la28_n => tb_fmc_lpc_row_h(32), --: std_logic;
- fmc_la28_p => tb_fmc_lpc_row_h(31), --: std_logic;
- fmc_la29_n => tb_fmc_lpc_row_g(31), --: std_logic := 'Z';
- fmc_la29_p => tb_fmc_lpc_row_g(30), --: std_logic := 'Z';
- fmc_la30_n => tb_fmc_lpc_row_h(35), --: std_logic;
- fmc_la30_p => tb_fmc_lpc_row_h(34), --: std_logic := 'Z';
- fmc_la31_n => tb_fmc_lpc_row_g(34), --: std_logic := 'Z';
- fmc_la31_p => tb_fmc_lpc_row_g(33), --: std_logic := 'Z';
- fmc_la32_n => tb_fmc_lpc_row_h(38), --: std_logic;
- fmc_la32_p => tb_fmc_lpc_row_h(37), --: std_logic;
- fmc_la33_n => tb_fmc_lpc_row_g(37), --: std_logic := 'Z';
- fmc_la33_p => tb_fmc_lpc_row_g(36), --: std_logic := 'Z';
- fmc_prsnt_m2c_l => tb_fmc_prsnt_m2c_l, --: std_logic;
- FMC_PWR_GOOD_FLASH_RST_B => tb_FMC_PWR_GOOD_FLASH_RST_B, --: out std_logic; -- multiple destinations: 1 of Q2 (LED DS1 driver), U1 AB2 FPGA_PROG (through series R260 DNP), 44 of U25
- --
- -- ???
- FPGA_AWAKE => tb_FPGA_AWAKE, --: out std_logic;
- FPGA_CCLK => tb_FPGA_CCLK, --: in std_logic;
- FPGA_CMP_CLK => tb_FPGA_CMP_CLK, --: in std_logic;
- FPGA_CMP_CS_B => tb_FPGA_CMP_CS_B, --: in std_logic;
- FPGA_CMP_MOSI => tb_FPGA_CMP_MOSI, --: in std_logic;
- --
- FPGA_HSWAPEN => tb_FPGA_HSWAPEN, --: in std_logic;
- FPGA_INIT_B => tb_FPGA_INIT_B, --: out std_logic;
- FPGA_M0_CMP_MISO => tb_FPGA_M0_CMP_MISO, --: in std_logic;
- FPGA_M1 => tb_FPGA_M1, --: in std_logic;
- FPGA_MOSI_CSI_B_MISO0 => tb_FPGA_MOSI_CSI_B_MISO0, --: in std_logic;
- FPGA_ONCHIP_TERM1 => tb_FPGA_ONCHIP_TERM1, --: inout std_logic;
- FPGA_ONCHIP_TERM2 => tb_FPGA_ONCHIP_TERM2, --: inout std_logic;
- FPGA_VTEMP => tb_FPGA_VTEMP, --: in std_logic;
- --
- -- GPIOs
- gpio_button => tb_gpio_button, --: in std_logic_vector(3 downto 0); -- active high
- gpio_header_ls => tb_gpio_header_ls, --: inout std_logic_vector(7 downto 0);
- gpio_led => tb_gpio_led, --: out std_logic_vector(3 downto 0);
- gpio_switch => tb_gpio_switch, --: in std_logic_vector(3 downto 0); -- active high
- --
- -- Ethernet Gigabit PHY
- PHY_COL => tb_PHY_COL, --: in std_logic;
- PHY_CRS => tb_PHY_CRS, --: in std_logic;
- PHY_INT => tb_PHY_INT, --: out std_logic;
- PHY_MDC => tb_PHY_MDC, --: out std_logic;
- PHY_MDIO => tb_PHY_MDIO, --: inout std_logic;
- PHY_RESET => tb_PHY_RESET, --: out std_logic;
- PHY_RXCLK => tb_PHY_RXCLK, --: in std_logic;
- PHY_RXCTL_RXDV => tb_PHY_RXCTL_RXDV, --: in std_logic;
- PHY_RXD => tb_PHY_RXD, --: in std_logic_vector(7 downto 0);
- PHY_RXER => tb_PHY_RXER, --: in std_logic;
- PHY_TXCLK => tb_PHY_TXCLK, --: in std_logic;
- PHY_TXCTL_TXEN => tb_PHY_TXCTL_TXEN, --: out std_logic;
- PHY_TXC_GTXCLK => tb_PHY_TXC_GTXCLK, --: out std_logic;
- PHY_TXD => tb_PHY_TXD, --: out std_logic_vector(7 downto 0);
- PHY_TXER => tb_PHY_TXER, --: out std_logic;
- --
- --
- SPI_CS_B => tb_SPI_CS_B, --: in std_logic;
- --
- -- 200 MHz oscillator
- SYSCLK_N => tb_sysclk_n, --: in std_logic;
- SYSCLK_P => tb_sysclk_p, --: in std_logic;
- --
- -- RS232 via USB
- usb_1_cts => tb_usb_1_cts, --: out std_logic;
- usb_1_rts => tb_usb_1_rts, --: in std_logic;
- usb_1_rx => tb_usb_1_rx, --: out std_logic;
- usb_1_tx => tb_usb_1_tx, --: in std_logic;
- --
- -- 27 MHz, oscillator socket
- user_clock => tb_user_clock, --: in std_logic;
- user_sma_clock_p => tb_user_sma_clock_p, --: inout std_logic;
- user_sma_clock_n => tb_user_sma_clock_n --: inout std_logic;
- );
-
-
-
- -- ethernet phy signals
- tb_phy_mdio <= 'H'; -- pullup
- tb_phy_txclk <= 'H'; -- : out std_logic;
- tb_phy_rxclk <= 'H'; -- : out std_logic;
- tb_phy_rxd <= (others => 'H'); -- : out std_logic_vector(7 downto 0);
- tb_phy_rxctl_rxdv <= 'H'; -- : out std_logic;
- tb_phy_rxer <= 'H'; -- : out std_logic;
- tb_phy_col <= 'H'; -- : out std_logic;
- tb_phy_crs <= 'H'; -- : out std_logic;
-
-
- -- predefined connections on fmc connector
- -- X - power, 0 - gnd, U - unknown signal
- -- row c
- tb_fmc_lpc_row_c(1) <= gnd;
- tb_fmc_lpc_row_c(2) <= 'U';
- tb_fmc_lpc_row_c(3) <= 'U';
- tb_fmc_lpc_row_c(4) <= gnd;
- tb_fmc_lpc_row_c(5) <= gnd;
- tb_fmc_lpc_row_c(6) <= 'U';
- tb_fmc_lpc_row_c(7) <= 'U';
- tb_fmc_lpc_row_c(8) <= gnd;
- tb_fmc_lpc_row_c(9) <= gnd;
- tb_fmc_lpc_row_c(12) <= gnd;
- tb_fmc_lpc_row_c(13) <= gnd;
- tb_fmc_lpc_row_c(16) <= gnd;
- tb_fmc_lpc_row_c(17) <= gnd;
- tb_fmc_lpc_row_c(20) <= gnd;
- tb_fmc_lpc_row_c(21) <= gnd;
- tb_fmc_lpc_row_c(24) <= gnd;
- tb_fmc_lpc_row_c(25) <= gnd;
- tb_fmc_lpc_row_c(28) <= gnd;
- tb_fmc_lpc_row_c(29) <= gnd;
- tb_fmc_lpc_row_c(30) <= tb_iic_scl_main;
- tb_fmc_lpc_row_c(31) <= tb_iic_sda_main;
- tb_fmc_lpc_row_c(32) <= gnd;
- tb_fmc_lpc_row_c(33) <= gnd;
- tb_fmc_lpc_row_c(34) <= 'U';
- tb_fmc_lpc_row_c(35) <= 'X';
- tb_fmc_lpc_row_c(36) <= gnd;
- tb_fmc_lpc_row_c(37) <= 'X';
- tb_fmc_lpc_row_c(38) <= gnd;
- tb_fmc_lpc_row_c(39) <= 'X';
- tb_fmc_lpc_row_c(40) <= gnd;
- -- row d
- tb_fmc_lpc_row_d(2) <= gnd;
- tb_fmc_lpc_row_d(3) <= gnd;
- tb_fmc_lpc_row_d(4) <= 'U';
- tb_fmc_lpc_row_d(5) <= 'U';
- tb_fmc_lpc_row_d(6) <= gnd;
- tb_fmc_lpc_row_d(7) <= gnd;
- tb_fmc_lpc_row_d(10) <= gnd;
- tb_fmc_lpc_row_d(13) <= gnd;
- tb_fmc_lpc_row_d(16) <= gnd;
- tb_fmc_lpc_row_d(19) <= gnd;
- tb_fmc_lpc_row_d(22) <= gnd;
- tb_fmc_lpc_row_d(25) <= gnd;
- tb_fmc_lpc_row_d(28) <= gnd;
- tb_fmc_lpc_row_d(29) <= 'U';
- tb_fmc_lpc_row_d(30) <= 'U';
- tb_fmc_lpc_row_d(31) <= 'U';
- tb_fmc_lpc_row_d(32) <= 'X';
- tb_fmc_lpc_row_d(33) <= 'U';
- tb_fmc_lpc_row_d(34) <= 'U';
- tb_fmc_lpc_row_d(35) <= 'U';
- tb_fmc_lpc_row_d(36) <= 'X';
- tb_fmc_lpc_row_d(37) <= gnd;
- tb_fmc_lpc_row_d(38) <= 'X';
- tb_fmc_lpc_row_d(39) <= gnd;
- tb_fmc_lpc_row_d(40) <= 'X';
- -- row g
- tb_fmc_lpc_row_g(1) <= gnd;
- tb_fmc_lpc_row_g(4) <= gnd;
- tb_fmc_lpc_row_g(5) <= gnd;
- tb_fmc_lpc_row_g(8) <= gnd;
- tb_fmc_lpc_row_g(11) <= gnd;
- tb_fmc_lpc_row_g(14) <= gnd;
- tb_fmc_lpc_row_g(17) <= gnd;
- tb_fmc_lpc_row_g(20) <= gnd;
- tb_fmc_lpc_row_g(23) <= gnd;
- tb_fmc_lpc_row_g(26) <= gnd;
- tb_fmc_lpc_row_g(29) <= gnd;
- tb_fmc_lpc_row_g(32) <= gnd;
- tb_fmc_lpc_row_g(35) <= gnd;
- tb_fmc_lpc_row_g(38) <= gnd;
- tb_fmc_lpc_row_g(39) <= 'X';
- tb_fmc_lpc_row_g(40) <= gnd;
- -- row h
- tb_fmc_lpc_row_h(1) <= 'X';
- tb_fmc_lpc_row_h(3) <= gnd;
- tb_fmc_lpc_row_h(6) <= gnd;
- tb_fmc_lpc_row_h(9) <= gnd;
- tb_fmc_lpc_row_h(12) <= gnd;
- tb_fmc_lpc_row_h(15) <= gnd;
- tb_fmc_lpc_row_h(18) <= gnd;
- tb_fmc_lpc_row_h(21) <= gnd;
- tb_fmc_lpc_row_h(24) <= gnd;
- tb_fmc_lpc_row_h(27) <= gnd;
- tb_fmc_lpc_row_h(30) <= gnd;
- tb_fmc_lpc_row_h(33) <= gnd;
- tb_fmc_lpc_row_h(36) <= gnd;
- tb_fmc_lpc_row_h(39) <= gnd;
- tb_fmc_lpc_row_h(40) <= 'X';
-
-
- main: process
- begin
-
- wait for 2 ms;
- simulation_run <= false;
- report "Simlation ended." severity note;
- wait;
-
- end process;
-
-
-end architecture testbench;
diff --git a/test_rrobin_problem/simulation/Makefile b/test_rrobin_problem/simulation/Makefile
deleted file mode 100644
index 9ed290d..0000000
--- a/test_rrobin_problem/simulation/Makefile
+++ /dev/null
@@ -1,55 +0,0 @@
-#
-# $HeadURL: https://svn.fzd.de/repo/concast/FWF_Projects/FWKE/beam_position_monitor/hardware/board_sp605/simulation/Makefile $
-# $Date$
-# $Author$
-# $Revision$
-#
-
-library = test_rrobin
-top = top_tb
-
-software_dir = ../software
-
-
-# http://sourceforge.net/projects/vmk/
-VMK = vmk
-
-# generate list of used libs
-library_list = $(shell cut --field 1 --delimiter=" " --only-delimited vhdl_files.txt | grep --invert "\#" | sort --unique)
-
-
-all: compile simulate
-
-
-software:
- test ! -d $(software_dir) || make --directory $(software_dir) | ccze -A
-
-compile: Makefile.msim
- export ANAFLAGS="-quiet -2008"; \
- make -f Makefile.msim | ccze -A
-
-
-simulate:
- export top=$(top); \
- vsim -quiet -gui $(library).$(top) -do run.do -l transcript.log
-
-
-clean:
- @# modelsim stuff
- rm -f transcript.log
- rm -f *.wlf
- rm -f wlf*
- @# vmk stuff
- -make -f Makefile.msim clean
- rm -f Makefile.msim
- rm -rf $(library_list)
-
-
-# generate Makefile.msim with vmk
-Makefile.msim: software vhdl_files.txt $(library_list)
- $(VMK) -t modelsim -O -w $(library) -F vhdl_files.txt
-
-$(library_list):
- vlib $@
-
-
diff --git a/test_rrobin_problem/simulation/run.do b/test_rrobin_problem/simulation/run.do
deleted file mode 100644
index 36d1969..0000000
--- a/test_rrobin_problem/simulation/run.do
+++ /dev/null
@@ -1,71 +0,0 @@
-
-#
-# helper functions
-#
-
-
-# neues Spiel, neues Glueck
-proc nsng {} {
-
- restart -f
- global StdArithNoWarnings
- global NumericStdNoWarnings
- set StdArithNoWarnings 1
- set NumericStdNoWarnings 1
-
- when -label enable_Warn {reset == '0'} {echo "Enable Warnings" ; set StdArithNoWarnings 0 ; set NumericStdNoWarnings 0 ;}
-
- run -all
-}
-
-
-proc r {} {
- restart -f
- run -all
-}
-
-
-# restart with clear
-proc rc {} {
- .main clear
- r
-}
-
-
-
-proc my_debug {} {
- global env
- foreach key [array names env] {
- puts "$key=$env($key)"
- }
-}
-
-
-proc e {} {
- exit -force
-}
-
-proc x {} {
- exit -force
-}
-
-
-
-
-# get env variables
-global env
-quietly set top $env(top)
-
-
-if {[file exists wave_$top.do]} {
- do wave_$top.do
-} else {
- if {[file exists wave.do]} {
- do wave.do
- } else {
- puts "INFO: no wave file found."
- }
-}
-
-
-run -all
diff --git a/test_rrobin_problem/simulation/vhdl_files.txt b/test_rrobin_problem/simulation/vhdl_files.txt
deleted file mode 100644
index d2f9c6f..0000000
--- a/test_rrobin_problem/simulation/vhdl_files.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-test_rrobin ../rtl/led_control_ahb.vhd
-test_rrobin ../rtl/box.vhd
-test_rrobin ../rtl/top.vhd
-test_rrobin ../rtl_tb/top_tb.vhd
-hzdr ../../hzdr/rtl/devices_hzdr.vhd
-grlib ../../grlib/rtl/ahbctrl.vhd
-grlib ../../grlib/rtl/amba.vhd
-grlib ../../grlib/rtl/apbctrl.vhd
-grlib ../../grlib/rtl/devices.vhd
-grlib ../../grlib/rtl/config.vhd
-grlib ../../grlib/rtl/util.vhd
-grlib ../../grlib/rtl/testlib.vhd
-grlib ../../grlib/rtl/stdlib.vhd
-grlib ../../grlib/rtl/version.vhd
-grlib ../../grlib/rtl_tb/stdio.vhd
-techmap ../../techmap/rtl/gencomp.vhd
-gaisler ../../gaisler/rtl/apbuart.vhd
-gaisler ../../gaisler/rtl/grgpio.vhd
-gaisler ../../gaisler/rtl/grgpreg.vhd
-gaisler ../../gaisler/rtl/misc.vhd
-gaisler ../../gaisler/rtl/net.vhd
-gaisler ../../gaisler/rtl/uart.vhd
diff --git a/test_rrobin_problem/simulation/wave.do b/test_rrobin_problem/simulation/wave.do
deleted file mode 100644
index 7ba2647..0000000
--- a/test_rrobin_problem/simulation/wave.do
+++ /dev/null
@@ -1,27 +0,0 @@
-onerror {resume}
-quietly WaveActivateNextPane {} 0
-add wave -noupdate /top_tb/top_i0/box_i0/clk
-add wave -noupdate /top_tb/top_i0/box_i0/ahbctrl_i0/msto(0).hbusreq
-add wave -noupdate /top_tb/top_i0/box_i0/ahbctrl_i0/msto(1).hbusreq
-add wave -noupdate -divider ahbctrl
-add wave -noupdate -expand /top_tb/top_i0/box_i0/ahbctrl_i0/msti.hgrant
-add wave -noupdate /top_tb/top_i0/box_i0/ahbctrl_i0/msti.hready
-add wave -noupdate -divider gpio
-add wave -noupdate -expand /top_tb/top_i0/gpio_led
-TreeUpdate [SetDefaultTree]
-WaveRestoreCursors {{Cursor 1} {64180831 ps} 0}
-configure wave -namecolwidth 150
-configure wave -valuecolwidth 100
-configure wave -justifyvalue left
-configure wave -signalnamewidth 1
-configure wave -snapdistance 10
-configure wave -datasetprefix 0
-configure wave -rowmargin 4
-configure wave -childrowmargin 2
-configure wave -gridoffset 0
-configure wave -gridperiod 1
-configure wave -griddelta 40
-configure wave -timeline 0
-configure wave -timelineunits ns
-update
-WaveRestoreZoom {0 ps} {1840927 ps}
diff --git a/test_rrobin_problem/synthesis/Makefile b/test_rrobin_problem/synthesis/Makefile
deleted file mode 100644
index 9aa0be7..0000000
--- a/test_rrobin_problem/synthesis/Makefile
+++ /dev/null
@@ -1,205 +0,0 @@
-#
-# $Date$
-# $Author$
-# $Revision$
-#
-
-MODULE = top
-SPEEDGRADE = 2
-DEVICE = xc6slx16-csg324-$(SPEEDGRADE)
-UCF_FILE = sp601.ucf
-CORES = ../cores/
-SOFTWARE = ../software
-BMM_FILE = zpu_i0_memory_64k.bmm
-
-BUILDDIR = isebuild
-DATE = $(shell date +"%Y-%m-%d__%H_%M")
-LOGFILE = synthesis_log_$(DATE).txt
-export XST_LOGFILE := $(LOGFILE)
-
-
-all:
- @echo "check - look for timing and other synthesis issues"
- @echo "xst - generate ngc file (netlist, replaces edif and netlist constrains)"
- @echo "translate - generate ngd file (native generic database [reduced to primitives])"
- @echo "map - generate ncd file (native ciruit description)"
- @echo "par - place&route ncd file (design implementation)"
- @echo "trace - generate timing report"
- @echo "bitgen - generate bit file (ncd -> bit)"
- @echo "update - update bitstream with elf file"
- @echo "program - program fpga with bit file"
- @echo "genmcs - genrate mcs file"
- @echo "progspi - program spi flash with mcs file"
- @echo "clean"
- @echo "..."
- @echo "testflow - update bitgen update program check"
- @echo "finalflow - update bitgen update progspi check"
-
-testflow:
- time $(MAKE) software bitgen update program check 2>&1 | tee $(XST_LOGFILE)
-
-finalflow:
- time $(MAKE) software bitgen update progspi check 2>&1 | tee $(XST_LOGFILE)
-
-
-check:
- @echo -e "Timing score: "
- @grep --with-filename "Timing Score" $(BUILDDIR)/*.par
- @echo -e "\nUnwanted Latches (737): "
- @grep --with-filename "WARNING:Xst:737" $(BUILDDIR)/*.syr || echo -n
- @echo -e "\nUnassigned signals (653): "
- @grep --with-filename "WARNING:Xst:653" $(BUILDDIR)/*.syr || echo -n
- @echo -e "\nInternal tristates (2042): "
- @grep --with-filename "WARNING:Xst:2042" $(BUILDDIR)/*.syr || echo -n
- @echo -e "\nCombinatoric loops (2170): "
- @grep --with-filename "WARNING:Xst:2170" $(BUILDDIR)/*.syr || echo -n
- @echo -e "\nGated clocks (372): "
- @grep --with-filename "WARNING:PhysDesignRules:372" $(BUILDDIR)/*.bgn || echo -n
-
-
-software:
- ###
- #############################################################################
- ### (re)compile software
- ###
- test ! -d $(SOFTWARE) || make all --directory $(SOFTWARE)
-
-
-update: $(BUILDDIR)/$(MODULE).bit
- ###
- #############################################################################
- ### update the bitfile
- ###
- test ! -d $(SOFTWARE) || data2mem -bm $(BMM_FILE) -bd $(SOFTWARE)/*.elf -bt $(BUILDDIR)/$(MODULE).bit -o b $(MODULE)_update.bit
- test -d $(SOFTWARE) || cp $(BUILDDIR)/$(MODULE).bit $(MODULE)_update.bit
-
-
-program:
- ###
- #############################################################################
- ### configure FPGA
- ###
- impact -batch program_fpga.cmd
-
-
-genmcs: $(MODULE)_update.mcs
-
-$(MODULE)_update.mcs: $(MODULE)_update.bit
- ###
- #############################################################################
- ### generate flash file
- ###
- promgen -spi -p mcs -w -o $(MODULE)_update.mcs -s 8192 -u 0 $(MODULE)_update.bit
-
-
-progspi: genmcs
- ###
- #############################################################################
- ### program flash
- ###
- impact -batch program_spi.cmd
-
-
-clean:
- rm -f $(MODULE).prj
- rm -f *.log
- rm -f _impact.cmd
- rm -f *.cfi
- rm -f *.prm
- rm -rf $(BUILDDIR)
-
-
-dir: $(MODULE).prj
- ###
- #############################################################################
- ### generate build directory
- ###
- mkdir -p $(BUILDDIR)
- mkdir -p $(BUILDDIR)/projnav.tmp
-
-
-
-$(MODULE).prj: ../simulation/vhdl_files.txt
- ###
- #############################################################################
- ### generate project file
- ###
- grep --invert rtl_tb ../simulation/vhdl_files.txt | grep --invert "\#" | grep --invert "^$$" | awk '{printf "vhdl %s %s\n",$$1,$$2}' > $(MODULE).prj
-
-
-xst: $(MODULE).ngc
-translate: $(MODULE).ngd
-map: $(MODULE)_map.ncd
-par: $(MODULE).ncd
-
-
-hw_timestamp:
- ###
- #############################################################################
- #### update hw timestamp
- ###
- test ! -f ../rtl/Makefile || make --directory ../rtl
-
-$(MODULE).ngc: dir hw_timestamp
- ###
- #############################################################################
- ### synthesis
- ###
- cd $(BUILDDIR) ; xst -ifn ../$(MODULE).xst -ofn $(MODULE).syr
-
-
-$(MODULE).ngd: $(MODULE).ngc $(UCF_FILE)
- ###
- #############################################################################
- ### translate
- ###
- cd $(BUILDDIR) ; ngdbuild -dd _ngo -nt timestamp -uc ../$(UCF_FILE) -p $(DEVICE) -sd ../$(CORES) $(MODULE).ngc $(MODULE).ngd
-
-$(MODULE)_map.ncd: $(MODULE).ngd
- ###
- #############################################################################
- ### map
- ###
- @# explanation of map parameters:
- @# -p part number
- @# -mt multi-threading
- @# -w overwrite existing files
- @# -logic_opt logic optimization
- @# -ol overall effor level (std|high)
- @# -t placer cost table
- @# -xt extra placer cost table
- @# -register_duplication duplicate registers
- @# -global_opt Global Optimization (off|speed|area|power)
- @# -ir ignore RLOCs
- @# -pr pack registers in IO (off|i|o|b)
- @# -lc lut combining (auto|area|off)
- @# -power Virtex 6 Power Optimization (on|off|high|xe)
- @# -detail Generate Detailed MAP Report
- @# -o Output File Name
- @# -bp enables block RAM mapping
- cd $(BUILDDIR) ; export XIL_PAR_DESIGN_CHECK_VERBOSE=1; map -p $(DEVICE) -mt 2 -w -logic_opt off -ol high -t 1 -xt 0 -register_duplication off -global_opt off -ir off -pr off -lc off -power off -detail -o $(MODULE)_map.ncd $(MODULE).ngd $(MODULE).pcf
-
-
-$(MODULE).ncd: $(MODULE)_map.ncd
- ###
- #############################################################################
- ### place & route
- ###
- cd $(BUILDDIR) ; par -w -mt 4 -ol high $(MODULE)_map.ncd $(MODULE).ncd $(MODULE).pcf
-
-
-trace:
- cd $(BUILDDIR) ; trce -e -a -u 100 -s $(SPEEDGRADE) -xml $(MODULE).twx $(MODULE).ncd -o $(MODULE).twr $(MODULE).pcf
-
-tracefast:
- cd $(BUILDDIR) ; trce -v 12 -u 100 -s $(SPEEDGRADE) -fastpaths -xml $(MODULE).twx -o $(MODULE).twr $(MODULE).ncd $(MODULE).pcf
-
-
-bitgen: $(MODULE).ncd
- ###
- #############################################################################
- ### generate bitfile
- ###
- cd $(BUILDDIR) ; bitgen -f ../$(MODULE).ut $(MODULE).ncd
-
-
diff --git a/test_rrobin_problem/synthesis/program_fpga.cmd b/test_rrobin_problem/synthesis/program_fpga.cmd
deleted file mode 100644
index e025d0a..0000000
--- a/test_rrobin_problem/synthesis/program_fpga.cmd
+++ /dev/null
@@ -1,8 +0,0 @@
-setMode -bscan
-#setCable -port auto
-setCable -port usb21
-Identify
-assignFile -p 1 -file "top_update.bit"
-Program -p 1
-closeCable
-quit
diff --git a/test_rrobin_problem/synthesis/program_spi.cmd b/test_rrobin_problem/synthesis/program_spi.cmd
deleted file mode 100644
index c6fcbc0..0000000
--- a/test_rrobin_problem/synthesis/program_spi.cmd
+++ /dev/null
@@ -1,9 +0,0 @@
-setMode -bs
-setCable -port auto
-Identify -inferir
-identifyMPM
-attachflash -position 1 -spi "W25Q64BV"
-assignfiletoattachedflash -position 1 -file "top_update.mcs"
-Program -p 1 -dataWidth 4 -spionly -e -v -loadfpga
-closeCable
-quit
diff --git a/test_rrobin_problem/synthesis/sp601.ucf b/test_rrobin_problem/synthesis/sp601.ucf
deleted file mode 100644
index 90a9d07..0000000
--- a/test_rrobin_problem/synthesis/sp601.ucf
+++ /dev/null
@@ -1,372 +0,0 @@
-
-############################################################
-# $HeadURL: https://svn.fzd.de/repo/concast/FWF_Projects/FWKE/beam_position_monitor/hardware/board_sp601/rtl/teilerregister.vhd $
-# $Date$
-# $Author$
-# $Revision$
-
-
-############################################################
-# SPARTAN-6 SP601 BOARD CONSTRAINTS FILE
-#
-# Bank Voltage
-# Bank 0: 2.5 V
-# Bank 1: 2.5 V
-# Bank 2: 2.5 V
-# Bank 3: 1.8 V
-# VCCAUX: 2.5 V
-
-# following pins are connected to VCC1V8/2:
-# N3, M5, C1
-
-
-############################################################
-## clock specialities
-############################################################
-#
-# separete VGA clock from system clock
-# no VGA -> no VGA clk
-#NET "clk_driver_b.dcm_sp_i0_clkfx" TNM_NET = "clkfx";
-#NET "clk_driver_b.dcm_sp_i0_clkdv" TNM_NET = "clkdv";
-#TIMESPEC "TS_clkfx_clkdv" = FROM "clkfx" to "clkdv" TIG;
-
-
-
-
-############################################################
-## placement constraints
-############################################################
-
-### internal memory for zpu 8x4 bit = 32 bit width
-### zpu_core_small
-#INST "box_i0/zpu_ahb_i0/zpu_i0/memory/Mram_ram1" AREA_GROUP = "ZPU_MEM1" ;
-#INST "box_i0/zpu_ahb_i0/zpu_i0/memory/Mram_ram2" AREA_GROUP = "ZPU_MEM2" ;
-#INST "box_i0/zpu_ahb_i0/zpu_i0/memory/Mram_ram3" AREA_GROUP = "ZPU_MEM3" ;
-#INST "box_i0/zpu_ahb_i0/zpu_i0/memory/Mram_ram4" AREA_GROUP = "ZPU_MEM4" ;
-#INST "box_i0/zpu_ahb_i0/zpu_i0/memory/Mram_ram5" AREA_GROUP = "ZPU_MEM5" ;
-#INST "box_i0/zpu_ahb_i0/zpu_i0/memory/Mram_ram6" AREA_GROUP = "ZPU_MEM6" ;
-#INST "box_i0/zpu_ahb_i0/zpu_i0/memory/Mram_ram7" AREA_GROUP = "ZPU_MEM7" ;
-#INST "box_i0/zpu_ahb_i0/zpu_i0/memory/Mram_ram8" AREA_GROUP = "ZPU_MEM8" ;
-
-### zpu_core_medium
-#INST "box_i0/dualport_ram_ahb_wrapper_i0/dualport_ram_i0/Mram_ram1" AREA_GROUP = "ZPU_MEM1" ;
-#INST "box_i0/dualport_ram_ahb_wrapper_i0/dualport_ram_i0/Mram_ram2" AREA_GROUP = "ZPU_MEM2" ;
-#INST "box_i0/dualport_ram_ahb_wrapper_i0/dualport_ram_i0/Mram_ram3" AREA_GROUP = "ZPU_MEM3" ;
-#INST "box_i0/dualport_ram_ahb_wrapper_i0/dualport_ram_i0/Mram_ram4" AREA_GROUP = "ZPU_MEM4" ;
-#INST "box_i0/dualport_ram_ahb_wrapper_i0/dualport_ram_i0/Mram_ram5" AREA_GROUP = "ZPU_MEM5" ;
-#INST "box_i0/dualport_ram_ahb_wrapper_i0/dualport_ram_i0/Mram_ram6" AREA_GROUP = "ZPU_MEM6" ;
-#INST "box_i0/dualport_ram_ahb_wrapper_i0/dualport_ram_i0/Mram_ram7" AREA_GROUP = "ZPU_MEM7" ;
-#INST "box_i0/dualport_ram_ahb_wrapper_i0/dualport_ram_i0/Mram_ram8" AREA_GROUP = "ZPU_MEM8" ;
-#INST "box_i0/dualport_ram_ahb_wrapper_i0/dualport_ram_i0/Mram_ram9" AREA_GROUP = "ZPU_MEM9" ;
-#INST "box_i0/dualport_ram_ahb_wrapper_i0/dualport_ram_i0/Mram_ram10" AREA_GROUP = "ZPU_MEM10" ;
-#INST "box_i0/dualport_ram_ahb_wrapper_i0/dualport_ram_i0/Mram_ram11" AREA_GROUP = "ZPU_MEM11" ;
-#INST "box_i0/dualport_ram_ahb_wrapper_i0/dualport_ram_i0/Mram_ram12" AREA_GROUP = "ZPU_MEM12" ;
-#INST "box_i0/dualport_ram_ahb_wrapper_i0/dualport_ram_i0/Mram_ram13" AREA_GROUP = "ZPU_MEM13" ;
-#INST "box_i0/dualport_ram_ahb_wrapper_i0/dualport_ram_i0/Mram_ram14" AREA_GROUP = "ZPU_MEM14" ;
-#INST "box_i0/dualport_ram_ahb_wrapper_i0/dualport_ram_i0/Mram_ram15" AREA_GROUP = "ZPU_MEM15" ;
-#INST "box_i0/dualport_ram_ahb_wrapper_i0/dualport_ram_i0/Mram_ram16" AREA_GROUP = "ZPU_MEM16" ;
-
-### planahead has problems with "" around range
-AREA_GROUP "ZPU_MEM1" RANGE = RAMB16_X0Y14:RAMB16_X0Y14 ;
-AREA_GROUP "ZPU_MEM2" RANGE = RAMB16_X0Y12:RAMB16_X0Y12 ;
-AREA_GROUP "ZPU_MEM3" RANGE = RAMB16_X0Y10:RAMB16_X0Y10 ;
-AREA_GROUP "ZPU_MEM4" RANGE = RAMB16_X0Y8:RAMB16_X0Y8 ;
-AREA_GROUP "ZPU_MEM5" RANGE = RAMB16_X0Y6:RAMB16_X0Y6 ;
-AREA_GROUP "ZPU_MEM6" RANGE = RAMB16_X0Y4:RAMB16_X0Y4 ;
-AREA_GROUP "ZPU_MEM7" RANGE = RAMB16_X0Y2:RAMB16_X0Y2 ;
-AREA_GROUP "ZPU_MEM8" RANGE = RAMB16_X0Y0:RAMB16_X0Y0 ;
-AREA_GROUP "ZPU_MEM9" RANGE = RAMB16_X1Y14:RAMB16_X1Y14 ;
-AREA_GROUP "ZPU_MEM10" RANGE = RAMB16_X1Y12:RAMB16_X1Y12 ;
-AREA_GROUP "ZPU_MEM11" RANGE = RAMB16_X1Y10:RAMB16_X1Y10 ;
-AREA_GROUP "ZPU_MEM12" RANGE = RAMB16_X1Y8:RAMB16_X1Y8 ;
-AREA_GROUP "ZPU_MEM13" RANGE = RAMB16_X1Y6:RAMB16_X1Y6 ;
-AREA_GROUP "ZPU_MEM14" RANGE = RAMB16_X1Y4:RAMB16_X1Y4 ;
-AREA_GROUP "ZPU_MEM15" RANGE = RAMB16_X1Y2:RAMB16_X1Y2 ;
-AREA_GROUP "ZPU_MEM16" RANGE = RAMB16_X1Y0:RAMB16_X1Y0 ;
-
-
-
-############################################################
-## pin constraints
-############################################################
-
-
-NET "CPU_RESET" LOC = "N4";
-##
-## 128 MB DDR2 Component Memory
-NET "DDR2_A<12>" LOC ="G6"; # | IOSTANDARD = SSTL18_II ;
-NET "DDR2_A<11>" LOC ="D3"; # | IOSTANDARD = SSTL18_II ;
-NET "DDR2_A<10>" LOC ="F4"; # | IOSTANDARD = SSTL18_II ;
-NET "DDR2_A<9>" LOC ="D1"; # | IOSTANDARD = SSTL18_II ;
-NET "DDR2_A<8>" LOC ="D2"; # | IOSTANDARD = SSTL18_II ;
-NET "DDR2_A<7>" LOC ="H6"; # | IOSTANDARD = SSTL18_II ;
-NET "DDR2_A<6>" LOC ="H3"; # | IOSTANDARD = SSTL18_II ;
-NET "DDR2_A<5>" LOC ="H4"; # | IOSTANDARD = SSTL18_II ;
-NET "DDR2_A<4>" LOC ="F3"; # | IOSTANDARD = SSTL18_II ;
-NET "DDR2_A<3>" LOC ="L7"; # | IOSTANDARD = SSTL18_II ;
-NET "DDR2_A<2>" LOC ="H5"; # | IOSTANDARD = SSTL18_II ;
-NET "DDR2_A<1>" LOC ="J6"; # | IOSTANDARD = SSTL18_II ;
-NET "DDR2_A<0>" LOC ="J7"; # | IOSTANDARD = SSTL18_II ;
-NET "DDR2_DQ<15>" LOC ="U1"; # | IOSTANDARD = SSTL18_II ;
-NET "DDR2_DQ<14>" LOC ="U2"; # | IOSTANDARD = SSTL18_II ;
-NET "DDR2_DQ<13>" LOC ="T1"; # | IOSTANDARD = SSTL18_II ;
-NET "DDR2_DQ<12>" LOC ="T2"; # | IOSTANDARD = SSTL18_II ;
-NET "DDR2_DQ<11>" LOC ="N1"; # | IOSTANDARD = SSTL18_II ;
-NET "DDR2_DQ<10>" LOC ="N2"; # | IOSTANDARD = SSTL18_II ;
-NET "DDR2_DQ<9>" LOC ="M1"; # | IOSTANDARD = SSTL18_II ;
-NET "DDR2_DQ<8>" LOC ="M3"; # | IOSTANDARD = SSTL18_II ;
-NET "DDR2_DQ<7>" LOC ="J1"; # | IOSTANDARD = SSTL18_II ;
-NET "DDR2_DQ<6>" LOC ="J3"; # | IOSTANDARD = SSTL18_II ;
-NET "DDR2_DQ<5>" LOC ="H1"; # | IOSTANDARD = SSTL18_II ;
-NET "DDR2_DQ<4>" LOC ="H2"; # | IOSTANDARD = SSTL18_II ;
-NET "DDR2_DQ<3>" LOC ="K1"; # | IOSTANDARD = SSTL18_II ;
-NET "DDR2_DQ<2>" LOC ="K2"; # | IOSTANDARD = SSTL18_II ;
-NET "DDR2_DQ<1>" LOC ="L1"; # | IOSTANDARD = SSTL18_II ;
-NET "DDR2_DQ<0>" LOC ="L2"; # | IOSTANDARD = SSTL18_II ;
-NET "DDR2_WE_B" LOC ="E3"; # | IOSTANDARD = SSTL18_II ;
-NET "DDR2_UDQS_P" LOC ="P2"; # | IOSTANDARD = DIFF_SSTL18_II;
-NET "DDR2_UDQS_N" LOC ="P1"; # | IOSTANDARD = DIFF_SSTL18_II;
-NET "DDR2_UDM" LOC ="K4"; # | IOSTANDARD = SSTL18_II ;
-NET "DDR2_RAS_B" LOC ="L5"; # | IOSTANDARD = SSTL18_II ;
-NET "DDR2_ODT" LOC ="K6"; # | IOSTANDARD = SSTL18_II ;
-NET "DDR2_LDQS_P" LOC ="L4"; # | IOSTANDARD = DIFF_SSTL18_II;
-NET "DDR2_LDQS_N" LOC ="L3"; # | IOSTANDARD = DIFF_SSTL18_II;
-NET "DDR2_LDM" LOC ="K3"; # | IOSTANDARD = SSTL18_II ;
-NET "DDR2_CLK_P" LOC ="G3"; # | IOSTANDARD = DIFF_SSTL18_II;
-NET "DDR2_CLK_N" LOC ="G1"; # | IOSTANDARD = DIFF_SSTL18_II;
-NET "DDR2_CKE" LOC ="H7"; # | IOSTANDARD = SSTL18_II ;
-NET "DDR2_CAS_B" LOC ="K5"; # | IOSTANDARD = SSTL18_II ;
-NET "DDR2_BA<2>" LOC ="E1"; # | IOSTANDARD = SSTL18_II ;
-NET "DDR2_BA<1>" LOC ="F1"; # | IOSTANDARD = SSTL18_II ;
-NET "DDR2_BA<0>" LOC ="F2"; # | IOSTANDARD = SSTL18_II ;
-##
-##
-NET "FLASH_A<0>" LOC = "K18";
-NET "FLASH_A<1>" LOC = "K17";
-NET "FLASH_A<2>" LOC = "J18";
-NET "FLASH_A<3>" LOC = "J16";
-NET "FLASH_A<4>" LOC = "G18";
-NET "FLASH_A<5>" LOC = "G16";
-NET "FLASH_A<6>" LOC = "H16";
-NET "FLASH_A<7>" LOC = "H15";
-NET "FLASH_A<8>" LOC = "H14";
-NET "FLASH_A<9>" LOC = "H13";
-NET "FLASH_A<10>" LOC = "F18";
-NET "FLASH_A<11>" LOC = "F17";
-NET "FLASH_A<12>" LOC = "K13";
-NET "FLASH_A<13>" LOC = "K12";
-NET "FLASH_A<14>" LOC = "E18";
-NET "FLASH_A<15>" LOC = "E16";
-NET "FLASH_A<16>" LOC = "G13";
-NET "FLASH_A<17>" LOC = "H12";
-NET "FLASH_A<18>" LOC = "D18";
-NET "FLASH_A<19>" LOC = "D17";
-NET "FLASH_A<20>" LOC = "G14";
-NET "FLASH_A<21>" LOC = "F14";
-NET "FLASH_A<22>" LOC = "C18";
-NET "FLASH_A<23>" LOC = "C17";
-NET "FLASH_A<24>" LOC = "F16";
-NET "FLASH_CE_B" LOC = "L17";
-#NET "FLASH_D<0>" LOC = "R13" | SLEW = "SLOW" | DRIVE = 2;
-#NET "FLASH_D<1>" LOC = "T14" | SLEW = "SLOW" | DRIVE = 2;
-#NET "FLASH_D<2>" LOC = "V14" | SLEW = "SLOW" | DRIVE = 2;
-NET "FLASH_D<3>" LOC = "U5" | SLEW = "SLOW" | DRIVE = 2;
-NET "FLASH_D<4>" LOC = "V5" | SLEW = "SLOW" | DRIVE = 2;
-NET "FLASH_D<5>" LOC = "R3" | SLEW = "SLOW" | DRIVE = 2;
-NET "FLASH_D<6>" LOC = "T3" | SLEW = "SLOW" | DRIVE = 2;
-NET "FLASH_D<7>" LOC = "R5" | SLEW = "SLOW" | DRIVE = 2;
-NET "FLASH_OE_B" LOC = "L18";
-NET "FLASH_WE_B" LOC = "M16";
-
-# FMC-Connector, Bank 0,2 (M2C = Mezzanine to Carrier, C2M = Carrier to Mezzanine)
-NET "FMC_CLK0_M2C_N" LOC = "A10";
-NET "FMC_CLK0_M2C_P" LOC = "C10";
-NET "FMC_CLK1_M2C_N" LOC = "V9" ;
-NET "FMC_CLK1_M2C_P" LOC = "T9" ;
-NET "FMC_LA00_CC_N" LOC = "C9" ;
-NET "FMC_LA00_CC_P" LOC = "D9" ;
-NET "FMC_LA01_CC_N" LOC = "C11" | TNM_NET = "ADC_CLK";
-NET "FMC_LA01_CC_P" LOC = "D11" | TNM_NET = "ADC_CLK";
-TIMESPEC "TS_ADC_CLK" = PERIOD "ADC_CLK" 52 MHz HIGH 50 %;
-NET "FMC_LA02_N" LOC = "A15";
-NET "FMC_LA02_P" LOC = "C15";
-NET "FMC_LA03_N" LOC = "A13";
-NET "FMC_LA03_P" LOC = "C13";
-NET "FMC_LA04_N" LOC = "A16";
-NET "FMC_LA04_P" LOC = "B16";
-NET "FMC_LA05_N" LOC = "A14";
-NET "FMC_LA05_P" LOC = "B14";
-NET "FMC_LA06_N" LOC = "C12";
-NET "FMC_LA06_P" LOC = "D12";
-NET "FMC_LA07_N" LOC = "E8" ;
-NET "FMC_LA07_P" LOC = "E7" ;
-NET "FMC_LA08_N" LOC = "E11";
-NET "FMC_LA08_P" LOC = "F11";
-NET "FMC_LA09_N" LOC = "F10";
-NET "FMC_LA09_P" LOC = "G11";
-NET "FMC_LA10_N" LOC = "C8" ;
-NET "FMC_LA10_P" LOC = "D8" ;
-NET "FMC_LA11_N" LOC = "A12";
-NET "FMC_LA11_P" LOC = "B12";
-NET "FMC_LA12_N" LOC = "C6" ;
-NET "FMC_LA12_P" LOC = "D6" ;
-NET "FMC_LA13_N" LOC = "A11";
-NET "FMC_LA13_P" LOC = "B11";
-NET "FMC_LA14_N" LOC = "A2" ;
-NET "FMC_LA14_P" LOC = "B2" ;
-NET "FMC_LA15_N" LOC = "F9" ;
-NET "FMC_LA15_P" LOC = "G9" ;
-NET "FMC_LA16_N" LOC = "A7" ;
-NET "FMC_LA16_P" LOC = "C7" ;
-NET "FMC_LA17_CC_N" LOC = "T8" ;
-NET "FMC_LA17_CC_P" LOC = "R8" ;
-NET "FMC_LA18_CC_N" LOC = "T10";
-NET "FMC_LA18_CC_P" LOC = "R10";
-NET "FMC_LA19_N" LOC = "P7" ;
-NET "FMC_LA19_P" LOC = "N6" ;
-NET "FMC_LA20_N" LOC = "P8" ;
-NET "FMC_LA20_P" LOC = "N7" ;
-NET "FMC_LA21_N" LOC = "V4" ;
-NET "FMC_LA21_P" LOC = "T4" ;
-NET "FMC_LA22_N" LOC = "T7" ;
-NET "FMC_LA22_P" LOC = "R7" ;
-NET "FMC_LA23_N" LOC = "P6" ;
-NET "FMC_LA23_P" LOC = "N5" ;
-NET "FMC_LA24_N" LOC = "V8" ;
-NET "FMC_LA24_P" LOC = "U8" ;
-NET "FMC_LA25_N" LOC = "N11";
-NET "FMC_LA25_P" LOC = "M11";
-NET "FMC_LA26_N" LOC = "V7" ;
-NET "FMC_LA26_P" LOC = "U7" ;
-NET "FMC_LA27_N" LOC = "T11";
-NET "FMC_LA27_P" LOC = "R11";
-NET "FMC_LA28_N" LOC = "V11";
-NET "FMC_LA28_P" LOC = "U11";
-NET "FMC_LA29_N" LOC = "N8" ;
-NET "FMC_LA29_P" LOC = "M8" ;
-NET "FMC_LA30_N" LOC = "V12";
-NET "FMC_LA30_P" LOC = "T12";
-NET "FMC_LA31_N" LOC = "V6" ;
-NET "FMC_LA31_P" LOC = "T6" ;
-NET "FMC_LA32_N" LOC = "V15";
-NET "FMC_LA32_P" LOC = "U15";
-NET "FMC_LA33_N" LOC = "N9" ;
-NET "FMC_LA33_P" LOC = "M10";
-NET "FMC_PRSNT_M2C_L" LOC = "U13";
-NET "FMC_PWR_GOOD_FLASH_RST_B" LOC = "B3";
-
-
-NET "FPGA_AWAKE" LOC = "P15"| SLEW = SLOW | DRIVE = 2;
-NET "FPGA_CCLK" LOC = "R15";
-NET "FPGA_CMP_CLK" LOC = "U16";
-#NET "FPGA_CMP_CS_B" LOC = "P13";
-NET "FPGA_CMP_MOSI" LOC = "V16";
-NET "FPGA_D0_DIN_MISO_MISO1" LOC = "R13" | DRIVE = 4; ## 8 on U17 (thru series R187 100 ohm), 33 on U10, 6 on J12
-NET "FPGA_D1_MISO2" LOC = "T14" | DRIVE = 4; ## 9 on U17 (thru series R186 100 ohm), 35 on U10, 3 on J12
-NET "FPGA_D2_MISO3" LOC = "V14" | DRIVE = 4; ## 1 on U17, 38 on U10, 2 on J12
-#NET "FPGA_DONE" LOC = "V17"| SLEW = SLOW | DRIVE = 8; # findet MAP nicht, kein IOB
-NET "FPGA_HSWAPEN" LOC = "D4";
-NET "FPGA_INIT_B" LOC = "U3" | SLEW = SLOW | DRIVE = 4;
-NET "FPGA_M0_CMP_MISO" LOC = "T15";
-NET "FPGA_M1" LOC = "N12";
-NET "FPGA_MOSI_CSI_B_MISO0" LOC = "T13" | DRIVE = 4;
-NET "FPGA_ONCHIP_TERM1" LOC = "L6";
-NET "FPGA_ONCHIP_TERM2" LOC = "C2";
-#NET "FPGA_PROG_B" LOC = "V2" | IOSTANDARD = LVTTL | PULLDOWN; # kein IOB
-#NET "FPGA_SUSPEND" LOC = "R16"; # ERROR:MapLib:30
-#NET "FPGA_TCK" LOC = "A17"; # kein IOB
-#NET "FPGA_TDI" LOC = "D15"; # kein IOB
-#NET "FPGA_TDO" LOC = "D16"; # kein IOB
-#NET "FPGA_TMS" LOC = "B18";
-NET "FPGA_VTEMP" LOC = "P3";
-##
-## Pushbuttons, Bank 3, external Pulldown
-NET "GPIO_BUTTON<0>" LOC = "P4" ;
-NET "GPIO_BUTTON<1>" LOC = "F6" ;
-NET "GPIO_BUTTON<2>" LOC = "E4" ;
-NET "GPIO_BUTTON<3>" LOC = "F5" ;
-NET "GPIO_BUTTON*" TIG;
-##
-## 8 Pin IO Header J13, Bank 0,1,2
-NET "GPIO_HEADER_LS<0>" LOC = "N17"| SLEW = SLOW | DRIVE = 4 ;
-NET "GPIO_HEADER_LS<1>" LOC = "M18"| SLEW = SLOW | DRIVE = 4 ;
-NET "GPIO_HEADER_LS<2>" LOC = "A3" | SLEW = SLOW | DRIVE = 4 ;
-NET "GPIO_HEADER_LS<3>" LOC = "L15"| SLEW = SLOW | DRIVE = 4 ;
-NET "GPIO_HEADER_LS<4>" LOC = "F15"| SLEW = SLOW | DRIVE = 4 ;
-NET "GPIO_HEADER_LS<5>" LOC = "B4" | SLEW = SLOW | DRIVE = 4 ;
-NET "GPIO_HEADER_LS<6>" LOC = "F13"| SLEW = SLOW | DRIVE = 4 ;
-NET "GPIO_HEADER_LS<7>" LOC = "P12"| SLEW = SLOW | DRIVE = 4 ;
-##
-## 4 GP LEDs, Bank 0
-NET "GPIO_LED<0>" LOC = "E13"| SLEW = SLOW | DRIVE = 4 ;
-NET "GPIO_LED<1>" LOC = "C14"| SLEW = SLOW | DRIVE = 4 ;
-NET "GPIO_LED<2>" LOC = "C4" | SLEW = SLOW | DRIVE = 4 ;
-NET "GPIO_LED<3>" LOC = "A4" | SLEW = SLOW | DRIVE = 4 ;
-NET "GPIO_LED*" TIG;
-##
-## GP IO Dip Switches, Bank 0,2, external Pulldown
-NET "GPIO_SWITCH<0>" LOC = "D14";
-NET "GPIO_SWITCH<1>" LOC = "E12";
-NET "GPIO_SWITCH<2>" LOC = "F12";
-NET "GPIO_SWITCH<3>" LOC = "V13";
-NET "GPIO_SWITCH*" TIG;
-##
-## IIC Bus
-NET "IIC_SCL_MAIN" LOC = "P11";
-NET "IIC_SDA_MAIN" LOC = "N10";
-##
-## 10/100/1000 Tri-Speed Ethernet PHY
-NET "PHY_COL" LOC = "L14";
-NET "PHY_CRS" LOC = "M13";
-NET "PHY_INT" LOC = "J13";
-NET "PHY_MDC" LOC = "N14" | SLEW = SLOW | DRIVE = 4;
-NET "PHY_MDIO" LOC = "P16" | SLEW = SLOW | DRIVE = 4;
-NET "PHY_RESET" LOC = "L13";
-NET "PHY_RXCLK" LOC = "L16";
-NET "PHY_RXCTL_RXDV" LOC = "N18";
-NET "PHY_RXD<0>" LOC = "M14";
-NET "PHY_RXD<1>" LOC = "U18";
-NET "PHY_RXD<2>" LOC = "U17";
-NET "PHY_RXD<3>" LOC = "T18";
-NET "PHY_RXD<4>" LOC = "T17";
-NET "PHY_RXD<5>" LOC = "N16";
-NET "PHY_RXD<6>" LOC = "N15";
-NET "PHY_RXD<7>" LOC = "P18";
-NET "PHY_RXER" LOC = "P17";
-NET "PHY_TXCLK" LOC = "B9" ;
-NET "PHY_TXCTL_TXEN" LOC = "B8" | SLEW = SLOW | DRIVE = 4;
-NET "PHY_TXC_GTXCLK" LOC = "A9" ;
-NET "PHY_TXD<0>" LOC = "F8" | SLEW = SLOW | DRIVE = 4;
-NET "PHY_TXD<1>" LOC = "G8" | SLEW = SLOW | DRIVE = 4;
-NET "PHY_TXD<2>" LOC = "A6" | SLEW = SLOW | DRIVE = 4;
-NET "PHY_TXD<3>" LOC = "B6" | SLEW = SLOW | DRIVE = 4;
-NET "PHY_TXD<4>" LOC = "E6" | SLEW = SLOW | DRIVE = 4;
-NET "PHY_TXD<5>" LOC = "F7" | SLEW = SLOW | DRIVE = 4;
-NET "PHY_TXD<6>" LOC = "A5" | SLEW = SLOW | DRIVE = 4;
-NET "PHY_TXD<7>" LOC = "C5" | SLEW = SLOW | DRIVE = 4;
-NET "PHY_TXER" LOC = "A8" | SLEW = SLOW | DRIVE = 4;
-##
-## SPI x4 Flash
-NET "SPI_CS_B" LOC = "V3";
-##
-## 200 MHz oscillator (differential)
-NET "SYSCLK_N" LOC = "K16"| IOSTANDARD = LVDS_33 | TNM_NET = "SYSCLK";
-NET "SYSCLK_P" LOC = "K15"| IOSTANDARD = LVDS_33 | TNM_NET = "SYSCLK";
-TIMESPEC "TS_SYSCLK" = PERIOD "SYSCLK" 200 MHz HIGH 50 %;
-##
-## USB-UART
-## this names are real net names
-NET "USB_1_CTS" LOC = "U10"| DRIVE = 4 | SLEW = SLOW; # RTS output
-NET "USB_1_RTS" LOC = "T5" ; # CTS input
-NET "USB_1_RX" LOC = "L12"| DRIVE = 4 | SLEW = SLOW; # TX data out
-NET "USB_1_TX" LOC = "K14"; # RX data in
-##
-## 27 MHz
-NET "USER_CLOCK" LOC = "V10"| IOSTANDARD = LVCMOS33 ;
-NET "USER_CLOCK" PERIOD = 27 MHz HIGH 40%;
-##
-NET "USER_SMA_CLOCK_N" LOC = "H18"| TNM_NET = "USER_SMA_CLOCK";
-NET "USER_SMA_CLOCK_P" LOC = "H17"| TNM_NET = "USER_SMA_CLOCK";
-#TIMESPEC "TS_USER_SMA_CLOCK" = PERIOD "USER_SMA_CLOCK" 52 MHz HIGH 50 %;
-
-
diff --git a/test_rrobin_problem/synthesis/top.ut b/test_rrobin_problem/synthesis/top.ut
deleted file mode 100644
index ea9319f..0000000
--- a/test_rrobin_problem/synthesis/top.ut
+++ /dev/null
@@ -1,30 +0,0 @@
--w
--g DebugBitstream:No
--g Binary:no
--g CRC:Enable
--g Reset_on_err:No
--g ConfigRate:2
--g ProgPin:PullUp
--g TckPin:PullUp
--g TdiPin:PullUp
--g TdoPin:PullUp
--g TmsPin:PullUp
--g UnusedPin:PullDown
--g UserID:0xFFFFFFFF
--g ExtMasterCclk_en:No
--g SPI_buswidth:1
--g TIMER_CFG:0xFFFF
--g multipin_wakeup:No
--g StartUpClk:CClk
--g DONE_cycle:4
--g GTS_cycle:5
--g GWE_cycle:6
--g LCK_cycle:NoWait
--g Security:None
--g DonePipe:No
--g DriveDone:No
--g en_sw_gsr:No
--g drive_awake:No
--g sw_clk:Startupclk
--g sw_gwe_cycle:5
--g sw_gts_cycle:4
diff --git a/test_rrobin_problem/synthesis/top.xst b/test_rrobin_problem/synthesis/top.xst
deleted file mode 100644
index ae0c0c7..0000000
--- a/test_rrobin_problem/synthesis/top.xst
+++ /dev/null
@@ -1,53 +0,0 @@
-set -tmpdir "projnav.tmp"
-set -xsthdpdir "xst"
-run
--ifn ../top.prj
--ifmt mixed
--ofn top
--ofmt NGC
--p xc6slx16-2-csg324
--top top
--opt_mode Speed
--opt_level 1
--power NO
--iuc NO
--keep_hierarchy No
--netlist_hierarchy As_Optimized
--rtlview Yes
--glob_opt AllClockNets
--read_cores YES
--write_timing_constraints NO
--cross_clock_analysis NO
--hierarchy_separator /
--bus_delimiter <>
--case Maintain
--slice_utilization_ratio 100
--bram_utilization_ratio 100
--dsp_utilization_ratio 100
--lc Auto
--reduce_control_sets Auto
--fsm_extract YES -fsm_encoding Auto
--safe_implementation No
--fsm_style LUT
--ram_extract Yes
--ram_style Auto
--rom_extract Yes
--shreg_extract YES
--rom_style Auto
--auto_bram_packing NO
--resource_sharing YES
--async_to_sync NO
--shreg_min_size 2
--use_dsp48 Auto
--iobuf YES
--max_fanout 100000
--bufg 16
--register_duplication YES
--register_balancing No
--optimize_primitives NO
--use_clock_enable Auto
--use_sync_set Auto
--use_sync_reset Auto
--iob Auto
--equivalent_register_removal YES
--slice_utilization_ratio_maxmargin 5
diff --git a/tobuy.txt b/tobuy.txt
deleted file mode 100644
index cd16063..0000000
--- a/tobuy.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-PMODS für FPGAs
-===============
-http://www.maxim-ic.com/products/evkits/fpga-modules/
-
-
-Lattice MACH XO(2)
-==================
-
-MACH XO2 Eval Board (38€)
-LCMXO2-1200ZE-P1-EVN
-
-
-MACH XO Breakout Board (25€)
-LCMXO2280C-B-EVN
diff --git a/tomake.txt b/tomake.txt
deleted file mode 100644
index 1add4d9..0000000
--- a/tomake.txt
+++ /dev/null
@@ -1,48 +0,0 @@
-* Ansteuerung von SPI-Flash auf FPGA-Entwicklungsboards
- (SP601/SP605/Spartan3e)
- Möglichkeit zur Nutzung als Konfigurations und Programmspeicher
-
-
-* Portierung uIP/lwIP auf ZPU/greth microblaze/temac für
- FPGA Spartan 3e und Spartan 6
-
-
-
-* Entwicklung eines UDP-Stacks (in C) für ZPU (FPGA) und ARM-Cores
- Ziele:
- ggf. Portierung des vorhandenen Debug-Monitor
- Ansteuerung des Debug-Monitors per UDP
- Ermittlung der maximal möglichen Transferrate auf der jeweiligen Plattform
-
-
-
-* Evaluierung von Entwicklungssystemen [STM32 (STMicroelectronics), NuMicro (Nuvoton), MSP430 (Texas Instruments) und/oder C8051/CP2201 (Sillicon Laboratories)]
- Ziele:
- Welche Entwicklungssysteme laufen auf welcher Plattform (64bit?)
- Lassen sich die Evaluation-Boards aus einer virtuellen Maschine heraus programmieren/debuggen?
- Welche Schnittstellen/Peripherie steht zur Verfügung?
- Wie lassen sich die verschiedenen Systeme schnell und günstig mit einem FPGA koppeln?
-
-
-* Inbetriebnahme/Portierung von eCos auf
- STM32
- ZPU
- MicroBlaze
- PPC
-
- Ziele:
- Ermittlung der Leistungsfähigkeit und des Ressourcenverbrauch (Flash, RAM) von ECOS auf den
- verschiedenen Entwicklungsplattformen
-
-
-* Evaluierung der PCIe Connnectivität des SP605
- Xilinx Core bzw. grlib
-
-
-* Evaluierung von Xilinx-Zynq (FPGA mit ARM-Kern)
-
-* Evaluierung von Actel-Smartfusion (FPGA mit ARM-Kern)
-
-
-* Evaluierung Altera/NIOS
- sowie Vergleichsweise ZPU auf Altera
diff --git a/tool_makefile/Makefile.synthesis.digilent_s3e b/tool_makefile/Makefile.synthesis.digilent_s3e
deleted file mode 100644
index ace90ab..0000000
--- a/tool_makefile/Makefile.synthesis.digilent_s3e
+++ /dev/null
@@ -1,203 +0,0 @@
-#
-# $HeadURL: https://svn.fzd.de/repo/concast/FWF_Projects/FWKE/beam_position_monitor/hardware/board_sp601_amba/synthese/Makefile $
-# $Date: 2011-11-18 08:42:44 +0100 (Fr, 18. Nov 2011) $
-# $Author: lange $
-# $Revision: 1257 $
-#
-
-MODULE = top
-SPEEDGRADE = 4
-DEVICE = xc3s500e-fg320-$(SPEEDGRADE)
-UCF_FILE = s3estarter.ucf
-CORES = ../cores/
-SOFTWARE = ../software
-BMM_FILE = zpu_i0_memory.bmm
-
-BUILDDIR = isebuild
-DATE = $(shell date +"%Y-%m-%d__%H_%M")
-LOGFILE = synthesis_log_$(DATE).txt
-export XST_LOGFILE := $(LOGFILE)
-
-
-all:
- @echo "check - look for timing and other synthesis issues"
- @echo "xst - generate ngc file (netlist, replaces edif and netlist constrains)"
- @echo "translate - generate ngd file (native generic database [reduced to primitives])"
- @echo "map - generate ncd file (native ciruit description)"
- @echo "par - place&route ncd file (design implementation)"
- @echo "trace - generate timing report"
- @echo "bitgen - generate bit file (ncd -> bit)"
- @echo "update - update bitstream with elf file"
- @echo "program - program fpga with bit file"
- @echo "genmcs - genrate mcs file"
- @echo "progspi - program spi flash with mcs file"
- @echo "clean"
- @echo "..."
- @echo "testflow - update bitgen update program check"
- @echo "finalflow - update bitgen update progspi check"
-
-testflow:
- time $(MAKE) software bitgen update program check 2>&1 | tee $(XST_LOGFILE)
-
-finalflow:
- time $(MAKE) software bitgen update progspi check 2>&1 | tee $(XST_LOGFILE)
-
-
-check:
- @echo -e "Timing score: "
- @grep --with-filename "Timing Score" $(BUILDDIR)/*.par
- @echo -e "\nUnwanted Latches (737): "
- @grep --with-filename "WARNING:Xst:737" $(BUILDDIR)/*.syr || echo -n
- @echo -e "\nUnassigned signals (653): "
- @grep --with-filename "WARNING:Xst:653" $(BUILDDIR)/*.syr || echo -n
- @echo -e "\nCombinatoric loops (2170): "
- @grep --with-filename "WARNING:Xst:2170" $(BUILDDIR)/*.syr || echo -n
- @echo -e "\nGated clocks (372): "
- @grep --with-filename "WARNING:PhysDesignRules:372" $(BUILDDIR)/*.bgn || echo -n
-
-
-software:
- ###
- #############################################################################
- ### (re)compile software
- ###
- test ! -d $(SOFTWARE) || make all --directory $(SOFTWARE)
-
-
-update: $(BUILDDIR)/$(MODULE).bit
- ###
- #############################################################################
- ### update the bitfile
- ###
- test ! -d $(SOFTWARE) || data2mem -bm $(BMM_FILE) -bd $(SOFTWARE)/*.elf -bt $(BUILDDIR)/$(MODULE).bit -o b $(MODULE)_update.bit
- test -d $(SOFTWARE) || cp $(BUILDDIR)/$(MODULE).bit $(MODULE)_update.bit
-
-
-program:
- ###
- #############################################################################
- ### configure FPGA
- ###
- impact -batch program_fpga.cmd
-
-
-genmcs: $(MODULE)_update.mcs
-
-$(MODULE)_update.mcs: $(MODULE)_update.bit
- ###
- #############################################################################
- ### generate flash file
- ###
- promgen -spi -p mcs -w -o $(MODULE)_update.mcs -s 8192 -u 0 $(MODULE)_update.bit
-
-
-progspi: genmcs
- ###
- #############################################################################
- ### program flash
- ###
- impact -batch program_spi.cmd
-
-
-clean:
- rm -f $(MODULE).prj
- rm -f *.log
- rm -f _impact.cmd
- rm -f *.cfi
- rm -f *.prm
- rm -rf $(BUILDDIR)
-
-
-dir: $(MODULE).prj
- ###
- #############################################################################
- ### generate build directory
- ###
- mkdir -p $(BUILDDIR)
- mkdir -p $(BUILDDIR)/projnav.tmp
-
-
-
-$(MODULE).prj: ../simulation/vhdl_files.txt
- ###
- #############################################################################
- ### generate project file
- ###
- grep --invert rtl_tb ../simulation/vhdl_files.txt | grep --invert "^$$" | awk '{printf "vhdl %s %s\n",$$1,$$2}' > $(MODULE).prj
-
-
-xst: $(MODULE).ngc
-translate: $(MODULE).ngd
-map: $(MODULE)_map.ncd
-par: $(MODULE).ncd
-
-
-hw_timestamp:
- ###
- #############################################################################
- #### update hw timestamp
- ###
- test ! -f ../rtl/Makefile || make --directory ../rtl
-
-$(MODULE).ngc: dir hw_timestamp
- ###
- #############################################################################
- ### synthesis
- ###
- cd $(BUILDDIR) ; xst -ifn ../$(MODULE).xst -ofn $(MODULE).syr
-
-
-$(MODULE).ngd: $(MODULE).ngc $(UCF_FILE)
- ###
- #############################################################################
- ### translate
- ###
- cd $(BUILDDIR) ; ngdbuild -dd _ngo -nt timestamp -uc ../$(UCF_FILE) -p $(DEVICE) -sd ../$(CORES) $(MODULE).ngc $(MODULE).ngd
-
-$(MODULE)_map.ncd: $(MODULE).ngd
- ###
- #############################################################################
- ### map
- ###
- @# explanation of map parameters:
- @# -p part number
- @# -mt multi-threading
- @# -w overwrite existing files
- @# -logic_opt logic optimization
- @# -ol overall effor level (std|high)
- @# -t placer cost table
- @# -xt extra placer cost table
- @# -register_duplication duplicate registers
- @# -global_opt Global Optimization (off|speed|area|power)
- @# -ir ignore RLOCs
- @# -pr pack registers in IO (off|i|o|b)
- @# -lc lut combining (auto|area|off)
- @# -power Virtex 6 Power Optimization (on|off|high|xe)
- @# -detail Generate Detailed MAP Report
- @# -o Output File Name
- @# -bp enables block RAM mapping
- cd $(BUILDDIR) ; export XIL_PAR_DESIGN_CHECK_VERBOSE=1; map -p $(DEVICE) -cm speed -detail -ir off -pr off -c 100 -o $(MODULE)_map.ncd $(MODULE).ngd $(MODULE).pcf
-
-
-$(MODULE).ncd: $(MODULE)_map.ncd
- ###
- #############################################################################
- ### place & route
- ###
- cd $(BUILDDIR) ; par -w -ol high -t 1 $(MODULE)_map.ncd $(MODULE).ncd $(MODULE).pcf
-
-trace:
- cd $(BUILDDIR) ; trce -e -a -u -s $(SPEEDGRADE) -xml $(MODULE).twx $(MODULE).ncd -o $(MODULE).twr $(MODULE).pcf
-
-tracefast:
- cd $(BUILDDIR) ; trce -v 12 -s $(SPEEDGRADE) -fastpaths -xml $(MODULE).twx -o $(MODULE).twr $(MODULE).ncd $(MODULE).pcf
-
-
-bitgen: $(MODULE).ncd
- ###
- #############################################################################
- ### generate bitfile
- ###
- cd $(BUILDDIR) ; bitgen -f ../$(MODULE).ut $(MODULE).ncd
-
-
diff --git a/tool_makefile/Makefile.synthesis.sp601 b/tool_makefile/Makefile.synthesis.sp601
deleted file mode 100644
index 9c6923d..0000000
--- a/tool_makefile/Makefile.synthesis.sp601
+++ /dev/null
@@ -1,204 +0,0 @@
-#
-# $HeadURL: https://svn.fzd.de/repo/concast/FWF_Projects/FWKE/beam_position_monitor/hardware/board_sp601_amba/synthese/Makefile $
-# $Date: 2011-11-18 08:42:44 +0100 (Fr, 18. Nov 2011) $
-# $Author: lange $
-# $Revision: 1257 $
-#
-
-MODULE = top
-SPEEDGRADE = 2
-DEVICE = xc6slx16-csg324-$(SPEEDGRADE)
-UCF_FILE = sp601.ucf
-CORES = ../cores/
-SOFTWARE = ../software
-BMM_FILE = zpu_i0_memory_64k.bmm
-
-BUILDDIR = isebuild
-DATE = $(shell date +"%Y-%m-%d__%H_%M")
-LOGFILE = synthesis_log_$(DATE).txt
-export XST_LOGFILE := $(LOGFILE)
-
-
-all:
- @echo "check - look for timing and other synthesis issues"
- @echo "xst - generate ngc file (netlist, replaces edif and netlist constrains)"
- @echo "translate - generate ngd file (native generic database [reduced to primitives])"
- @echo "map - generate ncd file (native ciruit description)"
- @echo "par - place&route ncd file (design implementation)"
- @echo "trace - generate timing report"
- @echo "bitgen - generate bit file (ncd -> bit)"
- @echo "update - update bitstream with elf file"
- @echo "program - program fpga with bit file"
- @echo "genmcs - genrate mcs file"
- @echo "progspi - program spi flash with mcs file"
- @echo "clean"
- @echo "..."
- @echo "testflow - update bitgen update program check"
- @echo "finalflow - update bitgen update progspi check"
-
-testflow:
- time $(MAKE) software bitgen update program check 2>&1 | tee $(XST_LOGFILE)
-
-finalflow:
- time $(MAKE) software bitgen update progspi check 2>&1 | tee $(XST_LOGFILE)
-
-
-check:
- @echo -e "Timing score: "
- @grep --with-filename "Timing Score" $(BUILDDIR)/*.par
- @echo -e "\nUnwanted Latches (737): "
- @grep --with-filename "WARNING:Xst:737" $(BUILDDIR)/*.syr || echo -n
- @echo -e "\nUnassigned signals (653): "
- @grep --with-filename "WARNING:Xst:653" $(BUILDDIR)/*.syr || echo -n
- @echo -e "\nCombinatoric loops (2170): "
- @grep --with-filename "WARNING:Xst:2170" $(BUILDDIR)/*.syr || echo -n
- @echo -e "\nGated clocks (372): "
- @grep --with-filename "WARNING:PhysDesignRules:372" $(BUILDDIR)/*.bgn || echo -n
-
-
-software:
- ###
- #############################################################################
- ### (re)compile software
- ###
- test ! -d $(SOFTWARE) || make all --directory $(SOFTWARE)
-
-
-update: $(BUILDDIR)/$(MODULE).bit
- ###
- #############################################################################
- ### update the bitfile
- ###
- test ! -d $(SOFTWARE) || data2mem -bm $(BMM_FILE) -bd $(SOFTWARE)/*.elf -bt $(BUILDDIR)/$(MODULE).bit -o b $(MODULE)_update.bit
- test -d $(SOFTWARE) || cp $(BUILDDIR)/$(MODULE).bit $(MODULE)_update.bit
-
-
-program:
- ###
- #############################################################################
- ### configure FPGA
- ###
- impact -batch program_fpga.cmd
-
-
-genmcs: $(MODULE)_update.mcs
-
-$(MODULE)_update.mcs: $(MODULE)_update.bit
- ###
- #############################################################################
- ### generate flash file
- ###
- promgen -spi -p mcs -w -o $(MODULE)_update.mcs -s 8192 -u 0 $(MODULE)_update.bit
-
-
-progspi: genmcs
- ###
- #############################################################################
- ### program flash
- ###
- impact -batch program_spi.cmd
-
-
-clean:
- rm -f $(MODULE).prj
- rm -f *.log
- rm -f _impact.cmd
- rm -f *.cfi
- rm -f *.prm
- rm -rf $(BUILDDIR)
-
-
-dir: $(MODULE).prj
- ###
- #############################################################################
- ### generate build directory
- ###
- mkdir -p $(BUILDDIR)
- mkdir -p $(BUILDDIR)/projnav.tmp
-
-
-
-$(MODULE).prj: ../simulation/vhdl_files.txt
- ###
- #############################################################################
- ### generate project file
- ###
- grep --invert rtl_tb ../simulation/vhdl_files.txt | grep --invert "^$$" | awk '{printf "vhdl %s %s\n",$$1,$$2}' > $(MODULE).prj
-
-
-xst: $(MODULE).ngc
-translate: $(MODULE).ngd
-map: $(MODULE)_map.ncd
-par: $(MODULE).ncd
-
-
-hw_timestamp:
- ###
- #############################################################################
- #### update hw timestamp
- ###
- test ! -f ../rtl/Makefile || make --directory ../rtl
-
-$(MODULE).ngc: dir hw_timestamp
- ###
- #############################################################################
- ### synthesis
- ###
- cd $(BUILDDIR) ; xst -ifn ../$(MODULE).xst -ofn $(MODULE).syr
-
-
-$(MODULE).ngd: $(MODULE).ngc $(UCF_FILE)
- ###
- #############################################################################
- ### translate
- ###
- cd $(BUILDDIR) ; ngdbuild -dd _ngo -nt timestamp -uc ../$(UCF_FILE) -p $(DEVICE) -sd ../$(CORES) $(MODULE).ngc $(MODULE).ngd
-
-$(MODULE)_map.ncd: $(MODULE).ngd
- ###
- #############################################################################
- ### map
- ###
- @# explanation of map parameters:
- @# -p part number
- @# -mt multi-threading
- @# -w overwrite existing files
- @# -logic_opt logic optimization
- @# -ol overall effor level (std|high)
- @# -t placer cost table
- @# -xt extra placer cost table
- @# -register_duplication duplicate registers
- @# -global_opt Global Optimization (off|speed|area|power)
- @# -ir ignore RLOCs
- @# -pr pack registers in IO (off|i|o|b)
- @# -lc lut combining (auto|area|off)
- @# -power Virtex 6 Power Optimization (on|off|high|xe)
- @# -detail Generate Detailed MAP Report
- @# -o Output File Name
- @# -bp enables block RAM mapping
- cd $(BUILDDIR) ; export XIL_PAR_DESIGN_CHECK_VERBOSE=1; map -p $(DEVICE) -mt 2 -w -logic_opt off -ol high -t 1 -xt 0 -register_duplication off -global_opt off -ir off -pr off -lc off -power off -detail -o $(MODULE)_map.ncd $(MODULE).ngd $(MODULE).pcf
-
-
-$(MODULE).ncd: $(MODULE)_map.ncd
- ###
- #############################################################################
- ### place & route
- ###
- cd $(BUILDDIR) ; par -w -mt 4 -ol high $(MODULE)_map.ncd $(MODULE).ncd $(MODULE).pcf
-
-
-trace:
- cd $(BUILDDIR) ; trce -e -a -u -s $(SPEEDGRADE) -xml $(MODULE).twx $(MODULE).ncd -o $(MODULE).twr $(MODULE).pcf
-
-tracefast:
- cd $(BUILDDIR) ; trce -v 12 -s $(SPEEDGRADE) -fastpaths -xml $(MODULE).twx -o $(MODULE).twr $(MODULE).ncd $(MODULE).pcf
-
-
-bitgen: $(MODULE).ncd
- ###
- #############################################################################
- ### generate bitfile
- ###
- cd $(BUILDDIR) ; bitgen -f ../$(MODULE).ut $(MODULE).ncd
-
-
diff --git a/tool_makefile/Makefile.synthesis.sp605 b/tool_makefile/Makefile.synthesis.sp605
deleted file mode 100644
index 5c25917..0000000
--- a/tool_makefile/Makefile.synthesis.sp605
+++ /dev/null
@@ -1,204 +0,0 @@
-#
-# $HeadURL: https://svn.fzd.de/repo/concast/FWF_Projects/FWKE/beam_position_monitor/hardware/board_sp601_amba/synthese/Makefile $
-# $Date: 2011-11-18 08:42:44 +0100 (Fr, 18. Nov 2011) $
-# $Author: lange $
-# $Revision: 1257 $
-#
-
-MODULE = top
-SPEEDGRADE = 3
-DEVICE = xc6slx45t-fgg484-$(SPEEDGRADE)
-UCF_FILE = sp605.ucf
-CORES = ../cores/
-SOFTWARE = ../software
-BMM_FILE = zpu_i0_memory_64k.bmm
-
-BUILDDIR = isebuild
-DATE = $(shell date +"%Y-%m-%d__%H_%M")
-LOGFILE = synthesis_log_$(DATE).txt
-export XST_LOGFILE := $(LOGFILE)
-
-
-all:
- @echo "check - look for timing and other synthesis issues"
- @echo "xst - generate ngc file (netlist, replaces edif and netlist constrains)"
- @echo "translate - generate ngd file (native generic database [reduced to primitives])"
- @echo "map - generate ncd file (native ciruit description)"
- @echo "par - place&route ncd file (design implementation)"
- @echo "trace - generate timing report"
- @echo "bitgen - generate bit file (ncd -> bit)"
- @echo "update - update bitstream with elf file"
- @echo "program - program fpga with bit file"
- @echo "genmcs - genrate mcs file"
- @echo "progspi - program spi flash with mcs file"
- @echo "clean"
- @echo "..."
- @echo "testflow - update bitgen update program check"
- @echo "finalflow - update bitgen update progspi check"
-
-testflow:
- time $(MAKE) software bitgen update program check 2>&1 | tee $(XST_LOGFILE)
-
-finalflow:
- time $(MAKE) software bitgen update progspi check 2>&1 | tee $(XST_LOGFILE)
-
-
-check:
- @echo -e "Timing score: "
- @grep --with-filename "Timing Score" $(BUILDDIR)/*.par
- @echo -e "\nUnwanted Latches (737): "
- @grep --with-filename "WARNING:Xst:737" $(BUILDDIR)/*.syr || echo -n
- @echo -e "\nUnassigned signals (653): "
- @grep --with-filename "WARNING:Xst:653" $(BUILDDIR)/*.syr || echo -n
- @echo -e "\nCombinatoric loops (2170): "
- @grep --with-filename "WARNING:Xst:2170" $(BUILDDIR)/*.syr || echo -n
- @echo -e "\nGated clocks (372): "
- @grep --with-filename "WARNING:PhysDesignRules:372" $(BUILDDIR)/*.bgn || echo -n
-
-
-software:
- ###
- #############################################################################
- ### (re)compile software
- ###
- test ! -d $(SOFTWARE) || make all --directory $(SOFTWARE)
-
-
-update: $(BUILDDIR)/$(MODULE).bit
- ###
- #############################################################################
- ### update the bitfile
- ###
- test ! -d $(SOFTWARE) || data2mem -bm $(BMM_FILE) -bd $(SOFTWARE)/*.elf -bt $(BUILDDIR)/$(MODULE).bit -o b $(MODULE)_update.bit
- test -d $(SOFTWARE) || cp $(BUILDDIR)/$(MODULE).bit $(MODULE)_update.bit
-
-
-program:
- ###
- #############################################################################
- ### configure FPGA
- ###
- impact -batch program_fpga.cmd
-
-
-genmcs: $(MODULE)_update.mcs
-
-$(MODULE)_update.mcs: $(MODULE)_update.bit
- ###
- #############################################################################
- ### generate flash file
- ###
- promgen -spi -p mcs -w -o $(MODULE)_update.mcs -s 8192 -u 0 $(MODULE)_update.bit
-
-
-progspi: genmcs
- ###
- #############################################################################
- ### program flash
- ###
- impact -batch program_spi.cmd
-
-
-clean:
- rm -f $(MODULE).prj
- rm -f *.log
- rm -f _impact.cmd
- rm -f *.cfi
- rm -f *.prm
- rm -rf $(BUILDDIR)
-
-
-dir: $(MODULE).prj
- ###
- #############################################################################
- ### generate build directory
- ###
- mkdir -p $(BUILDDIR)
- mkdir -p $(BUILDDIR)/projnav.tmp
-
-
-
-$(MODULE).prj: ../simulation/vhdl_files.txt
- ###
- #############################################################################
- ### generate project file
- ###
- grep --invert rtl_tb ../simulation/vhdl_files.txt | grep --invert "^$$" | awk '{printf "vhdl %s %s\n",$$1,$$2}' > $(MODULE).prj
-
-
-xst: $(MODULE).ngc
-translate: $(MODULE).ngd
-map: $(MODULE)_map.ncd
-par: $(MODULE).ncd
-
-
-hw_timestamp:
- ###
- #############################################################################
- #### update hw timestamp
- ###
- test ! -f ../rtl/Makefile || make --directory ../rtl
-
-$(MODULE).ngc: dir hw_timestamp
- ###
- #############################################################################
- ### synthesis
- ###
- cd $(BUILDDIR) ; xst -ifn ../$(MODULE).xst -ofn $(MODULE).syr
-
-
-$(MODULE).ngd: $(MODULE).ngc $(UCF_FILE)
- ###
- #############################################################################
- ### translate
- ###
- cd $(BUILDDIR) ; ngdbuild -dd _ngo -nt timestamp -uc ../$(UCF_FILE) -p $(DEVICE) -sd ../$(CORES) $(MODULE).ngc $(MODULE).ngd
-
-$(MODULE)_map.ncd: $(MODULE).ngd
- ###
- #############################################################################
- ### map
- ###
- @# explanation of map parameters:
- @# -p part number
- @# -mt multi-threading
- @# -w overwrite existing files
- @# -logic_opt logic optimization
- @# -ol overall effor level (std|high)
- @# -t placer cost table
- @# -xt extra placer cost table
- @# -register_duplication duplicate registers
- @# -global_opt Global Optimization (off|speed|area|power)
- @# -ir ignore RLOCs
- @# -pr pack registers in IO (off|i|o|b)
- @# -lc lut combining (auto|area|off)
- @# -power Virtex 6 Power Optimization (on|off|high|xe)
- @# -detail Generate Detailed MAP Report
- @# -o Output File Name
- @# -bp enables block RAM mapping
- cd $(BUILDDIR) ; export XIL_PAR_DESIGN_CHECK_VERBOSE=1; map -p $(DEVICE) -mt 2 -w -logic_opt off -ol high -t 1 -xt 0 -register_duplication off -global_opt off -ir off -pr off -lc off -power off -detail -o $(MODULE)_map.ncd $(MODULE).ngd $(MODULE).pcf
-
-
-$(MODULE).ncd: $(MODULE)_map.ncd
- ###
- #############################################################################
- ### place & route
- ###
- cd $(BUILDDIR) ; par -w -mt 4 -ol high $(MODULE)_map.ncd $(MODULE).ncd $(MODULE).pcf
-
-
-trace:
- cd $(BUILDDIR) ; trce -e -a -u -s $(SPEEDGRADE) -xml $(MODULE).twx $(MODULE).ncd -o $(MODULE).twr $(MODULE).pcf
-
-tracefast:
- cd $(BUILDDIR) ; trce -v 12 -s $(SPEEDGRADE) -fastpaths -xml $(MODULE).twx -o $(MODULE).twr $(MODULE).ncd $(MODULE).pcf
-
-
-bitgen: $(MODULE).ncd
- ###
- #############################################################################
- ### generate bitfile
- ###
- cd $(BUILDDIR) ; bitgen -f ../$(MODULE).ut $(MODULE).ncd
-
-
diff --git a/treemap/Makefile b/treemap/Makefile
deleted file mode 100644
index 386bc20..0000000
--- a/treemap/Makefile
+++ /dev/null
@@ -1,67 +0,0 @@
-#TOP = top
-#DIR = ../s3estarter/syn/xst
-#SCREENSHOT = s3estarter_ressources
-
-TOP = top
-DIR = ../beam_position_monitor/hardware/board_sp601_amba/synthsis/xst
-SCREENSHOT = bpm_sp601_amba
-
-#TOP = top
-#DIR = ../beam_position_monitor/hardware/board_sp605/synthsis/xst
-#SCREENSHOT = bpm_sp605
-
-#TOP = top
-#DIR = ../central_trigger_generator/syn/xst
-#SCREENSHOT = central_trigger_ressources
-
-
-# derived Variables
-MAPREPORTXML = $(DIR)/$(TOP)_map.xrpt
-MAPREPORT = $(DIR)/$(TOP)_map.mrp
-
-
-start = $(shell grep --line-number "^Logic Utilization:" $(DIR)/$(TOP)_map.mrp | cut -d":" -f1)
-end = $(shell grep --line-number "^Peak Memory Usage:" $(DIR)/$(TOP)_map.mrp | cut -d":" -f1)
-
-
-help:
- @echo "run - run Treeviz"
- @echo "convert - convert data (on unix)"
- @echo "util - grep for utilization"
- @echo "combine - two screenshots for better overview"
- @echo "clean - tidy up"
-
-run: ressources.xml
- @echo "save screeshot as $(SCREENSHOT)_grob.png and $(SCREENSHOT)_fein.png"
- java -jar Treeviz/dist/Treeviz.jar $<
-
-convert: ressources.xml
-
-
-# useful for printing with graphic report
-# cut lines beetween "Logic Utilization" and "Average Fanout..."
-util: $(MAPREPORT)
- @sed -n '/Logic Utilization:/,/^Average Fanout of Non-Clock Nets:/p' $(MAPREPORT)
-
-# not so useful -> confusing if hierachy to deep
-# cut lines from "Section 13" (2nd occurence) and end of file
-util_hier: $(MAPREPORT)
- @tail -n +$(shell grep --line-number "^Section 13" $(MAPREPORT) | tail -1 | cut -d":" -f1) $(MAPREPORT)
-
-
-
-ressources.xml: $(MAPREPORTXML) convert.xsl
- saxon-xslt $(MAPREPORTXML) convert.xsl > tmp.xml
- # prune empty lines with sed
- sed -e '/^[ ]*$$/d' tmp.xml > ressources.xml
- # cleanup
- rm -f tmp.xml
-
-
-combine: $(SCREENSHOT)_fein.png $(SCREENSHOT)_grob.png
- composite -blend 33 $(SCREENSHOT)_fein.png $(SCREENSHOT)_grob.png $(SCREENSHOT)_mixed.png
-
-
-clean:
- rm -f ressources.xml
-
diff --git a/treemap/convert.xsl b/treemap/convert.xsl
deleted file mode 100644
index 080bd00..0000000
--- a/treemap/convert.xsl
+++ /dev/null
@@ -1,110 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-
-<xsl:output encoding="UTF-8"/>
-<xsl:strip-space elements="*" />
-<xsl:preserve-space elements="node" />
-
-<xsl:template match="tree">
-
- <xsl:if test="@stringID='MAP_MODULE_HIERARCHY'">
- <xsl:apply-templates />
- </xsl:if>
-
-</xsl:template>
-
-
-<xsl:template match="node">
-
- <xsl:variable name="nodename">
- <xsl:value-of select="@value" />
- </xsl:variable>
-
- <xsl:variable name="nodeslices">
- <xsl:call-template name="slices" />
- </xsl:variable>
-
- <xsl:variable name="nodeslice_reg">
- <xsl:call-template name="slice_reg" />
- </xsl:variable>
-
- <xsl:variable name="nodeluts">
- <xsl:call-template name="luts" />
- </xsl:variable>
-
- <xsl:variable name="nodelutram">
- <xsl:call-template name="lutram" />
- </xsl:variable>
-
- <xsl:variable name="nodebrams">
- <xsl:call-template name="brams" />
- </xsl:variable>
-
- <xsl:variable name="nodemul_dsp">
- <xsl:call-template name="mul_dsp" />
- </xsl:variable>
-
-<!--<node name="{$nodename}" size="{$nodeslices}" created="{substring(concat('0000',$nodebrams),1+string-length($nodebrams),4)}-01-01 00:00:00">-->
- <node name="{$nodename}" slices="{$nodeslices}" slice_reg="{$nodeslice_reg}" luts="{$nodeluts}" lutram="{$nodelutram}" brams="{$nodebrams}" mul_dsp="{$nodemul_dsp}">
- <xsl:apply-templates />
- </node>
-
-</xsl:template>
-
-
-<xsl:template name="slices">
- <xsl:for-each select="item">
- <xsl:if test="@stringID='MAP_SLICES'">
- <xsl:value-of select="@value" />
-<!-- <xsl:value-of select="@ACCUMULATED" />-->
- </xsl:if>
- </xsl:for-each>
-</xsl:template>
-
-
-<xsl:template name="slice_reg">
- <xsl:for-each select="item">
- <xsl:if test="@stringID='MAP_SLICE_REG'">
- <xsl:value-of select="@value" />
- </xsl:if>
- </xsl:for-each>
-</xsl:template>
-
-
-<xsl:template name="luts">
- <xsl:for-each select="item">
- <xsl:if test="@label='LUTs'">
- <xsl:value-of select="@value" />
- </xsl:if>
- </xsl:for-each>
-</xsl:template>
-
-
-<xsl:template name="lutram">
- <xsl:for-each select="item">
- <xsl:if test="@label='LUTRAM'">
- <xsl:value-of select="@value" />
- </xsl:if>
- </xsl:for-each>
-</xsl:template>
-
-
-<xsl:template name="brams">
- <xsl:for-each select="item">
- <xsl:if test="@stringID='MAP_BRAM' or @stringID='MAP_BRAM_FIFO'">
- <xsl:value-of select="@value" />
- </xsl:if>
- </xsl:for-each>
-</xsl:template>
-
-
-<xsl:template name="mul_dsp">
- <xsl:for-each select="item">
- <xsl:if test="@stringID='MAP_MULT18X18' or @label='DSP48A1'">
- <xsl:value-of select="@value" />
- </xsl:if>
- </xsl:for-each>
-</xsl:template>
-
-
-</xsl:stylesheet>
diff --git a/uc_arm/checkliste.txt b/uc_arm/checkliste.txt
deleted file mode 100644
index 3779293..0000000
--- a/uc_arm/checkliste.txt
+++ /dev/null
@@ -1,63 +0,0 @@
-Problem: die guten/aktuellen Boards gibt es nur mit kostenpflichtigem ecosPRO Support
-
-TODO: Nachschauen, welche Boards von der CVS-Version von ecos unterstützt werden:
-http://ecos.sourceware.org/anoncvs.html
-CortexM3 -> Stellaris EK-LM3SS811 --> auch nur 8k RAM
-CortexM3 -> Olimex LPC 1766 STK
-
-
-
-Stamp9261 von Taskit
-====================
-http://www.taskit.de/produkte/stamp/index.htm?gclid=CJ28pvq4nqcCFUjxzAodSVDecw
-- 100polige Hirose FX8-Stecker (StampAdaptor), wo zu beziehen?
-+ 32Bit Prozessorbus am StampAdaptor
-- Ethernet StampAdaptors
-Referenzchip (DM9000A) angeblich nur bei DacomWest zu finden
-* Briefmarke ab 99€
-* Starterkit ab 550€
-
-
-Stamp9G20 von Taskit
-====================
-http://www.taskit.de/produkte/stamp9g20/index.htm
-- 100polige Hirose FX8
-+ 16Bit Prozessorbus
-
-
-AIM 711
-=======
-http://www.visionsystems.de/produkte/325.html
-SO-DIMM Formfaktor
-+ ECOS ready
-- nur 8bit Bus
-
-
-Eddy v2.1-Serie
-===============
-http://www.trenz-electronic.de/de/produkte/arm-cpu-module/systembase/eddy-v21.html
-mit Linux
-- ecos nur als ecos pro support
-+ 16Bit Datenbus (19Bit Adressen)
-+ werben mit langer Verfügbarkeit
-Preis 51€
-Starterkit 160€
-
-
-CSB737 von Cogent
-=================
-SODIMM Formfaktor
-+ 16Bit Daten/ 25Bit Adressbus
-
-
-Abcheckliste
-http://www.gumstix.com/store/catalog/product_info.php?products_id=251
-
-auf der Eddy CPU ist ein KSZ8041NL
-Ethernet Controller von Micrel
-
-ein AT91SAM9260. Der hat bereits ein MAC.
-
-Fazit: Mit Eddy-S2M/PIN V2 ist man für 79 Euro dabei, wenn man etwas
-mit Ethernet, Seriell, USB und MMC machen will.
-
diff --git a/uc_str912/erase_flash/Makefile b/uc_str912/erase_flash/Makefile
deleted file mode 100644
index b8b8b61..0000000
--- a/uc_str912/erase_flash/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-all: erase
-
-erase: erase.o erase_jlink.gdb
- arm-none-eabi-gdb -x erase_jlink.gdb
-
-erase.o: erase.S
- arm-none-eabi-as erase.S -o erase.o
-
-clean:
- rm -f erase.o
diff --git a/uc_str912/erase_flash/erase.S b/uc_str912/erase_flash/erase.S
deleted file mode 100644
index 6abf4fc..0000000
--- a/uc_str912/erase_flash/erase.S
+++ /dev/null
@@ -1,3 +0,0 @@
-/* erase.S */
-.text
-.space 1024*512
diff --git a/uc_str912/erase_flash/erase_jlink.gdb b/uc_str912/erase_flash/erase_jlink.gdb
deleted file mode 100644
index ddf866e..0000000
--- a/uc_str912/erase_flash/erase_jlink.gdb
+++ /dev/null
@@ -1,7 +0,0 @@
-target remote :2331
-monitor endian little
-monitor flash download = 1
-monitor flash device = STR912FAW44
-load erase.o
-monitor reset
-quit
diff --git a/uc_str912/openocd/amontec.sh b/uc_str912/openocd/amontec.sh
deleted file mode 100644
index c49c229..0000000
--- a/uc_str912/openocd/amontec.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-openocd -f openocd_amontec.cfg
-#--debug 3
diff --git a/uc_str912/openocd/openocd_amontec.cfg b/uc_str912/openocd/openocd_amontec.cfg
deleted file mode 100644
index 16e806c..0000000
--- a/uc_str912/openocd/openocd_amontec.cfg
+++ /dev/null
@@ -1,26 +0,0 @@
-source [find interface/jtagkey-tiny.cfg]
-
-#avoid warning bei detection
-set BSTAPID 0x2457f041
-source str912.cfg
-
-# at 25 MHz JTAG should run with 4166 kHz
-# 16 = 450 bytes/sec
-# 32 = 870 bytes/sec
-# 64 = 1 kbyte/sec c bleibt nicht stehen
-# 127 = 2 kbyte/sec c bleibt nicht stehen
-# 250 = 4 kbyte/sec
-# 500 = 5 kbyte/sec
-# 1000 = 7 kbyte/sec
-# 2000 = 8 kbyte/sec
-# 3000 = 8 kbyte/sec
-
-#jtag_rclk 4166 # enable later
-
-# gdb_breakpoint_override hard # geht
-# gdb_flash_program enable # geht nicht
-# gdb_memory_map enable # geht nicht
-# gdb_report_data_abort # geht nicht
-
-arm7_9 dcc_downloads enable
-arm7_9 fast_memory_access enable
diff --git a/uc_str912/openocd/openocd_segger.cfg b/uc_str912/openocd/openocd_segger.cfg
deleted file mode 100644
index 3a1fc14..0000000
--- a/uc_str912/openocd/openocd_segger.cfg
+++ /dev/null
@@ -1,6 +0,0 @@
-#gdb_memory_map enable # fehler bei openocd start
-#gdb_flash_program enable # fehler bei openocd start
-source [find interface/jlink.cfg]
-# avoid warning bei detection
-set BSTAPID 0x2457f041
-source str912.cfg
diff --git a/uc_str912/openocd/segger.sh b/uc_str912/openocd/segger.sh
deleted file mode 100644
index 47cf43d..0000000
--- a/uc_str912/openocd/segger.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-openocd -f openocd_segger.cfg
diff --git a/uc_str912/openocd/str912.cfg b/uc_str912/openocd/str912.cfg
deleted file mode 100644
index 108ae9c..0000000
--- a/uc_str912/openocd/str912.cfg
+++ /dev/null
@@ -1,131 +0,0 @@
-# script for str9
-
-if { [info exists CHIPNAME] } {
- set _CHIPNAME $CHIPNAME
-} else {
- set _CHIPNAME str912
-}
-
-if { [info exists ENDIAN] } {
- set _ENDIAN $ENDIAN
-} else {
- set _ENDIAN little
-}
-
-# jtag speed. We need to stick to 16kHz until we've finished reset.
-jtag_rclk 16
-
-jtag_nsrst_delay 100
-jtag_ntrst_delay 100
-
-#use combined on interfaces or targets that can't set TRST/SRST separately
-reset_config trst_and_srst
-#reset_config trst_only
-
-if { [info exists FLASHTAPID ] } {
- set _FLASHTAPID $FLASHTAPID
-} else {
- set _FLASHTAPID 0x04570041
-}
-jtag newtap $_CHIPNAME flash -irlen 8 -ircapture 0x1 -irmask 0x1 -expected-id $_FLASHTAPID
-
-if { [info exists CPUTAPID ] } {
- set _CPUTAPID $CPUTAPID
-} else {
- set _CPUTAPID 0x25966041
-}
-jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID
-
-
-if { [info exists BSTAPID ] } {
- set _BSTAPID $BSTAPID
-} else {
- set _BSTAPID 0x1457f041
-}
-jtag newtap $_CHIPNAME bs -irlen 5 -ircapture 0x1 -irmask 0x1 -expected-id $_BSTAPID
-
-set _TARGETNAME $_CHIPNAME.cpu
-target create $_TARGETNAME arm966e -endian $_ENDIAN -chain-position $_TARGETNAME -variant arm966e
-
-$_TARGETNAME configure -event reset-start { jtag_rclk 16 }
-
-$_TARGETNAME configure -event reset-init {
- # We can increase speed now that we know the target is halted.
- jtag_rclk 2000
-
- # -- Enable 96K RAM
- # PFQBC enabled / DTCM & AHB wait-states disabled
- mww 0x5C002034 0x0191
-
- flash banks
- flash probe 0
-
- #str9x flash_config <bank> <bbsize> <nbsize> <bbstart> <nbstart>
- str9x flash_config 0 4 2 0x0 0x80000
-
- #nbsize register = 0 : means 8kBytes (written in the STR9 flash programming manual)
- #nbsize register = 2 : means 32kBytes (written in the STR9 flash programming manual)
- #bbsize register = 4 : means 512kBytes (written in the STR9 flash programming manual)
-
-
- flash protect 0 0 7 off
- flash protect_check 0
-# flash info 0
-
- flash protect 1 0 3 off
- flash protect_check 1
-# flash info 1
-
- flash auto_erase on
-}
-
-#$_TARGETNAME configure -work-area-phys 0x04000000 -work-area-size 16384 -work-area-backup 0
-$_TARGETNAME configure -work-area-phys 0x04000000 -work-area-size 0x18000 -work-area-backup 0
-
-#flash bank str9x <base> <size> 0 0 <target#> <variant>
-set _FLASHNAME $_CHIPNAME.flash
-flash bank $_FLASHNAME str9x 0x00000000 0x00080000 0 0 $_TARGETNAME
-set _FLASHNAME $_CHIPNAME.flash
-flash bank $_FLASHNAME str9x 0x00080000 0x00008000 0 0 $_TARGETNAME
-
-
-
-
-$_TARGETNAME configure -event debug-halted {
- puts "Running debug halted script for EBx00 Board"
-}
-
-
-$_TARGETNAME configure -event gdb-attach {
- puts "Running gdb-attach script for EBx00 Board"
-}
-
-
-$_TARGETNAME configure -event gdb-detach {
- puts "Running gdb-detach script for EBx00 Board"
-}
-
-
-$_TARGETNAME configure -event gdb-flash-erase-start {
- puts "Running gdb-flash-erase-start script for EBx00 Board"
-}
-
-
-$_TARGETNAME configure -event gdb-flash-erase-end {
- puts "Running gdb-flash-erase-end script for EBx00 Board"
-}
-
-
-$_TARGETNAME configure -event gdb-start {
- puts "Running gdb_start script for EBx00 Board"
-}
-
-
-
-$_TARGETNAME configure -event gdb-end {
- puts "Running gdb_halted script for EBx00 Board"
-}
-
-
-# For more information about the configuration files, take a look at:
-# openocd.texi
diff --git a/uc_str912/prj_TEST_LED/Makefile b/uc_str912/prj_TEST_LED/Makefile
deleted file mode 100644
index a7f04ba..0000000
--- a/uc_str912/prj_TEST_LED/Makefile
+++ /dev/null
@@ -1,496 +0,0 @@
-# Hey Emacs, this is a -*- makefile -*-
-#
-# WinARM template makefile
-# by Giacomo Fazio and Antonio Nasca, Catania, Italy
-# <giacomofazio@gmail.com>
-# <antodani.nasca@hotmail.it>
-#
-# based on the WinARM template makefile written by Martin Thomas
-# Released to the Public Domain
-# Please read the make user manual!
-#
-#
-# On command line:
-#
-# make all = Make software.
-#
-# make clean = Clean out built project files.
-#
-# make program = Download the hex file to the device
-#
-# (TODO: make filename.s = Just compile filename.c into the assembler code only)
-#
-# To rebuild project do "make clean" then "make all".
-# Toolchain prefix (i.e arm-elf -> arm-elf-gcc.exe)
-#TCHAIN = arm-elf
-TCHAIN = arm-none-eabi
-
-#USE_THUMB_MODE = YES
-USE_THUMB_MODE = NO
-
-# MCU name and submodel
-MCU = arm966e-s
-SUBMDL = STR91x
-
-## Create ROM-Image
-RUN_MODE=ROM_RUN
-## Create RAM-Image
-#RUN_MODE=RAM_RUN
-
-## not supported in this example:
-## Exception-Vector placement only supported for "ROM_RUN"
-## (placement settings ignored when using "RAM_RUN")
-## - Exception vectors in ROM:
-#VECTOR_LOCATION=VECTORS_IN_ROM
-## - Exception vectors in RAM:
-#VECTOR_LOCATION=VECTORS_IN_RAM
-
-
-# Target file name (without extension).
-TARGET = led
-
-# List C source files here. (C dependencies are automatically generated.)
-# use file-extension c for "c-only"-files
-SRC = $(TARGET).c str91x_lib/91x_scu.c str91x_lib/91x_gpio.c
-
-# List C source files here which must be compiled in ARM-Mode.
-# use file-extension c for "c-only"-files
-SRCARM = vectors.c
-# thumb is possible too for vectors.c - keep ARM, TODO: profile
-
-# List C++ source files here.
-# use file-extension cpp for C++-files (use extension .cpp)
-CPPSRC =
-
-# List C++ source files here which must be compiled in ARM-Mode.
-# use file-extension cpp for C++-files (use extension .cpp)
-#CPPSRCARM = $(TARGET).cpp
-CPPSRCARM =
-
-# List Assembler source files here.
-# Make them always end in a capital .S. Files ending in a lowercase .s
-# will not be considered source files but generated files (assembler
-# output from the compiler), and will be deleted upon "make clean"!
-# Even though the DOS/Win* filesystem matches both .s and .S the same,
-# it will preserve the spelling of the filenames, and gcc itself does
-# care about how the name is spelled on its command-line.
-ASRC =
-
-# List Assembler source files here which must be assembled in ARM-Mode..
-ASRCARM = vector.S startup.S
-
-# Path to Linker-Scripts
-LINKERSCRIPTPATH = .
-
-## Output format. (can be ihex or binary or both)
-## (binary i.e. for openocd and SAM-BA, hex i.e. for lpc21isp and uVision)
-#FORMAT = ihex
-#FORMAT = binary
-FORMAT = both
-
-# Optimization level, can be [0, 1, 2, 3, s].
-# 0 = turn off optimization. s = optimize for size.
-# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
-#OPT = s
-OPT = 0
-
-## Using the Atmel AT91_lib produces warning with
-## the default warning-levels.
-## yes - disable these warnings; no - keep default settings
-#AT91LIBNOWARN = yes
-AT91LIBNOWARN = no
-
-# Debugging format.
-# Native formats for AVR-GCC's -g are stabs [default], or dwarf-2.
-# AVR (extended) COFF requires stabs, plus an avr-objcopy run.
-#DEBUG = stabs
-DEBUG = dwarf-2
-
-# List any extra directories to look for include files here.
-# Each directory must be seperated by a space.
-EXTRAINCDIRS = ./include ./str91x_lib/include
-
-# List any extra directories to look for library files here.
-# Each directory must be seperated by a space.
-#EXTRA_LIBDIRS = ../arm7_efsl_0_2_4
-EXTRA_LIBDIRS = ./str91x_lib
-
-
-# Compiler flag to set the C Standard level.
-# c89 - "ANSI" C
-# gnu89 - c89 plus GCC extensions
-# c99 - ISO C99 standard (not yet fully implemented)
-# gnu99 - c99 plus GCC extensions
-CSTANDARD = -std=gnu99
-
-# Place -D or -U options for C here
-CDEFS = -D$(RUN_MODE)
-
-# Place -I options here
-CINCS =
-
-# Place -D or -U options for ASM here
-ADEFS = -D$(RUN_MODE)
-
-ifdef VECTOR_LOCATION
-CDEFS += -D$(VECTOR_LOCATION)
-ADEFS += -D$(VECTOR_LOCATION)
-endif
-
-CDEFS += -D__WinARM__ -D__WINARMSUBMDL_$(SUBMDL)__
-ADEFS += -D__WinARM__ -D__WINARMSUBMDL_$(SUBMDL)__
-
-# Compiler flags.
-
-ifeq ($(USE_THUMB_MODE),YES)
-THUMB = -mthumb
-THUMB_IW = -mthumb-interwork
-else
-THUMB =
-THUMB_IW =
-endif
-
-# -g*: generate debugging information
-# -O*: optimization level
-# -f...: tuning, see GCC manual and avr-libc documentation
-# -Wall...: warning level
-# -Wa,...: tell GCC to pass this to the assembler.
-# -adhlns...: create assembler listing
-#
-# Flags for C and C++ (arm-elf-gcc/arm-elf-g++)
-CFLAGS = -g$(DEBUG)
-CFLAGS += $(CDEFS) $(CINCS)
-CFLAGS += -O$(OPT)
-CFLAGS += -Wall -Wcast-align -Wimplicit
-CFLAGS += -Wpointer-arith -Wswitch
-CFLAGS += -ffunction-sections -fdata-sections
-CFLAGS += -Wredundant-decls -Wreturn-type -Wshadow -Wunused
-CFLAGS += -Wa,-adhlns=$(subst $(suffix $<),.lst,$<)
-CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
-
-# flags only for C
-CONLYFLAGS += -Wnested-externs
-CONLYFLAGS += $(CSTANDARD)
-
-ifneq ($(AT91LIBNOWARN),yes)
-#AT91-lib warnings with:
-CFLAGS += -Wcast-qual
-CONLYFLAGS += -Wmissing-prototypes
-CONLYFLAGS += -Wstrict-prototypes
-CONLYFLAGS += -Wmissing-declarations
-endif
-
-# flags only for C++ (arm-elf-g++)
-# CPPFLAGS = -fno-rtti -fno-exceptions
-CPPFLAGS =
-
-# Assembler flags.
-# -Wa,...: tell GCC to pass this to the assembler.
-# -ahlns: create listing
-# -g$(DEBUG): have the assembler create line number information
-ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:.S=.lst),-g$(DEBUG)
-
-
-#Additional libraries.
-
-# Extra libraries
-# Each library-name must be seperated by a space.
-# To add libxyz.a, libabc.a and libefsl.a:
-# EXTRA_LIBS = xyz abc efsl
-#EXTRA_LIBS = efsl
-EXTRA_LIBS =
-#STR91x_lib
-
-#Support for newlibc-lpc (file: libnewlibc-lpc.a)
-#NEWLIBLPC = -lnewlib-lpc
-
-MATH_LIB = -lm
-
-# CPLUSPLUS_LIB = -lstdc++
-
-
-# Linker flags.
-# -Wl,...: tell GCC to pass this to linker.
-# -Map: create map file
-# --cref: add cross reference to map file
-LDFLAGS = -nostartfiles -Wl,-Map=$(TARGET).map,--cref,--gc-sections,--no-warn-mismatch
-LDFLAGS += -lc
-LDFLAGS += $(NEWLIBLPC) $(MATH_LIB)
-LDFLAGS += -lc -lgcc
-LDFLAGS += $(CPLUSPLUS_LIB)
-LDFLAGS += $(patsubst %,-L%,$(EXTRA_LIBDIRS))
-LDFLAGS += $(patsubst %,-l%,$(EXTRA_LIBS))
-
-# Set Linker-Script Depending On Selected Memory and Controller
-ifeq ($(RUN_MODE),RAM_RUN)
-LDFLAGS +=-T$(LINKERSCRIPTPATH)/$(SUBMDL)-RAM.ld
-else
-LDFLAGS +=-T$(LINKERSCRIPTPATH)/$(SUBMDL)-ROM.ld
-endif
-
-
-# Define directories, if needed.
-## DIRARM = c:/WinARM/
-## DIRARMBIN = $(DIRAVR)/bin/
-## DIRAVRUTILS = $(DIRAVR)/utils/bin/
-
-# Define programs and commands.
-SHELL = sh
-CC = $(TCHAIN)-gcc
-CPP = $(TCHAIN)-g++
-AR = $(TCHAIN)-ar
-OBJCOPY = $(TCHAIN)-objcopy
-OBJDUMP = $(TCHAIN)-objdump
-SIZE = $(TCHAIN)-size
-NM = $(TCHAIN)-nm
-REMOVE = rm -f
-REMOVEDIR = rm -f -r
-COPY = cp
-
-# Define Messages
-# English
-MSG_ERRORS_NONE = Errors: none
-MSG_BEGIN = "-------- begin (mode: $(RUN_MODE)) --------"
-MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
-MSG_SIZE_AFTER = Size after:
-MSG_FLASH = Creating load file for Flash:
-MSG_EXTENDED_LISTING = Creating Extended Listing:
-MSG_SYMBOL_TABLE = Creating Symbol Table:
-MSG_LINKING = Linking:
-MSG_COMPILING = Compiling C:
-MSG_COMPILING_ARM = "Compiling C (ARM-only):"
-MSG_COMPILINGCPP = Compiling C++:
-MSG_COMPILINGCPP_ARM = "Compiling C++ (ARM-only):"
-MSG_ASSEMBLING = Assembling:
-MSG_ASSEMBLING_ARM = "Assembling (ARM-only):"
-MSG_CLEANING = Cleaning project:
-MSG_FORMATERROR = Can not handle output-format
-MSG_LPC21_RESETREMINDER = You may have to bring the target in bootloader-mode now.
-
-# Define all object files.
-COBJ = $(SRC:.c=.o)
-AOBJ = $(ASRC:.S=.o)
-COBJARM = $(SRCARM:.c=.o)
-AOBJARM = $(ASRCARM:.S=.o)
-CPPOBJ = $(CPPSRC:.cpp=.o)
-CPPOBJARM = $(CPPSRCARM:.cpp=.o)
-
-# Define all listing files.
-LST = $(ASRC:.S=.lst) $(ASRCARM:.S=.lst) $(SRC:.c=.lst) $(SRCARM:.c=.lst)
-LST += $(CPPSRC:.cpp=.lst) $(CPPSRCARM:.cpp=.lst)
-
-# Compiler flags to generate dependency files.
-### GENDEPFLAGS = -Wp,-M,-MP,-MT,$(*F).o,-MF,.dep/$(@F).d
-GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d
-
-# Combine all necessary flags and optional flags.
-# Add target processor to flags.
-ALL_CFLAGS = -mcpu=$(MCU) $(THUMB_IW) -I. $(CFLAGS) $(GENDEPFLAGS)
-ALL_ASFLAGS = -mcpu=$(MCU) $(THUMB_IW) -I. -x assembler-with-cpp $(ASFLAGS)
-
-
-# Default target.
-all: begin gccversion sizebefore build sizeafter finished end
-
-ifeq ($(FORMAT),ihex)
-build: elf hex lss sym
-hex: $(TARGET).hex
-IMGEXT=hex
-else
-ifeq ($(FORMAT),binary)
-build: elf bin lss sym
-bin: $(TARGET).bin
-IMGEXT=bin
-else
-ifeq ($(FORMAT),both)
-build: elf hex bin lss sym
-hex: $(TARGET).hex
-bin: $(TARGET).bin
-else
-$(error "$(MSG_FORMATERROR) $(FORMAT)")
-endif
-endif
-endif
-
-elf: $(TARGET).elf
-lss: $(TARGET).lss
-sym: $(TARGET).sym
-
-# Eye candy.
-begin:
- @echo
- @echo $(MSG_BEGIN)
-
-finished:
- @echo $(MSG_ERRORS_NONE)
-
-end:
- @echo $(MSG_END)
- @echo
-
-
-# Display size of file.
-HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
-ELFSIZE = $(SIZE) -A $(TARGET).elf
-sizebefore:
- @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi
-
-sizeafter:
- @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi
-
-
-# Display compiler version information.
-gccversion :
- @$(CC) --version
-
-# FLASH Programming with OPENOCD
-
-# specify the directory where openocd executable resides (openocd-ftd2xx.exe or openocd-pp.exe)
-# Note: you may have to adjust this if a newer version of YAGARTO has been downloaded
-OPENOCD_DIR = 'c:\Programmi\openocd\bin\'
-
-# specify OpenOCD executable (pp is for the wiggler, ftd2xx is for the USB debugger)
-OPENOCD = $(OPENOCD_DIR)openocd-pp.exe
-#OPENOCD = $(OPENOCD_DIR)openocd-ftd2xx.exe
-
-# specify OpenOCD configuration file (pick the one for your device)
-#OPENOCD_CFG = C:\openocd-configs\str91x-configs\str91x_signalyzer-flash-program.cfg
-#OPENOCD_CFG = C:\openocd-configs\str91x-configs\str91x_jtagkey-flash-program.cfg
-#OPENOCD_CFG = C:\openocd-configs\str91x-configs\str91x_armusbocd-flash-program.cfg
-OPENOCD_CFG = C:\openocd-configs\str91x-configs\str91x_pp-flash-program.cfg
-
-program:
- @echo
- @echo "Flash Programming with OpenOCD..."
- $(OPENOCD) -f $(OPENOCD_CFG)
- @echo
- @echo
- @echo "Flash Programming Finished."
-
-
-# Create final output file (.hex) from ELF output file.
-%.hex: %.elf
- @echo
- @echo $(MSG_FLASH) $@
- $(OBJCOPY) -O ihex $< $@
-
-# Create final output file (.bin) from ELF output file.
-%.bin: %.elf
- @echo
- @echo $(MSG_FLASH) $@
- $(OBJCOPY) -O binary $< $@
-
-
-# Create extended listing file from ELF output file.
-# testing: option -C
-%.lss: %.elf
- @echo
- @echo $(MSG_EXTENDED_LISTING) $@
- $(OBJDUMP) -h -S -C $< > $@
-
-
-# Create a symbol table from ELF output file.
-%.sym: %.elf
- @echo
- @echo $(MSG_SYMBOL_TABLE) $@
- $(NM) -n $< > $@
-
-
-# Link: create ELF output file from object files.
-.SECONDARY : $(TARGET).elf
-.PRECIOUS : $(AOBJARM) $(AOBJ) $(COBJARM) $(COBJ) $(CPPOBJ) $(CPPOBJARM)
-%.elf: $(AOBJARM) $(AOBJ) $(COBJARM) $(COBJ) $(CPPOBJ) $(CPPOBJARM)
- @echo
- @echo $(MSG_LINKING) $@
- $(CC) $(THUMB) $(ALL_CFLAGS) $(AOBJARM) $(AOBJ) $(COBJARM) $(COBJ) $(CPPOBJ) $(CPPOBJARM) --output $@ $(LDFLAGS)
-# $(CPP) $(THUMB) $(ALL_CFLAGS) $(AOBJARM) $(AOBJ) $(COBJARM) $(COBJ) $(CPPOBJ) $(CPPOBJARM) --output $@ $(LDFLAGS)
-
-# Compile: create object files from C source files. ARM/Thumb
-$(COBJ) : %.o : %.c
- @echo
- @echo $(MSG_COMPILING) $<
- $(CC) -c $(THUMB) $(ALL_CFLAGS) $(CONLYFLAGS) $< -o $@
-
-# Compile: create object files from C source files. ARM-only
-$(COBJARM) : %.o : %.c
- @echo
- @echo $(MSG_COMPILING_ARM) $<
- $(CC) -c $(ALL_CFLAGS) $(CONLYFLAGS) $< -o $@
-
-# Compile: create object files from C++ source files. ARM/Thumb
-$(CPPOBJ) : %.o : %.cpp
- @echo
- @echo $(MSG_COMPILINGCPP) $<
- $(CPP) -c $(THUMB) $(ALL_CFLAGS) $(CPPFLAGS) $< -o $@
-
-# Compile: create object files from C++ source files. ARM-only
-$(CPPOBJARM) : %.o : %.cpp
- @echo
- @echo $(MSG_COMPILINGCPP_ARM) $<
- $(CPP) -c $(ALL_CFLAGS) $(CPPFLAGS) $< -o $@
-
-
-# Compile: create assembler files from C source files. ARM/Thumb
-## does not work - TODO - hints welcome
-##$(COBJ) : %.s : %.c
-## $(CC) $(THUMB) -S $(ALL_CFLAGS) $< -o $@
-
-
-# Assemble: create object files from assembler source files. ARM/Thumb
-$(AOBJ) : %.o : %.S
- @echo
- @echo $(MSG_ASSEMBLING) $<
- $(CC) -c $(THUMB) $(ALL_ASFLAGS) $< -o $@
-
-
-# Assemble: create object files from assembler source files. ARM-only
-$(AOBJARM) : %.o : %.S
- @echo
- @echo $(MSG_ASSEMBLING_ARM) $<
- $(CC) -c $(ALL_ASFLAGS) $< -o $@
-
-
-# Target: clean project.
-clean: begin clean_list finished end
-
-
-clean_list :
- @echo
- @echo $(MSG_CLEANING)
- $(REMOVE) $(TARGET).hex
- $(REMOVE) $(TARGET).bin
- $(REMOVE) $(TARGET).obj
- $(REMOVE) $(TARGET).elf
- $(REMOVE) $(TARGET).map
- $(REMOVE) $(TARGET).obj
- $(REMOVE) $(TARGET).a90
- $(REMOVE) $(TARGET).sym
- $(REMOVE) $(TARGET).lnk
- $(REMOVE) $(TARGET).lss
- $(REMOVE) $(COBJ)
- $(REMOVE) $(CPPOBJ)
- $(REMOVE) $(AOBJ)
- $(REMOVE) $(COBJARM)
- $(REMOVE) $(CPPOBJARM)
- $(REMOVE) $(AOBJARM)
- $(REMOVE) $(LST)
- $(REMOVE) $(SRC:.c=.s)
- $(REMOVE) $(SRC:.c=.d)
- $(REMOVE) $(SRCARM:.c=.s)
- $(REMOVE) $(SRCARM:.c=.d)
- $(REMOVE) $(CPPSRC:.cpp=.s)
- $(REMOVE) $(CPPSRC:.cpp=.d)
- $(REMOVE) $(CPPSRCARM:.cpp=.s)
- $(REMOVE) $(CPPSRCARM:.cpp=.d)
- $(REMOVEDIR) .dep | exit 0
-
-
-# Include the dependency files.
--include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
-
-
-# Listing of phony targets.
-.PHONY : all begin finish end sizebefore sizeafter gccversion \
-build elf hex bin lss sym clean clean_list program
-
diff --git a/uc_str912/prj_TEST_LED/STR91x-RAM.ld b/uc_str912/prj_TEST_LED/STR91x-RAM.ld
deleted file mode 100644
index aced384..0000000
--- a/uc_str912/prj_TEST_LED/STR91x-RAM.ld
+++ /dev/null
@@ -1,218 +0,0 @@
-/***********************************************************************************
-* Copyright 2005 Anglia Design
-* This demo code and associated components are provided as is and has no warranty,
-* implied or otherwise. You are free to use/modify any of the provided
-* code at your own risk in your applications with the expressed limitation
-* of liability (see below)
-*
-* LIMITATION OF LIABILITY: ANGLIA OR ANGLIA DESIGNS SHALL NOT BE LIABLE FOR ANY
-* LOSS OF PROFITS, LOSS OF USE, LOSS OF DATA, INTERRUPTION OF BUSINESS, NOR FOR
-* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND WHETHER UNDER
-* THIS AGREEMENT OR OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-*
-* Author : Spencer Oliver
-* Web : www.anglia-designs.com
-*
-***********************************************************************************/
-
-/* Stack Sizes */
-
- _STACKSIZE = 1024;
- _STACKSIZE_IRQ = 256;
- _STACKSIZE_FIQ = 256;
- _STACKSIZE_SVC = 0;
- _STACKSIZE_ABT = 0;
- _STACKSIZE_UND = 0;
- _HEAPSIZE = 1024;
-
-/* Memory Definitions */
-
-MEMORY
-{
- DATA (rw) : ORIGIN = 0x04000000, LENGTH = 0x00018000
-}
-
-/* Section Definitions */
-
-SECTIONS
-{
- /* first section is .text which is used for code */
-
- .text :
- {
- KEEP(*(.vectors))
- KEEP(*(.init))
- *(.text .text.*)
- *(.gnu.linkonce.t.*)
- *(.glue_7t .glue_7)
- KEEP(*(.fini))
- *(.gcc_except_table)
- } >DATA =0
- . = ALIGN(4);
-
- /* .ctors .dtors are used for c++ constructors/destructors */
-
- .ctors :
- {
- PROVIDE(__ctors_start__ = .);
- KEEP(*(SORT(.ctors.*)))
- KEEP(*(.ctors))
- PROVIDE(__ctors_end__ = .);
- } >DATA
-
- .dtors :
- {
- PROVIDE(__dtors_start__ = .);
- KEEP(*(SORT(.dtors.*)))
- KEEP(*(.dtors))
- PROVIDE(__dtors_end__ = .);
- } >DATA
-
- /* .rodata section which is used for read-only data (constants) */
-
- .rodata :
- {
- *(.rodata .rodata.*)
- *(.gnu.linkonce.r.*)
- } >DATA
- . = ALIGN(4);
-
- _etext = .;
- PROVIDE (etext = .);
-
- /* .data section which is used for initialized data */
-
- .data : AT (_etext)
- {
- *(.data .data.*)
- *(.gnu.linkonce.d.*)
- SORT(CONSTRUCTORS)
- } >DATA
- . = ALIGN(4);
-
- __data_start = .;
- _edata = .;
- PROVIDE (edata = .);
-
- /* .bss section which is used for uninitialized data */
-
- .bss :
- {
- __bss_start = .;
- __bss_start__ = .;
- *(.bss .bss.*)
- *(.gnu.linkonce.b.*)
- *(COMMON)
- . = ALIGN(4);
- } >DATA
- . = ALIGN(4);
- __bss_end__ = .;
-
- _end = .;
- PROVIDE(end = .);
-
- /* .heap section which is used for memory allocation */
-
- .heap (NOLOAD) :
- {
- __heap_start__ = .;
- *(.heap)
- . = MAX(__heap_start__ + _HEAPSIZE , .);
- } >DATA
- __heap_end__ = __heap_start__ + SIZEOF(.heap);
-
- /* .stack section - user mode stack */
-
- .stack (__heap_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_start__ = .;
- *(.stack)
- . = MAX(__stack_start__ + _STACKSIZE , .);
- } >DATA
- __stack_end__ = __stack_start__ + SIZEOF(.stack);
-
- /* .stack_irq section */
-
- .stack_irq (__stack_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_irq_start__ = .;
- *(.stack_irq)
- . = MAX(__stack_irq_start__ + _STACKSIZE_IRQ , .);
- } >DATA
- __stack_irq_end__ = __stack_irq_start__ + SIZEOF(.stack_irq);
-
- /* .stack_fiq section */
-
- .stack_fiq (__stack_irq_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_fiq_start__ = .;
- *(.stack_fiq)
- . = MAX(__stack_fiq_start__ + _STACKSIZE_FIQ , .);
- } >DATA
- __stack_fiq_end__ = __stack_fiq_start__ + SIZEOF(.stack_fiq);
-
- /* .stack_svc section */
-
- .stack_svc (__stack_fiq_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_svc_start__ = .;
- *(.stack_svc)
- . = MAX(__stack_svc_start__ + _STACKSIZE_SVC , .);
- } >DATA
- __stack_svc_end__ = __stack_svc_start__ + SIZEOF(.stack_svc);
-
- /* .stack_abt section */
-
- .stack_abt (__stack_svc_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_abt_start__ = .;
- *(.stack_abt)
- . = MAX(__stack_abt_start__ + _STACKSIZE_ABT , .);
- } >DATA
- __stack_abt_end__ = __stack_abt_start__ + SIZEOF(.stack_abt);
-
- /* .stack_und section */
-
- .stack_und (__stack_abt_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_und_start__ = .;
- *(.stack_und)
- . = MAX(__stack_und_start__ + _STACKSIZE_UND , .);
- } >DATA
- __stack_und_end__ = __stack_und_start__ + SIZEOF(.stack_und);
-
- /* 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) }
-}
-
diff --git a/uc_str912/prj_TEST_LED/STR91x-ROM.ld b/uc_str912/prj_TEST_LED/STR91x-ROM.ld
deleted file mode 100644
index ed2979b..0000000
--- a/uc_str912/prj_TEST_LED/STR91x-ROM.ld
+++ /dev/null
@@ -1,221 +0,0 @@
-/***********************************************************************************
-* Copyright 2005 Anglia Design
-* This demo code and associated components are provided as is and has no warranty,
-* implied or otherwise. You are free to use/modify any of the provided
-* code at your own risk in your applications with the expressed limitation
-* of liability (see below)
-*
-* LIMITATION OF LIABILITY: ANGLIA OR ANGLIA DESIGNS SHALL NOT BE LIABLE FOR ANY
-* LOSS OF PROFITS, LOSS OF USE, LOSS OF DATA, INTERRUPTION OF BUSINESS, NOR FOR
-* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND WHETHER UNDER
-* THIS AGREEMENT OR OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-*
-* Author : Spencer Oliver
-* Web : www.anglia-designs.com
-*
-***********************************************************************************/
-
-/* Stack Sizes */
-
- _STACKSIZE = 1024;
- _STACKSIZE_IRQ = 256;
- _STACKSIZE_FIQ = 256;
- _STACKSIZE_SVC = 0;
- _STACKSIZE_ABT = 0;
- _STACKSIZE_UND = 0;
- _HEAPSIZE = 1024;
-
-/* Memory Definitions */
-
-MEMORY
-{
- CODE (rx) : ORIGIN = 0x00000000, LENGTH = 0x00080000
- DATA (rw) : ORIGIN = 0x04000000, LENGTH = 0x00018000
-}
-
-/* Section Definitions */
-
-SECTIONS
-{
- /* first section is .text which is used for code */
-
- .text :
- {
- KEEP(*(.vectors))
- KEEP(*(.init))
- *(.text .text.*)
- *(.gnu.linkonce.t.*)
- *(.glue_7t .glue_7)
- KEEP(*(.fini))
- *(.gcc_except_table)
- } >CODE =0
- . = ALIGN(4);
-
- /* .ctors .dtors are used for c++ constructors/destructors */
-
- .ctors :
- {
- PROVIDE(__ctors_start__ = .);
- KEEP(*(SORT(.ctors.*)))
- KEEP(*(.ctors))
- PROVIDE(__ctors_end__ = .);
- } >CODE
-
- .dtors :
- {
- PROVIDE(__dtors_start__ = .);
- KEEP(*(SORT(.dtors.*)))
- KEEP(*(.dtors))
- PROVIDE(__dtors_end__ = .);
- } >CODE
-
- /* .rodata section which is used for read-only data (constants) */
-
- .rodata :
- {
- *(.rodata .rodata.*)
- *(.gnu.linkonce.r.*)
- } >CODE
- . = ALIGN(4);
-
- _etext = .;
- PROVIDE (etext = .);
-
- /* .data section which is used for initialized data */
-
- .data : AT (_etext)
- {
- __data_start = .;
- *(.data .data.*)
- *(.gnu.linkonce.d.*)
- SORT(CONSTRUCTORS)
- . = ALIGN(4);
- *(.fastrun .fastrun.*)
- } >DATA
- . = ALIGN(4);
-
- _edata = .;
- PROVIDE (edata = .);
-
- /* .bss section which is used for uninitialized data */
-
- .bss :
- {
- __bss_start = .;
- __bss_start__ = .;
- *(.bss .bss.*)
- *(.gnu.linkonce.b.*)
- *(COMMON)
- . = ALIGN(4);
- } >DATA
- . = ALIGN(4);
- __bss_end__ = .;
-
- _end = .;
- PROVIDE(end = .);
-
- /* .heap section which is used for memory allocation */
-
- .heap (NOLOAD) :
- {
- __heap_start__ = .;
- *(.heap)
- . = MAX(__heap_start__ + _HEAPSIZE , .);
- } >DATA
- __heap_end__ = __heap_start__ + SIZEOF(.heap);
-
- /* .stack section - user mode stack */
-
- .stack (__heap_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_start__ = .;
- *(.stack)
- . = MAX(__stack_start__ + _STACKSIZE , .);
- } >DATA
- __stack_end__ = __stack_start__ + SIZEOF(.stack);
-
- /* .stack_irq section */
-
- .stack_irq (__stack_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_irq_start__ = .;
- *(.stack_irq)
- . = MAX(__stack_irq_start__ + _STACKSIZE_IRQ , .);
- } >DATA
- __stack_irq_end__ = __stack_irq_start__ + SIZEOF(.stack_irq);
-
- /* .stack_fiq section */
-
- .stack_fiq (__stack_irq_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_fiq_start__ = .;
- *(.stack_fiq)
- . = MAX(__stack_fiq_start__ + _STACKSIZE_FIQ , .);
- } >DATA
- __stack_fiq_end__ = __stack_fiq_start__ + SIZEOF(.stack_fiq);
-
- /* .stack_svc section */
-
- .stack_svc (__stack_fiq_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_svc_start__ = .;
- *(.stack_svc)
- . = MAX(__stack_svc_start__ + _STACKSIZE_SVC , .);
- } >DATA
- __stack_svc_end__ = __stack_svc_start__ + SIZEOF(.stack_svc);
-
- /* .stack_abt section */
-
- .stack_abt (__stack_svc_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_abt_start__ = .;
- *(.stack_abt)
- . = MAX(__stack_abt_start__ + _STACKSIZE_ABT , .);
- } >DATA
- __stack_abt_end__ = __stack_abt_start__ + SIZEOF(.stack_abt);
-
- /* .stack_und section */
-
- .stack_und (__stack_abt_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_und_start__ = .;
- *(.stack_und)
- . = MAX(__stack_und_start__ + _STACKSIZE_UND , .);
- } >DATA
- __stack_und_end__ = __stack_und_start__ + SIZEOF(.stack_und);
-
- /* 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) }
-}
-
diff --git a/uc_str912/prj_TEST_LED/include/91x_ahbapb.h b/uc_str912/prj_TEST_LED/include/91x_ahbapb.h
deleted file mode 100644
index 1828d48..0000000
--- a/uc_str912/prj_TEST_LED/include/91x_ahbapb.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_ahbapb.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* AHBAPB software library.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef _91x_AHBAPB_H
-#define _91x_AHBAPB_H
-
-#include "91x_map.h"
-
-#define AHBAPB_Split_Enable 0x01000000
-#define AHBAPB_Split_Disable 0xFEFFFFFF
-#define AHBAPB_Error_Enable 0x0000100
-#define AHBAPB_Error_Disable 0xFFFFEFF
-
-/*FLAG*/
-#define AHBAPB_FLAG_ERROR 0x01 /* error flag*/
-#define AHBAPB_FLAG_OUTM 0x10 /* Out of Memory flag */
-#define AHBAPB_FLAG_APBT 0x20 /* APB Time-out flag */
-#define AHBAPB_FLAG_RW 0x40 /*Access type flag*/
-
-/* Includes ------------------------------------------------------------------*/
-
-
-/* AHBAPB Init structure definition */
-typedef struct
-{
- u32 AHBAPB_SetTimeOut;
- u32 AHBAPB_Error;
- u32 AHBAPB_Split;
- u8 AHBAPB_SplitCounter;
-}AHBAPB_InitTypeDef;
-
-/* Exported constants --------------------------------------------------------*/
-void AHBAPB_DeInit(AHBAPB_TypeDef* AHBAPBx);
-void AHBAPB_Init(AHBAPB_TypeDef* AHBAPBx, AHBAPB_InitTypeDef* AHBAPB_InitStruct);
-void AHBAPB_StructInit(AHBAPB_InitTypeDef* AHBAPB_InitStruct);
-FlagStatus AHBAPB_GetFlagStatus(AHBAPB_TypeDef* AHBAPBx, u8 AHBAPB_FLAG);
-void AHBAPB_ClearFlag(AHBAPB_TypeDef* AHBAPBx, u8 AHBAPB_FLAG);
-u32 AHBAPB_GetPeriphAddrError(AHBAPB_TypeDef* AHBAPBx);
-
-
-#endif /* _91x_AHBAPB_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_TEST_LED/include/91x_conf.h b/uc_str912/prj_TEST_LED/include/91x_conf.h
deleted file mode 100644
index 578335d..0000000
--- a/uc_str912/prj_TEST_LED/include/91x_conf.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_conf.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : Library configuration.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-
-#ifndef __91x_CONF_H
-#define __91x_CONF_H
-
-/* To work in buffered mode just decomment the following line */
-
-//#define Buffered
-
-/* Comment the line below to put the library in release mode */
-//#define DEBUG
-
-/************************* AHBAPB *************************/
-//#define _AHBAPB
-//#define _AHBAPB0
-//#define _AHBAPB1
-/************************* VIC *************************/
-//#define _VIC
-//#define _VIC0
-//#define _VIC1
-/************************* DMA *************************/
-//#define _DMA
-//#define _DMA_Channel0
-//#define _DMA_Channel1
-//#define _DMA_Channel2
-//#define _DMA_Channel3
-//#define _DMA_Channel4
-//#define _DMA_Channel5
-//#define _DMA_Channel6
-//#define _DMA_Channel7
-
-/************************* EMI *************************/
-//#define _EMI
-//#define _EMI_Bank0
-//#define _EMI_Bank1
-//#define _EMI_Bank2
-//#define _EMI_Bank3
-/************************* FMI *************************/
-//#define _FMI
-/************************* WIU *************************/
-//#define _WIU
-/************************* TIM *************************/
-//#define _TIM
-//#define _TIM0
-//#define _TIM1
-//#define _TIM2
-//#define _TIM3
-/************************* GPIO ************************/
-#define _GPIO
-#define _GPIO0
-#define _GPIO1
-#define _GPIO2
-#define _GPIO3
-#define _GPIO4
-#define _GPIO5
-#define _GPIO6
-#define _GPIO7
-#define _GPIO8
-#define _GPIO9
-/************************* RTC *************************/
-//#define _RTC
-/************************* SCU *************************/
-#define _SCU
-/************************* MC **************************/
-//#define _MC
-/************************* UART ************************/
-//#define _UART
-//#define _UART0
-//#define _UART1
-//#define _UART2
-/************************* SSP *************************/
-//#define _SSP
-//#define _SSP0
-//#define _SSP1
-/************************* CAN *************************/
-//#define _CAN
-/************************* ADC *************************/
-//#define _ADC
-/************************* WDG *************************/
-//#define _WDG
-/************************* I2C *************************/
-//#define _I2C
-//#define _I2C0
-//#define _I2C1
-/************************ ENET *************************/
-//#define _ENET
-
-/*---------------------------- _Main_Crystal frequency value (KHz)------------*/
-
-#ifndef _Main_Crystal
-#define _Main_Crystal 25000
-#endif
-/*------------------------------------------------------------------------------*/
-
-
-#endif /* __91x_CONF_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_TEST_LED/include/91x_fmi.h b/uc_str912/prj_TEST_LED/include/91x_fmi.h
deleted file mode 100644
index 06e8115..0000000
--- a/uc_str912/prj_TEST_LED/include/91x_fmi.h
+++ /dev/null
@@ -1,184 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_fmi.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* FMI software library.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-
-/* Define to prevent recursive inclusion ------------------------------------ */
-
-#ifndef __91x_FMI_H
-#define __91x_FMI_H
-
-/* ========================================================================== */
-/* When bank 1 is remapped at address 0x0, decomment the following line */
-/* ========================================================================== */
-
-//#define Remap_Bank_1
-
-
-/* Includes ------------------------------------------------------------------*/
-
-#include "91x_map.h"
-
-/* Exported types ------------------------------------------------------------*/
-/* Exported constants --------------------------------------------------------*/
-
-/* FMI banks */
-
-#ifdef Remap_Bank_1
-
-#define FMI_BANK_0 ((*(vu32*)0x54000010) << 2) /* FMI Bank 0 */
-#define FMI_BANK_1 ((*(vu32*)0x5400000C) << 2) /* FMI Bank 1 */
-
-#else /* Remap Bank 0 */
-
-#define FMI_BANK_0 ((*(vu32*)0x5400000C) << 2) /* FMI Bank 0 */
-#define FMI_BANK_1 ((*(vu32*)0x54000010) << 2) /* FMI Bank 1 */
-
-#endif
-
-/* FMI sectors */
-
-#define FMI_B0S0 0x00000000 + FMI_BANK_0 /* Bank 0 sector 0 */
-#define FMI_B0S1 0x00010000 + FMI_BANK_0 /* Bank 0 sector 1 */
-#define FMI_B0S2 0x00020000 + FMI_BANK_0 /* Bank 0 sector 2 */
-#define FMI_B0S3 0x00030000 + FMI_BANK_0 /* Bank 0 sector 3 */
-#define FMI_B0S4 0x00040000 + FMI_BANK_0 /* Bank 0 sector 4 */
-#define FMI_B0S5 0x00050000 + FMI_BANK_0 /* Bank 0 sector 5 */
-#define FMI_B0S6 0x00060000 + FMI_BANK_0 /* Bank 0 sector 6 */
-#define FMI_B0S7 0x00070000 + FMI_BANK_0 /* Bank 0 sector 7 */
-
-#define FMI_B1S0 0x00000000 + FMI_BANK_1 /* Bank 1 sector 0 */
-#define FMI_B1S1 0x00002000 + FMI_BANK_1 /* Bank 1 sector 1 */
-#define FMI_B1S2 0x00004000 + FMI_BANK_1 /* Bank 1 sector 2 */
-#define FMI_B1S3 0x00006000 + FMI_BANK_1 /* Bank 1 sector 3 */
-
-/* FMI Flags */
-
-#define FMI_FLAG_SPS 0x02 /* Sector Protection Status Flag */
-#define FMI_FLAG_PSS 0x04 /* Program Suspend Status Flag */
-#define FMI_FLAG_PS 0x10 /* Program Status Flag */
-#define FMI_FLAG_ES 0x20 /* Erase Status Flag */
-#define FMI_FLAG_ESS 0x40 /* Erase Suspend Status Flag */
-#define FMI_FLAG_PECS 0x80 /* FPEC Status Flag */
-
-/* FMI read wait states */
-
-#define FMI_READ_WAIT_STATE_1 0x0000 /* One read wait state */
-#define FMI_READ_WAIT_STATE_2 0x2000 /* Two read wait states */
-#define FMI_READ_WAIT_STATE_3 0x4000 /* Three read wait states */
-
-/* FMI write wait states */
-
-#define FMI_WRITE_WAIT_STATE_0 0xFFFFFEFF /* Zero wait state */
-#define FMI_WRITE_WAIT_STATE_1 0x00000100 /* One wait state */
-
-/* FMI power down configuration */
-
-#define FMI_PWD_ENABLE 0x1000 /* FMI Power Down Enable */
-#define FMI_PWD_DISABLE 0x0000 /* FMI Power Down Disable */
-
-/* FMI low voltage detector */
-
-#define FMI_LVD_ENABLE 0x0000 /* FMI Low Voltage Detector Enable */
-#define FMI_LVD_DISABLE 0x0800 /* FMI Low Voltage Detector Disable */
-
-/* FMI frequency range */
-
-#define FMI_FREQ_LOW 0x0000 /* FMI Low bus working frequency */
-#define FMI_FREQ_HIGH 0x0040 /* FMI High bus working gfrequency */
- /* Above 66 MHz*/
-/* FMI OTP word addresses */
-
-#define FMI_OTP_WORD_0 0x00 /* OTP word 0 */
-#define FMI_OTP_WORD_1 0x04 /* OTP word 1 */
-#define FMI_OTP_WORD_2 0x08 /* OTP word 2 */
-#define FMI_OTP_WORD_3 0x0C /* OTP word 3 */
-#define FMI_OTP_WORD_4 0x10 /* OTP word 4 */
-#define FMI_OTP_WORD_5 0x14 /* OTP word 5 */
-#define FMI_OTP_WORD_6 0x18 /* OTP word 6 */
-#define FMI_OTP_WORD_7 0x1C /* OTP word 7 */
-
-/* FMI OTP halfword addresses */
-
-#define FMI_OTP_LOW_HALFWORD_0 0x00 /* OTP Low halfword 0 */
-#define FMI_OTP_HIGH_HALFWORD_0 0x02 /* OTP High halfword 0 */
-#define FMI_OTP_LOW_HALFWORD_1 0x04 /* OTP Low halfword 1 */
-#define FMI_OTP_HIGH_HALFWORD_1 0x06 /* OTP High halfword 1 */
-#define FMI_OTP_LOW_HALFWORD_2 0x08 /* OTP Low halfword 2 */
-#define FMI_OTP_HIGH_HALFWORD_2 0x0A /* OTP High halfword 2 */
-#define FMI_OTP_LOW_HALFWORD_3 0x0C /* OTP Low halfword 3 */
-#define FMI_OTP_HIGH_HALFWORD_3 0x0E /* OTP High halfword 3 */
-#define FMI_OTP_LOW_HALFWORD_4 0x10 /* OTP Low halfword 4 */
-#define FMI_OTP_HIGH_HALFWORD_4 0x12 /* OTP High halfword 4 */
-#define FMI_OTP_LOW_HALFWORD_5 0x14 /* OTP Low halfword 5 */
-#define FMI_OTP_HIGH_HALFWORD_5 0x16 /* OTP High halfword 5 */
-#define FMI_OTP_LOW_HALFWORD_6 0x18 /* OTP Low halfword 6 */
-#define FMI_OTP_HIGH_HALFWORD_6 0x1A /* OTP High halfword 6 */
-#define FMI_OTP_LOW_HALFWORD_7 0x1C /* OTP Low halfword 7 */
-#define FMI_OTP_HIGH_HALFWORD_7 0x1E /* OTP High halfword 7 */
-
-/* FMI sectors Masks */
-
-#define FMI_B0S0_MASK 0x0001 /* FMI B0S0 mask */
-#define FMI_B0S1_MASK 0x0002 /* FMI B0S1 mask */
-#define FMI_B0S2_MASK 0x0004 /* FMI B0S2 mask */
-#define FMI_B0S3_MASK 0x0008 /* FMI B0S3 mask */
-#define FMI_B0S4_MASK 0x0010 /* FMI B0S4 mask */
-#define FMI_B0S5_MASK 0x0020 /* FMI B0S5 mask */
-#define FMI_B0S6_MASK 0x0040 /* FMI B0S6 mask */
-#define FMI_B0S7_MASK 0x0080 /* FMI B0S7 mask */
-
-#define FMI_B1S0_MASK 0x0100 /* FMI B1S0 mask */
-#define FMI_B1S1_MASK 0x0200 /* FMI B1S1 mask */
-#define FMI_B1S2_MASK 0x0400 /* FMI B1S2 mask */
-#define FMI_B1S3_MASK 0x0800 /* FMI B1S3 mask */
-
-/* Timeout error */
-
-#define FMI_TIME_OUT_ERROR 0x00 /* Timeout error */
-#define FMI_NO_TIME_OUT_ERROR 0x01 /* No Timeout error */
-
-/* Module private variables --------------------------------------------------*/
-/* Exported macro ------------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-
-void FMI_BankRemapConfig(u8 FMI_BootBankSize, u8 FMI_NonBootBankSize, \
- u32 FMI_BootBankAddress, u32 FMI_NonBootBankAddress);
-void FMI_Config(u16 FMI_ReadWaitState, u32 FMI_WriteWaitState, u16 FMI_PWD,\
- u16 FMI_LVDEN, u16 FMI_FreqRange);
-void FMI_EraseSector(vu32 FMI_Sector);
-void FMI_EraseBank(vu32 FMI_Bank);
-void FMI_WriteHalfWord(u32 FMI_Address, u16 FMI_Data);
-void FMI_WriteOTPHalfWord(u8 FMI_OTPHWAddress, u16 FMI_OTPData);
-u32 FMI_ReadWord(u32 FMI_Address);
-u32 FMI_ReadOTPData(u8 FMI_OTPAddress);
-FlagStatus FMI_GetFlagStatus(u8 FMI_Flag, vu32 FMI_Bank);
-u16 FMI_GetReadWaitStateValue(void);
-u16 FMI_GetWriteWaitStateValue(void);
-void FMI_SuspendEnable(vu32 FMI_Bank);
-void FMI_ResumeEnable(vu32 FMI_Bank);
-void FMI_ClearFlag(vu32 FMI_Bank);
-void FMI_WriteProtectionCmd(vu32 FMI_Sector, FunctionalState FMI_NewState);
-FlagStatus FMI_GetWriteProtectionStatus(u32 FMI_Sector_Protection);
-u8 FMI_WaitForLastOperation(vu32 FMI_Bank);
-
-#endif /* __91x_FMI_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
-
diff --git a/uc_str912/prj_TEST_LED/include/91x_gpio.h b/uc_str912/prj_TEST_LED/include/91x_gpio.h
deleted file mode 100644
index 4beab75..0000000
--- a/uc_str912/prj_TEST_LED/include/91x_gpio.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_gpio.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* GPIO software library.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion ------------------------------------ */
-
-#ifndef _91x_GPIO_H
-#define _91x_GPIO_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_map.h"
-
-/* GPIO Init structure definition */
-typedef struct
-{
- u8 GPIO_Pin;
- u8 GPIO_Direction;
- u8 GPIO_Type;
- u8 GPIO_IPConnected;
- u16 GPIO_Alternate;
-}GPIO_InitTypeDef;
-
-/* Bit_SET and Bit_RESET enumeration */
-typedef enum
-{ Bit_RESET = 0,
- Bit_SET
-}BitAction;
-
-
-/* Exported constants --------------------------------------------------------*/
-#define GPIO_Pin_None 0x00
-#define GPIO_Pin_0 0x01
-#define GPIO_Pin_1 0x02
-#define GPIO_Pin_2 0x04
-#define GPIO_Pin_3 0x08
-#define GPIO_Pin_4 0x10
-#define GPIO_Pin_5 0x20
-#define GPIO_Pin_6 0x40
-#define GPIO_Pin_7 0x80
-#define GPIO_Pin_All 0xFF
-
-#define GPIO_PinInput 0x00
-#define GPIO_PinOutput 0x01
-
-#define GPIO_Type_PushPull 0x00
-#define GPIO_Type_OpenCollector 0x01
-
-#define GPIO_IPConnected_Disable 0x00
-#define GPIO_IPConnected_Enable 0x01
-
-#define GPIO_InputAlt1 0x00
-#define GPIO_OutputAlt1 0x01
-#define GPIO_OutputAlt2 0x02
-#define GPIO_OutputAlt3 0x03
-
-#define GPIO_ANAChannel0 0x01
-#define GPIO_ANAChannel1 0x02
-#define GPIO_ANAChannel2 0x04
-#define GPIO_ANAChannel3 0x08
-#define GPIO_ANAChannel4 0x10
-#define GPIO_ANAChannel5 0x20
-#define GPIO_ANAChannel6 0x40
-#define GPIO_ANAChannel7 0x80
-#define GPIO_ANAChannelALL 0xFF
-
-void GPIO_DeInit(GPIO_TypeDef* GPIOx);
-void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct);
-void GPIO_StructInit(GPIO_InitTypeDef* GPIO_InitStruct);
-u8 GPIO_ReadBit(GPIO_TypeDef* GPIOx, u8 GPIO_Pin);
-u8 GPIO_Read(GPIO_TypeDef* GPIOx);
-void GPIO_WriteBit(GPIO_TypeDef* GPIOx, u8 GPIO_Pin, BitAction BitVal);
-void GPIO_Write(GPIO_TypeDef* GPIOx, u8 PortVal);
-void GPIO_EMIConfig(FunctionalState NewState);
-void GPIO_ANAPinConfig(u8 GPIO_ANAChannel, FunctionalState NewState);
-
-#endif /* _91x_GPIO_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_TEST_LED/include/91x_lib.h b/uc_str912/prj_TEST_LED/include/91x_lib.h
deleted file mode 100644
index 823b250..0000000
--- a/uc_str912/prj_TEST_LED/include/91x_lib.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_lib.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : Used to include the peripherals header file in the
-* user application.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-#ifndef __91x_LIB_H
-#define __91x_LIB_H
-
-#include "91x_map.h"
-#include "91x_conf.h"
-
-#ifdef _AHBAPB
- #include "91x_ahbapb.h"
-#endif /* _AHBAPB */
-
-#ifdef _EMI
- #include "91x_emi.h"
-#endif /* _EMI */
-
-#ifdef _DMA
- #include "91x_dma.h"
-#endif /* _DMA */
-
-#ifdef _FMI
- #include "91x_fmi.h"
-#endif /* _FMI */
-
-#ifdef _VIC
- #include "91x_vic.h"
-#endif /* _VIC */
-
-#ifdef _WIU
- #include "91x_wiu.h"
-#endif /* _WIU */
-
-#ifdef _TIM
- #include "91x_tim.h"
-#endif /* _TIM */
-
-#ifdef _GPIO
- #include "91x_gpio.h"
-#endif /* _GPIO */
-
-#ifdef _RTC
- #include "91x_rtc.h"
-#endif /* _RTC */
-
-#ifdef _SCU
- #include "91x_scu.h"
-#endif /* _SCU */
-
-#ifdef _UART
- #include "91x_uart.h"
-#endif /* _UART */
-
-#ifdef _SSP
- #include "91x_ssp.h"
-#endif /* _SSP */
-
-#ifdef _CAN
- #include "91x_can.h"
-#endif /* _CAN */
-
-#ifdef _ADC
- #include "91x_adc.h"
-#endif /* _ADC */
-
-#ifdef _WDG
- #include "91x_wdg.h"
-#endif /* _WDG */
-
-#ifdef _I2C
- #include "91x_i2c.h"
-#endif /* _I2C */
-
-#ifdef _WIU
- #include "91x_wiu.h"
-#endif
-
-#ifdef _MC
- #include "91x_mc.h"
-#endif
-
-#ifdef _ENET
- #include "91x_enet.h"
-#endif
-
-/* Exported types ------------------------------------------------------------*/
-/* Exported constants --------------------------------------------------------*/
-/* Module private variables --------------------------------------------------*/
-/* Exported macro ------------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-
- void debug( void );
-
-
-#endif /* __91x_LIB_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_TEST_LED/include/91x_map.h b/uc_str912/prj_TEST_LED/include/91x_map.h
deleted file mode 100644
index 2e94a91..0000000
--- a/uc_str912/prj_TEST_LED/include/91x_map.h
+++ /dev/null
@@ -1,878 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_map.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : Peripherals registers definition and memory mapping.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion ------------------------------------ */
-#ifndef __91x_MAP_H
-#define __91x_MAP_H
-
-#ifndef EXT
- #define EXT extern
-#endif /* EXT */
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_conf.h"
-#include "91x_type.h"
-
-/******************************************************************************/
-/* IP registers structures */
-/******************************************************************************/
-
-/*------------------------------------ FMI -----------------------------------*/
-
-typedef struct
-{
- vu32 BBSR; /* Boot Bank Size Register */
- vu32 NBBSR; /* Non-Boot Bank Size Register */
- vu32 EMPTY1;
- vu32 BBADR; /* Boot Bank Base Address Register */
- vu32 NBBADR; /* Non-Boot Bank Base Address Register */
- vu32 EMPTY2;
- vu32 CR; /* Control Register */
- vu32 SR; /* Status Register */
- vu32 BCE5ADDR; /* BC Fifth Entry Target Address Register */
-} FMI_TypeDef;
-
-/*---------------------- Analog to Digital Convertor ------------------------*/
-
-typedef struct
-{
- vu16 CR; /* Control Register */
- vu16 EMPTY1;
- vu16 CCR; /* Channel Configuration Register */
- vu16 EMPTY2;
- vu16 HTR; /* Higher Threshold Register */
- vu16 EMPTY3;
- vu16 LTR; /* Lower Threshold Register */
- vu16 EMPTY4;
- vu16 CRR; /* Compare Result Register */
- vu16 EMPTY5;
- vu16 DR0; /* Data Register for Channel 0 */
- vu16 EMPTY6;
- vu16 DR1; /* Data Register for Channel 1 */
- vu16 EMPTY7;
- vu16 DR2; /* Data Register for Channel 2 */
- vu16 EMPTY8;
- vu16 DR3; /* Data Register for Channel 3 */
- vu16 EMPTY9;
- vu16 DR4; /* Data Register for Channel 4 */
- vu16 EMPTY10;
- vu16 DR5; /* Data Register for Channel 5 */
- vu16 EMPTY11;
- vu16 DR6; /* Data Register for Channel 6 */
- vu16 EMPTY12;
- vu16 DR7; /* Data Register for Channel 7 */
- vu16 EMPTY13;
- vu16 PRS; /* Prescaler Value Register */
- vu16 EMPTY14;
-} ADC_TypeDef;
-
-/*--------------------- AHB APB BRIDGE registers strcture --------------------*/
-
-typedef struct
-{
- vu32 BSR; /* Bridge Status Register */
- vu32 BCR; /* Bridge Configuration Register */
- vu32 PAER; /* Peripheral Address Error register */
-} AHBAPB_TypeDef;
-
-/*--------------- Controller Area Network Interface Register -----------------*/
-
-typedef struct
-{
- vu16 CRR; /* IFn Command request Register */
- vu16 EMPTY1;
- vu16 CMR; /* IFn Command Mask Register */
- vu16 EMPTY2;
- vu16 M1R; /* IFn Message Mask 1 Register */
- vu16 EMPTY3;
- vu16 M2R; /* IFn Message Mask 2 Register */
- vu16 EMPTY4;
- vu16 A1R; /* IFn Message Arbitration 1 Register */
- vu16 EMPTY5;
- vu16 A2R; /* IFn Message Arbitration 2 Register */
- vu16 EMPTY6;
- vu16 MCR; /* IFn Message Control Register */
- vu16 EMPTY7;
- vu16 DA1R; /* IFn DATA A 1 Register */
- vu16 EMPTY8;
- vu16 DA2R; /* IFn DATA A 2 Register */
- vu16 EMPTY9;
- vu16 DB1R; /* IFn DATA B 1 Register */
- vu16 EMPTY10;
- vu16 DB2R; /* IFn DATA B 2 Register */
- vu16 EMPTY11[27];
-} CAN_MsgObj_TypeDef;
-
-typedef struct
-{
- vu16 CR; /* Control Register */
- vu16 EMPTY1;
- vu16 SR; /* Status Register */
- vu16 EMPTY2;
- vu16 ERR; /* Error counter Register */
- vu16 EMPTY3;
- vu16 BTR; /* Bit Timing Register */
- vu16 EMPTY4;
- vu16 IDR; /* Interrupt Identifier Register */
- vu16 EMPTY5;
- vu16 TESTR; /* Test Register */
- vu16 EMPTY6;
- vu16 BRPR; /* BRP Extension Register */
- vu16 EMPTY7[3];
- CAN_MsgObj_TypeDef sMsgObj[2];
- vu16 EMPTY8[16];
- vu16 TXR1R; /* Transmission request 1 Register */
- vu16 EMPTY9;
- vu16 TXR2R; /* Transmission Request 2 Register */
- vu16 EMPTY10[13];
- vu16 ND1R; /* New Data 1 Register */
- vu16 EMPTY11;
- vu16 ND2R; /* New Data 2 Register */
- vu16 EMPTY12[13];
- vu16 IP1R; /* Interrupt Pending 1 Register */
- vu16 EMPTY13;
- vu16 IP2R; /* Interrupt Pending 2 Register */
- vu16 EMPTY14[13];
- vu16 MV1R; /* Message Valid 1 Register */
- vu16 EMPTY15;
- vu16 MV2R; /* Message VAlid 2 Register */
- vu16 EMPTY16;
-} CAN_TypeDef;
-
-/*----------------------- System Control Unit---------------------------------*/
-
-typedef struct
-{
- vu32 CLKCNTR; /* Clock Control Register */
- vu32 PLLCONF; /* PLL Configuration Register */
- vu32 SYSSTATUS; /* System Status Register */
- vu32 PWRMNG; /* Power Management Register */
- vu32 ITCMSK; /* Interrupt Mask Register */
- vu32 PCGRO; /* Peripheral Clock Gating Register 0 */
- vu32 PCGR1; /* Peripheral Clock Gating Register 1 */
- vu32 PRR0; /* Peripheral Reset Register 0 */
- vu32 PRR1; /* Peripheral Reset Register 1 */
- vu32 MGR0; /* Idle Mode Mask Gating Register 0 */
- vu32 MGR1; /* Idle Mode Mask Gating Register 1 */
- vu32 PECGR0; /* Peripheral Emulation Clock Gating Register 0 */
- vu32 PECGR1; /* Peripheral Emulation Clock Gating Register 1 */
- vu32 SCR0; /* System Configuration Register 0 */
- vu32 SCR1; /* System Configuration Register 1 */
- vu32 SCR2; /* System Configuration Register 2 */
- u32 EMPTY1;
- vu32 GPIOOUT[8]; /* GPIO Output Registers */
- vu32 GPIOIN[8]; /* GPIO Input Registers */
- vu32 GPIOTYPE[10];/* GPIO Type Registers */
- vu32 GPIOEMI; /* GPIO EMI Selector Register */
- vu32 WKUPSEL; /* Wake-Up Selection Register */
- u32 EMPTY2[2];
- vu32 GPIOANA; /* GPIO Analag mode Register */
-} SCU_TypeDef;
-
-/*------------------------- DMA Channelx Registers ---------------------------*/
-
-typedef struct
-{
- vu32 SRC; /* Channelx Source Address Register */
- vu32 DES; /* Channelx Destination Address Register */
- vu32 LLI; /* Channelx Lincked List Item Register */
- vu32 CC; /* Channelx Contol Register */
- vu32 CCNF; /* Channelx Configuration Register */
-} DMA_Channel_TypeDef;
-
-/* x can be ,0,1,2,3,4,5,6 or 7. There are eight Channels AHB BUS Master */
-
-/*----------------------------- DMA Controller -------------------------------*/
-
-typedef struct
-{
- vu32 ISR; /* Interrupt Status Register */
- vu32 TCISR; /* Terminal Count Interrupt Status Register */
- vu32 TCICR; /* Terminal CountInterrupt Clear Register */
- vu32 EISR; /* Error Interrupt Status Register */
- vu32 EICR; /* Error Interrupt Clear Register */
- vu32 TCRISR; /* Terminal Count Raw Interrupt Status Register */
- vu32 ERISR; /* Raw Error Interrupt Status Register */
- vu32 ENCSR; /* Enabled Channel Status Register */
- vu32 SBRR; /* Software Burst Request Register */
- vu32 SSRR; /* Software Single Request Register */
- vu32 SLBRR; /* Software Last Burst Request Register */
- vu32 SLSRR; /* Software Last Single Request Register */
- vu32 CNFR; /* Configuration Register */
- vu32 SYNR; /* Syncronization Register */
- } DMA_TypeDef;
-
-/*--------------------------------- TIM Timer --------------------------------*/
-
-typedef struct
-{
- vu16 IC1R; /* Input Capture 1 Register */
- vu16 EMPTY1;
- vu16 IC2R; /* Input Capture 2 Register */
- vu16 EMPTY2;
- vu16 OC1R; /* Output Compare 1 Register */
- vu16 EMPTY3;
- vu16 OC2R; /* Output Compare 2 Register */
- vu16 EMPTY4;
- vu16 CNTR; /* Counter Register */
- vu16 EMPTY5;
- vu16 CR1; /* Control Register 1 */
- vu16 EMPTY6;
- vu16 CR2; /* Control Register 2 */
- vu16 EMPTY7;
- vu16 SR; /* Status Register */
- vu16 EMPTY8;
-} TIM_TypeDef;
-
-/*---------------------------- EMI Bankx Registers ---------------------------*/
-
-typedef struct
-{
- vu32 ICR; /* Bankx Idle Cycle Control Register */
- vu32 RCR; /* Bankx Read Wait State Control Register */
- vu32 WCR; /* Bankx Write Wait State Control Register */
- vu32 OECR; /* Bankx Output Enable Assertion Delay Control Register */
- vu32 WECR; /* Bankx Write Enable Assertion Delay Control Register */
- vu32 BCR; /* Bankx Control Register */
- } EMI_Bank_TypeDef;
-
-/*---------------------------- Ethernet Controller ---------------------------*/
-
-/* MAC Registers */
-typedef struct
-{
- vu32 MCR; /* ENET Control Register */
- vu32 MAH; /* ENET Address High Register */
- vu32 MAL; /* ENET Address Low Register */
- vu32 MCHA; /* Multicast Address High Register */
- vu32 MCLA; /* Multicast Address Low Register */
- vu32 MIIA; /* MII Address Register */
- vu32 MIID; /* MII Data Register */
- vu32 MCF; /* ENET Control Frame Register */
- vu32 VL1; /* VLAN1 Register */
- vu32 VL2; /* VLAN2 register */
- vu32 MTS; /* ENET Transmission Status Register */
- vu32 MRS; /* ENET Reception Status Register */
-} ENET_MAC_TypeDef;
-
-/* DMA Registers */
-typedef struct
-{
- vu32 SCR; /* DMA Status and Control Register */
- vu32 IER; /* DMA Interrupt Sources Enable Register */
- vu32 ISR; /* DMA Interrupt Status Register */
- vu32 CCR; /* Clock Control Relation : HCLK, PCLK and
- ENET_CLK phase relations */
- vu32 RXSTR; /* Rx DMA start Register */
- vu32 RXCR; /* Rx DMA Control Register */
- vu32 RXSAR; /* Rx DMA Base Address Register */
- vu32 RXNDAR; /* Rx DMA Next Descriptor Address Register */
- vu32 RXCAR; /* Rx DMA Current Address Register */
- vu32 RXCTCR; /* Rx DMA Current Transfer Count Register */
- vu32 RXTOR; /* Rx DMA FIFO Time Out Register */
- vu32 RXSR; /* Rx DMA FIFO Status Register */
- vu32 TXSTR; /* Tx DMA start Register */
- vu32 TXCR; /* Tx DMA Control Register */
- vu32 TXSAR; /* Tx DMA Base Address Register */
- vu32 TXNDAR; /* Tx DMA Next Descriptor Address Register */
- vu32 TXCAR; /* Tx DMA Current Address Register */
- vu32 TXTCR; /* Tx DMA Current Transfer Count Register */
- vu32 TXTOR; /* Tx DMA FIFO Time Out Register */
- vu32 TXSR; /* Tx DMA FIFO Status Register */
-} ENET_DMA_TypeDef;
-
-/*------------------------------------- GPIO ---------------------------------*/
-
-typedef struct
-{
- vu8 DR[1021]; /* Data Register */
- vu32 DDR; /* Data Direction Register */
-} GPIO_TypeDef;
-
-/*-------------------------------- I2C interface -----------------------------*/
-
-typedef struct
-{
- vu8 CR; /* Control Register */
- vu8 EMPTY1[3];
- vu8 SR1; /* Status Register 1 */
- vu8 EMPTY2[3];
- vu8 SR2; /* Status Register 2 */
- vu8 EMPTY3[3];
- vu8 CCR; /* Clock Control Register */
- vu8 EMPTY4[3];
- vu8 OAR1; /* Own Address Register 1 */
- vu8 EMPTY5[3];
- vu8 OAR2; /* Own Address Register 2 */
- vu8 EMPTY6[3];
- vu8 DR; /* Data Register */
- vu8 EMPTY7[3];
- vu8 ECCR; /* Extended Clock Control Register */
- vu8 EMPTY8[3];
-} I2C_TypeDef;
-
-/*------------------------------------- VIC ----------------------------------*/
-
-typedef struct
-{
- vu32 ISR; /* IRQ Status Register */
- vu32 FSR; /* FIQ Status Register */
- vu32 RINTSR; /* Raw Interrupt Status Register */
- vu32 INTSR; /* Interrupt Select Register */
- vu32 INTER; /* Interrupt Enable Register */
- vu32 INTECR; /* Interrupt Enable Clear Register */
- vu32 SWINTR; /* Software Interrupt Register */
- vu32 SWINTCR; /* Software Interrupt clear Register */
- vu32 PER; /* Protection Enable Register */
- vu32 EMPTY1[3];
- vu32 VAR; /* Vector Address Register */
- vu32 DVAR; /* Default Vector Address Register */
- vu32 EMPTY2[50];
- vu32 VAiR[16]; /* Vector Address 0-15 Register */
- vu32 EMPTY3[48];
- vu32 VCiR[16]; /* Vector Control 0-15 Register */
-} VIC_TypeDef;
-
-/*-------------------------------- Motor Control -----------------------------*/
-
-typedef struct
-{
- vu16 TCPT; /* Tacho Capture Register */
- vu16 EMPTY1;
- vu16 TCMP; /* Tacho Compare Register */
- vu16 EMPTY2;
- vu16 IPR; /* Input Pending Register */
- vu16 EMPTY3;
- vu16 TPRS; /* Tacho Prescaler Register */
- vu16 EMPTY4;
- vu16 CPRS; /* PWM Counter Prescaler Register */
- vu16 EMPTY5;
- vu16 REP; /* Repetition Counter Register */
- vu16 EMPTY6;
- vu16 CMPW; /* Compare Phase W Preload Register */
- vu16 EMPTY7;
- vu16 CMPV; /* Compare Phase V Preload Register */
- vu16 EMPTY8;
- vu16 CMPU; /* Compare Phase U Preload Register */
- vu16 EMPTY9;
- vu16 CMP0; /* Compare 0 Preload Register */
- vu16 EMPTY10;
- vu16 PCR0; /* Peripheral Control Register 0 */
- vu16 EMPTY11;
- vu16 PCR1; /* Peripheral Control Register 1 */
- vu16 EMPTY12;
- vu16 PCR2; /* Peripheral Control Register 2 */
- vu16 EMPTY13;
- vu16 PSR; /* Polarity Selection Register */
- vu16 EMPTY14;
- vu16 OPR; /* Output Peripheral Register */
- vu16 EMPTY15;
- vu16 IMR; /* Interrupt Mask Register */
- vu16 EMPTY16;
- vu16 DTG; /* Dead Time Generator Register */
- vu16 EMPTY17;
- vu16 ESC; /* Emergency Stop Clear Register */
- vu16 EMPTY18;
-}MC_TypeDef;
-
-/*------------------------------------- RTC ----------------------------------*/
-
-typedef struct
-{
- vu32 TR; /* Time Register */
- vu32 DTR; /* Date Register */
- vu32 ATR; /* Alarm time Register */
- vu32 CR; /* Control Register */
- vu32 SR; /* Status Register */
- vu32 MILR; /* Millisec Register */
-}RTC_TypeDef;
-
-/*------------------------------------- SSP ----------------------------------*/
-
-typedef struct
-{
- vu16 CR0; /* Control Register 1 */
- vu16 EMPTY1;
- vu16 CR1; /* Control Register 2 */
- vu16 EMPTY2;
- vu16 DR; /* Data Register */
- vu16 EMPTY3;
- vu16 SR; /* Status Register */
- vu16 EMPTY4;
- vu16 PR; /* Clock Prescale Register */
- vu16 EMPTY5;
- vu16 IMSCR; /* Interrupt Mask Set or Clear Register */
- vu16 EMPTY6;
- vu16 RISR; /* Raw Interrupt Status Register */
- vu16 EMPTY7;
- vu16 MISR; /* Masked Interrupt Status Register */
- vu16 EMPTY8;
- vu16 ICR; /* Interrupt Clear Register */
- vu16 EMPTY9;
- vu16 DMACR; /* DMA Control Register */
- vu16 EMPTY10;
-}SSP_TypeDef;
-
-/*------------------------------------ UART ----------------------------------*/
-
-typedef struct
-{
- vu16 DR; /* Data Register */
- vu16 EMPTY1;
- vu16 RSECR; /* Receive Status Register (read)/Error Clear Register (write) */
- vu16 EMPTY2[9];
- vu16 FR; /* Flag Register */
- vu16 EMPTY3[3];
- vu16 ILPR; /* IrDA Low-Power counter Register */
- vu16 EMPTY4;
- vu16 IBRD; /* Integer Baud Rate Divisor Register */
- vu16 EMPTY5;
- vu16 FBRD; /* Fractional Baud Rate Divisor Register */
- vu16 EMPTY6;
- vu16 LCR; /* Line Control Register, High byte */
- vu16 EMPTY7;
- vu16 CR; /* Control Register */
- vu16 EMPTY8;
- vu16 IFLS; /* Interrupt FIFO Level Select Register */
- vu16 EMPTY9;
- vu16 IMSC; /* Interrupt Mask Set/Clear Register */
- vu16 EMPTY10;
- vu16 RIS; /* Raw Interrupt Status Register */
- vu16 EMPTY11;
- vu16 MIS; /* Masked Interrupt Status Register */
- vu16 EMPTY12;
- vu16 ICR; /* Interrupt Clear Register */
- vu16 EMPTY13;
- vu16 DMACR; /* DMA Control Register */
- vu16 EMPTY14;
-}UART_TypeDef;
-
-/*------------------------------- Wake-up System -----------------------------*/
-
-typedef struct
-{
- vu32 CTRL; /* Control Register */
- vu32 MR; /* Mask Register */
- vu32 TR; /* Trigger Register */
- vu32 PR; /* Pending Register */
- vu32 INTR; /* Software Interrupt Register */
-} WIU_TypeDef;
-
-/*------------------------------- WatchDog Timer -----------------------------*/
-
-typedef struct
-{
- vu16 CR; /* Control Register */
- vu16 EMPTY1;
- vu16 PR; /* Presclar Register */
- vu16 EMPTY2;
- vu16 VR; /* Pre-load Value Register */
- vu16 EMPTY3;
- vu16 CNT; /* Counter Register */
- vu16 EMPTY4;
- vu16 SR; /* Status Register */
- vu16 EMPTY5;
- vu16 MR; /* Mask Register */
- vu16 EMPTY6;
- vu16 KR; /* Key Register */
- vu16 EMPTY7;
-} WDG_TypeDef;
-
-/*******************************************************************************
-* Memory Mapping of STR91x *
-*******************************************************************************/
-
-#define AHB_APB_BRDG0_U (0x58000000) /* AHB/APB Bridge 0 UnBuffered Space */
-#define AHB_APB_BRDG0_B (0x48000000) /* AHB/APB Bridge 0 Buffered Space */
-
-#define AHB_APB_BRDG1_U (0x5C000000) /* AHB/APB Bridge 1 UnBuffered Space */
-#define AHB_APB_BRDG1_B (0x4C000000) /* AHB/APB Bridge 1 Buffered Space */
-
-#define AHB_EMI_U (0x74000000) /* EMI UnBuffered Space */
-#define AHB_EMI_B (0x64000000) /* EMI Buffered Space */
-
-#define AHB_DMA_U (0x78000000) /* DMA UnBuffered Space */
-#define AHB_DMA_B (0x68000000) /* DMA Buffered Space */
-
-#define AHB_ENET_MAC_U (0x7C000400) /* ENET_MAC UnBuffered Space */
-#define AHB_ENET_MAC_B (0x6C000000) /* ENET_MAC Buffered Space */
-
-#define AHB_ENET_DMA_U (0x7C000000) /* ENET_DMA Unbuffered Space */
-#define AHB_ENET_DMA_B (0x6C000400) /* ENET_DMA Buffered Space */
-
-#define AHB_VIC1_U (0xFC000000) /* Secondary VIC1 UnBuffered Space */
-#define AHB_VIC0_U (0xFFFFF000) /* Primary VIC0 UnBuffered Space */
-
-#define AHB_FMI_U (0x54000000) /* FMI Unbuffered Space */
-#define AHB_FMI_B (0x44000000) /* FMI buffered Space */
-
-/*******************************************************************************
-* Addresses related to the VICs' peripherals *
-*******************************************************************************/
-
-#define VIC0_BASE (AHB_VIC0_U)
-#define VIC1_BASE (AHB_VIC1_U)
-
-/*******************************************************************************
-* Addresses related to the EMI banks *
-*******************************************************************************/
-
-#define AHB_EMIB3_OFST (0x00000040) /* Offset of EMI bank3 */
-#define AHB_EMIB2_OFST (0x00000020) /* Offset of EMI bank2 */
-#define AHB_EMIB1_OFST (0x00000000) /* Offset of EMI bank1 */
-#define AHB_EMIB0_OFST (0x000000E0) /* Offset of EMI bank0 */
-
-/*******************************************************************************
-* Addresses related to the DMA peripheral *
-*******************************************************************************/
-
-#define AHB_DMA_Channel0_OFST (0x00000100) /* Offset of Channel 0 */
-#define AHB_DMA_Channel1_OFST (0x00000120) /* Offset of Channel 1 */
-#define AHB_DMA_Channel2_OFST (0x00000140) /* Offset of Channel 2 */
-#define AHB_DMA_Channel3_OFST (0x00000160) /* Offset of Channel 3 */
-#define AHB_DMA_Channel4_OFST (0x00000180) /* Offset of Channel 4 */
-#define AHB_DMA_Channel5_OFST (0x000001A0) /* Offset of Channel 5 */
-#define AHB_DMA_Channel6_OFST (0x000001C0) /* Offset of Channel 6 */
-#define AHB_DMA_Channel7_OFST (0x000001E0) /* Offset of Channel 7 */
-
-/*******************************************************************************
-* Addresses related to the APB0 sub-system *
-*******************************************************************************/
-
-#define APB_WIU_OFST (0x00001000) /* Offset of WIU */
-#define APB_TIM0_OFST (0x00002000) /* Offset of TIM0 */
-#define APB_TIM1_OFST (0x00003000) /* Offset of TIM1 */
-#define APB_TIM2_OFST (0x00004000) /* Offset of TIM2 */
-#define APB_TIM3_OFST (0x00005000) /* Offset of TIM3 */
-#define APB_GPIO0_OFST (0x00006000) /* Offset of GPIO0 */
-#define APB_GPIO1_OFST (0x00007000) /* Offset of GPIO1 */
-#define APB_GPIO2_OFST (0x00008000) /* Offset of GPIO2 */
-#define APB_GPIO3_OFST (0x00009000) /* Offset of GPIO3 */
-#define APB_GPIO4_OFST (0x0000A000) /* Offset of GPIO4 */
-#define APB_GPIO5_OFST (0x0000B000) /* Offset of GPIO5 */
-#define APB_GPIO6_OFST (0x0000C000) /* Offset of GPIO6 */
-#define APB_GPIO7_OFST (0x0000D000) /* Offset of GPIO7 */
-#define APB_GPIO8_OFST (0x0000E000) /* Offset of GPIO8 */
-#define APB_GPIO9_OFST (0x0000F000) /* Offset of GPIO9 */
-
-/*******************************************************************************
-* Addresses related to the APB1 sub-system *
-*******************************************************************************/
-
-#define APB_RTC_OFST (0x00001000) /* Offset of RTC */
-#define APB_SCU_OFST (0x00002000) /* Offset of System Controller */
-#define APB_MC_OFST (0x00003000) /* Offset of Motor Control */
-#define APB_UART0_OFST (0x00004000) /* Offset of UART0 */
-#define APB_UART1_OFST (0x00005000) /* Offset of UART1 */
-#define APB_UART2_OFST (0x00006000) /* Offset of UART2 */
-#define APB_SSP0_OFST (0x00007000) /* Offset of SSP0 */
-#define APB_SSP1_OFST (0x00008000) /* Offset of SSPI */
-#define APB_CAN_OFST (0x00009000) /* Offset of CAN */
-#define APB_ADC_OFST (0x0000A000) /* Offset of ADC */
-#define APB_WDG_OFST (0x0000B000) /* Offset of WDG */
-#define APB_I2C0_OFST (0x0000C000) /* Offset of I2C0 */
-#define APB_I2C1_OFST (0x0000D000) /* Offset of I2C1 */
-
-/*----------------------------------------------------------------------------*/
-/*----------------------------- Unbuffered Mode ------------------------------*/
-/*----------------------------------------------------------------------------*/
-
-#ifndef Buffered
-
-/*******************************************************************************
-* AHBAPB peripheral Unbuffered Base Address *
-*******************************************************************************/
-
-#define AHBAPB0_BASE (AHB_APB_BRDG0_U)
-#define AHBAPB1_BASE (AHB_APB_BRDG1_U)
-
-/*******************************************************************************
-* ENET peripheral Unbuffered Base Address *
-*******************************************************************************/
-
-#define ENET_MAC_BASE (AHB_ENET_MAC_U)
-#define ENET_DMA_BASE (AHB_ENET_DMA_U)
-
-/*******************************************************************************
-* DMA peripheral Unbuffered Base Address *
-*******************************************************************************/
-
-#define DMA_BASE (AHB_DMA_U)
-
-/*******************************************************************************
-* EMI peripheral Unbuffered Base Address *
-*******************************************************************************/
-
-#define EMI_BASE (AHB_EMI_U)
-
-/*******************************************************************************
-* FMI peripheral Unbuffered Base Address *
-*******************************************************************************/
-
-#define FMI_BASE (AHB_FMI_U)
-
-
-#else /* Buffered */
-
-/*----------------------------------------------------------------------------*/
-/*------------------------------ Buffered Mode -------------------------------*/
-/*----------------------------------------------------------------------------*/
-
-/*******************************************************************************
-* AHBAPB peripheral Buffered Base Address *
-*******************************************************************************/
-
-#define AHBAPB0_BASE (AHB_APB_BRDG0_B)
-#define AHBAPB1_BASE (AHB_APB_BRDG1_B)
-
-/*******************************************************************************
-* ENET peripheral Unbuffered Base Address *
-*******************************************************************************/
-
-#define ENET_MAC_BASE (AHB_ENET_MAC_B)
-#define ENET_DMA_BASE (AHB_ENET_DMA_B)
-
-/*******************************************************************************
-* DMA peripheral Buffered Base Address *
-*******************************************************************************/
-
-#define DMA_BASE (AHB_DMA_B)
-
-/*******************************************************************************
-* EMI peripheral Buffered Base Address *
-*******************************************************************************/
-
-#define EMI_BASE (AHB_EMI_B)
-
-/*******************************************************************************
-* FMI peripheral Buffered Base Address *
-*******************************************************************************/
-
-#define FMI_BASE (AHB_FMI_B)
-
-#endif /* Buffered */
-
-/*******************************************************************************
-* DMA channels Base Address *
-*******************************************************************************/
-#define DMA_Channel0_BASE (DMA_BASE + AHB_DMA_Channel0_OFST)
-#define DMA_Channel1_BASE (DMA_BASE + AHB_DMA_Channel1_OFST)
-#define DMA_Channel2_BASE (DMA_BASE + AHB_DMA_Channel2_OFST)
-#define DMA_Channel3_BASE (DMA_BASE + AHB_DMA_Channel3_OFST)
-#define DMA_Channel4_BASE (DMA_BASE + AHB_DMA_Channel4_OFST)
-#define DMA_Channel5_BASE (DMA_BASE + AHB_DMA_Channel5_OFST)
-#define DMA_Channel6_BASE (DMA_BASE + AHB_DMA_Channel6_OFST)
-#define DMA_Channel7_BASE (DMA_BASE + AHB_DMA_Channel7_OFST)
-
-/*******************************************************************************
-* EMI Banks peripheral Base Address *
-*******************************************************************************/
-
-#define EMI_Bank0_BASE (EMI_BASE + AHB_EMIB0_OFST)
-#define EMI_Bank1_BASE (EMI_BASE + AHB_EMIB1_OFST)
-#define EMI_Bank2_BASE (EMI_BASE + AHB_EMIB2_OFST)
-#define EMI_Bank3_BASE (EMI_BASE + AHB_EMIB3_OFST)
-
-/*******************************************************************************
-* APB0 Peripherals' Base addresses *
-*******************************************************************************/
-
-#define WIU_BASE (AHBAPB0_BASE + APB_WIU_OFST)
-#define TIM0_BASE (AHBAPB0_BASE + APB_TIM0_OFST)
-#define TIM1_BASE (AHBAPB0_BASE + APB_TIM1_OFST)
-#define TIM2_BASE (AHBAPB0_BASE + APB_TIM2_OFST)
-#define TIM3_BASE (AHBAPB0_BASE + APB_TIM3_OFST)
-#define GPIO0_BASE (AHBAPB0_BASE + APB_GPIO0_OFST)
-#define GPIO1_BASE (AHBAPB0_BASE + APB_GPIO1_OFST)
-#define GPIO2_BASE (AHBAPB0_BASE + APB_GPIO2_OFST)
-#define GPIO3_BASE (AHBAPB0_BASE + APB_GPIO3_OFST)
-#define GPIO4_BASE (AHBAPB0_BASE + APB_GPIO4_OFST)
-#define GPIO5_BASE (AHBAPB0_BASE + APB_GPIO5_OFST)
-#define GPIO6_BASE (AHBAPB0_BASE + APB_GPIO6_OFST)
-#define GPIO7_BASE (AHBAPB0_BASE + APB_GPIO7_OFST)
-#define GPIO8_BASE (AHBAPB0_BASE + APB_GPIO8_OFST)
-#define GPIO9_BASE (AHBAPB0_BASE + APB_GPIO9_OFST)
-
-/*******************************************************************************
-* APB1 Peripherals' Base addresses *
-*******************************************************************************/
-
-#define RTC_BASE (AHBAPB1_BASE + APB_RTC_OFST)
-#define SCU_BASE (AHBAPB1_BASE + APB_SCU_OFST)
-#define MC_BASE (AHBAPB1_BASE + APB_MC_OFST)
-#define UART0_BASE (AHBAPB1_BASE + APB_UART0_OFST)
-#define UART1_BASE (AHBAPB1_BASE + APB_UART1_OFST)
-#define UART2_BASE (AHBAPB1_BASE + APB_UART2_OFST)
-#define SSP0_BASE (AHBAPB1_BASE + APB_SSP0_OFST)
-#define SSP1_BASE (AHBAPB1_BASE + APB_SSP1_OFST)
-#define CAN_BASE (AHBAPB1_BASE + APB_CAN_OFST)
-#define ADC_BASE (AHBAPB1_BASE + APB_ADC_OFST)
-#define WDG_BASE (AHBAPB1_BASE + APB_WDG_OFST)
-#define I2C0_BASE (AHBAPB1_BASE + APB_I2C0_OFST)
-#define I2C1_BASE (AHBAPB1_BASE + APB_I2C1_OFST)
-
-/*******************************************************************************
-* IPs' declaration *
-*******************************************************************************/
-
-/*------------------------------ Non Debug Mode ------------------------------*/
-#undef DEBUG
-#ifndef DEBUG
-
-/*********************************** AHBAPB ***********************************/
-
-#define AHBAPB0 ((AHBAPB_TypeDef *)AHBAPB0_BASE)
-#define AHBAPB1 ((AHBAPB_TypeDef *)AHBAPB1_BASE)
-
-/************************************* EMI ************************************/
-
-#define EMI ((EMI_TypeDef *)EMI_BASE)
-
-/************************************* DMA ************************************/
-
-#define DMA ((DMA_TypeDef *)DMA_BASE)
-#define DMA_Channel0 ((DMA_Channel_TypeDef *)DMA_Channel0_BASE)
-#define DMA_Channel1 ((DMA_Channel_TypeDef *)DMA_Channel1_BASE)
-#define DMA_Channel2 ((DMA_Channel_TypeDef *)DMA_Channel2_BASE)
-#define DMA_Channel3 ((DMA_Channel_TypeDef *)DMA_Channel3_BASE)
-#define DMA_Channel4 ((DMA_Channel_TypeDef *)DMA_Channel4_BASE)
-#define DMA_Channel5 ((DMA_Channel_TypeDef *)DMA_Channel5_BASE)
-#define DMA_Channel6 ((DMA_Channel_TypeDef *)DMA_Channel6_BASE)
-#define DMA_Channel7 ((DMA_Channel_TypeDef *)DMA_Channel7_BASE)
-
-/************************************* EMI ************************************/
-
-#define EMI_Bank0 ((EMI_Bank_TypeDef *)EMI_Bank0_BASE)
-#define EMI_Bank1 ((EMI_Bank_TypeDef *)EMI_Bank1_BASE)
-#define EMI_Bank2 ((EMI_Bank_TypeDef *)EMI_Bank2_BASE)
-#define EMI_Bank3 ((EMI_Bank_TypeDef *)EMI_Bank3_BASE)
-
-/************************************* ENET_MAC ************************************/
-
-#define ENET_MAC ((ENET_MAC_TypeDef *)ENET_MAC_BASE)
-
-/************************************* ENET_DMA ************************************/
-
-#define ENET_DMA ((ENET_DMA_TypeDef *)ENET_DMA_BASE)
-
-/************************************* FMI ************************************/
-
-#define FMI ((FMI_TypeDef *)FMI_BASE)
-
-/************************************* VIC ************************************/
-
-#define VIC0 ((VIC_TypeDef *)VIC0_BASE)
-#define VIC1 ((VIC_TypeDef *)VIC1_BASE)
-
-/*******************************************************************************
-* APB0 Peripherals' *
-*******************************************************************************/
-#define WIU ((WIU_TypeDef *)WIU_BASE)
-#define TIM0 ((TIM_TypeDef *)TIM0_BASE)
-#define TIM1 ((TIM_TypeDef *)TIM1_BASE)
-#define TIM2 ((TIM_TypeDef *)TIM2_BASE)
-#define TIM3 ((TIM_TypeDef *)TIM3_BASE)
-#define GPIO0 ((GPIO_TypeDef *)GPIO0_BASE)
-#define GPIO1 ((GPIO_TypeDef *)GPIO1_BASE)
-#define GPIO2 ((GPIO_TypeDef *)GPIO2_BASE)
-#define GPIO3 ((GPIO_TypeDef *)GPIO3_BASE)
-#define GPIO4 ((GPIO_TypeDef *)GPIO4_BASE)
-#define GPIO5 ((GPIO_TypeDef *)GPIO5_BASE)
-#define GPIO6 ((GPIO_TypeDef *)GPIO6_BASE)
-#define GPIO7 ((GPIO_TypeDef *)GPIO7_BASE)
-#define GPIO8 ((GPIO_TypeDef *)GPIO8_BASE)
-#define GPIO9 ((GPIO_TypeDef *)GPIO9_BASE)
-/*******************************************************************************
-* APB1 Peripherals' *
-*******************************************************************************/
-#define RTC ((RTC_TypeDef *)RTC_BASE)
-#define SCU ((SCU_TypeDef *)SCU_BASE)
-#define MC ((MC_TypeDef *)MC_BASE)
-#define UART0 ((UART_TypeDef *)UART0_BASE)
-#define UART1 ((UART_TypeDef *)UART1_BASE)
-#define UART2 ((UART_TypeDef *)UART2_BASE)
-#define SSP0 ((SSP_TypeDef *)SSP0_BASE)
-#define SSP1 ((SSP_TypeDef *)SSP1_BASE)
-#define CAN ((CAN_TypeDef *)CAN_BASE)
-#define ADC ((ADC_TypeDef *)ADC_BASE)
-#define WDG ((WDG_TypeDef *)WDG_BASE)
-#define I2C0 ((I2C_TypeDef *)I2C0_BASE)
-#define I2C1 ((I2C_TypeDef *)I2C1_BASE)
-#define ENET_MAC ((ENET_MAC_TypeDef *)ENET_MAC_BASE)
-#define ENET_DMA ((ENET_DMA_TypeDef *)ENET_DMA_BASE)
-
-#else /* DEBUG */
-
-/*-------------------------------- Debug Mode --------------------------------*/
-
-EXT AHBAPB_TypeDef *AHBAPB0;
-EXT AHBAPB_TypeDef *AHBAPB1;
-EXT DMA_TypeDef *DMA;
-EXT DMA_Channel_TypeDef *DMA_Channel0;
-EXT DMA_Channel_TypeDef *DMA_Channel1;
-EXT DMA_Channel_TypeDef *DMA_Channel2;
-EXT DMA_Channel_TypeDef *DMA_Channel3;
-EXT DMA_Channel_TypeDef *DMA_Channel4;
-EXT DMA_Channel_TypeDef *DMA_Channel5;
-EXT DMA_Channel_TypeDef *DMA_Channel6;
-EXT DMA_Channel_TypeDef *DMA_Channel7;
-EXT EMI_Bank_TypeDef *EMI_Bank0;
-EXT EMI_Bank_TypeDef *EMI_Bank1;
-EXT EMI_Bank_TypeDef *EMI_Bank2;
-EXT EMI_Bank_TypeDef *EMI_Bank3;
-EXT FMI_TypeDef *FMI;
-EXT VIC_TypeDef *VIC0;
-EXT VIC_TypeDef *VIC1;
-EXT WIU_TypeDef *WIU;
-EXT TIM_TypeDef *TIM0;
-EXT TIM_TypeDef *TIM1;
-EXT TIM_TypeDef *TIM2;
-EXT TIM_TypeDef *TIM3;
-EXT GPIO_TypeDef *GPIO0;
-EXT GPIO_TypeDef *GPIO1;
-EXT GPIO_TypeDef *GPIO2;
-EXT GPIO_TypeDef *GPIO3;
-EXT GPIO_TypeDef *GPIO4;
-EXT GPIO_TypeDef *GPIO5;
-EXT GPIO_TypeDef *GPIO6;
-EXT GPIO_TypeDef *GPIO7;
-EXT GPIO_TypeDef *GPIO8;
-EXT GPIO_TypeDef *GPIO9;
-EXT RTC_TypeDef *RTC;
-EXT SCU_TypeDef *SCU;
-EXT MC_TypeDef *MC;
-EXT UART_TypeDef *UART0;
-EXT UART_TypeDef *UART1;
-EXT UART_TypeDef *UART2;
-EXT SSP_TypeDef *SSP0;
-EXT SSP_TypeDef *SSP1;
-EXT CAN_TypeDef *CAN;
-EXT ADC_TypeDef *ADC;
-EXT WDG_TypeDef *WDG;
-EXT I2C_TypeDef *I2C0;
-EXT I2C_TypeDef *I2C1;
-EXT ENET_MAC_TypeDef *ENET_MAC;
-EXT ENET_DMA_TypeDef *ENET_DMA;
-
-
-#endif /* DEBUG */
-
-#endif /* __91x_MAP_H*/
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
-
diff --git a/uc_str912/prj_TEST_LED/include/91x_scu.h b/uc_str912/prj_TEST_LED/include/91x_scu.h
deleted file mode 100644
index b9d04f5..0000000
--- a/uc_str912/prj_TEST_LED/include/91x_scu.h
+++ /dev/null
@@ -1,196 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_scu.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides the SCU library software functions
-* prototypes & definitions
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __91x_SCU_H
-#define __91x_SCU_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_map.h"
-
-/* Exported constants --------------------------------------------------------*/
-
-/*MCLK_Source*/
-#define SCU_MCLK_PLL 0x0
-#define SCU_MCLK_RTC 0x1
-#define SCU_MCLK_OSC 0x2
-
-/*RCLK_Divisor*/
-#define SCU_RCLK_Div1 0xFFFFFFE3
-#define SCU_RCLK_Div2 0x4
-#define SCU_RCLK_Div4 0x8
-#define SCU_RCLK_Div8 0xC
-#define SCU_RCLK_Div16 0x10
-#define SCU_RCLK_Div1024 0x14
-
-/*HCLK_Divisor*/
-#define SCU_HCLK_Div1 0xFFFFFF9F
-#define SCU_HCLK_Div2 0x20
-#define SCU_HCLK_Div4 0x40
-
-/*PCLK_Divisor*/
-#define SCU_PCLK_Div1 0xFFFFFE7F
-#define SCU_PCLK_Div2 0x80
-#define SCU_PCLK_Div4 0x100
-#define SCU_PCLK_Div8 0x180
-
-/*FMICLK_Divisor*/
-#define SCU_FMICLK_Div1 0xFFFEFFFF
-#define SCU_FMICLK_Div2 0x10000
-
-/*BRCLK_Divisor*/
-#define SCU_BRCLK_Div1 0xFFFFFDFF
-#define SCU_BRCLK_Div2 0x200
-
-/*TIMCLK_Source*/
-#define SCU_TIMCLK_EXT 0x1
-#define SCU_TIMCLK_INT 0x0
-
-/*TIMx*/
-#define SCU_TIM01 0x0
-#define SCU_TIM23 0x1
-
-
-/*USBCLK_Source*/
-#define SCU_USBCLK_MCLK 0xFFFFF3FF
-#define SCU_USBCLK_MCLK2 0x400
-#define SCU_USBCLK_EXT 0x800
-
-/*SCU_EMIBCLK*/
-#define SCU_EMIBCLK_Div1 0xFFF9FFFF
-#define SCU_EMIBCLK_Div2 0x20000
-
-/*SCU_EMIMODE*/
-#define SCU_EMI_MUX 0xFFFFFFBF
-#define SCU_EMI_DEMUX 0x40
-
-/*SCU_EMIALE_LEN*/
-#define SCU_EMIALE_LEN1 0xFFFFFEFF
-#define SCU_EMIALE_LEN2 0x100
-
-/*SCU_EMIALE_POL*/
-#define SCU_EMIALE_POLLow 0xFFFFFF7F
-#define SCU_EMIALE_POLHigh 0x80
-
-/*UART_IrDA_Mode*/
-#define SCU_UARTMode_IrDA 0x1
-#define SCU_UARTMode_UART 0x0
-
-/*APBPeriph*/
-#define __TIM01 0x1
-#define __TIM23 0x2
-#define __MC 0x4
-#define __UART0 0x8
-#define __UART1 0x10
-#define __UART2 0x20
-#define __I2C0 0x40
-#define __I2C1 0x80
-#define __SSP0 0x100
-#define __SSP1 0x200
-#define __CAN 0x400
-#define __ADC 0x800
-#define __WDG 0x1000
-#define __WIU 0x2000
-#define __GPIO0 0x4000
-#define __GPIO1 0x8000
-#define __GPIO2 0x10000
-#define __GPIO3 0x20000
-#define __GPIO4 0x40000
-#define __GPIO5 0x80000
-#define __GPIO6 0x100000
-#define __GPIO7 0x200000
-#define __GPIO8 0x400000
-#define __GPIO9 0x800000
-#define __RTC 0x1000000
-
-/*AHBPeriph*/
-#define __FMI 0x1
-#define __FPQBC 0x2
-#define __SRAM 0x8
-#define __SRAM_ARBITER 0x10
-#define __VIC 0x20
-#define __EMI 0x40
-#define __EMI_MEM_CLK 0x80
-#define __DMA 0x100
-#define __USB 0x200
-#define __USB48M 0x400
-#define __ENET 0x800
-#define __PFQBC_AHB 0x1000
-
-/*SCU_IT*/
-#define SCU_IT_LVD_RST 0x10
-#define SCU_IT_SRAM_ERROR 0x8
-#define SCU_IT_ACK_PFQBC 0x4
-#define SCU_IT_LOCK_LOST 0x2
-#define SCU_IT_LOCK 0x1
-
-/*SCU_FLAG*/
-#define SCU_FLAG_SRAM_ERROR 0x20
-#define SCU_FLAG_ACK_PFQBC 0x10
-#define SCU_FLAG_LVD_RESET 0x8
-#define SCU_FLAG_WDG_RST 0x4
-#define SCU_FLAG_LOCK_LOST 0x2
-#define SCU_FLAG_LOCK 0x1
-
-
-/* Module private variables --------------------------------------------------*/
-/* Exported macro ------------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-ErrorStatus SCU_MCLKSourceConfig(u32 MCLK_Source);
-ErrorStatus SCU_PLLFactorsConfig(u8 PLLN, u8 PLLM, u8 PLLP);
-ErrorStatus SCU_PLLCmd(FunctionalState NewState);
-void SCU_RCLKDivisorConfig(u32 RCLK_Divisor);
-void SCU_HCLKDivisorConfig(u32 HCLK_Divisor);
-void SCU_PCLKDivisorConfig(u32 PCLK_Divisor);
-void SCU_APBPeriphClockConfig(u32 APBPeriph, FunctionalState NewState);
-void SCU_AHBPeriphClockConfig(u32 AHBPeriph, FunctionalState NewState);
-void SCU_APBPeriphReset(u32 APBPeriph, FunctionalState NewState);
-void SCU_AHBPeriphReset(u32 AHBPeriph, FunctionalState NewState);
-void SCU_APBPeriphIdleConfig(u32 APBPeriph, FunctionalState NewState);
-void SCU_AHBPeriphIdleConfig(u32 AHBPeriph, FunctionalState NewState);
-void SCU_APBPeriphDebugConfig(u32 APBPeriph, FunctionalState NewState);
-void SCU_AHBPeriphDebugConfig(u32 AHBPeriph, FunctionalState NewState);
-void SCU_BRCLKDivisorConfig(u32 BRCLK_Divisor);
-void SCU_TIMCLKSourceConfig(u8 TIMx, u32 TIMCLK_Source);
-void SCU_TIMPresConfig(u8 TIMx, u16 Prescaler);
-void SCU_USBCLKConfig(u32 USBCLK_Source);
-void SCU_PHYCLKConfig(FunctionalState NewState);
-void SCU_FMICLKDivisorConfig(u32 FMICLK_Divisor);
-void SCU_EMIBCLKDivisorConfig(u32 SCU_EMIBCLK);
-void SCU_EMIModeConfig(u32 SCU_EMIMODE);
-void SCU_EMIALEConfig(u32 SCU_EMIALE_LEN, u32 SCU_EMIALE_POL);
-void SCU_ITConfig(u32 SCU_IT, FunctionalState NewState);
-FlagStatus SCU_GetFlagStatus(u32 SCU_Flag);
-void SCU_ClearFlag(u32 SCU_Flag);
-u32 SCU_GetPLLFreqValue(void);
-u32 SCU_GetMCLKFreqValue(void);
-u32 SCU_GetRCLKFreqValue(void);
-u32 SCU_GetHCLKFreqValue(void);
-u32 SCU_GetPCLKFreqValue(void);
-void SCU_WakeUpLineConfig(u8 EXTint);
-void SCU_SpecIntRunModeConfig(FunctionalState NewState);
-void SCU_EnterIdleMode(void);
-void SCU_EnterSleepMode(void);
-void SCU_UARTIrDASelect(UART_TypeDef * UARTx, u8 UART_IrDA_Mode);
-void SCU_PFQBCCmd(FunctionalState NewState);
-
-#endif /*__91x_SCU_H*/
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_TEST_LED/include/91x_type.h b/uc_str912/prj_TEST_LED/include/91x_type.h
deleted file mode 100644
index 916d81c..0000000
--- a/uc_str912/prj_TEST_LED/include/91x_type.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_type.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : It contains common types and constants used in all the
-* peripherals' drivers.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-**********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*********************************************************************************/
-
-#ifndef __91x_type_H
-#define __91x_type_H
-
- typedef long long u64;
- typedef unsigned long u32;
- typedef unsigned short u16;
- typedef unsigned char u8;
-
- typedef signed long s32;
- typedef signed short s16;
- typedef signed char s8;
-
- typedef volatile unsigned long vu32;
- typedef volatile unsigned short vu16;
- typedef volatile unsigned char vu8;
-
- typedef volatile signed long vs32;
- typedef volatile signed short vs16;
- typedef volatile signed char vs8;
-
-typedef enum { FALSE = 0, TRUE = !FALSE } bool;
-
-typedef enum { RESET = 0, SET = !RESET } FlagStatus, ITStatus;
-
-typedef enum { DISABLE = 0, ENABLE = !DISABLE} FunctionalState;
-
-typedef enum { ERROR = 0, SUCCESS = !ERROR} ErrorStatus;
-
-#endif /* __91x_type_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_TEST_LED/led.c b/uc_str912/prj_TEST_LED/led.c
deleted file mode 100644
index c46fd85..0000000
--- a/uc_str912/prj_TEST_LED/led.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/******************************************************************************
- * www.propox.com
- * MMstr912 - Minimodu³ Ethernetowy z procesorem ARM9 STR912.
- * Ethernet minimodule with ARM9 STR912 microcontroller.
- *
- * LED Test - efekt swietlny na diodach led
- * light effect on LEDs
- *
- * Do GPIO8 podlaczyc diody (Connect LEDs o GPIO8)
-
- * Includes ------------------------------------------------------------------*/
-/* Pliki nag³ówkowe ----------------------------------------------------------*/
-/* Library includes. */
-#include "91x_lib.h"
-#include "91x_gpio.h"
-#include "91x_map.h"
-#include "91x_scu.h"
-
-//#include <targets/STR912FW44.h> rem Bla
-
-
-/* Port 8 Configuration */
-/* Konfiguracja protu 8 */
-void HardwareConf(void)
-{
- //Disable reset for GPIO8
- //wylaczenie resetu na GPIO8
- SCU_APBPeriphReset(__GPIO8, DISABLE);
- //Enable clock for GPIO8
- //W³¹czenie zegara na GPIO8
- SCU_APBPeriphClockConfig(__GPIO8, ENABLE);
-}
-
-
-/* Port 8 Configuration */
-/* Konfiguracja protu 8 */
-void LED_DataLinesConfig()
-{
- /* Private typedef */
- /* Deklaracja struktury */
- GPIO_InitTypeDef GPIO_InitStructure;
-
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All;
- /* Configure D0~D7 lines in Output Push-Pull mode */
- /* Konfiguracja lini portu 8 jako wyjsc w trybie push-pull */
- GPIO_InitStructure.GPIO_Alternate = GPIO_OutputAlt1;
- GPIO_InitStructure.GPIO_Direction = GPIO_PinOutput;
- GPIO_InitStructure.GPIO_Type = GPIO_Type_PushPull;
-
- GPIO_Init(GPIO8, &GPIO_InitStructure);
-}
-
-
-/* Delay */
-/* Opoznienie */
-void delay(int time)
-{
- while(time--)
- asm volatile ("nop");
-}
-
-/******************** LEDs Functions **************************/
-/**************************************************************/
-/* LED Flashing */
-/* Miganie diody LED */
-void LEDflashing(int GPIO_Pin_x)
-{
- /* Reset pin P8.x */
- GPIO_WriteBit(GPIO8, GPIO_Pin_x, Bit_RESET);
- delay(200000);
- /* Set pin P8.x */
- GPIO_WriteBit(GPIO8, GPIO_Pin_x, Bit_SET);
- delay(200000);
-}
-/* LED on */
-/* zapalenie diody LED */
-void LEDon(int GPIO_Pin_x)
-{
- /* Reset pin P8.x */
- GPIO_WriteBit(GPIO8, GPIO_Pin_x, Bit_RESET);
-}
-/* LED off */
-/* zgaszenie diody LED */
-void LEDoff(int GPIO_Pin_x)
-{
- /* Set pin P8.x */
- GPIO_WriteBit(GPIO8, GPIO_Pin_x, Bit_SET);
-}
-/**************************************************************/
-
-
-int main()
-{
-//Hardware Configuration
-//Konfiguracja sprzetu
-HardwareConf();
-//Port Configuration
-//Konfiguracja portu
-LED_DataLinesConfig();
-
-while(1)
-{
- LEDflashing(GPIO_Pin_0);
- delay(5000);
- LEDflashing(GPIO_Pin_1);
- delay(5000);
- LEDflashing(GPIO_Pin_2);
- delay(5000);
- LEDflashing(GPIO_Pin_3);
- delay(5000);
- LEDflashing(GPIO_Pin_4);
- delay(5000);
- LEDflashing(GPIO_Pin_5);
- delay(5000);
- LEDflashing(GPIO_Pin_6);
- delay(5000);
- LEDflashing(GPIO_Pin_7);
- delay(5000);
-}
-
-return 0;
-}
diff --git a/uc_str912/prj_TEST_LED/load_segger.gdb b/uc_str912/prj_TEST_LED/load_segger.gdb
deleted file mode 100644
index dc1736e..0000000
--- a/uc_str912/prj_TEST_LED/load_segger.gdb
+++ /dev/null
@@ -1,20 +0,0 @@
-set complaints 1
-set output-radix 16
-set input-radix 16
-set prompt (arm-gdb)
-
-target remote localhost:2331
-
-monitor speed adaptive
-monitor endian little
-
-monitor reset
-monitor flash device = STR912FAW44
-monitor flash breakpoints = 1
-monitor flash download = 1
-monitor halt
-
-
-pwd
-load led.elf
-file led.elf
diff --git a/uc_str912/prj_TEST_LED/startup.s b/uc_str912/prj_TEST_LED/startup.s
deleted file mode 100644
index cef54d8..0000000
--- a/uc_str912/prj_TEST_LED/startup.s
+++ /dev/null
@@ -1,233 +0,0 @@
-/***********************************************************************************
-* Copyright 2005 Anglia Design
-* This demo code and associated components are provided as is and has no warranty,
-* implied or otherwise. You are free to use/modify any of the provided
-* code at your own risk in your applications with the expressed limitation
-* of liability (see below)
-*
-* LIMITATION OF LIABILITY: ANGLIA OR ANGLIA DESIGNS SHALL NOT BE LIABLE FOR ANY
-* LOSS OF PROFITS, LOSS OF USE, LOSS OF DATA, INTERRUPTION OF BUSINESS, NOR FOR
-* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND WHETHER UNDER
-* THIS AGREEMENT OR OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-*
-* Author : Spencer Oliver
-* Web : www.anglia-designs.com
-*
-***********************************************************************************/
-
-/**** Startup Code (executed after Reset) ****/
-
-/* Frequency values kHz */
-/* set to suit target hardware */
-
- .equ FOSC, 25000
-
-/* Standard definitions of Mode bits and Interrupt (I & F) flags in PSRs */
-
- .equ Mode_USR, 0x10
- .equ Mode_FIQ, 0x11
- .equ Mode_IRQ, 0x12
- .equ Mode_SVC, 0x13
- .equ Mode_ABT, 0x17
- .equ Mode_UND, 0x1B
- .equ Mode_SYS, 0x1F /* available on ARM Arch 4 and later */
-
- .equ I_Bit, 0x80 /* when I bit is set, IRQ is disabled */
- .equ F_Bit, 0x40 /* when F bit is set, FIQ is disabled */
-
- .equ SRAM32, 0x00
- .equ SRAM64, 0x08
- .equ SRAM96, 0x10
-
-/* --- System memory locations */
-
- .equ SCRO_AHB_UMB, 0x5C002034 /* System configuration register 0 (unbuffered) */
-
- .equ FMI_BASE_UMB, 0x54000000 /* Flash FMI base address (unbuffered) */
- .equ BBSR_off_addr, 0x00
- .equ NBBSR_off_addr, 0x04
- .equ BBADR_off_addr, 0x0C
- .equ NBBADR_off_addr, 0x10
- .equ CR_off_addr, 0x18
-
-.ifndef LIBUFF
- .equ LIBUFF, 0
-.endif
-
-/* Startup Code must be linked first at Address at which it expects to run. */
-
- .text
- .arm
- .section .init, "ax"
-
- .global _start
- .global _Main_Crystal
-
-/* After remap this will be our reset handler */
-
-_start:
- LDR pc, =NextInst
-NextInst:
-
- NOP /* Wait for OSC stabilization */
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
-
-/* Enable buffered mode */
-
-.if LIBUFF
- MRC p15, 0, r0, c1, c0, 0 /* Read CP15 register 1 into r0 */
- ORR r0, r0, #0x8 /* Enable Write Buffer on AHB */
- MCR p15, 0, r0, c1, c0, 0 /* Write CP15 register 1 */
-.endif
-
-/* Remap Flash Bank 0 at address 0x0 and Bank 1 at address 0x80000, */
-/* when the bank 0 is the boot bank, then enable the Bank 1. */
-
- LDR r0, =FMI_BASE_UMB
- LDR r1, =0x4 /* configure 512KB Boot bank 0 */
- STR r1, [r0, #BBSR_off_addr]
-
- LDR r1, =0x2 /* configure 32KB Non Boot bank 1 */
- STR r1, [r0, #NBBSR_off_addr]
-
- LDR r1, =(0x00000000 >> 2) /* Boot Bank Base Address */
- STR r1, [r0, #BBADR_off_addr]
-
- LDR r1, =(0x00080000 >> 2) /* Non Boot Bank Base Address */
- STR r1, [r0, #NBBADR_off_addr]
-
- LDR r1, =0x18 /* Flash Banks 0 1 enabled */
- STR r1, [r0, #CR_off_addr]
-
-/* Enable 96K RAM */
-
- LDR r0, =SCRO_AHB_UMB
-# LDR r1, =0x0196 /* prefetch disabled, default enabled */
- LDR r1, =0x0187|SRAM96
- STR r1, [r0]
-
-/* Set bits 17-18 (Instruction/Data TCM order) of the */
-/* Core Configuration Control Register */
-
- MOV r0, #0x60000
- MCR p15, 0x1, r0, c15, c1, 0
-
-/* Setup Stack for each mode */
-
-/* Enter Abort Mode and set its Stack Pointer */
-
- MSR cpsr_c, #Mode_ABT|I_Bit|F_Bit
- LDR sp, =__stack_abt_end__
-
-/* Enter Undefined Instruction Mode and set its Stack Pointer */
-
- MSR cpsr_c, #Mode_UND|I_Bit|F_Bit
- LDR sp, =__stack_und_end__
-
-/* Enter Supervisor Mode and set its Stack Pointer */
-
- MSR cpsr_c, #Mode_SVC|I_Bit|F_Bit
- LDR sp, =__stack_svc_end__
-
-/* Enter FIQ Mode and set its Stack Pointer */
-
- MSR cpsr_c, #Mode_FIQ|I_Bit|F_Bit
- LDR sp, =__stack_fiq_end__
-
-/* Enter IRQ Mode and set its Stack Pointer */
-
- MSR cpsr_c, #Mode_IRQ|I_Bit|F_Bit
- LDR sp, =__stack_irq_end__
-
-/* Enter System/User Mode and set its Stack Pointer */
-
- MSR cpsr_c, #Mode_SYS
- LDR sp, =__stack_end__
-
-/* Setup a default Stack Limit (when compiled with "-mapcs-stack-check") */
-
- LDR sl, =__bss_end__
-
-/* Relocate .data section (Copy from ROM to RAM) */
-
- LDR r1, =_etext
- LDR r2, =__data_start
- LDR r3, =_edata
-LoopRel:
- CMP r2, r3
- LDRLO r0, [r1], #4
- STRLO r0, [r2], #4
- BLO LoopRel
-
-/* Clear .bss section (Zero init) */
-
- MOV r0, #0
- LDR r1, =__bss_start__
- LDR r2, =__bss_end__
-LoopZI:
- CMP r1, r2
- STRLO r0, [r1], #4
- BLO LoopZI
-
-/* Call C++ constructors */
-
- LDR r0, =__ctors_start__
- LDR r1, =__ctors_end__
-ctor_loop:
- CMP r0, r1
- BEQ ctor_end
- LDR r2, [r0], #4
- STMFD sp!, {r0-r1}
- BLX r2
- LDMFD sp!, {r0-r1}
- B ctor_loop
-ctor_end:
-
-/* Need to set up standard file handles */
-/* Only used under simulator, normally overide syscall.c */
-
-# BL initialise_monitor_handles
-
-/* if we use debug version of str9lib this will call the init function */
-
- BL libdebug
-libdebug:
-
-/* Enter the C code, use B instruction so as to never return */
-/* use BL main if you want to use c++ destructors below */
-
- B main
-
-/* Call destructors */
-
-# LDR r0, =__dtors_start__
-# LDR r1, =__dtors_end__
-#dtor_loop:
-# CMP r0, r1
-# BEQ dtor_end
-# LDR r2, [r0], #4
-# STMFD sp!, {r0-r1}
-# BLX r2
-# LDMFD sp!, {r0-r1}
-# B dtor_loop
-#dtor_end:
-
-/* Return from main, loop forever. */
-
-#exit_loop:
-# B exit_loop
-
-/* Fosc values, used by libstr9 */
-
-_Main_Crystal: .long FOSC
-
- .weak libdebug
-
- .end
diff --git a/uc_str912/prj_TEST_LED/str91x_lib/91x_ahbapb.c b/uc_str912/prj_TEST_LED/str91x_lib/91x_ahbapb.c
deleted file mode 100644
index 41489ac..0000000
--- a/uc_str912/prj_TEST_LED/str91x_lib/91x_ahbapb.c
+++ /dev/null
@@ -1,177 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_ahbapb.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the AHBAPB software functions.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_ahbapb.h"
-
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-#define AHBAPB_SplitCounter_Mask 0xFFE0FFFF
-#define AHBAPB_SetTimeOut_Mask 0xFFFFFFE0
-#define AHBAPB_Address_Mask 0xFEFFFFFF
-#define AHBAPB_FLAG_RW_Mask 0x01000000
-/*******************************************************************************
-* Function Name : AHBAPB_DeInit
-* Description : Deinitializes the AHBAPBx peripheral registers to their default
-* reset values.
-* Input : AHBAPBx: where x can be 0 or 1 to select the AHBAPB peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void AHBAPB_DeInit(AHBAPB_TypeDef* AHBAPBx)
-{
- AHBAPBx->BCR = 0x00000000;
- AHBAPBx->BSR = 0x00000000;
-}
-/*******************************************************************************
-* Function Name : AHBAPB_Init
-* Description : Initializes the AHBAPBx peripheral according to the specified
-* parameters in the AHBAPB_InitStruct .
-* Input :- AHBAPBx: where x can be 0 or 1 to select the AHBAPB peripheral.
-* - AHBAPB_InitStruct: pointer to a AHBAPB_InitTypeDef structure that
-* contains the configuration information for the specified AHBAPB
-* peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void AHBAPB_Init(AHBAPB_TypeDef* AHBAPBx, AHBAPB_InitTypeDef* AHBAPB_InitStruct)
-{
-
- if(AHBAPB_InitStruct->AHBAPB_Split == AHBAPB_Split_Enable)
- {
- /* Set SPLITEN bit;*/
- AHBAPBx->BCR |= AHBAPB_Split_Enable;
- /*Split_CNT bits[20:16]*/
- AHBAPBx->BCR &= AHBAPB_SplitCounter_Mask;
- AHBAPBx->BCR |= (AHBAPB_InitStruct->AHBAPB_SplitCounter)<<16;
- }
- else
- {
- /*/ Clear SPLITEN bit;*/
- AHBAPBx->BCR &= AHBAPB_Split_Disable;
- }
- /*APB Time out*/
- if(AHBAPB_InitStruct->AHBAPB_Error == AHBAPB_Error_Enable)
- {
- /* Set ERREN bit*/
- AHBAPBx->BCR |= AHBAPB_Error_Enable;
- /*Time ouit counter*/
- AHBAPBx->BCR &= AHBAPB_SetTimeOut_Mask;
- AHBAPBx->BCR |= AHBAPB_InitStruct->AHBAPB_SetTimeOut;
- }
- else
- {
- /* Clear ERREN bit*/
- AHBAPBx->BCR &= AHBAPB_Error_Disable;
- }
-}
-
-/*******************************************************************************
-* Function Name : AHBAPB_StructInit
-* Description : Initialize the AHBAPB Init Structure parameters
-* Input : AHBAPB_InitStruct : pointer to a AHBAPB_InitTypeDef structure
-* which will be initialized.
-* Output : None
-* Return : None
-*******************************************************************************/
-void AHBAPB_StructInit(AHBAPB_InitTypeDef* AHBAPB_InitStruct)
-{
- /* Reset AHBAPB init structure parameters values */
- AHBAPB_InitStruct->AHBAPB_Split = AHBAPB_Split_Enable;
- AHBAPB_InitStruct->AHBAPB_SplitCounter = 0xFF;
- AHBAPB_InitStruct->AHBAPB_Error = AHBAPB_Error_Enable;
- AHBAPB_InitStruct->AHBAPB_SetTimeOut = 0xFF;
-
-}
-
-/*******************************************************************************
-* Function Name : AHBAPB_GetFlagStatus
-* Description : Checks whether the specified AHBAPB flag is set or not.
-* Input : - AHBAPB: where x can be 0 or 1 to select the AHBAPB peripheral
-* - AHBAPB_FLAG: specifies the flag to check.
-* This parameter can be one of the following values:
-* - AHBAPB_FLAG_ERROR: error flag
-* - AHBAPB_FLAG_OUTM : Out of Memory flag
-* - AHBAPB_FLAG_APBT : APB Time-out flag
-* - AHBAPB_FLAG_RW : Access type flag
-* Output : None
-* Return : The new state of AHBAPB_FLAG (SET or RESET).
-*******************************************************************************/
-FlagStatus AHBAPB_GetFlagStatus(AHBAPB_TypeDef* AHBAPBx, u8 AHBAPB_FLAG)
-{
- if(AHBAPB_FLAG == AHBAPB_FLAG_RW)
- {
- if ((AHBAPBx->PAER & AHBAPB_FLAG_RW_Mask) == RESET)
- {
- return RESET;
- }
- else
- {
- return SET;
- }
- }
- else
- {
- if ((AHBAPBx->BSR & AHBAPB_FLAG) == RESET)
- {
- return RESET;
- }
- else
- {
- return SET;
- }
- }
-}
-/*******************************************************************************
-* Function Name : AHBAPB_ClearFlag
-* Description : Clears the AHBAPBx flags.
-* Input : - AHBAPB: where x can be 0 or 1 to select the AHBAPB peripheral
-* - AHBAPB_FLAG: flags to clear. This parameter one of the
-* following values:
-* - AHBAPB_FLAG_ERROR: error flag
-* - AHBAPB_FLAG_OUTM : Out of Memory flag
-* - AHBAPB_FLAG_APBT : APB Time-out flag
-* Output : None
-* Return : None
-*******************************************************************************/
-void AHBAPB_ClearFlag(AHBAPB_TypeDef* AHBAPBx, u8 AHBAPB_FLAG)
-{
- /* Clear the flag */
- AHBAPBx->BSR &= AHBAPB_FLAG;
-}
-/*******************************************************************************
-* Function Name : AHBAPB_GetPeriphAddrError
-* Description : Gets the AHBAPB error address peripherals.
-* Input : - AHBAPB: where x can be 0 or 1 to select the AHBAPB peripheral
-* Output : None
-* Return : The Peropheral address error
-*******************************************************************************/
-u32 AHBAPB_GetPeriphAddrError(AHBAPB_TypeDef* AHBAPBx)
-{
- u32 AHBAPB_Address = 0x00000000;
-
- /*Return Oeripheral address without RW bit*/
- AHBAPB_Address = (AHBAPBx->PAER)& AHBAPB_Address_Mask;
- return (AHBAPB_Address);
-}
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_TEST_LED/str91x_lib/91x_fmi.c b/uc_str912/prj_TEST_LED/str91x_lib/91x_fmi.c
deleted file mode 100644
index fb558ad..0000000
--- a/uc_str912/prj_TEST_LED/str91x_lib/91x_fmi.c
+++ /dev/null
@@ -1,519 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_fmi.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the FMI software functions.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-
-/* Standard include ----------------------------------------------------------*/
-#include "91x_fmi.h"
-
-/* Include of other module interface headers ---------------------------------*/
-/* Local includes ------------------------------------------------------------*/
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-
-#define TIMEOUT 0xFFFFFF /* Timeout value */
-
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/* Interface functions -------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-
-
-/*******************************************************************************
-* Function Name : FMI_BankRemapConfig
-* Description : Configure the addresses and sizes of bank 0 and bank 1.
-* Input1 : FMI_BootBankSize: specifies the boot bank size.
-* This parameter can be one of the following values:
-* - 0x0: 32KBytes.
-* - 0x1: 64KBytes.
-* - 0x2: 128KBytes.
-* - 0x3: 256KBytes.
-* - 0x4: 512KBytes.
-* ....
-* - 0xB: 64MBytes.
-* Input2 : FMI_NonBootBankSize: specifies the non boot bank size.
-* This parameter can be one of the following values:
-* - 0x0: 8KBytes.
-* - 0x1: 16KBytes.
-* - 0x2: 32KBytes.
-* - 0x3: 64KBytes.
-* ....
-* - 0xD: 64MBytes.
-* Input3 : FMI_BootBankAddress: specifies the address of the boot bank.
-* Input4 : FMI_NonBootBankAddress: specifies the address of the non
-* boot bank.
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_BankRemapConfig(u8 FMI_BootBankSize, u8 FMI_NonBootBankSize, \
- u32 FMI_BootBankAddress, u32 FMI_NonBootBankAddress)
-{
- FMI->BBSR = FMI_BootBankSize;
- FMI->NBBSR = FMI_NonBootBankSize;
- FMI->BBADR = (FMI_BootBankAddress >> 2);
- FMI->NBBADR = (FMI_NonBootBankAddress >> 2);
- FMI->CR |= 0x18; /* Enable bank 1 */
-}
-
-/*******************************************************************************
-* Function Name : FMI_Config
-* Description : Configure the FMI.
-* Input1 : FMI_ReadWaitState: specifies the needed read wait states.
-* This parameter can be one of the following values:
-* - FMI_READ_WAIT_STATE_1: One read wait state.
-* - FMI_READ_WAIT_STATE_2: Two read wait states.
-* - FMI_READ_WAIT_STATE_3: Three read wait states.
-* Input2 : FMI_WriteWaitState: specifies the needed write wait states.
-* This parameter can be one of the following values:
-* - FMI_WRITE_WAIT_STATE_1: One write wait state.
-* - FMI_WRITE_WAIT_STATE_2: Two write wait states.
-* Input3 : FMI_PWD: specifies the power down mode status.
-* This parameter can be one of the following values:
-* - FMI_PWD_ENABLE: Enable the PWD.
-* - FMI_PWD_DISABLE: Disable the PWD.
-* Input4 : FMI_LVDEN: specifies the low voltage detector status.
-* This parameter can be one of the following values:
-* - FMI_LVD_ENABLE: Enable the LVD.
-* - FMI_LVD_DISABLE: Disable the LVD.
-* Input5 : FMI_FreqRange: specifies the working frequency range.
-* This parameter can be one of the following values:
-* - FMI_FREQ_LOW: Low working frequency (up to 66MHz).
-* - FMI_FREQ_HIGH: High working frequency (above 66MHz) .
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_Config(u16 FMI_ReadWaitState, u32 FMI_WriteWaitState, u16 FMI_PWD,\
- u16 FMI_LVDEN, u16 FMI_FreqRange)
-{
- /* Configure the write wait state value */
- if (FMI_WriteWaitState == FMI_WRITE_WAIT_STATE_1)
- {
- FMI->CR |= FMI_WRITE_WAIT_STATE_1;
- }
- else
- {
- FMI->CR &= FMI_WRITE_WAIT_STATE_0;
- }
-
- /* Write a write flash configuration register command */
- *(vu16 *)FMI_BANK_1 = 0x60;
-
- /* Configure the flash configuration register */
- *(vu16 *)(FMI_BANK_1|FMI_ReadWaitState|FMI_PWD|FMI_LVDEN|FMI_FreqRange) = 0x03;
-}
-
-/*******************************************************************************
-* Function Name : FMI_EraseSector
-* Description : Erase the needed sector.
-* Input : FMI_Sector: specifies the sector to be erased.
-* This parameter can be one of the following values:
-* - FMI_B0S0: FMI bank 0 sector 0.
-* - FMI_B0S1: FMI bank 0 sector 1.
-* - FMI_B0S2: FMI bank 0 sector 2.
-* - FMI_B0S3: FMI bank 0 sector 3.
-* - FMI_B0S4: FMI bank 0 sector 4.
-* - FMI_B0S5: FMI bank 0 sector 5.
-* - FMI_B0S6: FMI bank 0 sector 6.
-* - FMI_B0S7: FMI bank 0 sector 7.
-* - FMI_B1S0: FMI bank 1 sector 0.
-* - FMI_B1S1: FMI bank 1 sector 1.
-* - FMI_B1S2: FMI bank 1 sector 2.
-* - FMI_B1S3: FMI bank 1 sector 3.
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_EraseSector(vu32 FMI_Sector)
-{
- /* Write an erase set-up command to the sector */
- *(vu16 *)FMI_Sector = 0x20;
-
- /* Write an erase confirm command to the sector */
- *(vu16 *)FMI_Sector = 0xD0;
-}
-
-/*******************************************************************************
-* Function Name : FMI_EraseBank
-* Description : Erase the needed bank.
-* Input : FMI_Bank: specifies the bank to be erased.
-* This parameter can be one of the following values:
-* - FMI_BANK_0: FMI bank 0.
-* - FMI_BANK_1: FMI bank 1.
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_EraseBank(vu32 FMI_Bank)
-{
- /* Write a bank erase set-up command to the bank */
- *(vu16 *)FMI_Bank = 0x80;
-
- /* Write an erase confirm command to the sector */
- *(vu16 *)FMI_Bank = 0xD0;
-}
-
-/*******************************************************************************
-* Function Name : FMI_WriteHalfWord
-* Description : Write a halfword to the needed Flash memory address.
-* Input 1 : FMI_Address: specifies the address offset where the data will
-* be written.
-* Input 2 : FMI_Data: the needed data.
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_WriteHalfWord(u32 FMI_Address, u16 FMI_Data)
-{
- /* Write a program command to the sector to be written */
- *(vu16 *)(FMI_Address & 0xFFFFFFFC) = 0x40;
-
- /* Write the halfword to the destination address */
- *(vu16 *)FMI_Address = FMI_Data;
-}
-
-/*******************************************************************************
-* Function Name : FMI_WriteOTPHalfWord
-* Description : Write a halfword to the needed OTP sector address.
-* Input 1 : FMI_OTPHWAddress: specifies the halfword address offset
-* where the data will be written.
-* This parameter can be one of the following values:
-* - FMI_OTP_LOW_HALFWORD_0: OTP Low halfword 0.
-* - FMI_OTP_HIGH_HALFWORD_0: OTP High halfword 0.
-* - FMI_OTP_LOW_HALFWORD_1: OTP Low halfword 1.
-* - FMI_OTP_HIGH_HALFWORD_1: OTP High halfword 1.
-* - FMI_OTP_LOW_HALFWORD_2: OTP Low halfword 2.
-* - FMI_OTP_HIGH_HALFWORD_2: OTP High halfword 2.
-* - FMI_OTP_LOW_HALFWORD_3: OTP Low halfword 3.
-* - FMI_OTP_HIGH_HALFWORD_3: OTP High halfword 3.
-* - FMI_OTP_LOW_HALFWORD_4: OTP Low halfword 4.
-* - FMI_OTP_HIGH_HALFWORD_4: OTP High halfword 4.
-* - FMI_OTP_LOW_HALFWORD_5: OTP Low halfword 5.
-* - FMI_OTP_HIGH_HALFWORD_5: OTP High halfword 5.
-* - FMI_OTP_LOW_HALFWORD_6: OTP Low halfword 6.
-* - FMI_OTP_HIGH_HALFWORD_6: OTP High halfword 6.
-* - FMI_OTP_LOW_HALFWORD_7: OTP Low halfword 7.
-* - FMI_OTP_HIGH_HALFWORD_7: OTP High halfword 7.
-* Input 2 : FMI_OTPData: The needed OTP data.
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_WriteOTPHalfWord(u8 FMI_OTPHWAddress, u16 FMI_OTPData)
-{
- /* Write a write OTP command to the needed address */
- *(vu16 *)(FMI_BANK_1) = 0xC0;
-
- /* Write the halfword to the destination address */
- *(vu16 *)(FMI_BANK_1 + FMI_OTPHWAddress) = FMI_OTPData;
-}
-
-/*******************************************************************************
-* Function Name : FMI_ReadWord
-* Description : Read the correspondent data.
-* Input : FMI_Address: specifies the needed address.
-* Output : None
-* Return : The data contained in the specified address.
-*******************************************************************************/
-u32 FMI_ReadWord(u32 FMI_Address)
-{
- return(*(u32*)FMI_Address);
-}
-
-/*******************************************************************************
-* Function Name : FMI_ReadOTPData
-* Description : Read data from the OTP sector.
-* Input : FMI_OTPAddress: specifies the address of the data to be read.
-* This parameter can be one of the following values:
-* - FMI_OTP_WORD_0: FMI bank 0 sector 0.
-* - FMI_OTP_WORD_1: FMI bank 0 sector 1.
-* - FMI_OTP_WORD_2: FMI bank 0 sector 2.
-* - FMI_OTP_WORD_3: FMI bank 0 sector 3.
-* - FMI_OTP_WORD_4: FMI bank 0 sector 4.
-* - FMI_OTP_WORD_5: FMI bank 0 sector 5.
-* - FMI_OTP_WORD_6: FMI bank 0 sector 6.
-* - FMI_OTP_WORD_7: FMI bank 0 sector 7.
-* Output : None
-* Return : The needed OTP words.
-*******************************************************************************/
-u32 FMI_ReadOTPData(u8 FMI_OTPAddress)
-{
- u32 OTP_Data = 0x0;
- /* write a read OTP sector command */
- *(vu16 *)(FMI_BANK_1) = 0x98;
-
- /* Read the correspondent data */
- OTP_Data = (*(vu32*)(FMI_BANK_1 + FMI_OTPAddress));
-
- /* Write a read array command */
- *(vu16 *)(FMI_BANK_1) = 0xFF;
-
- return OTP_Data;
-}
-
-/*******************************************************************************
-* Function Name : FMI_GetFlagStatus
-* Description : Check whether the specified FMI flag is set or not.
-* Input1 : FMI_Flag: flag to check.
-* This parameter can be one of the following values:
-* - FMI_FLAG_SPS: Sector Protection Status Flag.
-* - FMI_FLAG_PSS: Program Suspend Status Flag.
-* - FMI_FLAG_PS: Program Status Flag.
-* - FMI_FLAG_ES: Erase Status Flag.
-* - FMI_FLAG_ESS: Erase Suspend Status Flag.
-* - FMI_FLAG_PECS: FPEC Status Flag.
-* Input2 : FMI_Bank: specifies the needed bank.
-* This parameter can be one of the following values:
-* - FMI_BANK_0: FMI bank 0.
-* - FMI_BANK_1: FMI bank 1.
-* Output : None
-* Return : None
-*******************************************************************************/
-FlagStatus FMI_GetFlagStatus(u8 FMI_Flag, vu32 FMI_Bank)
-{
- u16 FMI_Status_Register = 0;
-
- /* Write a read status register command */
- *(vu16 *)FMI_Bank = 0x70;
-
- /* Wait until operation completion */
- while(!((*(vu16 *)FMI_Bank) & 0x80));
-
- /* Read the status register */
- FMI_Status_Register = *(vu16 *)FMI_Bank;
-
- /* Write a read array command */
- *(vu16 *)FMI_Bank = 0xFF;
-
- if((FMI_Status_Register & FMI_Flag) != RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : FMI_GetReadWaitStateValue
-* Description : Get the current Read wait state value.
-* Input : None
-* Output : None
-* Return : The current read wait states value.
-*******************************************************************************/
-u16 FMI_GetReadWaitStateValue(void)
-{
- u16 FMI_Configuration_Register = 0;
- /* Write a read flash configuration register command */
- *(vu16 *)FMI_BANK_1 = 0x90;
-
- /* Read the flash configuration register */
- FMI_Configuration_Register = *(vu16 *)(FMI_BANK_1 + 0x14);
-
- /* Write a read array command */
- *(vu16 *)FMI_BANK_1 = 0xFF;
-
- FMI_Configuration_Register = ((FMI_Configuration_Register>>11) + 1) & 0x3;
-
- /* Return the wait states value */
- return FMI_Configuration_Register;
-}
-
-/*******************************************************************************
-* Function Name : FMI_GetWriteWaitStateValue
-* Description : Get the current write wait state value.
-* Input : None
-* Output : None
-* Return : The current write wait states value.
-*******************************************************************************/
-u16 FMI_GetWriteWaitStateValue(void)
-{
- return ((u16)((FMI->CR & 0x100) >> 8));
-}
-
-/*******************************************************************************
-* Function Name : FMI_SuspendEnable
-* Description : Suspend command enable.
-* Input : FMI_Bank: specifies the bank to be suspended.
-* This parameter can be one of the following values:
-* - FMI_BANK_0: FMI bank 0.
-* - FMI_BANK_1: FMI bank 1.
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_SuspendEnable(vu32 FMI_Bank)
-{
- /* Write a suspend command to the bank */
- *(vu16 *)FMI_Bank = 0xB0;
-}
-
-/*******************************************************************************
-* Function Name : FMI_ResumeEnable
-* Description : Resume the suspended command.
-* Input : FMI_Bank: specifies the suspended bank.
-* This parameter can be one of the following values:
-* - FMI_BANK_0: FMI bank 0.
-* - FMI_BANK_1: FMI bank 1.
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_ResumeEnable(vu32 FMI_Bank)
-{
- /* Write a resume command to the bank */
- *(vu16 *)FMI_Bank = 0xD0;
-}
-
-/*******************************************************************************
-* Function Name : FMI_ClearFlag
-* Description : Clear the FMI Flags on the correspondent bank.
-* Input : FMI_Bank: specifies the needed bank.
-* This parameter can be one of the following values:
-* - FMI_BANK_0: FMI bank 0.
-* - FMI_BANK_1: FMI bank 1.
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_ClearFlag(vu32 FMI_Bank)
-{
- /* Write a clear status register command */
- *(vu16 *)FMI_Bank = 0x50;
-}
-
-/*******************************************************************************
-* Function Name : FMI_WriteProtectionCmd
-* Description : Enable or disable the write protection for the needed sector.
-* Input1 : FMI_Sector: specifies the sector to be protected or
-* unprotected.
-* This parameter can be one of the following values:
-* - FMI_B0S0: FMI bank 0 sector 0.
-* - FMI_B0S1: FMI bank 0 sector 1.
-* - FMI_B0S2: FMI bank 0 sector 2.
-* - FMI_B0S3: FMI bank 0 sector 3.
-* - FMI_B0S4: FMI bank 0 sector 4.
-* - FMI_B0S5: FMI bank 0 sector 5.
-* - FMI_B0S6: FMI bank 0 sector 6.
-* - FMI_B0S7: FMI bank 0 sector 7.
-* - FMI_B1S0: FMI bank 1 sector 0.
-* - FMI_B1S1: FMI bank 1 sector 1.
-* - FMI_B1S2: FMI bank 1 sector 2.
-* - FMI_B1S3: FMI bank 1 sector 3.
-* Input2 : FMI_NewState: specifies the protection status.
-* This parameter can be one of the following values:
-* - ENABLE: Enable the protection.
-* - DISABLE: Disable the protection.
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_WriteProtectionCmd(vu32 FMI_Sector, FunctionalState FMI_NewState)
-{
- if (FMI_NewState == ENABLE)
- {
- *(vu16*)FMI_Sector = 0x60;
- *(vu16*)FMI_Sector = 0x01;
- *(vu16*)FMI_Sector = 0xFF;
- }
- else /* DISABLE */
- {
- *(vu16*)FMI_Sector = 0x60;
- *(vu16*)FMI_Sector = 0xD0;
- *(vu16*)FMI_Sector = 0xFF;
- }
-}
-
-/*******************************************************************************
-* Function Name : FMI_GetWriteProtectionStatus
-* Description : Get the write protection status for the needed sector.
-* Input : FMI_Sector_Mask: specifies the needed sector mask.
-* This parameter can be one of the following values:
-* - FMI_B0S0_MASK: FMI bank 0 sector 0.
-* - FMI_B0S1_MASK: FMI bank 0 sector 1.
-* - FMI_B0S2_MASK: FMI bank 0 sector 2.
-* - FMI_B0S3_MASK: FMI bank 0 sector 3.
-* - FMI_B0S4_MASK: FMI bank 0 sector 4.
-* - FMI_B0S5_MASK: FMI bank 0 sector 5.
-* - FMI_B0S6_MASK: FMI bank 0 sector 6.
-* - FMI_B0S7_MASK: FMI bank 0 sector 7.
-* - FMI_B1S0_MASK: FMI bank 1 sector 0.
-* - FMI_B1S1_MASK: FMI bank 1 sector 1.
-* - FMI_B1S2_MASK: FMI bank 1 sector 2.
-* - FMI_B1S3_MASK: FMI bank 1 sector 3.
-* Output : None
-* Return : The Protection Status of the needed sector.
-* - RESET: The needed sector is not write protected.
-* - SET : The needed sector is write protected.
-*******************************************************************************/
-FlagStatus FMI_GetWriteProtectionStatus(u32 FMI_Sector_Mask)
-{
- u16 Protection_Level_1_Register = 0;
- /* Write a read flash protection level 1 register command */
- *(vu16 *)FMI_BANK_1 = 0x90;
-
- /* Read the flash protection level 1 register */
- Protection_Level_1_Register = *(vu16 *)(FMI_BANK_1 + 0x10);
-
- /* Write a read array command */
- *(vu16 *)FMI_BANK_1 = 0xFF;
-
- if (Protection_Level_1_Register &= FMI_Sector_Mask)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : FMI_WaitForLastOperation
-* Description : Wait until the last operation (Write halfword, Write OTP
-* halfword, Erase sector and Erase bank) completion.
-* Input : FMI_Bank: specifies the bank where the operation is on going.
-* This parameter can be one of the following values:
-* - FMI_BANK_0: FMI bank 0.
-* - FMI_BANK_1: FMI bank 1.
-* Output : None
-* Return : The timeout status.
-* This parameter can be one of the following values:
-* - FMI_TIME_OUT_ERROR: Timeout error occurred.
-* - FMI_NO_TIME_OUT_ERROR: No timeout error.
-*******************************************************************************/
-u8 FMI_WaitForLastOperation(vu32 FMI_Bank)
-{
- u32 Time_Out = 0;
-
- /* Write a read status register command */
- *(vu16 *)(FMI_Bank) = 0x70;
-
- /* Wait until operation compeletion */
- while((!((*(vu16 *)FMI_Bank) & 0x80))&&(Time_Out < TIMEOUT ))
- {
- Time_Out ++; /* Time Out */
- }
-
- /* Write a read array command */
- *(vu16 *)FMI_Bank = 0xFF;
-
- if (Time_Out == TIMEOUT)
- {
- return FMI_TIME_OUT_ERROR;
- }
- else
- {
- return FMI_NO_TIME_OUT_ERROR;
- }
-}
-
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_TEST_LED/str91x_lib/91x_gpio.c b/uc_str912/prj_TEST_LED/str91x_lib/91x_gpio.c
deleted file mode 100644
index f2d0941..0000000
--- a/uc_str912/prj_TEST_LED/str91x_lib/91x_gpio.c
+++ /dev/null
@@ -1,407 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_gpio.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the GPIO software functions.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_gpio.h"
-#include "91x_scu.h"
-
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
- static u8 GPIO_GetGPIONumber(GPIO_TypeDef* GPIOx);
-
-/* Private functions ---------------------------------------------------------*/
-
-/*******************************************************************************
-* Function Name : GPIO_DeInit
-* Description : Deinitializes the GPIOx peripheral registers to their default
-* reset values.
-* Input : GPIOx: where x can be (0..9) to select the GPIO peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void GPIO_DeInit(GPIO_TypeDef* GPIOx)
-{
-
- /* Reset the GPIO registers values */
- if(GPIOx == GPIO0)
- {
- SCU_APBPeriphReset(__GPIO0,ENABLE);
- SCU_APBPeriphReset(__GPIO0,DISABLE);
- SCU->GPIOTYPE[0x00] = 0x0000 ;
- SCU->GPIOOUT[0x00] = 0x0000;
- SCU->GPIOIN[0x00] = 0x0000;
- }
-
- if(GPIOx == GPIO1)
- {
- SCU_APBPeriphReset(__GPIO1,ENABLE);
- SCU_APBPeriphReset(__GPIO1,DISABLE);
- SCU->GPIOTYPE[0x01] = 0x0000 ;
- SCU->GPIOOUT[0x01] = 0x0000;
- SCU->GPIOIN[0x01] = 0x0000;
- }
-
- if(GPIOx == GPIO2)
- {
- SCU_APBPeriphReset(__GPIO2,ENABLE);
- SCU_APBPeriphReset(__GPIO2,DISABLE);
- SCU->GPIOTYPE[0x02] = 0x0000 ;
- SCU->GPIOOUT[0x02] = 0x0000;
- SCU->GPIOIN[0x02] = 0x0000;
- }
-
- if(GPIOx == GPIO3)
- {
- SCU_APBPeriphReset(__GPIO3,ENABLE);
- SCU_APBPeriphReset(__GPIO3,DISABLE);
- SCU->GPIOTYPE[0x03] = 0x0000 ;
- SCU->GPIOOUT[0x03] = 0x0000;
- SCU->GPIOIN[0x03] = 0x0000;
- }
-
- if(GPIOx == GPIO4)
- {
- SCU_APBPeriphReset(__GPIO4,ENABLE);
- SCU_APBPeriphReset(__GPIO4,DISABLE);
- SCU->GPIOTYPE[0x04] = 0x0000 ;
- SCU->GPIOOUT[0x04] = 0x0000;
- SCU->GPIOIN[0x04] = 0x0000;
- SCU->GPIOANA = 0x00;
- }
-
- if(GPIOx == GPIO5)
- {
- SCU_APBPeriphReset(__GPIO5,ENABLE);
- SCU_APBPeriphReset(__GPIO5,DISABLE);
- SCU->GPIOTYPE[0x05] = 0x0000 ;
- SCU->GPIOOUT[0x05] = 0x0000;
- SCU->GPIOIN[0x05] = 0x0000;
- }
-
- if(GPIOx == GPIO6)
- {
- SCU_APBPeriphReset(__GPIO6,ENABLE);
- SCU_APBPeriphReset(__GPIO6,DISABLE);
- SCU->GPIOTYPE[0x06] = 0x0000 ;
- SCU->GPIOOUT[0x06] = 0x0000;
- SCU->GPIOIN[0x06] = 0x0000;
- }
-
- if(GPIOx == GPIO7)
- {
- SCU_APBPeriphReset(__GPIO7,ENABLE);
- SCU_APBPeriphReset(__GPIO7,DISABLE);
- SCU->GPIOOUT[0x07] = 0xAAAA;
- SCU->GPIOOUT[0x07] = 0x0000;
- SCU->GPIOIN[0x07] = 0x0000;
- }
-
- if(GPIOx == GPIO8)
- {
- SCU_APBPeriphReset(__GPIO8,ENABLE);
- SCU_APBPeriphReset(__GPIO8,DISABLE);
- SCU->GPIOEMI = 0x00;
- }
-
- if(GPIOx == GPIO9)
- {
- SCU_APBPeriphReset(__GPIO9,ENABLE);
- SCU_APBPeriphReset(__GPIO9,DISABLE);
- SCU->GPIOEMI = 0x00;
- }
-}
-/*******************************************************************************
-* Function Name : GPIO_Init
-* Description : Initializes the GPIOx peripheral according to the specified
-* parameters in the GPIO_InitStruct .
-* Input :- GPIOx: where x can be (0..9) to select the GPIO peripheral.
-* - GPIO_InitStruct: pointer to a GPIO_InitTypeDef structure that
-* contains the configuration information for the specified GPIO
-* peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct)
-{
- /* Select pin direction */
- u8 PinNumber = 0;
- u8 Counter = 0;
- u8 GPIO_Number = 0;
-
- GPIO_Number = GPIO_GetGPIONumber(GPIOx);
-
-
- if(GPIO_InitStruct->GPIO_Direction == GPIO_PinOutput)
- {
- GPIOx->DDR |= GPIO_InitStruct->GPIO_Pin;
- }
- else
- {
- GPIOx->DDR &= ~GPIO_InitStruct->GPIO_Pin;
- }
-
- for (Counter = 0; Counter < 8;Counter++)
- {
- /*Search pin number*/
- PinNumber = (GPIO_InitStruct->GPIO_Pin & (1 <<Counter));
- if((PinNumber >> Counter) == 1)
- {
- /*Output ALternate 0*/
- SCU->GPIOOUT[GPIO_Number] &= ~(0x3 <<(Counter *2));
- if(GPIO_InitStruct->GPIO_Alternate == GPIO_OutputAlt1)
- {
- /*Output ALternate 1*/
- SCU->GPIOOUT[GPIO_Number] |= 1 << (Counter *2);
- }
- if(GPIO_InitStruct->GPIO_Alternate == GPIO_OutputAlt2)
- {
- /*Output ALternate 2*/
- SCU->GPIOOUT[GPIO_Number] |= 0x2 << (Counter *2);
- }
- if(GPIO_InitStruct->GPIO_Alternate == GPIO_OutputAlt3)
- {
- /*Output ALternate 3*/
- SCU->GPIOOUT[GPIO_Number] |= 0x3 << (Counter *2);
- }
-
- /*Type configuration: PushPull or Open Collector*/
- SCU->GPIOTYPE[GPIO_Number] &= ~(0x1 << Counter) ;
- if(GPIO_InitStruct->GPIO_Type == GPIO_Type_OpenCollector)
- {
- /*Open Drain configuration*/
- SCU->GPIOTYPE[GPIO_Number] |= 0x1 << Counter;
- }
-
- /*IP Connected disable*/
- SCU->GPIOIN[GPIO_Number] &= ~(0x1 << Counter) ;
- if(GPIO_InitStruct->GPIO_IPConnected == GPIO_IPConnected_Enable)
- {
- /*IP Connected enable*/
- SCU->GPIOIN[GPIO_Number] |= 0x1 << Counter;
- }
- }
- }
-}
-
-/*******************************************************************************
-* Function Name : GPIO_StructInit
-* Description : Initialize the GPIO Init Structure parameters
-* Input : GPIO_InitStruct : pointer to a GPIO_InitTypeDef structure
-* which will be initialized.
-* Output : None
-* Return : None
-*******************************************************************************/
-void GPIO_StructInit(GPIO_InitTypeDef* GPIO_InitStruct)
-{
- /* Reset GPIO init structure parameters values */
- GPIO_InitStruct->GPIO_Pin = GPIO_Pin_All;
- GPIO_InitStruct->GPIO_Direction = GPIO_PinInput;
- GPIO_InitStruct->GPIO_Type = GPIO_Type_PushPull;
- GPIO_InitStruct->GPIO_IPConnected = GPIO_IPConnected_Disable;
- GPIO_InitStruct->GPIO_Alternate = GPIO_InputAlt1;
-}
-
-/*******************************************************************************
-* Function Name : GPIO_ReadBit
-* Description : Reads the specified port pin
-* Input : - GPIOx: where x can be (0..9) to select the GPIO peripheral.
-* : - GPIO_Pin: the Pin number. This parameter can be GPIO_Pin_x
-* where x can be (0..7).
-* Output : None
-* Return : The port pin value
-*******************************************************************************/
-u8 GPIO_ReadBit(GPIO_TypeDef* GPIOx, u8 GPIO_Pin)
-{
- if ((((GPIOx->DR[GPIO_Pin<<2])) & GPIO_Pin) != Bit_RESET )
- {
- return Bit_SET;
- }
- else
- {
- return Bit_RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : GPIO_Read
-* Description : Reads the specified GPIO data port
-* Input : - GPIOx: where x can be (0..9) to select the GPIO peripheral.
-* Output : None
-* Return : GPIO data port word value.
-*******************************************************************************/
-u8 GPIO_Read(GPIO_TypeDef* GPIOx)
-{
- return (GPIOx->DR[0x3FC]);
-}
-
-/*******************************************************************************
-* Function Name : GPIO_WriteBit
-* Description : Sets or clears the selected data port bit.
-* Input : - GPIOx: where x can be (0..9) to select the GPIO peripheral.
-* - GPIO_Pin: the Pin number. This parameter can be GPIO_Pin_x
-* where x can be (0..7).
-* - BitVal: this parameter specifies the value to be written
-* to the selected bit.
-* BitVal must be one of the BitAction enum values:
-* - Bit_RESET: to clear the port pin
-* - Bit_SET: to set the port pin
-* Output : None
-* Return : None
-*******************************************************************************/
-void GPIO_WriteBit(GPIO_TypeDef* GPIOx, u8 GPIO_Pin, BitAction BitVal)
-{
- if(BitVal == Bit_SET)
- {
- GPIOx->DR[GPIO_Pin <<2] = GPIO_Pin;
- }
- else
- {
- GPIOx->DR[GPIO_Pin <<2] = 0x00;
- }
-}
-
-/*******************************************************************************
-* Function Name : GPIO_Write
-* Description : Writes the passed value in the selected data GPIOx port
-* register.
-* Input :- GPIOx: where x can be (0..9) to select the GPIO peripheral.
-* - PortVal: the value to be written to the data port register.
-* Output : None
-* Return : None
-*******************************************************************************/
-void GPIO_Write(GPIO_TypeDef* GPIOx, u8 PortVal)
-{
- GPIOx->DR[0x3FC] = PortVal;
-}
-
-/*******************************************************************************
-* Function Name : GPIO_EMIConfig
-* Description : Enables or disables GPIO 8 and 9 in EMI mode.
-* Input : - NewState: new state of the EMI.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void GPIO_EMIConfig(FunctionalState NewState)
-{
- if(NewState == ENABLE)
- {
- SCU->GPIOEMI = 0x01;
- }
- else
- {
- SCU->GPIOEMI = 0x00;
- }
-}
-
-/*******************************************************************************
-* Function Name : GPIO_ANAPinConfig
-* Description : Enables or disables pins from GPIO 4 in Analogue mode.
-* Input :- GPIO_ANAChannel: selects the ADC channel pin.
-* This parameter can be one of the following values:
-* GPIO_ANAChannel0
-* GPIO_ANAChannel1
-* GPIO_ANAChannel2
-* GPIO_ANAChannel3
-* GPIO_ANAChannel4
-* GPIO_ANAChannel5
-* GPIO_ANAChannel6
-* GPIO_ANAChannel7
-* GPIO_ANAChannelALL
-* - NewState: new state of the port pin.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void GPIO_ANAPinConfig(u8 GPIO_ANAChannel, FunctionalState NewState)
-{
-
- if(NewState == ENABLE)
- {
- if(GPIO_ANAChannel == GPIO_ANAChannelALL)
- {
- SCU->GPIOOUT[4] = 0x0000;
- SCU->GPIOIN[4] = 0x00;
- }
- else
- {
- SCU->GPIOOUT[4] &= ~(0x3<<(GPIO_ANAChannel-1));
- SCU->GPIOIN[4] &= ~GPIO_ANAChannel;
- }
- SCU->GPIOANA |= GPIO_ANAChannel;
-
- }
- else
- {
- SCU->GPIOANA &= ~GPIO_ANAChannel;
- }
-}
-
-/*******************************************************************************
-* Function Name : GPIO_GetGPIONumber
-* Description : searche the GPIO number.
-* Input : GPIOx: where x can be (0..9) to select the GPIO peripheral.
-* Output : None
-* Return : GPIO number
-*******************************************************************************/
-u8 GPIO_GetGPIONumber(GPIO_TypeDef* GPIOx)
-{
-
- if(GPIOx == GPIO1)
- {
- return 1;
- }
- if(GPIOx == GPIO2)
- {
- return 2;
- }
- if(GPIOx == GPIO3)
- {
- return 3;
- }
- if(GPIOx == GPIO4)
- {
- return 4;
- }
- if(GPIOx == GPIO5)
- {
- return 5;
- }
- if(GPIOx == GPIO6)
- {
- return 6;
- }
- if(GPIOx == GPIO7)
- {
- return 7;
- }
- if(GPIOx == GPIO8)
- {
- return 8;
- }
- if(GPIOx == GPIO9)
- {
- return 9;
- }
- return 0;
-}
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_TEST_LED/str91x_lib/91x_lib.c b/uc_str912/prj_TEST_LED/str91x_lib/91x_lib.c
deleted file mode 100644
index c0eadbb..0000000
--- a/uc_str912/prj_TEST_LED/str91x_lib/91x_lib.c
+++ /dev/null
@@ -1,281 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_lib.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all peripherals pointers
- : initialization.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-#define EXT
-
-/* Standard include ----------------------------------------------------------*/
-#include "91x_map.h"
-
-/* Include of other module interface headers ---------------------------------*/
-/* Local includes ------------------------------------------------------------*/
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/* Interface functions -------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-#ifdef DEBUG
-
-/*******************************************************************************
-* Function Name : debug
-* Description : this function initialize peripherals pointers
-* Input : no one
-* Output : no one
-* Return : no one
-*******************************************************************************/
-void debug(void)
-{
-
-
-/************************* DMA *************************/
-
-#ifdef _DMA
- DMA = (DMA_TypeDef *)DMA_BASE;
-#endif /* _DMA */
-
-/************************* DMA *************************/
-
-
-#ifdef _DMA_Channel0
- DMA_Channel0= (DMA_Channel_TypeDef *)DMA_Channel0_BASE;
-#endif /* _DMA_Channel0 */
-
-#ifdef _DMA_Channel1
- DMA_Channel1= (DMA_Channel_TypeDef *)DMA_Channel1_BASE;
-#endif /* _DMA_Channel1 */
-
-#ifdef _DMA_Channel2
- DMA_Channel2 = (DMA_Channel_TypeDef *)DMA_Channel2_BASE;
-#endif /* _DMA_Channel2 */
-
-#ifdef _DMA_Channel3
- DMA_Channel3 = (DMA_Channel_TypeDef *)DMA_Channel3_BASE;
-#endif /* _DMA_Channel3 */
-
-#ifdef _DMA_Channel4
- DMA_Channel4 = (DMA_Channel_TypeDef *)DMA_Channel4_BASE;
-#endif /* _DMA_Channel4 */
-
-#ifdef _DMA_Channel5
- DMA_Channel5= (DMA_Channel_TypeDef *)DMA_Channel5_BASE;
-#endif /* _DMA_Channel5*/
-
-
-#ifdef _DMA_Channel6
- DMA_Channel6 = (DMA_Channel_TypeDef *)DMA_Channel6_BASE;
-#endif /* _DMA_Channel6 */
-
-#ifdef _DMA_Channel7
- DMA_Channel7 = (DMA_Channel_TypeDef *)DMA_Channel7_BASE;
-#endif /* _DMA_Channel7 */
-
-
-
- /************************* EMI *************************/
-
-#ifdef _EMI_Bank0
- EMI_Bank0= (EMI_Bank_TypeDef *)EMI_Bank0_BASE;
-#endif /* _EMI_Bank0 */
-
-#ifdef _EMI_Bank1
- EMI_Bank1= (EMI_Bank_TypeDef *)EMI_Bank1_BASE;
-#endif /* _EMI_Bank1 */
-
-#ifdef _EMI_Bank2
- EMI_Bank2 = (EMI_Bank_TypeDef *)EMI_Bank2_BASE;
-#endif /* _EMI_Bank2 */
-
-#ifdef _EMI_Bank3
- EMI_Bank3 = (EMI_Bank_TypeDef *)EMI_Bank3_BASE;
- #endif /* _EMI_Bank3 */
-
-
-
-/************************* AHBAPB *************************/
-
-#ifdef _AHBAPB0
- AHBAPB0 = (AHBAPB_TypeDef *)AHBAPB0_BASE;
-#endif /* _AHBAPB0 */
-
-#ifdef _AHBAPB1
- AHBAPB1 = (AHBAPB_TypeDef *)AHBAPB1_BASE;
-#endif /*_AHBAPB1 */
-
-
-
-/************************* FMI *************************/
-
-#ifdef _FMI
- FMI = (FMI_TypeDef *)FMI_BASE;
-#endif /* _FMI */
-
-/************************* VIC *************************/
-
-#ifdef _VIC0
- VIC0 = (VIC_TypeDef *)VIC0_BASE;
-#endif /* _VIC0 */
-
-#ifdef _VIC1
- VIC1 = (VIC_TypeDef *)VIC1_BASE;
-#endif /* _VIC1 */
-
-/************************* WIU *************************/
-
-#ifdef _WIU
- WIU = (WIU_TypeDef *)WIU_BASE;
-#endif /* _WIU */
-
-/************************* TIM *************************/
-
-#ifdef _TIM0
- TIM0 = (TIM_TypeDef *)TIM0_BASE;
-#endif /* _TIM0 */
-
-#ifdef _TIM1
- TIM1 = (TIM_TypeDef *)TIM1_BASE;
-#endif /* _TIM1 */
-
-#ifdef _TIM2
- TIM2 = (TIM_TypeDef *)TIM2_BASE;
-#endif /* _TIM2 */
-
-#ifdef _TIM3
- TIM3 = (TIM_TypeDef *)TIM3_BASE;
-#endif /* _TIM3 */
-
-/************************* GPIO ************************/
-
-#ifdef _GPIO0
- GPIO0 = (GPIO_TypeDef *)GPIO0_BASE;
-#endif /* _GPIO0 */
-
-#ifdef _GPIO1
- GPIO1 = (GPIO_TypeDef *)GPIO1_BASE;
-#endif /* _GPIO1 */
-
-#ifdef _GPIO2
- GPIO2 = (GPIO_TypeDef *)GPIO2_BASE;
-#endif /* _GPIO2 */
-
-#ifdef _GPIO3
- GPIO3 = (GPIO_TypeDef *)GPIO3_BASE;
-#endif /* _GPIO3 */
-
-#ifdef _GPIO4
- GPIO4 = (GPIO_TypeDef *)GPIO4_BASE;
-#endif /* _GPIO4 */
-
-#ifdef _GPIO5
- GPIO5 = (GPIO_TypeDef *)GPIO5_BASE;
-#endif /* _GPIO5 */
-
-#ifdef _GPIO6
- GPIO6 = (GPIO_TypeDef *)GPIO6_BASE;
-#endif /* _GPIO6 */
-
-#ifdef _GPIO7
- GPIO7 = (GPIO_TypeDef *)GPIO7_BASE;
-#endif /* _GPIO7 */
-
-#ifdef _GPIO8
- GPIO8 = (GPIO_TypeDef *)GPIO8_BASE;
-#endif /* _GPIO8 */
-
-#ifdef _GPIO9
- GPIO9 = (GPIO_TypeDef *)GPIO9_BASE;
-#endif /* _GPIO9 */
-
-/************************* RTC *************************/
-
-#ifdef _RTC
- RTC = (RTC_TypeDef *)RTC_BASE;
-#endif /* _RTC */
-
-/************************* PRCCU ***********************/
-
-#ifdef _SCU
- SCU = (SCU_TypeDef *)SCU_BASE;
-#endif /* _PRCCU */
-
-/************************** MC *************************/
-
-#ifdef _MC
- MC = (MC_TypeDef *)MC_BASE;
-#endif /* _MC */
-
-/************************* UART ************************/
-
-#ifdef _UART0
- UART0 = (UART_TypeDef *)UART0_BASE;
-#endif /* _UART0 */
-
-#ifdef _UART1
- UART1 = (UART_TypeDef *)UART1_BASE;
-#endif /* _UART1 */
-
-#ifdef _UART2
- UART2 = (UART_TypeDef *)UART2_BASE;
-#endif /* _UART2 */
-
-/************************* SSP *************************/
-
-#ifdef _SSP0
- SSP0 = (SSP_TypeDef *)SSP0_BASE;
-#endif /* _SSP0 */
-
-#ifdef _SSP1
- SSP1 = (SSP_TypeDef *)SSP1_BASE;
-#endif /* _SSP1 */
-
-/************************* CAN *************************/
-
-#ifdef _CAN
- CAN = (CAN_TypeDef *)CAN_BASE;
-#endif /* _CAN */
-
-/************************* ADC *************************/
-
-#ifdef _ADC
- ADC = (ADC_TypeDef *)ADC_BASE;
-#endif /* _ADC */
-
-/************************* WDG *************************/
-
-#ifdef _WDG
- WDG = (WDG_TypeDef *)WDG_BASE;
-#endif /* _WDG */
-
-/************************* I2C *************************/
-
-#ifdef _I2C0
- I2C0 = (I2C_TypeDef *)I2C0_BASE;
-#endif /* _I2C0 */
-
-#ifdef _I2C1
- I2C1 = (I2C_TypeDef *)I2C1_BASE;
-#endif /* _I2C1 */
-/********************** ENET **************************/
-#ifdef _ENET
- ENET_MAC = (ENET_MAC_TypeDef *)ENET_MAC_BASE;
- ENET_DMA = (ENET_DMA_TypeDef *)ENET_DMA_BASE;
-#endif /* _ENET */
-}
-#endif /* DEBUG */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_TEST_LED/str91x_lib/91x_scu.c b/uc_str912/prj_TEST_LED/str91x_lib/91x_scu.c
deleted file mode 100644
index 21116b2..0000000
--- a/uc_str912/prj_TEST_LED/str91x_lib/91x_scu.c
+++ /dev/null
@@ -1,661 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_scu.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides the SCU library software functions
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_scu.h"
-
-/* Include of other module interface headers ---------------------------------*/
-/* Local includes ------------------------------------------------------------*/
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-#define SCU_PLLEN 0x80000
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/* Interface functions -------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-
-/*******************************************************************************
-* Function Name : SCU_MCLKSourceConfig
-* Description : Configures the MCLK source clock
-* Input : MCLK_Source = SCU_MCLK_OSC, SCU_MCLK_PLL or SCU_MCLK_RTC
-* Output : None
-* Return : ErrorStatus: SUCCESS or ERROR
-* Note : this function returns ERROR if trying to select the PLL as
-* clock source while the PLL is disabled or not locked.
-*******************************************************************************/
-ErrorStatus SCU_MCLKSourceConfig(u32 MCLK_Source)
-{
- u32 CLKCNTR_Value;
-
- CLKCNTR_Value = SCU->CLKCNTR; /*get CLKCNTR register value*/
- CLKCNTR_Value &=~0x3; /*clear field MCLKSEL*/
- if (MCLK_Source == SCU_MCLK_PLL) /*PLL selected as clock source*/
- {
- /*check if PLL enabled & locked*/
- if (!((SCU->PLLCONF&SCU_PLLEN)&&(SCU->SYSSTATUS&SCU_FLAG_LOCK)))
- return ERROR;
- }
- else CLKCNTR_Value |=MCLK_Source; /*OSC or RTC selected as clock source*/
- SCU->CLKCNTR = CLKCNTR_Value; /*Update CLKCNTR register value*/
- return SUCCESS;
-}
-
-/*******************************************************************************
-* Function Name : SCU_PLLFactorsConfig
-* Description : Sets the PLL factors
-* Input : PLLN, PLLM and PLLP
-* Output : None
-* Return : ErrorStatus: ERROR or SUCCESS
-* Notes : -The PLL factors must respect the PLL specification requirements
-* -The function returns ERROR if trying to change PLL
-* factors while PLL is selected as Main Clock source (MCLK)
-* -This function disables the PLL, to enable the PLL use
-* function" SCU_PLLCmd(ENABLE)" after setting the PLL factors
-******************************************************************************/
-ErrorStatus SCU_PLLFactorsConfig(u8 PLLN, u8 PLLM, u8 PLLP)
-{
- if (SCU_PLLCmd(DISABLE)==SUCCESS) /*Disable PLL*/
- {
- SCU->PLLCONF =0; /*clear PLLCONF register*/
- SCU->PLLCONF |=(PLLN<<8); /*update PLLN field*/
- SCU->PLLCONF |=PLLM; /*update PLLM field*/
- SCU->PLLCONF |=PLLP<<16; /*update PLLP field*/
- return SUCCESS;
- }
- return ERROR;
-}
-
-/*******************************************************************************
-* Function Name : SCU_PLLCmd
-* Description : Enable or Disable the PLL
-* Input : NewState = ENABLE or DISABLE
-* Output : None
-* Return : ErrorStatus: SUCCESS or ERROR
-* Note : -The function returns ERROR if:
-* *trying to disable the PLL while it is selected as the MCLK
-* *trying to enable the PLL while it is already enabled and
-* locked
-*******************************************************************************/
-ErrorStatus SCU_PLLCmd(FunctionalState NewState)
-{
- vu32 i;
- if (NewState==ENABLE)
- {
- if (!((SCU->PLLCONF&SCU_PLLEN)&&(SCU->SYSSTATUS&SCU_FLAG_LOCK)))
- {
- SCU->SYSSTATUS|=SCU_FLAG_LOCK; /*clear LOCK bit*/
- SCU->PLLCONF |=SCU_PLLEN; /*PLL Enable*/
- while(!SCU->SYSSTATUS&SCU_FLAG_LOCK); /*Wait PLL to lock*/
- return SUCCESS;
- }
- else return ERROR;
- }
- else /*NewState = DISABLE*/
- {
- if(SCU->CLKCNTR&0x3) /*check if PLL not sys CLK*/
- {
- for(i=10;i>0;i--); /*delay before PLL disabling*/
- SCU->PLLCONF &=~SCU_PLLEN; /*PLL Disable*/
- return SUCCESS;
- }
- else return ERROR;
- }
-}
-
-/*******************************************************************************
-* Function Name : SCU_RCLKDivisorConfig
-* Description : Sets the RCLK divisor value
-* Input : RCLK_Divisor
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_RCLKDivisorConfig(u32 RCLK_Divisor)
-{
- SCU->CLKCNTR &=SCU_RCLK_Div1; /*clear RCLKDIV[2:0] field*/
- if (RCLK_Divisor!=SCU_RCLK_Div1)
- SCU->CLKCNTR |= RCLK_Divisor; /*update field with RCLK divisor*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_HCLKDivisorConfig
-* Description : Sets the HCLK divisor value
-* Input : HCLK_Divisor
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_HCLKDivisorConfig(u32 HCLK_Divisor)
-{
- SCU->CLKCNTR &=SCU_HCLK_Div1; /*clear AHBDIV[1:0] field*/
- if (HCLK_Divisor!=SCU_HCLK_Div1)
- SCU->CLKCNTR |= HCLK_Divisor; /*update field with HCLK divisor*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_PCLKDivisorConfig
-* Description : Sets the PCLK divisor value
-* Input : PCLK_Divisor
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_PCLKDivisorConfig(u32 PCLK_Divisor)
-{
- SCU->CLKCNTR &=SCU_PCLK_Div1; /*clear APBDIV[1:0] field*/
- if (PCLK_Divisor!=SCU_PCLK_Div1)
- SCU->CLKCNTR |= PCLK_Divisor; /*update field with PCLK Divisor*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_APBPeriphClockConfig
-* Description : Enable the clock for an APB peripheral
-* Input : -APBPerip : APB peripherals(__RTC, __ADC ,...)
-* -NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_APBPeriphClockConfig(u32 APBPeriph, FunctionalState NewState)
-{
- if (NewState==ENABLE) /*Enable clock for APB peripheral*/
- SCU->PCGR1 |=APBPeriph;
- else
- SCU->PCGR1 &=~APBPeriph; /*Disable clock for APB peripheral*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_AHBPeriphClockConfig
-* Description : Enable the clock for an AHB peripheral
-* Input : -AHBPerip: AHB peripherals(__USB, __DMA,...)
-* -NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_AHBPeriphClockConfig(u32 AHBPeriph, FunctionalState NewState)
-{
- if (NewState==ENABLE) /*Enable clock for AHB peripheral*/
- SCU->PCGRO |=AHBPeriph;
- else
- SCU->PCGRO &=~AHBPeriph; /*Disable clock for AHB peripheral*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_APBPeriphReset
-* Description : Assert or deassert Reset on APB peripheral
-* Input : -APBPeriph: APB peripherals(__RTC, __ADC,...)
- -NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_APBPeriphReset(u32 APBPeriph, FunctionalState NewState)
-{
- if (NewState==DISABLE) /*APB peripheral not held in Reset*/
- SCU->PRR1 |=APBPeriph;
- else
- SCU->PRR1 &=~APBPeriph; /*APB peripheral held in Reset*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_AHBPeriphReset
-* Description : Assert or deassert Reset on AHB peripheral
-* Input : -AHBPeriph: AHB peripherals(__USB, __DMA,...)
- -NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_AHBPeriphReset(u32 AHBPeriph, FunctionalState NewState)
-{
- if (NewState==DISABLE)
- SCU->PRR0 |=AHBPeriph; /*AHB peripheral not held in Reset*/
- else
- SCU->PRR0 &=~AHBPeriph; /*AHB peripheral held in Reset*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_APBPeriphIdleConfig
-* Description : Enable or Disable Periph Clock during Idle mode
-* Input : -APBPeriph: APB peripherals(__RTC, __ADC,...)
- -NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_APBPeriphIdleConfig(u32 APBPeriph, FunctionalState NewState)
-{
- if (NewState==ENABLE)
- SCU->MGR1 |=APBPeriph; /*APB peripheral clock enabled during Idle mode*/
- else
- SCU->MGR1 &=~APBPeriph; /*APB peripheral clock disabled during Idle mode*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_AHBPeriphIdleConfig
-* Description : Enable or Disable Periph Clock during Idle mode
-* Input : -AHBPeriph: AHB peripherals(__USB, __DMA,...)
- -NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_AHBPeriphIdleConfig(u32 AHBPeriph, FunctionalState NewState)
-{
- if (NewState==ENABLE)
- SCU->MGR0 |=AHBPeriph; /*AHB peripheral clock enabled during Idle mode*/
- else
- SCU->MGR0 &=~AHBPeriph; /*AHB peripheral clock disabled during Idle mode*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_APBPeriphDebugConfig
-* Description : Enable or Disable Periph Clock during ARM debug state
-* Input : -APBPeriph: APB peripherals(__RTC, __ADC,...)
- -NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_APBPeriphDebugConfig(u32 APBPeriph, FunctionalState NewState)
-{
- if (NewState==ENABLE)
- SCU->PECGR1 |=APBPeriph; /*APB peripheral clock enabled during ARM debug state*/
- else
- SCU->PECGR1 &=~APBPeriph; /*APB peripheral clock disabled during ARM debug state*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_AHBPeriphDebugConfig
-* Description : Enable or Disable Periph Clock during ARM debug state
-* Input : -AHBPeriph: AHB peripherals(__USB, __DMA,...)
- -NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_AHBPeriphDebugConfig(u32 AHBPeriph, FunctionalState NewState)
-{
- if (NewState==ENABLE)
- SCU->PECGR0 |=AHBPeriph; /*AHB peripheral clock enabled during ARM debug state*/
- else
- SCU->PECGR0 &=~AHBPeriph; /*AHB peripheral clock disabled during ARM debug state*/
-}
-/*******************************************************************************
-* Function Name : SCU_BRCLKDivisorConfig
-* Description : Sets the BRCLK divisor value
-* Input : BRCLK_Divisor
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_BRCLKDivisorConfig(u32 BRCLK_Divisor)
-{
- SCU->CLKCNTR &=SCU_BRCLK_Div1; /*Clear BRSEL bit*/
- if (BRCLK_Divisor!=SCU_BRCLK_Div1)
- SCU->CLKCNTR |= SCU_BRCLK_Div2; /*set bit BRSEL*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_TIMCLKSourceConfig
-* Description : Sets the TIMx clock source
-* Input : - TIMx : SCU_TIM01 or SCU_TIM23
-* - TIMCLK_Source = SCU_TIMCLK_EXT or SCU_TIMCLK_INT
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_TIMCLKSourceConfig(u8 TIMx, u32 TIMCLK_Source)
-{
- if (TIMx== SCU_TIM01) /*TIM01 clock source configuration*/
- {
- SCU->CLKCNTR &=0xFFFFDFFF;
- if (TIMCLK_Source == SCU_TIMCLK_EXT)
- SCU->CLKCNTR |=0x2000;
- }
- else
- {
- SCU->CLKCNTR &=0xFFFFBFFF; /*TIM23 clock source configuration*/
- if (TIMCLK_Source == SCU_TIMCLK_EXT)
- SCU->CLKCNTR |=0x4000;
- }
-}
-
-/*******************************************************************************
-* Function Name : SCU_TIMPresConfig
-* Description : Sets the TIMx Prescaler Value
-* Input : - TIMx : SCU_TIM01 or SCU_TIM23
-* - Prescaler (16 bit value)
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_TIMPresConfig(u8 TIMx, u16 Prescaler)
-{
- if (TIMx==SCU_TIM01) /*TIM01 Prescaler configuration*/
- SCU->SCR1 = Prescaler&0xFFFF;
- else
- SCU->SCR2 = Prescaler&0xFFFF; /*TIM23 Prescaler configuration*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_USBCLKConfig
-* Description : Configures the clock source for the 48MHz USBCLK
-* Input : USBCLK_Source: SCU_USBCLK_MCLK,SCU_USBCLK_MCLK2 or SCU_USBCLK_EXT
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_USBCLKConfig(u32 USBCLK_Source)
-{
- SCU->CLKCNTR &=SCU_USBCLK_MCLK; /*clear USBSEL[1:0] field*/
- if (USBCLK_Source!=SCU_USBCLK_MCLK)
- SCU->CLKCNTR |= USBCLK_Source; /*update field with USBCLK_Source*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_PHYCLKConfig
-* Description : Enable or Disable PHY clock output
-* Input : NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_PHYCLKConfig(FunctionalState NewState)
-{
- if (NewState==ENABLE)
- SCU->CLKCNTR |= 0x1000; /*enable MIIPHY clock*/
- else
- SCU->CLKCNTR &=~0x1000; /*disable MIIPHY clock*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_FMICLKDivisorConfig
-* Description : Set the FMI clock divisor
-* Input : FMICLK_Divisor: SCU_FMICLK_Div1 or SCU_FMICLK_DIV2
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_FMICLKDivisorConfig(u32 FMICLK_Divisor)
-{
- SCU->CLKCNTR &=SCU_FMICLK_Div1; /*FMICLK = RCLK*/
- if (FMICLK_Divisor!=SCU_FMICLK_Div1)
- SCU->CLKCNTR |=SCU_FMICLK_Div2; /*FMICLK = RCLK/2 */
-}
-
-/*******************************************************************************
-* Function Name : SCU_EMIBCLKDivisorConfig
-* Description : Set the EMI Bus clock divisor: EMIBCLK = HCLK or HCLK/2
-* Input : SCU_EMICLK: SCU_EMIBCLK_Div1 , SCU_EMIBCLK_Div2
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_EMIBCLKDivisorConfig(u32 SCU_EMIBCLK)
-{
- SCU->CLKCNTR &=SCU_EMIBCLK_Div1; /*EMIBCLK = HCLK */
- if (SCU_EMIBCLK!=SCU_EMIBCLK_Div1)
- SCU->CLKCNTR |= SCU_EMIBCLK_Div2; /*EMIBCLK = HCLK/2 */
-}
-
-/*******************************************************************************
-* Function Name : SCU_EMIModeConfig
-* Description : Configure the EMI as Multiplexed or Demultiplexed
-* Input : SCU_EMIMODE : SCU_EMI_MUX or SCU_EMI_DEMUX
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_EMIModeConfig(u32 SCU_EMIMODE)
-{
- SCU->SCR0 &=SCU_EMI_MUX; /*EMI mode = Multiplexed*/
- if (SCU_EMIMODE!=SCU_EMI_MUX)
- SCU->SCR0 |= SCU_EMI_DEMUX; /*EMI mode = Demultiplexed*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_EMIALEConfig
-* Description : Configure the ALE signal (length & polarity)
-* Input : -SCU_EMIALE_LEN : SCU_EMIALE_LEN1 or SCU_EMIALE_LEN2
-* -SCU_EMIALE_POL : SCU_EMIALE_POLLow or SCU_EMI_POLHigh
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_EMIALEConfig(u32 SCU_EMIALE_LEN, u32 SCU_EMIALE_POL)
-{
- /*Configure EMI ALE Length*/
- SCU->SCR0 &=SCU_EMIALE_LEN1;
- if (SCU_EMIALE_LEN!=SCU_EMIALE_LEN1)
- SCU->SCR0 |= SCU_EMIALE_LEN2;
-
- /*Configure EMI ALE POL*/
- SCU->SCR0 &=SCU_EMIALE_POLLow;
- if (SCU_EMIALE_POL!=SCU_EMIALE_POLLow)
- SCU->SCR0 |= SCU_EMIALE_POLHigh;
-}
-
-/*******************************************************************************
-* Function Name : SCU_ITConfig
-* Description : ENBALE or DISABLE an SCU interrupt
-* Input : -SCU_IT: interrupt mask
-* -NewState: ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_ITConfig(u32 SCU_IT, FunctionalState NewState)
-{
- if (NewState==ENABLE)
- SCU->ITCMSK&=~SCU_IT; /*IT enable */
- else
- SCU->ITCMSK|=SCU_IT; /*IT disable( mask)*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_GetFlagStatus
-* Description : Returns flag status
-* Input : SCU_Flag
-* Output : NONE
-* Return : SET or RESET
-*******************************************************************************/
-FlagStatus SCU_GetFlagStatus(u32 SCU_Flag)
-{
- if (SCU->SYSSTATUS&SCU_Flag)
- return SET;
- else return RESET;
-}
-
-/*******************************************************************************
-* Function Name : SCU_ClearFlag
-* Description : Clears a SYSTATUS Flag
-* Input : SCU_Flag
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_ClearFlag(u32 SCU_Flag)
-{
- SCU->SYSSTATUS = SCU_Flag;
-}
-/*******************************************************************************
-* Function Name : SCU_GetPLLfreqValue
-* Description : Gets the current PLL frequency
-* Input : None
-* Output : None
-* Return : PLL frequency (KHz)
-*******************************************************************************/
-u32 SCU_GetPLLFreqValue(void)
-{
- u8 PLL_M;
- u8 PLL_N;
- u8 PLL_P;
-
- PLL_M = SCU->PLLCONF&0xFF;
- PLL_N = (SCU->PLLCONF&0xFF00)>>8;
- PLL_P = (SCU->PLLCONF&0x70000)>>16;
-
- if ((PLL_M>0)&&(PLL_N>0))
- return (u32)(((_Main_Crystal*2)*PLL_N)/(PLL_M<<PLL_P));
-
- else return 0;
-}
-/*******************************************************************************
-* Function Name : SCU_GetMCLKFreqValue
-* Description : Gets the current MCLK frequency
-* Input : None
-* Output : None
-* Return : MCLK frequency (KHz)
-*******************************************************************************/
-u32 SCU_GetMCLKFreqValue(void)
-{
- if ((SCU->CLKCNTR&0x3) == 0x2) return (u32)(_Main_Crystal);
- if ((SCU->CLKCNTR&0x3) == 0x1) return (u32)(32);
- else return (SCU_GetPLLFreqValue());
-}
-
-/*******************************************************************************
-* Function Name : SCU_GetRCLKFreqValue
-* Description : Gets the current RCLK frequency
-* Input : None
-* Output : None
-* Return : RCLK frequency (KHz)
-*******************************************************************************/
-u32 SCU_GetRCLKFreqValue(void)
-{
- u8 RCLK_Div;
- RCLK_Div = (SCU->CLKCNTR&0x1C)>>2;
- if (RCLK_Div==0x5) RCLK_Div=10;
- return (u32)(SCU_GetMCLKFreqValue() >>RCLK_Div);
-}
-
-/*******************************************************************************
-* Function Name : SCU_GetHCLKFreqValue
-* Description : Gets the current PCLK frequency
-* Input : None
-* Output : None
-* Return : HCLK frequency (KHz)
-*******************************************************************************/
-u32 SCU_GetHCLKFreqValue(void)
-{
- u8 HCLK_Div;
- HCLK_Div = (SCU->CLKCNTR&0x60)>>5;
- return (u32)(SCU_GetRCLKFreqValue() >>HCLK_Div);
-}
-
-/*******************************************************************************
-* Function Name : SCU_GetPCLKFreqValue
-* Description : Gets the current HCLK frequency
-* Input : None
-* Output : None
-* Return : PCLK frequency (KHz)
-*******************************************************************************/
-u32 SCU_GetPCLKFreqValue(void)
-{
- u8 PCLK_Div;
- PCLK_Div = (SCU->CLKCNTR&0x180)>>7;
- return (u32)(SCU_GetRCLKFreqValue() >>PCLK_Div);
-}
-
-/*******************************************************************************
-* Function Name : SCU_WakeUpLineConfig
-* Description : Configures an External interrupt as WakeUp line
-* Input : EXTint : 0 -> 31
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_WakeUpLineConfig(u8 EXTint)
-{
- if (EXTint < 8)
- {
- SCU->WKUPSEL&=~0x7;
- SCU->WKUPSEL|=EXTint;
- }
- else if (EXTint<16)
- {
- SCU->WKUPSEL&=~0x38;
- SCU->WKUPSEL|=(EXTint-8)<<3;
- }
- else if (EXTint<24)
- {
- SCU->WKUPSEL&=~0x1C0;
- SCU->WKUPSEL|=(EXTint-16)<<6;
- }
- else
- {
- SCU->WKUPSEL&=~0xE00;
- SCU->WKUPSEL|=(EXTint-24)<<9;
- }
-}
-
-/*******************************************************************************
-* Function Name : SCU_SpecIntRunModeConfig
-* Description : Enables or Disables the Special Run mode
-* Input : newstate = ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_SpecIntRunModeConfig(FunctionalState NewState)
-{
- if (NewState == ENABLE)
- SCU->PWRMNG |=0x8;
- else
- SCU->PWRMNG &=~0x8;
-}
-/*******************************************************************************
-* Function Name : SCU_EnterIdleMode
-* Description : Enters in Idle mode
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_EnterIdleMode(void)
-{
- SCU->PWRMNG |=0x1;
-}
-/*******************************************************************************
-* Function Name : SCU_EnterSleepMode
-* Description : Enters in Sleep mode
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_EnterSleepMode(void)
-{
- SCU->PWRMNG |=0x2;
-}
-
-/*******************************************************************************
-* Function Name : SCU_UARTIrDAConfig
-* Description : Enable or Disable the Irda mode for UARTx
-* Input : - UARTx :x=0,1 or 2
-* - UART_IrDA_Mode : SCU_UARTMode_IrDA or SCU_UARTMode_UART
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_UARTIrDASelect(UART_TypeDef * UARTx, u8 UART_IrDA_Mode)
-{
- if (UART_IrDA_Mode == SCU_UARTMode_IrDA)
- {
- if (UARTx== UART0) SCU->SCR0 |=0x400;
- else if (UARTx==UART1) SCU->SCR0 |=0x800;
- else SCU->SCR0 |=0x1000;
- }
- else
- {
- if (UARTx== UART0) SCU->SCR0 &=~0x400;
- else if (UARTx==UART1) SCU->SCR0 &=~0x800;
- else SCU->SCR0 &=~0x1000;
- }
-}
-/*******************************************************************************
-* Function Name : SCU_PFQBCCmd
-* Description : Enable or Disable PFQBC
-* Input : NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_PFQBCCmd(FunctionalState NewState)
-{
- if (NewState==ENABLE)
- SCU->SCR0 |=0x1;
- else SCU->SCR0 &=~0x1;
-}
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_TEST_LED/vector.s b/uc_str912/prj_TEST_LED/vector.s
deleted file mode 100644
index 7708f54..0000000
--- a/uc_str912/prj_TEST_LED/vector.s
+++ /dev/null
@@ -1,202 +0,0 @@
-/***********************************************************************************
-* Copyright 2005 Anglia Design
-* This demo code and associated components are provided as is and has no warranty,
-* implied or otherwise. You are free to use/modify any of the provided
-* code at your own risk in your applications with the expressed limitation
-* of liability (see below)
-*
-* LIMITATION OF LIABILITY: ANGLIA OR ANGLIA DESIGNS SHALL NOT BE LIABLE FOR ANY
-* LOSS OF PROFITS, LOSS OF USE, LOSS OF DATA, INTERRUPTION OF BUSINESS, NOR FOR
-* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND WHETHER UNDER
-* THIS AGREEMENT OR OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-*
-* Author : Spencer Oliver
-* Web : www.anglia-designs.com
-*
-***********************************************************************************/
-
- .equ VectorAddress, 0xFFFFF030 /* VIC Vector address register address. */
- .equ VectorAddressDaisy, 0xFC000030 /* Daisy VIC Vector address register */
-
- .equ Mode_USR, 0x10
- .equ Mode_FIQ, 0x11
- .equ Mode_IRQ, 0x12
- .equ Mode_SVC, 0x13
- .equ Mode_ABT, 0x17
- .equ Mode_UND, 0x1B
- .equ Mode_SYS, 0x1F /* available on ARM Arch 4 and later */
-
- .equ I_Bit, 0x80 /* when I bit is set, IRQ is disabled */
- .equ F_Bit, 0x40 /* when F bit is set, FIQ is disabled */
-
- .text
- .arm
- .section .vectors, "ax"
-
- .global Reset_Vec
-
-/* Note: LDR PC instructions are used here, though branch (B) instructions */
-/* could also be used, unless the ROM is at an address >32MB. */
-
-/*******************************************************************************
- Exception vectors
-*******************************************************************************/
-
-Reset_Vec: LDR pc, Reset_Addr /* Reset Handler */
-Undef_Vec: LDR pc, Undefined_Addr
-SWI_Vec: LDR pc, SWI_Addr
-PAbt_Vec: LDR pc, Prefetch_Addr
-DAbt_Vec: LDR pc, Abort_Addr
- NOP /* Reserved vector */
-IRQ_Vec: LDR pc, IRQ_Addr
-FIQ_Vec: LDR pc, FIQ_Addr
-
-/*******************************************************************************
- Exception handlers address table
-*******************************************************************************/
-
-Reset_Addr: .word _start
-Undefined_Addr: .word UndefinedHandler
-SWI_Addr: .word SWIHandler
-Prefetch_Addr: .word PrefetchHandler
-Abort_Addr: .word AbortHandler
- .word 0 /* reserved */
-IRQ_Addr: .word IRQHandler
-FIQ_Addr: .word FIQHandler
-
-/*******************************************************************************
- Exception Handlers
-*******************************************************************************/
-
-/*******************************************************************************
-* Macro Name : SaveContext
-* Description : This macro used to save the context before entering
- an exception handler.
-* Input : The range of registers to store.
-* Output : none
-*******************************************************************************/
-
-.macro SaveContext reg1 reg2
- STMFD sp!,{\reg1-\reg2,lr} /* Save The workspace plus the current return */
- /* address lr_ mode into the stack */
- MRS r1, spsr /* Save the spsr_mode into r1 */
- STMFD sp!, {r1} /* Save spsr */
-.endm
-
-/*******************************************************************************
-* Macro Name : RestoreContext
-* Description : This macro used to restore the context to return from
- an exception handler and continue the program execution.
-* Input : The range of registers to restore.
-* Output : none
-*******************************************************************************/
-
-.macro RestoreContext reg1 reg2
- LDMFD sp!, {r1} /* Restore the saved spsr_mode into r1 */
- MSR spsr_cxsf, r1 /* Restore spsr_mode */
- LDMFD sp!, {\reg1-\reg2,pc}^ /* Return to the instruction following */
- /* the exception interrupt */
-.endm
-
-/*******************************************************************************
-* Function Name : IRQHandler
-* Description : This function called when IRQ exception is entered.
-* Input : none
-* Output : none
-*******************************************************************************/
-
-IRQHandler:
- SUB lr, lr, #4 /* Update the link register */
- SaveContext r0, r12 /* Save the workspace plus the current */
- /* return address lr_irq and spsr_irq */
- LDR r0, =VectorAddress
- LDR r0, [r0] /* Read the routine address */
- LDR r1, =VectorAddressDaisy
- LDR r1, [r1]
- /* Padding between the acknowledge and re-enable of interrupts */
- /* For more details, please refer to the following URL */
- /* http://www.arm.com/support/faqip/3682.html */
- NOP
- NOP
- MSR cpsr_c, #Mode_SYS /* Switch to SYS mode and enable IRQ */
- STMFD sp!, {lr} /* Save the link register. */
- LDR lr, =ReturnAddress /* Read the return address. */
- MOV pc, r0 /* Branch to the IRQ handler. */
-ReturnAddress:
- LDMFD sp!, {lr} /* Restore the link register. */
- MSR cpsr_c, #Mode_IRQ|I_Bit|F_Bit /* Switch to IRQ mode and disable IRQ */
- LDR r0, =VectorAddress /* Write to the VectorAddress to clear the */
- STR r0, [r0] /* respective interrupt in the internal interrupt */
- LDR r1, =VectorAddressDaisy /* Write to the VectorAddressDaisy to clear the */
- STR r1, [r1] /* respective interrupt in the internal interrupt */
- RestoreContext r0, r12 /* Restore the context and return to the program execution. */
-
-/*******************************************************************************
-* Function Name : SWIHandler
-* Description : This function called when SWI instruction executed.
-* Input : none
-* Output : none
-*******************************************************************************/
-
-SWIHandler:
- SaveContext r0, r12 /* r0 holds swi number */
- MOV r1, sp /* load regs */
- BL SWI_Handler
- RestoreContext r0, r12
-
-/*******************************************************************************
-* Function Name : UndefinedHandler
-* Description : This function called when undefined instruction
- exception is entered.
-* Input : none
-* Output : none
-*******************************************************************************/
-
-UndefinedHandler:
- SaveContext r0, r12
- BL Undefined_Handler
- RestoreContext r0, r12
-
-/*******************************************************************************
-* Function Name : PrefetchAbortHandler
-* Description : This function called when Prefetch Abort
- exception is entered.
-* Input : none
-* Output : none
-*******************************************************************************/
-
-PrefetchHandler:
- SUB lr, lr, #4 /* Update the link register. */
- SaveContext r0, r12
- BL Prefetch_Handler
- RestoreContext r0, r12
-
-/*******************************************************************************
-* Function Name : DataAbortHandler
-* Description : This function is called when Data Abort
- exception is entered.
-* Input : none
-* Output : none
-*******************************************************************************/
-
-AbortHandler:
- SUB lr, lr, #8 /* Update the link register. */
- SaveContext r0, r12
- BL Abort_Handler
- RestoreContext r0, r12
-
-/*******************************************************************************
-* Function Name : FIQHandler
-* Description : This function is called when FIQ
- exception is entered.
-* Input : none
-* Output : none
-*******************************************************************************/
-
-FIQHandler:
- SUB lr, lr, #4 /* Update the link register. */
- SaveContext r0, r7
- BL FIQ_Handler
- RestoreContext r0, r7
-
- .end
diff --git a/uc_str912/prj_TEST_LED/vectors.c b/uc_str912/prj_TEST_LED/vectors.c
deleted file mode 100644
index 4022391..0000000
--- a/uc_str912/prj_TEST_LED/vectors.c
+++ /dev/null
@@ -1,462 +0,0 @@
-/***********************************************************************************
-* Copyright 2005 Anglia Design
-* This demo code and associated components are provided as is and has no warranty,
-* implied or otherwise. You are free to use/modify any of the provided
-* code at your own risk in your applications with the expressed limitation
-* of liability (see below)
-*
-* LIMITATION OF LIABILITY: ANGLIA OR ANGLIA DESIGNS SHALL NOT BE LIABLE FOR ANY
-* LOSS OF PROFITS, LOSS OF USE, LOSS OF DATA, INTERRUPTION OF BUSINESS, NOR FOR
-* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND WHETHER UNDER
-* THIS AGREEMENT OR OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-*
-* Author : Spencer Oliver
-* Web : www.anglia-designs.com
-*
-***********************************************************************************/
-
-#include "vectors.h"
-
-/*******************************************************************************
-* Function Name : Undefined_Handler
-* Description : This function Undefined instruction exception.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void Undefined_Handler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : SWI_Handler
-* Description : This function handles SW exception.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void SWI_Handler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : Prefetch_Handler
-* Description : This function handles preftetch abort exception.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void Prefetch_Handler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : Abort_Handler
-* Description : This function handles data abort exception.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void Abort_Handler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : FIQ_Handler
-* Description : This function handles FIQ exception.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void FIQ_Handler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : WDG_IRQHandler
-* Description : This function handles the WDG interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void WDG_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : SW_IRQHandler
-* Description : This function handles the SW interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void SW_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : ARMRX_IRQHandler
-* Description : This function handles the ARMRX interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void ARMRX_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : ARMTX_IRQHandler
-* Description : This function handles the ARMTX interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void ARMTX_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : TIM0_IRQHandler
-* Description : This function handles the TIM0 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void TIM0_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : TIM1_IRQHandler
-* Description : This function handles the TIM1 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void TIM1_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : TIM2_IRQHandler
-* Description : This function handles the TIM2 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void TIM2_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : TIM3_IRQHandler
-* Description : This function handles the TIM3 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void TIM3_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : USBHP_IRQHandler
-* Description : This function handles the USBHP interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void USBHP_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : USBLP_IRQHandler
-* Description : This function handles the USBLP interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void USBLP_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : SCU_IRQHandler
-* Description : This function handles the SCU interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : ENET_IRQHandler
-* Description : This function handles the ENET interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void ENET_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : DMA_IRQHandler
-* Description : This function handles the DMA interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void DMA_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : CAN_IRQHandler
-* Description : This function handles the CAN interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void CAN_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : MC_IRQHandler
-* Description : This function handles the MC interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : ADC_IRQHandler
-* Description : This function handles the ADC interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void ADC_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : UART0_IRQHandler
-* Description : This function handles the UART0 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART0_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : UART1_IRQHandler
-* Description : This function handles the UART1 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART1_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : UART2_IRQHandler
-* Description : This function handles the UART2 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART2_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : I2C0_IRQHandler
-* Description : This function handles the I2C0 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void I2C0_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : I2C1_IRQHandler
-* Description : This function handles the I2C1 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void I2C1_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : SSP0_IRQHandler
-* Description : This function handles the SSP0 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void SSP0_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : SSP1_IRQHandler
-* Description : This function handles the SSP1 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void SSP1_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : LVD_IRQHandler
-* Description : This function handles the LVD interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void LVD_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : RTC_IRQHandler
-* Description : This function handles the RTC interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void RTC_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : WIU_IRQHandler
-* Description : This function handles the WIU interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void WIU_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : EXTIT0_IRQHandler
-* Description : This function handles the EXTIT0 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void EXTIT0_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : EXTIT1_IRQHandler
-* Description : This function handles the EXTIT1 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void EXTIT1_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : EXTIT2_IRQHandler
-* Description : This function handles the EXTIT2 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void EXTIT2_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : EXTIT3_IRQHandler
-* Description : This function handles the EXTIT3 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void EXTIT3_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : USBWU_IRQHandler
-* Description : This function handles the USBWU interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void USBWU_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : PFQBC_IRQHandler
-* Description : This function handles the PFQBC interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void PFQBC_IRQHandler(void)
-{
- while(1);
-}
diff --git a/uc_str912/prj_TEST_LED/vectors.h b/uc_str912/prj_TEST_LED/vectors.h
deleted file mode 100644
index d48e61f..0000000
--- a/uc_str912/prj_TEST_LED/vectors.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/***********************************************************************************
-* Copyright 2005 Anglia Design
-* This demo code and associated components are provided as is and has no warranty,
-* implied or otherwise. You are free to use/modify any of the provided
-* code at your own risk in your applications with the expressed limitation
-* of liability (see below)
-*
-* LIMITATION OF LIABILITY: ANGLIA OR ANGLIA DESIGNS SHALL NOT BE LIABLE FOR ANY
-* LOSS OF PROFITS, LOSS OF USE, LOSS OF DATA, INTERRUPTION OF BUSINESS, NOR FOR
-* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND WHETHER UNDER
-* THIS AGREEMENT OR OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-*
-* Author : Spencer Oliver
-* Web : www.anglia-designs.com
-*
-***********************************************************************************/
-
-#ifndef _VECTOR_H
-#define _VECTOR_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void Undefined_Handler(void);
-void FIQ_Handler(void);
-void SWI_Handler(void);
-void Prefetch_Handler(void);
-void Abort_Handler(void);
-void WDG_IRQHandler(void);
-void SW_IRQHandler(void);
-void ARMRX_IRQHandler(void);
-void ARMTX_IRQHandler(void);
-void TIM0_IRQHandler(void);
-void TIM1_IRQHandler(void);
-void TIM2_IRQHandler(void);
-void TIM3_IRQHandler(void);
-void USBHP_IRQHandler(void);
-void USBLP_IRQHandler(void);
-void SCU_IRQHandler(void);
-void ENET_IRQHandler(void);
-void DMA_IRQHandler(void);
-void CAN_IRQHandler(void);
-void MC_IRQHandler(void);
-void ADC_IRQHandler(void);
-void UART0_IRQHandler(void);
-void UART1_IRQHandler(void);
-void UART2_IRQHandler(void);
-void I2C0_IRQHandler(void);
-void I2C1_IRQHandler(void);
-void SSP0_IRQHandler(void);
-void SSP1_IRQHandler(void);
-void LVD_IRQHandler(void);
-void RTC_IRQHandler(void);
-void WIU_IRQHandler(void);
-void EXTIT0_IRQHandler(void);
-void EXTIT1_IRQHandler(void);
-void EXTIT2_IRQHandler(void);
-void EXTIT3_IRQHandler(void);
-void USBWU_IRQHandler(void);
-void PFQBC_IRQHandler(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //_VECTOR_H
diff --git a/uc_str912/prj_blinky_complex_startup/91x_conf.h b/uc_str912/prj_blinky_complex_startup/91x_conf.h
deleted file mode 100644
index 2abcae5..0000000
--- a/uc_str912/prj_blinky_complex_startup/91x_conf.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_conf.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : Library configuration.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-
-#ifndef __91x_CONF_H
-#define __91x_CONF_H
-
-/* To work in buffered mode just decomment the following line */
-
-//#define Buffered
-
-/* Comment the line below to put the library in release mode */
-#define DEBUG
-
-/************************* AHBAPB *************************/
-//#define _AHBAPB
-//#define _AHBAPB0
-//#define _AHBAPB1
-/************************* VIC *************************/
-#define _VIC
-#define _VIC0
-#define _VIC1
-/************************* DMA *************************/
-//#define _DMA
-//#define _DMA_Channel0
-//#define _DMA_Channel1
-//#define _DMA_Channel2
-//#define _DMA_Channel3
-//#define _DMA_Channel4
-//#define _DMA_Channel5
-//#define _DMA_Channel6
-//#define _DMA_Channel7
-
-/************************* EMI *************************/
-//#define _EMI
-//#define _EMI_Bank0
-//#define _EMI_Bank1
-//#define _EMI_Bank2
-//#define _EMI_Bank3
-/************************* FMI *************************/
-#define _FMI
-/************************* WIU *************************/
-//#define _WIU
-/************************* TIM *************************/
-#define _TIM
-#define _TIM0
-#define _TIM1
-#define _TIM2
-#define _TIM3
-/************************* GPIO ************************/
-#define _GPIO
-#define _GPIO0
-#define _GPIO1
-#define _GPIO2
-#define _GPIO3
-#define _GPIO4
-#define _GPIO5
-#define _GPIO6
-#define _GPIO7
-#define _GPIO8
-#define _GPIO9
-/************************* RTC *************************/
-//#define _RTC
-/************************* SCU *************************/
-#define _SCU
-/************************* MC **************************/
-//#define _MC
-/************************* UART ************************/
-#define _UART
-#define _UART0
-#define _UART1
-#define _UART2
-/************************* SSP *************************/
-//#define _SSP
-//#define _SSP0
-//#define _SSP1
-/************************* CAN *************************/
-//#define _CAN
-/************************* ADC *************************/
-//#define _ADC
-/************************* WDG *************************/
-//#define _WDG
-/************************* I2C *************************/
-//#define _I2C
-//#define _I2C0
-//#define _I2C1
-
-/************************ ENET *************************/
-//#define _ENET
-/************************ USB *************************/
-//#define _USB
-
-/*---------------------------- _Main_Crystal frequency value (KHz)------------*/
-
-#ifndef _Main_Crystal
-#define _Main_Crystal 25000
-#endif
-/*------------------------------------------------------------------------------*/
-
-
-#endif /* __91x_CONF_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_complex_startup/Makefile b/uc_str912/prj_blinky_complex_startup/Makefile
deleted file mode 100644
index 325838f..0000000
--- a/uc_str912/prj_blinky_complex_startup/Makefile
+++ /dev/null
@@ -1,463 +0,0 @@
-# Hey Emacs, this is a -*- makefile -*-
-#
-#
-# based on
-# WinARM template makefile
-# by Martin Thomas, Kaiserslautern, Germany
-# <eversmith@heizung-thomas.de>
-#
-# based on the WinAVR makefile written by Eric B. Weddington, J?g Wunsch, et al.
-# Released to the Public Domain
-# Please read the make user manual!
-#
-#
-# On command line:
-#
-# make all = Make software.
-#
-# make clean = Clean out built project files.
-#
-# To rebuild project do "make clean" then "make all".
-#
-# Requires:
-# - CodeSourcery Toolchain (tested & working with Lite version under Windows & Linux)
-# - startup912.s and startup_generic.s to be renamed to .S with capital "S" to avoid deletion when calling "make clean"
-# - Changes in file: scripts/flash_str9.ld
-# replace: ./obj/startup912.o (.text) /* Startup code */
-# to: ./startup912.o (.text) /* Startup code */
-# or else change it to where this file is relative to current dir.
-#
-
-
-
-# Toolchain prefix (i.e arm-elf -> arm-elf-gcc.exe)
-TCHAIN = arm-none-eabi
-
-#USE_THUMB_MODE = YES
-USE_THUMB_MODE = NO
-
-#-------------------------------------------------------------------
-
-# MCU name and submodel
-MCU = arm966e-s
-HEX_NAME = STR9
-
-# Target file name (without extension).
-TARGET = main
-
-# List C source files here. (C dependencies are automatically generated.)
-# use file-extension c for "c-only"-files
-#SRC = $(TARGET).c
-
-# List C source files here which must be compiled in ARM-Mode.
-# use file-extension c for "c-only"-files
-#SRCARM = vectors.c
-
-SRCARM += ./src/91x_adc.c
-SRCARM += ./src/91x_ahbapb.c
-SRCARM += ./src/91x_can.c
-SRCARM += ./src/91x_dma.c
-SRCARM += ./src/91x_emi.c
-SRCARM += ./src/91x_fmi.c
-SRCARM += ./src/91x_gpio.c
-SRCARM += ./src/91x_i2c.c
-SRCARM += ./src/91x_lib.c
-SRCARM += ./src/91x_mc.c
-SRCARM += ./src/91x_rtc.c
-SRCARM += ./src/91x_scu.c
-SRCARM += ./src/91x_ssp.c
-SRCARM += ./src/91x_tim.c
-SRCARM += ./src/91x_uart.c
-SRCARM += ./src/91x_vic.c
-SRCARM += ./src/91x_wdg.c
-SRCARM += ./src/91x_wiu.c
-#SRCARM += ./src/usb_core.c
-#SRCARM += ./src/usb_init.c
-#SRCARM += ./src/usb_int.c
-#SRCARM += ./src/usb_mem.c
-#SRCARM += ./src/usb_regs.c
-SRCARM += main.c
-SRCARM += interrupt.c
-SRCARM += syscalls.c
-
-# thumb is possible too for vectors.c - keep ARM, TODO: profile
-
-# List C++ source files here.
-# use file-extension cpp for C++-files (use extension .cpp)
-CPPSRC =
-
-# List C++ source files here which must be compiled in ARM-Mode.
-# use file-extension cpp for C++-files (use extension .cpp)
-#CPPSRCARM = $(TARGET).cpp
-CPPSRCARM =
-
-# List Assembler source files here.
-# Make them always end in a capital .S. Files ending in a lowercase .s
-# will not be considered source files but generated files (assembler
-# output from the compiler), and will be deleted upon "make clean"!
-# Even though the DOS/Win* filesystem matches both .s and .S the same,
-# it will preserve the spelling of the filenames, and gcc itself does
-# care about how the name is spelled on its command-line.
-ASRC =
-
-# List Assembler source files here which must be assembled in ARM-Mode..
-#ASRCARM = startup.S vector.S
-ASRCARM = startup912.S
-
-# Path to Linker-Scripts
-LINKERSCRIPTPATH = ../scripts
-
-## Output format. (can be ihex or binary or both)
-## (binary i.e. for openocd and SAM-BA, hex i.e. for lpc21isp and uVision)
-#FORMAT = ihex
-#FORMAT = binary
-FORMAT = both
-
-# Optimization level, can be [0, 1, 2, 3, s].
-# 0 = turn off optimization. s = optimize for size.
-# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
-OPT = s
-#OPT = 0
-
-# Debugging format.
-DEBUG =
-
-# List any extra directories to look for include files here.
-# Each directory must be seperated by a space.
-EXTRAINCDIRS = ./include
-
-# List any extra directories to look for library files here.
-# Each directory must be seperated by a space.
-#EXTRA_LIBDIRS = ../arm7_efsl_0_2_4
-EXTRA_LIBDIRS =
-
-
-# Compiler flag to set the C Standard level.
-# c89 - "ANSI" C
-# gnu89 - c89 plus GCC extensions
-# c99 - ISO C99 standard (not yet fully implemented)
-# gnu99 - c99 plus GCC extensions
-CSTANDARD = -std=gnu99
-
-# Place -D or -U options for C here
-CDEFS =
-
-
-# Place -I options here
-CINCS =
-
-# Place -D or -U options for ASM here
-ADEFS =
-
-# Compiler flags.
-
-ifeq ($(USE_THUMB_MODE),YES)
-THUMB = -mthumb
-THUMB_IW = -mthumb-interwork
-else
-THUMB =
-THUMB_IW =
-endif
-
-# -g*: generate debugging information
-# -O*: optimization level
-# -f...: tuning, see GCC manual and avr-libc documentation
-# -Wall...: warning level
-# -Wa,...: tell GCC to pass this to the assembler.
-# -adhlns...: create assembler listing
-#
-# Flags for C and C++ (arm-elf-gcc/arm-elf-g++)
-CFLAGS = -g$(DEBUG)
-CFLAGS += $(CDEFS) $(CINCS)
-CFLAGS += -O$(OPT)
-CFLAGS += -Wall -Wcast-align -Wimplicit
-#CFLAGS += -Wpointer-arith -Wswitch
-CFLAGS += -ffunction-sections -fdata-sections
-CFLAGS += -Wredundant-decls -Wreturn-type -Wshadow -Wunused
-CFLAGS += -Wa,-adhlns=$(subst $(suffix $<),.lst,$<)
-CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
-
-# flags only for C
-CONLYFLAGS += -Wnested-externs
-CONLYFLAGS += $(CSTANDARD)
-
-# flags only for C++ (arm-elf-g++)
-# CPPFLAGS = -fno-rtti -fno-exceptions
-CPPFLAGS =
-
-# Assembler flags.
-# -Wa,...: tell GCC to pass this to the assembler.
-# -ahlns: create listing
-# -g$(DEBUG): have the assembler create line number information
-ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:.S=.lst),-g$(DEBUG)
-
-
-#Additional libraries.
-
-# Extra libraries
-# Each library-name must be seperated by a space.
-# To add libxyz.a, libabc.a and libefsl.a:
-# EXTRA_LIBS = xyz abc efsl
-#EXTRA_LIBS = efsl
-EXTRA_LIBS =
-
-
-# Linker flags.
-# -Wl,...: tell GCC to pass this to linker.
-# -Map: create map file
-# --cref: add cross reference to map file
-LDFLAGS += -nostartfiles
-#LDFLAGS += -nostdlib
-#LDFLAGS += -nodefaultlibs
-LDFLAGS += -Wl,-Map=$(TARGET).map
-LDFLAGS += -Wl,--cref
-#LDFLAGS += -Wl,--gc-sections
-#LDFLAGS += -Wl,-Ttext=0x000000,-Tdata=0x4000000
-
-#LDFLAGS += -lm
-#LDFLAGS += -lc
-LDFLAGS += -lgcc
-#LDFLAGS += -lstdc++
-#LDFLAGS += $(patsubst %,-L%,$(EXTRA_LIBDIRS))
-#LDFLAGS += $(patsubst %,-l%,$(EXTRA_LIBS))
-
-# Set Linker-Script
-LDFLAGS +=-T$(LINKERSCRIPTPATH)/str912fw44.ld
-#LDFLAGS +=-T$(LINKERSCRIPTPATH)/flash_str9.ld
-#LDFLAGS +=-T$(LINKERSCRIPTPATH)/str912_rom.ld
-
-
-# Define programs and commands.
-SHELL = sh
-CC = $(TCHAIN)-gcc
-CPP = $(TCHAIN)-g++
-AR = $(TCHAIN)-ar
-OBJCOPY = $(TCHAIN)-objcopy
-OBJDUMP = $(TCHAIN)-objdump
-SIZE = $(TCHAIN)-size
-NM = $(TCHAIN)-nm
-REMOVE = rm -f
-REMOVEDIR = rm -f -r
-COPY = cp
-
-# Define Messages
-# English
-MSG_ERRORS_NONE = Errors: none
-MSG_BEGIN = "-------- begin (mode: $(RUN_MODE)) --------"
-MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
-MSG_SIZE_AFTER = Size after:
-MSG_FLASH = Creating load file for Flash:
-MSG_EXTENDED_LISTING = Creating Extended Listing:
-MSG_SYMBOL_TABLE = Creating Symbol Table:
-MSG_LINKING = Linking:
-MSG_COMPILING = Compiling C:
-MSG_COMPILING_ARM = "Compiling C (ARM-only):"
-MSG_COMPILINGCPP = Compiling C++:
-MSG_COMPILINGCPP_ARM = "Compiling C++ (ARM-only):"
-MSG_ASSEMBLING = Assembling:
-MSG_ASSEMBLING_ARM = "Assembling (ARM-only):"
-MSG_CLEANING = Cleaning project:
-MSG_FORMATERROR = Can not handle output-format
-MSG_LPC21_RESETREMINDER = You may have to bring the target in bootloader-mode now.
-
-# Define all object files.
-COBJ = $(SRC:.c=.o)
-AOBJ = $(ASRC:.S=.o)
-COBJARM = $(SRCARM:.c=.o)
-AOBJARM = $(ASRCARM:.S=.o)
-CPPOBJ = $(CPPSRC:.cpp=.o)
-CPPOBJARM = $(CPPSRCARM:.cpp=.o)
-
-# Define all listing files.
-LST = $(ASRC:.S=.lst) $(ASRCARM:.S=.lst) $(SRC:.c=.lst) $(SRCARM:.c=.lst)
-LST += $(CPPSRC:.cpp=.lst) $(CPPSRCARM:.cpp=.lst)
-
-# Compiler flags to generate dependency files.
-### GENDEPFLAGS = -Wp,-M,-MP,-MT,$(*F).o,-MF,.dep/$(@F).d
-GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d
-
-# Combine all necessary flags and optional flags.
-# Add target processor to flags.
-ALL_CFLAGS = -mcpu=$(MCU) $(THUMB_IW) -I. $(CFLAGS) $(GENDEPFLAGS)
-ALL_ASFLAGS = -mcpu=$(MCU) $(THUMB_IW) -I. -x assembler-with-cpp $(ASFLAGS)
-
-
-# Default target.
-all: begin gccversion sizebefore build sizeafter finished end
-
-ifeq ($(FORMAT),ihex)
-build: elf hex lss sym
-hex: $(TARGET).hex
-IMGEXT=hex
-else
-ifeq ($(FORMAT),binary)
-build: elf bin lss sym
-bin: $(TARGET).bin
-IMGEXT=bin
-else
-ifeq ($(FORMAT),both)
-build: elf hex bin lss sym
-hex: $(TARGET).hex
-bin: $(TARGET).bin
-else
-$(error "$(MSG_FORMATERROR) $(FORMAT)")
-endif
-endif
-endif
-
-elf: $(TARGET).elf
-lss: $(TARGET).lss
-sym: $(TARGET).sym
-
-# Eye candy
-begin:
- @echo
- @echo $(MSG_BEGIN)
-
-finished:
- @echo $(MSG_ERRORS_NONE)
-
-end:
- @echo $(MSG_END)
- @echo
-
-
-# Display size of file.
-HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
-ELFSIZE = $(SIZE) -A $(TARGET).elf
-sizebefore:
- @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi
-
-sizeafter:
- @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi
-
-
-# Display compiler version information.
-gccversion :
- @$(CC) --version
-
-# Create final output file (.hex) from ELF output file.
-%.hex: %.elf
- @echo
- @echo $(MSG_FLASH) $@
- $(OBJCOPY) -O ihex $< $@
-
-# Create final output file (.bin) from ELF output file.
-%.bin: %.elf
- @echo
- @echo $(MSG_FLASH) $@
- $(OBJCOPY) -O binary $< $@
-
-
-# Create extended listing file from ELF output file.
-# testing: option -C
-%.lss: %.elf
- @echo
- @echo $(MSG_EXTENDED_LISTING) $@
- $(OBJDUMP) -h -S -C $< > $@
-
-
-# Create a symbol table from ELF output file.
-%.sym: %.elf
- @echo
- @echo $(MSG_SYMBOL_TABLE) $@
- $(NM) -n $< > $@
-
-
-# Link: create ELF output file from object files.
-.SECONDARY : $(TARGET).elf
-.PRECIOUS : $(AOBJARM) $(AOBJ) $(COBJARM) $(COBJ) $(CPPOBJ) $(CPPOBJARM)
-%.elf: $(AOBJARM) $(AOBJ) $(COBJARM) $(COBJ) $(CPPOBJ) $(CPPOBJARM)
- @echo
- @echo $(MSG_LINKING) $@
- $(CC) $(THUMB) $(ALL_CFLAGS) $(AOBJARM) $(AOBJ) $(COBJARM) $(COBJ) $(CPPOBJ) $(CPPOBJARM) --output $@ $(LDFLAGS)
- @# $(CPP) $(THUMB) $(ALL_CFLAGS) $(AOBJARM) $(AOBJ) $(COBJARM) $(COBJ) $(CPPOBJ) $(CPPOBJARM) --output $@ $(LDFLAGS)
-
-# Compile: create object files from C source files. ARM/Thumb
-$(COBJ) : %.o : %.c
- @echo
- @echo $(MSG_COMPILING) $<
- $(CC) -c $(THUMB) $(ALL_CFLAGS) $(CONLYFLAGS) $< -o $@
-
-# Compile: create object files from C source files. ARM-only
-$(COBJARM) : %.o : %.c
- @echo
- @echo $(MSG_COMPILING_ARM) $<
- $(CC) -c $(ALL_CFLAGS) $(CONLYFLAGS) $< -o $@
-
-# Compile: create object files from C++ source files. ARM/Thumb
-$(CPPOBJ) : %.o : %.cpp
- @echo
- @echo $(MSG_COMPILINGCPP) $<
- $(CPP) -c $(THUMB) $(ALL_CFLAGS) $(CPPFLAGS) $< -o $@
-
-# Compile: create object files from C++ source files. ARM-only
- $(CPPOBJARM) : %.o : %.cpp
- @echo
- @echo $(MSG_COMPILINGCPP_ARM) $<
- $(CPP) -c $(ALL_CFLAGS) $(CPPFLAGS) $< -o $@
-
-
-# Compile: create assembler files from C source files. ARM/Thumb
-## does not work - TODO - hints welcome
-##$(COBJ) : %.s : %.c
-## $(CC) $(THUMB) -S $(ALL_CFLAGS) $< -o $@
-
-
-# Assemble: create object files from assembler source files. ARM/Thumb
-$(AOBJ) : %.o : %.S
- @echo
- @echo $(MSG_ASSEMBLING) $<
- $(CC) -c $(THUMB) $(ALL_ASFLAGS) $< -o $@
-
-
-# Assemble: create object files from assembler source files. ARM-only
-$(AOBJARM) : %.o : %.S
- @echo
- @echo $(MSG_ASSEMBLING_ARM) $<
- $(CC) -c $(ALL_ASFLAGS) $< -o $@
-
-
-# Target: clean project.
-clean: begin clean_list finished end
-
-
-clean_list :
- @echo
- @echo $(MSG_CLEANING)
- $(REMOVE) $(TARGET).hex
- $(REMOVE) $(TARGET).bin
- $(REMOVE) $(TARGET).obj
- $(REMOVE) $(TARGET).elf
- $(REMOVE) $(TARGET).map
- $(REMOVE) $(TARGET).obj
- $(REMOVE) $(TARGET).a90
- $(REMOVE) $(TARGET).sym
- $(REMOVE) $(TARGET).lnk
- $(REMOVE) $(TARGET).lss
- $(REMOVE) $(COBJ)
- $(REMOVE) $(CPPOBJ)
- $(REMOVE) $(AOBJ)
- $(REMOVE) $(COBJARM)
- $(REMOVE) $(CPPOBJARM)
- $(REMOVE) $(AOBJARM)
- $(REMOVE) $(LST)
- $(REMOVE) $(SRC:.c=.s)
- $(REMOVE) $(SRC:.c=.d)
- $(REMOVE) $(SRCARM:.c=.s)
- $(REMOVE) $(SRCARM:.c=.d)
- $(REMOVE) $(CPPSRC:.cpp=.s)
- $(REMOVE) $(CPPSRC:.cpp=.d)
- $(REMOVE) $(CPPSRCARM:.cpp=.s)
- $(REMOVE) $(CPPSRCARM:.cpp=.d)
- $(REMOVEDIR) .dep | exit 0
-
-
-# Include the dependency files.
--include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
-
-
-# Listing of phony targets.
-.PHONY : all begin finish end sizebefore sizeafter gccversion \
-build elf hex bin lss sym clean clean_list program
diff --git a/uc_str912/prj_blinky_complex_startup/defines.h b/uc_str912/prj_blinky_complex_startup/defines.h
deleted file mode 100644
index 42d3b32..0000000
--- a/uc_str912/prj_blinky_complex_startup/defines.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/********************************************************************
- * Project: STR9-comStick GNU(UART)
- * File: defines.h
- *
- * System: ARM9TDMI 32 Bit (STR912FW44X)
- * Compiler: GCC 4.0.3
- *
- * Date: 2006-12-20
- * Author: Applications@Hitex.de
- *
- * Rights: Hitex Development Tools GmbH
- * Greschbachstr. 12
- * D-76229 Karlsruhe
- ********************************************************************
- * Description:
- *
- * This file is part of the GNU Example chain for STR9-comStick
- * The code is bassed on usage of the STmicro library functions
- * This is a small implementation of UART1 feature with command interface
- * The application runs in ARM mode with high optimization level.
- *
- ********************************************************************
- * History:
- *
- * Revision 1.0 2006/12/20 Gn
- * Initial revision
- ********************************************************************
- * This is a preliminary version.
- *
- * WARRANTY: HITEX warrants that the media on which the SOFTWARE is
- * furnished is free from defects in materials and workmanship under
- * normal use and service for a period of ninety (90) days. HITEX entire
- * liability and your exclusive remedy shall be the replacement of the
- * SOFTWARE if the media is defective. This Warranty is void if failure
- * of the media resulted from unauthorized modification, accident, abuse,
- * or misapplication.
- *
- * DISCLAIMER: OTHER THAN THE ABOVE WARRANTY, THE SOFTWARE IS FURNISHED
- * "AS IS" WITHOUT WARRANTY OF ANY KIND. HITEX DISCLAIMS ALL OTHER WARRANTIES,
- * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- *
- * NEITHER HITEX NOR ITS AFFILIATES SHALL BE LIABLE FOR ANY DAMAGES ARISING
- * OUT OF THE USE OF OR INABILITY TO USE THE SOFTWARE, INCLUDING DAMAGES FOR
- * LOSS OF PROFITS, BUSINESS INTERRUPTION, OR ANY SPECIAL, INCIDENTAL, INDIRECT
- * OR CONSEQUENTIAL DAMAGES EVEN IF HITEX HAS BEEN ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGES.
- ********************************************************************/
-
-/* length specific types recommended by MISRA rule 13 */
-
-#ifndef __DEFINES_H__
-#define __DEFINES_H__
-
-#define int8_t signed char
-#define uint8_t unsigned char
-#define int16_t signed short
-#define uint16_t unsigned short
-#define int32_t signed long
-#define uint32_t unsigned long
-
-#define float16 float
-#define float32 double
-
-#endif /* __DEFINES_H__ */
-
-/************************************ EOF ***********************************/
diff --git a/uc_str912/prj_blinky_complex_startup/include/91x_adc.h b/uc_str912/prj_blinky_complex_startup/include/91x_adc.h
deleted file mode 100644
index 25a396d..0000000
--- a/uc_str912/prj_blinky_complex_startup/include/91x_adc.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_adc.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* ADC software library.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-
-/* Define to prevent recursive inclusion ------------------------------------ */
-
-#ifndef __91x_ADC_H
-#define __91x_ADC_H
-
-/* Includes ------------------------------------------------------------------*/
-
-#include "91x_map.h"
-
-/* Exported types ------------------------------------------------------------*/
-
-/* ADC Init structure define */
-typedef struct
-{
- u16 ADC_WDG_High_Threshold;
- u16 ADC_WDG_Low_Threshold;
- u16 ADC_Channel_0_Mode;
- u16 ADC_Channel_1_Mode;
- u16 ADC_Channel_2_Mode;
- u16 ADC_Channel_3_Mode;
- u16 ADC_Channel_4_Mode;
- u16 ADC_Channel_5_Mode;
- u16 ADC_Channel_6_Mode;
- u16 ADC_Channel_7_Mode;
- u16 ADC_Select_Channel;
- FunctionalState ADC_Scan_Mode;
- u16 ADC_Conversion_Mode;
-}ADC_InitTypeDef;
-
-/* ADC watchdog thresholds */
-typedef enum
-{
- ADC_HighThreshold,
- ADC_LowThreshold
-}ADC_ThresholdType;
-
-/* Exported constants --------------------------------------------------------*/
-
-/* ADC channels */
-#define ADC_Channel_0 0x00 /* Channel 0 */
-#define ADC_Channel_1 0x01 /* Channel 1 */
-#define ADC_Channel_2 0x02 /* Channel 2 */
-#define ADC_Channel_3 0x03 /* Channel 3 */
-#define ADC_Channel_4 0x04 /* Channel 4 */
-#define ADC_Channel_5 0x05 /* Channel 5 */
-#define ADC_Channel_6 0x06 /* Channel 6 */
-#define ADC_Channel_7 0x07 /* Channel 7 */
-
-/* ADC modes */
-#define ADC_Continuous_Mode 0x0010 /* Continuous mode conversion */
-#define ADC_Single_Mode 0xFFEF /* Single mode conversion */
-
-/* ADC Flags */
-#define ADC_FLAG_ECV 0x002F /* End of Conversion Flag */
-#define ADC_FLAG_AWD 0x002E /* Analog WatchDog Flag */
-
-#define ADC_FLAG_OV_CH_0 0x00CF /* Overflow Flag for channel 0 */
-#define ADC_FLAG_OV_CH_1 0x00EF /* Overflow Flag for channel 1 */
-#define ADC_FLAG_OV_CH_2 0x010F /* Overflow Flag for channel 2 */
-#define ADC_FLAG_OV_CH_3 0x012F /* Overflow Flag for channel 3 */
-#define ADC_FLAG_OV_CH_4 0x014F /* Overflow Flag for channel 4 */
-#define ADC_FLAG_OV_CH_5 0x016F /* Overflow Flag for channel 5 */
-#define ADC_FLAG_OV_CH_6 0x018F /* Overflow Flag for channel 6 */
-#define ADC_FLAG_OV_CH_7 0x01AF /* Overflow Flag for channel 7 */
-
-/* ADC conversion modes */
-#define ADC_NoThreshold_Conversion 0x0003 /* Conversion w/o thresholds */
-#define ADC_LowThreshold_Conversion 0x0002 /* Low threshold conversion */
-#define ADC_HighThreshold_Conversion 0x0001 /* High threshold conversion */
-#define ADC_No_Conversion 0x0000 /* No ADC conversion */
-
-/* ADC interrupts */
-#define ADC_IT_ECV 0x0400 /* End of Conversion Interrupt */
-#define ADC_IT_AWD 0x0200 /* Analog Watchdog Interrupt */
-
-/* ADC Start/Stop conversion */
-#define ADC_Conversion_Start 0x0001 /* ADC start conversion */
-#define ADC_Conversion_Stop 0xFFFE /* ADC stop conversion */
-
-/* Module private variables --------------------------------------------------*/
-/* Exported macro ------------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-
-void ADC_DeInit(void);
-void ADC_Init(ADC_InitTypeDef* ADC_InitStruct);
-void ADC_StructInit(ADC_InitTypeDef* ADC_InitStruct);
-void ADC_PrescalerConfig(u8 ADC_Prescaler);
-u8 ADC_GetPrescalerValue(void);
-FlagStatus ADC_GetFlagStatus(u16 ADC_Flag);
-void ADC_ClearFlag(u16 ADC_Flag);
-u16 ADC_GetConversionValue(u16 ADC_Channel);
-FlagStatus ADC_GetAnalogWatchdogResult(u16 ADC_Channel);
-void ADC_ClearAnalogWatchdogResult(u16 ADC_Channel);
-u16 ADC_GetWatchdogThreshold(ADC_ThresholdType ADC_Threshold);
-void ADC_ITConfig(u16 ADC_IT, FunctionalState ADC_NewState);
-void ADC_StandbyModeCmd(FunctionalState ADC_NewState);
-void ADC_Cmd(FunctionalState ADC_NewState);
-void ADC_ConversionCmd(u16 ADC_Conversion);
-
-#endif /* __91x_ADC_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
-
diff --git a/uc_str912/prj_blinky_complex_startup/include/91x_ahbapb.h b/uc_str912/prj_blinky_complex_startup/include/91x_ahbapb.h
deleted file mode 100644
index 1828d48..0000000
--- a/uc_str912/prj_blinky_complex_startup/include/91x_ahbapb.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_ahbapb.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* AHBAPB software library.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef _91x_AHBAPB_H
-#define _91x_AHBAPB_H
-
-#include "91x_map.h"
-
-#define AHBAPB_Split_Enable 0x01000000
-#define AHBAPB_Split_Disable 0xFEFFFFFF
-#define AHBAPB_Error_Enable 0x0000100
-#define AHBAPB_Error_Disable 0xFFFFEFF
-
-/*FLAG*/
-#define AHBAPB_FLAG_ERROR 0x01 /* error flag*/
-#define AHBAPB_FLAG_OUTM 0x10 /* Out of Memory flag */
-#define AHBAPB_FLAG_APBT 0x20 /* APB Time-out flag */
-#define AHBAPB_FLAG_RW 0x40 /*Access type flag*/
-
-/* Includes ------------------------------------------------------------------*/
-
-
-/* AHBAPB Init structure definition */
-typedef struct
-{
- u32 AHBAPB_SetTimeOut;
- u32 AHBAPB_Error;
- u32 AHBAPB_Split;
- u8 AHBAPB_SplitCounter;
-}AHBAPB_InitTypeDef;
-
-/* Exported constants --------------------------------------------------------*/
-void AHBAPB_DeInit(AHBAPB_TypeDef* AHBAPBx);
-void AHBAPB_Init(AHBAPB_TypeDef* AHBAPBx, AHBAPB_InitTypeDef* AHBAPB_InitStruct);
-void AHBAPB_StructInit(AHBAPB_InitTypeDef* AHBAPB_InitStruct);
-FlagStatus AHBAPB_GetFlagStatus(AHBAPB_TypeDef* AHBAPBx, u8 AHBAPB_FLAG);
-void AHBAPB_ClearFlag(AHBAPB_TypeDef* AHBAPBx, u8 AHBAPB_FLAG);
-u32 AHBAPB_GetPeriphAddrError(AHBAPB_TypeDef* AHBAPBx);
-
-
-#endif /* _91x_AHBAPB_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_complex_startup/include/91x_can.h b/uc_str912/prj_blinky_complex_startup/include/91x_can.h
deleted file mode 100644
index b3d0653..0000000
--- a/uc_str912/prj_blinky_complex_startup/include/91x_can.h
+++ /dev/null
@@ -1,165 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_can.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* CAN bus software library.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __91x_CAN_H
-#define __91x_CAN_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_map.h"
-
-/* Exported types ------------------------------------------------------------*/
-
-/* CAN Init structure define */
-typedef struct
-{
- u8 CAN_ConfigParameters;
- u32 CAN_Bitrate;
-}CAN_InitTypeDef;
-
-/* Exported constants --------------------------------------------------------*/
-/* Standard bitrates available*/
-enum
-{
- CAN_BITRATE_100K,
- CAN_BITRATE_125K,
- CAN_BITRATE_250K,
- CAN_BITRATE_500K,
- CAN_BITRATE_1M
-};
-
-/* Control register*/
-#define CAN_CR_TEST 0x0080
-#define CAN_CR_CCE 0x0040
-#define CAN_CR_DAR 0x0020
-#define CAN_CR_EIE 0x0008
-#define CAN_CR_SIE 0x0004
-#define CAN_CR_IE 0x0002
-#define CAN_CR_INIT 0x0001
-
-/* Status register */
-#define CAN_SR_BOFF 0x0080
-#define CAN_SR_EWARN 0x0040
-#define CAN_SR_EPASS 0x0020
-#define CAN_SR_RXOK 0x0010
-#define CAN_SR_TXOK 0x0008
-#define CAN_SR_LEC 0x0007
-
-/* Test register*/
-#define CAN_TESTR_RX 0x0080
-#define CAN_TESTR_TX1 0x0040
-#define CAN_TESTR_TX0 0x0020
-#define CAN_TESTR_LBACK 0x0010
-#define CAN_TESTR_SILENT 0x0008
-#define CAN_TESTR_BASIC 0x0004
-
-/* IFn / Command Request register*/
-#define CAN_CRR_BUSY 0x8000
-
-/* IFn / Command Mask register*/
-#define CAN_CMR_WRRD 0x0080
-#define CAN_CMR_MASK 0x0040
-#define CAN_CMR_ARB 0x0020
-#define CAN_CMR_CONTROL 0x0010
-#define CAN_CMR_CLRINTPND 0x0008
-#define CAN_CMR_TXRQSTNEWDAT 0x0004
-#define CAN_CMR_DATAA 0x0002
-#define CAN_CMR_DATAB 0x0001
-
-/* IFn / Mask 2 register*/
-#define CAN_M2R_MXTD 0x8000
-#define CAN_M2R_MDIR 0x4000
-
-/* IFn / Arbitration 2 register*/
-#define CAN_A2R_MSGVAL 0x8000
-#define CAN_A2R_XTD 0x4000
-#define CAN_A2R_DIR 0x2000
-
-/* IFn / Message Control register*/
-#define CAN_MCR_NEWDAT 0x8000
-#define CAN_MCR_MSGLST 0x4000
-#define CAN_MCR_INTPND 0x2000
-#define CAN_MCR_UMASK 0x1000
-#define CAN_MCR_TXIE 0x0800
-#define CAN_MCR_RXIE 0x0400
-#define CAN_MCR_RMTEN 0x0200
-#define CAN_MCR_TXRQST 0x0100
-#define CAN_MCR_EOB 0x0080
-
-
-/* Wake-up modes*/
-enum
-{
- CAN_WAKEUP_ON_EXT,
- CAN_WAKEUP_ON_CAN
-};
-
-
-/* CAN message structure*/
-typedef struct
-{
- u32 IdType;
- u32 Id;
- u8 Dlc;
- u8 Data[8];
-} canmsg;
-
-/* Message ID types*/
-enum
-{
- CAN_STD_ID,
- CAN_EXT_ID
-};
-
-/* Message ID limits*/
-
-#define CAN_LAST_STD_ID ((1<<11) - 1)
-#define CAN_LAST_EXT_ID ((1L<<29) - 1)
-
-/* Exported functions ------------------------------------------------------- */
-
-void CAN_Init (CAN_InitTypeDef *CAN_InitStruct);
-void CAN_DeInit (void);
-void CAN_StructInit(CAN_InitTypeDef *CAN_InitStruct);
-void CAN_SetBitrate(u32 bitrate);
-void CAN_SetTiming(u32 tseg1, u32 tseg2, u32 sjw, u32 brp);
-ErrorStatus CAN_SetUnusedMsgObj(u32 msgobj);
-ErrorStatus CAN_SetTxMsgObj(u32 msgobj, u32 idType);
-ErrorStatus CAN_SetRxMsgObj(u32 msgobj, u32 idType, u32 idLow, u32 idHigh, bool singleOrFifoLast);
-void CAN_InvalidateAllMsgObj(void);
-ErrorStatus CAN_ReleaseMessage(u32 msgobj);
-ErrorStatus CAN_SendMessage(u32 msgobj, canmsg* pCanMsg);
-ErrorStatus CAN_ReceiveMessage(u32 msgobj, bool release, canmsg* pCanMsg);
-ErrorStatus CAN_WaitEndOfTx(void);
-ErrorStatus CAN_BasicSendMessage(canmsg* pCanMsg);
-ErrorStatus CAN_BasicReceiveMessage(canmsg* pCanMsg);
-void CAN_EnterTestMode(u8 TestMask);
-void CAN_EnterInitMode(u8 InitMask);
-void CAN_LeaveInitMode(void);
-void CAN_LeaveTestMode(void);
-void CAN_ReleaseTxMessage(u32 msgobj);
-void CAN_ReleaseRxMessage(u32 msgobj);
-u32 CAN_IsMessageWaiting(u32 msgobj);
-u32 CAN_IsTransmitRequested(u32 msgobj);
-u32 CAN_IsInterruptPending(u32 msgobj);
-u32 CAN_IsObjectValid(u32 msgobj);
-
-#endif /* __91x_CAN_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_complex_startup/include/91x_dma.h b/uc_str912/prj_blinky_complex_startup/include/91x_dma.h
deleted file mode 100644
index 6a383aa..0000000
--- a/uc_str912/prj_blinky_complex_startup/include/91x_dma.h
+++ /dev/null
@@ -1,247 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : template.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : provide a short description of the source file indicating
-* its purpose.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __91x_DMA_H
-#define __91x_DMA_H
-
-/* Includes ------------------------------------------------------------------*/
-#include"91x_map.h"
-
-
-/* Exported types ------------------------------------------------------------*/
-
-typedef struct
-{
- u32 DMA_Channel_SrcAdd; /* The current source address (byte-aligned) of the data to be transferred.*/
-
- u32 DMA_Channel_DesAdd; /* The current destination address (byte-aligned) of the data to be transferred.*/
-
- u32 DMA_Channel_LLstItm; /* The word- aligned address for the next Linked List Item. */
-
- u32 DMA_Channel_DesWidth; /* Destination transfer width. */
-
- u32 DMA_Channel_SrcWidth; /* Source transfer width. */
-
- u32 DMA_Channel_DesBstSize; /* The destination burst size which indicates the number of transfers that make up a destination burst transfer request.*/
-
- u32 DMA_Channel_SrcBstSize; /* The source burst size.Indicates the number of transfers that make up a source burst */
-
- u32 DMA_Channel_TrsfSize; /* Transfer size which indicates the size of the transfer when the DMA controller is the flow controller*/
-
- u32 DMA_Channel_FlowCntrl; /* Flow control and transfer type. */
-
- u32 DMA_Channel_Src; /* Source peripheral: selects the DMA source request peripheral. */
-
- u32 DMA_Channel_Des; /* Destination peripheral:selects the DMA destination request peripheral. */
-
-} DMA_InitTypeDef;
-
-/* Exported constants --------------------------------------------------------*/
-
- /* Interrupts masks */
-
-#define DMA_ITMask_IE 0x4000 /* Interrupt error mask. */
-#define DMA_ITMask_ITC 0x8000 /* Terminal count interrupt mask.*/
-#define DMA_ITMask_ALL 0xC000 /* All DMA_Channelx interrupts enable/disable mask*/
-
- /* Sources Request (used as masks) */
-
-#define DMA_USB_RX_Mask 0x0001
-#define DMA_USB_TX_Mask 0x0002
-#define DMA_TIM0_Mask 0x0004
-#define DMA_TIM1_Mask 0x0008
-#define DMA_UART0_RX_Mask 0x0010
-#define DMA_UART0_TX_Mask 0x0020
-#define DMA_UART1_RX_Mask 0x0040
-#define DMA_UART1_TX_Mask 0x0080
-#define DMA_External_Req0_Mask 0x0100
-#define DMA_External_Req1_Mask 0x0200
-#define DMA_I2C0_Mask 0x0400
-#define DMA_I2C1_Mask 0x0800
-#define DMA_SSP0_RX_Mask 0x1000
-#define DMA_SSP0_TX_Mask 0x2000
-#define DMA_SSP1_RX_Mask 0x4000
-#define DMA_SSP1_TX_Mask 0x8000
-
-
-/* Previleged Mode and user mode */
-
-#define DMA_PrevilegedMode 0x10000000
-#define DMA_UserMode 0xEFFFFFFF
-
-
-/* Error and Terminal Count interrupts Status, after and before"raw" masking */
-#define DMA_IS 0x01
-#define DMA_TCS 0x02
-#define DMA_ES 0x03
-#define DMA_TCRS 0x04
-#define DMA_ERS 0x05
-
-
-/* interrupt clear: Terminal Count flag Clear and Error flag clear*/
-
-#define DMA_TCC 0x01
-#define DMA_EC 0x02
-
-/* channel index "0...7"*/
-
-#define Channel0 0
-#define Channel1 1
-#define Channel2 2
-#define Channel3 3
-#define Channel4 4
-#define Channel5 5
-#define Channel6 6
-#define Channel7 7
-
-
-
-/* Destination request selection: selects the DMA Destination request peripheral */
-
-#define DMA_DES_USB_RX 0x00
-#define DMA_DES_USB_TX 0x40
-#define DMA_DES_TIM1 0x80
-#define DMA_DES_TIM2 0xC0
-#define DMA_DES_UART0_RX 0x100
-#define DMA_DES_UART0_TX 0x140
-#define DMA_DES_UART1_RX 0x180
-#define DMA_DES_UART1_TX 0x1C0
-#define DMA_DES_External_Req0 0x200
-#define DMA_DES_External_Req1 0x240
-#define DMA_DES_I2C0 0x280
-#define DMA_DES_I2C1 0x2C0
-#define DMA_DES_SSP0_RX 0x300
-#define DMA_DES_SSP0_TX 0x340
-#define DMA_DES_SSP1_RX 0x380
-#define DMA_DES_SSP1_TX 0x3C0
-
-
-
-
-/* Source request selection: selects the DMA Source request peripheral */
-
-#define DMA_SRC_USB_RX 0x00
-#define DMA_SRC_USB_TX 0x02
-#define DMA_SRC_TIM1 0x04
-#define DMA_SRC_TIM2 0x06
-#define DMA_SRC_UART0_RX 0x08
-#define DMA_SRC_UART0_TX 0x0A
-#define DMA_SRC_UART1_RX 0x0C
-#define DMA_SRC_UART1_TX 0x0E
-#define DMA_SRC_External_Req0 0x10
-#define DMA_SRC_External_Req1 0x12
-#define DMA_SRC_I2C0 0x14
-#define DMA_SRC_I2C1 0x16
-#define DMA_SRC_SSP0_RX 0x18
-#define DMA_SRC_SSP0_TX 0x1A
-#define DMA_SRC_SSP1_RX 0x1C
-#define DMA_SRC_SSP1_TX 0x1E
-
-
-
-
-
-#define DMA_FlowCntrlt0_DMA 0x00000000 /* transfer type :Memory-to-memory, flow controller:DMA */
-#define DMA_FlowCntrl1_DMA 0x00000800 /* transfer type :Memory-to-peripheral, flow controller:DMA */
-#define DMA_FlowCntrl2_DMA 0x00001000 /* transfer type :Peripheral-to-memory, flow controller:DMA */
-#define DMA_FlowCntrl3_DMA 0x00001800 /* transfer type :Source peripheral-to-destination peripheral, flow controller:DMA */
-#define DMA_FlowCntrl_DestPerip 0x00002000 /* transfer type :Source peripheral-to-destination peripheral, flow controller:Destination peripheral */
-#define DMA_FlowCntrl_Perip1 0x00002800 /* transfer type :Memory-to-peripheral, flow controller:peripheral */
-#define DMA_FlowCntrl_Perip2 0x00003000 /* transfer type : Peripheral-to-memory, flow controller:peripheral */
-#define DMA_FlowCntrl_SrcPerip 0x00003800 /* transfer type :Source peripheral-to-destination peripheral, flow controller:Source peripheral */
-
-
-
-
-#define DMA_SrcBst_1Data 0x00000000 /* Source Burst transfer request IS 1 Data ( DATA = Source transfer width ) */
-#define DMA_SrcBst_4Data 0x00001000 /* Source Burst transfer request IS 4 Data */
-#define DMA_SrcBst_8Data 0x00002000 /* Source Burst transfer request IS 8 Data */
-#define DMA_SrcBst_16Data 0x00003000 /* Source Burst transfer request IS 16 Data */
-#define DMA_SrcBst_32Data 0x00004000 /* Source Burst transfer request IS 32 Data */
-#define DMA_SrcBst_64Data 0x00005000 /* Source Burst transfer request IS 64Data */
-#define DMA_SrcBst_128Data 0x00006000 /* Source Burst transfer request IS 128 Data */
-#define DMA_SrcBst_256Data 0x00007000 /* Source Burst transfer request IS 256 Data */
-
-
-
-
-#define DMA_DesBst_1Data 0x00000000 /*Destination Burst transfer request IS 1Data ( DATA = destination transfer width ) */
-#define DMA_DesBst_4Data 0x00008000 /*Destination Burst transfer request IS 1 Data */
-#define DMA_DesBst_8Data 0x00010000 /*Destination Burst transfer request IS 4 Data */
-#define DMA_DesBst_16Data 0x00018000 /*Destination Burst transfer request IS 8 Data */
-#define DMA_DesBst_32Data 0x00020000 /*Destination Burst transfer request IS 16 Data */
-#define DMA_DesBst_64Data 0x00028000 /*Destination Burst transfer request IS 32 Data */
-#define DMA_DesBst_128Data 0x00030000 /*Destination Burst transfer request IS 128 Data */
-#define DMA_DesBst_256Data 0x00038000 /*Destination Burst transfer request IS 256 Data */
-
-
-
-
-
-#define DMA_SrcWidth_Byte 0x00000000 /* source Width is one Byte */
-#define DMA_SrcWidth_HalfWord 0x00040000 /* source Width is one HalfWord */
-#define DMA_SrcWidth_Word 0x00080000 /* source Width is one Word */
-
-
-
-
-#define DMA_DesWidth_Byte 0x00000000 /* Destination Width is one Byte */
-#define DMA_DesWidth_HalfWord 0x00200000 /* Destination Width is one HalfWord */
-#define DMA_DesWidth_Word 0x00400000 /* Destination Width is one Word */
-
-
-
-
-
-
-/* Exported macro ------------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-
-void DMA_DeInit(void);
-void DMA_Init(DMA_Channel_TypeDef * DMA_Channelx, DMA_InitTypeDef * DMA_InitStruct);
-void DMA_StructInit(DMA_InitTypeDef *DMA_InitStruct);
-void DMA_Cmd(FunctionalState NewState);
-void DMA_ITMaskConfig(DMA_Channel_TypeDef * DMA_Channelx, u16 DMA_ITMask, FunctionalState NewState);
-void DMA_ITConfig(DMA_Channel_TypeDef * DMA_Channelx, FunctionalState NewState);
-FlagStatus DMA_GetChannelStatus(u8 ChannelIndx );
-ITStatus DMA_GetITStatus(u8 ChannelIndx,u8 DMA_ITReq);
-void DMA_ClearIT(u8 ChannelIndx,u8 DMA_ITClr);
-void DMA_SyncConfig(u16 DMA_SrcReq, FunctionalState NewState);
-FlagStatus DMA_GetSReq(u16 DMA_SrcReq);
-FlagStatus DMA_GetLSReq(u16 DMA_SrcReq);
-FlagStatus DMA_GetBReq(u16 DMA_SrcReq);
-FlagStatus DMA_GetLBReq(u16 DMA_SrcReq);
-FlagStatus DMA_GetChannelActiveStatus( DMA_Channel_TypeDef * DMA_Channelx);
-void DMA_SetSReq(u16 DMA_SrcReq);
-void DMA_SetLSReq(u16 DMA_SrcReq);
-void DMA_SetBReq(u16 DMA_SrcReq);
-void DMA_SetLBReq(u16 DMA_SrcReq);
-void DMA_ChannelCmd (DMA_Channel_TypeDef * DMA_Channelx,FunctionalState NewState);
-void DMA_ChannelHalt (DMA_Channel_TypeDef * DMA_Channelx,FunctionalState NewState);
-void DMA_ChannelBuffering (DMA_Channel_TypeDef * DMA_Channelx,FunctionalState NewState);
-void DMA_ChannelLockTrsf(DMA_Channel_TypeDef * DMA_Channelx,FunctionalState NewState);
-void DMA_ChannelCache(DMA_Channel_TypeDef * DMA_Channelx,FunctionalState NewState);
-void DMA_ChannelProt0Mode(DMA_Channel_TypeDef * DMA_Channelx,u32 Prot0Mode);
-void DMA_ChannelSRCIncConfig (DMA_Channel_TypeDef * DMA_Channelx, FunctionalState NewState);
-void DMA_ChannelDESIncConfig (DMA_Channel_TypeDef * DMA_Channelx, FunctionalState NewState);
-
-#endif /* __91x_DMA_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_complex_startup/include/91x_emi.h b/uc_str912/prj_blinky_complex_startup/include/91x_emi.h
deleted file mode 100644
index 4633020..0000000
--- a/uc_str912/prj_blinky_complex_startup/include/91x_emi.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_emi.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* EMI software library.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __91x_EMI_H
-#define __91x_EMI_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_map.h"
-
-/* Exported types ------------------------------------------------------------*/
- typedef struct
- {
- u32 EMI_Bank_IDCY;
-
- u32 EMI_Bank_WSTRD;
-
- u32 EMI_Bank_WSTWR;
-
- u32 EMI_Bank_WSTROEN;
-
- u32 EMI_Bank_WSTWEN;
-
- u32 EMI_Bank_MemWidth ;
-
- u32 EMI_Bank_WriteProtection;
-
- u32 EMI_PageModeRead_TransferLength;
-
- u32 EMI_PageModeRead_Selection;
-
- } EMI_InitTypeDef;
-
-/* Exported constants --------------------------------------------------------*/
-
-
-/* page transfer length for page mode read */
-#define EMI_4Data 0x00000000 /*4 transfers burst*/
-#define EMI_8Data 0x00000400 /*8 transfers burst*/
-
-
-/*Select or deselect the page mode read*/
-#define EMI_NormalMode 0x00000000 /*Normal Mode*/
-#define EMI_PageModeRead 0x00000100 /*Page Mode Read*/
-
-
-/*memory width*/
-#define EMI_Width_Byte 0x00000000 /*8 bits width*/
-#define EMI_Width_HalfWord 0x00000010 /*16 bits width*/
-
-/*Write protection feature */
-#define EMI_Bank_NonWriteProtect 0x00000000 /*No write protection*/
-#define EMI_Bank_WriteProtect 0x00000008 /*bank is write protected*/
-
-
-/* Exported macro ------------------------------------------------------------*/
-
-
-/* Exported functions ------------------------------------------------------- */
-
-void EMI_DeInit(void);
-void EMI_Init( EMI_Bank_TypeDef* EMI_Bankx, EMI_InitTypeDef* EMI_InitStruct);
-void EMI_StructInit(EMI_InitTypeDef* EMI_InitStruct);
-
-#endif /* __EMI_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_complex_startup/include/91x_fmi.h b/uc_str912/prj_blinky_complex_startup/include/91x_fmi.h
deleted file mode 100644
index 06e8115..0000000
--- a/uc_str912/prj_blinky_complex_startup/include/91x_fmi.h
+++ /dev/null
@@ -1,184 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_fmi.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* FMI software library.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-
-/* Define to prevent recursive inclusion ------------------------------------ */
-
-#ifndef __91x_FMI_H
-#define __91x_FMI_H
-
-/* ========================================================================== */
-/* When bank 1 is remapped at address 0x0, decomment the following line */
-/* ========================================================================== */
-
-//#define Remap_Bank_1
-
-
-/* Includes ------------------------------------------------------------------*/
-
-#include "91x_map.h"
-
-/* Exported types ------------------------------------------------------------*/
-/* Exported constants --------------------------------------------------------*/
-
-/* FMI banks */
-
-#ifdef Remap_Bank_1
-
-#define FMI_BANK_0 ((*(vu32*)0x54000010) << 2) /* FMI Bank 0 */
-#define FMI_BANK_1 ((*(vu32*)0x5400000C) << 2) /* FMI Bank 1 */
-
-#else /* Remap Bank 0 */
-
-#define FMI_BANK_0 ((*(vu32*)0x5400000C) << 2) /* FMI Bank 0 */
-#define FMI_BANK_1 ((*(vu32*)0x54000010) << 2) /* FMI Bank 1 */
-
-#endif
-
-/* FMI sectors */
-
-#define FMI_B0S0 0x00000000 + FMI_BANK_0 /* Bank 0 sector 0 */
-#define FMI_B0S1 0x00010000 + FMI_BANK_0 /* Bank 0 sector 1 */
-#define FMI_B0S2 0x00020000 + FMI_BANK_0 /* Bank 0 sector 2 */
-#define FMI_B0S3 0x00030000 + FMI_BANK_0 /* Bank 0 sector 3 */
-#define FMI_B0S4 0x00040000 + FMI_BANK_0 /* Bank 0 sector 4 */
-#define FMI_B0S5 0x00050000 + FMI_BANK_0 /* Bank 0 sector 5 */
-#define FMI_B0S6 0x00060000 + FMI_BANK_0 /* Bank 0 sector 6 */
-#define FMI_B0S7 0x00070000 + FMI_BANK_0 /* Bank 0 sector 7 */
-
-#define FMI_B1S0 0x00000000 + FMI_BANK_1 /* Bank 1 sector 0 */
-#define FMI_B1S1 0x00002000 + FMI_BANK_1 /* Bank 1 sector 1 */
-#define FMI_B1S2 0x00004000 + FMI_BANK_1 /* Bank 1 sector 2 */
-#define FMI_B1S3 0x00006000 + FMI_BANK_1 /* Bank 1 sector 3 */
-
-/* FMI Flags */
-
-#define FMI_FLAG_SPS 0x02 /* Sector Protection Status Flag */
-#define FMI_FLAG_PSS 0x04 /* Program Suspend Status Flag */
-#define FMI_FLAG_PS 0x10 /* Program Status Flag */
-#define FMI_FLAG_ES 0x20 /* Erase Status Flag */
-#define FMI_FLAG_ESS 0x40 /* Erase Suspend Status Flag */
-#define FMI_FLAG_PECS 0x80 /* FPEC Status Flag */
-
-/* FMI read wait states */
-
-#define FMI_READ_WAIT_STATE_1 0x0000 /* One read wait state */
-#define FMI_READ_WAIT_STATE_2 0x2000 /* Two read wait states */
-#define FMI_READ_WAIT_STATE_3 0x4000 /* Three read wait states */
-
-/* FMI write wait states */
-
-#define FMI_WRITE_WAIT_STATE_0 0xFFFFFEFF /* Zero wait state */
-#define FMI_WRITE_WAIT_STATE_1 0x00000100 /* One wait state */
-
-/* FMI power down configuration */
-
-#define FMI_PWD_ENABLE 0x1000 /* FMI Power Down Enable */
-#define FMI_PWD_DISABLE 0x0000 /* FMI Power Down Disable */
-
-/* FMI low voltage detector */
-
-#define FMI_LVD_ENABLE 0x0000 /* FMI Low Voltage Detector Enable */
-#define FMI_LVD_DISABLE 0x0800 /* FMI Low Voltage Detector Disable */
-
-/* FMI frequency range */
-
-#define FMI_FREQ_LOW 0x0000 /* FMI Low bus working frequency */
-#define FMI_FREQ_HIGH 0x0040 /* FMI High bus working gfrequency */
- /* Above 66 MHz*/
-/* FMI OTP word addresses */
-
-#define FMI_OTP_WORD_0 0x00 /* OTP word 0 */
-#define FMI_OTP_WORD_1 0x04 /* OTP word 1 */
-#define FMI_OTP_WORD_2 0x08 /* OTP word 2 */
-#define FMI_OTP_WORD_3 0x0C /* OTP word 3 */
-#define FMI_OTP_WORD_4 0x10 /* OTP word 4 */
-#define FMI_OTP_WORD_5 0x14 /* OTP word 5 */
-#define FMI_OTP_WORD_6 0x18 /* OTP word 6 */
-#define FMI_OTP_WORD_7 0x1C /* OTP word 7 */
-
-/* FMI OTP halfword addresses */
-
-#define FMI_OTP_LOW_HALFWORD_0 0x00 /* OTP Low halfword 0 */
-#define FMI_OTP_HIGH_HALFWORD_0 0x02 /* OTP High halfword 0 */
-#define FMI_OTP_LOW_HALFWORD_1 0x04 /* OTP Low halfword 1 */
-#define FMI_OTP_HIGH_HALFWORD_1 0x06 /* OTP High halfword 1 */
-#define FMI_OTP_LOW_HALFWORD_2 0x08 /* OTP Low halfword 2 */
-#define FMI_OTP_HIGH_HALFWORD_2 0x0A /* OTP High halfword 2 */
-#define FMI_OTP_LOW_HALFWORD_3 0x0C /* OTP Low halfword 3 */
-#define FMI_OTP_HIGH_HALFWORD_3 0x0E /* OTP High halfword 3 */
-#define FMI_OTP_LOW_HALFWORD_4 0x10 /* OTP Low halfword 4 */
-#define FMI_OTP_HIGH_HALFWORD_4 0x12 /* OTP High halfword 4 */
-#define FMI_OTP_LOW_HALFWORD_5 0x14 /* OTP Low halfword 5 */
-#define FMI_OTP_HIGH_HALFWORD_5 0x16 /* OTP High halfword 5 */
-#define FMI_OTP_LOW_HALFWORD_6 0x18 /* OTP Low halfword 6 */
-#define FMI_OTP_HIGH_HALFWORD_6 0x1A /* OTP High halfword 6 */
-#define FMI_OTP_LOW_HALFWORD_7 0x1C /* OTP Low halfword 7 */
-#define FMI_OTP_HIGH_HALFWORD_7 0x1E /* OTP High halfword 7 */
-
-/* FMI sectors Masks */
-
-#define FMI_B0S0_MASK 0x0001 /* FMI B0S0 mask */
-#define FMI_B0S1_MASK 0x0002 /* FMI B0S1 mask */
-#define FMI_B0S2_MASK 0x0004 /* FMI B0S2 mask */
-#define FMI_B0S3_MASK 0x0008 /* FMI B0S3 mask */
-#define FMI_B0S4_MASK 0x0010 /* FMI B0S4 mask */
-#define FMI_B0S5_MASK 0x0020 /* FMI B0S5 mask */
-#define FMI_B0S6_MASK 0x0040 /* FMI B0S6 mask */
-#define FMI_B0S7_MASK 0x0080 /* FMI B0S7 mask */
-
-#define FMI_B1S0_MASK 0x0100 /* FMI B1S0 mask */
-#define FMI_B1S1_MASK 0x0200 /* FMI B1S1 mask */
-#define FMI_B1S2_MASK 0x0400 /* FMI B1S2 mask */
-#define FMI_B1S3_MASK 0x0800 /* FMI B1S3 mask */
-
-/* Timeout error */
-
-#define FMI_TIME_OUT_ERROR 0x00 /* Timeout error */
-#define FMI_NO_TIME_OUT_ERROR 0x01 /* No Timeout error */
-
-/* Module private variables --------------------------------------------------*/
-/* Exported macro ------------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-
-void FMI_BankRemapConfig(u8 FMI_BootBankSize, u8 FMI_NonBootBankSize, \
- u32 FMI_BootBankAddress, u32 FMI_NonBootBankAddress);
-void FMI_Config(u16 FMI_ReadWaitState, u32 FMI_WriteWaitState, u16 FMI_PWD,\
- u16 FMI_LVDEN, u16 FMI_FreqRange);
-void FMI_EraseSector(vu32 FMI_Sector);
-void FMI_EraseBank(vu32 FMI_Bank);
-void FMI_WriteHalfWord(u32 FMI_Address, u16 FMI_Data);
-void FMI_WriteOTPHalfWord(u8 FMI_OTPHWAddress, u16 FMI_OTPData);
-u32 FMI_ReadWord(u32 FMI_Address);
-u32 FMI_ReadOTPData(u8 FMI_OTPAddress);
-FlagStatus FMI_GetFlagStatus(u8 FMI_Flag, vu32 FMI_Bank);
-u16 FMI_GetReadWaitStateValue(void);
-u16 FMI_GetWriteWaitStateValue(void);
-void FMI_SuspendEnable(vu32 FMI_Bank);
-void FMI_ResumeEnable(vu32 FMI_Bank);
-void FMI_ClearFlag(vu32 FMI_Bank);
-void FMI_WriteProtectionCmd(vu32 FMI_Sector, FunctionalState FMI_NewState);
-FlagStatus FMI_GetWriteProtectionStatus(u32 FMI_Sector_Protection);
-u8 FMI_WaitForLastOperation(vu32 FMI_Bank);
-
-#endif /* __91x_FMI_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
-
diff --git a/uc_str912/prj_blinky_complex_startup/include/91x_gpio.h b/uc_str912/prj_blinky_complex_startup/include/91x_gpio.h
deleted file mode 100644
index 4beab75..0000000
--- a/uc_str912/prj_blinky_complex_startup/include/91x_gpio.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_gpio.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* GPIO software library.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion ------------------------------------ */
-
-#ifndef _91x_GPIO_H
-#define _91x_GPIO_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_map.h"
-
-/* GPIO Init structure definition */
-typedef struct
-{
- u8 GPIO_Pin;
- u8 GPIO_Direction;
- u8 GPIO_Type;
- u8 GPIO_IPConnected;
- u16 GPIO_Alternate;
-}GPIO_InitTypeDef;
-
-/* Bit_SET and Bit_RESET enumeration */
-typedef enum
-{ Bit_RESET = 0,
- Bit_SET
-}BitAction;
-
-
-/* Exported constants --------------------------------------------------------*/
-#define GPIO_Pin_None 0x00
-#define GPIO_Pin_0 0x01
-#define GPIO_Pin_1 0x02
-#define GPIO_Pin_2 0x04
-#define GPIO_Pin_3 0x08
-#define GPIO_Pin_4 0x10
-#define GPIO_Pin_5 0x20
-#define GPIO_Pin_6 0x40
-#define GPIO_Pin_7 0x80
-#define GPIO_Pin_All 0xFF
-
-#define GPIO_PinInput 0x00
-#define GPIO_PinOutput 0x01
-
-#define GPIO_Type_PushPull 0x00
-#define GPIO_Type_OpenCollector 0x01
-
-#define GPIO_IPConnected_Disable 0x00
-#define GPIO_IPConnected_Enable 0x01
-
-#define GPIO_InputAlt1 0x00
-#define GPIO_OutputAlt1 0x01
-#define GPIO_OutputAlt2 0x02
-#define GPIO_OutputAlt3 0x03
-
-#define GPIO_ANAChannel0 0x01
-#define GPIO_ANAChannel1 0x02
-#define GPIO_ANAChannel2 0x04
-#define GPIO_ANAChannel3 0x08
-#define GPIO_ANAChannel4 0x10
-#define GPIO_ANAChannel5 0x20
-#define GPIO_ANAChannel6 0x40
-#define GPIO_ANAChannel7 0x80
-#define GPIO_ANAChannelALL 0xFF
-
-void GPIO_DeInit(GPIO_TypeDef* GPIOx);
-void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct);
-void GPIO_StructInit(GPIO_InitTypeDef* GPIO_InitStruct);
-u8 GPIO_ReadBit(GPIO_TypeDef* GPIOx, u8 GPIO_Pin);
-u8 GPIO_Read(GPIO_TypeDef* GPIOx);
-void GPIO_WriteBit(GPIO_TypeDef* GPIOx, u8 GPIO_Pin, BitAction BitVal);
-void GPIO_Write(GPIO_TypeDef* GPIOx, u8 PortVal);
-void GPIO_EMIConfig(FunctionalState NewState);
-void GPIO_ANAPinConfig(u8 GPIO_ANAChannel, FunctionalState NewState);
-
-#endif /* _91x_GPIO_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_complex_startup/include/91x_i2c.h b/uc_str912/prj_blinky_complex_startup/include/91x_i2c.h
deleted file mode 100644
index f4d0c66..0000000
--- a/uc_str912/prj_blinky_complex_startup/include/91x_i2c.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_i2c.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* I2C software library.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion ------------------------------------ */
-#ifndef __91x_I2C_H
-#define __91x_I2C_H
-
-/* Includes ----------------------------------------------------------------- */
-#include "91x_map.h"
-
-/* Exported types ----------------------------------------------------------- */
-/* I2C Init structure definition */
-typedef struct
-{
- u32 I2C_CLKSpeed;
- u16 I2C_OwnAddress;
- u8 I2C_GeneralCall;
- u8 I2C_Ack;
-}I2C_InitTypeDef;
-
-/* Exported constants --------------------------------------------------------*/
-#define I2C_GeneralCall_Enable 0x10
-#define I2C_GeneralCall_Disable 0xEF
-/* Acknowledgement */
-#define I2C_Ack_Enable 0x04
-#define I2C_Ack_Disable 0xFB
-
-/* I2C Flags */
-#define I2C_FLAG_SB 0x0001
-#define I2C_FLAG_M_SL 0x0002
-#define I2C_FLAG_ADSL 0x0004
-#define I2C_FLAG_BTF 0x0008
-#define I2C_FLAG_BUSY 0x0010
-#define I2C_FLAG_TRA 0x0020
-#define I2C_FLAG_ADD10 0x0040
-#define I2C_FLAG_EVF 0x0080
-#define I2C_FLAG_GCAL 0x0100
-#define I2C_FLAG_BERR 0x0200
-#define I2C_FLAG_ARLO 0x0400
-#define I2C_FLAG_STOPF 0x0800
-#define I2C_FLAG_AF 0x1000
-#define I2C_FLAG_ENDAD 0x2000
-#define I2C_FLAG_ACK 0x4000
-
-/* I2C Events */
-#define I2C_EVENT_SLAVE_ADDRESS_MATCHED ( I2C_FLAG_EVF | I2C_FLAG_BUSY | I2C_FLAG_ADSL)
-#define I2C_EVENT_SLAVE_BYTE_RECEIVED ( I2C_FLAG_EVF | I2C_FLAG_BUSY | I2C_FLAG_BTF )
-#define I2C_EVENT_SLAVE_BYTE_TRANSMITTED ( I2C_FLAG_EVF | I2C_FLAG_BUSY | I2C_FLAG_BTF | I2C_FLAG_TRA )
-#define I2C_EVENT_MASTER_MODE_SELECT ( I2C_FLAG_EVF | I2C_FLAG_BUSY | I2C_FLAG_M_SL | I2C_FLAG_SB )
-#define I2C_EVENT_MASTER_MODE_SELECTED ( I2C_FLAG_EVF | I2C_FLAG_BUSY | I2C_FLAG_M_SL | I2C_FLAG_ENDAD )
-#define I2C_EVENT_MASTER_BYTE_RECEIVED ( I2C_FLAG_EVF | I2C_FLAG_BUSY | I2C_FLAG_M_SL | I2C_FLAG_BTF )
-#define I2C_EVENT_MASTER_BYTE_TRANSMITTED ( I2C_FLAG_EVF | I2C_FLAG_BUSY | I2C_FLAG_M_SL | I2C_FLAG_BTF | I2C_FLAG_TRA )
-#define I2C_EVENT_MASTER_MODE_ADDRESS10 ( I2C_FLAG_EVF | I2C_FLAG_BUSY | I2C_FLAG_M_SL |I2C_FLAG_ADD10 )
-#define I2C_EVENT_SLAVE_STOP_DETECTED I2C_FLAG_STOPF
-#define I2C_EVENT_SLAVE_ACK_FAILURE ( I2C_FLAG_EVF | I2C_FLAG_BUSY | I2C_FLAG_BTF | I2C_FLAG_TRA | I2C_FLAG_AF)
-
-#define I2C_BUS_ERROR_DETECTED I2C_FLAG_BERR
-#define I2C_ARBITRATION_LOST I2C_FLAG_ARLO
-#define I2C_SLAVE_GENERAL_CALL (I2C_FLAG_BUSY | I2C_FLAG_GCAL)
-
-/* Master/Receiver Mode */
-#define I2C_MODE_TRANSMITTER 0x00
-#define I2C_MODE_RECEIVER 0x01
-
-/* I2C Registers offset */
-#define I2C_CR 0x00
-#define I2C_SR1 0x04
-#define I2C_SR2 0x08
-#define I2C_CCR 0x0C
-#define I2C_OAR1 0x10
-#define I2C_OAR2 0x14
-#define I2C_DR 0x18
-#define I2C_ECCR 0x1C
-
-/* Exported macro ------------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-void I2C_DeInit(I2C_TypeDef* I2Cx);
-void I2C_Init(I2C_TypeDef* I2Cx, I2C_InitTypeDef* I2C_InitStruct);
-void I2C_StructInit(I2C_InitTypeDef* I2C_InitStruct);
-void I2C_Cmd(I2C_TypeDef* I2Cx, FunctionalState NewState);
-void I2C_GenerateStart(I2C_TypeDef* I2Cx, FunctionalState NewState);
-void I2C_GenerateSTOP(I2C_TypeDef* I2Cx, FunctionalState NewState);
-void I2C_AcknowledgeConfig(I2C_TypeDef *I2Cx, FunctionalState NewState);
-void I2C_ITConfig(I2C_TypeDef *I2Cx, FunctionalState NewState);
-void I2C_Send7bitAddress(I2C_TypeDef* I2Cx, u8 Address, u8 Direction);
-u8 I2C_ReadRegister(I2C_TypeDef* I2Cx, u8 I2C_Register);
-FlagStatus I2C_GetFlagStatus(I2C_TypeDef* I2Cx, u16 I2C_FLAG);
-void I2C_ClearFlag(I2C_TypeDef* I2Cx, u16 I2C_FLAG, ...);
-void I2C_SendData(I2C_TypeDef* I2Cx, u8 bData);
-u8 I2C_ReceiveData(I2C_TypeDef* I2Cx);
-u16 I2C_GetLastEvent(I2C_TypeDef* I2Cx);
-ErrorStatus I2C_CheckEvent(I2C_TypeDef* I2Cx,u16 I2C_Event);
-
-#endif /* __91x_I2C_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_complex_startup/include/91x_it.h b/uc_str912/prj_blinky_complex_startup/include/91x_it.h
deleted file mode 100644
index a8e35fc..0000000
--- a/uc_str912/prj_blinky_complex_startup/include/91x_it.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_it.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains the headers of the interrupt
-* handlers'routines
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion ------------------------------------ */
-#ifndef _91x_IT_H
-#define _91x_IT_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_lib.h"
-
-/* Exported types ------------------------------------------------------------*/
-/* Exported constants --------------------------------------------------------*/
-/* Module private variables --------------------------------------------------*/
-/* Exported macro ------------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-void Undefined_Handler (void);
-void SWI_Handler (void);
-void Prefetch_Handler (void);
-void Abort_Handler (void);
-void FIQ_Handler (void);
-void WDG_IRQHandler (void);
-void SW_IRQHandler (void);
-void ARMRX_IRQHandler (void);
-void ARMTX_IRQHandler (void);
-void TIM0_IRQHandler (void);
-void TIM1_IRQHandler (void);
-void TIM2_IRQHandler (void);
-void TIM3_IRQHandler (void);
-void USBHP_IRQHandler (void);
-void USBLP_IRQHandler (void);
-void SCU_IRQHandler (void);
-void ENET_IRQHandler (void);
-void DMA_IRQHandler (void);
-void CAN_IRQHandler (void);
-void MC_IRQHandler (void);
-void ADC_IRQHandler (void);
-void UART0_IRQHandler (void);
-void UART1_IRQHandler (void);
-void UART2_IRQHandler (void);
-void I2C0_IRQHandler (void);
-void I2C1_IRQHandler (void);
-void SSP0_IRQHandler (void);
-void SSP1_IRQHandler (void);
-void LVD_IRQHandler (void);
-void RTC_IRQHandler (void);
-void WIU_IRQHandler (void);
-void EXTIT0_IRQHandler (void);
-void EXTIT1_IRQHandler (void);
-void EXTIT2_IRQHandler (void);
-void EXTIT3_IRQHandler (void);
-void USBWU_IRQHandler (void);
-void PFQBC_IRQHandler (void);
-
-#endif /* _91x_IT_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_complex_startup/include/91x_lib.h b/uc_str912/prj_blinky_complex_startup/include/91x_lib.h
deleted file mode 100644
index 823b250..0000000
--- a/uc_str912/prj_blinky_complex_startup/include/91x_lib.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_lib.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : Used to include the peripherals header file in the
-* user application.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-#ifndef __91x_LIB_H
-#define __91x_LIB_H
-
-#include "91x_map.h"
-#include "91x_conf.h"
-
-#ifdef _AHBAPB
- #include "91x_ahbapb.h"
-#endif /* _AHBAPB */
-
-#ifdef _EMI
- #include "91x_emi.h"
-#endif /* _EMI */
-
-#ifdef _DMA
- #include "91x_dma.h"
-#endif /* _DMA */
-
-#ifdef _FMI
- #include "91x_fmi.h"
-#endif /* _FMI */
-
-#ifdef _VIC
- #include "91x_vic.h"
-#endif /* _VIC */
-
-#ifdef _WIU
- #include "91x_wiu.h"
-#endif /* _WIU */
-
-#ifdef _TIM
- #include "91x_tim.h"
-#endif /* _TIM */
-
-#ifdef _GPIO
- #include "91x_gpio.h"
-#endif /* _GPIO */
-
-#ifdef _RTC
- #include "91x_rtc.h"
-#endif /* _RTC */
-
-#ifdef _SCU
- #include "91x_scu.h"
-#endif /* _SCU */
-
-#ifdef _UART
- #include "91x_uart.h"
-#endif /* _UART */
-
-#ifdef _SSP
- #include "91x_ssp.h"
-#endif /* _SSP */
-
-#ifdef _CAN
- #include "91x_can.h"
-#endif /* _CAN */
-
-#ifdef _ADC
- #include "91x_adc.h"
-#endif /* _ADC */
-
-#ifdef _WDG
- #include "91x_wdg.h"
-#endif /* _WDG */
-
-#ifdef _I2C
- #include "91x_i2c.h"
-#endif /* _I2C */
-
-#ifdef _WIU
- #include "91x_wiu.h"
-#endif
-
-#ifdef _MC
- #include "91x_mc.h"
-#endif
-
-#ifdef _ENET
- #include "91x_enet.h"
-#endif
-
-/* Exported types ------------------------------------------------------------*/
-/* Exported constants --------------------------------------------------------*/
-/* Module private variables --------------------------------------------------*/
-/* Exported macro ------------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-
- void debug( void );
-
-
-#endif /* __91x_LIB_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_complex_startup/include/91x_map.h b/uc_str912/prj_blinky_complex_startup/include/91x_map.h
deleted file mode 100644
index 2e94a91..0000000
--- a/uc_str912/prj_blinky_complex_startup/include/91x_map.h
+++ /dev/null
@@ -1,878 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_map.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : Peripherals registers definition and memory mapping.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion ------------------------------------ */
-#ifndef __91x_MAP_H
-#define __91x_MAP_H
-
-#ifndef EXT
- #define EXT extern
-#endif /* EXT */
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_conf.h"
-#include "91x_type.h"
-
-/******************************************************************************/
-/* IP registers structures */
-/******************************************************************************/
-
-/*------------------------------------ FMI -----------------------------------*/
-
-typedef struct
-{
- vu32 BBSR; /* Boot Bank Size Register */
- vu32 NBBSR; /* Non-Boot Bank Size Register */
- vu32 EMPTY1;
- vu32 BBADR; /* Boot Bank Base Address Register */
- vu32 NBBADR; /* Non-Boot Bank Base Address Register */
- vu32 EMPTY2;
- vu32 CR; /* Control Register */
- vu32 SR; /* Status Register */
- vu32 BCE5ADDR; /* BC Fifth Entry Target Address Register */
-} FMI_TypeDef;
-
-/*---------------------- Analog to Digital Convertor ------------------------*/
-
-typedef struct
-{
- vu16 CR; /* Control Register */
- vu16 EMPTY1;
- vu16 CCR; /* Channel Configuration Register */
- vu16 EMPTY2;
- vu16 HTR; /* Higher Threshold Register */
- vu16 EMPTY3;
- vu16 LTR; /* Lower Threshold Register */
- vu16 EMPTY4;
- vu16 CRR; /* Compare Result Register */
- vu16 EMPTY5;
- vu16 DR0; /* Data Register for Channel 0 */
- vu16 EMPTY6;
- vu16 DR1; /* Data Register for Channel 1 */
- vu16 EMPTY7;
- vu16 DR2; /* Data Register for Channel 2 */
- vu16 EMPTY8;
- vu16 DR3; /* Data Register for Channel 3 */
- vu16 EMPTY9;
- vu16 DR4; /* Data Register for Channel 4 */
- vu16 EMPTY10;
- vu16 DR5; /* Data Register for Channel 5 */
- vu16 EMPTY11;
- vu16 DR6; /* Data Register for Channel 6 */
- vu16 EMPTY12;
- vu16 DR7; /* Data Register for Channel 7 */
- vu16 EMPTY13;
- vu16 PRS; /* Prescaler Value Register */
- vu16 EMPTY14;
-} ADC_TypeDef;
-
-/*--------------------- AHB APB BRIDGE registers strcture --------------------*/
-
-typedef struct
-{
- vu32 BSR; /* Bridge Status Register */
- vu32 BCR; /* Bridge Configuration Register */
- vu32 PAER; /* Peripheral Address Error register */
-} AHBAPB_TypeDef;
-
-/*--------------- Controller Area Network Interface Register -----------------*/
-
-typedef struct
-{
- vu16 CRR; /* IFn Command request Register */
- vu16 EMPTY1;
- vu16 CMR; /* IFn Command Mask Register */
- vu16 EMPTY2;
- vu16 M1R; /* IFn Message Mask 1 Register */
- vu16 EMPTY3;
- vu16 M2R; /* IFn Message Mask 2 Register */
- vu16 EMPTY4;
- vu16 A1R; /* IFn Message Arbitration 1 Register */
- vu16 EMPTY5;
- vu16 A2R; /* IFn Message Arbitration 2 Register */
- vu16 EMPTY6;
- vu16 MCR; /* IFn Message Control Register */
- vu16 EMPTY7;
- vu16 DA1R; /* IFn DATA A 1 Register */
- vu16 EMPTY8;
- vu16 DA2R; /* IFn DATA A 2 Register */
- vu16 EMPTY9;
- vu16 DB1R; /* IFn DATA B 1 Register */
- vu16 EMPTY10;
- vu16 DB2R; /* IFn DATA B 2 Register */
- vu16 EMPTY11[27];
-} CAN_MsgObj_TypeDef;
-
-typedef struct
-{
- vu16 CR; /* Control Register */
- vu16 EMPTY1;
- vu16 SR; /* Status Register */
- vu16 EMPTY2;
- vu16 ERR; /* Error counter Register */
- vu16 EMPTY3;
- vu16 BTR; /* Bit Timing Register */
- vu16 EMPTY4;
- vu16 IDR; /* Interrupt Identifier Register */
- vu16 EMPTY5;
- vu16 TESTR; /* Test Register */
- vu16 EMPTY6;
- vu16 BRPR; /* BRP Extension Register */
- vu16 EMPTY7[3];
- CAN_MsgObj_TypeDef sMsgObj[2];
- vu16 EMPTY8[16];
- vu16 TXR1R; /* Transmission request 1 Register */
- vu16 EMPTY9;
- vu16 TXR2R; /* Transmission Request 2 Register */
- vu16 EMPTY10[13];
- vu16 ND1R; /* New Data 1 Register */
- vu16 EMPTY11;
- vu16 ND2R; /* New Data 2 Register */
- vu16 EMPTY12[13];
- vu16 IP1R; /* Interrupt Pending 1 Register */
- vu16 EMPTY13;
- vu16 IP2R; /* Interrupt Pending 2 Register */
- vu16 EMPTY14[13];
- vu16 MV1R; /* Message Valid 1 Register */
- vu16 EMPTY15;
- vu16 MV2R; /* Message VAlid 2 Register */
- vu16 EMPTY16;
-} CAN_TypeDef;
-
-/*----------------------- System Control Unit---------------------------------*/
-
-typedef struct
-{
- vu32 CLKCNTR; /* Clock Control Register */
- vu32 PLLCONF; /* PLL Configuration Register */
- vu32 SYSSTATUS; /* System Status Register */
- vu32 PWRMNG; /* Power Management Register */
- vu32 ITCMSK; /* Interrupt Mask Register */
- vu32 PCGRO; /* Peripheral Clock Gating Register 0 */
- vu32 PCGR1; /* Peripheral Clock Gating Register 1 */
- vu32 PRR0; /* Peripheral Reset Register 0 */
- vu32 PRR1; /* Peripheral Reset Register 1 */
- vu32 MGR0; /* Idle Mode Mask Gating Register 0 */
- vu32 MGR1; /* Idle Mode Mask Gating Register 1 */
- vu32 PECGR0; /* Peripheral Emulation Clock Gating Register 0 */
- vu32 PECGR1; /* Peripheral Emulation Clock Gating Register 1 */
- vu32 SCR0; /* System Configuration Register 0 */
- vu32 SCR1; /* System Configuration Register 1 */
- vu32 SCR2; /* System Configuration Register 2 */
- u32 EMPTY1;
- vu32 GPIOOUT[8]; /* GPIO Output Registers */
- vu32 GPIOIN[8]; /* GPIO Input Registers */
- vu32 GPIOTYPE[10];/* GPIO Type Registers */
- vu32 GPIOEMI; /* GPIO EMI Selector Register */
- vu32 WKUPSEL; /* Wake-Up Selection Register */
- u32 EMPTY2[2];
- vu32 GPIOANA; /* GPIO Analag mode Register */
-} SCU_TypeDef;
-
-/*------------------------- DMA Channelx Registers ---------------------------*/
-
-typedef struct
-{
- vu32 SRC; /* Channelx Source Address Register */
- vu32 DES; /* Channelx Destination Address Register */
- vu32 LLI; /* Channelx Lincked List Item Register */
- vu32 CC; /* Channelx Contol Register */
- vu32 CCNF; /* Channelx Configuration Register */
-} DMA_Channel_TypeDef;
-
-/* x can be ,0,1,2,3,4,5,6 or 7. There are eight Channels AHB BUS Master */
-
-/*----------------------------- DMA Controller -------------------------------*/
-
-typedef struct
-{
- vu32 ISR; /* Interrupt Status Register */
- vu32 TCISR; /* Terminal Count Interrupt Status Register */
- vu32 TCICR; /* Terminal CountInterrupt Clear Register */
- vu32 EISR; /* Error Interrupt Status Register */
- vu32 EICR; /* Error Interrupt Clear Register */
- vu32 TCRISR; /* Terminal Count Raw Interrupt Status Register */
- vu32 ERISR; /* Raw Error Interrupt Status Register */
- vu32 ENCSR; /* Enabled Channel Status Register */
- vu32 SBRR; /* Software Burst Request Register */
- vu32 SSRR; /* Software Single Request Register */
- vu32 SLBRR; /* Software Last Burst Request Register */
- vu32 SLSRR; /* Software Last Single Request Register */
- vu32 CNFR; /* Configuration Register */
- vu32 SYNR; /* Syncronization Register */
- } DMA_TypeDef;
-
-/*--------------------------------- TIM Timer --------------------------------*/
-
-typedef struct
-{
- vu16 IC1R; /* Input Capture 1 Register */
- vu16 EMPTY1;
- vu16 IC2R; /* Input Capture 2 Register */
- vu16 EMPTY2;
- vu16 OC1R; /* Output Compare 1 Register */
- vu16 EMPTY3;
- vu16 OC2R; /* Output Compare 2 Register */
- vu16 EMPTY4;
- vu16 CNTR; /* Counter Register */
- vu16 EMPTY5;
- vu16 CR1; /* Control Register 1 */
- vu16 EMPTY6;
- vu16 CR2; /* Control Register 2 */
- vu16 EMPTY7;
- vu16 SR; /* Status Register */
- vu16 EMPTY8;
-} TIM_TypeDef;
-
-/*---------------------------- EMI Bankx Registers ---------------------------*/
-
-typedef struct
-{
- vu32 ICR; /* Bankx Idle Cycle Control Register */
- vu32 RCR; /* Bankx Read Wait State Control Register */
- vu32 WCR; /* Bankx Write Wait State Control Register */
- vu32 OECR; /* Bankx Output Enable Assertion Delay Control Register */
- vu32 WECR; /* Bankx Write Enable Assertion Delay Control Register */
- vu32 BCR; /* Bankx Control Register */
- } EMI_Bank_TypeDef;
-
-/*---------------------------- Ethernet Controller ---------------------------*/
-
-/* MAC Registers */
-typedef struct
-{
- vu32 MCR; /* ENET Control Register */
- vu32 MAH; /* ENET Address High Register */
- vu32 MAL; /* ENET Address Low Register */
- vu32 MCHA; /* Multicast Address High Register */
- vu32 MCLA; /* Multicast Address Low Register */
- vu32 MIIA; /* MII Address Register */
- vu32 MIID; /* MII Data Register */
- vu32 MCF; /* ENET Control Frame Register */
- vu32 VL1; /* VLAN1 Register */
- vu32 VL2; /* VLAN2 register */
- vu32 MTS; /* ENET Transmission Status Register */
- vu32 MRS; /* ENET Reception Status Register */
-} ENET_MAC_TypeDef;
-
-/* DMA Registers */
-typedef struct
-{
- vu32 SCR; /* DMA Status and Control Register */
- vu32 IER; /* DMA Interrupt Sources Enable Register */
- vu32 ISR; /* DMA Interrupt Status Register */
- vu32 CCR; /* Clock Control Relation : HCLK, PCLK and
- ENET_CLK phase relations */
- vu32 RXSTR; /* Rx DMA start Register */
- vu32 RXCR; /* Rx DMA Control Register */
- vu32 RXSAR; /* Rx DMA Base Address Register */
- vu32 RXNDAR; /* Rx DMA Next Descriptor Address Register */
- vu32 RXCAR; /* Rx DMA Current Address Register */
- vu32 RXCTCR; /* Rx DMA Current Transfer Count Register */
- vu32 RXTOR; /* Rx DMA FIFO Time Out Register */
- vu32 RXSR; /* Rx DMA FIFO Status Register */
- vu32 TXSTR; /* Tx DMA start Register */
- vu32 TXCR; /* Tx DMA Control Register */
- vu32 TXSAR; /* Tx DMA Base Address Register */
- vu32 TXNDAR; /* Tx DMA Next Descriptor Address Register */
- vu32 TXCAR; /* Tx DMA Current Address Register */
- vu32 TXTCR; /* Tx DMA Current Transfer Count Register */
- vu32 TXTOR; /* Tx DMA FIFO Time Out Register */
- vu32 TXSR; /* Tx DMA FIFO Status Register */
-} ENET_DMA_TypeDef;
-
-/*------------------------------------- GPIO ---------------------------------*/
-
-typedef struct
-{
- vu8 DR[1021]; /* Data Register */
- vu32 DDR; /* Data Direction Register */
-} GPIO_TypeDef;
-
-/*-------------------------------- I2C interface -----------------------------*/
-
-typedef struct
-{
- vu8 CR; /* Control Register */
- vu8 EMPTY1[3];
- vu8 SR1; /* Status Register 1 */
- vu8 EMPTY2[3];
- vu8 SR2; /* Status Register 2 */
- vu8 EMPTY3[3];
- vu8 CCR; /* Clock Control Register */
- vu8 EMPTY4[3];
- vu8 OAR1; /* Own Address Register 1 */
- vu8 EMPTY5[3];
- vu8 OAR2; /* Own Address Register 2 */
- vu8 EMPTY6[3];
- vu8 DR; /* Data Register */
- vu8 EMPTY7[3];
- vu8 ECCR; /* Extended Clock Control Register */
- vu8 EMPTY8[3];
-} I2C_TypeDef;
-
-/*------------------------------------- VIC ----------------------------------*/
-
-typedef struct
-{
- vu32 ISR; /* IRQ Status Register */
- vu32 FSR; /* FIQ Status Register */
- vu32 RINTSR; /* Raw Interrupt Status Register */
- vu32 INTSR; /* Interrupt Select Register */
- vu32 INTER; /* Interrupt Enable Register */
- vu32 INTECR; /* Interrupt Enable Clear Register */
- vu32 SWINTR; /* Software Interrupt Register */
- vu32 SWINTCR; /* Software Interrupt clear Register */
- vu32 PER; /* Protection Enable Register */
- vu32 EMPTY1[3];
- vu32 VAR; /* Vector Address Register */
- vu32 DVAR; /* Default Vector Address Register */
- vu32 EMPTY2[50];
- vu32 VAiR[16]; /* Vector Address 0-15 Register */
- vu32 EMPTY3[48];
- vu32 VCiR[16]; /* Vector Control 0-15 Register */
-} VIC_TypeDef;
-
-/*-------------------------------- Motor Control -----------------------------*/
-
-typedef struct
-{
- vu16 TCPT; /* Tacho Capture Register */
- vu16 EMPTY1;
- vu16 TCMP; /* Tacho Compare Register */
- vu16 EMPTY2;
- vu16 IPR; /* Input Pending Register */
- vu16 EMPTY3;
- vu16 TPRS; /* Tacho Prescaler Register */
- vu16 EMPTY4;
- vu16 CPRS; /* PWM Counter Prescaler Register */
- vu16 EMPTY5;
- vu16 REP; /* Repetition Counter Register */
- vu16 EMPTY6;
- vu16 CMPW; /* Compare Phase W Preload Register */
- vu16 EMPTY7;
- vu16 CMPV; /* Compare Phase V Preload Register */
- vu16 EMPTY8;
- vu16 CMPU; /* Compare Phase U Preload Register */
- vu16 EMPTY9;
- vu16 CMP0; /* Compare 0 Preload Register */
- vu16 EMPTY10;
- vu16 PCR0; /* Peripheral Control Register 0 */
- vu16 EMPTY11;
- vu16 PCR1; /* Peripheral Control Register 1 */
- vu16 EMPTY12;
- vu16 PCR2; /* Peripheral Control Register 2 */
- vu16 EMPTY13;
- vu16 PSR; /* Polarity Selection Register */
- vu16 EMPTY14;
- vu16 OPR; /* Output Peripheral Register */
- vu16 EMPTY15;
- vu16 IMR; /* Interrupt Mask Register */
- vu16 EMPTY16;
- vu16 DTG; /* Dead Time Generator Register */
- vu16 EMPTY17;
- vu16 ESC; /* Emergency Stop Clear Register */
- vu16 EMPTY18;
-}MC_TypeDef;
-
-/*------------------------------------- RTC ----------------------------------*/
-
-typedef struct
-{
- vu32 TR; /* Time Register */
- vu32 DTR; /* Date Register */
- vu32 ATR; /* Alarm time Register */
- vu32 CR; /* Control Register */
- vu32 SR; /* Status Register */
- vu32 MILR; /* Millisec Register */
-}RTC_TypeDef;
-
-/*------------------------------------- SSP ----------------------------------*/
-
-typedef struct
-{
- vu16 CR0; /* Control Register 1 */
- vu16 EMPTY1;
- vu16 CR1; /* Control Register 2 */
- vu16 EMPTY2;
- vu16 DR; /* Data Register */
- vu16 EMPTY3;
- vu16 SR; /* Status Register */
- vu16 EMPTY4;
- vu16 PR; /* Clock Prescale Register */
- vu16 EMPTY5;
- vu16 IMSCR; /* Interrupt Mask Set or Clear Register */
- vu16 EMPTY6;
- vu16 RISR; /* Raw Interrupt Status Register */
- vu16 EMPTY7;
- vu16 MISR; /* Masked Interrupt Status Register */
- vu16 EMPTY8;
- vu16 ICR; /* Interrupt Clear Register */
- vu16 EMPTY9;
- vu16 DMACR; /* DMA Control Register */
- vu16 EMPTY10;
-}SSP_TypeDef;
-
-/*------------------------------------ UART ----------------------------------*/
-
-typedef struct
-{
- vu16 DR; /* Data Register */
- vu16 EMPTY1;
- vu16 RSECR; /* Receive Status Register (read)/Error Clear Register (write) */
- vu16 EMPTY2[9];
- vu16 FR; /* Flag Register */
- vu16 EMPTY3[3];
- vu16 ILPR; /* IrDA Low-Power counter Register */
- vu16 EMPTY4;
- vu16 IBRD; /* Integer Baud Rate Divisor Register */
- vu16 EMPTY5;
- vu16 FBRD; /* Fractional Baud Rate Divisor Register */
- vu16 EMPTY6;
- vu16 LCR; /* Line Control Register, High byte */
- vu16 EMPTY7;
- vu16 CR; /* Control Register */
- vu16 EMPTY8;
- vu16 IFLS; /* Interrupt FIFO Level Select Register */
- vu16 EMPTY9;
- vu16 IMSC; /* Interrupt Mask Set/Clear Register */
- vu16 EMPTY10;
- vu16 RIS; /* Raw Interrupt Status Register */
- vu16 EMPTY11;
- vu16 MIS; /* Masked Interrupt Status Register */
- vu16 EMPTY12;
- vu16 ICR; /* Interrupt Clear Register */
- vu16 EMPTY13;
- vu16 DMACR; /* DMA Control Register */
- vu16 EMPTY14;
-}UART_TypeDef;
-
-/*------------------------------- Wake-up System -----------------------------*/
-
-typedef struct
-{
- vu32 CTRL; /* Control Register */
- vu32 MR; /* Mask Register */
- vu32 TR; /* Trigger Register */
- vu32 PR; /* Pending Register */
- vu32 INTR; /* Software Interrupt Register */
-} WIU_TypeDef;
-
-/*------------------------------- WatchDog Timer -----------------------------*/
-
-typedef struct
-{
- vu16 CR; /* Control Register */
- vu16 EMPTY1;
- vu16 PR; /* Presclar Register */
- vu16 EMPTY2;
- vu16 VR; /* Pre-load Value Register */
- vu16 EMPTY3;
- vu16 CNT; /* Counter Register */
- vu16 EMPTY4;
- vu16 SR; /* Status Register */
- vu16 EMPTY5;
- vu16 MR; /* Mask Register */
- vu16 EMPTY6;
- vu16 KR; /* Key Register */
- vu16 EMPTY7;
-} WDG_TypeDef;
-
-/*******************************************************************************
-* Memory Mapping of STR91x *
-*******************************************************************************/
-
-#define AHB_APB_BRDG0_U (0x58000000) /* AHB/APB Bridge 0 UnBuffered Space */
-#define AHB_APB_BRDG0_B (0x48000000) /* AHB/APB Bridge 0 Buffered Space */
-
-#define AHB_APB_BRDG1_U (0x5C000000) /* AHB/APB Bridge 1 UnBuffered Space */
-#define AHB_APB_BRDG1_B (0x4C000000) /* AHB/APB Bridge 1 Buffered Space */
-
-#define AHB_EMI_U (0x74000000) /* EMI UnBuffered Space */
-#define AHB_EMI_B (0x64000000) /* EMI Buffered Space */
-
-#define AHB_DMA_U (0x78000000) /* DMA UnBuffered Space */
-#define AHB_DMA_B (0x68000000) /* DMA Buffered Space */
-
-#define AHB_ENET_MAC_U (0x7C000400) /* ENET_MAC UnBuffered Space */
-#define AHB_ENET_MAC_B (0x6C000000) /* ENET_MAC Buffered Space */
-
-#define AHB_ENET_DMA_U (0x7C000000) /* ENET_DMA Unbuffered Space */
-#define AHB_ENET_DMA_B (0x6C000400) /* ENET_DMA Buffered Space */
-
-#define AHB_VIC1_U (0xFC000000) /* Secondary VIC1 UnBuffered Space */
-#define AHB_VIC0_U (0xFFFFF000) /* Primary VIC0 UnBuffered Space */
-
-#define AHB_FMI_U (0x54000000) /* FMI Unbuffered Space */
-#define AHB_FMI_B (0x44000000) /* FMI buffered Space */
-
-/*******************************************************************************
-* Addresses related to the VICs' peripherals *
-*******************************************************************************/
-
-#define VIC0_BASE (AHB_VIC0_U)
-#define VIC1_BASE (AHB_VIC1_U)
-
-/*******************************************************************************
-* Addresses related to the EMI banks *
-*******************************************************************************/
-
-#define AHB_EMIB3_OFST (0x00000040) /* Offset of EMI bank3 */
-#define AHB_EMIB2_OFST (0x00000020) /* Offset of EMI bank2 */
-#define AHB_EMIB1_OFST (0x00000000) /* Offset of EMI bank1 */
-#define AHB_EMIB0_OFST (0x000000E0) /* Offset of EMI bank0 */
-
-/*******************************************************************************
-* Addresses related to the DMA peripheral *
-*******************************************************************************/
-
-#define AHB_DMA_Channel0_OFST (0x00000100) /* Offset of Channel 0 */
-#define AHB_DMA_Channel1_OFST (0x00000120) /* Offset of Channel 1 */
-#define AHB_DMA_Channel2_OFST (0x00000140) /* Offset of Channel 2 */
-#define AHB_DMA_Channel3_OFST (0x00000160) /* Offset of Channel 3 */
-#define AHB_DMA_Channel4_OFST (0x00000180) /* Offset of Channel 4 */
-#define AHB_DMA_Channel5_OFST (0x000001A0) /* Offset of Channel 5 */
-#define AHB_DMA_Channel6_OFST (0x000001C0) /* Offset of Channel 6 */
-#define AHB_DMA_Channel7_OFST (0x000001E0) /* Offset of Channel 7 */
-
-/*******************************************************************************
-* Addresses related to the APB0 sub-system *
-*******************************************************************************/
-
-#define APB_WIU_OFST (0x00001000) /* Offset of WIU */
-#define APB_TIM0_OFST (0x00002000) /* Offset of TIM0 */
-#define APB_TIM1_OFST (0x00003000) /* Offset of TIM1 */
-#define APB_TIM2_OFST (0x00004000) /* Offset of TIM2 */
-#define APB_TIM3_OFST (0x00005000) /* Offset of TIM3 */
-#define APB_GPIO0_OFST (0x00006000) /* Offset of GPIO0 */
-#define APB_GPIO1_OFST (0x00007000) /* Offset of GPIO1 */
-#define APB_GPIO2_OFST (0x00008000) /* Offset of GPIO2 */
-#define APB_GPIO3_OFST (0x00009000) /* Offset of GPIO3 */
-#define APB_GPIO4_OFST (0x0000A000) /* Offset of GPIO4 */
-#define APB_GPIO5_OFST (0x0000B000) /* Offset of GPIO5 */
-#define APB_GPIO6_OFST (0x0000C000) /* Offset of GPIO6 */
-#define APB_GPIO7_OFST (0x0000D000) /* Offset of GPIO7 */
-#define APB_GPIO8_OFST (0x0000E000) /* Offset of GPIO8 */
-#define APB_GPIO9_OFST (0x0000F000) /* Offset of GPIO9 */
-
-/*******************************************************************************
-* Addresses related to the APB1 sub-system *
-*******************************************************************************/
-
-#define APB_RTC_OFST (0x00001000) /* Offset of RTC */
-#define APB_SCU_OFST (0x00002000) /* Offset of System Controller */
-#define APB_MC_OFST (0x00003000) /* Offset of Motor Control */
-#define APB_UART0_OFST (0x00004000) /* Offset of UART0 */
-#define APB_UART1_OFST (0x00005000) /* Offset of UART1 */
-#define APB_UART2_OFST (0x00006000) /* Offset of UART2 */
-#define APB_SSP0_OFST (0x00007000) /* Offset of SSP0 */
-#define APB_SSP1_OFST (0x00008000) /* Offset of SSPI */
-#define APB_CAN_OFST (0x00009000) /* Offset of CAN */
-#define APB_ADC_OFST (0x0000A000) /* Offset of ADC */
-#define APB_WDG_OFST (0x0000B000) /* Offset of WDG */
-#define APB_I2C0_OFST (0x0000C000) /* Offset of I2C0 */
-#define APB_I2C1_OFST (0x0000D000) /* Offset of I2C1 */
-
-/*----------------------------------------------------------------------------*/
-/*----------------------------- Unbuffered Mode ------------------------------*/
-/*----------------------------------------------------------------------------*/
-
-#ifndef Buffered
-
-/*******************************************************************************
-* AHBAPB peripheral Unbuffered Base Address *
-*******************************************************************************/
-
-#define AHBAPB0_BASE (AHB_APB_BRDG0_U)
-#define AHBAPB1_BASE (AHB_APB_BRDG1_U)
-
-/*******************************************************************************
-* ENET peripheral Unbuffered Base Address *
-*******************************************************************************/
-
-#define ENET_MAC_BASE (AHB_ENET_MAC_U)
-#define ENET_DMA_BASE (AHB_ENET_DMA_U)
-
-/*******************************************************************************
-* DMA peripheral Unbuffered Base Address *
-*******************************************************************************/
-
-#define DMA_BASE (AHB_DMA_U)
-
-/*******************************************************************************
-* EMI peripheral Unbuffered Base Address *
-*******************************************************************************/
-
-#define EMI_BASE (AHB_EMI_U)
-
-/*******************************************************************************
-* FMI peripheral Unbuffered Base Address *
-*******************************************************************************/
-
-#define FMI_BASE (AHB_FMI_U)
-
-
-#else /* Buffered */
-
-/*----------------------------------------------------------------------------*/
-/*------------------------------ Buffered Mode -------------------------------*/
-/*----------------------------------------------------------------------------*/
-
-/*******************************************************************************
-* AHBAPB peripheral Buffered Base Address *
-*******************************************************************************/
-
-#define AHBAPB0_BASE (AHB_APB_BRDG0_B)
-#define AHBAPB1_BASE (AHB_APB_BRDG1_B)
-
-/*******************************************************************************
-* ENET peripheral Unbuffered Base Address *
-*******************************************************************************/
-
-#define ENET_MAC_BASE (AHB_ENET_MAC_B)
-#define ENET_DMA_BASE (AHB_ENET_DMA_B)
-
-/*******************************************************************************
-* DMA peripheral Buffered Base Address *
-*******************************************************************************/
-
-#define DMA_BASE (AHB_DMA_B)
-
-/*******************************************************************************
-* EMI peripheral Buffered Base Address *
-*******************************************************************************/
-
-#define EMI_BASE (AHB_EMI_B)
-
-/*******************************************************************************
-* FMI peripheral Buffered Base Address *
-*******************************************************************************/
-
-#define FMI_BASE (AHB_FMI_B)
-
-#endif /* Buffered */
-
-/*******************************************************************************
-* DMA channels Base Address *
-*******************************************************************************/
-#define DMA_Channel0_BASE (DMA_BASE + AHB_DMA_Channel0_OFST)
-#define DMA_Channel1_BASE (DMA_BASE + AHB_DMA_Channel1_OFST)
-#define DMA_Channel2_BASE (DMA_BASE + AHB_DMA_Channel2_OFST)
-#define DMA_Channel3_BASE (DMA_BASE + AHB_DMA_Channel3_OFST)
-#define DMA_Channel4_BASE (DMA_BASE + AHB_DMA_Channel4_OFST)
-#define DMA_Channel5_BASE (DMA_BASE + AHB_DMA_Channel5_OFST)
-#define DMA_Channel6_BASE (DMA_BASE + AHB_DMA_Channel6_OFST)
-#define DMA_Channel7_BASE (DMA_BASE + AHB_DMA_Channel7_OFST)
-
-/*******************************************************************************
-* EMI Banks peripheral Base Address *
-*******************************************************************************/
-
-#define EMI_Bank0_BASE (EMI_BASE + AHB_EMIB0_OFST)
-#define EMI_Bank1_BASE (EMI_BASE + AHB_EMIB1_OFST)
-#define EMI_Bank2_BASE (EMI_BASE + AHB_EMIB2_OFST)
-#define EMI_Bank3_BASE (EMI_BASE + AHB_EMIB3_OFST)
-
-/*******************************************************************************
-* APB0 Peripherals' Base addresses *
-*******************************************************************************/
-
-#define WIU_BASE (AHBAPB0_BASE + APB_WIU_OFST)
-#define TIM0_BASE (AHBAPB0_BASE + APB_TIM0_OFST)
-#define TIM1_BASE (AHBAPB0_BASE + APB_TIM1_OFST)
-#define TIM2_BASE (AHBAPB0_BASE + APB_TIM2_OFST)
-#define TIM3_BASE (AHBAPB0_BASE + APB_TIM3_OFST)
-#define GPIO0_BASE (AHBAPB0_BASE + APB_GPIO0_OFST)
-#define GPIO1_BASE (AHBAPB0_BASE + APB_GPIO1_OFST)
-#define GPIO2_BASE (AHBAPB0_BASE + APB_GPIO2_OFST)
-#define GPIO3_BASE (AHBAPB0_BASE + APB_GPIO3_OFST)
-#define GPIO4_BASE (AHBAPB0_BASE + APB_GPIO4_OFST)
-#define GPIO5_BASE (AHBAPB0_BASE + APB_GPIO5_OFST)
-#define GPIO6_BASE (AHBAPB0_BASE + APB_GPIO6_OFST)
-#define GPIO7_BASE (AHBAPB0_BASE + APB_GPIO7_OFST)
-#define GPIO8_BASE (AHBAPB0_BASE + APB_GPIO8_OFST)
-#define GPIO9_BASE (AHBAPB0_BASE + APB_GPIO9_OFST)
-
-/*******************************************************************************
-* APB1 Peripherals' Base addresses *
-*******************************************************************************/
-
-#define RTC_BASE (AHBAPB1_BASE + APB_RTC_OFST)
-#define SCU_BASE (AHBAPB1_BASE + APB_SCU_OFST)
-#define MC_BASE (AHBAPB1_BASE + APB_MC_OFST)
-#define UART0_BASE (AHBAPB1_BASE + APB_UART0_OFST)
-#define UART1_BASE (AHBAPB1_BASE + APB_UART1_OFST)
-#define UART2_BASE (AHBAPB1_BASE + APB_UART2_OFST)
-#define SSP0_BASE (AHBAPB1_BASE + APB_SSP0_OFST)
-#define SSP1_BASE (AHBAPB1_BASE + APB_SSP1_OFST)
-#define CAN_BASE (AHBAPB1_BASE + APB_CAN_OFST)
-#define ADC_BASE (AHBAPB1_BASE + APB_ADC_OFST)
-#define WDG_BASE (AHBAPB1_BASE + APB_WDG_OFST)
-#define I2C0_BASE (AHBAPB1_BASE + APB_I2C0_OFST)
-#define I2C1_BASE (AHBAPB1_BASE + APB_I2C1_OFST)
-
-/*******************************************************************************
-* IPs' declaration *
-*******************************************************************************/
-
-/*------------------------------ Non Debug Mode ------------------------------*/
-#undef DEBUG
-#ifndef DEBUG
-
-/*********************************** AHBAPB ***********************************/
-
-#define AHBAPB0 ((AHBAPB_TypeDef *)AHBAPB0_BASE)
-#define AHBAPB1 ((AHBAPB_TypeDef *)AHBAPB1_BASE)
-
-/************************************* EMI ************************************/
-
-#define EMI ((EMI_TypeDef *)EMI_BASE)
-
-/************************************* DMA ************************************/
-
-#define DMA ((DMA_TypeDef *)DMA_BASE)
-#define DMA_Channel0 ((DMA_Channel_TypeDef *)DMA_Channel0_BASE)
-#define DMA_Channel1 ((DMA_Channel_TypeDef *)DMA_Channel1_BASE)
-#define DMA_Channel2 ((DMA_Channel_TypeDef *)DMA_Channel2_BASE)
-#define DMA_Channel3 ((DMA_Channel_TypeDef *)DMA_Channel3_BASE)
-#define DMA_Channel4 ((DMA_Channel_TypeDef *)DMA_Channel4_BASE)
-#define DMA_Channel5 ((DMA_Channel_TypeDef *)DMA_Channel5_BASE)
-#define DMA_Channel6 ((DMA_Channel_TypeDef *)DMA_Channel6_BASE)
-#define DMA_Channel7 ((DMA_Channel_TypeDef *)DMA_Channel7_BASE)
-
-/************************************* EMI ************************************/
-
-#define EMI_Bank0 ((EMI_Bank_TypeDef *)EMI_Bank0_BASE)
-#define EMI_Bank1 ((EMI_Bank_TypeDef *)EMI_Bank1_BASE)
-#define EMI_Bank2 ((EMI_Bank_TypeDef *)EMI_Bank2_BASE)
-#define EMI_Bank3 ((EMI_Bank_TypeDef *)EMI_Bank3_BASE)
-
-/************************************* ENET_MAC ************************************/
-
-#define ENET_MAC ((ENET_MAC_TypeDef *)ENET_MAC_BASE)
-
-/************************************* ENET_DMA ************************************/
-
-#define ENET_DMA ((ENET_DMA_TypeDef *)ENET_DMA_BASE)
-
-/************************************* FMI ************************************/
-
-#define FMI ((FMI_TypeDef *)FMI_BASE)
-
-/************************************* VIC ************************************/
-
-#define VIC0 ((VIC_TypeDef *)VIC0_BASE)
-#define VIC1 ((VIC_TypeDef *)VIC1_BASE)
-
-/*******************************************************************************
-* APB0 Peripherals' *
-*******************************************************************************/
-#define WIU ((WIU_TypeDef *)WIU_BASE)
-#define TIM0 ((TIM_TypeDef *)TIM0_BASE)
-#define TIM1 ((TIM_TypeDef *)TIM1_BASE)
-#define TIM2 ((TIM_TypeDef *)TIM2_BASE)
-#define TIM3 ((TIM_TypeDef *)TIM3_BASE)
-#define GPIO0 ((GPIO_TypeDef *)GPIO0_BASE)
-#define GPIO1 ((GPIO_TypeDef *)GPIO1_BASE)
-#define GPIO2 ((GPIO_TypeDef *)GPIO2_BASE)
-#define GPIO3 ((GPIO_TypeDef *)GPIO3_BASE)
-#define GPIO4 ((GPIO_TypeDef *)GPIO4_BASE)
-#define GPIO5 ((GPIO_TypeDef *)GPIO5_BASE)
-#define GPIO6 ((GPIO_TypeDef *)GPIO6_BASE)
-#define GPIO7 ((GPIO_TypeDef *)GPIO7_BASE)
-#define GPIO8 ((GPIO_TypeDef *)GPIO8_BASE)
-#define GPIO9 ((GPIO_TypeDef *)GPIO9_BASE)
-/*******************************************************************************
-* APB1 Peripherals' *
-*******************************************************************************/
-#define RTC ((RTC_TypeDef *)RTC_BASE)
-#define SCU ((SCU_TypeDef *)SCU_BASE)
-#define MC ((MC_TypeDef *)MC_BASE)
-#define UART0 ((UART_TypeDef *)UART0_BASE)
-#define UART1 ((UART_TypeDef *)UART1_BASE)
-#define UART2 ((UART_TypeDef *)UART2_BASE)
-#define SSP0 ((SSP_TypeDef *)SSP0_BASE)
-#define SSP1 ((SSP_TypeDef *)SSP1_BASE)
-#define CAN ((CAN_TypeDef *)CAN_BASE)
-#define ADC ((ADC_TypeDef *)ADC_BASE)
-#define WDG ((WDG_TypeDef *)WDG_BASE)
-#define I2C0 ((I2C_TypeDef *)I2C0_BASE)
-#define I2C1 ((I2C_TypeDef *)I2C1_BASE)
-#define ENET_MAC ((ENET_MAC_TypeDef *)ENET_MAC_BASE)
-#define ENET_DMA ((ENET_DMA_TypeDef *)ENET_DMA_BASE)
-
-#else /* DEBUG */
-
-/*-------------------------------- Debug Mode --------------------------------*/
-
-EXT AHBAPB_TypeDef *AHBAPB0;
-EXT AHBAPB_TypeDef *AHBAPB1;
-EXT DMA_TypeDef *DMA;
-EXT DMA_Channel_TypeDef *DMA_Channel0;
-EXT DMA_Channel_TypeDef *DMA_Channel1;
-EXT DMA_Channel_TypeDef *DMA_Channel2;
-EXT DMA_Channel_TypeDef *DMA_Channel3;
-EXT DMA_Channel_TypeDef *DMA_Channel4;
-EXT DMA_Channel_TypeDef *DMA_Channel5;
-EXT DMA_Channel_TypeDef *DMA_Channel6;
-EXT DMA_Channel_TypeDef *DMA_Channel7;
-EXT EMI_Bank_TypeDef *EMI_Bank0;
-EXT EMI_Bank_TypeDef *EMI_Bank1;
-EXT EMI_Bank_TypeDef *EMI_Bank2;
-EXT EMI_Bank_TypeDef *EMI_Bank3;
-EXT FMI_TypeDef *FMI;
-EXT VIC_TypeDef *VIC0;
-EXT VIC_TypeDef *VIC1;
-EXT WIU_TypeDef *WIU;
-EXT TIM_TypeDef *TIM0;
-EXT TIM_TypeDef *TIM1;
-EXT TIM_TypeDef *TIM2;
-EXT TIM_TypeDef *TIM3;
-EXT GPIO_TypeDef *GPIO0;
-EXT GPIO_TypeDef *GPIO1;
-EXT GPIO_TypeDef *GPIO2;
-EXT GPIO_TypeDef *GPIO3;
-EXT GPIO_TypeDef *GPIO4;
-EXT GPIO_TypeDef *GPIO5;
-EXT GPIO_TypeDef *GPIO6;
-EXT GPIO_TypeDef *GPIO7;
-EXT GPIO_TypeDef *GPIO8;
-EXT GPIO_TypeDef *GPIO9;
-EXT RTC_TypeDef *RTC;
-EXT SCU_TypeDef *SCU;
-EXT MC_TypeDef *MC;
-EXT UART_TypeDef *UART0;
-EXT UART_TypeDef *UART1;
-EXT UART_TypeDef *UART2;
-EXT SSP_TypeDef *SSP0;
-EXT SSP_TypeDef *SSP1;
-EXT CAN_TypeDef *CAN;
-EXT ADC_TypeDef *ADC;
-EXT WDG_TypeDef *WDG;
-EXT I2C_TypeDef *I2C0;
-EXT I2C_TypeDef *I2C1;
-EXT ENET_MAC_TypeDef *ENET_MAC;
-EXT ENET_DMA_TypeDef *ENET_DMA;
-
-
-#endif /* DEBUG */
-
-#endif /* __91x_MAP_H*/
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
-
diff --git a/uc_str912/prj_blinky_complex_startup/include/91x_mc.h b/uc_str912/prj_blinky_complex_startup/include/91x_mc.h
deleted file mode 100644
index b33b7c3..0000000
--- a/uc_str912/prj_blinky_complex_startup/include/91x_mc.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_mc.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* MC software library.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __91x_MC_H
-#define __91x_MC_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_map.h"
-
-/* Exported types ------------------------------------------------------------*/
-typedef struct
-{
- u16 MC_OperatingMode;
- u16 MC_TachoMode;
- u16 MC_TachoEvent_Mode;
- u8 MC_Prescaler;
- u8 MC_ForcedPWMState;
- u16 MC_TachoPrescaler;
- u16 MC_PWMMode;
- u16 MC_Complementary;
- u16 MC_Emergency;
- u16 MC_Period;
- u16 MC_TachoPeriod;
- u16 MC_Channel;
- u16 MC_PulseU;
- u16 MC_PulseV;
- u16 MC_PulseW;
- u16 MC_PolarityUL;
- u16 MC_PolarityUH;
- u16 MC_PolarityVL;
- u16 MC_PolarityVH;
- u16 MC_PolarityWL;
- u16 MC_PolarityWH;
- u16 MC_TachoPolarity;
- u16 MC_DeadTime;
- u8 MC_RepetitionCounter;
-} MC_InitTypeDef;
-
-typedef enum { DOWN = 0, UP = !DOWN} CountingStatus;
-
-/* Exported constants --------------------------------------------------------*/
-#define MC_Complementary_Enable 0x0001
-#define MC_Complementary_Disable 0x0002
-
-#define MC_HardwareOperating_Mode 0x0001
-#define MC_SoftwareOperating_Mode 0x0002
-
-#define MC_PWMClassical_Mode 0x0001
-#define MC_PWMZeroCentered_Mode 0x0002
-
-#define MC_Emergency_Enable 0x0001
-#define MC_Emergency_Disable 0x0002
-
-#define MC_Polarity_Inverted 0x0001
-#define MC_Polarity_NonInverted 0x0002
-
-#define MC_TachoOneShot_Mode 0x0001
-#define MC_TachoContinuous_Mode 0x0002
-
-#define MC_TachoEventEdge_None 0x0000
-#define MC_TachoEventEdge_Falling 0x0001
-#define MC_TachoEventEdge_Rising 0x0002
-#define MC_TachoEventEdge_RisingFalling 0x0003
-
-#define MC_Channel_U 0x0001
-#define MC_Channel_V 0x0002
-#define MC_Channel_W 0x0003
-#define MC_Channel_ALL 0x0004
-
-
-#define MC_TachoEvent_Hardware_Mode 0x0001
-#define MC_TachoEvent_Software_Mode 0x0002
-
-#define MC_IT_CMPW 0x0001
-#define MC_IT_CMPV 0x0002
-#define MC_IT_CMPU 0x0004
-#define MC_IT_ZPC 0x0008
-#define MC_IT_ADT 0x0010
-#define MC_IT_OTC 0x0020
-#define MC_IT_CPT 0x0040
-#define MC_IT_CM0 0x0080
-
-#define MC_FLAG_CMPW 0x0001
-#define MC_FLAG_CMPV 0x0002
-#define MC_FLAG_CMPU 0x0004
-#define MC_FLAG_ZPC 0x0008
-#define MC_FLAG_ADT 0x0010
-#define MC_FLAG_OTC 0x0020
-#define MC_FLAG_CPT 0x0040
-#define MC_FLAG_CM0 0x0080
-#define MC_FLAG_EST 0x0100
-/* Exported macro ------------------------------------------------------------*/
-/* Exported functions --------------------------------------------------------*/
-void MC_Init(MC_InitTypeDef* MC_InitStruct);
-void MC_DeInit(void);
-void MC_StructInit(MC_InitTypeDef* MC_InitStruct);
-void MC_Cmd(FunctionalState NewState);
-void MC_CtrlPWMOutputs(FunctionalState Newstate);
-void MC_ITConfig(u16 MC_IT, FunctionalState NewState);
-void MC_SetPrescaler(u8 Prescaler);
-void MC_SetPeriod(u16 MC_Period);
-void MC_SetPulseU(u16 MC_PulseU);
-void MC_SetPulseV(u16 MC_PulseV);
-void MC_SetPulseW(u16 MC_PulseW);
-void MC_SetTachoCompare(u8 MC_Compare);
-void MC_PWMModeConfig(u16 MC_PWMMode);
-void MC_SetDeadTime(u16 MC_DeadTime);
-void MC_EmergencyCmd(FunctionalState NewState);
-void MC_EmergencyClear(void);
-u16 MC_GetPeriod(void);
-u16 MC_GetPulseU(void);
-u16 MC_GetPulseV(void);
-u16 MC_GetPulseW(void);
-u16 MC_GetTachoCapture(void);
-void MC_ClearOnTachoCapture(FunctionalState NewState);
-void MC_ForceDataTransfer(u8 MC_ForcedData);
-void MC_SoftwarePreloadConfig(void);
-void MC_SoftwareTachoCapture(void);
-CountingStatus MC_GetCountingStatus(void);
-FlagStatus MC_GetFlagStatus(u16 MC_FLAG);
-void MC_ClearFlag(u16 MC_FLAG);
-ITStatus MC_GetITStatus(u16 MC_IT);
-void MC_ClearITPendingBit(u16 MC_IT);
-
-#endif /* __91x_MC_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
-
diff --git a/uc_str912/prj_blinky_complex_startup/include/91x_rtc.h b/uc_str912/prj_blinky_complex_startup/include/91x_rtc.h
deleted file mode 100644
index 25a2805..0000000
--- a/uc_str912/prj_blinky_complex_startup/include/91x_rtc.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_rtc.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides the RTC library software functions
-* prototypes & definitions
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __91x_RTC_H
-#define __91x_RTC_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_map.h"
-
-/* Private typedef -----------------------------------------------------------*/
-typedef struct
-{
- u8 century;
- u8 year;
- u8 month;
- u8 day;
- u8 weekday;
-}RTC_DATE;
-
-typedef struct
-{
- u8 hours;
- u8 minutes;
- u8 seconds;
- u16 milliseconds;
-}RTC_TIME;
-
-typedef struct
-{
- u8 day;
- u8 hours;
- u8 minutes;
- u8 seconds;
-}RTC_ALARM;
-
-/* Exported constants --------------------------------------------------------*/
-
-#define BINARY 0
-#define BCD 1
-
-/*TamperMode*/
-#define RTC_TamperMode_Edge 0xFFFFFFEF
-#define RTC_TamperMode_Level 0x10
-
-/*TamperPol*/
-#define RTC_TamperPol_High 0x4
-#define RTC_TamperPol_Low 0xFFFFFFFB
-
-/*PeriodicClock*/
-#define RTC_Per_2Hz 0x10000
-#define RTC_Per_16Hz 0x20000
-#define RTC_Per_128Hz 0x40000
-#define RTC_Per_1024Hz 0x80000
-#define RTC_Per_DISABLE 0x0
-
-/*RTC_IT*/
-#define RTC_IT_Per 0x200000
-#define RTC_IT_Alarm 0x800000
-#define RTC_IT_Tamper 0x400000
-
-/*RTC_FLAG*/
-#define RTC_FLAG_Per 0x80000000
-#define RTC_FLAG_Alarm 0x40000000
-#define RTC_FLAG_Tamper 0x10000000
-
-
-/* Module private variables --------------------------------------------------*/
-/* Exported macro ------------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-void RTC_DeInit(void);
-void RTC_SetDate(RTC_DATE Date);
-void RTC_SetTime(RTC_TIME Time);
-void RTC_SetAlarm(RTC_ALARM Alarm);
-void RTC_GetDate(u8 Format, RTC_DATE * Date);
-void RTC_GetTime(u8 Format, RTC_TIME * Time);
-void RTC_GetAlarm(u8 Format, RTC_ALARM * Alarm);
-void RTC_TamperConfig(u32 TamperMode, u32 TamperPol);
-void RTC_TamperCmd(FunctionalState NewState);
-void RTC_AlarmCmd(FunctionalState NewState);
-void RTC_CalibClockCmd(FunctionalState NewState);
-void RTC_SRAMBattPowerCmd(FunctionalState NewState);
-void RTC_PeriodicIntConfig(u32 PeriodicClock);
-void RTC_ITConfig(u32 RTC_IT, FunctionalState NewState);
-FlagStatus RTC_GetFlagStatus(u32 RTC_FLAG);
-void RTC_ClearFlag(u32 RTC_FLAG);
-#endif /*__91x_RTC_H*/
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
-
-
-
diff --git a/uc_str912/prj_blinky_complex_startup/include/91x_scu.h b/uc_str912/prj_blinky_complex_startup/include/91x_scu.h
deleted file mode 100644
index b9d04f5..0000000
--- a/uc_str912/prj_blinky_complex_startup/include/91x_scu.h
+++ /dev/null
@@ -1,196 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_scu.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides the SCU library software functions
-* prototypes & definitions
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __91x_SCU_H
-#define __91x_SCU_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_map.h"
-
-/* Exported constants --------------------------------------------------------*/
-
-/*MCLK_Source*/
-#define SCU_MCLK_PLL 0x0
-#define SCU_MCLK_RTC 0x1
-#define SCU_MCLK_OSC 0x2
-
-/*RCLK_Divisor*/
-#define SCU_RCLK_Div1 0xFFFFFFE3
-#define SCU_RCLK_Div2 0x4
-#define SCU_RCLK_Div4 0x8
-#define SCU_RCLK_Div8 0xC
-#define SCU_RCLK_Div16 0x10
-#define SCU_RCLK_Div1024 0x14
-
-/*HCLK_Divisor*/
-#define SCU_HCLK_Div1 0xFFFFFF9F
-#define SCU_HCLK_Div2 0x20
-#define SCU_HCLK_Div4 0x40
-
-/*PCLK_Divisor*/
-#define SCU_PCLK_Div1 0xFFFFFE7F
-#define SCU_PCLK_Div2 0x80
-#define SCU_PCLK_Div4 0x100
-#define SCU_PCLK_Div8 0x180
-
-/*FMICLK_Divisor*/
-#define SCU_FMICLK_Div1 0xFFFEFFFF
-#define SCU_FMICLK_Div2 0x10000
-
-/*BRCLK_Divisor*/
-#define SCU_BRCLK_Div1 0xFFFFFDFF
-#define SCU_BRCLK_Div2 0x200
-
-/*TIMCLK_Source*/
-#define SCU_TIMCLK_EXT 0x1
-#define SCU_TIMCLK_INT 0x0
-
-/*TIMx*/
-#define SCU_TIM01 0x0
-#define SCU_TIM23 0x1
-
-
-/*USBCLK_Source*/
-#define SCU_USBCLK_MCLK 0xFFFFF3FF
-#define SCU_USBCLK_MCLK2 0x400
-#define SCU_USBCLK_EXT 0x800
-
-/*SCU_EMIBCLK*/
-#define SCU_EMIBCLK_Div1 0xFFF9FFFF
-#define SCU_EMIBCLK_Div2 0x20000
-
-/*SCU_EMIMODE*/
-#define SCU_EMI_MUX 0xFFFFFFBF
-#define SCU_EMI_DEMUX 0x40
-
-/*SCU_EMIALE_LEN*/
-#define SCU_EMIALE_LEN1 0xFFFFFEFF
-#define SCU_EMIALE_LEN2 0x100
-
-/*SCU_EMIALE_POL*/
-#define SCU_EMIALE_POLLow 0xFFFFFF7F
-#define SCU_EMIALE_POLHigh 0x80
-
-/*UART_IrDA_Mode*/
-#define SCU_UARTMode_IrDA 0x1
-#define SCU_UARTMode_UART 0x0
-
-/*APBPeriph*/
-#define __TIM01 0x1
-#define __TIM23 0x2
-#define __MC 0x4
-#define __UART0 0x8
-#define __UART1 0x10
-#define __UART2 0x20
-#define __I2C0 0x40
-#define __I2C1 0x80
-#define __SSP0 0x100
-#define __SSP1 0x200
-#define __CAN 0x400
-#define __ADC 0x800
-#define __WDG 0x1000
-#define __WIU 0x2000
-#define __GPIO0 0x4000
-#define __GPIO1 0x8000
-#define __GPIO2 0x10000
-#define __GPIO3 0x20000
-#define __GPIO4 0x40000
-#define __GPIO5 0x80000
-#define __GPIO6 0x100000
-#define __GPIO7 0x200000
-#define __GPIO8 0x400000
-#define __GPIO9 0x800000
-#define __RTC 0x1000000
-
-/*AHBPeriph*/
-#define __FMI 0x1
-#define __FPQBC 0x2
-#define __SRAM 0x8
-#define __SRAM_ARBITER 0x10
-#define __VIC 0x20
-#define __EMI 0x40
-#define __EMI_MEM_CLK 0x80
-#define __DMA 0x100
-#define __USB 0x200
-#define __USB48M 0x400
-#define __ENET 0x800
-#define __PFQBC_AHB 0x1000
-
-/*SCU_IT*/
-#define SCU_IT_LVD_RST 0x10
-#define SCU_IT_SRAM_ERROR 0x8
-#define SCU_IT_ACK_PFQBC 0x4
-#define SCU_IT_LOCK_LOST 0x2
-#define SCU_IT_LOCK 0x1
-
-/*SCU_FLAG*/
-#define SCU_FLAG_SRAM_ERROR 0x20
-#define SCU_FLAG_ACK_PFQBC 0x10
-#define SCU_FLAG_LVD_RESET 0x8
-#define SCU_FLAG_WDG_RST 0x4
-#define SCU_FLAG_LOCK_LOST 0x2
-#define SCU_FLAG_LOCK 0x1
-
-
-/* Module private variables --------------------------------------------------*/
-/* Exported macro ------------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-ErrorStatus SCU_MCLKSourceConfig(u32 MCLK_Source);
-ErrorStatus SCU_PLLFactorsConfig(u8 PLLN, u8 PLLM, u8 PLLP);
-ErrorStatus SCU_PLLCmd(FunctionalState NewState);
-void SCU_RCLKDivisorConfig(u32 RCLK_Divisor);
-void SCU_HCLKDivisorConfig(u32 HCLK_Divisor);
-void SCU_PCLKDivisorConfig(u32 PCLK_Divisor);
-void SCU_APBPeriphClockConfig(u32 APBPeriph, FunctionalState NewState);
-void SCU_AHBPeriphClockConfig(u32 AHBPeriph, FunctionalState NewState);
-void SCU_APBPeriphReset(u32 APBPeriph, FunctionalState NewState);
-void SCU_AHBPeriphReset(u32 AHBPeriph, FunctionalState NewState);
-void SCU_APBPeriphIdleConfig(u32 APBPeriph, FunctionalState NewState);
-void SCU_AHBPeriphIdleConfig(u32 AHBPeriph, FunctionalState NewState);
-void SCU_APBPeriphDebugConfig(u32 APBPeriph, FunctionalState NewState);
-void SCU_AHBPeriphDebugConfig(u32 AHBPeriph, FunctionalState NewState);
-void SCU_BRCLKDivisorConfig(u32 BRCLK_Divisor);
-void SCU_TIMCLKSourceConfig(u8 TIMx, u32 TIMCLK_Source);
-void SCU_TIMPresConfig(u8 TIMx, u16 Prescaler);
-void SCU_USBCLKConfig(u32 USBCLK_Source);
-void SCU_PHYCLKConfig(FunctionalState NewState);
-void SCU_FMICLKDivisorConfig(u32 FMICLK_Divisor);
-void SCU_EMIBCLKDivisorConfig(u32 SCU_EMIBCLK);
-void SCU_EMIModeConfig(u32 SCU_EMIMODE);
-void SCU_EMIALEConfig(u32 SCU_EMIALE_LEN, u32 SCU_EMIALE_POL);
-void SCU_ITConfig(u32 SCU_IT, FunctionalState NewState);
-FlagStatus SCU_GetFlagStatus(u32 SCU_Flag);
-void SCU_ClearFlag(u32 SCU_Flag);
-u32 SCU_GetPLLFreqValue(void);
-u32 SCU_GetMCLKFreqValue(void);
-u32 SCU_GetRCLKFreqValue(void);
-u32 SCU_GetHCLKFreqValue(void);
-u32 SCU_GetPCLKFreqValue(void);
-void SCU_WakeUpLineConfig(u8 EXTint);
-void SCU_SpecIntRunModeConfig(FunctionalState NewState);
-void SCU_EnterIdleMode(void);
-void SCU_EnterSleepMode(void);
-void SCU_UARTIrDASelect(UART_TypeDef * UARTx, u8 UART_IrDA_Mode);
-void SCU_PFQBCCmd(FunctionalState NewState);
-
-#endif /*__91x_SCU_H*/
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_complex_startup/include/91x_ssp.h b/uc_str912/prj_blinky_complex_startup/include/91x_ssp.h
deleted file mode 100644
index e356d4f..0000000
--- a/uc_str912/prj_blinky_complex_startup/include/91x_ssp.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_ssp.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* SSP software library.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __91x_SSP_H
-#define __91x_SSP_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_map.h"
-
-/* Exported types ------------------------------------------------------------*/
-/* SSP Init structure definition */
-typedef struct
-{
- u16 SSP_FrameFormat ;
- u16 SSP_Mode ;
- u16 SSP_CPOL ;
- u16 SSP_CPHA ;
- u16 SSP_DataSize ;
- u16 SSP_SlaveOutput ;
- u8 SSP_ClockRate ;
- u8 SSP_ClockPrescaler ;
-}SSP_InitTypeDef;
-
-/* Exported constants --------------------------------------------------------*/
-/* SSP Frame Format Select */
-#define SSP_FrameFormat_TI 0x0010
-#define SSP_FrameFormat_Motorola 0xFFCF
-#define SSP_FrameFormat_Microwire 0x0020
-
-/* SSP Master/Slave Select */
-#define SSP_Mode_Master 0xFFFB
-#define SSP_Mode_Slave 0x0004
-
-/* SSP Clock Polarity */
-#define SSP_CPOL_Low 0xFFBF
-#define SSP_CPOL_High 0x0040
-
-/* SSP Clock Phase */
-#define SSP_CPHA_1Edge 0xFF7F
-#define SSP_CPHA_2Edge 0x0080
-
-/* SSP Data Size */
-#define SSP_DataSize_16b 0x000F
-#define SSP_DataSize_15b 0x000E
-#define SSP_DataSize_14b 0x000D
-#define SSP_DataSize_13b 0x000C
-#define SSP_DataSize_12b 0x000B
-#define SSP_DataSize_11b 0x000A
-#define SSP_DataSize_10b 0x0009
-#define SSP_DataSize_9b 0x0008
-#define SSP_DataSize_8b 0x0007
-#define SSP_DataSize_7b 0x0006
-#define SSP_DataSize_6b 0x0005
-#define SSP_DataSize_5b 0x0004
-#define SSP_DataSize_4b 0x0003
-
-/* SSP Slave output config */
-#define SSP_SlaveOutput_Enable 0xFFF7
-#define SSP_SlaveOutput_Disable 0x0008
-
-/* SSP Interrupts */
-#define SSP_IT_TxFifo 0x0008
-#define SSP_IT_RxFifo 0x0004
-#define SSP_IT_RxTimeOut 0x0002
-#define SSP_IT_RxOverrun 0x0001
-
-/* SSP Flags */
-#define SSP_FLAG_Busy 0x0024
-#define SSP_FLAG_RxFifoFull 0x0023
-#define SSP_FLAG_RxFifoNotEmpty 0x0022
-#define SSP_FLAG_TxFifoNotFull 0x0021
-#define SSP_FLAG_TxFifoEmpty 0x0020
-#define SSP_FLAG_TxFifo 0x0043
-#define SSP_FLAG_RxFifo 0x0042
-#define SSP_FLAG_RxTimeOut 0x0041
-#define SSP_FLAG_RxOverrun 0x0040
-
-/* SSP DMA Requests */
-#define SSP_DMA_Transmit 0x0002
-#define SSP_DMA_Receive 0x0001
-
-/* Exported macro ------------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-
-void SSP_DeInit(SSP_TypeDef* SSPx);
-void SSP_Init(SSP_TypeDef* SSPx, SSP_InitTypeDef* SSP_InitStruct);
-void SSP_StructInit(SSP_InitTypeDef* SSP_InitStruct);
-void SSP_Cmd(SSP_TypeDef* SSPx, FunctionalState NewState);
-void SSP_ITConfig(SSP_TypeDef* SSPx, u16 SSP_IT, FunctionalState NewState);
-void SSP_DMACmd(SSP_TypeDef* SSPx, u16 SSP_DMATransfert, FunctionalState NewState);
-void SSP_SendData(SSP_TypeDef* SSPx, u16 Data);
-u16 SSP_ReceiveData(SSP_TypeDef* SSPx);
-void SSP_LoopBackConfig(SSP_TypeDef* SSPx, FunctionalState NewState);
-FlagStatus SSP_GetFlagStatus(SSP_TypeDef* SSPx, u16 SSP_FLAG);
-void SSP_ClearFlag(SSP_TypeDef* SSPx, u16 SSP_FLAG);
-ITStatus SSP_GetITStatus(SSP_TypeDef* SSPx, u16 SSP_IT);
-void SSP_ClearITPendingBit(SSP_TypeDef* SSPx, u16 SSP_IT);
-
-#endif /* __91x_SSP_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
-
diff --git a/uc_str912/prj_blinky_complex_startup/include/91x_tim.h b/uc_str912/prj_blinky_complex_startup/include/91x_tim.h
deleted file mode 100644
index b587c27..0000000
--- a/uc_str912/prj_blinky_complex_startup/include/91x_tim.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_tim.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* TIM software library.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __91x_TIM_H
-#define __91x_TIM_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_map.h"
-#include "91x_scu.h"
-
-/* Exported types ----------------------------------------------------------- */
-
-/* TIM Init structure define */
-typedef struct
-{
- u16 TIM_Mode; /* Timer mode */
- u16 TIM_OC1_Modes; /* Output Compare 1 Mode: Timing or Wave */
- u16 TIM_OC2_Modes; /* Output Compare 2 Mode: Timing or Wave */
- u16 TIM_Clock_Source; /* Timer Clock source APB/SCU/EXTERNAL */
- u16 TIM_Clock_Edge; /* Timer Clock Edge: Rising or Falling Edge */
- u16 TIM_OPM_INPUT_Edge; /* Timer Input Capture 1 Edge used in OPM Mode */
- u16 TIM_ICAP1_Edge; /* Timer Input Capture 1 Edge used in ICAP1 Mode */
- u16 TIM_ICAP2_Edge; /* Timer Input Capture 2 Edge used in ICAP2 Mode */
- u8 TIM_Prescaler; /* Timer Prescaler factor */
- u16 TIM_Pulse_Level_1; /* Level applied on the Output Compare Pin 1 */
- u16 TIM_Pulse_Level_2; /* Level applied on the Output Compare Pin 2 */
- u16 TIM_Period_Level; /* Level applied during the Period of a PWM Mode */
- u16 TIM_Pulse_Length_1; /* Pulse 1 Length used in Output Compare 1 Mode */
- u16 TIM_Pulse_Length_2; /* Pulse 2 Length used in Output Compare 2 Mode */
- u16 TIM_Full_Period; /* Period Length used in PWM Mode */
-} TIM_InitTypeDef;
-
-typedef enum
-{
- TIM_START,
- TIM_STOP,
- TIM_CLEAR
-} TIM_CounterOperations;
-
-/* Exported constants --------------------------------------------------------*/
-
-/* TIM MODE */
-#define TIM_PWMI 0x4000 /* PWM INPUT Mode */
-#define TIM_OCM_CHANNEL_1 0x0040 /* OUTPUT COMPARE CHANNEL 1 Mode */
-#define TIM_OCM_CHANNEL_2 0x0080 /* OUTPUT COMPARE CHANNEL 2 Mode */
-#define TIM_OCM_CHANNEL_12 0x00C0 /* OUTPUT COMPARE CHANNEL 1 & 2 Mode */
-#define TIM_PWM 0x0010 /* PWM Mode */
-#define TIM_OPM 0x0020 /* ONE PULSE Mode */
-#define TIM_ICAP_CHANNEL_1 0x0400 /* INPUT CAPTURE 1 Mode */
-#define TIM_ICAP_CHANNEL_2 0x0500 /* INPUT CAPTURE 2 Mode */
-#define TIM_ICAP_CHANNEL_12 0x0600 /* INPUT CAPTURE 1 & 2 Mode */
-
-/* TIM OUTPUT COMPARE MODE */
-#define TIM_WAVE 0x0001
-#define TIM_TIMING 0x0002
-
-/* TIM CLOCK SOURCE */
-#define TIM_CLK_APB 0xFFFE
-#define TIM_CLK_EXTERNAL 0x0001
-#define TIM_CLK_SCU 0x0001
-
-/* TIM CLOCK EDGE */
-#define TIM_CLK_EDGE_FALLING 0xFFFD
-#define TIM_CLK_EDGE_RISING 0x0002
-
-/* TIM OPM INPUT EDGE */
-#define TIM_OPM_EDGE_FALLING 0xFFFB
-#define TIM_OPM_EDGE_RISING 0x0004
-
-/* TIM ICAPA INPUT EDGE */
-#define TIM_ICAP1_EDGE_FALLING 0xFFFB
-#define TIM_ICAP1_EDGE_RISING 0x0004
-
-/* TIM ICAPB INPUT EDGE */
-#define TIM_ICAP2_EDGE_FALLING 0xFFF7
-#define TIM_ICAP2_EDGE_RISING 0x0008
-
-/* TIM OUTPUT LEVEL */
-#define TIM_HIGH 0x0200
-#define TIM_LOW 0x0300
-
-/* TIM OUTPUT EDGE */
-#define TIM_OUTPUT_EDGE_RISING 0x8000
-#define TIM_OUTPUT_EDGE_FALLING 0x0800
-
-/* TIM channels */
-#define TIM_PWM_OC1_Channel 0x1 /* PWM/Output Compare 1 Channel */
-#define TIM_OC2_Channel 0x2 /* Output Compare 2 Channel */
-
-/* TIM DMA SOURCE */
-#define TIM_DMA_IC1 0x0000 /* Input Capture Channel 1 DMA Source */
-#define TIM_DMA_OC1 0x1000 /* OUTPUT Compare Channel 1 DMA Source */
-#define TIM_DMA_IC2 0x2000 /* Input Capture Channel 2 DMA Source */
-#define TIM_DMA_OC2 0x3000 /* OUTPUT Compare Channel 2 DMA Source */
-
-/* TIM DMA ENABLE or DISABLE */
-#define TIM_DMA_ENABLE 0x0400 /* DMA Enable */
-#define TIM_DMA_DISABLE 0xFBFF /* DMA Disable */
-
-/* TIM Interruption Sources*/
-#define TIM_IT_IC1 0x8000 /* Input Capture Channel 1 Interrupt Source */
-#define TIM_IT_OC1 0x4000 /* Output Compare Channel 1 Interrupt Source */
-#define TIM_IT_TO 0x2000 /* Timer OverFlow Interrupt Source */
-#define TIM_IT_IC2 0x1000 /* Input Capture Channel 2 Interrupt Source */
-#define TIM_IT_OC2 0x0800 /* Output Compare Channel 2 Interrupt Source */
-
-/* TIM Flags */
-#define TIM_FLAG_IC1 0x8000 /* Input Capture Channel 1 Flag */
-#define TIM_FLAG_OC1 0x4000 /* Output Compare Channel 1 Flag */
-#define TIM_FLAG_TO 0x2000 /* Timer OverFlow Flag */
-#define TIM_FLAG_IC2 0x1000 /* Input Capture Channel 2 Flag */
-#define TIM_FLAG_OC2 0x0800 /* Output Compare Channel 2 Flag */
-
-/* Module private variables --------------------------------------------------*/
-/* Exported macro ------------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-void TIM_Init(TIM_TypeDef *TIMx, TIM_InitTypeDef *TIM_InitStruct);
-void TIM_DeInit(TIM_TypeDef *TIMx);
-void TIM_StructInit(TIM_InitTypeDef *TIM_InitStruct);
-void TIM_CounterCmd(TIM_TypeDef *TIMx, TIM_CounterOperations TIM_operation);
-void TIM_PrescalerConfig(TIM_TypeDef *TIMx, u8 TIM_Prescaler);
-u8 TIM_GetPrescalerValue(TIM_TypeDef *TIMx);
-u16 TIM_GetCounterValue(TIM_TypeDef *TIMx);
-u16 TIM_GetICAP1Value(TIM_TypeDef *TIMx);
-u16 TIM_GetICAP2Value(TIM_TypeDef *TIMx);
-void TIM_SetPulse(TIM_TypeDef *TIMx,u16 TIM_Channel ,u16 TIM_Pulse);
-FlagStatus TIM_GetFlagStatus(TIM_TypeDef *TIMx, u16 TIM_Flag);
-void TIM_ClearFlag(TIM_TypeDef *TIMx, u16 TIM_Flag);
-u16 TIM_GetPWMIPulse(TIM_TypeDef *TIMx);
-u16 TIM_GetPWMIPeriod(TIM_TypeDef *TIMx);
-void TIM_ITConfig(TIM_TypeDef *TIMx, u16 TIM_IT, FunctionalState TIM_Newstate);
-void TIM_DMAConfig(TIM_TypeDef *TIMx, u16 TIM_DMA_Sources);
-void TIM_DMACmd(TIM_TypeDef *TIMx, FunctionalState TIM_Newstate);
-
-#endif /* __91x_TIM_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_complex_startup/include/91x_type.h b/uc_str912/prj_blinky_complex_startup/include/91x_type.h
deleted file mode 100644
index 916d81c..0000000
--- a/uc_str912/prj_blinky_complex_startup/include/91x_type.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_type.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : It contains common types and constants used in all the
-* peripherals' drivers.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-**********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*********************************************************************************/
-
-#ifndef __91x_type_H
-#define __91x_type_H
-
- typedef long long u64;
- typedef unsigned long u32;
- typedef unsigned short u16;
- typedef unsigned char u8;
-
- typedef signed long s32;
- typedef signed short s16;
- typedef signed char s8;
-
- typedef volatile unsigned long vu32;
- typedef volatile unsigned short vu16;
- typedef volatile unsigned char vu8;
-
- typedef volatile signed long vs32;
- typedef volatile signed short vs16;
- typedef volatile signed char vs8;
-
-typedef enum { FALSE = 0, TRUE = !FALSE } bool;
-
-typedef enum { RESET = 0, SET = !RESET } FlagStatus, ITStatus;
-
-typedef enum { DISABLE = 0, ENABLE = !DISABLE} FunctionalState;
-
-typedef enum { ERROR = 0, SUCCESS = !ERROR} ErrorStatus;
-
-#endif /* __91x_type_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_complex_startup/include/91x_uart.h b/uc_str912/prj_blinky_complex_startup/include/91x_uart.h
deleted file mode 100644
index b979438..0000000
--- a/uc_str912/prj_blinky_complex_startup/include/91x_uart.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_uart.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* UART software library.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __91x_UART_H
-#define __91x_UART_H
-
-/* Includes ------------------------------------------------------------------*/
-#include <91x_map.h>
-
-/* Exported types ------------------------------------------------------------*/
-/* UART FIFO Level enumeration */
-typedef enum
-{
- UART_FIFOLevel_1_8 = 0x0000, /* FIFO size 16 bytes, FIFO level 2 bytes */
- UART_FIFOLevel_1_4 = 0x0001, /* FIFO size 16 bytes, FIFO level 4 bytes */
- UART_FIFOLevel_1_2 = 0x0002, /* FIFO size 16 bytes, FIFO level 8 bytes */
- UART_FIFOLevel_3_4 = 0x0003, /* FIFO size 16 bytes, FIFO level 12 bytes */
- UART_FIFOLevel_7_8 = 0x0004 /* FIFO size 16 bytes, FIFO level 14 bytes */
-}UART_FIFOLevel;
-
-/* UART Init Structure definition */
-typedef struct
-{
- u16 UART_WordLength;
- u16 UART_StopBits;
- u16 UART_Parity;
- u32 UART_BaudRate;
- u16 UART_HardwareFlowControl;
- u16 UART_Mode;
- u16 UART_FIFO;
- UART_FIFOLevel UART_TxFIFOLevel;
- UART_FIFOLevel UART_RxFIFOLevel;
-}UART_InitTypeDef;
-
-
-/* UART RTS enumeration */
-typedef enum
-{
- LowLevel = 0,
- HighLevel
-}UART_LevelTypeDef;
-
-/* Exported constants --------------------------------------------------------*/
-/* UART Data Length */
-#define UART_WordLength_5D 0x0000 /* 5 bits Data */
-#define UART_WordLength_6D 0x0020 /* 6 bits Data */
-#define UART_WordLength_7D 0x0040 /* 7 bits Data */
-#define UART_WordLength_8D 0x0060 /* 8 bits Data */
-
-/* UART Stop Bits */
-#define UART_StopBits_1 0xFFF7 /* Disable two stop bit is transmitted
- at the end of frame */
-#define UART_StopBits_2 0x0008 /* Enable Two stop bits are transmitted
- at the end of frame */
-/* UART Parity */
-#define UART_Parity_No 0x0000 /* Parity Disable */
-#define UART_Parity_Even 0x0006 /* Even Parity */
-#define UART_Parity_Odd 0x0002 /* Odd Parity */
-#define UART_Parity_OddStick 0x0082 /* 1 is transmitted as bit parity */
-#define UART_Parity_EvenStick 0x0086 /* 0 is transmitted as bit parity */
-
-/* UART Hardware Flow Control */
-#define UART_HardwareFlowControl_None 0x0000 /* HFC Disable */
-#define UART_HardwareFlowControl_RTS 0x4000 /* RTS Enable */
-#define UART_HardwareFlowControl_CTS 0x8000 /* CTS Enable */
-#define UART_HardwareFlowControl_RTS_CTS 0xC000 /* CTS and RTS Enable */
-
-/* UART Mode */
-#define UART_Mode_Rx 0x0200 /* UART Rx Enabled */
-#define UART_Mode_Tx 0x0100 /* UART Tx Enbled */
-#define UART_Mode_Tx_Rx 0x0300 /* UART Tx and Rx Enabled */
-
-/* UART FIFO */
-#define UART_FIFO_Disable 0xFFEF /* FIFOs Disable */
-#define UART_FIFO_Enable 0x0010 /* FIFOs Enable */
-
-/* UART Interrupt definition */
-#define UART_IT_OverrunError 0x0400 /* Overrun Error interrupt mask */
-#define UART_IT_BreakError 0x0200 /* Break Error interrupt mask */
-#define UART_IT_ParityError 0x0100 /* Parity Error interrupt mask */
-#define UART_IT_FrameError 0x0080 /* Frame Error interrupt mask */
-#define UART_IT_ReceiveTimeOut 0x0040 /* Receive Time Out interrupt mask */
-#define UART_IT_Transmit 0x0020 /* Transmit interrupt mask */
-#define UART_IT_Receive 0x0010 /* Receive interrupt mask */
-#define UART_IT_DSR 0x0008 /* DSR interrupt mask */
-#define UART_IT_DCD 0x0004 /* DCD interrupt mask */
-#define UART_IT_CTS 0x0002 /* CTS interrupt mask */
-#define UART_IT_RI 0x0001 /* RI interrupt mask */
-
-/* UART DMA On Error */
-#define UART_DMAOnError_Enable 0xFFFB /* DMA receive request enabled
- when the UART error interrupt
- is asserted. */
-#define UART_DMAOnError_Disable 0x0004 /* DMA receive request disabled
- when the UART error interrupt
- is asserted. */
-/* UART DMA Request */
-#define UART_DMAReq_Tx 0x02 /* Transmit DMA Enable */
-#define UART_DMAReq_Rx 0x01 /* Receive DMA Enable */
-
-/* UART FLAG */
-#define UART_FLAG_OverrunError 0x23 /* Overrun error flag */
-#define UART_FLAG_Break 0x22 /* break error flag */
-#define UART_FLAG_ParityError 0x21 /* parity error flag */
-#define UART_FLAG_FrameError 0x20 /* frame error flag */
-#define UART_FLAG_RI 0x48 /* RI flag */
-#define UART_FLAG_TxFIFOEmpty 0x47 /* Transmit FIFO Empty flag */
-#define UART_FLAG_RxFIFOFull 0x46 /* Receive FIFO Full flag */
-#define UART_FLAG_TxFIFOFull 0x45 /* Transmit FIFO Full flag */
-#define UART_FLAG_RxFIFOEmpty 0x44 /* Receive FIFO Empty flag */
-#define UART_FLAG_Busy 0x43 /* UART Busy flag */
-#define UART_FLAG_DCD 0x42 /* DCD flag */
-#define UART_FLAG_DSR 0x41 /* DSR flag */
-#define UART_FLAG_CTS 0x40 /* CTS flag */
-#define UART_RawIT_OverrunError 0x6A /* Overrun Error Raw IT flag */
-#define UART_RawIT_BreakError 0x69 /* Break Error Raw IT flag */
-#define UART_RawIT_ParityError 0x68 /* Parity Error Raw IT flag */
-#define UART_RawIT_FrameError 0x67 /* Frame Error Raw IT flag */
-#define UART_RawIT_ReceiveTimeOut 0x66 /* ReceiveTimeOut Raw IT flag */
-#define UART_RawIT_Transmit 0x65 /* Transmit Raw IT flag */
-#define UART_RawIT_Receive 0x64 /* Receive Raw IT flag */
-#define UART_RawIT_DSR 0x63 /* DSR Raw IT flag */
-#define UART_RawIT_DCD 0x62 /* DCD Raw IT flag */
-#define UART_RawIT_CTS 0x61 /* CTS Raw IT flag */
-#define UART_RawIT_RI 0x60 /* RI Raw IT flag */
-
-/*IrDAx select*/
-#define IrDA0 0x01 /*IrDA0 select*/
-#define IrDA1 0x02 /*IrDA0 select*/
-#define IrDA2 0x03 /*IrDA0 select*/
-
-/* Exported macro ------------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-void UART_DeInit(UART_TypeDef* UARTx);
-void UART_Init(UART_TypeDef* UARTx, UART_InitTypeDef* UART_InitStruct);
-void UART_StructInit(UART_InitTypeDef* UART_InitStruct);
-void UART_Cmd(UART_TypeDef* UARTx, FunctionalState NewState);
-void UART_ITConfig(UART_TypeDef* UARTx, u16 UART_IT, FunctionalState NewState);
-void UART_DMAConfig(UART_TypeDef* UARTx, u16 UART_DMAOnError);
-void UART_DMACmd(UART_TypeDef* UARTx, u8 UART_DMAReq, FunctionalState NewState);
-void UART_LoopBackConfig(UART_TypeDef* UARTx, FunctionalState NewState);
-FlagStatus UART_GetFlagStatus(UART_TypeDef* UARTx, u16 UART_FLAG);
-void UART_ClearFlag(UART_TypeDef* UARTx);
-void UART_ClearITPendingBit(UART_TypeDef* UARTx, u16 UART_IT);
-void UART_IrDALowPowerConfig(u8 IrDAx, FunctionalState NewState);
-void UART_IrDACmd(u8 IrDAx, FunctionalState NewState);
-void UART_IrDASetCounter(u8 IrDAx, u32 IrDA_Counter);
-void UART_SendData(UART_TypeDef* UARTx, u8 Data);
-u8 UART_ReceiveData(UART_TypeDef* UARTx);
-void UART_SendBreak(UART_TypeDef* UARTx);
-void UART_DTRConfig(UART_LevelTypeDef LevelState);
-void UART_RTSConfig(UART_LevelTypeDef LevelState);
-ITStatus UART_GetITStatus(UART_TypeDef* UARTx, u16 UART_IT);
-
-#endif /* __91x_UART_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_complex_startup/include/91x_vic.h b/uc_str912/prj_blinky_complex_startup/include/91x_vic.h
deleted file mode 100644
index 127716a..0000000
--- a/uc_str912/prj_blinky_complex_startup/include/91x_vic.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_vic.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* VIC software library.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-
-/* Define to prevent recursive inclusion ------------------------------------ */
-#ifndef __91x_VIC_H
-#define __91x_VIC_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_map.h"
-#include "91x_it.h"
-
-/* Exported types ------------------------------------------------------------*/
-/* Type of interrupt */
-typedef enum
-{
- VIC_IRQ,
- VIC_FIQ
-} VIC_ITLineMode;
-
-/* Exported constants --------------------------------------------------------*/
-
-/* VIC sources*/
-
-#define WDG_ITLine 0
-#define SW_ITLine 1
-#define ARMRX_ITLine 2
-#define ARMTX_ITLine 3
-#define TIM0_ITLine 4
-#define TIM1_ITLine 5
-#define TIM2_ITLine 6
-#define TIM3_ITLine 7
-#define USBHP_ITLine 8
-#define USBLP_ITLine 9
-#define SCU_ITLine 10
-#define ENET_ITLine 11
-#define DMA_ITLine 12
-#define CAN_ITLine 13
-#define MC_ITLine 14
-#define ADC_ITLine 15
-#define UART0_ITLine 16
-#define UART1_ITLine 17
-#define UART2_ITLine 18
-#define I2C0_ITLine 19
-#define I2C1_ITLine 20
-#define SSP0_ITLine 21
-#define SSP1_ITLine 22
-#define LVD_ITLine 23
-#define RTC_ITLine 24
-#define WIU_ITLine 25
-#define EXTIT0_ITLine 26
-#define EXTIT1_ITLine 27
-#define EXTIT2_ITLine 28
-#define EXTIT3_ITLine 29
-#define USBWU_ITLine 30
-#define PFQBC_ITLine 31
-
-
-/* Module private variables --------------------------------------------------*/
-/* Exported macro ------------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-
-void VIC_DeInit(void);
-FlagStatus VIC_GetIRQStatus(u16 VIC_Source);
-FlagStatus VIC_GetFIQStatus(u16 VIC_Source);
-FlagStatus VIC_GetSourceITStatus(u16 VIC_Source);
-void VIC_ITCmd(u16 VIC_Source, FunctionalState VIC_NewState);
-void VIC_SWITCmd(u16 VIC_Source, FunctionalState VIC_NewState);
-void VIC_ProtectionCmd(FunctionalState VIC_NewState);
-u32 VIC_GetCurrentISRAdd(VIC_TypeDef* VICx);
-u32 VIC_GetISRVectAdd(u16 VIC_Source);
-void VIC_Config(u16 VIC_Source, VIC_ITLineMode VIC_LineMode, u8 VIC_Priority);
-
-#endif /* __91x_VIC_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
-
diff --git a/uc_str912/prj_blinky_complex_startup/include/91x_wdg.h b/uc_str912/prj_blinky_complex_startup/include/91x_wdg.h
deleted file mode 100644
index fc70547..0000000
--- a/uc_str912/prj_blinky_complex_startup/include/91x_wdg.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_wdg.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* WDG software library.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __91x_WDG_H
-#define __91x_WDG_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_map.h"
-
-/* Exported types ------------------------------------------------------------*/
-typedef struct
-{
-u16 WDG_Mode;
-u16 WDG_ClockSource;
-u16 WDG_Prescaler;
-u16 WDG_Preload;
-
-} WDG_InitTypeDef;
-
-/* Exported constants --------------------------------------------------------*/
-
-/* WDG_Mode */
-#define WDG_Mode_Wdg 0x0001 /*WDG configured to run in watchdog mode.*/
-#define WDG_Mode_Timer 0xFFFE /*WDG configured to be in Free-running Timer mode.*/
-
-
-/* WDG_ClockSource */
-#define WDG_ClockSource_Rtc 0x0004 /* External clock ( 32 khz RTC clock ) will be used as counting clock.*/
-#define WDG_ClockSource_Apb 0xFFFB /*The APB clock signal will be used as counting clock.*/
-
-/* WDG_Prescaler */
-/*This member must be a number between 0x00 and 0xFF.
-Specifies the Prescaler value to divide the clock source.
-The clock of the Watchdog Timer Counter is divided by " WDG_Prescaler + 1".*/
-
-
-
-/* WDG_Preload */
-/*This member must be a number between 0x0000 and 0xFFFF.
-This value is loaded in the WDG Counter when it starts counting.*/
-
-
-/* WDG Sequence */
-#define WDG_KeyValue1 0xA55A
-#define WDG_KeyValue2 0x5AA5
-
-/* Exported macro ------------------------------------------------------------*/
-
-
-/* Exported functions ------------------------------------------------------- */
-
-void WDG_DeInit(void);
-void WDG_Init(WDG_InitTypeDef* WDG_InitStruct);
-void WDG_StructInit(WDG_InitTypeDef* WDG_InitStruct);
-void WDG_Cmd(FunctionalState NewState);
-void WDG_ITConfig(FunctionalState NewState);
-u16 WDG_GetCounter(void);
-FlagStatus WDG_GetFlagStatus(void);
-void WDG_ClearFlag(void);
-ITStatus WDG_GetITStatus(void);
-void WDG_ClearITPendingBit(void);
-
-#endif /* __WDG_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_complex_startup/include/91x_wiu.h b/uc_str912/prj_blinky_complex_startup/include/91x_wiu.h
deleted file mode 100644
index 8b0349c..0000000
--- a/uc_str912/prj_blinky_complex_startup/include/91x_wiu.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_wiu.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* WIU software library.
-**********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-**********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*********************************************************************************/
-
-/* Define to prevent recursive inclusion ------------------------------------ */
-#ifndef __91x_WIU_H
-#define __91x_WIU_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_map.h"
-
-/* Exported types ------------------------------------------------------------*/
-/* WIU Init structure type define */
-typedef struct
-{
- u8 WIU_Mode ;
- u8 WIU_TriggerEdge;
- u32 WIU_Line ;
-}WIU_InitTypeDef ;
-
-/* Exported constants --------------------------------------------------------*/
-/* Wake-up line triggering edge */
-#define WIU_FallingEdge 0x00
-#define WIU_RisingEdge 0x01
-
-/* Wake-up unit modes */
-#define WIU_Mode_WakeUp 0x01
-#define WIU_Mode_Interrupt 0x02
-#define WIU_Mode_WakeUpInterrupt 0x03
-#define WIU_Mode_SWInterrupt 0x04
-
-/* Wake-up lines*/
-#define WIU_Line0 0x0001
-#define WIU_Line1 (WIU_Line0<<1)
-#define WIU_Line2 (WIU_Line1<<1)
-#define WIU_Line3 (WIU_Line2<<1)
-#define WIU_Line4 (WIU_Line3<<1)
-#define WIU_Line5 (WIU_Line4<<1)
-#define WIU_Line6 (WIU_Line5<<1)
-#define WIU_Line7 (WIU_Line6<<1)
-#define WIU_Line8 (WIU_Line7<<1)
-#define WIU_Line9 (WIU_Line8<<1)
-#define WIU_Line10 (WIU_Line9<<1)
-#define WIU_Line11 (WIU_Line10<<1)
-#define WIU_Line12 (WIU_Line11<<1)
-#define WIU_Line13 (WIU_Line12<<1)
-#define WIU_Line14 (WIU_Line13<<1)
-#define WIU_Line15 (WIU_Line14<<1)
-#define WIU_Line16 (WIU_Line15<<1)
-#define WIU_Line17 (WIU_Line16<<1)
-#define WIU_Line18 (WIU_Line17<<1)
-#define WIU_Line19 (WIU_Line18<<1)
-#define WIU_Line20 (WIU_Line19<<1)
-#define WIU_Line21 (WIU_Line20<<1)
-#define WIU_Line22 (WIU_Line21<<1)
-#define WIU_Line23 (WIU_Line22<<1)
-#define WIU_Line24 (WIU_Line23<<1)
-#define WIU_Line25 (WIU_Line24<<1)
-#define WIU_Line26 (WIU_Line25<<1)
-#define WIU_Line27 (WIU_Line26<<1)
-#define WIU_Line28 (WIU_Line27<<1)
-#define WIU_Line29 (WIU_Line28<<1)
-#define WIU_Line30 (WIU_Line29<<1)
-#define WIU_Line31 (WIU_Line30<<1)
-
-/* Exported constants --------------------------------------------------------*/
-/* Module private variables --------------------------------------------------*/
-/* Exported macro ------------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-
-void WIU_DeInit(void);
-void WIU_StructInit(WIU_InitTypeDef* WIU_InitStruct);
-void WIU_Init(WIU_InitTypeDef* WIU_InitStruct);
-void WIU_GenerateSWInterrupt(u32 WIU_Line);
-FlagStatus WIU_GetFlagStatus(u32 WIU_Line);
-void WIU_ClearFlag(u32 WIU_Line);
-ITStatus WIU_GetITStatus(u32 WIU_Line);
-void WIU_ClearITPendingBit(u32 WIU_Line);
-
-#endif /* __91x_WIU_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
-
diff --git a/uc_str912/prj_blinky_complex_startup/include/usb_core.h b/uc_str912/prj_blinky_complex_startup/include/usb_core.h
deleted file mode 100644
index 72feb08..0000000
--- a/uc_str912/prj_blinky_complex_startup/include/usb_core.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : usb_core.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : USB state machine structures and functions prototypes
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-#define Type_Recipient (pInfo->USBbmRequestType & (REQUEST_TYPE | RECIPIENT))
-
-#define STD_MAXPACKETSIZE 0x40 /* 64 bytes*/
-
-typedef enum _CONTROL_STATE {
- WAIT_SETUP,
- SETTING_UP,
- IN_DATA,
- OUT_DATA,
- LAST_IN_DATA,
- LAST_OUT_DATA,
- WAIT_STATUS_IN,
- WAIT_STATUS_OUT,
- STALLED,
- PAUSE
-} CONTROL_STATE; /* The state machine states of a control pipe */
-
-
-typedef struct OneDescriptor {
- BYTE *Descriptor;
- WORD Descriptor_Size;
-} ONE_DESCRIPTOR, *PONE_DESCRIPTOR;
-
-
-typedef enum _RESULT {
- USB_SUCCESS = 0, /* Process sucessfully */
- USB_ERROR,
- UNSUPPORT,
- NOT_READY /* The process has not been finished, */
- /* endpoint will be NAK to further rquest */
-} RESULT;
-
-
-/*-*-*-*-*-*-*-*-*-*-* Definitions for endpoint level -*-*-*-*-*-*-*-*-*-*-*-*/
-
-typedef struct _ENDPOINT_INFO {
- WORD Usb_wLength;
- WORD Usb_wOffset;
- WORD PacketSize;
- BYTE *(*CopyData)(WORD Length);
-} ENDPOINT_INFO;
-
-#define Usb_rLength Usb_wLength
-#define Usb_rOffset Usb_wOffset
-
-
-/*-*-*-*-*-*-*-*-*-*-*-* Definitions for device level -*-*-*-*-*-*-*-*-*-*-*-*/
-
-typedef struct _DEVICE {
- BYTE Total_Endpoint; /* Number of endpoints that are used */
- BYTE Total_Configuration;/* Number of configuration available */
-} DEVICE;
-
-typedef union {
- WORD w;
- struct BW {
- BYTE bb1;
- BYTE bb0;
- } bw;
-} WORD_BYTE;
-
-typedef struct _DEVICE_INFO {
- BYTE USBbmRequestType; /* bmRequestType */
- BYTE USBbRequest; /* bRequest */
- WORD_BYTE USBwValues; /* wValue */
- WORD_BYTE USBwIndexs; /* wIndex */
- WORD_BYTE USBwLengths; /* wLength */
-
- BYTE ControlState; /* of type CONTROL_STATE */
- BYTE Current_Feature; /*selected features*/
-
- BYTE Current_Configuration; /* Selected configuration */
- BYTE Current_Interface; /* Selected interface of current configuration */
- BYTE Current_AlternateSetting;/* Selected Alternate Setting of current interface*/
- ENDPOINT_INFO Ctrl_Info;
-} DEVICE_INFO;
-
-typedef struct _DEVICE_PROP {
- void (*Init)(void);
- void (*Reset)(void);
- void (*Process_Status_IN)(void);
- void (*Process_Status_OUT)(void);
- RESULT (*Class_Data_Setup)(BYTE RequestNo);
- RESULT (*Class_NoData_Setup)(BYTE RequestNo);
- RESULT (*Class_Get_Interface_Setting)(BYTE Interface,BYTE AlternateSetting);
- BYTE* (*GetDeviceDescriptor)(WORD Length);
- BYTE* (*GetConfigDescriptor)(WORD Length);
- BYTE* (*GetStringDescriptor)(WORD Length);
- BYTE* RxEP_buffer;
- WORD MaxPacketSize;
-} DEVICE_PROP;
-
-extern DEVICE_PROP Device_Property;
-extern DEVICE Device_Table;
-extern DEVICE_INFO Device_Info;
-
-/* cells saving status during interrupt servicing */
-extern WORD SaveRState;
-extern WORD SaveTState;
-
-#define USBwValue USBwValues.w
-#define USBwValue0 USBwValues.bw.bb0
-#define USBwValue1 USBwValues.bw.bb1
-#define USBwIndex USBwIndexs.w
-#define USBwIndex0 USBwIndexs.bw.bb0
-#define USBwIndex1 USBwIndexs.bw.bb1
-#define USBwLength USBwLengths.w
-#define USBwLength0 USBwLengths.bw.bb0
-#define USBwLength1 USBwLengths.bw.bb1
-
-BYTE Setup0_Process(void);
-BYTE Post0_Process(void);
-BYTE Out0_Process(void);
-BYTE In0_Process(void);
-
-RESULT Standard_SetEndPointFeature(void);
-RESULT Standard_SetDeviceFeature(void);
-
-BYTE *Standard_GetConfiguration(WORD Length);
-RESULT Standard_SetConfiguration(void);
-BYTE *Standard_GetInterface(WORD Length);
-RESULT Standard_SetInterface(void);
-BYTE *Standard_GetDescriptorData(WORD Length, PONE_DESCRIPTOR pDesc);
-BYTE *Standard_GetStringDescriptor(WORD Length, PONE_DESCRIPTOR pDesc);
-
-void SetDeviceAddress(BYTE);
-void NOP_Process(void);
-
diff --git a/uc_str912/prj_blinky_complex_startup/include/usb_def.h b/uc_str912/prj_blinky_complex_startup/include/usb_def.h
deleted file mode 100644
index 7b69666..0000000
--- a/uc_str912/prj_blinky_complex_startup/include/usb_def.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : usb_def.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : definitions related to usb
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-
-/* Definition of "USBbmRequestType" */
-#define REQUEST_TYPE 0x60 /* Mask to get request type */
-#define STANDARD_REQUEST 0x00 /* Standard request */
-#define CLASS_REQUEST 0x20 /* Class request */
-#define VENDOR_REQUEST 0x40 /* Vendor request */
-
-#define RECIPIENT 0x1F /* Mask to get recipient */
-
-typedef enum _RECIPIENT_TYPE {
- DEVICE_RECIPIENT, /* Recipient device */
- INTERFACE_RECIPIENT, /* Recipient interface */
- ENDPOINT_RECIPIENT, /* Recipient endpoint */
- OTHER_RECIPIENT
-} RECIPIENT_TYPE;
-
-
-typedef enum _STANDARD_REQUESTS {
- GET_STATUS = 0,
- CLEAR_FEATURE,
- RESERVED1,
- SET_FEATURE,
- RESERVED2,
- SET_ADDRESS,
- GET_DESCRIPTOR,
- SET_DESCRIPTOR,
- GET_CONFIGURATION,
- SET_CONFIGURATION,
- GET_INTERFACE,
- SET_INTERFACE,
- TOTAL_sREQUEST, /* Total number of Standard request */
- SYNCH_FRAME = 12
-} STANDARD_REQUESTS;
-
-/* Definition of "USBwValue" */
-typedef enum _DESCRIPTOR_TYPE {
- DEVICE_DESCRIPTOR = 1,
- CONFIG_DESCRIPTOR,
- STRING_DESCRIPTOR,
- INTERFACE_DESCRIPTOR,
- ENDPOINT_DESCRIPTOR
-} DESCRIPTOR_TYPE;
-
-/* Feature selector of a SET_FEATURE or CLEAR_FEATURE */
-typedef enum _FEATURE_SELECTOR {
- ENDPOINT_STALL,
- DEVICE_REMOTE_WAKEUP
-} FEATURE_SELECTOR;
-
-
diff --git a/uc_str912/prj_blinky_complex_startup/include/usb_init.h b/uc_str912/prj_blinky_complex_startup/include/usb_init.h
deleted file mode 100644
index 9d94750..0000000
--- a/uc_str912/prj_blinky_complex_startup/include/usb_init.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : usb_init.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : initialization routines & global variables
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-/* Save token on endpoint 0 */
-extern BYTE EP0_Token ;
-
-/* Interrupt flags.*/
-/* Each bit represents an interrupt is coming to that endpoint */
-extern WORD Token_Event ;
-
-/* The number of current endpoint, it will be used to specify an endpoint */
-extern BYTE EPindex;
-
-/* Points to the DEVICE_INFO structure of current device */
-/* The purpose of this register is to speed up the execution */
-extern DEVICE_INFO* pInformation;
-
-/* Points to the DEVICE_PROP structure of current device */
-/* The purpose of this register is to speed up the execution */
-extern DEVICE_PROP* pProperty;
-
-/* Temporary save the state of Rx & Tx status. */
-/* Whenever the Rx or Tx state is changed, its value is saved */
-/* in this variable first and will be set to the EPRB or EPRA */
-/* at the end of interrupt process */
-extern WORD SaveState ;
-
-extern WORD wInterrupt_Mask;
-
-void USB_Init(void);
-
diff --git a/uc_str912/prj_blinky_complex_startup/include/usb_lib.h b/uc_str912/prj_blinky_complex_startup/include/usb_lib.h
deleted file mode 100644
index f33fa73..0000000
--- a/uc_str912/prj_blinky_complex_startup/include/usb_lib.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : usb_lib.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : USB library include files
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-
-#include "USB_type.h"
-#include "USB_regs.h"
-#include "USB_def.h"
-#include "USB_core.h"
-#include "USB_init.h"
-void CTR_ISR(void);
diff --git a/uc_str912/prj_blinky_complex_startup/include/usb_mem.h b/uc_str912/prj_blinky_complex_startup/include/usb_mem.h
deleted file mode 100644
index 3b4c958..0000000
--- a/uc_str912/prj_blinky_complex_startup/include/usb_mem.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : usb_mem.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : utility functions for memory transfers
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* function prototypes */
-void UserToPMABufferCopy(BYTE *pbUsrBuf,WORD wPMABufAddr, WORD wNBytes);
-void PMAToUserBufferCopy(BYTE *pbUsrBuf,WORD wPMABufAddr, WORD wNBytes);
-
-
diff --git a/uc_str912/prj_blinky_complex_startup/include/usb_regs.h b/uc_str912/prj_blinky_complex_startup/include/usb_regs.h
deleted file mode 100644
index fd1ac1b..0000000
--- a/uc_str912/prj_blinky_complex_startup/include/usb_regs.h
+++ /dev/null
@@ -1,442 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : usb_regs.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : Interface functions to USB cell registers
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-#define RegBase (0x70000800L) /* USB_IP Peripheral Registers base address */
-#define PMAAddr (0x70000000L) /* USB_IP Packet Memory Area base address */
-
-/* General registers */
-#define CNTR ((volatile unsigned *)(RegBase + 0x40)) /* Control register */
-#define ISTR ((volatile unsigned *)(RegBase + 0x44)) /* Interrupt status register */
-#define FNR ((volatile unsigned *)(RegBase + 0x48)) /* Frame number register */
-#define DADDR ((volatile unsigned *)(RegBase + 0x4C)) /* Device address register */
-#define BTABLE ((volatile unsigned *)(RegBase + 0x50)) /* Buffer Table address register */
-#define DMACR1 ((volatile unsigned *)(RegBase + 0x54)) /* DMA control register 1 */
-#define DMACR2 ((volatile unsigned *)(RegBase + 0x58)) /* DMA control register 2 */
-#define DMACR3 ((volatile unsigned *)(RegBase + 0x5C)) /* DMA control register 3 */
-#define DMABSIZE ((volatile unsigned *)(RegBase + 0x60))/* DMA burst size register */
-#define DMALLI ((volatile unsigned *)(RegBase + 0x64)) /* DMA LLI register */
-
-
-/* Endpoint registers */
-#define EP0REG ((volatile unsigned *)(RegBase)) /* endpoint 0 register address */
-/* endpoints enumeration */
-#define ENDP0 ((BYTE)0)
-#define ENDP1 ((BYTE)1)
-#define ENDP2 ((BYTE)2)
-#define ENDP3 ((BYTE)3)
-#define ENDP4 ((BYTE)4)
-#define ENDP5 ((BYTE)5)
-#define ENDP6 ((BYTE)6)
-#define ENDP7 ((BYTE)7)
-#define ENDP8 ((BYTE)8)
-#define ENDP9 ((BYTE)9)
-
-/******************************************************************************/
-/* ISTR interrupt events */
-/******************************************************************************/
-#define ISTR_CTR (0x8000) /* Correct TRansfer (clear-only bit) */
-#define ISTR_DOVR (0x4000) /* DMA OVeR/underrun (clear-only bit) */
-#define ISTR_ERR (0x2000) /* ERRor (clear-only bit) */
-#define ISTR_WKUP (0x1000) /* WaKe UP (clear-only bit) */
-#define ISTR_SUSP (0x0800) /* SUSPend (clear-only bit) */
-#define ISTR_RESET (0x0400) /* RESET (clear-only bit) */
-#define ISTR_SOF (0x0200) /* Start Of Frame (clear-only bit) */
-#define ISTR_ESOF (0x0100) /* Expected Start Of Frame (clear-only bit) */
-#define ISTR_SZDPR (0x0080) /* Short or Zero-Length Received Data Packet */
-#define ISTR_DIR (0x0010) /* DIRection of transaction (read-only bit) */
-#define ISTR_EP_ID (0x000F) /* EndPoint IDentifier (read-only bit) */
-
-#define CLR_CTR (~ISTR_CTR) /* clear Correct TRansfer bit */
-#define CLR_DOVR (~ISTR_DOVR) /* clear DMA OVeR/underrun bit*/
-#define CLR_ERR (~ISTR_ERR) /* clear ERRor bit */
-#define CLR_WKUP (~ISTR_WKUP) /* clear WaKe UP bit */
-#define CLR_SUSP (~ISTR_SUSP) /* clear SUSPend bit */
-#define CLR_RESET (~ISTR_RESET)/* clear RESET bit */
-#define CLR_SOF (~ISTR_SOF) /* clear Start Of Frame bit */
-#define CLR_ESOF (~ISTR_ESOF) /* clear Expected Start Of Frame bit */
-#define CLR_SZDPR (~ISTR_SZDPR)/* clear SZDPR bit */
-
-/******************************************************************************/
-/* CNTR control register bits definitions */
-/******************************************************************************/
-#define CNTR_CTRM (0x8000) /* Correct TRansfer Mask */
-#define CNTR_DOVRM (0x4000) /* DMA OVeR/underrun Mask */
-#define CNTR_ERRM (0x2000) /* ERRor Mask */
-#define CNTR_WKUPM (0x1000) /* WaKe UP Mask */
-#define CNTR_SUSPM (0x0800) /* SUSPend Mask */
-#define CNTR_RESETM (0x0400) /* RESET Mask */
-#define CNTR_SOFM (0x0200) /* Start Of Frame Mask */
-#define CNTR_ESOFM (0x0100) /* Expected Start Of Frame Mask */
-#define CNTR_SZDPRM (0x0080) /* Short or Zero-Length Received Data Packet Mask*/
-#define CNTR_RESUME (0x0010) /* RESUME request */
-#define CNTR_FSUSP (0x0008) /* Force SUSPend */
-#define CNTR_LPMODE (0x0004) /* Low-power MODE */
-#define CNTR_PDWN (0x0002) /* Power DoWN */
-#define CNTR_FRES (0x0001) /* Force USB RESet */
-
-/******************************************************************************/
-/* FNR Frame Number Register bit definitions */
-/******************************************************************************/
-#define FNR_RXDP (0x8000) /* status of D+ data line */
-#define FNR_RXDM (0x4000) /* status of D- data line */
-#define FNR_LCK (0x2000) /* LoCKed */
-#define FNR_LSOF (0x1800) /* Lost SOF */
-#define FNR_FN (0x07FF) /* Frame Number */
-/******************************************************************************/
-/* DADDR Device ADDRess bit definitions */
-/******************************************************************************/
-#define DADDR_EF (0x80)
-#define DADDR_ADD (0x7F)
-
-/******************************************************************************/
-/* Endpoint register */
-/******************************************************************************/
-/* bit positions */
-#define EP_CTR_RX (0x8000) /* EndPoint Correct TRansfer RX */
-#define EP_DTOG_RX (0x4000) /* EndPoint Data TOGGLE RX */
-#define EPRX_STAT (0x3000) /* EndPoint RX STATus bit field */
-#define EP_SETUP (0x0800) /* EndPoint SETUP */
-#define EP_T_FIELD (0x0600) /* EndPoint TYPE */
-#define EP_KIND (0x0100) /* EndPoint KIND */
-#define EP_CTR_TX (0x0080) /* EndPoint Correct TRansfer TX */
-#define EP_DTOG_TX (0x0040) /* EndPoint Data TOGGLE TX */
-#define EPTX_STAT (0x0030) /* EndPoint TX STATus bit field */
-#define EPADDR_FIELD (0x000F) /* EndPoint ADDRess FIELD */
-
-/* EndPoint REGister MASK (no toggle fields) */
-#define EPREG_MASK (EP_CTR_RX|EP_SETUP|EP_T_FIELD|EP_KIND|EP_CTR_TX|EPADDR_FIELD)
-
-/* EP_TYPE[1:0] EndPoint TYPE */
-#define EP_BULK (0x0000) /* EndPoint BULK */
-#define EP_CONTROL (0x0200) /* EndPoint CONTROL */
-#define EP_ISOCHRONOUS (0x0400) /* EndPoint ISOCHRONOUS */
-#define EP_INTERRUPT (0x0600) /* EndPoint INTERRUPT */
-#define EP_T_MASK (~EP_T_FIELD & EPREG_MASK)
-
-
-/* EP_KIND EndPoint KIND */
-#define EPKIND_MASK (~EP_KIND & EPREG_MASK)
-
-/* STAT_TX[1:0] STATus for TX transfer */
-#define EP_TX_DIS (0x0000) /* EndPoint TX DISabled */
-#define EP_TX_STALL (0x0010) /* EndPoint TX STALLed */
-#define EP_TX_NAK (0x0020) /* EndPoint TX NAKed */
-#define EP_TX_VALID (0x0030) /* EndPoint TX VALID */
-#define EPTX_DTOG1 (0x0010) /* EndPoint TX Data TOGgle bit1 */
-#define EPTX_DTOG2 (0x0020) /* EndPoint TX Data TOGgle bit2 */
-#define EPTX_DTOGMASK (EPTX_STAT|EPREG_MASK)
-
-/* STAT_RX[1:0] STATus for RX transfer */
-#define EP_RX_DIS (0x0000) /* EndPoint RX DISabled */
-#define EP_RX_STALL (0x1000) /* EndPoint RX STALLed */
-#define EP_RX_NAK (0x2000) /* EndPoint RX NAKed */
-#define EP_RX_VALID (0x3000) /* EndPoint RX VALID */
-#define EPRX_DTOG1 (0x1000) /* EndPoint RX Data TOGgle bit1 */
-#define EPRX_DTOG2 (0x2000) /* EndPoint RX Data TOGgle bit1 */
-#define EPRX_DTOGMASK (EPRX_STAT|EPREG_MASK)
-
-
-typedef enum _EP_DBUF_DIR{ /* double buffered endpoint direction */
- EP_DBUF_ERR,
- EP_DBUF_OUT,
- EP_DBUF_IN
-}EP_DBUF_DIR;
-
-enum EP_BUF_NUM{ /* endpoint buffer number */
- EP_NOBUF,
- EP_BUF0 ,
- EP_BUF1
-};
-
-
-extern volatile WORD wIstr; /* ISTR register last read value */
-
-/******************************************************************************/
-/* FUNCTION PROTOTYPES */
-/* & */
-/* M A C R O s */
-/******************************************************************************/
-
-/* SetCNTR */
-void SetCNTR(WORD /*wRegValue*/);
-#define _SetCNTR(wRegValue) (*CNTR = (WORD)wRegValue)
-/*----------------------------------------------------------------------------*/
-/* SetISTR */
-void SetISTR(WORD /*wRegValue*/);
-#define _SetISTR(wRegValue) (*ISTR = (WORD)wRegValue)
-/*----------------------------------------------------------------------------*/
-/* SetDADDR */
-void SetDADDR(WORD /*wRegValue*/);
-#define _SetDADDR(wRegValue) (*DADDR = (WORD)wRegValue)
-/*----------------------------------------------------------------------------*/
-/* SetBTABLE */
-void SetBTABLE(WORD /*wRegValue*/);
-#define _SetBTABLE(wRegValue)(*BTABLE = (WORD)(wRegValue & 0xFFF8))
-/*----------------------------------------------------------------------------*/
-/* GetCNTR */
-WORD GetCNTR(void);
-#define _GetCNTR() ((WORD) *CNTR)
-/*----------------------------------------------------------------------------*/
-/* GetISTR */
-WORD GetISTR(void);
-#define _GetISTR() ((WORD) *ISTR)
-/*----------------------------------------------------------------------------*/
-/* GetFNR */
-WORD GetFNR(void);
-#define _GetFNR() ((WORD) *FNR)
-/*----------------------------------------------------------------------------*/
-/* GetDADDR */
-WORD GetDADDR(void);
-#define _GetDADDR() ((WORD) *DADDR)
-/*----------------------------------------------------------------------------*/
-/* GetBTABLE */
-WORD GetBTABLE(void);
-#define _GetBTABLE() ((WORD) *BTABLE)
-/*----------------------------------------------------------------------------*/
-/* Pointers on endpoint(bEpNum) Count & Addr registers on PMA */
-#define _pEPBufCount(bEpNum) ((DWORD *)(_GetBTABLE()+bEpNum*8 + 4 + PMAAddr))
-#define _pEPBufAddr(bEpNum) ((DWORD *)(_GetBTABLE()+bEpNum*8 + PMAAddr))
-/*----------------------------------------------------------------------------*/
-/* SetENDPOINT */
-void SetENDPOINT(BYTE /*bEpNum*/,WORD /*wRegValue*/);
-#define _SetENDPOINT(bEpNum,wRegValue) (*(EP0REG + bEpNum)= \
-/*----------------------------------------------------------------------------*/ (WORD)wRegValue)
-/* GetENDPOINT */
-WORD GetENDPOINT(BYTE /*bEpNum*/);
-#define _GetENDPOINT(bEpNum) ((WORD)(*(EP0REG + bEpNum)))
-/*----------------------------------------------------------------------------*/
-/* SetEPType */
-void SetEPType(BYTE /*bEpNum*/,WORD /*wType*/);
-#define _SetEPType(bEpNum,wType) (_SetENDPOINT(bEpNum,\
- ((_GetENDPOINT(bEpNum) & EP_T_MASK) | wType)))
-/*----------------------------------------------------------------------------*/
-/* GetEPType */
-WORD GetEPType(BYTE /*bEpNum*/);
-#define _GetEPType(bEpNum) (_GetENDPOINT(bEpNum) & EP_T_FIELD)
-/*----------------------------------------------------------------------------*/
-/* SetEPTxStatus */
-void SetEPTxStatus(BYTE /*bEpNum*/,WORD /*wState*/);
-#define _SetEPTxStatus(bEpNum,wState) {\
- register WORD _wRegVal; \
- _wRegVal = _GetENDPOINT(bEpNum) & EPTX_DTOGMASK; \
- /* toggle first bit ? */ \
- if((EPTX_DTOG1 & wState)!= 0) \
- _wRegVal ^= EPTX_DTOG1; \
- /* toggle second bit ? */ \
- if((EPTX_DTOG2 & wState)!= 0) \
- _wRegVal ^= EPTX_DTOG2; \
- _SetENDPOINT(bEpNum, _wRegVal); \
-} /* _SetEPTxStatus */
-/*----------------------------------------------------------------------------*/
-/* SetEPRxStatus */
-void SetEPRxStatus(BYTE /*bEpNum*/,WORD /*wState*/);
-#define _SetEPRxStatus(bEpNum,wState) {\
- register WORD _wRegVal; \
- _wRegVal = _GetENDPOINT(bEpNum) & EPRX_DTOGMASK;\
- /* toggle first bit ? */ \
- if((EPRX_DTOG1 & wState)!= 0) \
- _wRegVal ^= EPRX_DTOG1; \
- /* toggle second bit ? */ \
- if((EPRX_DTOG2 & wState)!= 0) \
- _wRegVal ^= EPRX_DTOG2; \
- _SetENDPOINT(bEpNum, _wRegVal); \
-} /* _SetEPRxStatus */
-/*----------------------------------------------------------------------------*/
-/* GetEPTxStatus / GetEPRxStatus */
-WORD GetEPTxStatus(BYTE /*bEpNum*/);
-WORD GetEPRxStatus(BYTE /*bEpNum*/);
-#define _GetEPTxStatus(bEpNum) ((WORD)_GetENDPOINT(bEpNum) & EPTX_STAT)
-#define _GetEPRxStatus(bEpNum) ((WORD)_GetENDPOINT(bEpNum) & EPRX_STAT)
-/*----------------------------------------------------------------------------*/
-/* SetEPTxValid / SetEPRxValid */
-void SetEPTxValid(BYTE /*bEpNum*/);
-void SetEPRxValid(BYTE /*bEpNum*/);
-#define _SetEPTxValid(bEpNum) (_SetEPTxStatus(bEpNum, EP_TX_VALID))
-#define _SetEPRxValid(bEpNum) (_SetEPRxStatus(bEpNum, EP_RX_VALID))
-/*----------------------------------------------------------------------------*/
-/* GetTxStallStatus / GetRxStallStatus */
-BOOL GetTxStallStatus(BYTE /*bEpNum*/);
-BOOL GetRxStallStatus(BYTE /*bEpNum*/);
-#define _GetTxStallStatus(bEpNum) (_GetEPTxStatus(bEpNum) \
- == EP_TX_STALL)
-#define _GetRxStallStatus(bEpNum) (_GetEPRxStatus(bEpNum) \
- == EP_RX_STALL)
-/*----------------------------------------------------------------------------*/
-/* SetEP_KIND / ClearEP_KIND */
-void SetEP_KIND(BYTE /*bEpNum*/);
-void ClearEP_KIND(BYTE /*bEpNum*/);
-#define _SetEP_KIND(bEpNum) (_SetENDPOINT(bEpNum, \
- (_GetENDPOINT(bEpNum) | EP_KIND) & EPREG_MASK))
-#define _ClearEP_KIND(bEpNum) (_SetENDPOINT(bEpNum, \
- (_GetENDPOINT(bEpNum) & EPKIND_MASK)))
-/*----------------------------------------------------------------------------*/
-/* Set_Status_Out / Clear_Status_Out */
-void Set_Status_Out(BYTE /*bEpNum*/);
-void Clear_Status_Out(BYTE /*bEpNum*/);
-#define _Set_Status_Out(bEpNum) _SetEP_KIND(bEpNum)
-#define _Clear_Status_Out(bEpNum) _ClearEP_KIND(bEpNum)
-/*----------------------------------------------------------------------------*/
-/* SetEPDoubleBuff / ClearEPDoubleBuff */
-void SetEPDoubleBuff(BYTE /*bEpNum*/);
-void ClearEPDoubleBuff(BYTE /*bEpNum*/);
-#define _SetEPDoubleBuff(bEpNum) _SetEP_KIND(bEpNum)
-#define _ClearEPDoubleBuff(bEpNum) _ClearEP_KIND(bEpNum)
-/*----------------------------------------------------------------------------*/
-/* ClearEP_CTR_RX / ClearEP_CTR_TX */
-void ClearEP_CTR_RX(BYTE /*bEpNum*/);
-void ClearEP_CTR_TX(BYTE /*bEpNum*/);
-#define _ClearEP_CTR_RX(bEpNum) (_SetENDPOINT(bEpNum,\
- _GetENDPOINT(bEpNum) & 0x7FFF & EPREG_MASK))
-#define _ClearEP_CTR_TX(bEpNum) (_SetENDPOINT(bEpNum,\
- _GetENDPOINT(bEpNum) & 0xFF7F & EPREG_MASK))
-/*----------------------------------------------------------------------------*/
-/* ToggleDTOG_RX / ToggleDTOG_TX */
-void ToggleDTOG_RX(BYTE /*bEpNum*/);
-void ToggleDTOG_TX(BYTE /*bEpNum*/);
-#define _ToggleDTOG_RX(bEpNum) (_SetENDPOINT(bEpNum, \
- ((EP_DTOG_RX | _GetENDPOINT(bEpNum)) & EPREG_MASK)))
-#define _ToggleDTOG_TX(bEpNum) (_SetENDPOINT(bEpNum, \
- ((EP_DTOG_TX | _GetENDPOINT(bEpNum)) & EPREG_MASK)))
-/*----------------------------------------------------------------------------*/
-/* ClearDTOG_RX / ClearDTOG_TX */
-void ClearDTOG_RX(BYTE /*bEpNum*/);
-void ClearDTOG_TX(BYTE /*bEpNum*/);
-#define _ClearDTOG_RX(bEpNum) if((_GetENDPOINT(bEpNum) & EP_DTOG_RX) != 0)\
- _ToggleDTOG_RX(bEpNum)
-#define _ClearDTOG_TX(bEpNum) if((_GetENDPOINT(bEpNum) & EP_DTOG_TX) != 0)\
- _ToggleDTOG_TX(bEpNum)
-/*----------------------------------------------------------------------------*/
-/* SetEPAddress */
-void SetEPAddress(BYTE /*bEpNum*/,BYTE /*bAddr*/);
-#define _SetEPAddress(bEpNum,bAddr) _SetENDPOINT(bEpNum,\
- (_GetENDPOINT(bEpNum) & (EPREG_MASK | bAddr)))
-/*----------------------------------------------------------------------------*/
-/* GetEPAddress */
-BYTE GetEPAddress(BYTE /*bEpNum*/);
-#define _GetEPAddress(bEpNum) ((BYTE)(_GetENDPOINT(bEpNum) & EPADDR_FIELD))
-/*----------------------------------------------------------------------------*/
-/* SetEPTxAddr / SetEPRxAddr*/
-void SetEPTxAddr(BYTE /*bEpNum*/,WORD /*wAddr*/);
-#define _SetEPTxAddr(bEpNum , wAddr) {\
- *_pEPBufAddr(bEpNum) &=0xFFFF0000; \
- *_pEPBufAddr(bEpNum) |=((wAddr)&0x0FFFC);\
- }
-void SetEPRxAddr(BYTE /*bEpNum*/,WORD /*wAddr*/);
-#define _SetEPRxAddr(bEpNum, wAddr) {\
- *_pEPBufAddr(bEpNum) &=0x0000FFFF;\
- *_pEPBufAddr(bEpNum) |=((wAddr<<16)&0xFFFC0000);\
-}
-/*----------------------------------------------------------------------------*/
-/* GetEPTxAddr / GetEPRxAddr */
-WORD GetEPTxAddr(BYTE /*bEpNum*/);
-#define _GetEPTxAddr(bEpNum) ((WORD)(*_pEPBufAddr(bEpNum) &0x0000FFFF))
-WORD GetEPRxAddr(BYTE /*bEpNum*/);
-#define _GetEPRxAddr(bEpNum) ((WORD)((*_pEPBufAddr(bEpNum)&0xFFFF0000)>>16))
-/*----------------------------------------------------------------------------*/
-/* SetEPTxCount / SetEPRxCount */
-void SetEPTxCount(BYTE /*bEpNum*/,WORD /*wCount*/);
-#define _SetEPTxCount(bEpNum,wCount) {\
- *_pEPBufCount(bEpNum) &=0xFFFFFC00;\
- *_pEPBufCount(bEpNum) |=wCount;\
-}
-/*----------------------------------------------------------------------------*/
-void SetEPRxCount(BYTE /*bEpNum*/,WORD /*wCount*/);
-#define _SetEPRxCount(bEpNum,wCount) {\
-DWORD BLsize=0;\
-DWORD Blocks;\
-if (wCount < 64) Blocks = wCount>>1;\
-else\
-{\
- BLsize = 0x80000000;\
- Blocks = wCount>>6;\
-}\
-*_pEPBufCount(bEpNum) &=~0x80000000;\
-*_pEPBufCount(bEpNum) |=BLsize;\
-*_pEPBufCount(bEpNum) &=0x83FFFFFF;\
-*_pEPBufCount(bEpNum) |=Blocks<<26;\
-*_pEPBufCount(bEpNum) &=0xFC00FFFF;\
-}
-
-/*----------------------------------------------------------------------------*/
-/* GetEPTxCount / GetEPRxCount */
-WORD GetEPTxCount(BYTE /*bEpNum*/);
-#define _GetEPTxCount(bEpNum) (WORD)(*_pEPBufCount(bEpNum)&0x3FF)
-WORD GetEPRxCount(BYTE /*bEpNum*/);
-#define _GetEPRxCount(bEpNum) (WORD)((*_pEPBufCount(bEpNum)&0x3FF0000)>>16)
-/*----------------------------------------------------------------------------*/
-/* SetEPDblBuf0Addr / SetEPDblBuf1Addr */
-void SetEPDblBuf0Addr(BYTE /*bEpNum*/,WORD /*wBuf0Addr*/);
-void SetEPDblBuf1Addr(BYTE /*bEpNum*/,WORD /*wBuf1Addr*/);
-#define _SetEPDblBuf0Addr(bEpNum,wBuf0Addr) {_SetEPTxAddr(bEpNum, wBuf0Addr);}
-#define _SetEPDblBuf1Addr(bEpNum,wBuf1Addr) {_SetEPRxAddr(bEpNum, wBuf1Addr);}
-/*----------------------------------------------------------------------------*/
-/* SetEPDblBuffAddr */
-void SetEPDblBuffAddr(BYTE /*bEpNum*/,WORD /*wBuf0Addr*/,WORD /*wBuf1Addr*/);
-#define _SetEPDblBuffAddr(bEpNum,wBuf0Addr,wBuf1Addr) { \
- _SetEPDblBuf0Addr(bEpNum, wBuf0Addr); \
- _SetEPDblBuf1Addr(bEpNum, wBuf1Addr); \
-} /* _SetEPDblBuffAddr */
-/*----------------------------------------------------------------------------*/
-/* GetEPDblBuf0Addr / GetEPDblBuf1Addr */
-WORD GetEPDblBuf0Addr(BYTE /*bEpNum*/);
-WORD GetEPDblBuf1Addr(BYTE /*bEpNum*/);
-#define _GetEPDblBuf0Addr(bEpNum) (_GetEPTxAddr(bEpNum))
-#define _GetEPDblBuf1Addr(bEpNum) (_GetEPRxAddr(bEpNum))
-/*----------------------------------------------------------------------------*/
-/* SetEPDblBuffCount / SetEPDblBuf0Count / SetEPDblBuf1Count */
-void SetEPDblBuffCount(BYTE /*bEpNum*/, BYTE /*bDir*/, WORD /*wCount*/);
-void SetEPDblBuf0Count(BYTE /*bEpNum*/, BYTE /*bDir*/, WORD /*wCount*/);
-void SetEPDblBuf1Count(BYTE /*bEpNum*/, BYTE /*bDir*/, WORD /*wCount*/);
-
-/*----------------------------------------------------------------------------*/
-/* GetEPDblBuf0Count / GetEPDblBuf1Count */
-WORD GetEPDblBuf0Count(BYTE /*bEpNum*/);
-WORD GetEPDblBuf1Count(BYTE /*bEpNum*/);
-#define _GetEPDblBuf0Count(bEpNum) (GetEPTxCount(bEpNum))
-#define _GetEPDblBuf1Count(bEpNum) (GetEPRxCount(bEpNum))
-/*----------------------------------------------------------------------------*/
-/* FreeUserBuffer */
-void FreeUserBuffer(BYTE /*bEpNum*/,BYTE Dir);
-/*----------------------------------------------------------------------------*/
-/* ToWord */
-WORD ToWord(BYTE,BYTE);
-/*----------------------------------------------------------------------------*/
-/* ByteSwap */
-WORD ByteSwap(WORD);
-/*----------------------------------------------------------------------------*/
-
-/* DMA Functions */
-void SetDMABurstTxSize(BYTE /*DestBsize*/);
-void SetDMABurstRxSize(BYTE /*SrcBsize*/);
-void DMAUnlinkedModeTxConfig(BYTE /*bEpNum*/ ,BYTE /*index*/);
-void DMAUnlinkedModeTxEnable(BYTE /*index*/);
-void DMAUnlinkedModeTxDisable(BYTE /*index*/);
-void DMAUnlinkedModeRxEnable(BYTE /*bEpNum*/);
-void DMAUnlinkedModeRxDisable(BYTE /*bEpNum*/);
-void DMALinkedModeRxConfig(BYTE /*bEpNum*/);
-void DMALinkedModeTxConfig(BYTE /*bEpNum*/);
-void DMALinkedModeRxEnable(void);
-void DMALinkedModeTxEnable(void);
-void DMALinkedModeRxDisable(void);
-void DMALinkedModeTxDisable(void);
-void DMASynchEnable(void);
-void DMASynchDisable(void);
-void SetDMALLITxLength(BYTE /*length*/);
-void SetDMALLIRxLength(BYTE /*length*/ );
-void SetDMALLIRxPacketNum(BYTE /*PacketNum*/);
-BYTE GetDMALLIRxPacketNum(void);
diff --git a/uc_str912/prj_blinky_complex_startup/include/usb_type.h b/uc_str912/prj_blinky_complex_startup/include/usb_type.h
deleted file mode 100644
index 42c7802..0000000
--- a/uc_str912/prj_blinky_complex_startup/include/usb_type.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : usb_type.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : types used in the usb library
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-#ifndef __USB_TYPE_H
-#define __USB_TYPE_H
-
-#ifndef NULL
-#define NULL ((void *)0)
-#endif
-
-
-typedef unsigned int DWORD;
-typedef unsigned char BOOL;
-typedef unsigned char BYTE;
-typedef unsigned short WORD;
-
-#endif /* __USB_TYPE_H */
diff --git a/uc_str912/prj_blinky_complex_startup/interrupt.c b/uc_str912/prj_blinky_complex_startup/interrupt.c
deleted file mode 100644
index 2b6ccd7..0000000
--- a/uc_str912/prj_blinky_complex_startup/interrupt.c
+++ /dev/null
@@ -1,295 +0,0 @@
-/********************************************************************
- * Project: STR9-comStick GNU (UART)
- * File: interrupt.c
- *
- * System: ARM9TDMI 32 Bit (STR912FW44X)
- * Compiler: GCC 4.0.3
- *
- * Date: 2006-12-20
- * Author: Applications@Hitex.de
- *
- * Rights: Hitex Development Tools GmbH
- * Greschbachstr. 12
- * D-76229 Karlsruhe
- ********************************************************************
- * Description:
- *
-* This file is part of the GNU Example chain for STR9-comStick
- * The code is bassed on usage of the STmicro library functions
- * This is a small implementation of UART1 feature with command interface
- * The application runs in ARM mode with high optimization level.
- *
- ********************************************************************
- * History:
- *
- * Revision 1.0 2006/12/20 Gn
- * Initial revision
- ********************************************************************
- * This is a preliminary version.
- *
- * WARRANTY: HITEX warrants that the media on which the SOFTWARE is
- * furnished is free from defects in materials and workmanship under
- * normal use and service for a period of ninety (90) days. HITEX entire
- * liability and your exclusive remedy shall be the replacement of the
- * SOFTWARE if the media is defective. This Warranty is void if failure
- * of the media resulted from unauthorized modification, accident, abuse,
- * or misapplication.
- *
- * DISCLAIMER: OTHER THAN THE ABOVE WARRANTY, THE SOFTWARE IS FURNISHED
- * "AS IS" WITHOUT WARRANTY OF ANY KIND. HITEX DISCLAIMS ALL OTHER WARRANTIES,
- * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- *
- * NEITHER HITEX NOR ITS AFFILIATES SHALL BE LIABLE FOR ANY DAMAGES ARISING
- * OUT OF THE USE OF OR INABILITY TO USE THE SOFTWARE, INCLUDING DAMAGES FOR
- * LOSS OF PROFITS, BUSINESS INTERRUPTION, OR ANY SPECIAL, INCIDENTAL, INDIRECT
- * OR CONSEQUENTIAL DAMAGES EVEN IF HITEX HAS BEEN ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGES.
- ********************************************************************/
-
-#define global extern /* to declare external variables and functions */
-
-extern void USB_Istr(void);
-extern void UART1_isr(void);
-
-/* switch to SYS mode and enabled interrupts */
-#define SWITCH_IRQ_TO_SYS asm(" msr CPSR_c,#0x1F \n stmfd sp!,{lr}" )
-
-/* switch back to IRQ mode with IRQ disabled */
-#define SWITCH_SYS_TO_IRQ asm (" ldmfd sp!,{lr} \n msr CPSR_c,#0x12|0x80")
-
-/*******************************************************************************
-* Function Name : Prefetch_Handler
-* Description : This function handles preftetch abort exception.
-*******************************************************************************/
-void Prefetch_Handler(void)
-{
-}
-/*******************************************************************************
-* Function Name : WDG_IRQHandler
-* Description : This function handles the WDG interrupt request
-*******************************************************************************/
-void WDG_IRQHandler(void)
-{
-}
-/*******************************************************************************
-* Function Name : SW_IRQHandler
-* Description : This function handles the SW interrupt request
-*******************************************************************************/
-void SW_IRQHandler(void)
-{
-}
-/*******************************************************************************
-* Function Name : ARMRX_IRQHandler
-* Description : This function handles the ARMRX interrupt request
-*******************************************************************************/
-void ARMRX_IRQHandler(void)
-{
-}
-/*******************************************************************************
-* Function Name : ARMTX_IRQHandler
-* Description : This function handles the ARMTX interrupt request
-*******************************************************************************/
-void ARMTX_IRQHandler(void)
-{
-}
-/*******************************************************************************
-* Function Name : TIM0_IRQHandler
-* Description : This function handles the TIM0 interrupt request
-*******************************************************************************/
-void TIM0_IRQHandler(void)
-{
-}
-/*******************************************************************************
-* Function Name : TIM1_IRQHandler
-* Description : This function handles the TIM1 interrupt request
-*******************************************************************************/
-void TIM1_IRQHandler(void)
-{
-}
-/*******************************************************************************
-* Function Name : TIM2_IRQHandler
-* Description : This function handles the TIM2 interrupt request
-*******************************************************************************/
-void TIM2_IRQHandler(void)
-{
-}
-/*******************************************************************************
-* Function Name : TIM3_IRQHandler
-* Description : This function handles the TIM3 interrupt request
-*******************************************************************************/
-void TIM3_IRQHandler(void)
-{
-}
-/*******************************************************************************
-* Function Name : USBHP_IRQHandler
-* Description : This function handles the USBHP interrupt request
-*******************************************************************************/
-void USBHP_IRQHandler(void)
-{
-}
-/*******************************************************************************
-* Function Name : USBLP_IRQHandler
-* Description : This function handles the USBLP interrupt request
-*******************************************************************************/
-void USBLP_IRQHandler(void)
-{
-}
-/*******************************************************************************
-* Function Name : SCU_IRQHandler
-* Description : This function handles the SCU interrupt request
-*******************************************************************************/
-void SCU_IRQHandler(void)
-{
-}
-/*******************************************************************************
-* Function Name : ENET_IRQHandler
-* Description : This function handles the DENET interrupt request
-*******************************************************************************/
-void ENET_IRQHandler(void)
-{
-}
-/*******************************************************************************
-* Function Name : DMA_IRQHandler
-* Description : This function handles the DMA interrupt request
-*******************************************************************************/
-void DMA_IRQHandler(void)
-{
-}
-/*******************************************************************************
-* Function Name : CAN_IRQHandler
-* Description : This function handles the CAN interrupt request
-*******************************************************************************/
-void CAN_IRQHandler(void)
-{
-}
-/*******************************************************************************
-* Function Name : MC_IRQHandler
-* Description : This function handles the MC interrupt request
-*******************************************************************************/
-void MC_IRQHandler(void)
-{
-}
-/*******************************************************************************
-* Function Name : ADC_IRQHandler
-* Description : This function handles the ADC interrupt request
-*******************************************************************************/
-void ADC_IRQHandler(void)
-{
-}
-/*******************************************************************************
-* Function Name : UART0_IRQHandler
-* Description : This function handles the UART0 interrupt request
-*******************************************************************************/
-void UART0_IRQHandler(void)
-{
-}
-/*******************************************************************************
-* Function Name : UART1_IRQHandler -> moved to inthandler.s
-* Description : This function handles the UART1 interrupt request
-*******************************************************************************/
-void UART1_IRQHandler(void)
-{
-/* SWITCH_SYS_TO_IRQ;
- UART1_isr();
- SWITCH_IRQ_TO_SYS;*/
-}
-/*******************************************************************************
-* Function Name : UART2_IRQHandler
-* Description : This function handles the UART2 interrupt request
-*******************************************************************************/
-void UART2_IRQHandler(void)
-{
-}
-/*******************************************************************************
-* Function Name : I2C0_IRQHandler
-* Description : This function handles the I2C0 interrupt request
-*******************************************************************************/
-void I2C0_IRQHandler(void)
-{
-}
-/*******************************************************************************
-* Function Name : I2C1_IRQHandler
-* Description : This function handles the I2C1 interrupt request
-*******************************************************************************/
-void I2C1_IRQHandler(void)
-{
-}
-/*******************************************************************************
-* Function Name : SSP0_IRQHandler
-* Description : This function handles the SSP0 interrupt request
-*******************************************************************************/
-void SSP0_IRQHandler(void)
-{
-}
-/*******************************************************************************
-* Function Name : SSP1_IRQHandler
-* Description : This function handles the SSP1 interrupt request
-*******************************************************************************/
-void SSP1_IRQHandler(void)
-{
-}
-/*******************************************************************************
-* Function Name : LVD_IRQHandler
-* Description : This function handles the LVD interrupt request
-*******************************************************************************/
-void LVD_IRQHandler(void)
-{
-}
-/*******************************************************************************
-* Function Name : RTC_IRQHandler
-* Description : This function handles the RTC interrupt request
-*******************************************************************************/
-void RTC_IRQHandler(void)
-{
-}
-/*******************************************************************************
-* Function Name : WIU_IRQHandler
-* Description : This function handles the WIU interrupt request
-*******************************************************************************/
-void WIU_IRQHandler(void)
-{
-}
-/*******************************************************************************
-* Function Name : EXTIT0_IRQHandler
-* Description : This function handles the EXTIT0 interrupt request
-*******************************************************************************/
-void EXTIT0_IRQHandler(void)
-{
-}
-/*******************************************************************************
-* Function Name : EXTIT1_IRQHandler
-* Description : This function handles the EXTIT1 interrupt request
-*******************************************************************************/
-void EXTIT1_IRQHandler(void)
-{
-}
-/*******************************************************************************
-* Function Name : EXTIT2_IRQHandler
-* Description : This function handles the EXTIT2 interrupt request
-*******************************************************************************/
-void EXTIT2_IRQHandler(void)
-{
-}
-/*******************************************************************************
-* Function Name : EXTIT3_IRQHandler
-* Description : This function handles the EXTIT3 interrupt request
-*******************************************************************************/
-void EXTIT3_IRQHandler(void)
-{
-}
-/*******************************************************************************
-* Function Name : USBWU_IRQHandler
-* Description : This function handles the USBWU interrupt request
-*******************************************************************************/
-void USBWU_IRQHandler(void)
-{
-}
-/*******************************************************************************
-* Function Name : PFQBC_IRQHandler
-* Description : This function handles the PFQBC interrupt request
-*******************************************************************************/
-void PFQBC_IRQHandler(void)
-{
-}
-
diff --git a/uc_str912/prj_blinky_complex_startup/inthandler.S b/uc_str912/prj_blinky_complex_startup/inthandler.S
deleted file mode 100644
index 09fea2f..0000000
--- a/uc_str912/prj_blinky_complex_startup/inthandler.S
+++ /dev/null
@@ -1,94 +0,0 @@
-# Hitex/We/26.04.2006
-# primary interrupt service
-
-# Standard definitions of Mode bits and Interrupt (I & F) flags in PSRs
-
- .equ Mode_USR, 0x10
- .equ Mode_FIQ, 0x11
- .equ Mode_IRQ, 0x12
- .equ Mode_SVC, 0x13
- .equ Mode_ABT, 0x17
- .equ Mode_UND, 0x1B
- .equ Mode_SYS, 0x1F
-
- .equ I_BIT, 0x80 /* when I bit is set, IRQ is disabled */
- .equ F_BIT, 0x40 /* when F bit is set, FIQ is disabled */
-
- .text
-# generate arm instructions (.code32)
- .arm
- .extern UART1_isr
- .global UART1_IRQHandler /*_uart1_srv*/
- .global _disableInterrupts
- .global _enableInterrupts
-
-
-# enable FIQ interrupts
-
- .func _enableInterrupts
-_enableInterrupts:
- stmfd sp!, {r1}
- mrs r1, CPSR
- bic r1, r1, #I_BIT
- bic r1, r1, #F_BIT
- msr CPSR_c, r1
- ldmfd sp!, {r1}
- mov pc, r14
- .size __enableInterrupts, . - __enableInterrupts
- .endfunc
-
-
-#disable FIQ interrupts
-
- .func _disableInterrupts
-_disableInterrupts:
- stmfd sp!, {r1}
- mrs r1, CPSR
- orr r1, r1, #0x40
- msr CPSR_c, r1
- ldmfd sp!, {r1}
- mov pc, r14
- .size __disableInterrupts, . - __disableInterrupts
- .endfunc
-
-
-###################################################
-#
-# primary interrupt services
-#
-###################################################
-.macro SvCon
-# Adjust and save LR_irq in IRQ stack
- sub r14, r14, #4
- stmfd sp!, {r14}
-
-# Save SPSR and r0 in IRQ stack
- mrs r14, SPSR
- stmfd sp!, {r0, r1, r14}
-
-# Save used registers and LR in User Stack
- stmfd sp!, { r1-r3, r12, r14}
-.endm
-.macro RsCon
-# Restore used registers and LR from User Stack
- ldmia sp!, { r1-r3, r12, r14}
-
-# Restore SPSR_irq and r0 from IRQ stack
- ldmia sp!, {r0, r1, r14}
- msr SPSR_cxsf, r14
-# Restore adjusted LR_irq from IRQ stack directly in the PC
- ldmia sp!, {pc}^
-.endm
-
-#inthandler entries
- .func UART1_IRQHandler /*_uart1_srv*/
-UART1_IRQHandler: /*_uart1_srv:*/
- SvCon
-# enter ISR
- bl UART1_isr /* branch to isr */
-# back from ISR
- RsCon
- .size __uart1_srv, . - __uart1_srv
- .endfunc
-
-.end
diff --git a/uc_str912/prj_blinky_complex_startup/load_segger.gdb b/uc_str912/prj_blinky_complex_startup/load_segger.gdb
deleted file mode 100644
index fe98dd4..0000000
--- a/uc_str912/prj_blinky_complex_startup/load_segger.gdb
+++ /dev/null
@@ -1,23 +0,0 @@
-set complaints 1
-set output-radix 16
-set input-radix 16
-set prompt (arm-gdb)
-
-target remote localhost:2331
-
-monitor speed adaptive
-monitor endian little
-
-monitor reset
-monitor flash device = STR912FAW44
-monitor flash breakpoints = 1
-monitor flash download = 1
-monitor halt
-
-
-pwd
-load main.elf
-file main.elf
-step
-break after_delay
-continue
diff --git a/uc_str912/prj_blinky_complex_startup/main.c b/uc_str912/prj_blinky_complex_startup/main.c
deleted file mode 100644
index 067323d..0000000
--- a/uc_str912/prj_blinky_complex_startup/main.c
+++ /dev/null
@@ -1,173 +0,0 @@
-/********************************************************************
- * Project: STR9-comStick GNU (UART on Interrupt)
- * File: main.c
- *
- * System: ARM9TDMI 32 Bit (STR912FW44X)
- * Compiler: GCC 4.0.3
- *
- * Date: 2006-12-20
- * Author: Applications@Hitex.de
- *
- * Rights: Hitex Development Tools GmbH
- * Greschbachstr. 12
- * D-76229 Karlsruhe
- ********************************************************************
- * Description:
- *
- * This file is part of the GNU Example chain for STR9-comStick
- * The code is bassed on usage of the STmicro library functions
- * This is a small implementation of UART1 feature with command interface
- * The application runs in ARM mode with high optimization level.
- *
- ********************************************************************
- * History:
- *
- * Revision 1.0 2006/12/20 Gn
- * Initial revision
- ********************************************************************
- * This is a preliminary version.
- *
- * WARRANTY: HITEX warrants that the media on which the SOFTWARE is
- * furnished is free from defects in materials and workmanship under
- * normal use and service for a period of ninety (90) days. HITEX entire
- * liability and your exclusive remedy shall be the replacement of the
- * SOFTWARE if the media is defective. This Warranty is void if failure
- * of the media resulted from unauthorized modification, accident, abuse,
- * or misapplication.
- *
- * DISCLAIMER: OTHER THAN THE ABOVE WARRANTY, THE SOFTWARE IS FURNISHED
- * "AS IS" WITHOUT WARRANTY OF ANY KIND. HITEX DISCLAIMS ALL OTHER WARRANTIES,
- * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- *
- * NEITHER HITEX NOR ITS AFFILIATES SHALL BE LIABLE FOR ANY DAMAGES ARISING
- * OUT OF THE USE OF OR INABILITY TO USE THE SOFTWARE, INCLUDING DAMAGES FOR
- * LOSS OF PROFITS, BUSINESS INTERRUPTION, OR ANY SPECIAL, INCIDENTAL, INDIRECT
- * OR CONSEQUENTIAL DAMAGES EVEN IF HITEX HAS BEEN ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGES.
- ********************************************************************/
-
-#include "defines.h"
-
-#define global extern /* to declare external variables and functions */
-#include "91x_lib.h"
-
-#include "main.h"
-
-extern void _enableInterrupts(void);
-
-
- GPIO_InitTypeDef GPIO_InitStructure;
-
-
-/* Private function prototypes -----------------------------------------------*/
- void SCU_Configuration(void);
- void GPIO_Configuration(void);
- void VIC_Configuration(void);
- static void Delay(u32 nCount);
-
-int main (void)
-{
-
- /* Configure the system clocks */
- SCU_Configuration();
- /* Configure the GPIOs */
- GPIO_Configuration();
- /* VIC setup */
- VIC_Configuration();
-
-
- /* endless loop */
- while (1)
- {
- /* Turn ON leds connected to P8.0 pins */
- GPIO_WriteBit(GPIO8, GPIO_Pin_0, Bit_SET);
- GPIO_WriteBit(GPIO8, GPIO_Pin_1, Bit_SET);
- GPIO_WriteBit(GPIO8, GPIO_Pin_2, Bit_SET);
- GPIO_WriteBit(GPIO8, GPIO_Pin_3, Bit_SET);
-
- /* Insert delay */
- Delay(0x1FFFFF);
-
- /* Turn OFF leds connected to 88.0 pins */
- GPIO_WriteBit(GPIO8, GPIO_Pin_0, Bit_RESET);
- GPIO_WriteBit(GPIO8, GPIO_Pin_1, Bit_RESET);
- GPIO_WriteBit(GPIO8, GPIO_Pin_2, Bit_RESET);
- GPIO_WriteBit(GPIO8, GPIO_Pin_3, Bit_RESET);
-
- /* Insert delay */
- Delay(0x1FFFFF);
- }
-}
-
-void SCU_Configuration(void)
-{
-
-// FMI_BankRemapConfig(4, 2, 0x00000000, 0x80000); /* Set Flash banks size & address */
- FMI_Config(FMI_READ_WAIT_STATE_2, FMI_WRITE_WAIT_STATE_0, FMI_PWD_ENABLE,\
- FMI_LVD_ENABLE, FMI_FREQ_HIGH); /* FMI Waite States */
-
- SCU_MCLKSourceConfig(SCU_MCLK_OSC);
-
- SCU_PLLFactorsConfig(192,25,2); /* PLL = 96 MHz */
- SCU_PLLCmd(ENABLE); /* PLL Enabled */
-
- SCU_RCLKDivisorConfig(SCU_RCLK_Div1); /* RCLK @96Mhz */
- SCU_HCLKDivisorConfig(SCU_HCLK_Div1); /* AHB @96Mhz */
- SCU_FMICLKDivisorConfig(SCU_FMICLK_Div1);/* FMI @96Mhz */
- SCU_PCLKDivisorConfig(SCU_PCLK_Div2); /* APB @48Mhz */
- SCU_MCLKSourceConfig(SCU_MCLK_PLL); /* MCLK @96Mhz */
-
- /* Set the PCLK Clock to MCLK/2 */
- SCU_PCLKDivisorConfig(SCU_PCLK_Div2);
-
- /* Enable VIC clock */
- SCU_APBPeriphClockConfig(__VIC, ENABLE);
- SCU_APBPeriphReset(__VIC, DISABLE);
-
- /* Enable the GPIO8 Clock */
- SCU_APBPeriphClockConfig(__GPIO8, ENABLE);
-
- /* Enable the clock for the GPIO3 */
- SCU_APBPeriphClockConfig(__GPIO3, ENABLE);
-
-}
-
-/* GPIO Configuration --------------------------------------------------------*/
-void GPIO_Configuration(void)
-{
- GPIO_DeInit(GPIO8);
- GPIO_DeInit(GPIO3); /* GPIO3 Deinitialization */
- /* LED */
- GPIO_InitStructure.GPIO_Direction = GPIO_PinOutput;
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All;
- GPIO_InitStructure.GPIO_Type = GPIO_Type_PushPull ;
- GPIO_Init (GPIO8, &GPIO_InitStructure);
- /* button */
- GPIO_InitStructure.GPIO_Direction = GPIO_PinInput;
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;
- GPIO_InitStructure.GPIO_Type = GPIO_Type_PushPull ;
- GPIO_Init (GPIO3, &GPIO_InitStructure);
-
-}
-
-void VIC_Configuration(void)
-{
- /* reset to default state */
- VIC_DeInit();
-}
-
-/*******************************************************************************
-* Function Name : Delay
-* Description : Inserts a delay time.
-* Input : nCount: specifies the delay time length.
-*******************************************************************************/
-static void Delay(u32 nCount)
-{
- u32 j = 0;
-
- for(j = nCount; j > 0; j--)
- asm("nop");
-}
-/************************************** EOF *********************************/
-
diff --git a/uc_str912/prj_blinky_complex_startup/main.h b/uc_str912/prj_blinky_complex_startup/main.h
deleted file mode 100644
index bf63b47..0000000
--- a/uc_str912/prj_blinky_complex_startup/main.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/********************************************************************
- * Project: STR9-comStick GNU (UART)
- * File: main.h
- *
- * System: ARM9TDMI 32 Bit (STR912FW44X)
- * Compiler: GCC 4.0.3
- *
- * Date: 2006-12-20
- * Author: Applications@Hitex.de
- *
- * Rights: Hitex Development Tools GmbH
- * Greschbachstr. 12
- * D-76229 Karlsruhe
- ********************************************************************
- * Description:
- *
- * This file is part of the GNU Example chain for STR9-comStick
- * The code is bassed on usage of the STmicro library functions
- * This is a small implementation of UART1 feature with command interface
- * The application runs in ARM mode with high optimization level.
- *
- ********************************************************************
- * History:
- *
- * Revision 1.0 2006/12/20 Gn
- * Initial revision
- ********************************************************************
- * This is a preliminary version.
- *
- * WARRANTY: HITEX warrants that the media on which the SOFTWARE is
- * furnished is free from defects in materials and workmanship under
- * normal use and service for a period of ninety (90) days. HITEX entire
- * liability and your exclusive remedy shall be the replacement of the
- * SOFTWARE if the media is defective. This Warranty is void if failure
- * of the media resulted from unauthorized modification, accident, abuse,
- * or misapplication.
- *
- * DISCLAIMER: OTHER THAN THE ABOVE WARRANTY, THE SOFTWARE IS FURNISHED
- * "AS IS" WITHOUT WARRANTY OF ANY KIND. HITEX DISCLAIMS ALL OTHER WARRANTIES,
- * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- *
- * NEITHER HITEX NOR ITS AFFILIATES SHALL BE LIABLE FOR ANY DAMAGES ARISING
- * OUT OF THE USE OF OR INABILITY TO USE THE SOFTWARE, INCLUDING DAMAGES FOR
- * LOSS OF PROFITS, BUSINESS INTERRUPTION, OR ANY SPECIAL, INCIDENTAL, INDIRECT
- * OR CONSEQUENTIAL DAMAGES EVEN IF HITEX HAS BEEN ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGES.
- ********************************************************************/
-
-#ifndef __MAIN_H__
-#define __MAIN_H__
-
-#endif /* __MAIN_H__ */
-
-/************************************** EOF *********************************/
diff --git a/uc_str912/prj_blinky_complex_startup/src/91x_adc.c b/uc_str912/prj_blinky_complex_startup/src/91x_adc.c
deleted file mode 100644
index a36758b..0000000
--- a/uc_str912/prj_blinky_complex_startup/src/91x_adc.c
+++ /dev/null
@@ -1,590 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_adc.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the ADC software functions.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-
-/* Standard include ----------------------------------------------------------*/
-#include "91x_adc.h"
-#include "91x_scu.h"
-/* Include of other module interface headers ---------------------------------*/
-/* Local includes ------------------------------------------------------------*/
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-
-/* ADC mask */
-#define ADC_FLAG_MASK 0x001F /* ADC Flag Mask */
-#define ADC_RESULT_MASK 0x03FF /* ADC Result Mask */
-#define ADC_SCAN_MODE_MASK 0x0020 /* ADC Sacn Mode Mask */
-#define ADC_STANDBY_MODE_MASK 0x0008 /* ADC Standby Mode Mask */
-#define ADC_CMD_MASK 0x0002 /* ADC Command Mask */
-#define ADC_CHANNEL_MASK 0xFE3F /* ADC Channel Select Mask */
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/* Interface functions -------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-
-/*******************************************************************************
-* Function Name : ADC_DeInit
-* Description : Deinitialize the ADC module registers to their default reset
-* values
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void ADC_DeInit(void)
-{
- /* Reset the ADC registers values */
- SCU_APBPeriphReset(__ADC,ENABLE);
- SCU_APBPeriphReset(__ADC,DISABLE);
-}
-
-/*******************************************************************************
-* Function Name : ADC_Init
-* Description : Initializes ADC peripheral according to the specified
-* parameters in the ADC_InitTypeDef structure.
-* Input : ADC_InitStruct: pointer to a ADC_InitTypeDef structure that
-* contains the configuration information for the specified
-* ADC peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void ADC_Init(ADC_InitTypeDef* ADC_InitStruct)
-{
- /* Set the low threshold of the watchdog */
- ADC->LTR = ADC_InitStruct->ADC_WDG_Low_Threshold;
-
- /* Set the high threshold of the watchdog */
- ADC->HTR = ADC_InitStruct->ADC_WDG_High_Threshold;
-
-
- /* Channel 0 conversion mode */
- ADC->CCR &= 0xFFFC;
- ADC->CCR |= ADC_InitStruct->ADC_Channel_0_Mode;
-
- /* Channel 1 conversion mode */
- ADC->CCR &= 0xFFF3;
- ADC->CCR |= ADC_InitStruct->ADC_Channel_1_Mode << 0x2;
-
- /* Channel 2 conversion mode */
- ADC->CCR &= 0xFFCF;
- ADC->CCR |= ADC_InitStruct->ADC_Channel_2_Mode << 0x4;
-
- /* Channel 3 conversion mode */
- ADC->CCR &= 0xFF3F;
- ADC->CCR |= ADC_InitStruct->ADC_Channel_3_Mode << 0x6;
-
- /* Channel 4 conversion mode */
- ADC->CCR &= 0xFCFF;
- ADC->CCR |= ADC_InitStruct->ADC_Channel_4_Mode << 0x8;
-
- /* Channel 5 conversion mode */
- ADC->CCR &= 0xF3FF;
- ADC->CCR |= ADC_InitStruct->ADC_Channel_5_Mode << 0xA;
-
- /* Channel 6 conversion mode */
- ADC->CCR &= 0xCFFF;
- ADC->CCR |= ADC_InitStruct->ADC_Channel_6_Mode << 0xC;
-
- /* Channel 7 conversion mode */
- ADC->CCR &= 0x3FFF;
- ADC->CCR |= ADC_InitStruct->ADC_Channel_7_Mode << 0xE;
-
- /* Select the channel to be converted */
- ADC->CR &= ADC_CHANNEL_MASK;
- ADC->CR |= ADC_InitStruct->ADC_Select_Channel << 0x6;
-
- /* Enable/disable the scan mode */
- if (ADC_InitStruct->ADC_Scan_Mode == ENABLE)
- {
- /* Enable the scan mode */
- ADC->CR |= ADC_SCAN_MODE_MASK;
- }
- else
- {
- /* Disable the scan mode */
- ADC->CR &= ~ADC_SCAN_MODE_MASK;
- }
-
- /* Configure the conversion mode */
- if (ADC_InitStruct->ADC_Conversion_Mode == ADC_Continuous_Mode)
- {
- /* ADC continuous mode */
- ADC->CR |= ADC_Continuous_Mode;
- }
- else
- {
- /* ADC single mode */
- ADC->CR &= ADC_Single_Mode;
- }
-}
-
-/*******************************************************************************
-* Function Name : ADC_StructInit
-* Description : Fills each ADC_InitStruct member with its reset value.
-* Input : ADC_InitStruct : pointer to a ADC_InitTypeDef structure
-* which will be initialized.
-* Output : None
-* Return : None.
-*******************************************************************************/
-void ADC_StructInit(ADC_InitTypeDef* ADC_InitStruct)
-{
- ADC_InitStruct->ADC_WDG_High_Threshold = 0x0000;
- ADC_InitStruct->ADC_WDG_Low_Threshold = 0x0000;
- ADC_InitStruct->ADC_Channel_0_Mode = ADC_No_Conversion;
- ADC_InitStruct->ADC_Channel_1_Mode = ADC_No_Conversion;
- ADC_InitStruct->ADC_Channel_2_Mode = ADC_No_Conversion;
- ADC_InitStruct->ADC_Channel_3_Mode = ADC_No_Conversion;
- ADC_InitStruct->ADC_Channel_4_Mode = ADC_No_Conversion;
- ADC_InitStruct->ADC_Channel_5_Mode = ADC_No_Conversion;
- ADC_InitStruct->ADC_Channel_6_Mode = ADC_No_Conversion;
- ADC_InitStruct->ADC_Channel_7_Mode = ADC_No_Conversion;
- ADC_InitStruct->ADC_Select_Channel = ADC_Channel_0;
- ADC_InitStruct->ADC_Scan_Mode = DISABLE;
- ADC_InitStruct->ADC_Conversion_Mode = ADC_Single_Mode;
-}
-
-/*******************************************************************************
-* Function Name : ADC_PrescalerConfig
-* Description : This routine is used to configure the ADC prescaler value.
-* Input : ADC_Prescaler: specifies the prescaler value. This parameter
-* can be a value from 0x0 to 0xFF.
-* Output : None
-* Return : None
-*******************************************************************************/
-void ADC_PrescalerConfig(u8 ADC_Prescaler)
-{
- ADC->PRS &= 0xFF00;
- ADC->PRS |= ADC_Prescaler;
-
-}
-/*******************************************************************************
-* Function Name : ADC_GetPrescalerValue
-* Description : This routine is used to get the ADC prescaler value.
-* Input : None
-* Output : None
-* Return : The prescaler value.
-*******************************************************************************/
-u8 ADC_GetPrescalerValue(void)
-{
- return ADC->PRS & 0x00FF;
-}
-/*******************************************************************************
-* Function Name : ADC_GetFlagStatus
-* Description : Checks whether the specified ADC flag is set or not.
-* Input : ADC_Flag: flag to check.
-* This parameter can be one of the following values:
-* - ADC_FLAG_OV_CH_0: Conversion overflow status for
-* channel 0.
-* - ADC_FLAG_OV_CH_1: Conversion overflow status for
-* channel 1.
-* - ADC_FLAG_OV_CH_2: Conversion overflow status for
-* channel 2.
-* - ADC_FLAG_OV_CH_3: Conversion overflow status for
-* channel 3.
-* - ADC_FLAG_OV_CH_4: Conversion overflow status for
-* channel 4.
-* - ADC_FLAG_OV_CH_5: Conversion overflow status for
-* channel 5.
-* - ADC_FLAG_OV_CH_6: Conversion overflow status for
-* channel 6.
-* - ADC_FLAG_OV_CH_7: Conversion overflow status for
-* channel 7.
-* - ADC_FLAG_ECV: End of conversion status.
-* - ADC_FLAG_AWD: Analog watchdog status.
-* Output : None
-* Return : The NewState of the ADC_Flag (SET or RESET).
-*******************************************************************************/
-FlagStatus ADC_GetFlagStatus(u16 ADC_Flag)
-{
- u8 AdcReg = 0, FlagPos = 0;
-
- /* Get the ADC register index */
- AdcReg = ADC_Flag >> 5;
-
- /* Get the flag position */
- FlagPos = ADC_Flag & ADC_FLAG_MASK;
-
- if(AdcReg == 1) /* The flag to check is in CR register */
- {
- if((ADC->CR & (1<<FlagPos))!= RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
- }
- else if(AdcReg == 6) /* The flag to check is in DR0 register */
- {
- if((ADC->DR0 & (1<<FlagPos))!= RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
- }
- else if(AdcReg == 7) /* The flag to check is in DR1 register */
- {
- if((ADC->DR1 & (1<<FlagPos))!= RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
- }
- else if(AdcReg == 8) /* The flag to check is in DR2 register */
- {
- if((ADC->DR2 & (1<<FlagPos))!= RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
- }
- else if(AdcReg == 9) /* The flag to check is in DR3 register */
- {
- if((ADC->DR3 & (1<<FlagPos))!= RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
- }
-
- else if(AdcReg == 0xA) /* The flag to check is in DR4 register */
- {
- if((ADC->DR4 & (1<<FlagPos))!= RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
- }
- else if(AdcReg == 0xB) /* The flag to check is in DR5 register */
- {
- if((ADC->DR5 & (1<<FlagPos))!= RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
- }
- else if(AdcReg == 0xC) /* The flag to check is in DR6 register */
- {
- if((ADC->DR6 & (1<<FlagPos))!= RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
- }
- else /* (AdcReg == 0xD), The flag to check is in DR7 register */
- {
- if((ADC->DR7 & (1<<FlagPos))!= RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
- }
-}
-
-/*******************************************************************************
-* Function Name : ADC_ClearFlag
-* Description : Clears the ADC Flag passed as a parameter.
-* Input : ADC_Flag: flag to clear.
-* This parameter can be one of the following values:
-* - ADC_FLAG_ECV: End of conversion status.
-* - ADC_FLAG_AWD: Analog watchdog status.
-* Output : None
-* Return : None
-*******************************************************************************/
-void ADC_ClearFlag(u16 ADC_Flag)
-{
- /* Clear the correspondent flag */
- ADC->CR |= (1<<(ADC_Flag & ADC_FLAG_MASK));
-}
-
-/*******************************************************************************
-* Function Name : ADC_GetConversionValue
-* Description : Read the result of conversion from the appropriate data
-* register.
-* Input : ADC_Channel: the correspondent channel of the ADC peripheral.
-* This parameter can be one of the following values:
-* - ADC_Channel_0: ADC channel 0.
-* - ADC_Channel_1: ADC channel 1.
-* - ADC_Channel_2: ADC channel 2.
-* - ADC_Channel_3: ADC channel 3.
-* - ADC_Channel_4: ADC channel 4.
-* - ADC_Channel_5: ADC channel 5.
-* - ADC_Channel_6: ADC channel 6.
-* - ADC_Channel_7: ADC channel 7.
-* Output : None
-* Return : The result of the conversion for the specific channel.
-*******************************************************************************/
-u16 ADC_GetConversionValue(u16 ADC_Channel)
-{
- u16 ADC_Conversion_Value = 0;
-
- switch (ADC_Channel)
- {
- case (ADC_Channel_0):
- /* Get the conversion value of the channel 0 */
- ADC_Conversion_Value = ADC->DR0 & ADC_RESULT_MASK;
- break;
-
- case (ADC_Channel_1):
- /* Get the conversion value of the channel 1 */
- ADC_Conversion_Value = ADC->DR1 & ADC_RESULT_MASK;
- break;
-
- case (ADC_Channel_2):
- /* Get the conversion value of the channel 2 */
- ADC_Conversion_Value = ADC->DR2 & ADC_RESULT_MASK;
- break;
-
- case (ADC_Channel_3):
- /* Get the conversion value of the channel 3 */
- ADC_Conversion_Value = ADC->DR3 & ADC_RESULT_MASK;
- break;
-
- case (ADC_Channel_4):
- /* Get the conversion value of the channel 4 */
- ADC_Conversion_Value = ADC->DR4 & ADC_RESULT_MASK;
- break;
-
- case (ADC_Channel_5):
- /* Get the conversion value of the channel 5 */
- ADC_Conversion_Value = ADC->DR5 & ADC_RESULT_MASK;
- break;
-
- case (ADC_Channel_6):
- /* Get the conversion value of the channel 6 */
- ADC_Conversion_Value = ADC->DR6 & ADC_RESULT_MASK;
- break;
-
- case (ADC_Channel_7):
- /* Get the conversion value of the channel 7 */
- ADC_Conversion_Value = ADC->DR7 & ADC_RESULT_MASK;
- break;
-
- default:
- break;
- }
-
- return(ADC_Conversion_Value);
-}
-
-/*******************************************************************************
-* Function Name : ADC_GetAnalogWatchdogResult
-* Description : Return the result of the comparaison on the selected Analog
-* Watchdog.
-* Input : ADC_Channel: the correspondent channel of the ADC peripheral.
-* This parameter can be one of the following values:
-* - ADC_Channel_0: ADC channel 0.
-* - ADC_Channel_1: ADC channel 1.
-* - ADC_Channel_2: ADC channel 2.
-* - ADC_Channel_3: ADC channel 3.
-* - ADC_Channel_4: ADC channel 4.
-* - ADC_Channel_5: ADC channel 5.
-* - ADC_Channel_6: ADC channel 6.
-* - ADC_Channel_7: ADC channel 7.
-* Output : None
-* Return : The state of the comparision (SET or RESET).
-*******************************************************************************/
-FlagStatus ADC_GetAnalogWatchdogResult(u16 ADC_Channel)
-{
- if ((ADC->CRR & (1<<ADC_Channel)) != RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : ADC_ClearAnalogWatchdogResult
-* Description : Clear the result of the comparaison on the selected Analog
-* Watchdog.
-* Input : ADC_Channel: the correspondent channel of the ADC peripheral.
-* This parameter can be one of the following values:
-* - ADC_Channel_0: ADC channel 0.
-* - ADC_Channel_1: ADC channel 1.
-* - ADC_Channel_2: ADC channel 2.
-* - ADC_Channel_3: ADC channel 3.
-* - ADC_Channel_4: ADC channel 4.
-* - ADC_Channel_5: ADC channel 5.
-* - ADC_Channel_6: ADC channel 6.
-* - ADC_Channel_7: ADC channel 7.
-* Output : None
-* Return : None
-*******************************************************************************/
-void ADC_ClearAnalogWatchdogResult(u16 ADC_Channel)
-{
- /* Clear the correspondent watchdog result */
- ADC->CRR = 1<<ADC_Channel;
-}
-
-/*******************************************************************************
-* Function Name : ADC_GetWatchdogThreshold
-* Description : Get the higher/lower thresholds values of the watchdog.
-* Input : ADC_Threshold: the lower or the higher threshold.
-* This parameter can be one of the following values:
-* - ADC_HigherThreshold: The higher threshold.
-* - ADC_LowerThreshold: The lower threshold.
-* Output : None
-* Return : The selected threshold value.
-*******************************************************************************/
-u16 ADC_GetWatchdogThreshold(ADC_ThresholdType ADC_Threshold)
-{
- u16 ADC_Threshold_Value = 0;
-
- switch (ADC_Threshold)
- {
- case ADC_LowThreshold:
- /* Get the low threshold of the watchdog */
- ADC_Threshold_Value = ADC->LTR;
- break;
-
- case ADC_HighThreshold:
- /* Get the high threshol of the watchdog */
- ADC_Threshold_Value = ADC->HTR;
- break;
-
- default:
- break;
- }
-
- return(ADC_Threshold_Value);
-}
-
-/*******************************************************************************
-* Function Name : ADC_ITConfig
-* Description : Enables or disables the specified ADC interrupts.
-* Input : - ADC_IT: specifies the ADC interrupts sources to be enabled
-* or disabled.
-* This parameter can be one of the following values:
-* - ADC_IT_EndOfConversion: End of conversion interrupt.
-* - ADC_IT_AnalogWDG: Analog watchdog interrupt.
-* - ADC_NewState: new state of the specified ADC interrupts.
-* (ADC_Newstate can be ENABLE or DISABLE).
-* Output : None
-* Return : None
-*******************************************************************************/
-void ADC_ITConfig(u16 ADC_IT, FunctionalState ADC_NewState)
-{
- if (ADC_NewState == ENABLE)
- {
- /* Enable the interrupt */
- ADC->CR |= ADC_IT;
- }
- else
- {
- /* Disable the interrupt */
- ADC->CR &= ~ADC_IT;
- }
-}
-
-/*******************************************************************************
-* Function Name : ADC_StandbyModeCmd
-* Description : Enable or disable the standby mode.
-* Input : ADC_NewState: new state of the ADC standby mode.
-* (ADC_Newstate can be ENABLE or DISABLE).
-* Output : None
-* Return : None
-*******************************************************************************/
-void ADC_StandbyModeCmd(FunctionalState ADC_NewState)
-{
- if (ADC_NewState == ENABLE)
- {
- /* Enable the standby mode */
- ADC->CR |= ADC_STANDBY_MODE_MASK;
- }
- else
- {
- /* Disable the standby mode */
- ADC->CR &= ~ADC_STANDBY_MODE_MASK;
- }
-}
-
-/*******************************************************************************
-* Function Name : ADC_Cmd
-* Description : Power on or put in reset mode the ADC peripheral.
-* Input : ADC_NewState: new state of the ADC peripheral.
-* (ADC_Newstate can be ENABLE or DISABLE).
-* Output : None
-* Return : None
-*******************************************************************************/
-void ADC_Cmd(FunctionalState ADC_NewState)
-{
- if (ADC_NewState == ENABLE)
- {
- /* Enable the ADC */
- ADC->CR |= ADC_CMD_MASK;
- }
- else
- {
- /* Disable the ADC */
- ADC->CR &= ~ADC_CMD_MASK;
- }
-}
-
-/*******************************************************************************
-* Function Name : ADC_ConversionCmd
-* Description : Start or stop the ADC conversion in the selected mode.
-* Input : ADC_Conversion: the conversion command.
-* This parameter can be one of the following values:
-* - ADC_Conversion_Start: Start the conversion.
-* - ADC_Conversion_Stop: Stop the Conversion.
-* Output : None
-* Return : None
-*******************************************************************************/
-void ADC_ConversionCmd(u16 ADC_Conversion)
-{
- if (ADC_Conversion == ADC_Conversion_Start)
- {
- /* Start the ADC conversion */
- ADC->CR |= ADC_Conversion_Start;
- }
- else
- {
- /* Stop the ADC conversion */
- ADC->CR &= ADC_Conversion_Stop;
- }
-}
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_complex_startup/src/91x_ahbapb.c b/uc_str912/prj_blinky_complex_startup/src/91x_ahbapb.c
deleted file mode 100644
index 41489ac..0000000
--- a/uc_str912/prj_blinky_complex_startup/src/91x_ahbapb.c
+++ /dev/null
@@ -1,177 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_ahbapb.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the AHBAPB software functions.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_ahbapb.h"
-
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-#define AHBAPB_SplitCounter_Mask 0xFFE0FFFF
-#define AHBAPB_SetTimeOut_Mask 0xFFFFFFE0
-#define AHBAPB_Address_Mask 0xFEFFFFFF
-#define AHBAPB_FLAG_RW_Mask 0x01000000
-/*******************************************************************************
-* Function Name : AHBAPB_DeInit
-* Description : Deinitializes the AHBAPBx peripheral registers to their default
-* reset values.
-* Input : AHBAPBx: where x can be 0 or 1 to select the AHBAPB peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void AHBAPB_DeInit(AHBAPB_TypeDef* AHBAPBx)
-{
- AHBAPBx->BCR = 0x00000000;
- AHBAPBx->BSR = 0x00000000;
-}
-/*******************************************************************************
-* Function Name : AHBAPB_Init
-* Description : Initializes the AHBAPBx peripheral according to the specified
-* parameters in the AHBAPB_InitStruct .
-* Input :- AHBAPBx: where x can be 0 or 1 to select the AHBAPB peripheral.
-* - AHBAPB_InitStruct: pointer to a AHBAPB_InitTypeDef structure that
-* contains the configuration information for the specified AHBAPB
-* peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void AHBAPB_Init(AHBAPB_TypeDef* AHBAPBx, AHBAPB_InitTypeDef* AHBAPB_InitStruct)
-{
-
- if(AHBAPB_InitStruct->AHBAPB_Split == AHBAPB_Split_Enable)
- {
- /* Set SPLITEN bit;*/
- AHBAPBx->BCR |= AHBAPB_Split_Enable;
- /*Split_CNT bits[20:16]*/
- AHBAPBx->BCR &= AHBAPB_SplitCounter_Mask;
- AHBAPBx->BCR |= (AHBAPB_InitStruct->AHBAPB_SplitCounter)<<16;
- }
- else
- {
- /*/ Clear SPLITEN bit;*/
- AHBAPBx->BCR &= AHBAPB_Split_Disable;
- }
- /*APB Time out*/
- if(AHBAPB_InitStruct->AHBAPB_Error == AHBAPB_Error_Enable)
- {
- /* Set ERREN bit*/
- AHBAPBx->BCR |= AHBAPB_Error_Enable;
- /*Time ouit counter*/
- AHBAPBx->BCR &= AHBAPB_SetTimeOut_Mask;
- AHBAPBx->BCR |= AHBAPB_InitStruct->AHBAPB_SetTimeOut;
- }
- else
- {
- /* Clear ERREN bit*/
- AHBAPBx->BCR &= AHBAPB_Error_Disable;
- }
-}
-
-/*******************************************************************************
-* Function Name : AHBAPB_StructInit
-* Description : Initialize the AHBAPB Init Structure parameters
-* Input : AHBAPB_InitStruct : pointer to a AHBAPB_InitTypeDef structure
-* which will be initialized.
-* Output : None
-* Return : None
-*******************************************************************************/
-void AHBAPB_StructInit(AHBAPB_InitTypeDef* AHBAPB_InitStruct)
-{
- /* Reset AHBAPB init structure parameters values */
- AHBAPB_InitStruct->AHBAPB_Split = AHBAPB_Split_Enable;
- AHBAPB_InitStruct->AHBAPB_SplitCounter = 0xFF;
- AHBAPB_InitStruct->AHBAPB_Error = AHBAPB_Error_Enable;
- AHBAPB_InitStruct->AHBAPB_SetTimeOut = 0xFF;
-
-}
-
-/*******************************************************************************
-* Function Name : AHBAPB_GetFlagStatus
-* Description : Checks whether the specified AHBAPB flag is set or not.
-* Input : - AHBAPB: where x can be 0 or 1 to select the AHBAPB peripheral
-* - AHBAPB_FLAG: specifies the flag to check.
-* This parameter can be one of the following values:
-* - AHBAPB_FLAG_ERROR: error flag
-* - AHBAPB_FLAG_OUTM : Out of Memory flag
-* - AHBAPB_FLAG_APBT : APB Time-out flag
-* - AHBAPB_FLAG_RW : Access type flag
-* Output : None
-* Return : The new state of AHBAPB_FLAG (SET or RESET).
-*******************************************************************************/
-FlagStatus AHBAPB_GetFlagStatus(AHBAPB_TypeDef* AHBAPBx, u8 AHBAPB_FLAG)
-{
- if(AHBAPB_FLAG == AHBAPB_FLAG_RW)
- {
- if ((AHBAPBx->PAER & AHBAPB_FLAG_RW_Mask) == RESET)
- {
- return RESET;
- }
- else
- {
- return SET;
- }
- }
- else
- {
- if ((AHBAPBx->BSR & AHBAPB_FLAG) == RESET)
- {
- return RESET;
- }
- else
- {
- return SET;
- }
- }
-}
-/*******************************************************************************
-* Function Name : AHBAPB_ClearFlag
-* Description : Clears the AHBAPBx flags.
-* Input : - AHBAPB: where x can be 0 or 1 to select the AHBAPB peripheral
-* - AHBAPB_FLAG: flags to clear. This parameter one of the
-* following values:
-* - AHBAPB_FLAG_ERROR: error flag
-* - AHBAPB_FLAG_OUTM : Out of Memory flag
-* - AHBAPB_FLAG_APBT : APB Time-out flag
-* Output : None
-* Return : None
-*******************************************************************************/
-void AHBAPB_ClearFlag(AHBAPB_TypeDef* AHBAPBx, u8 AHBAPB_FLAG)
-{
- /* Clear the flag */
- AHBAPBx->BSR &= AHBAPB_FLAG;
-}
-/*******************************************************************************
-* Function Name : AHBAPB_GetPeriphAddrError
-* Description : Gets the AHBAPB error address peripherals.
-* Input : - AHBAPB: where x can be 0 or 1 to select the AHBAPB peripheral
-* Output : None
-* Return : The Peropheral address error
-*******************************************************************************/
-u32 AHBAPB_GetPeriphAddrError(AHBAPB_TypeDef* AHBAPBx)
-{
- u32 AHBAPB_Address = 0x00000000;
-
- /*Return Oeripheral address without RW bit*/
- AHBAPB_Address = (AHBAPBx->PAER)& AHBAPB_Address_Mask;
- return (AHBAPB_Address);
-}
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_complex_startup/src/91x_can.c b/uc_str912/prj_blinky_complex_startup/src/91x_can.c
deleted file mode 100644
index 3a9ebce..0000000
--- a/uc_str912/prj_blinky_complex_startup/src/91x_can.c
+++ /dev/null
@@ -1,769 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_can.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the CAN software functions.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_can.h"
-#include "91x_scu.h"
-
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-/* Private macro -------------------------------------------------------------*/
-/*----------------------------------------------------------------------------*/
-/* Macro Name : xxx_ID_MSK, xxx_ID_ARB */
-/* Description : Form the Mask and Arbitration registers value to filter */
-/* a range of identifiers or a fixed identifier, for standard*/
-/* and extended IDs */
-/*----------------------------------------------------------------------------*/
-#define RANGE_ID_MSK(range_start, range_end) (~((range_end) - (range_start)))
-#define RANGE_ID_ARB(range_start, range_end) ((range_start) & (range_end))
-
-#define FIXED_ID_MSK(id) RANGE_ID_MSK((id), (id))
-#define FIXED_ID_ARB(id) RANGE_ID_ARB((id), (id))
-
-#define STD_RANGE_ID_MSK(range_start, range_end) ((u16)((RANGE_ID_MSK((range_start), (range_end)) & 0x7FF) << 2))
-#define STD_RANGE_ID_ARB(range_start, range_end) ((u16)(RANGE_ID_ARB((range_start), (range_end)) << 2))
-
-#define STD_FIXED_ID_MSK(id) ((u16)((FIXED_ID_MSK(id) & 0x7FF) << 2))
-#define STD_FIXED_ID_ARB(id) ((u16)(FIXED_ID_ARB(id) << 2))
-
-#define EXT_RANGE_ID_MSK_L(range_start, range_end) ((u16)(RANGE_ID_MSK((range_start), (range_end)) >> 11))
-#define EXT_RANGE_ID_MSK_H(range_start, range_end) ((u16)(STD_RANGE_ID_MSK((range_start), (range_end)) | ((RANGE_ID_MSK((range_start), (range_end)) >> 27) & 0x03)))
-#define EXT_RANGE_ID_ARB_L(range_start, range_end) ((u16)(RANGE_ID_ARB((range_start), (range_end)) >> 11))
-#define EXT_RANGE_ID_ARB_H(range_start, range_end) ((u16)(STD_RANGE_ID_ARB((range_start), (range_end)) | ((RANGE_ID_ARB((range_start), (range_end)) >> 27) & 0x03)))
-
-#define EXT_FIXED_ID_MSK_L(id) ((u16)(FIXED_ID_MSK(id) >> 11))
-#define EXT_FIXED_ID_MSK_H(id) ((u16)(STD_FIXED_ID_MSK(id) | ((FIXED_ID_MSK(id) >> 27) & 0x03)))
-#define EXT_FIXED_ID_ARB_L(id) ((u16)(FIXED_ID_ARB(id) >> 11))
-#define EXT_FIXED_ID_ARB_H(id) ((u16)(STD_FIXED_ID_ARB(id) | ((FIXED_ID_ARB(id) >> 27) & 0x03)))
-
-/* macro to format the timing register value from the timing parameters*/
-#define CAN_TIMING(tseg1, tseg2, sjw, brp) ((((tseg2-1) & 0x07) << 12) | (((tseg1-1) & 0x0F) << 8) | (((sjw-1) & 0x03) << 6) | ((brp-1) & 0x3F))
-
-/* Private variables ---------------------------------------------------------*/
-/* array of pre-defined timing parameters for standard bitrates for AHB@48MHz */
-u16 CanTimings[] = { /* value bitrate NTQ TSEG1 TSEG2 SJW BRP */
- CAN_TIMING(13, 6, 4, 24), /* 0x5CD7 100 kbit/s 24 13 6 4 24 */
- CAN_TIMING(13, 6, 4, 19), /* 0xyyyy 125 kbit/s 20 13 6 4 20 */
- CAN_TIMING( 6, 3, 5, 19), /* 0xyyyy 250 kbit/s 10 6 3 5 19 */
- CAN_TIMING(13, 2, 1, 1), /* 0x1C00 500 kbit/s 16 13 2 1 1 */
- CAN_TIMING( 4, 3, 1, 1), /* 0x2300 1 Mbit/s 8 4 3 1 1 */
-};
-
-/* Private function prototypes -----------------------------------------------*/
-static u32 GetFreeIF(void);
-/* Private functions ---------------------------------------------------------*/
-
-/*******************************************************************************
-* Function Name : CAN_DeInit
-* Description : Deinitializes the CAN peripheral registers to their default
-* reset values.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void CAN_DeInit (void)
-{
- /* Reset the CAN registers values*/
-
- SCU_APBPeriphReset(__CAN,ENABLE); /*CAN peripheral is under Reset */
- SCU_APBPeriphReset(__CAN,DISABLE); /*CAN peripheral Reset off*/
-
-
-}
-
-/*******************************************************************************
-* Function Name : CAN_Init
-* Description : Initializes the CAN peripheral according to the specified
-* parameters in the CAN_InitStruct.
-* Input : CAN_InitStruct: pointer to a CAN_InitTypeDef structure that
-* contains the configuration information for the CAN peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void CAN_Init(CAN_InitTypeDef* CAN_InitStruct)
-{
- CAN_EnterInitMode(CAN_CR_CCE | CAN_InitStruct->CAN_ConfigParameters);
- CAN_SetBitrate(CAN_InitStruct->CAN_Bitrate);
- CAN_LeaveInitMode();
- CAN_LeaveTestMode();
-}
-
-/*******************************************************************************
-* Function Name : CAN_StructInit
-* Description : Fills each CAN_InitStruct member with its reset value.
-* Input : CAN_InitStruct : pointer to a CAN_InitTypeDef structure which
-* will be initialized.
-* Output : None
-* Return : None.
-*******************************************************************************/
-void CAN_StructInit(CAN_InitTypeDef* CAN_InitStruct)
-{
-/* Reset CAN init structure parameters values */
- CAN_InitStruct->CAN_ConfigParameters = 0x0;
- CAN_InitStruct->CAN_Bitrate = 0x2301;
-}
-
-/*******************************************************************************
-* Function Name : CAN_SetBitrate
-* Description : Setups a standard CAN bitrate.
-* Input : bitrate: specifies the bit rate.
-* Output : None
-* Return : None
-*******************************************************************************/
-void CAN_SetBitrate(u32 bitrate)
-{
-// CAN->BTR = CanTimings[bitrate]; /* write the predefined timing value */
- CAN->BTR = bitrate; /* write the predefined timing value */
- CAN->BRPR = 0; /* clear the Extended Baud Rate Prescaler */
-}
-
-/*******************************************************************************
-* Function Name : CAN_SetTiming
-* Description : Setups the CAN timing with specific parameters
-* Input : - tseg1: specifies Time Segment before the sample point.
-* This parameter must be a number between 1 and 16.
-* - tseg2: Time Segment after the sample point. This parameter
-* must be a number between 1 and 8.
-* - sjw: Synchronisation Jump Width. This parameter must be
-* a number between 1 and 4.
-* - brp: Baud Rate Prescaler. This parameter must be a number
-* between 1 and 1024.
-* Output : None
-* Return : None
-*******************************************************************************/
-void CAN_SetTiming(u32 tseg1, u32 tseg2, u32 sjw, u32 brp)
-{
- CAN->BTR = CAN_TIMING(tseg1, tseg2, sjw, brp);
- CAN->BRPR = ((brp-1) >> 6) & 0x0F;
-}
-
-/*******************************************************************************
-* Function Name : GetFreeIF
-* Description : Searchs the first free message interface, starting from 0.
-* Input : None
-* Output : None
-* Return : A free message interface number (0 or 1) if found, else 2
-*******************************************************************************/
-static u32 GetFreeIF(void)
-{
- if ((CAN->sMsgObj[0].CRR & CAN_CRR_BUSY) == 0)
- return 0;
- else if ((CAN->sMsgObj[1].CRR & CAN_CRR_BUSY) == 0)
- return 1;
- else
- return 2;
-}
-
-/*******************************************************************************
-* Function Name : CAN_SetUnusedMsgObj
-* Description : Configures the message object as unused
-* Input : msgobj: specifies the Message object number, from 0 to 31.
-* Output : None
-* Return : An ErrorStatus enumuration value:
-* - SUCCESS: Interface to treat the message
-* - ERROR: No interface to treat the message
-*******************************************************************************/
-ErrorStatus CAN_SetUnusedMsgObj(u32 msgobj)
-{
- u32 msg_if=0;
-
- if ((msg_if = GetFreeIF()) == 2)
- {
- return ERROR;
- }
-
- CAN->sMsgObj[msg_if].CMR = CAN_CMR_WRRD
- | CAN_CMR_MASK
- | CAN_CMR_ARB
- | CAN_CMR_CONTROL
- | CAN_CMR_DATAA
- | CAN_CMR_DATAB;
-
- CAN->sMsgObj[msg_if].M1R = 0;
- CAN->sMsgObj[msg_if].M2R = 0;
-
- CAN->sMsgObj[msg_if].A1R = 0;
- CAN->sMsgObj[msg_if].A2R = 0;
-
- CAN->sMsgObj[msg_if].MCR = 0;
-
- CAN->sMsgObj[msg_if].DA1R = 0;
- CAN->sMsgObj[msg_if].DA2R = 0;
- CAN->sMsgObj[msg_if].DB1R = 0;
- CAN->sMsgObj[msg_if].DB2R = 0;
-
- CAN->sMsgObj[msg_if].CRR = 1 + msgobj;
-
- return SUCCESS;
-}
-
-/*******************************************************************************
-* Function Name : CAN_SetTxMsgObj
-* Description : Configures the message object as TX.
-* Input : - msgobj: specifies the Message object number, from 0 to 31.
-* - idType: specifies the identifier type of the frames that
-* will be transmitted using this message object.
-* This parameter can be one of the following values:
-* - CAN_STD_ID (standard ID, 11-bit)
-* - CAN_EXT_ID (extended ID, 29-bit)
-* Output : None
-* Return : An ErrorStatus enumuration value:
-* - SUCCESS: Interface to treat the message
-* - ERROR: No interface to treat the message
-*******************************************************************************/
-ErrorStatus CAN_SetTxMsgObj(u32 msgobj, u32 idType)
-{
- u32 msg_if=0;
-
- if ((msg_if = GetFreeIF()) == 2)
- {
- return ERROR;
- }
-
- CAN->sMsgObj[msg_if].CMR = CAN_CMR_WRRD
- | CAN_CMR_MASK
- | CAN_CMR_ARB
- | CAN_CMR_CONTROL
- | CAN_CMR_DATAA
- | CAN_CMR_DATAB;
-
- CAN->sMsgObj[msg_if].M1R = 0;
- CAN->sMsgObj[msg_if].A1R = 0;
-
- if (idType == CAN_STD_ID)
- {
- CAN->sMsgObj[msg_if].M2R = CAN_M2R_MDIR;
- CAN->sMsgObj[msg_if].A2R = CAN_A2R_MSGVAL | CAN_A2R_DIR;
- }
- else
- {
- CAN->sMsgObj[msg_if].M2R = CAN_M2R_MDIR | CAN_M2R_MXTD;
- CAN->sMsgObj[msg_if].A2R = CAN_A2R_MSGVAL | CAN_A2R_DIR | CAN_A2R_XTD;
- }
-
- CAN->sMsgObj[msg_if].MCR = CAN_MCR_TXIE | CAN_MCR_EOB;
-
- CAN->sMsgObj[msg_if].DA1R = 0;
- CAN->sMsgObj[msg_if].DA2R = 0;
- CAN->sMsgObj[msg_if].DB1R = 0;
- CAN->sMsgObj[msg_if].DB2R = 0;
-
- CAN->sMsgObj[msg_if].CRR = 1 + msgobj;
-
- return SUCCESS;
-}
-
-/*******************************************************************************
-* Function Name : CAN_SetRxMsgObj
-* Description : Configures the message object as RX.
-* Input : - msgobj: specifies the Message object number, from 0 to 31.
-* - idType: specifies the identifier type of the frames that
-* will be transmitted using this message object.
-* This parameter can be one of the following values:
-* - CAN_STD_ID (standard ID, 11-bit)
-* - CAN_EXT_ID (extended ID, 29-bit)
-* - idLow: specifies the low part of the identifier range used
-* for acceptance filtering.
-* - idHigh: specifies the high part of the identifier range
-* used for acceptance filtering.
-* - singleOrFifoLast: specifies the end-of-buffer indicator.
-* This parameter can be one of the following values:
-* - TRUE: for a single receive object or a FIFO receive
-* object that is the last one of the FIFO.
-* - FALSE: for a FIFO receive object that is not the
-* last one.
-* Output : None
-* Return : An ErrorStatus enumuration value:
-* - SUCCESS: Interface to treat the message
-* - ERROR: No interface to treat the message
-*******************************************************************************/
-ErrorStatus CAN_SetRxMsgObj(u32 msgobj, u32 idType, u32 idLow, u32 idHigh, bool singleOrFifoLast)
-{
- u32 msg_if=0;
-
- if ((msg_if = GetFreeIF()) == 2)
- {
- return ERROR;
- }
-
- CAN->sMsgObj[msg_if].CMR = CAN_CMR_WRRD
- | CAN_CMR_MASK
- | CAN_CMR_ARB
- | CAN_CMR_CONTROL
- | CAN_CMR_DATAA
- | CAN_CMR_DATAB;
-
- if (idType == CAN_STD_ID)
- {
- CAN->sMsgObj[msg_if].M1R = 0;
- CAN->sMsgObj[msg_if].M2R = STD_RANGE_ID_MSK(idLow, idHigh);
-
- CAN->sMsgObj[msg_if].A1R = 0;
- CAN->sMsgObj[msg_if].A2R = CAN_A2R_MSGVAL | STD_RANGE_ID_ARB(idLow, idHigh);
- }
- else
- {
- CAN->sMsgObj[msg_if].M1R = EXT_RANGE_ID_MSK_L(idLow, idHigh);
- CAN->sMsgObj[msg_if].M2R = CAN_M2R_MXTD | EXT_RANGE_ID_MSK_H(idLow, idHigh);
-
- CAN->sMsgObj[msg_if].A1R = EXT_RANGE_ID_ARB_L(idLow, idHigh);
- CAN->sMsgObj[msg_if].A2R = CAN_A2R_MSGVAL | CAN_A2R_XTD | EXT_RANGE_ID_ARB_H(idLow, idHigh);
- }
-
- CAN->sMsgObj[msg_if].MCR = CAN_MCR_RXIE | CAN_MCR_UMASK | (singleOrFifoLast ? CAN_MCR_EOB : 0);
-
- CAN->sMsgObj[msg_if].DA1R = 0;
- CAN->sMsgObj[msg_if].DA2R = 0;
- CAN->sMsgObj[msg_if].DB1R = 0;
- CAN->sMsgObj[msg_if].DB2R = 0;
-
- CAN->sMsgObj[msg_if].CRR = 1 + msgobj;
-
- return SUCCESS;
-}
-
-/*******************************************************************************
-* Function Name : CAN_InvalidateAllMsgObj
-* Description : Configures all the message objects as unused.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void CAN_InvalidateAllMsgObj(void)
-{
- u32 i=0;
- for (i = 0; i < 32; i++)
- CAN_SetUnusedMsgObj(i);
-}
-
-
-/*******************************************************************************
-* Function Name : CAN_ReleaseMessage
-* Description : Releases the message object
-* Input : - msgobj: specifies the Message object number, from 0 to 31.
-* Output : None
-* Return : An ErrorStatus enumuration value:
-* - SUCCESS: Interface to treat the message
-* - ERROR: No interface to treat the message
-*******************************************************************************/
-ErrorStatus CAN_ReleaseMessage(u32 msgobj)
-{
- u32 msg_if=0;
-
- if ((msg_if = GetFreeIF()) == 2)
- {
- return ERROR;
- }
-
- CAN->sMsgObj[msg_if].CMR = CAN_CMR_CLRINTPND | CAN_CMR_TXRQSTNEWDAT;
- CAN->sMsgObj[msg_if].CRR = 1 + msgobj;
-
- return SUCCESS;
-}
-
-/*******************************************************************************
-* Function Name : CAN_SendMessage
-* Description : Start transmission of a message
-* Input : - msgobj: specifies the Message object number, from 0 to 31.
-* : - pCanMsg: pointer to the message structure containing data
-* to transmit.
-* Output : None
-* Return : An ErrorStatus enumuration value:
-* - SUCCESS: Transmission OK
-* - ERROR: No transmission
-*******************************************************************************/
-ErrorStatus CAN_SendMessage(u32 msgobj, canmsg* pCanMsg)
-{
- if (CAN->sMsgObj[0].CRR & CAN_CRR_BUSY)
- {
- return ERROR;
- }
-
- CAN->SR &= ~CAN_SR_TXOK;
-
- /* read the Arbitration and Message Control*/
- CAN->sMsgObj[0].CMR = CAN_CMR_ARB | CAN_CMR_CONTROL;
-
- CAN->sMsgObj[0].CRR = 1 + msgobj;
-
- if (CAN->sMsgObj[0].CRR & CAN_CRR_BUSY)
- {
- return ERROR;
- }
-
- /* update the contents needed for transmission*/
- CAN->sMsgObj[0].CMR = CAN_CMR_WRRD
- | CAN_CMR_ARB
- | CAN_CMR_CONTROL
- | CAN_CMR_DATAA
- | CAN_CMR_DATAB;
-
- if ((CAN->sMsgObj[0].A2R & CAN_A2R_XTD) == 0)
- {
- /* standard ID*/
- CAN->sMsgObj[0].A1R = 0;
- CAN->sMsgObj[0].A2R = (CAN->sMsgObj[0].A2R & 0xE000) | STD_FIXED_ID_ARB(pCanMsg->Id);
- }
- else
- {
- /* extended ID*/
- CAN->sMsgObj[0].A1R = EXT_FIXED_ID_ARB_L(pCanMsg->Id);
- CAN->sMsgObj[0].A2R = (CAN->sMsgObj[0].A2R & 0xE000) | EXT_FIXED_ID_ARB_H(pCanMsg->Id);
- }
-
- CAN->sMsgObj[0].MCR = (CAN->sMsgObj[0].MCR & 0xFEF0) | CAN_MCR_NEWDAT | CAN_MCR_TXRQST | pCanMsg->Dlc;
-
- CAN->sMsgObj[0].DA1R = ((u16)pCanMsg->Data[1]<<8) | pCanMsg->Data[0];
- CAN->sMsgObj[0].DA2R = ((u16)pCanMsg->Data[3]<<8) | pCanMsg->Data[2];
- CAN->sMsgObj[0].DB1R = ((u16)pCanMsg->Data[5]<<8) | pCanMsg->Data[4];
- CAN->sMsgObj[0].DB2R = ((u16)pCanMsg->Data[7]<<8) | pCanMsg->Data[6];
-
- CAN->sMsgObj[0].CRR = 1 + msgobj;
-
- return SUCCESS;
-}
-
-/*******************************************************************************
-* Function Name : CAN_ReceiveMessage
-* Description : Gets the message, if received.
-* Input : - msgobj: specifies the Message object number, from 0 to 31.
-* - release: specifies the message release indicator.
-* This parameter can be one of the following values:
-* - TRUE: the message object is released when getting
-* the data.
-* - FALSE: the message object is not released.
-* - pCanMsg: pointer to the message structure where received
-* data is copied.
-* Output : None
-* Return : An ErrorStatus enumuration value:
-* - SUCCESS: Reception OK
-* - ERROR: No message pending
-*******************************************************************************/
-ErrorStatus CAN_ReceiveMessage(u32 msgobj, bool release, canmsg* pCanMsg)
-{
- if (!CAN_IsMessageWaiting(msgobj))
- {
- return ERROR;
- }
-
- CAN->SR &= ~CAN_SR_RXOK;
-
- /* read the message contents*/
- CAN->sMsgObj[1].CMR = CAN_CMR_MASK
- | CAN_CMR_ARB
- | CAN_CMR_CONTROL
- | CAN_CMR_CLRINTPND
- | (release ? CAN_CMR_TXRQSTNEWDAT : 0)
- | CAN_CMR_DATAA
- | CAN_CMR_DATAB;
-
- CAN->sMsgObj[1].CRR = 1 + msgobj;
-
- if (CAN->sMsgObj[1].CRR & CAN_CRR_BUSY)
- {
- return ERROR;
- }
-
- if ((CAN->sMsgObj[1].A2R & CAN_A2R_XTD) == 0)
- {
- /* standard ID*/
- pCanMsg->IdType = CAN_STD_ID;
- pCanMsg->Id = (CAN->sMsgObj[1].A2R >> 2) & 0x07FF;
- }
- else
- {
- /* extended ID*/
- pCanMsg->IdType = CAN_EXT_ID;
- pCanMsg->Id = ((CAN->sMsgObj[1].A2R >> 2) & 0x07FF);
- pCanMsg->Id |= ((u32)CAN->sMsgObj[1].A1R << 11);
- pCanMsg->Id |= (((u32)CAN->sMsgObj[1].A2R & 0x0003) << 27);
- }
-
- pCanMsg->Dlc = CAN->sMsgObj[1].MCR & 0x0F;
-
- pCanMsg->Data[0] = (u8) CAN->sMsgObj[1].DA1R;
- pCanMsg->Data[1] = (u8)(CAN->sMsgObj[1].DA1R >> 8);
- pCanMsg->Data[2] = (u8) CAN->sMsgObj[1].DA2R;
- pCanMsg->Data[3] = (u8)(CAN->sMsgObj[1].DA2R >> 8);
- pCanMsg->Data[4] = (u8) CAN->sMsgObj[1].DB1R;
- pCanMsg->Data[5] = (u8)(CAN->sMsgObj[1].DB1R >> 8);
- pCanMsg->Data[6] = (u8) CAN->sMsgObj[1].DB2R;
- pCanMsg->Data[7] = (u8)(CAN->sMsgObj[1].DB2R >> 8);
-
- return SUCCESS;
-}
-
-/*******************************************************************************
-* Function Name : CAN_WaitEndOfTx
-* Description : Waits until current transmission is finished.
-* Input : None
-* Output : None
-* Return : An ErrorStatus enumuration value:
-* - SUCCESS: Transmission ended
-* - ERROR: Transmission did not occur yet
-*******************************************************************************/
-ErrorStatus CAN_WaitEndOfTx(void)
-{
- if ((CAN->SR & CAN_SR_TXOK) == 0)
- {
- return ERROR;
- }
- CAN->SR &= ~CAN_SR_TXOK;
-
- return SUCCESS;
-}
-
-/*******************************************************************************
-* Function Name : CAN_BasicSendMessage
-* Description : Starts transmission of a message in BASIC mode. This mode
-* does not use the message RAM.
-* Input : pCanMsg: Pointer to the message structure containing data to
-* transmit.
-* Output : None
-* Return : An ErrorStatus enumuration value:
-* - SUCCESS: Transmission OK
-* - ERROR: No transmission
-*******************************************************************************/
-ErrorStatus CAN_BasicSendMessage(canmsg* pCanMsg)
-{
- /* clear NewDat bit in IF2 to detect next reception*/
- CAN->sMsgObj[1].MCR &= ~CAN_MCR_NEWDAT;
-
- CAN->SR &= ~CAN_SR_TXOK;
- CAN->sMsgObj[0].CMR = CAN_CMR_WRRD
- | CAN_CMR_ARB
- | CAN_CMR_CONTROL
- | CAN_CMR_DATAA
- | CAN_CMR_DATAB;
-
- if (pCanMsg->IdType == CAN_STD_ID)
- {
- /* standard ID*/
- CAN->sMsgObj[0].A1R = 0;
- CAN->sMsgObj[0].A2R = (CAN->sMsgObj[0].A2R & 0xE000) | STD_FIXED_ID_ARB(pCanMsg->Id);
- }
- else
- {
- /* extended ID*/
- CAN->sMsgObj[0].A1R = EXT_FIXED_ID_ARB_L(pCanMsg->Id);
- CAN->sMsgObj[0].A2R = ((CAN->sMsgObj[0].A2R) & 0xE000) | EXT_FIXED_ID_ARB_H(pCanMsg->Id);
- }
-
- CAN->sMsgObj[0].MCR = (CAN->sMsgObj[0].MCR & 0xFCF0) | pCanMsg->Dlc;
-
- CAN->sMsgObj[0].DA1R = ((u16)pCanMsg->Data[1]<<8) | pCanMsg->Data[0];
- CAN->sMsgObj[0].DA2R = ((u16)pCanMsg->Data[3]<<8) | pCanMsg->Data[2];
- CAN->sMsgObj[0].DB1R = ((u16)pCanMsg->Data[5]<<8) | pCanMsg->Data[4];
- CAN->sMsgObj[0].DB2R = ((u16)pCanMsg->Data[7]<<8) | pCanMsg->Data[6];
-
- /* request transmission*/
- if (CAN->sMsgObj[0].CRR == CAN_CRR_BUSY )
- {
- return ERROR;
- }
-
- return SUCCESS;
-}
-
-/*******************************************************************************
-* Function Name : CAN_BasicReceiveMessage
-* Description : Gets the message in BASIC mode, if received. This mode does
-* not use the message RAM.
-* Input : pCanMsg: pointer to the message structure where message is copied.
-* Output : None
-* Return : An ErrorStatus enumuration value:
-* - SUCCESS: Reception OK
-* - ERROR: No message pending
-*******************************************************************************/
-ErrorStatus CAN_BasicReceiveMessage(canmsg* pCanMsg)
-{
- if ((CAN->sMsgObj[1].MCR & CAN_MCR_NEWDAT) == 0)
- {
- return ERROR;
- }
-
- CAN->SR &= ~CAN_SR_RXOK;
-
- CAN->sMsgObj[1].CMR = CAN_CMR_ARB
- | CAN_CMR_CONTROL
- | CAN_CMR_DATAA
- | CAN_CMR_DATAB;
-
- if ((CAN->sMsgObj[1].A2R & CAN_A2R_XTD) == 0)
- {
- /* standard ID*/
- pCanMsg->IdType = CAN_STD_ID;
- pCanMsg->Id = (CAN->sMsgObj[1].A2R >> 2) & 0x07FF;
- }
- else
- {
- /* extended ID*/
- pCanMsg->IdType = CAN_EXT_ID;
- pCanMsg->Id = ((CAN->sMsgObj[1].A2R >> 2) & 0x07FF);
- pCanMsg->Id |= ((u32)CAN->sMsgObj[1].A1R << 11);
- pCanMsg->Id |= (((u32)CAN->sMsgObj[1].A2R & 0x0003) << 27);
- }
-
- pCanMsg->Dlc = CAN->sMsgObj[1].MCR & 0x0F;
-
- pCanMsg->Data[0] = (u8) CAN->sMsgObj[1].DA1R;
- pCanMsg->Data[1] = (u8)(CAN->sMsgObj[1].DA1R >> 8);
- pCanMsg->Data[2] = (u8) CAN->sMsgObj[1].DA2R;
- pCanMsg->Data[3] = (u8)(CAN->sMsgObj[1].DA2R >> 8);
- pCanMsg->Data[4] = (u8) CAN->sMsgObj[1].DB1R;
- pCanMsg->Data[5] = (u8)(CAN->sMsgObj[1].DB1R >> 8);
- pCanMsg->Data[6] = (u8) CAN->sMsgObj[1].DB2R;
- pCanMsg->Data[7] = (u8)(CAN->sMsgObj[1].DB2R >> 8);
-
- return SUCCESS;
-}
-
-/*******************************************************************************
-* Function Name : CAN_EnterInitMode
-* Description : Switchs the CAN into initialization mode. This function must
-* be used in conjunction with CAN_LeaveInitMode().
-* Input : InitMask: specifies the CAN configuration in normal mode.
-* Output : None
-* Return : None
-*******************************************************************************/
-void CAN_EnterInitMode(u8 InitMask)
-{
- CAN->CR = InitMask | CAN_CR_INIT;
- CAN->SR = 0; /* reset the status*/
-}
-
-/*******************************************************************************
-* Function Name : CAN_LeaveInitMode
-* Description : Leaves the initialization mode (switch into normal mode).
-* This function must be used in conjunction with CAN_EnterInitMode().
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void CAN_LeaveInitMode(void)
-{
- CAN->CR &= ~(CAN_CR_INIT | CAN_CR_CCE);
-}
-
-/*******************************************************************************
-* Function Name : CAN_EnterTestMode
-* Description : Switchs the CAN into test mode. This function must be used in
-* conjunction with CAN_LeaveTestMode().
-* Input : TestMask: specifies the configuration in test modes.
-* Output : None
-* Return : None
-*******************************************************************************/
-void CAN_EnterTestMode(u8 TestMask)
-{
- CAN->CR |= CAN_CR_TEST;
- CAN->TESTR |= TestMask;
-}
-
-/*******************************************************************************
-* Function Name : CAN_LeaveTestMode
-* Description : Leaves the current test mode (switch into normal mode).
-* This function must be used in conjunction with CAN_EnterTestMode().
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void CAN_LeaveTestMode(void)
-{
- CAN->CR |= CAN_CR_TEST;
- CAN->TESTR &= ~(CAN_TESTR_LBACK | CAN_TESTR_SILENT | CAN_TESTR_BASIC);
- CAN->CR &= ~CAN_CR_TEST;
-}
-
-/*******************************************************************************
-* Function Name : CAN_ReleaseTxMessage
-* Description : Releases the transmit message object.
-* Input : - msgobj: specifies the Message object number, from 0 to 31.
-* Output : None
-* Return : None
-*******************************************************************************/
-void CAN_ReleaseTxMessage(u32 msgobj)
-{
- CAN->sMsgObj[0].CMR = CAN_CMR_CLRINTPND | CAN_CMR_TXRQSTNEWDAT;
- CAN->sMsgObj[0].CRR = 1 + msgobj;
-}
-
-/*******************************************************************************
-* Function Name : CAN_ReleaseRxMessage
-* Description : Releases the receive message object.
-* Input : - msgobj: specifies the Message object number, from 0 to 31.
-* Output : None
-* Return : None
-*******************************************************************************/
-void CAN_ReleaseRxMessage(u32 msgobj)
-{
- CAN->sMsgObj[1].CMR = CAN_CMR_CLRINTPND | CAN_CMR_TXRQSTNEWDAT;
- CAN->sMsgObj[1].CRR = 1 + msgobj;
-}
-
-/*******************************************************************************
-* Function Name : CAN_IsMessageWaiting
-* Description : Tests the waiting status of a received message.
-* Input : - msgobj: specifies the Message object number, from 0 to 31.
-* Output : None
-* Return : A non-zero value if the corresponding message object has
-* received a message waiting to be copied, else 0.
-*******************************************************************************/
-u32 CAN_IsMessageWaiting(u32 msgobj)
-{
- return (msgobj < 16 ? CAN->ND1R & (1 << msgobj) : CAN->ND2R & (1 << (msgobj-16)));
-}
-
-/*******************************************************************************
-* Function Name : CAN_IsTransmitRequested
-* Description : Tests the request status of a transmitted message.
-* Input : - msgobj: specifies the Message object number, from 0 to 31.
-* Output : None
-* Return : A non-zero value if the corresponding message is requested
-* to transmit, else 0.
-*******************************************************************************/
-u32 CAN_IsTransmitRequested(u32 msgobj)
-{
- return (msgobj < 16 ? CAN->TXR1R & (1 << msgobj) : CAN->TXR2R & (1 << (msgobj-16)));
-}
-
-/*******************************************************************************
-* Function Name : CAN_IsInterruptPending
-* Description : Tests the interrupt status of a message object.
-* Input : - msgobj: specifies the Message object number, from 0 to 31.
-* Output : None
-* Return : A non-zero value if the corresponding message has an
-* interrupt pending, else 0.
-*******************************************************************************/
-u32 CAN_IsInterruptPending(u32 msgobj)
-{
- return (msgobj < 16 ? CAN->IP1R & (1 << msgobj) : CAN->IP2R & (1 << (msgobj-16)));
-}
-
-/*******************************************************************************
-* Function Name : CAN_IsObjectValid
-* Description : Tests the validity of a message object (ready to use).
-* Input : - msgobj: specifies the Message object number, from 0 to 31.
-* Output : None
-* Return : A non-zero value if the corresponding message object is
-* valid, else 0.
-*******************************************************************************/
-u32 CAN_IsObjectValid(u32 msgobj)
-{
- return (msgobj < 16 ? CAN->MV1R & (1 << msgobj) : CAN->MV2R & (1 << (msgobj-16)));
-}
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_complex_startup/src/91x_dma.c b/uc_str912/prj_blinky_complex_startup/src/91x_dma.c
deleted file mode 100644
index db6ad6e..0000000
--- a/uc_str912/prj_blinky_complex_startup/src/91x_dma.c
+++ /dev/null
@@ -1,1125 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_dma.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the DMA software functions
-* needed to access all DMA registers.
-********************************************************************************
-* History:v 1.0
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-
-# include"91x_dma.h"
-# include"91x_scu.h"
-
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-
-
-/* DMA Masks "used" only in this module */
-
-#define DMA_Width_DES_MASK 0xFF1FFFFF
-#define DMA_Width_SRC_MASK 0xFFE3FFFF
-#define DMA_Bst_DES_MASK 0xFFFC7FFF
-#define DMA_Bst_SRC_MASK 0xFFFF8FFF
-#define DMA_FlowCntrl_Mask 0xFFFFC7FF
-#define DMA_TrsfSisze_Mask 0xFFFFF000
-#define SRC_Mask 0xFFFFFFE1
-#define DES_Mask 0xFFFFFC3F
-#define DMA_TCIE 0x80000000
-#define DMA_ChannelDESInc 0x08000000
-#define DMA_ChannelSRCInc 0x04000000
-#define DMA_BufferChannel 0x20000000
-#define DMA_HaltChannel 0x00040000
-#define DMA_LockChannel 0x00010000
-#define DMA_CacheChannel 0x40000000
-#define DMA_ChannelActive 0x00020000
-#define DMA_Enable 0x00000001
-#define DMA_ChannelEnable 0x00000001
-
-
-
-
-/* Private function prototypes -----------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-
-/*******************************************************************************
-* Function Name : DMA_ITMaskConfig
-* Description : Enables or disables the specified DMA_Channelx Mask interrupt.
-* Input :
-* -DMA_Channelx: where x can be 0,1,2,3,4,5,6,or 7 to select the DMA Channel.
-* -DMA_ITMask: specifies the DMA interrupt mask source to be enabled or disabled.
-* This parameter can be:
-* - DMA_ITMask_IE (Interrupt error mask).
-* - DMA_ITMask_ITC (Terminal count interrupt mask).
-* - DMA_ITMask_ALL ( All interrupts mask)
-*
-* -NewState: new state of the specified DMA_Channelx mask interrupt.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-
-void DMA_ITMaskConfig(DMA_Channel_TypeDef * DMA_Channelx, u16 DMA_ITMask , FunctionalState NewState)
-
-{
- if (NewState==ENABLE) /* Mask the Interrupt */
- {
- DMA_Channelx-> CCNF |= DMA_ITMask ;
- }
-
- else /* Disable the Interrupt Mask*/
- {
- DMA_Channelx-> CCNF &= ~ DMA_ITMask ;
- }
-}
-
-
-
-
-
-/*******************************************************************************
-* Function Name : DMA_ITConfig
-* Description : Enables or disables the DMA_Channelx Terminal Count interrupt.
-* Input :
-* -DMA_Channelx: where x can be 0,1,2,3,4,5,6,or 7 to select the DMA Channel.
-* -NewState: new state of the specified DMA_Channelx mask interrupt.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-
-void DMA_ITConfig(DMA_Channel_TypeDef * DMA_Channelx, FunctionalState NewState)
-
-{
- if (NewState==ENABLE) /* Enable the Terminal Count Interrupt */
- {
- DMA_Channelx->CC |= DMA_TCIE ;
- }
-
- else /* Disable the Terminal Count Interrupt */
- {
- DMA_Channelx-> CC &= ~ DMA_TCIE ;
- }
-}
-
-
-/********************************************************************************
-* Function Name : DMA_SyncConfig
-* Description : Enables or disables synchronization logic for the corresponding DMA Request Signal.
-* Input :
-* -SRCReq:specifies the DMA Request Source.
-* This parameter can be:
-* -DMA_USB_RX_Mask
-* -DMA_USB_TX_Mask
-* -DMA_TIM0_Mask
-* -DMA_TIM1_Mask
-* -DMA_UART0_RX_Mask
-* -DMA_UART0_TX_Mask
-* -DMA_UART1_RX_Mask
-* -DMA_UART1_TX_Mask
-* -DMA_External_Req0_Mask
-* -DMA_External_Req1_Mask
-* -DMA_I2C0_Mask
-* -DMA_I2C1_Mask
-* -DMA_SSP0_RX_Mask
-* -DMA_SSP0_TX_Mask
-* -DMA_SSP1_RX_Mask
-* -DMA_SSP1_TX_Mask
-*
-* -NewState: new state of the specified DMA_Channelx mask interrupt.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-
-void DMA_SyncConfig(u16 SRCReq, FunctionalState NewState)
-
-{
- if (NewState==ENABLE) /* Enable the synchronization logic for the corresponding DMA Request Signal */
- {
-
- DMA->SYNR &= ~ SRCReq ;
-
- }
-
- else /* Disable the synchronization logic for the corresponding DMA Request Signal. */
- {
- DMA->SYNR |= SRCReq ;
-
- }
-}
-
-
-/********************************************************************************
-* Function Name : DMA_SetSReq
-* Description : Set the DMA to generate a Single transfer request for the corresponding DMA Request Source.
-* Input :
-* -SRCReq:specifies the DMA Request Source.
-* This parameter can be:
-* -DMA_USB_RX_Mask
-* -DMA_USB_TX_Mask
-* -DMA_TIM0_Mask
-* -DMA_TIM1_Mask
-* -DMA_UART0_RX_Mask
-* -DMA_UART0_TX_Mask
-* -DMA_UART1_RX_Mask
-* -DMA_UART1_TX_Mask
-* -DMA_External_Req0_Mask
-* -DMA_External_Req1_Mask
-* -DMA_I2C0_Mask
-* -DMA_I2C1_Mask
-* -DMA_SSP0_RX_Mask
-* -DMA_SSP0_TX_Mask
-* -DMA_SSP1_RX_Mask
-* -DMA_SSP1_TX_Mask
-*
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-
-void DMA_SetSReq(u16 SRCReq)
-
-{ /* Set the DMA to generate a Single transfer request for the corresponding DMA Request Source */
- DMA->SSRR |= SRCReq ;
-}
-
-
-
-
-/********************************************************************************
-* Function Name : DMA_SetLSReq
-* Description : Set the DMA to generate a Last Single transfer request for the corresponding DMA Request Source.
-* Input :
-* -SRCReq:specifies the DMA Request Source.
-* This parameter can be:
-* -DMA_USB_RX_Mask
-* -DMA_USB_TX_Mask
-* -DMA_TIM0_Mask
-* -DMA_TIM1_Mask
-* -DMA_UART0_RX_Mask
-* -DMA_UART0_TX_Mask
-* -DMA_UART1_RX_Mask
-* -DMA_UART1_TX_Mask
-* -DMA_External_Req0_Mask
-* -DMA_External_Req1_Mask
-* -DMA_I2C0_Mask
-* -DMA_I2C1_Mask
-* -DMA_SSP0_RX_Mask
-* -DMA_SSP0_TX_Mask
-* -DMA_SSP1_RX_Mask
-* -DMA_SSP1_TX_Mask
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-void DMA_SetLSReq(u16 SRCReq )
-{ /* Set the DMA to generate a Last Single transfer request for the corresponding DMA Request Source */
- DMA->SLSRR |= SRCReq ;
-}
-
-
-/********************************************************************************
-* Function Name : DMA_SetBReq
-* Description : Set the DMA to generate a Burst transfer request for the corresponding DMA Request Source.
-* Input :
-* -SRCReq:specifies the DMA Request Source.
-* This parameter can be:
-* -DMA_USB_RX_Mask
-* -DMA_USB_TX_Mask
-* -DMA_TIM0_Mask
-* -DMA_TIM1_Mask
-* -DMA_UART0_RX_Mask
-* -DMA_UART0_TX_Mask
-* -DMA_UART1_RX_Mask
-* -DMA_UART1_TX_Mask
-* -DMA_External_Req0_Mask
-* -DMA_External_Req1_Mask
-* -DMA_I2C0_Mask
-* -DMA_I2C1_Mask
-* -DMA_SSP0_RX_Mask
-* -DMA_SSP0_TX_Mask
-* -DMA_SSP1_RX_Mask
-* -DMA_SSP1_TX_Mask
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-
-void DMA_SetBReq(u16 SRCReq)
-
-{ /* Set the DMA to generate a Burst transfer request for the corresponding DMA Request Source */
- DMA->SBRR |= SRCReq ;
-}
-
-
-
-/********************************************************************************
-* Function Name : DMA_SetLBReq
-* Description : Set the DMA to generate a Last Burst transfer request for the corresponding DMA Request Source.
-* Input :
-* -SRCReq:specifies the DMA Request Source.
-* This parameter can be:
-* -DMA_USB_RX_Mask
-* -DMA_USB_TX_Mask
-* -DMA_TIM0_Mask
-* -DMA_TIM1_Mask
-* -DMA_UART0_RX_Mask
-* -DMA_UART0_TX_Mask
-* -DMA_UART1_RX_Mask
-* -DMA_UART1_TX_Mask
-* -DMA_External_Req0_Mask
-* -DMA_External_Req1_Mask
-* -DMA_I2C0_Mask
-* -DMA_I2C1_Mask
-* -DMA_SSP0_RX_Mask
-* -DMA_SSP0_TX_Mask
-* -DMA_SSP1_RX_Mask
-* -DMA_SSP1_TX_Mask
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-
-void DMA_SetLBReq(u16 SRCReq)
-
-{ /* Set the DMA to generate a Last Burst transfer request for the corresponding DMA Request Source */
- DMA->SLBRR |= SRCReq ;
-}
-
-
-/********************************************************************************
-* Function Name : DMA_GetSReq
-* Description : Check for a specific source if it request a Single transfer .
-* Input :
-* Input :
-* -SRCReq:specifies the DMA Request Source.
-* This parameter can be:
-* -DMA_USB_RX_Mask
-* -DMA_USB_TX_Mask
-* -DMA_TIM0_Mask
-* -DMA_TIM1_Mask
-* -DMA_UART0_RX_Mask
-* -DMA_UART0_TX_Mask
-* -DMA_UART1_RX_Mask
-* -DMA_UART1_TX_Mask
-* -DMA_External_Req0_Mask
-* -DMA_External_Req1_Mask
-* -DMA_I2C0_Mask
-* -DMA_I2C1_Mask
-* -DMA_SSP0_RX_Mask
-* -DMA_SSP0_TX_Mask
-* -DMA_SSP1_RX_Mask
-* -DMA_SSP1_TX_Mask
-* Output : None.
-* Return : SET or RESET.
-*******************************************************************************/
-
-
-FlagStatus DMA_GetSReq(u16 SRCReq)
-
-{ /* Check for a specific source if it request a Single transfer . */
- if ( (DMA->SSRR & SRCReq )!= RESET )
- {
- return SET;
- }
-
- else
- {
- return RESET;
- }
-}
-
-
-/********************************************************************************
-* Function Name : DMA_GetLSReq
-* Description : Check for a specific source if it request a Last Single transfer .
-* Input :
-* -SRCReq:specifies the DMA Request Source.
-* This parameter can be:
-* -DMA_USB_RX_Mask
-* -DMA_USB_TX_Mask
-* -DMA_TIM0_Mask
-* -DMA_TIM1_Mask
-* -DMA_UART0_RX_Mask
-* -DMA_UART0_TX_Mask
-* -DMA_UART1_RX_Mask
-* -DMA_UART1_TX_Mask
-* -DMA_External_Req0_Mask
-* -DMA_External_Req1_Mask
-* -DMA_I2C0_Mask
-* -DMA_I2C1_Mask
-* -DMA_SSP0_RX_Mask
-* -DMA_SSP0_TX_Mask
-* -DMA_SSP1_RX_Mask
-* -DMA_SSP1_TX_Mask
-* Output : None.
-* Return : SET or RESET.
-*******************************************************************************/
-
-
-FlagStatus DMA_GetLSReq(u16 SRCReq)
-
-{ /* Check for a specific source if it request a Last Single transfer . */
- if ( (DMA->SLSRR & SRCReq)!= RESET )
- {
- return SET;
- }
-
- else
- {
- return RESET;
- }
-}
-
-/********************************************************************************
-* Function Name : DMA_GetBReq
-* Description : Check for a specific source if it request a Burst transfer .
-* Input :
-* -SRCReq:specifies the DMA Request Source.
-* This parameter can be:
-* -DMA_USB_RX_Mask
-* -DMA_USB_TX_Mask
-* -DMA_TIM0_Mask
-* -DMA_TIM1_Mask
-* -DMA_UART0_RX_Mask
-* -DMA_UART0_TX_Mask
-* -DMA_UART1_RX_Mask
-* -DMA_UART1_TX_Mask
-* -DMA_External_Req0_Mask
-* -DMA_External_Req1_Mask
-* -DMA_I2C0_Mask
-* -DMA_I2C1_Mask
-* -DMA_SSP0_RX_Mask
-* -DMA_SSP0_TX_Mask
-* -DMA_SSP1_RX_Mask
-* -DMA_SSP1_TX_Mask
-* Output : None.
-* Return : SET or RESET.
-*******************************************************************************/
-
-
-FlagStatus DMA_GetBReq(u16 SRCReq)
-
-{ /* Check for a specific source if it request a Burst transfer . */
- if (( DMA->SBRR & SRCReq ) != RESET )
- {
- return SET;
- }
-
- else
- {
- return RESET;
- }
-}
-
-/********************************************************************************
-* Function Name : DMA_GetLSReq
-* Description : Check for a specific source if it request a Last Burst transfer .
-* Input :
-* Input :
-* - SRCReq:specifies the DMA Request Source.
-* This parameter can be:
-* -DMA_USB_RX_Mask
-* -DMA_USB_TX_Mask
-* -DMA_TIM0_Mask
-* -DMA_TIM1_Mask
-* -DMA_UART0_RX_Mask
-* -DMA_UART0_TX_Mask
-* -DMA_UART1_RX_Mask
-* -DMA_UART1_TX_Mask
-* -DMA_External_Req0_Mask
-* -DMA_External_Req1_Mask
-* -DMA_I2C0_Mask
-* -DMA_I2C1_Mask
-* -DMA_SSP0_RX_Mask
-* -DMA_SSP0_TX_Mask
-* -DMA_SSP1_RX_Mask
-* -DMA_SSP1_TX_Mask
-* Output : None.
-* Return : SET or RESET.
-*******************************************************************************/
-
-
-FlagStatus DMA_GetLBReq(u16 SRCReq)
-
-{ /* Check for a specific source if it request a Last Burst transfer . */
- if ( ( DMA->SLBRR & SRCReq ) != RESET )
- {
- return SET;
- }
-
- else
- {
- return RESET;
- }
-}
-
-
-
-/*******************************************************************************
-* Function Name : DMA_ChannelHalt
-* Description : Enables DMA requests or ignore extra source DMA requests for
- the specified channel.
-* Input :
- -DMA_Channelx: where x can be 0,1,2,3,4,5,6,or 7 to select the DMA Channel.
- -NewState: new state of the specified DMA_Channelx mask interrupt.
- This parameter can be: ENABLE or DISABLE.
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-
-void DMA_ChannelHalt(DMA_Channel_TypeDef * DMA_Channelx, FunctionalState NewState)
-
-{
- if (NewState==ENABLE) /* Enables DMA requests */
-
- {
- DMA_Channelx->CCNF |= DMA_HaltChannel ;
- }
-
- else /* Ignore extra source DMA request */
- {
- DMA_Channelx->CCNF &= ~ DMA_HaltChannel ;
- }
-}
-
-
-/*******************************************************************************
-* Function Name : DMA_ChannelLockTrsf
-* Description : Enables or disables the Locked Transfers Feature for the specified DMA_Channelx
-* Input :
-* -DMA_Channelx: where x can be 0,1,2,3,4,5,6,or 7 to select the DMA Channel.
-* -NewState: new state of the specified DMA_Channelx mask interrupt.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-
-void DMA_ChannelLockTrsf(DMA_Channel_TypeDef * DMA_Channelx, FunctionalState NewState)
-
-{
- if (NewState==ENABLE) /* Locked transfers enabled on channel x */
-
- {
- DMA_Channelx->CCNF |= DMA_LockChannel ;
- }
-
- else /* Locked transfers disabled on channel xt */
- {
- DMA_Channelx->CCNF &= ~ DMA_LockChannel;
- }
-}
-
-
-/*******************************************************************************
-* Function Name : DMA_ChannelCache
-* Description : Enables or disables the cacheability Feature for the specified DMA_Channelx
-* Input :
-* -DMA_Channelx: where x can be 0,1,2,3,4,5,6,or 7 to select the DMA Channel.
-* -NewState: new state of the specified DMA_Channelx mask interrupt.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-
-void DMA_ChannelCache (DMA_Channel_TypeDef * DMA_Channelx, FunctionalState NewState)
-
-{
- if (NewState==ENABLE) /* Cacheability Feature enabled on channelx */
-
- {
- DMA_Channelx->CC |= DMA_CacheChannel ;
- }
-
- else /* Cacheability Feature disabled on channelx */
- {
- DMA_Channelx->CC &= ~ DMA_CacheChannel ;
- }
-}
-
-
-/*******************************************************************************
-* Function Name : DMA_ChannelBuffering
-* Description : Enables or disables the Buffering Feature for the specified DMA_Channelx
-* Input :
-* -DMA_Channelx: where x can be 0,1,2,3,4,5,6,or 7 to select the DMA Channel.
-* -NewState: new state of the specified DMA_Channelx mask interrupt.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-
-void DMA_ChannelBuffering (DMA_Channel_TypeDef * DMA_Channelx, FunctionalState NewState)
-
-{
- if (NewState==ENABLE) /* Cacheability Feature enabled on channel x */
-
- {
- DMA_Channelx->CC |= DMA_BufferChannel ;
- }
-
- else /* Cacheability Feature disabled on channel xt */
- {
- DMA_Channelx->CC &= ~ DMA_BufferChannel ;
- }
-}
-
-/*******************************************************************************
-* Function Name : MA_ChannelProt0Mod
-* Description : Sets The User or Privileged mode for the specified DMA_Channelx
-* Input :
-* -DMA_Channelx: where x can be 0,1,2,3,4,5,6,or 7 to select the DMA Channel.
-* -Prot0Mode: Specifies the Privileged mode Or the User mode.
-* This parameter can be:
-* - DMA_PrevilegedMode
-* - DMA_UserMode
-*
-*
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-
-void DMA_ChannelProt0Mode (DMA_Channel_TypeDef * DMA_Channelx, u32 Prot0Mode)
-
-{
- if (Prot0Mode==DMA_PrevilegedMode) /* Privileged mode */
- {
- DMA_Channelx->CC |= DMA_PrevilegedMode ;
- }
-
- else /* User mode */
- {
- DMA_Channelx->CC &= DMA_UserMode ;
- }
-}
-
-
-
-
-
-/*******************************************************************************
-* Function Name : DMA_ChannelSRCIncConfig
-* Description : Enables or disables the Source address incrementation after each transfer for
-* the specified DMA_Channelx
-* Input :
-* -DMA_Channelx: where x can be 0,1,2,3,4,5,6,or 7 to select the DMA Channel.
-* -NewState: new state of the specified DMA_Channelx mask interrupt.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-
-void DMA_ChannelSRCIncConfig (DMA_Channel_TypeDef * DMA_Channelx, FunctionalState NewState)
-
-{
- if (NewState==ENABLE) /* The Source address is incremented after each transfer */
-
- {
- DMA_Channelx->CC |= DMA_ChannelSRCInc ;
- }
-
- else /* The Source address is not incremented after each Transfer */
- {
- DMA_Channelx->CC &= ~ DMA_ChannelSRCInc ;
- }
-}
-
-
-/*******************************************************************************
-* Function Name : DMA_ChannelDESIncConfig
-* Description : Enables or disables the Destination address incrementation after each transfer for
-* the specified DMA_Channelx
-* Input :
-* -DMA_Channelx: where x can be 0,1,2,3,4,5,6,or 7 to select the DMA Channel.
-* -NewState: new state of the specified DMA_Channelx mask interrupt.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-
-void DMA_ChannelDESIncConfig (DMA_Channel_TypeDef * DMA_Channelx, FunctionalState NewState)
-
-{
- if (NewState==ENABLE) /* The Destination address is incremented after each transfer */
-
- {
- DMA_Channelx->CC |= DMA_ChannelDESInc ;
- }
-
- else /* The Destination address is not incremented after each Transfer */
- {
- DMA_Channelx->CC &= ~ DMA_ChannelDESInc ;
- }
-}
-
-
-
-/********************************************************************************
-* Function Name : DMA_GetChannelStatus
-* Description : Checks the status of DMA channelx ( Enabled or Disabled).
-* - ChannelIndx:specifies the DMA Channel to be checked.
-* This parameter can be:
-* - Channel0
-* - Channel1
-* - Channel2
-* - Channel3
-* - Channel4
-* - Channel5
-* - Channel6
-* - Channel7
-* Output : None.
-*
-* Return : SET or RESET.
-*******************************************************************************/
-
-
-FlagStatus DMA_GetChannelStatus(u8 ChannelIndx )
-
-{
-
- if ( ( DMA->ENCSR & (1 << ChannelIndx )) != RESET )
- {
- return SET; /* Channelx Enabled */
- }
-
- else
-
- {
-
- return RESET; /* Channelx Disabled */
-
- }
-
-}
-
-
-
-/********************************************************************************
-* Function Name : DMA_GetITStatus
-* Description : Checks the status of Terminal Count and Error interrupts request after and before Masking.
-* Input :
-* - ChannelIndx:specifies the DMA Channel to be checked.
-* This parameter can be:
-* - Channel0
-* - Channel1
-* - Channel2
-* - Channel3
-* - Channel4
-* - Channel5
-* - Channel6
-* - Channel7
-*
-*. - DMA_ITReq: specifies the DMA interrupt request status to be checked.
-* This parameter can be:
-*
-* - DMA_IS
-* - DMA_TCS
-* - DMA_ES
-* - DMA_TCRS
-* - DMA_ERS.
-*
-* Output : None.
-*
-* Return : SET or RESET.
-*******************************************************************************/
-
-
-ITStatus DMA_GetITStatus(u8 ChannelIndx,u8 DMA_ITReq)
-
-{
- u32 DMAReg = 0;
-
- switch(DMA_ITReq)
-
- {
-
- case (DMA_IS): /*The status of the interrupts after masking : logical or of all Interrupts after Masking*/
- DMAReg = DMA->ISR;
- break;
-
-
-
- case (DMA_TCS): /* The status of the Terminal count request after masking */
- DMAReg = DMA->TCISR;
- break;
-
-
- case (DMA_ES): /* The status of the error request after masking */
- DMAReg = DMA->EISR;
- break;
-
-
- case (DMA_TCRS): /* Indicates if the DMA channel is requesting a transfer complete (terminal count Interrupt) prior to masking or Not. */
- DMAReg = DMA->TCRISR;
- break;
-
- case (DMA_ERS): /* Indicates if the DMA channel is requesting an Error Interrupt prior to masking or Not. */
- DMAReg = DMA->ERISR;
- break;
-
-
- }
-
- if((DMAReg &(1 << ChannelIndx )) != RESET )
-
- {
- return SET;
- }
-
- else
-
- {
-
- return RESET;
-
-
- }
-
-}
-
-
-/********************************************************************************
-* Function Name : DMA_ClearIT
-* Description : Clears The Interrupt pending bits for termnal count or Error interrupts for a specified DMA Channel.
-* - ChannelIndx:specifies the DMA Channel to be checked.
-* This parameter can be:
-* - Channel0
-* - Channel1
-* - Channel2
-* - Channel3
-* - Channel4
-* - Channel5
-* - Channel6
-* - Channel7
-* - DMA_ITClr : Specifies the DMA interrupt pending to be cleared.
-*. This parameter can be:
-* - DMA_TCC
-* - DMA_EC.
-*
-* Output : None.
-
-* Return : SET or RESET.
-*******************************************************************************/
-
-
-void DMA_ClearIT(u8 ChannelIndx,u8 DMA_ITClr)
-
-{
-
-
- switch(DMA_ITClr)
-
- {
-
- case (DMA_TCC): /* Clear The status of the Terminal count interrupt on the corresponding channel.*/
- DMA->TCICR |=(1 << ChannelIndx );
- break;
-
-
-
- case (DMA_EC): /* Clear The status of the error interrupt on the corresponding channel.*/
- DMA->EICR |=(1 << ChannelIndx );
- break;
-
-
-
- }
-
-
-
-}
-
-
-/*******************************************************************************
-* Function Name : DMA_Cmd(FunctionalState NewState)
-* Description : Enables or disables the DMA peripheral.
-*
-* Input :
-* -NewState: new state of the DMA.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-
-void DMA_Cmd(FunctionalState NewState)
-
-{
- if (NewState==ENABLE) /* ENABLE the DMA peripheral */
-
- {
- DMA-> CNFR |= DMA_Enable ;
- }
-
- else /* DISABLE the DMA peripheral */
- {
- DMA-> CNFR &= ~ DMA_Enable ;
- }
-}
-
-
-
-/*******************************************************************************
-* Function Name : DMA_ChannelCmd
-* Description : Enables or disables the specified DMA_Channelx
-*
-* Input :
-* -DMA_Channelx: where x can be 0,1,2,3,4,5,6,or 7 to select the DMA Channel.
-* -NewState: new state of the specified DMA_Channelx mask interrupt.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-
-void DMA_ChannelCmd (DMA_Channel_TypeDef *DMA_Channelx,FunctionalState NewState)
-
-{
- if (NewState==ENABLE) /* Enable The Channelx */
-
- {
- DMA_Channelx->CCNF |= DMA_ChannelEnable ;
- }
-
- else /* Disable The Channelx */
- {
- DMA_Channelx-> CCNF &= ~ DMA_ChannelEnable ;
- }
-}
-
-
-
-/********************************************************************************
-* Function Name : DMA_GetChannelActiveStatus
-* Description : Checks The DMA_Channelx FIFO if it has data or not.
-* Input :
-* -DMA_Channelx: where x can be 0,1,2,3,4,5,6,or 7 to select the DMA Channel.
-*
-*
-* Output : None.
-*
-* Return : SET or RESET.
-*******************************************************************************/
-
-
-FlagStatus DMA_GetChannelActiveStatus( DMA_Channel_TypeDef * DMA_Channelx )
-
-{
-
- if ( ( DMA_Channelx->CCNF & DMA_ChannelActive) != RESET )
- {
- return SET; /* The DMA_Channelx FIFO has data */
- }
-
- else
-
- {
-
- return RESET; /* No data in the DMA_Channelx FIFO */
-
-
- }
-
-}
-
-
-/********************************************************************************
-* Function Name : DMA_DeInit
-* Description : Initializes the DMA peripheral registers to their default reset values.
-*
-*
-* Input : None
-*
-* Output : None.
-*
-* Called Functions:
-*
-* - SCU_AHBPeriphReset: Function defined in the System clock Unit "scu.c".
-*
-*
-* Return : None
-*******************************************************************************/
-
-
-void DMA_DeInit(void)
-
-{
-
- SCU_AHBPeriphReset(__DMA, ENABLE); /*DMA peripheral is under Reset " Reset on"*/
- SCU_AHBPeriphReset(__DMA, DISABLE); /*DMA peripheral Reset off*/
-}
-
-
-
-/********************************************************************************
-* Function Name : DMA_StructInit
-* Description : Fills each DMA_InitStruct member with its reset value.
-* Input :
-* -DMA_InitStruct: pointer to a DMA_InitTypeDef structure which will be initialized.
-*
-* Output : None.
-*
-* Return : None
-*******************************************************************************/
-
-
-void DMA_StructInit(DMA_InitTypeDef * DMA_InitStruct)
-
-{
-
- /* Initialize The current source address */
- DMA_InitStruct-> DMA_Channel_SrcAdd =0x0000000;
-
-
- /* Initialize The current Destination address */
- DMA_InitStruct->DMA_Channel_DesAdd=0x00000000;
-
-
-
- /* Initialize The Linked List Items */
- DMA_InitStruct->DMA_Channel_LLstItm=0x00000000 ;
-
-
-
- /* Initialize The Destination width */
- DMA_InitStruct->DMA_Channel_DesWidth= DMA_DesWidth_Byte;
-
-
-
- /* Initialize The source width */
- DMA_InitStruct->DMA_Channel_SrcWidth= DMA_SrcWidth_Byte;
-
-
- /* Initialize The Burst Size for the Destination */
- DMA_InitStruct->DMA_Channel_DesBstSize= DMA_DesBst_1Data; /* 1 Data "one Data can be byte, halfword or word depending on the Destination width */
-
-
-
- /* Initialize The Burst Size for the Source*/
- DMA_InitStruct->DMA_Channel_SrcBstSize= DMA_SrcBst_1Data; /* 1 Data "one Data can be byte, halfword or word depending on the source width */
-
- /* Initialize The Flow control and transfer type for the DMA transfer */
- DMA_InitStruct->DMA_Channel_FlowCntrl=DMA_FlowCntrlt0_DMA; /* memory to memory transfer with DMA as flow controller */
-
-
- /* Initialize The Transfer Size */
- DMA_InitStruct->DMA_Channel_TrsfSize =0x00;
-
-
-
- /* Initialize the DMA source request peripheral :"This field is ignored if the source of the transfer is from memory" */
- DMA_InitStruct->DMA_Channel_Src =0x00;
-
-
-
- /* Initialize the DMA Destination request peripheral :"This field is ignored if the destination of the transfer is to memory.*/
-
- DMA_InitStruct->DMA_Channel_Des=0x00;
-
-
-}
-
-
-
-
-/********************************************************************************
-* Function Name : DMA_Init
-* Description : Initializes the DMA_Channelx according to the specified parameters
-* in the DMA_InitStruct .
-*
-* Input :
-* -DMA_Channelx: where x can be 0,1,2,3,4,5,6,or 7 to select the DMA Channel.
-* -DMA_InitStruct: pointer to a DMA_InitTypeDef structure
-* ( Structure Config to be load in DMA Registers). .
-*
-* Output : None.
-*
-* Return : None
-*******************************************************************************/
-
-
-void DMA_Init(DMA_Channel_TypeDef * DMA_Channelx, DMA_InitTypeDef * DMA_InitStruct)
-
-{
-
-
-
- /* Select the DMA source peripheral request */
- DMA_Channelx->CCNF &= SRC_Mask;
- DMA_Channelx->CCNF |= DMA_InitStruct->DMA_Channel_Src;
-
-
- /* Select the flow controller and the transfer type */
- DMA_Channelx->CCNF &= DMA_FlowCntrl_Mask;
- DMA_Channelx->CCNF |=DMA_InitStruct->DMA_Channel_FlowCntrl;
-
-
- /* Select the DMA Destination peripheral request*/
- DMA_Channelx->CCNF &= DES_Mask;
- DMA_Channelx->CCNF |= DMA_InitStruct->DMA_Channel_Des;
-
- /* Set the source address */
- DMA_Channelx->SRC = DMA_InitStruct-> DMA_Channel_SrcAdd ;
-
-
- /* Set the destination address */
-
- DMA_Channelx->DES = DMA_InitStruct->DMA_Channel_DesAdd ;
-
-
-
- /* Set the linked list Items address */
- DMA_Channelx->LLI = DMA_InitStruct->DMA_Channel_LLstItm ;
-
-
- /* Set The Destination width */
- DMA_Channelx->CC &= DMA_Width_DES_MASK;
- DMA_Channelx->CC |= DMA_InitStruct->DMA_Channel_DesWidth;
-
-
- /* Set The Source width */
- DMA_Channelx->CC &= DMA_Width_SRC_MASK;
- DMA_Channelx->CC |= DMA_InitStruct->DMA_Channel_SrcWidth;
-
- /* Set The Burst Size for the Destination */
- DMA_Channelx->CC &= DMA_Bst_DES_MASK;
- DMA_Channelx->CC |= DMA_InitStruct->DMA_Channel_DesBstSize;
-
- /* Set The Burst Size for the Source */
- DMA_Channelx->CC &= DMA_Bst_SRC_MASK;
- DMA_Channelx->CC |=DMA_InitStruct->DMA_Channel_SrcBstSize;
-
-
- /* Initialize The Transfer Size for the Source */
- DMA_Channelx->CC &= DMA_TrsfSisze_Mask;
- DMA_Channelx->CC |= DMA_InitStruct->DMA_Channel_TrsfSize;
-
-
-}
-
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_complex_startup/src/91x_emi.c b/uc_str912/prj_blinky_complex_startup/src/91x_emi.c
deleted file mode 100644
index deadae8..0000000
--- a/uc_str912/prj_blinky_complex_startup/src/91x_emi.c
+++ /dev/null
@@ -1,167 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_emi.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the EMI software functions.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_emi.h"
-#include "91x_scu.h"
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-
-/* These constant variables are used as masks to handle the EMI registers. */
-
-#define EMI_PageModeRead_TL_Mask 0xFFFFF3FF
-#define EMI_PageModeRead_Sel_Mask 0xFFFFFEFF
-#define EMI_MemWidth_Mask 0xFFFFFFCF
-#define EMI_WriteProtect_Mask 0xFFFFFEF7
-
-
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Registers reset value */
-/* Private function prototypes -----------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-
-/******************************************************************************
-* Function Name : EMI_DeInit
-* Description : Deinitializes the EMI peripheral registers to their default
-* reset values.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-
-void EMI_DeInit(void)
-{
-
- SCU_AHBPeriphReset(__EMI, ENABLE); /* EMI peripheral under Reset */
- SCU_AHBPeriphReset(__EMI,DISABLE ); /* EMI not under Reset */
-
-}
-
-/*******************************************************************************
-* Function Name : EMI_StructInit
-* Description : Fills the EMI_InitTypeDef structure member with its reset
-* value.
-* Input : EMI_InitStruct : pointer to a EMI_InitTypeDef structure
-* which will be initialized.
-* Output : None
-* Return : None
-*******************************************************************************/
-
-void EMI_StructInit( EMI_InitTypeDef *EMI_InitStruct)
-{
-
- /* Number of bus turnaround cycles added between read and write accesses.*/
- /*This member can be 0x01,0x02,0x03, ....0xF (Reset value:0xF "15 cycles"*/
-
- EMI_InitStruct->EMI_Bank_IDCY =0xF;
-
-
- /* Number of wait states for read accesses*/
- /*This member can be: 0x01,0x02,0x03, ....0x1F (Reset value:0x1F "31 cycles"*/
-
- EMI_InitStruct->EMI_Bank_WSTRD =0x1F;
-
-
- /* Number of wait states for write accesses*/
- /*This member can be: 0x01,0x02,0x03, ....0x1F (Reset value:0x1F "31 cycles"*/
-
- EMI_InitStruct->EMI_Bank_WSTWR =0x1F;
-
- /*Output enable assertion delay from chip select assertion*/
- /*This member can be: 0x01,0x02,0x03, ....0xF (Reset value:0x01 "1 cycle"*/
-
- EMI_InitStruct->EMI_Bank_WSTROEN =0x01;
-
-
- /*Write enable assertion delay from chip select assertion*/
- /*This member can be: 0x01,0x02,0x03, ....0xF (Reset value:0x00 "0 cycle"*/
-
- EMI_InitStruct->EMI_Bank_WSTWEN =0x00;
-
-
- /*This member Controls the memory width*/
- /*This member can be :"EMI_Width_Byte" = 8 bits width or "EMI_Width_HalfWord" = 16 bits width*/
-
- EMI_InitStruct->EMI_Bank_MemWidth = EMI_Width_Byte;
-
-
- /*Write protection feature */
- /*This member can be :"EMI_Bank_NonWriteProtect" = No write protection or "EMI_Bank_WriteProtect" = bank is write protected*/
-
- EMI_InitStruct-> EMI_Bank_WriteProtection= EMI_Bank_NonWriteProtect;
-
-
- /* page transfer length for page mode read */
- /*This member can be :"EMI_4Data" = 4 transfers burst or "EMI_8Data" = 8 transfers burst*/
-
- EMI_InitStruct->EMI_PageModeRead_TransferLength= EMI_4Data;
-
- /*Select or deselect the page mode read*/
- /*This member can be :"EMI_NormalMode" =Normal Mode or "EMI_PageModeRead" = Page Mode Read*/
-
- EMI_InitStruct->EMI_PageModeRead_Selection = EMI_NormalMode;
-
-
-}
-
-/*******************************************************************************
-* Function Name : EMI_Init
-* Description : Initializes EMI peripheral according to the specified
-* parameters in the EMI_InitStruct.
-
-* Input : EMI_Bankx:where x can be 0,1,2 or 3 to select the EMI Bank.
- EMI_InitStruct: pointer to a EMI_InitTypeDef structure
- ( Structure Config to be loaded in EMI Registers). .
-
-* Output : None
-* Return : None
-*******************************************************************************/
-
-void EMI_Init( EMI_Bank_TypeDef* EMI_Bankx, EMI_InitTypeDef* EMI_InitStruct)
-
-{
-
- EMI_Bankx->ICR = EMI_InitStruct-> EMI_Bank_IDCY ;
-
- EMI_Bankx->RCR = EMI_InitStruct->EMI_Bank_WSTRD ;
-
- EMI_Bankx->WCR = EMI_InitStruct->EMI_Bank_WSTWR ;
-
- EMI_Bankx->OECR = EMI_InitStruct->EMI_Bank_WSTROEN;
-
- EMI_Bankx->WECR = EMI_InitStruct->EMI_Bank_WSTWEN ;
-
- EMI_Bankx->BCR &= EMI_MemWidth_Mask;
- EMI_Bankx->BCR |= EMI_InitStruct->EMI_Bank_MemWidth;
-
- EMI_Bankx->BCR &= EMI_WriteProtect_Mask;
- EMI_Bankx->BCR |= EMI_InitStruct->EMI_Bank_WriteProtection;
-
- EMI_Bankx->BCR &= EMI_PageModeRead_TL_Mask;
- EMI_Bankx->BCR |= EMI_InitStruct->EMI_PageModeRead_TransferLength;
-
- EMI_Bankx->BCR &= EMI_PageModeRead_Sel_Mask;
- EMI_Bankx->BCR |= EMI_InitStruct->EMI_PageModeRead_Selection;
-
-
-}
-
-
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_complex_startup/src/91x_fmi.c b/uc_str912/prj_blinky_complex_startup/src/91x_fmi.c
deleted file mode 100644
index fb558ad..0000000
--- a/uc_str912/prj_blinky_complex_startup/src/91x_fmi.c
+++ /dev/null
@@ -1,519 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_fmi.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the FMI software functions.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-
-/* Standard include ----------------------------------------------------------*/
-#include "91x_fmi.h"
-
-/* Include of other module interface headers ---------------------------------*/
-/* Local includes ------------------------------------------------------------*/
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-
-#define TIMEOUT 0xFFFFFF /* Timeout value */
-
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/* Interface functions -------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-
-
-/*******************************************************************************
-* Function Name : FMI_BankRemapConfig
-* Description : Configure the addresses and sizes of bank 0 and bank 1.
-* Input1 : FMI_BootBankSize: specifies the boot bank size.
-* This parameter can be one of the following values:
-* - 0x0: 32KBytes.
-* - 0x1: 64KBytes.
-* - 0x2: 128KBytes.
-* - 0x3: 256KBytes.
-* - 0x4: 512KBytes.
-* ....
-* - 0xB: 64MBytes.
-* Input2 : FMI_NonBootBankSize: specifies the non boot bank size.
-* This parameter can be one of the following values:
-* - 0x0: 8KBytes.
-* - 0x1: 16KBytes.
-* - 0x2: 32KBytes.
-* - 0x3: 64KBytes.
-* ....
-* - 0xD: 64MBytes.
-* Input3 : FMI_BootBankAddress: specifies the address of the boot bank.
-* Input4 : FMI_NonBootBankAddress: specifies the address of the non
-* boot bank.
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_BankRemapConfig(u8 FMI_BootBankSize, u8 FMI_NonBootBankSize, \
- u32 FMI_BootBankAddress, u32 FMI_NonBootBankAddress)
-{
- FMI->BBSR = FMI_BootBankSize;
- FMI->NBBSR = FMI_NonBootBankSize;
- FMI->BBADR = (FMI_BootBankAddress >> 2);
- FMI->NBBADR = (FMI_NonBootBankAddress >> 2);
- FMI->CR |= 0x18; /* Enable bank 1 */
-}
-
-/*******************************************************************************
-* Function Name : FMI_Config
-* Description : Configure the FMI.
-* Input1 : FMI_ReadWaitState: specifies the needed read wait states.
-* This parameter can be one of the following values:
-* - FMI_READ_WAIT_STATE_1: One read wait state.
-* - FMI_READ_WAIT_STATE_2: Two read wait states.
-* - FMI_READ_WAIT_STATE_3: Three read wait states.
-* Input2 : FMI_WriteWaitState: specifies the needed write wait states.
-* This parameter can be one of the following values:
-* - FMI_WRITE_WAIT_STATE_1: One write wait state.
-* - FMI_WRITE_WAIT_STATE_2: Two write wait states.
-* Input3 : FMI_PWD: specifies the power down mode status.
-* This parameter can be one of the following values:
-* - FMI_PWD_ENABLE: Enable the PWD.
-* - FMI_PWD_DISABLE: Disable the PWD.
-* Input4 : FMI_LVDEN: specifies the low voltage detector status.
-* This parameter can be one of the following values:
-* - FMI_LVD_ENABLE: Enable the LVD.
-* - FMI_LVD_DISABLE: Disable the LVD.
-* Input5 : FMI_FreqRange: specifies the working frequency range.
-* This parameter can be one of the following values:
-* - FMI_FREQ_LOW: Low working frequency (up to 66MHz).
-* - FMI_FREQ_HIGH: High working frequency (above 66MHz) .
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_Config(u16 FMI_ReadWaitState, u32 FMI_WriteWaitState, u16 FMI_PWD,\
- u16 FMI_LVDEN, u16 FMI_FreqRange)
-{
- /* Configure the write wait state value */
- if (FMI_WriteWaitState == FMI_WRITE_WAIT_STATE_1)
- {
- FMI->CR |= FMI_WRITE_WAIT_STATE_1;
- }
- else
- {
- FMI->CR &= FMI_WRITE_WAIT_STATE_0;
- }
-
- /* Write a write flash configuration register command */
- *(vu16 *)FMI_BANK_1 = 0x60;
-
- /* Configure the flash configuration register */
- *(vu16 *)(FMI_BANK_1|FMI_ReadWaitState|FMI_PWD|FMI_LVDEN|FMI_FreqRange) = 0x03;
-}
-
-/*******************************************************************************
-* Function Name : FMI_EraseSector
-* Description : Erase the needed sector.
-* Input : FMI_Sector: specifies the sector to be erased.
-* This parameter can be one of the following values:
-* - FMI_B0S0: FMI bank 0 sector 0.
-* - FMI_B0S1: FMI bank 0 sector 1.
-* - FMI_B0S2: FMI bank 0 sector 2.
-* - FMI_B0S3: FMI bank 0 sector 3.
-* - FMI_B0S4: FMI bank 0 sector 4.
-* - FMI_B0S5: FMI bank 0 sector 5.
-* - FMI_B0S6: FMI bank 0 sector 6.
-* - FMI_B0S7: FMI bank 0 sector 7.
-* - FMI_B1S0: FMI bank 1 sector 0.
-* - FMI_B1S1: FMI bank 1 sector 1.
-* - FMI_B1S2: FMI bank 1 sector 2.
-* - FMI_B1S3: FMI bank 1 sector 3.
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_EraseSector(vu32 FMI_Sector)
-{
- /* Write an erase set-up command to the sector */
- *(vu16 *)FMI_Sector = 0x20;
-
- /* Write an erase confirm command to the sector */
- *(vu16 *)FMI_Sector = 0xD0;
-}
-
-/*******************************************************************************
-* Function Name : FMI_EraseBank
-* Description : Erase the needed bank.
-* Input : FMI_Bank: specifies the bank to be erased.
-* This parameter can be one of the following values:
-* - FMI_BANK_0: FMI bank 0.
-* - FMI_BANK_1: FMI bank 1.
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_EraseBank(vu32 FMI_Bank)
-{
- /* Write a bank erase set-up command to the bank */
- *(vu16 *)FMI_Bank = 0x80;
-
- /* Write an erase confirm command to the sector */
- *(vu16 *)FMI_Bank = 0xD0;
-}
-
-/*******************************************************************************
-* Function Name : FMI_WriteHalfWord
-* Description : Write a halfword to the needed Flash memory address.
-* Input 1 : FMI_Address: specifies the address offset where the data will
-* be written.
-* Input 2 : FMI_Data: the needed data.
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_WriteHalfWord(u32 FMI_Address, u16 FMI_Data)
-{
- /* Write a program command to the sector to be written */
- *(vu16 *)(FMI_Address & 0xFFFFFFFC) = 0x40;
-
- /* Write the halfword to the destination address */
- *(vu16 *)FMI_Address = FMI_Data;
-}
-
-/*******************************************************************************
-* Function Name : FMI_WriteOTPHalfWord
-* Description : Write a halfword to the needed OTP sector address.
-* Input 1 : FMI_OTPHWAddress: specifies the halfword address offset
-* where the data will be written.
-* This parameter can be one of the following values:
-* - FMI_OTP_LOW_HALFWORD_0: OTP Low halfword 0.
-* - FMI_OTP_HIGH_HALFWORD_0: OTP High halfword 0.
-* - FMI_OTP_LOW_HALFWORD_1: OTP Low halfword 1.
-* - FMI_OTP_HIGH_HALFWORD_1: OTP High halfword 1.
-* - FMI_OTP_LOW_HALFWORD_2: OTP Low halfword 2.
-* - FMI_OTP_HIGH_HALFWORD_2: OTP High halfword 2.
-* - FMI_OTP_LOW_HALFWORD_3: OTP Low halfword 3.
-* - FMI_OTP_HIGH_HALFWORD_3: OTP High halfword 3.
-* - FMI_OTP_LOW_HALFWORD_4: OTP Low halfword 4.
-* - FMI_OTP_HIGH_HALFWORD_4: OTP High halfword 4.
-* - FMI_OTP_LOW_HALFWORD_5: OTP Low halfword 5.
-* - FMI_OTP_HIGH_HALFWORD_5: OTP High halfword 5.
-* - FMI_OTP_LOW_HALFWORD_6: OTP Low halfword 6.
-* - FMI_OTP_HIGH_HALFWORD_6: OTP High halfword 6.
-* - FMI_OTP_LOW_HALFWORD_7: OTP Low halfword 7.
-* - FMI_OTP_HIGH_HALFWORD_7: OTP High halfword 7.
-* Input 2 : FMI_OTPData: The needed OTP data.
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_WriteOTPHalfWord(u8 FMI_OTPHWAddress, u16 FMI_OTPData)
-{
- /* Write a write OTP command to the needed address */
- *(vu16 *)(FMI_BANK_1) = 0xC0;
-
- /* Write the halfword to the destination address */
- *(vu16 *)(FMI_BANK_1 + FMI_OTPHWAddress) = FMI_OTPData;
-}
-
-/*******************************************************************************
-* Function Name : FMI_ReadWord
-* Description : Read the correspondent data.
-* Input : FMI_Address: specifies the needed address.
-* Output : None
-* Return : The data contained in the specified address.
-*******************************************************************************/
-u32 FMI_ReadWord(u32 FMI_Address)
-{
- return(*(u32*)FMI_Address);
-}
-
-/*******************************************************************************
-* Function Name : FMI_ReadOTPData
-* Description : Read data from the OTP sector.
-* Input : FMI_OTPAddress: specifies the address of the data to be read.
-* This parameter can be one of the following values:
-* - FMI_OTP_WORD_0: FMI bank 0 sector 0.
-* - FMI_OTP_WORD_1: FMI bank 0 sector 1.
-* - FMI_OTP_WORD_2: FMI bank 0 sector 2.
-* - FMI_OTP_WORD_3: FMI bank 0 sector 3.
-* - FMI_OTP_WORD_4: FMI bank 0 sector 4.
-* - FMI_OTP_WORD_5: FMI bank 0 sector 5.
-* - FMI_OTP_WORD_6: FMI bank 0 sector 6.
-* - FMI_OTP_WORD_7: FMI bank 0 sector 7.
-* Output : None
-* Return : The needed OTP words.
-*******************************************************************************/
-u32 FMI_ReadOTPData(u8 FMI_OTPAddress)
-{
- u32 OTP_Data = 0x0;
- /* write a read OTP sector command */
- *(vu16 *)(FMI_BANK_1) = 0x98;
-
- /* Read the correspondent data */
- OTP_Data = (*(vu32*)(FMI_BANK_1 + FMI_OTPAddress));
-
- /* Write a read array command */
- *(vu16 *)(FMI_BANK_1) = 0xFF;
-
- return OTP_Data;
-}
-
-/*******************************************************************************
-* Function Name : FMI_GetFlagStatus
-* Description : Check whether the specified FMI flag is set or not.
-* Input1 : FMI_Flag: flag to check.
-* This parameter can be one of the following values:
-* - FMI_FLAG_SPS: Sector Protection Status Flag.
-* - FMI_FLAG_PSS: Program Suspend Status Flag.
-* - FMI_FLAG_PS: Program Status Flag.
-* - FMI_FLAG_ES: Erase Status Flag.
-* - FMI_FLAG_ESS: Erase Suspend Status Flag.
-* - FMI_FLAG_PECS: FPEC Status Flag.
-* Input2 : FMI_Bank: specifies the needed bank.
-* This parameter can be one of the following values:
-* - FMI_BANK_0: FMI bank 0.
-* - FMI_BANK_1: FMI bank 1.
-* Output : None
-* Return : None
-*******************************************************************************/
-FlagStatus FMI_GetFlagStatus(u8 FMI_Flag, vu32 FMI_Bank)
-{
- u16 FMI_Status_Register = 0;
-
- /* Write a read status register command */
- *(vu16 *)FMI_Bank = 0x70;
-
- /* Wait until operation completion */
- while(!((*(vu16 *)FMI_Bank) & 0x80));
-
- /* Read the status register */
- FMI_Status_Register = *(vu16 *)FMI_Bank;
-
- /* Write a read array command */
- *(vu16 *)FMI_Bank = 0xFF;
-
- if((FMI_Status_Register & FMI_Flag) != RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : FMI_GetReadWaitStateValue
-* Description : Get the current Read wait state value.
-* Input : None
-* Output : None
-* Return : The current read wait states value.
-*******************************************************************************/
-u16 FMI_GetReadWaitStateValue(void)
-{
- u16 FMI_Configuration_Register = 0;
- /* Write a read flash configuration register command */
- *(vu16 *)FMI_BANK_1 = 0x90;
-
- /* Read the flash configuration register */
- FMI_Configuration_Register = *(vu16 *)(FMI_BANK_1 + 0x14);
-
- /* Write a read array command */
- *(vu16 *)FMI_BANK_1 = 0xFF;
-
- FMI_Configuration_Register = ((FMI_Configuration_Register>>11) + 1) & 0x3;
-
- /* Return the wait states value */
- return FMI_Configuration_Register;
-}
-
-/*******************************************************************************
-* Function Name : FMI_GetWriteWaitStateValue
-* Description : Get the current write wait state value.
-* Input : None
-* Output : None
-* Return : The current write wait states value.
-*******************************************************************************/
-u16 FMI_GetWriteWaitStateValue(void)
-{
- return ((u16)((FMI->CR & 0x100) >> 8));
-}
-
-/*******************************************************************************
-* Function Name : FMI_SuspendEnable
-* Description : Suspend command enable.
-* Input : FMI_Bank: specifies the bank to be suspended.
-* This parameter can be one of the following values:
-* - FMI_BANK_0: FMI bank 0.
-* - FMI_BANK_1: FMI bank 1.
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_SuspendEnable(vu32 FMI_Bank)
-{
- /* Write a suspend command to the bank */
- *(vu16 *)FMI_Bank = 0xB0;
-}
-
-/*******************************************************************************
-* Function Name : FMI_ResumeEnable
-* Description : Resume the suspended command.
-* Input : FMI_Bank: specifies the suspended bank.
-* This parameter can be one of the following values:
-* - FMI_BANK_0: FMI bank 0.
-* - FMI_BANK_1: FMI bank 1.
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_ResumeEnable(vu32 FMI_Bank)
-{
- /* Write a resume command to the bank */
- *(vu16 *)FMI_Bank = 0xD0;
-}
-
-/*******************************************************************************
-* Function Name : FMI_ClearFlag
-* Description : Clear the FMI Flags on the correspondent bank.
-* Input : FMI_Bank: specifies the needed bank.
-* This parameter can be one of the following values:
-* - FMI_BANK_0: FMI bank 0.
-* - FMI_BANK_1: FMI bank 1.
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_ClearFlag(vu32 FMI_Bank)
-{
- /* Write a clear status register command */
- *(vu16 *)FMI_Bank = 0x50;
-}
-
-/*******************************************************************************
-* Function Name : FMI_WriteProtectionCmd
-* Description : Enable or disable the write protection for the needed sector.
-* Input1 : FMI_Sector: specifies the sector to be protected or
-* unprotected.
-* This parameter can be one of the following values:
-* - FMI_B0S0: FMI bank 0 sector 0.
-* - FMI_B0S1: FMI bank 0 sector 1.
-* - FMI_B0S2: FMI bank 0 sector 2.
-* - FMI_B0S3: FMI bank 0 sector 3.
-* - FMI_B0S4: FMI bank 0 sector 4.
-* - FMI_B0S5: FMI bank 0 sector 5.
-* - FMI_B0S6: FMI bank 0 sector 6.
-* - FMI_B0S7: FMI bank 0 sector 7.
-* - FMI_B1S0: FMI bank 1 sector 0.
-* - FMI_B1S1: FMI bank 1 sector 1.
-* - FMI_B1S2: FMI bank 1 sector 2.
-* - FMI_B1S3: FMI bank 1 sector 3.
-* Input2 : FMI_NewState: specifies the protection status.
-* This parameter can be one of the following values:
-* - ENABLE: Enable the protection.
-* - DISABLE: Disable the protection.
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_WriteProtectionCmd(vu32 FMI_Sector, FunctionalState FMI_NewState)
-{
- if (FMI_NewState == ENABLE)
- {
- *(vu16*)FMI_Sector = 0x60;
- *(vu16*)FMI_Sector = 0x01;
- *(vu16*)FMI_Sector = 0xFF;
- }
- else /* DISABLE */
- {
- *(vu16*)FMI_Sector = 0x60;
- *(vu16*)FMI_Sector = 0xD0;
- *(vu16*)FMI_Sector = 0xFF;
- }
-}
-
-/*******************************************************************************
-* Function Name : FMI_GetWriteProtectionStatus
-* Description : Get the write protection status for the needed sector.
-* Input : FMI_Sector_Mask: specifies the needed sector mask.
-* This parameter can be one of the following values:
-* - FMI_B0S0_MASK: FMI bank 0 sector 0.
-* - FMI_B0S1_MASK: FMI bank 0 sector 1.
-* - FMI_B0S2_MASK: FMI bank 0 sector 2.
-* - FMI_B0S3_MASK: FMI bank 0 sector 3.
-* - FMI_B0S4_MASK: FMI bank 0 sector 4.
-* - FMI_B0S5_MASK: FMI bank 0 sector 5.
-* - FMI_B0S6_MASK: FMI bank 0 sector 6.
-* - FMI_B0S7_MASK: FMI bank 0 sector 7.
-* - FMI_B1S0_MASK: FMI bank 1 sector 0.
-* - FMI_B1S1_MASK: FMI bank 1 sector 1.
-* - FMI_B1S2_MASK: FMI bank 1 sector 2.
-* - FMI_B1S3_MASK: FMI bank 1 sector 3.
-* Output : None
-* Return : The Protection Status of the needed sector.
-* - RESET: The needed sector is not write protected.
-* - SET : The needed sector is write protected.
-*******************************************************************************/
-FlagStatus FMI_GetWriteProtectionStatus(u32 FMI_Sector_Mask)
-{
- u16 Protection_Level_1_Register = 0;
- /* Write a read flash protection level 1 register command */
- *(vu16 *)FMI_BANK_1 = 0x90;
-
- /* Read the flash protection level 1 register */
- Protection_Level_1_Register = *(vu16 *)(FMI_BANK_1 + 0x10);
-
- /* Write a read array command */
- *(vu16 *)FMI_BANK_1 = 0xFF;
-
- if (Protection_Level_1_Register &= FMI_Sector_Mask)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : FMI_WaitForLastOperation
-* Description : Wait until the last operation (Write halfword, Write OTP
-* halfword, Erase sector and Erase bank) completion.
-* Input : FMI_Bank: specifies the bank where the operation is on going.
-* This parameter can be one of the following values:
-* - FMI_BANK_0: FMI bank 0.
-* - FMI_BANK_1: FMI bank 1.
-* Output : None
-* Return : The timeout status.
-* This parameter can be one of the following values:
-* - FMI_TIME_OUT_ERROR: Timeout error occurred.
-* - FMI_NO_TIME_OUT_ERROR: No timeout error.
-*******************************************************************************/
-u8 FMI_WaitForLastOperation(vu32 FMI_Bank)
-{
- u32 Time_Out = 0;
-
- /* Write a read status register command */
- *(vu16 *)(FMI_Bank) = 0x70;
-
- /* Wait until operation compeletion */
- while((!((*(vu16 *)FMI_Bank) & 0x80))&&(Time_Out < TIMEOUT ))
- {
- Time_Out ++; /* Time Out */
- }
-
- /* Write a read array command */
- *(vu16 *)FMI_Bank = 0xFF;
-
- if (Time_Out == TIMEOUT)
- {
- return FMI_TIME_OUT_ERROR;
- }
- else
- {
- return FMI_NO_TIME_OUT_ERROR;
- }
-}
-
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_complex_startup/src/91x_gpio.c b/uc_str912/prj_blinky_complex_startup/src/91x_gpio.c
deleted file mode 100644
index f2d0941..0000000
--- a/uc_str912/prj_blinky_complex_startup/src/91x_gpio.c
+++ /dev/null
@@ -1,407 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_gpio.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the GPIO software functions.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_gpio.h"
-#include "91x_scu.h"
-
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
- static u8 GPIO_GetGPIONumber(GPIO_TypeDef* GPIOx);
-
-/* Private functions ---------------------------------------------------------*/
-
-/*******************************************************************************
-* Function Name : GPIO_DeInit
-* Description : Deinitializes the GPIOx peripheral registers to their default
-* reset values.
-* Input : GPIOx: where x can be (0..9) to select the GPIO peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void GPIO_DeInit(GPIO_TypeDef* GPIOx)
-{
-
- /* Reset the GPIO registers values */
- if(GPIOx == GPIO0)
- {
- SCU_APBPeriphReset(__GPIO0,ENABLE);
- SCU_APBPeriphReset(__GPIO0,DISABLE);
- SCU->GPIOTYPE[0x00] = 0x0000 ;
- SCU->GPIOOUT[0x00] = 0x0000;
- SCU->GPIOIN[0x00] = 0x0000;
- }
-
- if(GPIOx == GPIO1)
- {
- SCU_APBPeriphReset(__GPIO1,ENABLE);
- SCU_APBPeriphReset(__GPIO1,DISABLE);
- SCU->GPIOTYPE[0x01] = 0x0000 ;
- SCU->GPIOOUT[0x01] = 0x0000;
- SCU->GPIOIN[0x01] = 0x0000;
- }
-
- if(GPIOx == GPIO2)
- {
- SCU_APBPeriphReset(__GPIO2,ENABLE);
- SCU_APBPeriphReset(__GPIO2,DISABLE);
- SCU->GPIOTYPE[0x02] = 0x0000 ;
- SCU->GPIOOUT[0x02] = 0x0000;
- SCU->GPIOIN[0x02] = 0x0000;
- }
-
- if(GPIOx == GPIO3)
- {
- SCU_APBPeriphReset(__GPIO3,ENABLE);
- SCU_APBPeriphReset(__GPIO3,DISABLE);
- SCU->GPIOTYPE[0x03] = 0x0000 ;
- SCU->GPIOOUT[0x03] = 0x0000;
- SCU->GPIOIN[0x03] = 0x0000;
- }
-
- if(GPIOx == GPIO4)
- {
- SCU_APBPeriphReset(__GPIO4,ENABLE);
- SCU_APBPeriphReset(__GPIO4,DISABLE);
- SCU->GPIOTYPE[0x04] = 0x0000 ;
- SCU->GPIOOUT[0x04] = 0x0000;
- SCU->GPIOIN[0x04] = 0x0000;
- SCU->GPIOANA = 0x00;
- }
-
- if(GPIOx == GPIO5)
- {
- SCU_APBPeriphReset(__GPIO5,ENABLE);
- SCU_APBPeriphReset(__GPIO5,DISABLE);
- SCU->GPIOTYPE[0x05] = 0x0000 ;
- SCU->GPIOOUT[0x05] = 0x0000;
- SCU->GPIOIN[0x05] = 0x0000;
- }
-
- if(GPIOx == GPIO6)
- {
- SCU_APBPeriphReset(__GPIO6,ENABLE);
- SCU_APBPeriphReset(__GPIO6,DISABLE);
- SCU->GPIOTYPE[0x06] = 0x0000 ;
- SCU->GPIOOUT[0x06] = 0x0000;
- SCU->GPIOIN[0x06] = 0x0000;
- }
-
- if(GPIOx == GPIO7)
- {
- SCU_APBPeriphReset(__GPIO7,ENABLE);
- SCU_APBPeriphReset(__GPIO7,DISABLE);
- SCU->GPIOOUT[0x07] = 0xAAAA;
- SCU->GPIOOUT[0x07] = 0x0000;
- SCU->GPIOIN[0x07] = 0x0000;
- }
-
- if(GPIOx == GPIO8)
- {
- SCU_APBPeriphReset(__GPIO8,ENABLE);
- SCU_APBPeriphReset(__GPIO8,DISABLE);
- SCU->GPIOEMI = 0x00;
- }
-
- if(GPIOx == GPIO9)
- {
- SCU_APBPeriphReset(__GPIO9,ENABLE);
- SCU_APBPeriphReset(__GPIO9,DISABLE);
- SCU->GPIOEMI = 0x00;
- }
-}
-/*******************************************************************************
-* Function Name : GPIO_Init
-* Description : Initializes the GPIOx peripheral according to the specified
-* parameters in the GPIO_InitStruct .
-* Input :- GPIOx: where x can be (0..9) to select the GPIO peripheral.
-* - GPIO_InitStruct: pointer to a GPIO_InitTypeDef structure that
-* contains the configuration information for the specified GPIO
-* peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct)
-{
- /* Select pin direction */
- u8 PinNumber = 0;
- u8 Counter = 0;
- u8 GPIO_Number = 0;
-
- GPIO_Number = GPIO_GetGPIONumber(GPIOx);
-
-
- if(GPIO_InitStruct->GPIO_Direction == GPIO_PinOutput)
- {
- GPIOx->DDR |= GPIO_InitStruct->GPIO_Pin;
- }
- else
- {
- GPIOx->DDR &= ~GPIO_InitStruct->GPIO_Pin;
- }
-
- for (Counter = 0; Counter < 8;Counter++)
- {
- /*Search pin number*/
- PinNumber = (GPIO_InitStruct->GPIO_Pin & (1 <<Counter));
- if((PinNumber >> Counter) == 1)
- {
- /*Output ALternate 0*/
- SCU->GPIOOUT[GPIO_Number] &= ~(0x3 <<(Counter *2));
- if(GPIO_InitStruct->GPIO_Alternate == GPIO_OutputAlt1)
- {
- /*Output ALternate 1*/
- SCU->GPIOOUT[GPIO_Number] |= 1 << (Counter *2);
- }
- if(GPIO_InitStruct->GPIO_Alternate == GPIO_OutputAlt2)
- {
- /*Output ALternate 2*/
- SCU->GPIOOUT[GPIO_Number] |= 0x2 << (Counter *2);
- }
- if(GPIO_InitStruct->GPIO_Alternate == GPIO_OutputAlt3)
- {
- /*Output ALternate 3*/
- SCU->GPIOOUT[GPIO_Number] |= 0x3 << (Counter *2);
- }
-
- /*Type configuration: PushPull or Open Collector*/
- SCU->GPIOTYPE[GPIO_Number] &= ~(0x1 << Counter) ;
- if(GPIO_InitStruct->GPIO_Type == GPIO_Type_OpenCollector)
- {
- /*Open Drain configuration*/
- SCU->GPIOTYPE[GPIO_Number] |= 0x1 << Counter;
- }
-
- /*IP Connected disable*/
- SCU->GPIOIN[GPIO_Number] &= ~(0x1 << Counter) ;
- if(GPIO_InitStruct->GPIO_IPConnected == GPIO_IPConnected_Enable)
- {
- /*IP Connected enable*/
- SCU->GPIOIN[GPIO_Number] |= 0x1 << Counter;
- }
- }
- }
-}
-
-/*******************************************************************************
-* Function Name : GPIO_StructInit
-* Description : Initialize the GPIO Init Structure parameters
-* Input : GPIO_InitStruct : pointer to a GPIO_InitTypeDef structure
-* which will be initialized.
-* Output : None
-* Return : None
-*******************************************************************************/
-void GPIO_StructInit(GPIO_InitTypeDef* GPIO_InitStruct)
-{
- /* Reset GPIO init structure parameters values */
- GPIO_InitStruct->GPIO_Pin = GPIO_Pin_All;
- GPIO_InitStruct->GPIO_Direction = GPIO_PinInput;
- GPIO_InitStruct->GPIO_Type = GPIO_Type_PushPull;
- GPIO_InitStruct->GPIO_IPConnected = GPIO_IPConnected_Disable;
- GPIO_InitStruct->GPIO_Alternate = GPIO_InputAlt1;
-}
-
-/*******************************************************************************
-* Function Name : GPIO_ReadBit
-* Description : Reads the specified port pin
-* Input : - GPIOx: where x can be (0..9) to select the GPIO peripheral.
-* : - GPIO_Pin: the Pin number. This parameter can be GPIO_Pin_x
-* where x can be (0..7).
-* Output : None
-* Return : The port pin value
-*******************************************************************************/
-u8 GPIO_ReadBit(GPIO_TypeDef* GPIOx, u8 GPIO_Pin)
-{
- if ((((GPIOx->DR[GPIO_Pin<<2])) & GPIO_Pin) != Bit_RESET )
- {
- return Bit_SET;
- }
- else
- {
- return Bit_RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : GPIO_Read
-* Description : Reads the specified GPIO data port
-* Input : - GPIOx: where x can be (0..9) to select the GPIO peripheral.
-* Output : None
-* Return : GPIO data port word value.
-*******************************************************************************/
-u8 GPIO_Read(GPIO_TypeDef* GPIOx)
-{
- return (GPIOx->DR[0x3FC]);
-}
-
-/*******************************************************************************
-* Function Name : GPIO_WriteBit
-* Description : Sets or clears the selected data port bit.
-* Input : - GPIOx: where x can be (0..9) to select the GPIO peripheral.
-* - GPIO_Pin: the Pin number. This parameter can be GPIO_Pin_x
-* where x can be (0..7).
-* - BitVal: this parameter specifies the value to be written
-* to the selected bit.
-* BitVal must be one of the BitAction enum values:
-* - Bit_RESET: to clear the port pin
-* - Bit_SET: to set the port pin
-* Output : None
-* Return : None
-*******************************************************************************/
-void GPIO_WriteBit(GPIO_TypeDef* GPIOx, u8 GPIO_Pin, BitAction BitVal)
-{
- if(BitVal == Bit_SET)
- {
- GPIOx->DR[GPIO_Pin <<2] = GPIO_Pin;
- }
- else
- {
- GPIOx->DR[GPIO_Pin <<2] = 0x00;
- }
-}
-
-/*******************************************************************************
-* Function Name : GPIO_Write
-* Description : Writes the passed value in the selected data GPIOx port
-* register.
-* Input :- GPIOx: where x can be (0..9) to select the GPIO peripheral.
-* - PortVal: the value to be written to the data port register.
-* Output : None
-* Return : None
-*******************************************************************************/
-void GPIO_Write(GPIO_TypeDef* GPIOx, u8 PortVal)
-{
- GPIOx->DR[0x3FC] = PortVal;
-}
-
-/*******************************************************************************
-* Function Name : GPIO_EMIConfig
-* Description : Enables or disables GPIO 8 and 9 in EMI mode.
-* Input : - NewState: new state of the EMI.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void GPIO_EMIConfig(FunctionalState NewState)
-{
- if(NewState == ENABLE)
- {
- SCU->GPIOEMI = 0x01;
- }
- else
- {
- SCU->GPIOEMI = 0x00;
- }
-}
-
-/*******************************************************************************
-* Function Name : GPIO_ANAPinConfig
-* Description : Enables or disables pins from GPIO 4 in Analogue mode.
-* Input :- GPIO_ANAChannel: selects the ADC channel pin.
-* This parameter can be one of the following values:
-* GPIO_ANAChannel0
-* GPIO_ANAChannel1
-* GPIO_ANAChannel2
-* GPIO_ANAChannel3
-* GPIO_ANAChannel4
-* GPIO_ANAChannel5
-* GPIO_ANAChannel6
-* GPIO_ANAChannel7
-* GPIO_ANAChannelALL
-* - NewState: new state of the port pin.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void GPIO_ANAPinConfig(u8 GPIO_ANAChannel, FunctionalState NewState)
-{
-
- if(NewState == ENABLE)
- {
- if(GPIO_ANAChannel == GPIO_ANAChannelALL)
- {
- SCU->GPIOOUT[4] = 0x0000;
- SCU->GPIOIN[4] = 0x00;
- }
- else
- {
- SCU->GPIOOUT[4] &= ~(0x3<<(GPIO_ANAChannel-1));
- SCU->GPIOIN[4] &= ~GPIO_ANAChannel;
- }
- SCU->GPIOANA |= GPIO_ANAChannel;
-
- }
- else
- {
- SCU->GPIOANA &= ~GPIO_ANAChannel;
- }
-}
-
-/*******************************************************************************
-* Function Name : GPIO_GetGPIONumber
-* Description : searche the GPIO number.
-* Input : GPIOx: where x can be (0..9) to select the GPIO peripheral.
-* Output : None
-* Return : GPIO number
-*******************************************************************************/
-u8 GPIO_GetGPIONumber(GPIO_TypeDef* GPIOx)
-{
-
- if(GPIOx == GPIO1)
- {
- return 1;
- }
- if(GPIOx == GPIO2)
- {
- return 2;
- }
- if(GPIOx == GPIO3)
- {
- return 3;
- }
- if(GPIOx == GPIO4)
- {
- return 4;
- }
- if(GPIOx == GPIO5)
- {
- return 5;
- }
- if(GPIOx == GPIO6)
- {
- return 6;
- }
- if(GPIOx == GPIO7)
- {
- return 7;
- }
- if(GPIOx == GPIO8)
- {
- return 8;
- }
- if(GPIOx == GPIO9)
- {
- return 9;
- }
- return 0;
-}
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_complex_startup/src/91x_i2c.c b/uc_str912/prj_blinky_complex_startup/src/91x_i2c.c
deleted file mode 100644
index 9f15adb..0000000
--- a/uc_str912/prj_blinky_complex_startup/src/91x_i2c.c
+++ /dev/null
@@ -1,616 +0,0 @@
-/******************** (C) COPYRIGHT 2005 STMicroelectronics ********************
-* File Name : 91x_i2c.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the I2C software functions.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_i2c.h"
-#include "91x_scu.h"
-
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-
-/* I2C IT enable */
-#define I2C_IT_Enable 0x01
-#define I2C_IT_Disable 0xFE
-
-/* I2C Peripheral Enable/Disable */
-#define I2C_PE_Set 0x20
-#define I2C_PE_Reset 0xDF
-
-/* Address direction bit */
-#define I2C_ADD0_Set 0x01
-#define I2C_ADD0_Reset 0xFE
-
-/* I2C START Enable/Disable */
-#define I2C_Start_Enable 0x08
-#define I2C_Start_Disable 0xF7
-
-/* I2C STOP Enable/Disable */
-#define I2C_Stop_Enable 0x02
-#define I2C_Stop_Disable 0xFD
-
-/* I2C Masks */
-#define I2C_Frequency_Mask 0x1F
-#define I2C_AddressHigh_Mask 0xF9
-#define I2C_OwnAddress_Mask 0x0300
-#define I2C_StandardMode_Mask 0x7f
-#define I2C_FastMode_Mask 0x80
-#define I2C_Event_Mask 0x3FFF
-#define I2C_HeaderSet_Mask 0xF1
-#define I2C_HeaderReset_Mask 0xFE
-
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/*******************************************************************************
-* Function Name : I2C_DeInit
-* Description : Deinitializes the I2C peripheral registers to their default
-* reset values.
-* Input :- I2Cx: I2C peripheral can be:
-* - I2C0
-* - I2C1
-* Output : None
-* Return : None
-*******************************************************************************/
-void I2C_DeInit(I2C_TypeDef* I2Cx)
-{
- if (I2Cx == I2C0)
- {
- /* Reset the I2C0 registers values */
- SCU_APBPeriphReset(__I2C0, ENABLE);
- SCU_APBPeriphReset(__I2C0, DISABLE);
- }
- if (I2Cx == I2C1)
- {
- /* Reset the I2C1 registers values */
- SCU_APBPeriphReset(__I2C1, ENABLE);
- SCU_APBPeriphReset(__I2C1, DISABLE);
- }
-}
-
-/*******************************************************************************
-* Function Name : I2C_Init
-* Description : Initializes the I2C peripheral according to the specified
-* parameters in the I2C_InitTypeDef structure.
-* Input :- I2Cx: I2C peripheral can be:
-* - I2C0
-* - I2C1
-*
-* - I2C_InitStruct: pointer to an I2C_InitTypeDef structure that
-* contains the configuration information for the specified I2C
-* peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void I2C_Init(I2C_TypeDef* I2Cx, I2C_InitTypeDef* I2C_InitStruct)
-{
- u16 wResult = 0x0F;
- u32 dPCLK = 25000000;
-
- /* Get PCLK frequency value */
- dPCLK = SCU_GetPCLKFreqValue()*1000;
- /* Disable I2C peripheral to set FR[2:0] bits */
- I2C_Cmd (I2Cx, DISABLE);
- /* Clear frequency FR[2:0] bits */
- I2Cx->OAR2 &= I2C_Frequency_Mask;
- /* Set frequency bits depending on PCLK value */
- if ((dPCLK <1667000) & (dPCLK > 10000000))
- I2Cx->OAR2 |= 0x20;
- else if (dPCLK < 26670000)
- I2Cx->OAR2 |= 0x40;
- else if (dPCLK < 40000000)
- I2Cx->OAR2 |= 0x60;
- else if (dPCLK < 53330000)
- I2Cx->OAR2 |= 0x80;
- else if (dPCLK < 66000000)
- I2Cx->OAR2 |= 0xA0;
- else if (dPCLK < 80000000)
- I2Cx->OAR2 |= 0xC0;
- else if (dPCLK < 100000000)
- I2Cx->OAR2 |= 0xE0;
- I2C_Cmd (I2Cx, ENABLE);
-
- /* Configure general call */
- if (I2C_InitStruct->I2C_GeneralCall == I2C_GeneralCall_Enable)
- {
- /* Enable general call */
- I2Cx->CR |= I2C_GeneralCall_Enable;
- }
- else
- {
- /* Disable general call */
- I2Cx->CR &= I2C_GeneralCall_Disable;
- }
- /* Configure acknowledgement */
- if (I2C_InitStruct->I2C_Ack == I2C_Ack_Enable)
- {
- /* Enable acknowledgement */
- I2Cx->CR |= I2C_Ack_Enable;
- }
- else
- {
- /* Disable acknowledgement */
- I2Cx->CR &= I2C_Ack_Disable;
- }
-
- /* Configure LSB own address */
- I2Cx->OAR1 = I2C_InitStruct->I2C_OwnAddress;
- /* Clear MSB own address ADD[9:8] bits */
- I2Cx->OAR2 &= I2C_AddressHigh_Mask;
- /* Set MSB own address value */
- I2Cx->OAR2 |= (I2C_InitStruct->I2C_OwnAddress & I2C_OwnAddress_Mask)>>7;
-
- /* Configure speed in standard mode */
- if (I2C_InitStruct->I2C_CLKSpeed <= 100000)
- {
- /* Standard mode speed calculate */
- wResult = ((dPCLK/I2C_InitStruct->I2C_CLKSpeed)-7)/2;
- /* Set speed value and clear FM/SM bit for standard mode in LSB clock divider */
- I2Cx->CCR = wResult & I2C_StandardMode_Mask;
- }
- /* Configure speed in fast mode */
- else if (I2C_InitStruct->I2C_CLKSpeed <= 400000)
- {
- /* Fast mode speed calculate */
- wResult = ((dPCLK/I2C_InitStruct->I2C_CLKSpeed)-9)/3;
- /* Set speed value and set FM/SM bit for fast mode in LSB clock divider */
- I2Cx->CCR = wResult | I2C_FastMode_Mask;
- }
- /* Set speed in MSB clock divider */
- I2Cx->ECCR = wResult >>7;
-}
-
-/*******************************************************************************
-* Function Name : I2C_StructInit
-* Description : Initialize the I2C Init Structure parameters
-* Input : - I2C_InitStruct: pointer to an I2C_InitTypeDef structure
- which will be initialized.
-* Output : None
-* Return : None.
-*******************************************************************************/
-void I2C_StructInit(I2C_InitTypeDef* I2C_InitStruct)
-{
- /* Initialize the I2C_CLKSpeed member */
- I2C_InitStruct->I2C_CLKSpeed = 5000;
-
- /* Initialize the I2C_OwnAddress member */
- I2C_InitStruct->I2C_OwnAddress = 0x0;
-
- /* Initialize the I2C_GeneralCall member */
- I2C_InitStruct->I2C_GeneralCall = I2C_GeneralCall_Disable;
-
- /* Initialize the I2C_Ack member */
- I2C_InitStruct->I2C_Ack = I2C_Ack_Disable;
-}
-
-/*******************************************************************************
-* Function Name : I2C_Cmd
-* Description : Enables or disables the specified I2C peripheral.
-* Input :- I2Cx: I2C peripheral can be:
-* - I2C0
-* - I2C1
-* - NewState: new state of the I2C peripheral. This parameter
-* can be: ENABLE or DISABLE.
-* Output : None
-* Return : None.
-*******************************************************************************/
-void I2C_Cmd(I2C_TypeDef* I2Cx, FunctionalState NewState)
-{
- if (NewState == ENABLE)
- {
- /* Enable the I2C peripheral by setting twice the PE bit on the CR register */
- I2Cx->CR |= I2C_PE_Set;
- I2Cx->CR |= I2C_PE_Set;
- }
- else
- {
- /* Disable the I2C peripheral */
- I2Cx->CR &= I2C_PE_Reset;
- }
-}
-
-/*******************************************************************************
-* Function Name : I2C_GenerateSTART
-* Description : Generates I2C communication START condition.
-* Input :- I2Cx: I2C peripheral can be:
-* - I2C0
-* - I2C1
-*
-* - NewState: new state of the Start condition. This parameter
-* can be: ENABLE or DISABLE.
-* Output : None
-* Return : None.
-*******************************************************************************/
-void I2C_GenerateStart(I2C_TypeDef* I2Cx, FunctionalState NewState)
-{
- if (NewState == ENABLE)
- {
- /* Generate a START condition */
- I2Cx->CR |= I2C_Start_Enable;
- }
- else
- {
- /* Disable the START condition generation */
- I2Cx->CR &= I2C_Start_Disable;
- }
-}
-
-/*******************************************************************************
-* Function Name : I2C_GenerateSTOP
-* Description : Generates I2C communication STOP condition.
-* Input :- I2Cx: I2C peripheral can be:
-* - I2C0
-* - I2C1
-*
-* - NewState: new state of the Stop condition. This parameter
-* can be: ENABLE or DISABLE.
-* Output : None
-* Return : None.
-*******************************************************************************/
-void I2C_GenerateSTOP(I2C_TypeDef* I2Cx, FunctionalState NewState)
-{
- if (NewState == ENABLE)
- {
- /* Generate a SIOP condition */
- I2Cx->CR |= I2C_Stop_Enable;
- }
- else
- {
- /* Disable the STOP condition generation */
- I2Cx->CR &= I2C_Stop_Disable;
- }
-}
-
-/*******************************************************************************
-* Function Name : I2C_AcknowledgeConfig
-* Description : Enables or disables I2C acknowledge feature.
-* Input :- I2Cx: I2C peripheral can be:
-* - I2C0
-* - I2C1
-* - NewState: new state of the Acknowledgement. This parameter
-* can be: ENABLE or DISABLE.
-* Output : None
-* Return : None.
-*******************************************************************************/
-void I2C_AcknowledgeConfig(I2C_TypeDef *I2Cx, FunctionalState NewState)
-{
- if (NewState == ENABLE)
- {
- /* Enable the acknowledgement */
- I2Cx->CR |= I2C_Ack_Enable;
- }
- else
- {
- /* Disable the acknowledgement */
- I2Cx->CR &= I2C_Ack_Disable;
- }
-}
-
-/*******************************************************************************
-* Function Name : I2C_ITConfig
-* Description : Enables or disables I2C interrupt feature.
-* Input :- I2Cx: I2C peripheral can be:
-* - I2C0
-* - I2C1
-* - NewState: new state of the specified I2C interrupt.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None.
-*******************************************************************************/
-void I2C_ITConfig(I2C_TypeDef *I2Cx, FunctionalState NewState)
-{
- if (NewState == ENABLE)
- {
- /* Enable the I2C interrupt */
- I2Cx->CR |= I2C_IT_Enable;
- }
- else
- {
- /* Disable the I2C interrupt */
- I2Cx->CR &= I2C_IT_Disable;
- }
-}
-
-/*******************************************************************************
-* Function Name : I2C_ReadRegister
-* Description : Reads any I2C register and returns its value.
-* Input :- I2Cx: I2C peripheral can be:
-* - I2C0
-* - I2C1
-* - I2C_Register: the I2C register to be read. This parameter
-* can be one of the following values:
-* - I2C_CR: CR register.
-* - I2C_SR1: SR1 register.
-* - I2C_SR2: SR2 register.
-* - I2C_CCR: CCR register.
-* - I2C_OAR1: OAR1 register.
-* - I2C_OAR2: OAR2 register.
-* - I2C_DR: DR register.
-* - I2C_ECCR: ECCR register.
-* Output : None
-* Return : The value of the register passed as parameter
-*******************************************************************************/
-u8 I2C_ReadRegister(I2C_TypeDef* I2Cx, u8 I2C_Register)
-{
- /* Return the selected register value */
- if (I2Cx == I2C0)
- {
- return (*(u8 *)(I2C0_BASE + I2C_Register));
- }
- if (I2Cx == I2C1)
- {
- return (*(u8 *)(I2C1_BASE + I2C_Register));
- }
- return 0;
-}
-
-/*******************************************************************************
-* Function Name : I2C_GetFlagStatus
-* Description : Checks whether the specified I2C flag is set or not.
-* Input :- I2Cx: I2C peripheral can be:
-* - I2C0
-* - I2C1
-* - I2C_FLAG: flag to check. This parameter can be one of the
-* following values:
-* - I2C_FLAG_SB: Start bit flag
-* - I2C_FLAG_M_SL: Master/Slave flag
-* - I2C_FLAG_ADSL: Adress matched flag
-* - I2C_FLAG_BTF: Byte transfer finished flag
-* - I2C_FLAG_BUSY: Bus busy flag
-* - I2C_FLAG_TRA: Transmitter/Receiver flag
-* - I2C_FLAG_ADD10: 10-bit addressing in Master mode flag
-* - I2C_FLAG_EVF: Event flag
-* - I2C_FLAG_GCAL: General call flag
-* - I2C_FLAG_BERR: Bus error flag
-* - I2C_FLAG_ARLO: Arbitration lost flag
-* - I2C_FLAG_STOPF: Stop detection flag
-* - I2C_FLAG_AF: Acknowledge failure flag
-* - I2C_FLAG_ENDAD: End of address transmission flag
-* - I2C_FLAG_ACK: Acknowledge enable flag
-* Output : None
-* Return : The NewState of the I2C_Flag (SET or RESET).
-*******************************************************************************/
-FlagStatus I2C_GetFlagStatus(I2C_TypeDef* I2Cx, u16 I2C_FLAG)
-{
- u16 wFlag1=0, wFlag2=0, wTmp=0;
-
- wFlag1 = I2Cx->SR2;
- wFlag1 = wFlag1<<8;
- wFlag2 = I2Cx->CR & 0x04;
-
- /* Get all the I2C flags in a unique register*/
- wTmp = (((I2Cx->SR1 | (wFlag1)) & I2C_Event_Mask) | (wFlag2<<12));
-
- /* Check the status of the specified I2C flag */
- if((wTmp & I2C_FLAG) != RESET)
- {
- /* Return SET if I2C_FLAG is set */
- return SET;
- }
- else
- {
- /* Return RESET if I2C_FLAG is reset */
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : I2C_ClearFlag
-* Description : Clears the I2C Flag passed as a parameter
-* Input :- I2Cx: I2C peripheral can be:
-* - I2C0
-* - I2C1
-* - I2C_FLAG: flag to check. This parameter can be one of the
-* following values:
-* - I2C_FLAG_SB: Start bit flag
-* - I2C_FLAG_M_SL: Master/Slave flag
-* - I2C_FLAG_ADSL: Adress matched flag
-* - I2C_FLAG_BTF: Byte transfer finished flag
-* - I2C_FLAG_BUSY: Bus busy flag
-* - I2C_FLAG_TRA: Transmitter/Receiver flag
-* - I2C_FLAG_ADD10: 10-bit addressing in Master mode flag
-* - I2C_FLAG_EVF: Event flag
-* - I2C_FLAG_GCAL: General call flag
-* - I2C_FLAG_BERR: Bus error flag
-* - I2C_FLAG_ARLO: Arbitration lost flag
-* - I2C_FLAG_STOPF: Stop detection flag
-* - I2C_FLAG_AF: Acknowledge failure flag
-* - I2C_FLAG_ENDAD: End of address transmission flag
-* - I2C_FLAG_ACK: Acknowledge enable flag
-* - parameter needed in the case that the flag to be cleared
-* need a write in one register
-* Output : None
-* Return : None.
-*******************************************************************************/
-void I2C_ClearFlag(I2C_TypeDef* I2Cx, u16 I2C_FLAG, ...)
-{
- u8 bTmp = (u8)*((u32 *) & I2C_FLAG + sizeof(I2C_FLAG));
-
- /* flags that need a read of the SR2 register to be cleared */
- if ((I2C_FLAG==I2C_FLAG_ADD10) || (I2C_FLAG==I2C_FLAG_EVF) || (I2C_FLAG==I2C_FLAG_BERR) || (I2C_FLAG==I2C_FLAG_ARLO) |
- (I2C_FLAG==I2C_FLAG_STOPF) ||(I2C_FLAG==I2C_FLAG_AF) || (I2C_FLAG==I2C_FLAG_ENDAD))
- {
- /* Read the SR2 register */
- I2Cx->SR2;
-
- /* Two flags need a second step to be cleared */
- switch (I2C_FLAG)
- {
- case I2C_FLAG_ADD10:
- /* Send the MSB 10bit address passed as second parameter */
- I2Cx->DR = bTmp;
- break;
- case I2C_FLAG_ENDAD:
- /* Write to the I2C_CR register by setting PE bit */
- I2Cx->CR |= I2C_PE_Set;
- break;
- }
- }
-
- /* flags that need a read of the SR1 register to be cleared */
- else if (I2C_FLAG==I2C_FLAG_SB || I2C_FLAG==I2C_FLAG_ADSL || I2C_FLAG==I2C_FLAG_BTF || I2C_FLAG==I2C_FLAG_TRA)
- {
- /* Read the SR1 register */
- (void)I2Cx->SR1;
-
- /* three flags need a second step to be cleared */
- if (I2C_FLAG == I2C_FLAG_SB)
- {
- /* Send the address byte passed as second parameter */
- I2Cx->DR = bTmp;
- }
- else if (I2C_FLAG==I2C_FLAG_BTF || I2C_FLAG==I2C_FLAG_TRA)
- {
- /* return the received byte in the variable passed as second parameter */
- bTmp=I2Cx->DR;
- }
- }
-
- /* flags that need to disable the I2C interface */
- else if ( I2C_FLAG==I2C_FLAG_M_SL || I2C_FLAG==I2C_FLAG_GCAL)
- {
- I2C_Cmd(I2Cx, DISABLE);
- I2C_Cmd(I2Cx, ENABLE);
- }
-}
-
-/*******************************************************************************
-* Function Name : I2C_Send7bitAddress
-* Description : Transmits the address byte to select the slave device.
-* Input :- I2Cx: I2C peripheral can be:
-* - I2C0
-* - I2C1
-* - Address: specifies the slave address which will be transmitted
-* - Direction: specifies whether the I2C device will be a
-* Transmitter or a Receiver. This parameter can be one of the
-* following values
-* - I2C_MODE_TRANSMITTER: Transmitter mode
-* - I2C_MODE_RECEIVER: Receiver mode
-* Output : None
-* Return : None.
-*******************************************************************************/
-void I2C_Send7bitAddress(I2C_TypeDef* I2Cx, u8 Address, u8 Direction)
-{
- /* Test on the direction to define the read/write bit */
- if (Direction == I2C_MODE_RECEIVER)
- {
- /* Set the address bit0 for read */
- Address |= I2C_ADD0_Set;
- }
- else
- {
- /* Reset the address bit0 for write */
- Address &= I2C_ADD0_Reset;
- }
- /* Send the address */
- I2Cx->DR = Address;
-}
-
-/*******************************************************************************
-* Function Name : I2C_SendData
-* Description : Send a data byte.
-* Input :- I2Cx: I2C peripheral can be:
-* - I2C0
-* - I2C1
-* - bData : the byte to be sent
-* Output : None
-* Return : None.
-*******************************************************************************/
-void I2C_SendData(I2C_TypeDef* I2Cx, u8 bData)
-{
- /* Write in the DR register the byte to be sent */
- I2Cx->DR = bData;
-}
-
-/*******************************************************************************
-* Function Name : I2C_ReceiveData
-* Description : Read the received byte.
-* Input : - I2Cx: I2C peripheral can be:
-* - I2C0
-* - I2C1
-* Output : None
-* Return : The received byte
-*******************************************************************************/
-u8 I2C_ReceiveData(I2C_TypeDef* I2Cx)
-{
- /* Return from the DR register the received byte */
- return I2Cx->DR;
-}
-
-/*******************************************************************************
-* Function Name : I2C_GetLastEvent
-* Description : Get the Last happened I2C Event.
-* Input :- I2Cx: I2C peripheral can be:
-* - I2C0
-* - I2C1
-* Output : None
-* Return : The Last happened Event.
-*******************************************************************************/
-u16 I2C_GetLastEvent(I2C_TypeDef* I2Cx)
-{
- u16 wFlag1=0, wLastEvent=0;
- wFlag1 = I2Cx->SR2;
- wFlag1 = wFlag1<<8;
- /* Get the last event value from I2C status register */
- wLastEvent = (((I2Cx->SR1 | (wFlag1)) & I2C_Event_Mask));
- /* Return the last event */
- return wLastEvent;
-}
-
-/*******************************************************************************
-* Function Name : I2C_CheckEvent
-* Description : Checks whether the Last I2C Event is equal to the one passed
-* as parameter.
-* Input :- I2Cx: I2C peripheral can be:
-* - I2C0
-* - I2C1
-* - I2C_EVENT: the event to check. This parameter can be one of
-* the following values:
-* - I2C_EVENT_SLAVE_ADDRESS_MATCHED
-* - I2C_EVENT_SLAVE_BYTE_RECEIVED
-* - I2C_EVENT_SLAVE_BYTE_TRANSMITTED
-* - I2C_EVENT_MASTER_MODE_SELECT
-* - I2C_EVENT_MASTER_MODE_SELECTED
-* - I2C_EVENT_MASTER_BYTE_RECEIVED
-* - I2C_EVENT_MASTER_BYTE_TRANSMITTED
-* - I2C_EVENT_MASTER_MODE_ADDRESS10
-* - I2C_EVENT_SLAVE_STOP_DETECTED
-* - I2C_EVENT_SLAVE_ACK_FAILURE
-* Output : None
-* Return : An ErrorStatus enumuration value:
-* - SUCCESS: Last event is equal to the I2C_Event
-* - ERROR: Last event is different from the I2C_Event
-*******************************************************************************/
-ErrorStatus I2C_CheckEvent(I2C_TypeDef* I2Cx,u16 I2C_EVENT)
-{
- u16 wLastEvent = I2C_GetLastEvent(I2Cx);
-
- /* Check whther the last event is equal to I2C_EVENT */
- if (wLastEvent == I2C_EVENT)
- {
- /* Return SUCCESS when last event is equal to I2C_EVENT */
- return SUCCESS;
- }
- else
- {
- /* Return ERROR when last event is different from I2C_EVENT */
- return ERROR;
- }
-}
-
-/******************* (C) COPYRIGHT 2005 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_complex_startup/src/91x_lib.c b/uc_str912/prj_blinky_complex_startup/src/91x_lib.c
deleted file mode 100644
index c0eadbb..0000000
--- a/uc_str912/prj_blinky_complex_startup/src/91x_lib.c
+++ /dev/null
@@ -1,281 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_lib.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all peripherals pointers
- : initialization.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-#define EXT
-
-/* Standard include ----------------------------------------------------------*/
-#include "91x_map.h"
-
-/* Include of other module interface headers ---------------------------------*/
-/* Local includes ------------------------------------------------------------*/
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/* Interface functions -------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-#ifdef DEBUG
-
-/*******************************************************************************
-* Function Name : debug
-* Description : this function initialize peripherals pointers
-* Input : no one
-* Output : no one
-* Return : no one
-*******************************************************************************/
-void debug(void)
-{
-
-
-/************************* DMA *************************/
-
-#ifdef _DMA
- DMA = (DMA_TypeDef *)DMA_BASE;
-#endif /* _DMA */
-
-/************************* DMA *************************/
-
-
-#ifdef _DMA_Channel0
- DMA_Channel0= (DMA_Channel_TypeDef *)DMA_Channel0_BASE;
-#endif /* _DMA_Channel0 */
-
-#ifdef _DMA_Channel1
- DMA_Channel1= (DMA_Channel_TypeDef *)DMA_Channel1_BASE;
-#endif /* _DMA_Channel1 */
-
-#ifdef _DMA_Channel2
- DMA_Channel2 = (DMA_Channel_TypeDef *)DMA_Channel2_BASE;
-#endif /* _DMA_Channel2 */
-
-#ifdef _DMA_Channel3
- DMA_Channel3 = (DMA_Channel_TypeDef *)DMA_Channel3_BASE;
-#endif /* _DMA_Channel3 */
-
-#ifdef _DMA_Channel4
- DMA_Channel4 = (DMA_Channel_TypeDef *)DMA_Channel4_BASE;
-#endif /* _DMA_Channel4 */
-
-#ifdef _DMA_Channel5
- DMA_Channel5= (DMA_Channel_TypeDef *)DMA_Channel5_BASE;
-#endif /* _DMA_Channel5*/
-
-
-#ifdef _DMA_Channel6
- DMA_Channel6 = (DMA_Channel_TypeDef *)DMA_Channel6_BASE;
-#endif /* _DMA_Channel6 */
-
-#ifdef _DMA_Channel7
- DMA_Channel7 = (DMA_Channel_TypeDef *)DMA_Channel7_BASE;
-#endif /* _DMA_Channel7 */
-
-
-
- /************************* EMI *************************/
-
-#ifdef _EMI_Bank0
- EMI_Bank0= (EMI_Bank_TypeDef *)EMI_Bank0_BASE;
-#endif /* _EMI_Bank0 */
-
-#ifdef _EMI_Bank1
- EMI_Bank1= (EMI_Bank_TypeDef *)EMI_Bank1_BASE;
-#endif /* _EMI_Bank1 */
-
-#ifdef _EMI_Bank2
- EMI_Bank2 = (EMI_Bank_TypeDef *)EMI_Bank2_BASE;
-#endif /* _EMI_Bank2 */
-
-#ifdef _EMI_Bank3
- EMI_Bank3 = (EMI_Bank_TypeDef *)EMI_Bank3_BASE;
- #endif /* _EMI_Bank3 */
-
-
-
-/************************* AHBAPB *************************/
-
-#ifdef _AHBAPB0
- AHBAPB0 = (AHBAPB_TypeDef *)AHBAPB0_BASE;
-#endif /* _AHBAPB0 */
-
-#ifdef _AHBAPB1
- AHBAPB1 = (AHBAPB_TypeDef *)AHBAPB1_BASE;
-#endif /*_AHBAPB1 */
-
-
-
-/************************* FMI *************************/
-
-#ifdef _FMI
- FMI = (FMI_TypeDef *)FMI_BASE;
-#endif /* _FMI */
-
-/************************* VIC *************************/
-
-#ifdef _VIC0
- VIC0 = (VIC_TypeDef *)VIC0_BASE;
-#endif /* _VIC0 */
-
-#ifdef _VIC1
- VIC1 = (VIC_TypeDef *)VIC1_BASE;
-#endif /* _VIC1 */
-
-/************************* WIU *************************/
-
-#ifdef _WIU
- WIU = (WIU_TypeDef *)WIU_BASE;
-#endif /* _WIU */
-
-/************************* TIM *************************/
-
-#ifdef _TIM0
- TIM0 = (TIM_TypeDef *)TIM0_BASE;
-#endif /* _TIM0 */
-
-#ifdef _TIM1
- TIM1 = (TIM_TypeDef *)TIM1_BASE;
-#endif /* _TIM1 */
-
-#ifdef _TIM2
- TIM2 = (TIM_TypeDef *)TIM2_BASE;
-#endif /* _TIM2 */
-
-#ifdef _TIM3
- TIM3 = (TIM_TypeDef *)TIM3_BASE;
-#endif /* _TIM3 */
-
-/************************* GPIO ************************/
-
-#ifdef _GPIO0
- GPIO0 = (GPIO_TypeDef *)GPIO0_BASE;
-#endif /* _GPIO0 */
-
-#ifdef _GPIO1
- GPIO1 = (GPIO_TypeDef *)GPIO1_BASE;
-#endif /* _GPIO1 */
-
-#ifdef _GPIO2
- GPIO2 = (GPIO_TypeDef *)GPIO2_BASE;
-#endif /* _GPIO2 */
-
-#ifdef _GPIO3
- GPIO3 = (GPIO_TypeDef *)GPIO3_BASE;
-#endif /* _GPIO3 */
-
-#ifdef _GPIO4
- GPIO4 = (GPIO_TypeDef *)GPIO4_BASE;
-#endif /* _GPIO4 */
-
-#ifdef _GPIO5
- GPIO5 = (GPIO_TypeDef *)GPIO5_BASE;
-#endif /* _GPIO5 */
-
-#ifdef _GPIO6
- GPIO6 = (GPIO_TypeDef *)GPIO6_BASE;
-#endif /* _GPIO6 */
-
-#ifdef _GPIO7
- GPIO7 = (GPIO_TypeDef *)GPIO7_BASE;
-#endif /* _GPIO7 */
-
-#ifdef _GPIO8
- GPIO8 = (GPIO_TypeDef *)GPIO8_BASE;
-#endif /* _GPIO8 */
-
-#ifdef _GPIO9
- GPIO9 = (GPIO_TypeDef *)GPIO9_BASE;
-#endif /* _GPIO9 */
-
-/************************* RTC *************************/
-
-#ifdef _RTC
- RTC = (RTC_TypeDef *)RTC_BASE;
-#endif /* _RTC */
-
-/************************* PRCCU ***********************/
-
-#ifdef _SCU
- SCU = (SCU_TypeDef *)SCU_BASE;
-#endif /* _PRCCU */
-
-/************************** MC *************************/
-
-#ifdef _MC
- MC = (MC_TypeDef *)MC_BASE;
-#endif /* _MC */
-
-/************************* UART ************************/
-
-#ifdef _UART0
- UART0 = (UART_TypeDef *)UART0_BASE;
-#endif /* _UART0 */
-
-#ifdef _UART1
- UART1 = (UART_TypeDef *)UART1_BASE;
-#endif /* _UART1 */
-
-#ifdef _UART2
- UART2 = (UART_TypeDef *)UART2_BASE;
-#endif /* _UART2 */
-
-/************************* SSP *************************/
-
-#ifdef _SSP0
- SSP0 = (SSP_TypeDef *)SSP0_BASE;
-#endif /* _SSP0 */
-
-#ifdef _SSP1
- SSP1 = (SSP_TypeDef *)SSP1_BASE;
-#endif /* _SSP1 */
-
-/************************* CAN *************************/
-
-#ifdef _CAN
- CAN = (CAN_TypeDef *)CAN_BASE;
-#endif /* _CAN */
-
-/************************* ADC *************************/
-
-#ifdef _ADC
- ADC = (ADC_TypeDef *)ADC_BASE;
-#endif /* _ADC */
-
-/************************* WDG *************************/
-
-#ifdef _WDG
- WDG = (WDG_TypeDef *)WDG_BASE;
-#endif /* _WDG */
-
-/************************* I2C *************************/
-
-#ifdef _I2C0
- I2C0 = (I2C_TypeDef *)I2C0_BASE;
-#endif /* _I2C0 */
-
-#ifdef _I2C1
- I2C1 = (I2C_TypeDef *)I2C1_BASE;
-#endif /* _I2C1 */
-/********************** ENET **************************/
-#ifdef _ENET
- ENET_MAC = (ENET_MAC_TypeDef *)ENET_MAC_BASE;
- ENET_DMA = (ENET_DMA_TypeDef *)ENET_DMA_BASE;
-#endif /* _ENET */
-}
-#endif /* DEBUG */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_complex_startup/src/91x_mc.c b/uc_str912/prj_blinky_complex_startup/src/91x_mc.c
deleted file mode 100644
index d3ca96a..0000000
--- a/uc_str912/prj_blinky_complex_startup/src/91x_mc.c
+++ /dev/null
@@ -1,932 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_mc.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the MC software functions.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_mc.h"
-#include "91x_scu.h"
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-
-#define MC_ODCS_Set 0x0001
-#define MC_ODCS_Reset 0x00FE
-
-#define MC_CMS_Set 0x0004
-#define MC_CMS_Reset 0x00FB
-
-#define MC_CPC_Set 0x0008
-#define MC_CTC_Set 0x0010
-
-#define MC_PCE_Set 0x0020
-#define MC_PCE_Reset 0xFFDF
-
-#define MC_TCE_Set 0x0040
-#define MC_TCE_Reset 0x00BF
-
-#define MC_DTE_Set 0x0080
-#define MC_DTE_Reset 0x007F
-
-#define MC_TCB_Set 0x0004
-#define MC_TCB_Reset 0x00FB
-
-#define MC_STC_Set 0x0008
-
-#define MC_TES_Set 0x0010
-#define MC_TES_Reset 0x00EF
-
-#define MC_CCPT_Set 0x0020
-#define MC_CCPT_Reset 0x005F
-
-#define MC_DISEST_Set 0x0040
-#define MC_DISEST_Reset 0x003F
-
-#define MC_DTS_Set 0x0001
-#define MC_DTS_Reset 0x00FE
-
-#define MC_SDT_Set 0x0002
-
-#define MC_C0SE_Set 0x0004
-#define MC_C0SE_Reset 0x00FB
-
-#define MC_CUSE_Set 0x0008
-#define MC_CUSE_Reset 0x00F7
-
-#define MC_CVSE_Set 0x0010
-#define MC_CVSE_Reset 0x00EF
-
-#define MC_CWSE_Set 0x0020
-#define MC_CWSE_Reset 0x00D0
-
-#define MC_RSE_Set 0x0040
-#define MC_RSE_Reset 0x00BF
-
-#define MC_GPI_Set 0x0080
-#define MC_GPI_Reset 0x007F
-
-#define MC_PUH_Set 0x0020
-#define MC_PUH_Reset 0x005F
-#define MC_PUL_Set 0x0010
-#define MC_PUL_Reset 0x006F
-
-#define MC_PVH_Set 0x0008
-#define MC_PVH_Reset 0x0077
-#define MC_PVL_Set 0x0004
-#define MC_PVL_Reset 0x007B
-
-#define MC_PWH_Set 0x0002
-#define MC_PWH_Reset 0x007D
-#define MC_PWL_Set 0x0001
-#define MC_PWL_Reset 0x007E
-
-#define MC_ODS_Set 0x0040
-#define MC_ODS_Reset 0xFF3F
-
-#define MC_ESC_Clear 0x4321
-
-#define MC_PCR1_TIN_MASK 0xFFFC
-#define MC_OPR_Mask 0x0040
-#define MC_UDCS_Mask 0x0002
-/* Private function prototypes -----------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/******************************************************************************
-* Function Name : MC_DeInit
-* Description : Deinitializes MC peripheral registers to their default reset
-* values.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_DeInit(void)
-{
- /* MC peripheral is under Reset */
- SCU_APBPeriphReset(__MC, ENABLE);
-
- /* MC peripheral Reset off */
- SCU_APBPeriphReset(__MC, DISABLE);
-}
-
-/*******************************************************************************
-* Function Name : MC_Init
-* Description : Initializes the MC peripheral according to the specified
-* parameters in the MC_InitStruct .
-* Input : IMC_InitStruct: pointer to a MC_InitTypeDef structure that
-* contains the configuration information for the MC peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_Init(MC_InitTypeDef* MC_InitStruct)
-{
- /* Select the operating Mode */
- if(MC_InitStruct->MC_OperatingMode == MC_SoftwareOperating_Mode)
- {
- /* Select the Data transfer Mode */
- MC->PCR2 |= MC_DTS_Set;
-
- /* Enable the registers Software Data Transfer */
- MC->PCR2 |= MC_C0SE_Set | MC_CUSE_Set | MC_CVSE_Set | MC_CWSE_Set
- |MC_RSE_Set;
-
- }
- else
- {
- /* Select the Data transfer Mode */
- MC->PCR2 &= MC_DTS_Reset;
-
- /* Disable the registers Software Data Transfer */
- MC->PCR2 &= MC_C0SE_Reset | MC_CUSE_Reset | MC_CVSE_Reset | MC_CWSE_Reset
- |MC_RSE_Reset;
- }
-
- /* Select the MC PWM counter Mode */
- if(MC_InitStruct->MC_PWMMode == MC_PWMZeroCentered_Mode)
- {
- MC->PCR0 |= MC_CMS_Set;
- }
- else
- {
- MC->PCR0 &= MC_CMS_Reset;
- }
-
- /* Set the MC PWM counter Prescaler */
- MC->CPRS = MC_InitStruct->MC_Prescaler;
-
- /* Set the MC PWM Period */
- MC->CMP0 = MC_InitStruct->MC_Period;
-
- /* Set the MC PWM Repetition counter */
- MC->REP = MC_InitStruct->MC_RepetitionCounter;
-
- /* Set the Tacho Compare value */
- MC->TCMP = MC_InitStruct->MC_TachoPeriod;
-
- /* Set the Tacho Prescaler value */
- MC->TPRS = MC_InitStruct->MC_TachoPrescaler;
-
- /* Set the MC Tacho Input Polarity */
- MC->PCR1 = (MC->PCR1 & MC_PCR1_TIN_MASK) | MC_InitStruct->MC_TachoPolarity;
-
- /* Set the MC PWM Forced State */
- MC->OPR |= MC_ODS_Set;
- MC->OPR = (MC->OPR & MC_OPR_Mask) | MC_InitStruct->MC_ForcedPWMState;
-
- /* Select the Tacho Mode */
- if(MC_InitStruct->MC_TachoMode == MC_TachoOneShot_Mode)
- {
- MC->PCR1 |= MC_TCB_Set;
- }
- else
- {
- MC->PCR1 &= MC_TCB_Reset;
- }
-
- /* Select the Tacho Event Mode */
- if(MC_InitStruct->MC_TachoEvent_Mode == MC_TachoEvent_Software_Mode)
- {
- MC->PCR1 |= MC_TES_Set;
- }
- else
- {
- MC->PCR1 &= MC_TES_Reset;
- }
-
- /* Enable or disable the emergency input */
- if(MC_InitStruct->MC_Emergency == MC_Emergency_Enable)
- {
- MC->PCR1 &= MC_DISEST_Reset;
- }
- else
- {
- MC->PCR1 |= MC_DISEST_Set;
- }
-
-/* Select the complementary Mode */
- if(MC_InitStruct->MC_Complementary == MC_Complementary_Enable)
- {
- MC->DTG = MC_InitStruct->MC_DeadTime;
- MC->PCR0 |= MC_ODCS_Set;
- }
- else
- {
- MC->PCR0 &= MC_ODCS_Reset;
- }
-
- /* Tacho Mode selection */
- if(MC_InitStruct->MC_TachoMode == MC_TachoOneShot_Mode)
- {
- MC->PCR1 |= MC_TCB_Set;
- }
- else
- {
- MC->PCR1 &= MC_TCB_Reset;
- }
-
- switch(MC_InitStruct->MC_Channel)
- {
- /* Channel U configuration */
- case MC_Channel_U:
- {
- MC->CMPU = MC_InitStruct->MC_PulseU;
-
- if(MC_InitStruct->MC_PolarityUL == MC_Polarity_Inverted)
- {
- MC->PSR |= MC_PUL_Set;
- }
- else
- {
- MC->PSR &= MC_PUL_Reset;
- }
- if(MC_InitStruct->MC_PolarityUH == MC_Polarity_Inverted)
- {
- MC->PSR |= MC_PUH_Set;
- }
- else
- {
- MC->PSR &= MC_PUH_Reset;
- }
- break;
- }
-
- /* Channel V configuration */
- case MC_Channel_V:
- {
- MC->CMPV = MC_InitStruct->MC_PulseV;
-
- if(MC_InitStruct->MC_PolarityVL == MC_Polarity_Inverted)
- {
- MC->PSR |= MC_PVL_Set;
- }
- else
- {
- MC->PSR &= MC_PVL_Reset;
- }
- if(MC_InitStruct->MC_PolarityVH == MC_Polarity_Inverted)
- {
- MC->PSR |= MC_PVH_Set;
- }
- else
- {
- MC->PSR &= MC_PVH_Reset;
- }
- break;
- }
-
- /* Channel W configuration */
- case MC_Channel_W:
- {
- MC->CMPW = MC_InitStruct->MC_PulseW;
-
- if(MC_InitStruct->MC_PolarityWL == MC_Polarity_Inverted)
- {
- MC->PSR |= MC_PWL_Set;
- }
- else
- {
- MC->PSR &= MC_PWL_Reset;
- }
- if(MC_InitStruct->MC_PolarityWH == MC_Polarity_Inverted)
- {
- MC->PSR |= MC_PWH_Set;
- }
- else
- {
- MC->PSR &= MC_PWH_Reset;
- }
- break;
- }
- /* All Channel Configuration */
- case MC_Channel_ALL:
- {
- MC->CMPU = MC_InitStruct->MC_PulseU;
- MC->CMPV = MC_InitStruct->MC_PulseV;
- MC->CMPW = MC_InitStruct->MC_PulseW;
-
- if(MC_InitStruct->MC_PolarityUL == MC_Polarity_Inverted)
- {
- MC->PSR |= MC_PUL_Set;
- }
- else
- {
- MC->PSR &= MC_PUL_Reset;
- }
- if(MC_InitStruct->MC_PolarityUH == MC_Polarity_Inverted)
- {
- MC->PSR |= MC_PUH_Set;
- }
- else
- {
- MC->PSR &= MC_PUH_Reset;
- }
-
- if(MC_InitStruct->MC_PolarityVL == MC_Polarity_Inverted)
- {
- MC->PSR |= MC_PVL_Set;
- }
- else
- {
- MC->PSR &= MC_PVL_Reset;
- }
- if(MC_InitStruct->MC_PolarityVH == MC_Polarity_Inverted)
- {
- MC->PSR |= MC_PVH_Set;
- }
- else
- {
- MC->PSR &= MC_PVH_Reset;
- }
-
- if(MC_InitStruct->MC_PolarityWL == MC_Polarity_Inverted)
- {
- MC->PSR |= MC_PWL_Set;
- }
- else
- {
- MC->PSR &= MC_PWL_Reset;
- }
- if(MC_InitStruct->MC_PolarityWH == MC_Polarity_Inverted)
- {
- MC->PSR |= MC_PWH_Set;
- }
- else
- {
- MC->PSR &= MC_PWH_Reset;
- }
- }
- default:
- break;
- }
-}
-
-/*******************************************************************************
-* Function Name : MC_StructInit
-* Description : Fills each MC_InitStruct member with its default value.
-* Input : MC_InitStruct : pointer to a MC_InitTypeDef structure which
-* will be initialized.
-* Output : None
-* Return : None.
-*******************************************************************************/
-void MC_StructInit(MC_InitTypeDef* MC_InitStruct)
-{
- MC_InitStruct->MC_OperatingMode = MC_HardwareOperating_Mode;
- MC_InitStruct->MC_TachoMode = MC_TachoContinuous_Mode;
- MC_InitStruct->MC_TachoEvent_Mode = MC_TachoEvent_Hardware_Mode;
- MC_InitStruct->MC_Prescaler = 0x00;
- MC_InitStruct->MC_TachoPrescaler = 0x0000;
- MC_InitStruct->MC_PWMMode = MC_PWMClassical_Mode;
- MC_InitStruct->MC_Complementary = MC_Complementary_Enable;
- MC_InitStruct->MC_Emergency = MC_Emergency_Disable;
- MC_InitStruct->MC_ForcedPWMState = 0x003F;
- MC_InitStruct->MC_Period = 0x0000;
- MC_InitStruct->MC_TachoPeriod = 0x00FF;
- MC_InitStruct->MC_Channel = MC_Channel_ALL;
- MC_InitStruct->MC_PulseU = 0x0000;
- MC_InitStruct->MC_PulseV = 0x0000;
- MC_InitStruct->MC_PulseW = 0x0000;
- MC_InitStruct->MC_PolarityUL = MC_Polarity_NonInverted;
- MC_InitStruct->MC_PolarityUH = MC_Polarity_NonInverted;
- MC_InitStruct->MC_PolarityVL = MC_Polarity_NonInverted;
- MC_InitStruct->MC_PolarityVH = MC_Polarity_NonInverted;
- MC_InitStruct->MC_PolarityWL = MC_Polarity_NonInverted;
- MC_InitStruct->MC_PolarityWH = MC_Polarity_NonInverted;
- MC_InitStruct->MC_TachoPolarity = MC_TachoEventEdge_RisingFalling;
- MC_InitStruct->MC_DeadTime = 0x003F;
- MC_InitStruct->MC_RepetitionCounter = 0x0000;
-}
-
-/*******************************************************************************
-* Function Name : MC_Cmd
-* Description : Enables or disables the MC peripheral.
-* Input : Newstate: new state of the MC peripheral.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_Cmd(FunctionalState NewState)
-{
- if(NewState == ENABLE)
- {
- /* Enable the PWM counter */
- MC->PCR0 |= MC_PCE_Set;
-
- /* Enable the Tacho counter */
- MC->PCR0 |= MC_TCE_Set;
-
- /* Enable the Dead Time counter */
- MC->PCR0 |= MC_DTE_Set;
- }
- else
- {
- /* Disable the PWM counter */
- MC->PCR0 &= MC_PCE_Reset;
-
- /* Disable the Tacho counter */
- MC->PCR0 &= MC_TCE_Reset;
-
- /* Disable the Dead counter */
- MC->PCR0 &= MC_DTE_Reset;
- }
-}
-
-/*******************************************************************************
-* Function Name : MC_ClearPWMCounter
-* Description : Clears the MC PWM counter.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_ClearPWMCounter(void)
-{
-/* Clear the PWM counter */
- MC->PCR0 |= MC_CPC_Set;
-}
-
-/*******************************************************************************
-* Function Name : MC_ClearTachoCounter
-* Description : Clears the MC Tacho counter.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_ClearTachoCounter(void)
-{
-/* Clear the Tacho counter */
- MC->PCR0 |= MC_CTC_Set;
-}
-
-/*******************************************************************************
-* Function Name : MC_CtrlPWMOutputs
-* Description : Enables or disables MC peripheral Main Outputs.
-* Input : Newstate: new state of the MC peripheral Main Outputs.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_CtrlPWMOutputs(FunctionalState Newstate)
-{
- if(Newstate == ENABLE)
- {
- /* Enable the dead time generator data */
- MC->OPR &= MC_ODS_Reset;
- }
- else
- {
- /* Enable the default state data */
- MC->OPR |= MC_ODS_Set;
- }
-}
-
-/*******************************************************************************
-* Function Name : MC_ITConfig
-* Description : Enables or disables the MC interrupts.
-* Input : - MC_IT: specifies the MC interrupts sources to be enabled
-* or disabled.
-* This parameter can be any combination of the following values:
-* - MC_IT_CMPW: Compare W Interrupt.
-* - MC_IT_CMPV: Compare V Interrupt.
-* - MC_IT_CMPU: Compare U Interrupt.
-* - MC_IT_ZPC: Zero of PWM counter Interrupt.
-* - MC_IT_ADT: Automatic Data Transfer Interrupt.
-* - MC_IT_OTC: Overflow of Tacho counter Interrupt.
-* - MC_IT_CPT: Capture of Tacho counter Interrupt.
-* - MC_IT_CM0: Compare 0 Interrupt.
-* - Newstate: new state of IMC interrupts.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_ITConfig(u16 MC_IT, FunctionalState NewState)
-{
- if(NewState == ENABLE)
- {
- /* Enable the specific interrupt source */
- MC->IMR |= MC_IT;
-
- /* Enable the global peripheral interrupt sources */
- MC->PCR2 |= MC_GPI_Set;
- }
- else
- {
- /* Disable the specific interrupt source */
- MC->IMR &= ~MC_IT;
-
- /* Disable the global peripheral interrupt sources */
- MC->PCR2 &= MC_GPI_Reset;
- }
-}
-
-/*******************************************************************************
-* Function Name : MC_SetPrescaler
-* Description : Sets the MC prescaler value.
-* Input : MC_Prescaler: MC prescaler new value.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_SetPrescaler(u8 MC_Prescaler)
-{
-/* Set the Prescaler Register value */
- MC->CPRS = MC_Prescaler;
-}
-
-/*******************************************************************************
-* Function Name : MC_SetPeriod
-* Description : Sets the MC period value.
-* Input : MC_Period: MC period new value.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_SetPeriod(u16 MC_Period)
-{
-/* Set the Period Register value */
- MC->CMP0 = MC_Period;
-}
-
-/*******************************************************************************
-* Function Name : MC_SetPulseU
-* Description : Sets the MC pulse U value.
-* Input : MC_PulseU: MC pulse U new value.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_SetPulseU(u16 MC_PulseU)
-{
-/* Set the Pulse U Register value */
- MC->CMPU = MC_PulseU;
-}
-
-/*******************************************************************************
-* Function Name : MC_SetPulseV
-* Description : Sets the MC pulse V value.
-* Input : MC_PulseV: MC pulse V new value.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_SetPulseV(u16 MC_PulseV)
-{
-/* Set the Pulse V Register value */
- MC->CMPV = MC_PulseV;
-}
-
-/*******************************************************************************
-* Function Name : MC_SetPulseW
-* Description : Sets the MC pulse W value.
-* Input : MC_PulseW: MC pulse W new value.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_SetPulseW(u16 MC_PulseW)
-{
-/* Set the Pulse W Register value */
- MC->CMPW = MC_PulseW;
-}
-
-/*******************************************************************************
-* Function Name : MC_PWMModeConfig
-* Description : Selects the MC PWM counter Mode.
-* Input : MC_PWMMode: MC PWM counter Mode.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_PWMModeConfig(u16 MC_PWMMode)
-{
- /* Select the MC PWM counter Mode */
- if(MC_PWMMode == MC_PWMZeroCentered_Mode)
- {
- MC->PCR0 |= MC_CMS_Set;
- }
- else
- {
- MC->PCR0 &= MC_CMS_Reset;
- }
-}
-
-/*******************************************************************************
-* Function Name : MC_SetDeadTime
-* Description : Sets the MC dead time value.
-* Input : MC_DeadTime: MC dead time new value.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_SetDeadTime(u16 MC_DeadTime)
-{
-/* Set the dead time Register value */
- MC->DTG = MC_DeadTime;
-}
-
-/*******************************************************************************
-* Function Name : MC_SetTachoCompare
-* Description : Sets the MC Tacho Compare Register value.
-* Input : MC_Compare: MC Tacho compare new value.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_SetTachoCompare(u8 MC_Compare)
-{
- /* Sets the Tacho Compare Register value */
- MC->TCMP = MC_Compare;
-}
-/*******************************************************************************
-* Function Name : MC_EmergencyCmd
-* Description : Enables or disables the MC emergency feauture.
-* Input : Newstate: new state of the MC peripheral Emergency.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_EmergencyCmd(FunctionalState NewState)
-{
- if(NewState == ENABLE)
- {
- /* Reset the DISEST Bit in the PCR1 Register to enable the emergency stop input */
- MC->PCR1 &= MC_DISEST_Reset;
- }
- else
- {
- /* Set the DISEST Bit in the PCR1 Register to disable the emergency stop input */
- MC->PCR1 |= MC_DISEST_Reset;
- }
-}
-
-/*******************************************************************************
-* Function Name : MC_EmergencyClear
-* Description : Clears the MC Emergency Register.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_EmergencyClear(void)
-{
-/* Force PWM outputs in safe state (All OFF) */
- MC->OPR |= MC_ODS_Set;
-
-/* Clear EST bit */
- MC->ESC = MC_ESC_Clear;
-
-/* Re-enable protection */
- MC->ESC = 0;
-
-/* Enables the Outputs */
- MC->OPR &= MC_ODS_Reset;
-}
-
-/*******************************************************************************
-* Function Name : MC_GetPeriod
-* Description : Gets the MC period value.
-* Input : None
-* Output : None
-* Return : MC period value.
-*******************************************************************************/
-u16 MC_GetPeriod(void)
-{
-/* Return the PWM signal period value */
- return MC->CMP0;
-}
-
-/*******************************************************************************
-* Function Name : MC_GetPulseU
-* Description : Gets the MC pulse U value.
-* Input : None
-* Output : None
-* Return : MC pulse U value.
-*******************************************************************************/
-u16 MC_GetPulseU(void)
-{
-/* Return the PWM pulse U Register value */
- return MC->CMPU;
-}
-
-/*******************************************************************************
-* Function Name : MC_GetPulseV
-* Description : Gets the MC pulse V value.
-* Input : None
-* Output : None
-* Return : MC pulse V value.
-*******************************************************************************/
-u16 MC_GetPulseV(void)
-{
-/* Return the PWM pulse V Register value */
- return MC->CMPV;
-}
-
-/*******************************************************************************
-* Function Name : MC_GetPulseW
-* Description : Gets the MC pulse W value.
-* Input : None
-* Output : None
-* Return : MC pulse W value.
-*******************************************************************************/
-u16 MC_GetPulseW(void)
-{
-/* Return the PWM pulse W Register value */
- return MC->CMPW;
-}
-
-/*******************************************************************************
-* Function Name : MC_GetTachoCapture
-* Description : Gets the MC Tacho period value.
-* Input : None
-* Output : None
-* Return : MC Tacho capture value.
-*******************************************************************************/
-u16 MC_GetTachoCapture(void)
-{
-/* Return the Tacho Capture Register value */
- return MC->TCPT;
-}
-
-/*******************************************************************************
-* Function Name : MC_ClearOnTachoCapture
-* Description : Enables or disables the the Clear on capture of tacho counter.
-* Input : Newstate: new state of the CCPT bit.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_ClearOnTachoCapture(FunctionalState NewState)
-{
- if(NewState == ENABLE)
- {
- /* Enable the Clear on capture of tacho counter */
- MC->PCR1 |= MC_CCPT_Set;
- }
- else
- {
- /* Disable the Clear on capture of tacho counter */
- MC->PCR1 &= MC_CCPT_Reset;
- }
-}
-/*******************************************************************************
-* Function Name : MC_ForceDataTransfer
-* Description : Sets the MC Outputs default states.
-* Input : MC_ForcedData: MC outputs new states.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_ForceDataTransfer(u8 MC_ForcedData)
-{
- /* Set the MC PWM Forced State */
- MC->OPR |= MC_ODS_Set;
- MC->OPR = (MC->OPR & MC_OPR_Mask) | MC_ForcedData;
-}
-
-/*******************************************************************************
-* Function Name : MC_PreloadConfig
-* Description : Enables the Software Data Transfer.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_SoftwarePreloadConfig(void)
-{
- /* Set the SDT: Software Data Transfer bit */
- MC->PCR2 |= MC_SDT_Set;
-}
-
-/*******************************************************************************
-* Function Name : MC_SoftwareTachoCapture
-* Description : Enables the Software Tacho Capture.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_SoftwareTachoCapture(void)
-{
- /* Set the STC: Software Tacho Capture bit */
- MC->PCR1 |= MC_STC_Set;
-}
-
-/*******************************************************************************
-* Function Name : MC_GetCountingStatus
-* Description : Checks whether the PWM Counter is counting Up or Down.
-* Input : None
-* Output : None
-* Return : The new state of the PWM Counter(DOWN or UP).
-*******************************************************************************/
-CountingStatus MC_GetCountingStatus(void)
-{
- if((MC->PCR0 & MC_UDCS_Mask) != DOWN)
- {
- return UP;
- }
- else
- {
- return DOWN;
- }
-}
-
-/*******************************************************************************
-* Function Name : MC_GetFlagStatus
-* Description : Checks whether the specified MC flag is set or not.
-* Input : MC_FLAG: specifies the flag to check.
-* This parameter can be one of the following values:
-* - MC_FLAG_CMPW: Compare W Flag.
-* - MC_FLAG_CMPV: Compare V Flag.
-* - MC_FLAG_CMPU: Compare U Flag.
-* - MC_FLAG_ZPC: Zero of PWM counter Flag.
-* - MC_FLAG_ADT: Automatic Data Transfer Flag.
-* - MC_FLAG_OTC: Overflow of Tacho counter Flag.
-* - MC_FLAG_CPT: Capture of Tacho counter Flag.
-* - MC_FLAG_CM0: Compare 0 Flag.
-* - MC_FLAG_EST: Emergency Stop Flag.
-* Output : None
-* Return : The new state of the MC_FLAG(SET or RESET).
-*******************************************************************************/
-FlagStatus MC_GetFlagStatus(u16 MC_FLAG)
-{
- if((MC->IPR & MC_FLAG) != RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : MC_ClearFlag
-* Description : Clears the MC’s pending flags.
-* Input : MC_FLAG: specifies the flag to clear.
-* This parameter can be any combination of the following values:
-* - MC_FLAG_CMPW: Compare W Flag.
-* - MC_FLAG_CMPV: Compare V Flag.
-* - MC_FLAG_CMPU: Compare U Flag.
-* - MC_FLAG_ZPC: Zero of PWM counter Flag.
-* - MC_FLAG_ADT: Automatic Data Transfer Flag.
-* - MC_FLAG_OTC: Overflow of Tacho counter Flag.
-* - MC_FLAG_CPT: Capture of Tacho counter Flag.
-* - MC_FLAG_CM0: Compare 0 Flag.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_ClearFlag(u16 MC_FLAG)
-{
-/* Clear the corresponding Flag */
- MC->IPR &= ~MC_FLAG;
-}
-
-/*******************************************************************************
-* Function Name : MC_GetITStatus
-* Description : Checks whether the MC interrupt has occurred or not.
-* Input : MC_IT: specifies the MC interrupt source to check.
-* This parameter can be one of the following values:
-* - MC_IT_CMPW: Compare W Interrupt.
-* - MC_IT_CMPV: Compare V Interrupt.
-* - MC_IT_CMPU: Compare U Interrupt.
-* - MC_IT_ZPC: Zero of PWM counter Interrupt.
-* - MC_IT_ADT: Automatic Data Transfer Interrupt.
-* - MC_IT_OTC: Overflow of Tacho counter Interrupt.
-* - MC_IT_CPT: Capture of Tacho counter Interrupt.
-* - MC_IT_CM0: Compare 0 Interrupt.
-* Output : None
-* Return : The new state of the MC_IT(SET or RESET).
-*******************************************************************************/
-ITStatus MC_GetITStatus(u16 MC_IT)
-{
- if((MC->IPR & MC_IT) && (MC->IMR & MC_IT))
- {
- return SET;
- }
- else
- {
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : MC_ClearITPendingBit
-* Description : Clears the IMC's interrupt pending bits.
-* Input : MC_IT: specifies the pending bit to clear.
-* This parameter can be any combination of the following values:
-* - MC_IT_CMPW: Compare W Interrupt.
-* - MC_IT_CMPV: Compare V Interrupt.
-* - MC_IT_CMPU: Compare U Interrupt.
-* - MC_IT_ZPC: Zero of PWM counter Interrupt.
-* - MC_IT_ADT: Automatic Data Transfer Interrupt.
-* - MC_IT_OTC: Overflow of Tacho counter Interrupt.
-* - MC_IT_CPT: Capture of Tacho counter Interrupt.
-* - MC_IT_CM0: Compare 0 Interrupt.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_ClearITPendingBit(u16 MC_IT)
-{
-/* Clear the corresponding interrupt pending bit */
- MC->IPR &= ~MC_IT;
-}
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_complex_startup/src/91x_rtc.c b/uc_str912/prj_blinky_complex_startup/src/91x_rtc.c
deleted file mode 100644
index 27e5579..0000000
--- a/uc_str912/prj_blinky_complex_startup/src/91x_rtc.c
+++ /dev/null
@@ -1,400 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_rtc.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides the RTC library software functions
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_rtc.h"
-#include "91x_scu.h"
-
-/* Include of other module interface headers ---------------------------------*/
-/* Local includes ------------------------------------------------------------*/
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-u8 BYTEToBCD2(u8 value);
-u16 WORDToBCD3(u16 value);
-u8 BCD2ToBYTE(u8 value);
-u16 BCD3ToBYTE(u16 value);
-/* Interface functions -------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-
-/*******************************************************************************
-* Function Name : BYTEToBCD2
-* Description : Converts a 2 digit decimal to BCD format
-* Input : None
-* Output : None
-* Return : Converted byte
-*******************************************************************************/
-u8 BYTEToBCD2(u8 value)
-{
- u8 bcdhigh = 0;
- while (value >= 10)
- {
- bcdhigh++;
- value -= 10;
- }
- return (bcdhigh << 4) | value;
-}
-/*******************************************************************************
-* Function Name : WORDToBCD3
-* Description : Converts a 3 digit decimal to BCD format
-* Input : None
-* Output : None
-* Return : Converted word
-*******************************************************************************/
-u16 WORDToBCD3(u16 value)
-{
- u16 bcdhigh = 0;
- while (value >= 100)
- {
- bcdhigh++;
- value -= 100;
- }
- bcdhigh <<= 4;
- while (value >= 10)
- {
- bcdhigh++;
- value -= 10;
- }
- return (bcdhigh << 4) | value;
-}
-
-/*******************************************************************************
-* Function Name : BCD3ToWORD
-* Description : convert from 3 digit BCD to Binary
-* Input : None
-* Output : None
-* Return : Converted word
-*******************************************************************************/
-u16 BCD3ToWORD(u16 value)
-{
- return (u16)((((value&0xF00)>>8)*100) + (((value&0x0F0)>>4)*10) + (value&0x0F));
-}
-
-/*******************************************************************************
-* Function Name : BCD2ToBYTE
-* Description : convert from 2 digit BCD to Binary
-* Input : None
-* Output : None
-* Return : Converted word
-*******************************************************************************/
-u8 BCD2ToBYTE(u8 value)
-{
- u32 tmp;
- tmp= ((value&0xF0)>>4)*10;
- return (u8)(tmp+ (value&0x0F));
-}
-
-/*******************************************************************************
-* Function Name : RTC_DeInit
-* Description : Resets the RTC peripheral registers
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void RTC_DeInit(void)
-{
- SCU_APBPeriphReset(__RTC,ENABLE);
- SCU_APBPeriphReset(__RTC,DISABLE);
-}
-
-/*******************************************************************************
-* Function Name : RTC_SetDate
-* Description : Sets the Date register
-* Input : struct of type RTC_DATE
-* Output : None
-* Return : None
-*******************************************************************************/
-void RTC_SetDate(RTC_DATE Date)
-{
- u32 tmp = 0;
-
- RTC->CR |=0x80; /*Enable write operation in DTR register*/
- RTC->DTR = 0;
- tmp = BYTEToBCD2(Date.century);
- RTC->DTR|=tmp<<24;
- tmp = BYTEToBCD2(Date.year);
- RTC->DTR|=tmp<<16;
- tmp = BYTEToBCD2(Date.month);
- RTC->DTR|=tmp<<8;
- tmp = BYTEToBCD2(Date.weekday);
- RTC->DTR|=tmp;
- RTC->TR &=0xFFFFFF;
- tmp = BYTEToBCD2(Date.day);
- RTC->TR|=tmp<<24;
- RTC->CR &=~0x80; /*Disable write operation in DTR register*/
-}
-/*******************************************************************************
-* Function Name : RTC_SetTime
-* Description : Sets the Time register
-* Input : struct of type RTC_TIME
-* Output : None
-* Return : None
-*******************************************************************************/
-void RTC_SetTime(RTC_TIME Time)
-{
- u32 tmp = 0;
-
- RTC->CR |=0x80; /*Enable write operation in TR register*/
- RTC->TR &= 0xFF000000;
- tmp = BYTEToBCD2(Time.hours);
- RTC->TR|=tmp<<16;
- tmp = BYTEToBCD2(Time.minutes);
- RTC->TR|=tmp<<8;
- tmp = BYTEToBCD2(Time.seconds);
- RTC->TR|=tmp;
- RTC->MILR = 0;
- RTC->MILR |= WORDToBCD3(Time.milliseconds);
- RTC->CR &=~0x80; /*Disable write operation in TR register*/
-}
-/*******************************************************************************
-* Function Name : RTC_SetAlarm
-* Description : Sets the Alarm register
-* Input : Struct of type RTC_ALARM
-* Output : Date
-* Return : None
-*******************************************************************************/
-void RTC_SetAlarm(RTC_ALARM Alarm)
-{
- u32 tmp = 0;
-
- RTC->CR |=0x80; /*Enable write operation in ATR register*/
- RTC->ATR = 0;
- tmp = BYTEToBCD2(Alarm.day);
- RTC->ATR|=tmp<<24;
- tmp = BYTEToBCD2(Alarm.hours);
- RTC->ATR|=tmp<<16;
- tmp = BYTEToBCD2(Alarm.minutes);
- RTC->ATR|=tmp<<8;
- tmp = BYTEToBCD2(Alarm.seconds);
- RTC->ATR|=tmp;
- RTC->CR &=~0x80; /*Disable write operation in ATR register*/
-}
-
-/*******************************************************************************
-* Function Name : RTC_GetDate
-* Description : Gets RTC date in BCD coded or BINARY code
-* Input : -Format: BCD or BINARY
-* -Date: pointer to structure of type RTC_DATE to be filled by function
-* Output : None
-* Return : None
-*******************************************************************************/
-void RTC_GetDate(u8 Format, RTC_DATE * Date)
-{
- Date->century = (u8)((RTC->DTR&0xFF000000)>>24);
- Date->year = (u8)((RTC->DTR&0x00FF0000)>>16);
- Date->month = (u8)((RTC->DTR&0x00001F00)>>8);
- Date->day = (u8)((RTC->TR&0x3F000000)>>24);
- Date->weekday = (u8)(RTC->DTR&0xF);
- if (Format == BINARY)
- {
- Date->century = BCD2ToBYTE(Date->century);
- Date->year = BCD2ToBYTE(Date->year);
- Date->month = BCD2ToBYTE(Date->month);
- Date->day = BCD2ToBYTE(Date->day);
- Date->weekday = BCD2ToBYTE(Date->weekday);
- }
-}
-
-/*******************************************************************************
-* Function Name : RTC_GetTime
-* Description : Gets TIME in BCD coded or BINARY code
-* Input : -Format: BCD or BINARY
-* -Time : pointer to structure of type RTC_TIME to be filled by function
-* Output : Time
-* Return : None
-*******************************************************************************/
-void RTC_GetTime(u8 Format, RTC_TIME * Time)
-{
-
- Time->hours = (u8)((RTC->TR&0x003F0000)>>16);
- Time->minutes = (u8)((RTC->TR&0x00007F00)>>8);
- Time->seconds = (u8)(RTC->TR&0x7F);
- Time->milliseconds =(u16)(RTC->MILR&0xFFF);
- if (Format == BINARY)
- {
- Time->hours = BCD2ToBYTE(Time->hours);
- Time->minutes = BCD2ToBYTE(Time->minutes);
- Time->seconds = BCD2ToBYTE(Time->seconds);
- Time->seconds = BCD3ToWORD(Time->milliseconds);
- }
-}
-
-
-/*******************************************************************************
-* Function Name : RTC_GetAlarm
-* Description : Gets the RTC Alarm in BCD or BINARY code
-* Input : -Format: BCD or BINARY
-* -Alarm : pointer to structure of type RTC_ALARM to be filled by function
-* Output : Alarm
-* Return : None
-*******************************************************************************/
-void RTC_GetAlarm(u8 Format,RTC_ALARM * Alarm)
-{
- Alarm->day = (u8)((RTC->ATR&0x3F000000)>>24);
- Alarm->hours = (u8)((RTC->ATR&0x003F0000)>>16);
- Alarm->minutes = (u8)((RTC->ATR&0x00007F00)>>8);
- Alarm->seconds = (u8)((RTC->ATR)&0x7F);
- if (Format == BINARY)
- {
- Alarm->day = BCD2ToBYTE(Alarm->day);
- Alarm->hours = BCD2ToBYTE(Alarm->hours);
- Alarm->minutes = BCD2ToBYTE(Alarm->minutes);
- Alarm->seconds = BCD2ToBYTE(Alarm->seconds);
- }
-}
-
-/*******************************************************************************
-* Function Name : RTC_TamperConfig
-* Description : configures the Tamper mode and tamper polarity
-* Input : -TamperMode: RTC_TamperMode_Edge or RTC_TamperMode_Level
-* -TamperPol : RTC_TamperPol_Low or RTC_TamperMode_High
-* Output : None
-* Return : None
-*******************************************************************************/
-void RTC_TamperConfig(u32 TamperMode, u32 TamperPol)
-{
- RTC->CR&=RTC_TamperMode_Edge;
- if (TamperMode!=RTC_TamperMode_Edge)
- RTC->CR|=RTC_TamperMode_Level;
-
- RTC->CR&=RTC_TamperPol_Low;
- if (TamperPol!=RTC_TamperPol_Low)
- RTC->CR|=RTC_TamperPol_High;
-}
-
-/*******************************************************************************
-* Function Name : RTC_TamperCmd
-* Description : Enable or Disable Tamper
-* Input : NewState: ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void RTC_TamperCmd(FunctionalState NewState)
-{
- RTC->CR&=0xFFFFFFFE;
- if (NewState==ENABLE)
- RTC->CR|=0x1;
-}
-
-/*******************************************************************************
-* Function Name : RTC_AlarmCmd
-* Description : Enable or Disable Alarm
-* Input : NewState: ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void RTC_AlarmCmd(FunctionalState NewState)
-{
- RTC->CR&=~0x100000;
- if (NewState==ENABLE)
- RTC->CR|=0x100000;
-}
-
-/*******************************************************************************
-* Function Name : RTC_CalibClockCmd
-* Description : Enable or Disable RTC Calibration Clock Output
-* Input : NewState: ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void RTC_CalibClockCmd(FunctionalState NewState)
-{
- RTC->CR&=~0x40;
- if (NewState ==ENABLE)
- RTC->CR|=0x40;
-}
-
-/*******************************************************************************
-* Function Name : SRAMBattPowerCmd
-* Description : Enable or Disable SRAM backup Power by VBATT
-* Input : NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void RTC_SRAMBattPowerCmd(FunctionalState NewState)
-{
- RTC->CR&=~0x8;
- if (NewState ==ENABLE)
- RTC->CR|=0x8;
-}
-
-/*******************************************************************************
-* Function Name : RTC_PeridicIntConfig
-* Description : Select a Periodic CLock
-* Input : PeriodicClock
-* Output : None
-* Return : None
-* Note : When PeriodicClock = RTC_Per_DISABLE the Periodic clock generation
-* will be disabled.
-*******************************************************************************/
-void RTC_PeriodicIntConfig(u32 PeriodicClock)
-{
- RTC->CR &=~0xF0000;
- RTC->CR|=PeriodicClock;
-}
-
-/*******************************************************************************
-* Function Name : RTC_ITConfig
-* Description : Enable or Disable an interrupt
-* Input : -RTC_IT : RTC interrupt
-* -Newstate: Enable or Disable
-* Output : None
-* Return : None
-*******************************************************************************/
-void RTC_ITConfig(u32 RTC_IT, FunctionalState NewState)
-{
- RTC->CR&=~RTC_IT;
- if (NewState==ENABLE)
- RTC->CR|=RTC_IT;
-}
-
-/*******************************************************************************
-* Function Name : RTC_GetFlagStatus
-* Description : Gets a RTC flag status
-* Input : RTC_FLAG
-* Output : None
-* Return : FlagStatus :SET or RESET
-*******************************************************************************/
-FlagStatus RTC_GetFlagStatus(u32 RTC_FLAG)
-{
- if (RTC->SR&RTC_FLAG) return SET;
- else return RESET;
-}
-
-/*******************************************************************************
-* Function Name : RTC_ClearFlag
-* Description : Clears a RTC flag
-* Input : RTC_FLAG
-* Output : None
-* Return : None
-* Note : Before clearing the RTC Periodic Flag you need to disable the
-* Periodic interrupt generation, to do this use function
-* RTC_PeriodicIntConfig(RTC_Per_DISABLE)
-*******************************************************************************/
-void RTC_ClearFlag(u32 RTC_FLAG)
-{
- vu32 tmp=0;
- if (RTC_FLAG == RTC_FLAG_Per) tmp=RTC->SR;
- else if (RTC_FLAG == RTC_FLAG_Alarm) RTC->CR&=~0x100000;
- else if (RTC_FLAG == RTC_FLAG_Tamper) RTC->CR&=~0x1;
-}
-
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_complex_startup/src/91x_scu.c b/uc_str912/prj_blinky_complex_startup/src/91x_scu.c
deleted file mode 100644
index 21116b2..0000000
--- a/uc_str912/prj_blinky_complex_startup/src/91x_scu.c
+++ /dev/null
@@ -1,661 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_scu.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides the SCU library software functions
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_scu.h"
-
-/* Include of other module interface headers ---------------------------------*/
-/* Local includes ------------------------------------------------------------*/
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-#define SCU_PLLEN 0x80000
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/* Interface functions -------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-
-/*******************************************************************************
-* Function Name : SCU_MCLKSourceConfig
-* Description : Configures the MCLK source clock
-* Input : MCLK_Source = SCU_MCLK_OSC, SCU_MCLK_PLL or SCU_MCLK_RTC
-* Output : None
-* Return : ErrorStatus: SUCCESS or ERROR
-* Note : this function returns ERROR if trying to select the PLL as
-* clock source while the PLL is disabled or not locked.
-*******************************************************************************/
-ErrorStatus SCU_MCLKSourceConfig(u32 MCLK_Source)
-{
- u32 CLKCNTR_Value;
-
- CLKCNTR_Value = SCU->CLKCNTR; /*get CLKCNTR register value*/
- CLKCNTR_Value &=~0x3; /*clear field MCLKSEL*/
- if (MCLK_Source == SCU_MCLK_PLL) /*PLL selected as clock source*/
- {
- /*check if PLL enabled & locked*/
- if (!((SCU->PLLCONF&SCU_PLLEN)&&(SCU->SYSSTATUS&SCU_FLAG_LOCK)))
- return ERROR;
- }
- else CLKCNTR_Value |=MCLK_Source; /*OSC or RTC selected as clock source*/
- SCU->CLKCNTR = CLKCNTR_Value; /*Update CLKCNTR register value*/
- return SUCCESS;
-}
-
-/*******************************************************************************
-* Function Name : SCU_PLLFactorsConfig
-* Description : Sets the PLL factors
-* Input : PLLN, PLLM and PLLP
-* Output : None
-* Return : ErrorStatus: ERROR or SUCCESS
-* Notes : -The PLL factors must respect the PLL specification requirements
-* -The function returns ERROR if trying to change PLL
-* factors while PLL is selected as Main Clock source (MCLK)
-* -This function disables the PLL, to enable the PLL use
-* function" SCU_PLLCmd(ENABLE)" after setting the PLL factors
-******************************************************************************/
-ErrorStatus SCU_PLLFactorsConfig(u8 PLLN, u8 PLLM, u8 PLLP)
-{
- if (SCU_PLLCmd(DISABLE)==SUCCESS) /*Disable PLL*/
- {
- SCU->PLLCONF =0; /*clear PLLCONF register*/
- SCU->PLLCONF |=(PLLN<<8); /*update PLLN field*/
- SCU->PLLCONF |=PLLM; /*update PLLM field*/
- SCU->PLLCONF |=PLLP<<16; /*update PLLP field*/
- return SUCCESS;
- }
- return ERROR;
-}
-
-/*******************************************************************************
-* Function Name : SCU_PLLCmd
-* Description : Enable or Disable the PLL
-* Input : NewState = ENABLE or DISABLE
-* Output : None
-* Return : ErrorStatus: SUCCESS or ERROR
-* Note : -The function returns ERROR if:
-* *trying to disable the PLL while it is selected as the MCLK
-* *trying to enable the PLL while it is already enabled and
-* locked
-*******************************************************************************/
-ErrorStatus SCU_PLLCmd(FunctionalState NewState)
-{
- vu32 i;
- if (NewState==ENABLE)
- {
- if (!((SCU->PLLCONF&SCU_PLLEN)&&(SCU->SYSSTATUS&SCU_FLAG_LOCK)))
- {
- SCU->SYSSTATUS|=SCU_FLAG_LOCK; /*clear LOCK bit*/
- SCU->PLLCONF |=SCU_PLLEN; /*PLL Enable*/
- while(!SCU->SYSSTATUS&SCU_FLAG_LOCK); /*Wait PLL to lock*/
- return SUCCESS;
- }
- else return ERROR;
- }
- else /*NewState = DISABLE*/
- {
- if(SCU->CLKCNTR&0x3) /*check if PLL not sys CLK*/
- {
- for(i=10;i>0;i--); /*delay before PLL disabling*/
- SCU->PLLCONF &=~SCU_PLLEN; /*PLL Disable*/
- return SUCCESS;
- }
- else return ERROR;
- }
-}
-
-/*******************************************************************************
-* Function Name : SCU_RCLKDivisorConfig
-* Description : Sets the RCLK divisor value
-* Input : RCLK_Divisor
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_RCLKDivisorConfig(u32 RCLK_Divisor)
-{
- SCU->CLKCNTR &=SCU_RCLK_Div1; /*clear RCLKDIV[2:0] field*/
- if (RCLK_Divisor!=SCU_RCLK_Div1)
- SCU->CLKCNTR |= RCLK_Divisor; /*update field with RCLK divisor*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_HCLKDivisorConfig
-* Description : Sets the HCLK divisor value
-* Input : HCLK_Divisor
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_HCLKDivisorConfig(u32 HCLK_Divisor)
-{
- SCU->CLKCNTR &=SCU_HCLK_Div1; /*clear AHBDIV[1:0] field*/
- if (HCLK_Divisor!=SCU_HCLK_Div1)
- SCU->CLKCNTR |= HCLK_Divisor; /*update field with HCLK divisor*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_PCLKDivisorConfig
-* Description : Sets the PCLK divisor value
-* Input : PCLK_Divisor
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_PCLKDivisorConfig(u32 PCLK_Divisor)
-{
- SCU->CLKCNTR &=SCU_PCLK_Div1; /*clear APBDIV[1:0] field*/
- if (PCLK_Divisor!=SCU_PCLK_Div1)
- SCU->CLKCNTR |= PCLK_Divisor; /*update field with PCLK Divisor*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_APBPeriphClockConfig
-* Description : Enable the clock for an APB peripheral
-* Input : -APBPerip : APB peripherals(__RTC, __ADC ,...)
-* -NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_APBPeriphClockConfig(u32 APBPeriph, FunctionalState NewState)
-{
- if (NewState==ENABLE) /*Enable clock for APB peripheral*/
- SCU->PCGR1 |=APBPeriph;
- else
- SCU->PCGR1 &=~APBPeriph; /*Disable clock for APB peripheral*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_AHBPeriphClockConfig
-* Description : Enable the clock for an AHB peripheral
-* Input : -AHBPerip: AHB peripherals(__USB, __DMA,...)
-* -NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_AHBPeriphClockConfig(u32 AHBPeriph, FunctionalState NewState)
-{
- if (NewState==ENABLE) /*Enable clock for AHB peripheral*/
- SCU->PCGRO |=AHBPeriph;
- else
- SCU->PCGRO &=~AHBPeriph; /*Disable clock for AHB peripheral*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_APBPeriphReset
-* Description : Assert or deassert Reset on APB peripheral
-* Input : -APBPeriph: APB peripherals(__RTC, __ADC,...)
- -NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_APBPeriphReset(u32 APBPeriph, FunctionalState NewState)
-{
- if (NewState==DISABLE) /*APB peripheral not held in Reset*/
- SCU->PRR1 |=APBPeriph;
- else
- SCU->PRR1 &=~APBPeriph; /*APB peripheral held in Reset*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_AHBPeriphReset
-* Description : Assert or deassert Reset on AHB peripheral
-* Input : -AHBPeriph: AHB peripherals(__USB, __DMA,...)
- -NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_AHBPeriphReset(u32 AHBPeriph, FunctionalState NewState)
-{
- if (NewState==DISABLE)
- SCU->PRR0 |=AHBPeriph; /*AHB peripheral not held in Reset*/
- else
- SCU->PRR0 &=~AHBPeriph; /*AHB peripheral held in Reset*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_APBPeriphIdleConfig
-* Description : Enable or Disable Periph Clock during Idle mode
-* Input : -APBPeriph: APB peripherals(__RTC, __ADC,...)
- -NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_APBPeriphIdleConfig(u32 APBPeriph, FunctionalState NewState)
-{
- if (NewState==ENABLE)
- SCU->MGR1 |=APBPeriph; /*APB peripheral clock enabled during Idle mode*/
- else
- SCU->MGR1 &=~APBPeriph; /*APB peripheral clock disabled during Idle mode*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_AHBPeriphIdleConfig
-* Description : Enable or Disable Periph Clock during Idle mode
-* Input : -AHBPeriph: AHB peripherals(__USB, __DMA,...)
- -NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_AHBPeriphIdleConfig(u32 AHBPeriph, FunctionalState NewState)
-{
- if (NewState==ENABLE)
- SCU->MGR0 |=AHBPeriph; /*AHB peripheral clock enabled during Idle mode*/
- else
- SCU->MGR0 &=~AHBPeriph; /*AHB peripheral clock disabled during Idle mode*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_APBPeriphDebugConfig
-* Description : Enable or Disable Periph Clock during ARM debug state
-* Input : -APBPeriph: APB peripherals(__RTC, __ADC,...)
- -NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_APBPeriphDebugConfig(u32 APBPeriph, FunctionalState NewState)
-{
- if (NewState==ENABLE)
- SCU->PECGR1 |=APBPeriph; /*APB peripheral clock enabled during ARM debug state*/
- else
- SCU->PECGR1 &=~APBPeriph; /*APB peripheral clock disabled during ARM debug state*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_AHBPeriphDebugConfig
-* Description : Enable or Disable Periph Clock during ARM debug state
-* Input : -AHBPeriph: AHB peripherals(__USB, __DMA,...)
- -NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_AHBPeriphDebugConfig(u32 AHBPeriph, FunctionalState NewState)
-{
- if (NewState==ENABLE)
- SCU->PECGR0 |=AHBPeriph; /*AHB peripheral clock enabled during ARM debug state*/
- else
- SCU->PECGR0 &=~AHBPeriph; /*AHB peripheral clock disabled during ARM debug state*/
-}
-/*******************************************************************************
-* Function Name : SCU_BRCLKDivisorConfig
-* Description : Sets the BRCLK divisor value
-* Input : BRCLK_Divisor
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_BRCLKDivisorConfig(u32 BRCLK_Divisor)
-{
- SCU->CLKCNTR &=SCU_BRCLK_Div1; /*Clear BRSEL bit*/
- if (BRCLK_Divisor!=SCU_BRCLK_Div1)
- SCU->CLKCNTR |= SCU_BRCLK_Div2; /*set bit BRSEL*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_TIMCLKSourceConfig
-* Description : Sets the TIMx clock source
-* Input : - TIMx : SCU_TIM01 or SCU_TIM23
-* - TIMCLK_Source = SCU_TIMCLK_EXT or SCU_TIMCLK_INT
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_TIMCLKSourceConfig(u8 TIMx, u32 TIMCLK_Source)
-{
- if (TIMx== SCU_TIM01) /*TIM01 clock source configuration*/
- {
- SCU->CLKCNTR &=0xFFFFDFFF;
- if (TIMCLK_Source == SCU_TIMCLK_EXT)
- SCU->CLKCNTR |=0x2000;
- }
- else
- {
- SCU->CLKCNTR &=0xFFFFBFFF; /*TIM23 clock source configuration*/
- if (TIMCLK_Source == SCU_TIMCLK_EXT)
- SCU->CLKCNTR |=0x4000;
- }
-}
-
-/*******************************************************************************
-* Function Name : SCU_TIMPresConfig
-* Description : Sets the TIMx Prescaler Value
-* Input : - TIMx : SCU_TIM01 or SCU_TIM23
-* - Prescaler (16 bit value)
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_TIMPresConfig(u8 TIMx, u16 Prescaler)
-{
- if (TIMx==SCU_TIM01) /*TIM01 Prescaler configuration*/
- SCU->SCR1 = Prescaler&0xFFFF;
- else
- SCU->SCR2 = Prescaler&0xFFFF; /*TIM23 Prescaler configuration*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_USBCLKConfig
-* Description : Configures the clock source for the 48MHz USBCLK
-* Input : USBCLK_Source: SCU_USBCLK_MCLK,SCU_USBCLK_MCLK2 or SCU_USBCLK_EXT
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_USBCLKConfig(u32 USBCLK_Source)
-{
- SCU->CLKCNTR &=SCU_USBCLK_MCLK; /*clear USBSEL[1:0] field*/
- if (USBCLK_Source!=SCU_USBCLK_MCLK)
- SCU->CLKCNTR |= USBCLK_Source; /*update field with USBCLK_Source*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_PHYCLKConfig
-* Description : Enable or Disable PHY clock output
-* Input : NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_PHYCLKConfig(FunctionalState NewState)
-{
- if (NewState==ENABLE)
- SCU->CLKCNTR |= 0x1000; /*enable MIIPHY clock*/
- else
- SCU->CLKCNTR &=~0x1000; /*disable MIIPHY clock*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_FMICLKDivisorConfig
-* Description : Set the FMI clock divisor
-* Input : FMICLK_Divisor: SCU_FMICLK_Div1 or SCU_FMICLK_DIV2
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_FMICLKDivisorConfig(u32 FMICLK_Divisor)
-{
- SCU->CLKCNTR &=SCU_FMICLK_Div1; /*FMICLK = RCLK*/
- if (FMICLK_Divisor!=SCU_FMICLK_Div1)
- SCU->CLKCNTR |=SCU_FMICLK_Div2; /*FMICLK = RCLK/2 */
-}
-
-/*******************************************************************************
-* Function Name : SCU_EMIBCLKDivisorConfig
-* Description : Set the EMI Bus clock divisor: EMIBCLK = HCLK or HCLK/2
-* Input : SCU_EMICLK: SCU_EMIBCLK_Div1 , SCU_EMIBCLK_Div2
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_EMIBCLKDivisorConfig(u32 SCU_EMIBCLK)
-{
- SCU->CLKCNTR &=SCU_EMIBCLK_Div1; /*EMIBCLK = HCLK */
- if (SCU_EMIBCLK!=SCU_EMIBCLK_Div1)
- SCU->CLKCNTR |= SCU_EMIBCLK_Div2; /*EMIBCLK = HCLK/2 */
-}
-
-/*******************************************************************************
-* Function Name : SCU_EMIModeConfig
-* Description : Configure the EMI as Multiplexed or Demultiplexed
-* Input : SCU_EMIMODE : SCU_EMI_MUX or SCU_EMI_DEMUX
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_EMIModeConfig(u32 SCU_EMIMODE)
-{
- SCU->SCR0 &=SCU_EMI_MUX; /*EMI mode = Multiplexed*/
- if (SCU_EMIMODE!=SCU_EMI_MUX)
- SCU->SCR0 |= SCU_EMI_DEMUX; /*EMI mode = Demultiplexed*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_EMIALEConfig
-* Description : Configure the ALE signal (length & polarity)
-* Input : -SCU_EMIALE_LEN : SCU_EMIALE_LEN1 or SCU_EMIALE_LEN2
-* -SCU_EMIALE_POL : SCU_EMIALE_POLLow or SCU_EMI_POLHigh
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_EMIALEConfig(u32 SCU_EMIALE_LEN, u32 SCU_EMIALE_POL)
-{
- /*Configure EMI ALE Length*/
- SCU->SCR0 &=SCU_EMIALE_LEN1;
- if (SCU_EMIALE_LEN!=SCU_EMIALE_LEN1)
- SCU->SCR0 |= SCU_EMIALE_LEN2;
-
- /*Configure EMI ALE POL*/
- SCU->SCR0 &=SCU_EMIALE_POLLow;
- if (SCU_EMIALE_POL!=SCU_EMIALE_POLLow)
- SCU->SCR0 |= SCU_EMIALE_POLHigh;
-}
-
-/*******************************************************************************
-* Function Name : SCU_ITConfig
-* Description : ENBALE or DISABLE an SCU interrupt
-* Input : -SCU_IT: interrupt mask
-* -NewState: ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_ITConfig(u32 SCU_IT, FunctionalState NewState)
-{
- if (NewState==ENABLE)
- SCU->ITCMSK&=~SCU_IT; /*IT enable */
- else
- SCU->ITCMSK|=SCU_IT; /*IT disable( mask)*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_GetFlagStatus
-* Description : Returns flag status
-* Input : SCU_Flag
-* Output : NONE
-* Return : SET or RESET
-*******************************************************************************/
-FlagStatus SCU_GetFlagStatus(u32 SCU_Flag)
-{
- if (SCU->SYSSTATUS&SCU_Flag)
- return SET;
- else return RESET;
-}
-
-/*******************************************************************************
-* Function Name : SCU_ClearFlag
-* Description : Clears a SYSTATUS Flag
-* Input : SCU_Flag
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_ClearFlag(u32 SCU_Flag)
-{
- SCU->SYSSTATUS = SCU_Flag;
-}
-/*******************************************************************************
-* Function Name : SCU_GetPLLfreqValue
-* Description : Gets the current PLL frequency
-* Input : None
-* Output : None
-* Return : PLL frequency (KHz)
-*******************************************************************************/
-u32 SCU_GetPLLFreqValue(void)
-{
- u8 PLL_M;
- u8 PLL_N;
- u8 PLL_P;
-
- PLL_M = SCU->PLLCONF&0xFF;
- PLL_N = (SCU->PLLCONF&0xFF00)>>8;
- PLL_P = (SCU->PLLCONF&0x70000)>>16;
-
- if ((PLL_M>0)&&(PLL_N>0))
- return (u32)(((_Main_Crystal*2)*PLL_N)/(PLL_M<<PLL_P));
-
- else return 0;
-}
-/*******************************************************************************
-* Function Name : SCU_GetMCLKFreqValue
-* Description : Gets the current MCLK frequency
-* Input : None
-* Output : None
-* Return : MCLK frequency (KHz)
-*******************************************************************************/
-u32 SCU_GetMCLKFreqValue(void)
-{
- if ((SCU->CLKCNTR&0x3) == 0x2) return (u32)(_Main_Crystal);
- if ((SCU->CLKCNTR&0x3) == 0x1) return (u32)(32);
- else return (SCU_GetPLLFreqValue());
-}
-
-/*******************************************************************************
-* Function Name : SCU_GetRCLKFreqValue
-* Description : Gets the current RCLK frequency
-* Input : None
-* Output : None
-* Return : RCLK frequency (KHz)
-*******************************************************************************/
-u32 SCU_GetRCLKFreqValue(void)
-{
- u8 RCLK_Div;
- RCLK_Div = (SCU->CLKCNTR&0x1C)>>2;
- if (RCLK_Div==0x5) RCLK_Div=10;
- return (u32)(SCU_GetMCLKFreqValue() >>RCLK_Div);
-}
-
-/*******************************************************************************
-* Function Name : SCU_GetHCLKFreqValue
-* Description : Gets the current PCLK frequency
-* Input : None
-* Output : None
-* Return : HCLK frequency (KHz)
-*******************************************************************************/
-u32 SCU_GetHCLKFreqValue(void)
-{
- u8 HCLK_Div;
- HCLK_Div = (SCU->CLKCNTR&0x60)>>5;
- return (u32)(SCU_GetRCLKFreqValue() >>HCLK_Div);
-}
-
-/*******************************************************************************
-* Function Name : SCU_GetPCLKFreqValue
-* Description : Gets the current HCLK frequency
-* Input : None
-* Output : None
-* Return : PCLK frequency (KHz)
-*******************************************************************************/
-u32 SCU_GetPCLKFreqValue(void)
-{
- u8 PCLK_Div;
- PCLK_Div = (SCU->CLKCNTR&0x180)>>7;
- return (u32)(SCU_GetRCLKFreqValue() >>PCLK_Div);
-}
-
-/*******************************************************************************
-* Function Name : SCU_WakeUpLineConfig
-* Description : Configures an External interrupt as WakeUp line
-* Input : EXTint : 0 -> 31
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_WakeUpLineConfig(u8 EXTint)
-{
- if (EXTint < 8)
- {
- SCU->WKUPSEL&=~0x7;
- SCU->WKUPSEL|=EXTint;
- }
- else if (EXTint<16)
- {
- SCU->WKUPSEL&=~0x38;
- SCU->WKUPSEL|=(EXTint-8)<<3;
- }
- else if (EXTint<24)
- {
- SCU->WKUPSEL&=~0x1C0;
- SCU->WKUPSEL|=(EXTint-16)<<6;
- }
- else
- {
- SCU->WKUPSEL&=~0xE00;
- SCU->WKUPSEL|=(EXTint-24)<<9;
- }
-}
-
-/*******************************************************************************
-* Function Name : SCU_SpecIntRunModeConfig
-* Description : Enables or Disables the Special Run mode
-* Input : newstate = ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_SpecIntRunModeConfig(FunctionalState NewState)
-{
- if (NewState == ENABLE)
- SCU->PWRMNG |=0x8;
- else
- SCU->PWRMNG &=~0x8;
-}
-/*******************************************************************************
-* Function Name : SCU_EnterIdleMode
-* Description : Enters in Idle mode
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_EnterIdleMode(void)
-{
- SCU->PWRMNG |=0x1;
-}
-/*******************************************************************************
-* Function Name : SCU_EnterSleepMode
-* Description : Enters in Sleep mode
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_EnterSleepMode(void)
-{
- SCU->PWRMNG |=0x2;
-}
-
-/*******************************************************************************
-* Function Name : SCU_UARTIrDAConfig
-* Description : Enable or Disable the Irda mode for UARTx
-* Input : - UARTx :x=0,1 or 2
-* - UART_IrDA_Mode : SCU_UARTMode_IrDA or SCU_UARTMode_UART
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_UARTIrDASelect(UART_TypeDef * UARTx, u8 UART_IrDA_Mode)
-{
- if (UART_IrDA_Mode == SCU_UARTMode_IrDA)
- {
- if (UARTx== UART0) SCU->SCR0 |=0x400;
- else if (UARTx==UART1) SCU->SCR0 |=0x800;
- else SCU->SCR0 |=0x1000;
- }
- else
- {
- if (UARTx== UART0) SCU->SCR0 &=~0x400;
- else if (UARTx==UART1) SCU->SCR0 &=~0x800;
- else SCU->SCR0 &=~0x1000;
- }
-}
-/*******************************************************************************
-* Function Name : SCU_PFQBCCmd
-* Description : Enable or Disable PFQBC
-* Input : NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_PFQBCCmd(FunctionalState NewState)
-{
- if (NewState==ENABLE)
- SCU->SCR0 |=0x1;
- else SCU->SCR0 &=~0x1;
-}
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_complex_startup/src/91x_ssp.c b/uc_str912/prj_blinky_complex_startup/src/91x_ssp.c
deleted file mode 100644
index 06bf30c..0000000
--- a/uc_str912/prj_blinky_complex_startup/src/91x_ssp.c
+++ /dev/null
@@ -1,469 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_ssp.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the SSP software functions.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_ssp.h"
-#include "91x_scu.h"
-
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-
-/* SSP peripheral Enable */
-#define SSP_Enable 0x0002
-#define SSP_Disable 0xFFFD
-
-/* SSP Loop Back Mode Enable */
-#define SSP_LoopBackMode_Enable 0x0001
-#define SSP_LoopBackMode_Disable 0xFFFE
-
-/* SSP Flag Mask */
-#define SSP_Flag_Mask 0x001F
-
-/* SSP DMA transmit/ receive enable/disable Masks */
-#define SSP_DMA_TransmitEnable 0x0002
-#define SSP_DMA_TransmitDisable 0xFFFD
-#define SSP_DMA_ReceiveEnable 0x0001
-#define SSP_DMA_ReceiveDisable 0xFFFE
-
-/* SSP Masks */
-#define SSP_FrameFormat_Mask 0xFFCF
-#define SSP_DataSize_Mask 0xFFF0
-#define SSP_ClockRate_Mask 0x00FF
-#define SSP_ClockPrescaler_Mask 0xFF00
-
-/* Private function prototypes -----------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-
-/*******************************************************************************
-* Function Name : SSP_DeInit
-* Description : Deinitializes the SSPx peripheral registers to their default
-* reset values.
-* Input : SSPx: where x can be 0 or 1 to select the SSP peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void SSP_DeInit(SSP_TypeDef* SSPx)
-{
- if(SSPx == SSP0)
- {
- /* Reset the SSP0 registers values*/
- SCU_APBPeriphReset(__SSP0,ENABLE);
- SCU_APBPeriphReset(__SSP0,DISABLE);
- }
- else if (SSPx == SSP1)
- {
- /* Reset the SSP1 registers values*/
- SCU_APBPeriphReset(__SSP1,ENABLE);
- SCU_APBPeriphReset(__SSP1,DISABLE);
- }
-}
-
-/*******************************************************************************
-* Function Name : SSP_Init
-* Description : Initializes the SSPx peripheral according to the specified
-* parameters in the SSP_InitTypeDef structure.
-* Input : - SSPx: where x can be 0 or 1 to select the SSP peripheral.
-* - SSP_InitStruct: pointer to a SSP_InitTypeDef structure that
-* contains the configuration information for the specified SSP
-* peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void SSP_Init(SSP_TypeDef* SSPx, SSP_InitTypeDef* SSP_InitStruct)
-{
- if(SSP_InitStruct->SSP_FrameFormat == SSP_FrameFormat_Motorola)
- {
- /* Set the Motorola frame format */
- SSPx->CR0 &= SSP_FrameFormat_Motorola;
- /* Configure the Clock polarity */
- if(SSP_InitStruct->SSP_CPOL == SSP_CPOL_High)
- {
- /* SCK is held high when no data is being transfered */
- SSPx->CR0 |= SSP_CPOL_High;
- }
- else
- {
- /* SCK is held low when no data is being transfered */
- SSPx->CR0 &= SSP_CPOL_Low;
- }
- /* Configure the Clock Phase */
- if(SSP_InitStruct->SSP_CPHA == SSP_CPHA_2Edge)
- {
- /* Data captured on second clock edge */
- SSPx->CR0 |= SSP_CPHA_2Edge;
- }
- else
- {
- /* Data captured on first clock edge */
- SSPx->CR0 &= SSP_CPHA_1Edge;
- }
- }
- /* Configure the Frame format */
- else
- {
- /* Clear the FRF[1:0] bits */
- SSPx->CR0 &= SSP_FrameFormat_Mask;
- /* Set the TI frame format */
- SSPx->CR0 |= SSP_InitStruct->SSP_FrameFormat;
- }
- /* Configure the Mode */
- if(SSP_InitStruct->SSP_Mode == SSP_Mode_Slave)
- {
- /* Set the slave mode */
- SSPx->CR1 |= SSP_Mode_Slave;
- /* Configure the Slave output */
- if(SSP_InitStruct->SSP_SlaveOutput == SSP_SlaveOutput_Disable)
- {
- /* Slave output disabled */
- SSPx->CR1 |= SSP_SlaveOutput_Disable;
- }
- else
- {
- /* Slave output enabled */
- SSPx->CR1 &= SSP_SlaveOutput_Enable;
- }
- }
- else
- {
- /* Set the master mode */
- SSPx->CR1 &= SSP_Mode_Master;
- /* Clear clock rate SCR[7:0] bits */
- SSPx->CR0 &= SSP_ClockRate_Mask;
- /* Set the serial clock rate */
- SSPx->CR0 |= (SSP_InitStruct->SSP_ClockRate<<8);
- /* Clear clock prescaler CPSDVSR[7:0] bits */
- SSPx->PR &= SSP_ClockPrescaler_Mask;
- /* Set the serial clock prescaler */
- SSPx->PR |= SSP_InitStruct->SSP_ClockPrescaler;
- }
-
- /* Clear data size DSS[3:0] bits */
- SSPx->CR0 &= SSP_DataSize_Mask;
- /* Set the data size */
- SSPx->CR0 |= SSP_InitStruct->SSP_DataSize;
-}
-/*******************************************************************************
-* Function Name : SSP_StructInit
-* Description : Fills in a SSP_InitTypeDef structure with the reset value of
-* each parameter.
-* Input : SSP_InitStruct : pointer to a SSP_InitTypeDef structure
- which will be initialized.
-* Output : None
-* Return : None
-*******************************************************************************/
-void SSP_StructInit(SSP_InitTypeDef* SSP_InitStruct)
-{
- /* Initialize the SSP_FrameFormat member */
- SSP_InitStruct->SSP_FrameFormat = SSP_FrameFormat_Motorola;
-
- /* Initialize the SSP_Mode member */
- SSP_InitStruct->SSP_Mode = SSP_Mode_Master;
-
- /* Initialize the SSP_CPOL member */
- SSP_InitStruct->SSP_CPOL = SSP_CPOL_Low;
-
- /* Initialize the SSP_CPHA member */
- SSP_InitStruct->SSP_CPHA = SSP_CPHA_1Edge;
-
- /* Initialize the SSP_DataSize member */
- SSP_InitStruct->SSP_DataSize = SSP_DataSize_8b;
-
- /* Initialize the SSP_SlaveOutput member */
- SSP_InitStruct->SSP_SlaveOutput = SSP_SlaveOutput_Enable;
-
- /* Initialize the SSP_ClockRate member */
- SSP_InitStruct->SSP_ClockRate = 0;
-
- /* Initialize the SSP_ClockPrescaler member */
- SSP_InitStruct->SSP_ClockPrescaler = 0;
-}
-
-/*******************************************************************************
-* Function Name : SSP_Cmd
-* Description : Enables or disables the specified SSP peripheral.
-* Input : - SSPx: where x can be 0 or 1 to select the SSP peripheral.
-* - NewState: new state of the SSPx peripheral. This parameter
-* can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void SSP_Cmd(SSP_TypeDef* SSPx, FunctionalState NewState)
-{
- if(NewState == ENABLE)
- {
- /* Enable the SSP peripheral */
- SSPx->CR1 |= SSP_Enable;
- }
- else
- {
- /* Disable the SSP peripheral */
- SSPx->CR1 &= SSP_Disable;
- }
-}
-
-/*******************************************************************************
-* Function Name : SSP_ITConfig
-* Description : Enables or disables the specified SSP interrupts.
-* Input : - SSPx: where x can be 0 or 1 to select the SSP peripheral.
-* - SSP_IT: specifies the SSP interrupts sources to be enabled
-* or disabled. This parameter can be any combination of the
-* following values:
-* - SSP_IT_TxFifo: Transmit FIFO half empty or less interrupt
-* - SSP_IT_RxFifo: Receive FIFO half full or less interrupt
-* - SSP_IT_RxTimeOut: Receive timeout interrupt
-* - SSP_IT_RxOverrun: Receive overrun interrupt
-* - NewState: new state of the specified SSP interrupts.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void SSP_ITConfig(SSP_TypeDef* SSPx, u16 SSP_IT, FunctionalState NewState)
-{
- if(NewState == ENABLE)
- {
- /* Enable the selected SSP interrupts */
- SSPx->IMSCR |= SSP_IT;
- }
- else
- {
- /* Disable the selected SSP interrupts */
- SSPx->IMSCR &= ~SSP_IT;
- }
-}
-
-/*******************************************************************************
-* Function Name : SSP_DMACmd
-* Description : Configures the SSP0 DMA interface.
-* Input : - SSPx: where x can be 0 or 1 to select the SSP peripheral.
-* - SSP_DMATransfert : specifies the DMA transfert to be
-* enabled or disabled. This parameter can be one of the
-* following values:
-* - SSP_DMA_Transmit: transmit Fifo DMA transfert
-* - SSP_DMA_Receive : receive Fifo DMA transfert
-* - NewState: new state of the DMA transfert.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void SSP_DMACmd(SSP_TypeDef* SSPx, u16 SSP_DMATransfert, FunctionalState NewState)
-{
- if(NewState == ENABLE)
- {
- if(SSP_DMATransfert == SSP_DMA_Transmit)
- {
- /* Enable DMA for the transmit FIFO */
- SSPx->DMACR |= SSP_DMA_TransmitEnable;
- }
- else
- {
- /* Enable DMA for the receive FIFO */
- SSPx->DMACR |= SSP_DMA_ReceiveEnable;
- }
- }
- else
- {
- if(SSP_DMATransfert == SSP_DMA_Transmit)
- {
- /* Disable DMA for the transmit FIFO */
- SSPx->DMACR &= SSP_DMA_TransmitDisable;
- }
- else
- {
- /* Disable DMA for the receive FIFO */
- SSPx->DMACR &= SSP_DMA_ReceiveDisable;
- }
- }
-}
-
-/*******************************************************************************
-* Function Name : SSP_SendData.
-* Description : Transmits a Data through the SSP peripheral.
-* Input : - SSPx: where x can be 0 or 1 to select the SSP peripheral.
-* - Data : Data to be transmitted.
-* Output : None
-* Return : None
-*******************************************************************************/
-void SSP_SendData(SSP_TypeDef* SSPx, u16 Data)
-{
- /* Write in the DR register the data to be sent */
- SSPx->DR = Data;
-}
-
-/*******************************************************************************
-* Function Name : SSP_ReceiveData.
-* Description : Returns the most recent received data by the SSP peripheral.
-* Input : SSPx: where x can be 0 or 1 to select the SSP peripheral.
-* Output : None
-* Return : The value of the received data.
-*******************************************************************************/
-u16 SSP_ReceiveData(SSP_TypeDef* SSPx)
-{
- /* Return the data in the DR register */
- return SSPx->DR;
-}
-
-/*******************************************************************************
-* Function Name : SSP_LoopBackMode
-* Description : Enable or disable the Loop back mode for the selected SSPx peripheral.
-* Input : - SSPx: where x can be 0 or 1 to select the SSP peripheral.
-* - NewState: new state of the Loop Back mode.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None.
-*******************************************************************************/
-void SSP_LoopBackMode(SSP_TypeDef* SSPx, FunctionalState NewState)
-{
- if(NewState == ENABLE)
- {
- /* Enable loop back mode */
- SSPx->CR1 |= SSP_LoopBackMode_Enable;
- }
- else
- {
- /* Disable loop back mode */
- SSPx->CR1 &= SSP_LoopBackMode_Disable;
- }
-}
-
-
-
-/*******************************************************************************
-* Function Name : SSP_GetFlagStatus
-* Description : Checks whether the specified SSP flag is set or not.
-* Input : - SSPx: where x can be 0 or 1 to select the SSP peripheral.
-* - SSP_FLAG: flag to check. This parameter can be one of the
-* following values:
-* - SSP_FLAG_Busy: busy flag
-* - SSP_FLAG_RxFifoFull: Receive FIFO full flag
-* - SSP_FLAG_RxFifoNotEmpty: Receive FIFO not empty flag
-* - SSP_FLAG_TxFifoNotFull: Transmit FIFO not full flag
-* - SSP_FLAG_TxFifoEmpty: Transmit FIFO empty flag
-* - SSP_FLAG_TxFifo: Transmit FIFO half empty or less flag
-* - SSP_FLAG_RxFifo: Receive FIFO half full or less flag
-* - SSP_FLAG_RxTimeOut: Receive timeout flag
-* - SSP_FLAG_RxOverrun: Receive overrun flag
-* Output : None
-* Return : The new state of SSP_Flag (SET or RESET).
-*******************************************************************************/
-FlagStatus SSP_GetFlagStatus(SSP_TypeDef* SSPx, u16 SSP_FLAG)
-{
- u32 SSPReg = 0, FlagPos = 0;
- u32 StatusReg = 0;
-
- /* Get the SSP register index */
- SSPReg = SSP_FLAG >> 5;
-
- /* Get the flag position */
- FlagPos = SSP_FLAG & SSP_Flag_Mask;
-
- /* Find the register of the flag to check */
- if(SSPReg == 1)
- {
- /* The flag to check is in SR register */
- StatusReg = SSPx->SR;
- }
- else if (SSPReg == 2)
- {
- /* The flag to check is in RISR register */
- StatusReg = SSPx->RISR;
- }
-
- /* Check the status of the specified SSP flag */
- if((StatusReg & (1 << FlagPos)) != RESET)
- {
- /* Return SET if the SSP flag is set */
- return SET;
- }
- else
- {
- /* Return RESET if the SSP flag is reset */
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : SSP_ClearFlag
-* Description : Clears the SSPx flags.
-* Input : - SSPx: where x can be 0 or 1 to select the SSP peripheral.
-* - SSP_FLAG: flags to clear. This parameter one of the
-* following values:
-* - SSP_FLAG_RxTimeOut: Receive timeout flag
-* - SSP_FLAG_RxOverrun: Receive overrun flag
-* Output : None
-* Return : None
-*******************************************************************************/
-void SSP_ClearFlag(SSP_TypeDef* SSPx, u16 SSP_FLAG)
-{
- u8 FlagPos = 0;
-
- /* Get the flag position */
- FlagPos = SSP_FLAG & SSP_Flag_Mask;
-
- /* Clear the selected SSP flag */
- SSPx->ICR = (1 << FlagPos);
-}
-
-/*******************************************************************************
-* Function Name : SSP_GetITStatus
-* Description : Checks whether the specified SSP interrupt flag is set or not.
-* Input : - SSPx: where x can be 0 or 1 to select the SSP peripheral.
-* - SSP_IT: interrupt flag to check. This parameter can be one
-* of the following values:
-* - SSP_IT_TxFifo: Transmit FIFO half empty or less interrupt
-* - SSP_IT_RxFifo: Receive FIFO half full or less interrupt
-* - SSP_IT_RxTimeOut: Receive timeout interrupt
-* - SSP_IT_RxOverrun: Receive overrun interrupt
-* Output : None
-* Return : The new state of SSP_IT flag (SET or RESET).
-*******************************************************************************/
-ITStatus SSP_GetITStatus(SSP_TypeDef* SSPx, u16 SSP_IT)
-{
- /* Check the status of the specified interrupt flag */
- if((SSPx->MISR & SSP_IT) != RESET)
- {
- /* Return SET if the SSP interrupt flag is set */
- return SET;
- }
- else
- {
- /* Return RESET if SSP interrupt flag is reset */
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : SSP_ClearITPendingBit
-* Description : Clears the pending interrupt flags.
-* Input : - SSPx: where x can be 0 or 1 to select the SSP peripheral.
-* - SSP_IT: interrupts pending bits to clear. This parameter
-* can be any combination of the following values:
-* - SSP_IT_RxTimeOut: Receive timeout interrupt
-* - SSP_IT_RxOverrun: Receive overrun interrupt
-* Output : None
-* Return : None
-*******************************************************************************/
-void SSP_ClearITPendingBit(SSP_TypeDef* SSPx, u16 SSP_IT)
-{
- /* Clear the selected SSP interrupts pending bits */
- SSPx->ICR = SSP_IT;
-}
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
-
diff --git a/uc_str912/prj_blinky_complex_startup/src/91x_tim.c b/uc_str912/prj_blinky_complex_startup/src/91x_tim.c
deleted file mode 100644
index 7957168..0000000
--- a/uc_str912/prj_blinky_complex_startup/src/91x_tim.c
+++ /dev/null
@@ -1,694 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_tim.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the TIM software functions.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_tim.h"
-
-/* Include of other module interface headers ---------------------------------*/
-/* Local includes ------------------------------------------------------------*/
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-
-/* TIM Bits Masks */
-
-#define TIM_PWM_MASK 0x0010
-#define TIM_OPM_MASK 0x0020
-#define TIM_OC1_ENABLE_MASK 0x0040
-#define TIM_OC1_DISABLE_MASK 0xFFBF
-#define TIM_OC2_ENABLE_MASK 0x0080
-#define TIM_OC2_DISABLE_MASK 0xFF7F
-
-#define TIM_OLVL1_SET_MASK 0x0100
-#define TIM_OLVL1_RESET_MASK 0xFEFF
-
-#define TIM_OLVL2_SET_MASK 0x0200
-#define TIM_OLVL2_RESET_MASK 0xFDFF
-
-#define TIM_ENABLE_MASK 0x8000
-#define TIM_DISABLE_MASK 0x7FFF
-
-#define TIM_DMA_CLEAR_MASK 0xCFFF
-
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/* Interface functions -------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/*******************************************************************************
-* Function Name : TIM_DeInit
-* Description : Initializes TIM peripheral control and registers to their
-* : default reset values.
-* Input : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void TIM_DeInit(TIM_TypeDef *TIMx)
-{
- if((TIMx == TIM0)||(TIMx == TIM1))
- {
- SCU_APBPeriphReset(__TIM01, DISABLE); /* TIM0 & TIM1 Reset's off */
- }
- else
- {
- SCU_APBPeriphReset(__TIM23, DISABLE); /* TIM2 & TIM3 Reset's off */
- }
-
- /* Set all the TIMx registers to thier default values */
- TIMx->OC1R = 0x8000;
- TIMx->OC2R = 0x8000;
- TIMx->CR1 = 0x0;
- TIMx->CR2 = 0x1;
- TIMx->CNTR = 0x1234;
- TIMx->SR = 0x0;
-}
-
-/*******************************************************************************
-* Function Name : TIM_StructInit
-* Description : Fills in a TIM_InitTypeDef structure with the reset value of
-* each parameter.
-* Input : TIM_InitStruct : pointer to a TIM_InitTypeDef structure
- which will be initialized.
-* Output : None
-* Return : None.
-*******************************************************************************/
-void TIM_StructInit(TIM_InitTypeDef *TIM_InitStruct)
-{
- TIM_InitStruct->TIM_Mode = 0x0000;
- TIM_InitStruct->TIM_OC1_Modes = 0x0000;
- TIM_InitStruct->TIM_OC2_Modes = 0x0000;
- TIM_InitStruct->TIM_Clock_Source = 0x0000;
- TIM_InitStruct->TIM_Clock_Edge = 0x0000;
- TIM_InitStruct->TIM_OPM_INPUT_Edge = 0x0000;
- TIM_InitStruct->TIM_ICAP1_Edge = 0x0000;
- TIM_InitStruct->TIM_ICAP2_Edge = 0x0000;
- TIM_InitStruct->TIM_Prescaler = 0x0000;
- TIM_InitStruct->TIM_Pulse_Level_1 = 0x0000;
- TIM_InitStruct->TIM_Pulse_Level_2 = 0x0000;
- TIM_InitStruct->TIM_Period_Level = 0x0000;
- TIM_InitStruct->TIM_Pulse_Length_1 = 0x0000;
- TIM_InitStruct->TIM_Pulse_Length_2 = 0x0000;
- TIM_InitStruct->TIM_Full_Period = 0x0000;
-}
-
-/*******************************************************************************
-* Function Name : TIM_Init
-* Description : Initializes TIM peripheral according to the specified
-* parameters in the TIM_InitTypeDef structure.
-* Input1 : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Input2 : TIM_InitStruct: pointer to a TIM_InitTypeDef structure that
-* contains the configuration information for the specified
-* TIM peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-
-void TIM_Init(TIM_TypeDef *TIMx, TIM_InitTypeDef *TIM_InitStruct)
-{
-/***************************** Clock configuration ****************************/
-
- if (TIM_InitStruct->TIM_Clock_Source == TIM_CLK_APB)
- {
- /* APB clock */
- TIMx->CR1 &= TIM_CLK_APB;
- }
- else
- {
- /* External/SCU clock */
- TIMx->CR1 |= TIM_CLK_EXTERNAL;
- if (TIM_InitStruct->TIM_Clock_Edge == TIM_CLK_EDGE_RISING)
- {
- /* Clock rising edge */
- TIMx->CR1 |= TIM_CLK_EDGE_RISING;
- }
- else
- {
- /* Clock falling edge */
- TIMx->CR1 &= TIM_CLK_EDGE_FALLING;
- }
- }
-
-/************************** Prescaler configuration ***************************/
-
- TIMx->CR2 =( TIMx->CR2 & 0xFF00 )|TIM_InitStruct->TIM_Prescaler ;
-
-/********************************** TIM Modes *********************************/
-
- switch ( TIM_InitStruct->TIM_Mode)
- {
-/******************************* PWM Input mode *******************************/
-
- case TIM_PWMI:
-
- /* Set the PWMI Bit */
- TIMx->CR1 |= TIM_PWMI;
-
- /* Set the first edge Level */
- if ( TIM_InitStruct->TIM_ICAP1_Edge == TIM_ICAP1_EDGE_RISING)
- {
- TIMx->CR1 |= TIM_ICAP1_EDGE_RISING;
- }
- else
- {
- TIMx->CR1 &= TIM_ICAP1_EDGE_FALLING;
- }
-
- /* Set the Second edge Level ( Opposite of the first level ) */
- if ( TIM_InitStruct->TIM_ICAP1_Edge == TIM_ICAP1_EDGE_RISING)
- {
- TIMx->CR1 &= TIM_ICAP2_EDGE_FALLING;
- }
- else
- {
- TIMx->CR1 |= TIM_ICAP2_EDGE_RISING;
- }
-
- break;
-
-/************************** Output compare channel 1 **************************/
-
- case TIM_OCM_CHANNEL_1:
-
- if (TIM_InitStruct->TIM_Pulse_Level_1 == TIM_HIGH)
- {
- TIMx->CR1 |= TIM_OLVL1_SET_MASK;
- }
- else
- {
- TIMx->CR1 &= TIM_OLVL1_RESET_MASK;
- }
-
- TIMx->OC1R = TIM_InitStruct->TIM_Pulse_Length_1;
-
- if (TIM_InitStruct->TIM_OC1_Modes == TIM_TIMING)
- {
- TIMx->CR1 &= TIM_OC1_DISABLE_MASK;
- }
- else
- {
- TIMx->CR1 |= TIM_OC1_ENABLE_MASK;
- }
-
- break;
-
-/************************** Output compare channel 2 **************************/
-
- case TIM_OCM_CHANNEL_2:
-
- if (TIM_InitStruct->TIM_Pulse_Level_2 == TIM_HIGH)
- {
- TIMx->CR1 |= TIM_OLVL2_SET_MASK;
- }
- else
- {
- TIMx->CR1 &= TIM_OLVL2_RESET_MASK;
- }
-
- TIMx->OC2R = TIM_InitStruct->TIM_Pulse_Length_2;
-
- if (TIM_InitStruct->TIM_OC2_Modes == TIM_TIMING)
- {
- TIMx->CR1 &= TIM_OC2_DISABLE_MASK;
- }
- else
- {
- TIMx->CR1 |= TIM_OC2_ENABLE_MASK;
- }
-
- break;
-
-/************************ Output compare channel 1 & 2 ************************/
-
- case TIM_OCM_CHANNEL_12:
-
- TIMx->OC2R = TIM_InitStruct->TIM_Pulse_Length_2;
- TIMx->OC1R = TIM_InitStruct->TIM_Pulse_Length_1;
-
- if (TIM_InitStruct->TIM_OC2_Modes == TIM_TIMING)
- {
- TIMx->CR1 &= TIM_OC2_DISABLE_MASK;
- }
- else
- {
- TIMx->CR1 |= TIM_OC2_ENABLE_MASK;
- }
-
- if (TIM_InitStruct->TIM_OC1_Modes == TIM_TIMING)
- {
- TIMx->CR1 &= TIM_OC1_DISABLE_MASK;
- }
- else
- {
- TIMx->CR1 |= TIM_OC1_ENABLE_MASK;
- }
-
- if (TIM_InitStruct->TIM_Pulse_Level_1 == TIM_HIGH)
- {
- TIMx->CR1 |= TIM_OLVL1_SET_MASK;
- }
- else
- {
- TIMx->CR1 &= TIM_OLVL1_RESET_MASK;
- }
-
- if (TIM_InitStruct->TIM_Pulse_Level_2 == TIM_HIGH)
- {
- TIMx->CR1 |= TIM_OLVL2_SET_MASK;
- }
- else
- {
- TIMx->CR1 &= TIM_OLVL2_RESET_MASK;
- }
-
- break;
-
-/********************************** PWM mode **********************************/
-
- case TIM_PWM:
-
- /* Set the Level During the pulse */
- if ( TIM_InitStruct->TIM_Pulse_Level_1 == TIM_HIGH)
- {
- TIMx->CR1 |= TIM_OLVL2_SET_MASK;
- }
- else
- {
- TIMx->CR1 &= TIM_OLVL2_RESET_MASK;
- }
-
- /* Set the Level after the pulse */
- if (TIM_InitStruct->TIM_Period_Level == TIM_HIGH)
- {
- TIMx->CR1 |= TIM_OLVL1_SET_MASK;
- }
- else
- {
- TIMx->CR1 &= TIM_OLVL1_RESET_MASK;
- }
-
- /* Set the OCAE */
- TIMx->CR1 |= TIM_OC1_ENABLE_MASK;
-
- /* Set the PWM Bit */
- TIMx->CR1 |= TIM_PWM_MASK;
-
- /* Set the Duty Cycle value */
- if ( TIM_InitStruct->TIM_Pulse_Length_1 < 5 )
- {
- TIM_InitStruct->TIM_Pulse_Length_1 = 4;
- }
-
- TIMx->OC1R = TIM_InitStruct->TIM_Pulse_Length_1 - 4;
-
- /* Set the Full Period */
- TIMx->OC2R = TIM_InitStruct->TIM_Full_Period - 4;
-
- break;
-
-/******************************* One pulse mode *******************************/
-
- case TIM_OPM:
-
- /* Set the Level During the pulse */
- if (TIM_InitStruct->TIM_Pulse_Level_1 == TIM_HIGH)
- {
- TIMx->CR1 |= TIM_OLVL2_SET_MASK;
- }
-
- /* Set the Level after the pulse */
- if (TIM_InitStruct->TIM_Period_Level == TIM_HIGH)
- {
- TIMx->CR1 |= TIM_OLVL1_SET_MASK;
- }
-
- /* Set the Activation Edge on the ICAP 1 */
- if (TIM_InitStruct->TIM_OPM_INPUT_Edge == TIM_OPM_EDGE_RISING)
- {
- TIMx->CR1 |= TIM_OPM_EDGE_RISING;
- }
-
- /* Set the Output Compare Function */
- TIMx->CR1 |= TIM_OC1_ENABLE_MASK;
-
- /* Set the One pulse mode */
- TIMx->CR1 |= TIM_OPM_MASK;
-
- /* Set the Pulse length */
- TIMx->OC1R = TIM_InitStruct->TIM_Pulse_Length_1;
-
- break;
-
-/*************************** Input capture channel 1 **************************/
-
- case TIM_ICAP_CHANNEL_1:
-
- if (TIM_InitStruct->TIM_ICAP1_Edge == TIM_ICAP1_EDGE_RISING)
- {
- TIMx->CR1 |= TIM_ICAP1_EDGE_RISING;
- }
- else
- {
- TIMx->CR1 &= TIM_ICAP1_EDGE_FALLING;
- }
-
- break;
-
-/*************************** Input capture channel 2 **************************/
-
- case TIM_ICAP_CHANNEL_2:
-
- if (TIM_InitStruct->TIM_ICAP2_Edge == TIM_ICAP2_EDGE_RISING)
- {
- TIMx->CR1 |= TIM_ICAP2_EDGE_RISING;
- }
- else
- {
- TIMx->CR1 &= TIM_ICAP2_EDGE_FALLING;
- }
-
- break;
-
-/************************* Input capture channel 1 & 2 ************************/
-
- case TIM_ICAP_CHANNEL_12:
- if (TIM_InitStruct->TIM_ICAP2_Edge == TIM_ICAP2_EDGE_RISING)
- {
- TIMx->CR1 |= TIM_ICAP2_EDGE_RISING;
- }
- else
- {
- TIMx->CR1 &= TIM_ICAP2_EDGE_FALLING;
- }
-
- if (TIM_InitStruct->TIM_ICAP1_Edge == TIM_ICAP1_EDGE_RISING)
- {
- TIMx->CR1 |= TIM_ICAP1_EDGE_RISING;
- }
- else
- {
- TIMx->CR1 &= TIM_ICAP1_EDGE_FALLING;
- }
-
- break;
-
- default:
- break;
- }
-}
-
-/*******************************************************************************
-* Function Name : TIM_CounterCmd
-* Description : Enables or disables TIMx Counter peripheral.
-* Input1 : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Input2 : TIM_operation: specifies the new state of the TIMx Counter.
-* This parameter can be one of the following values:
-* - TIM_START: Start the timer counter.
-* - TIM_STOP : Stop the timer counter.
-* - TIM_CLEAR: Clear the timer counter.
-* Output : None
-* Return : None
-*******************************************************************************/
-void TIM_CounterCmd(TIM_TypeDef *TIMx, TIM_CounterOperations TIM_operation)
-{
- switch (TIM_operation)
- {
- case TIM_START:
- TIMx->CR1 |= TIM_ENABLE_MASK;
- break;
-
- case TIM_STOP:
- TIMx->CR1 &= TIM_DISABLE_MASK;
- break;
-
- case TIM_CLEAR:
- TIMx->CNTR = 0x1234;
- break;
-
- default:
- break;
- }
-}
-
-/*******************************************************************************
-* Function Name : TIM_PrescalerConfig
-* Description : This routine is used to configure the TIMx prescaler value
-* (when using the APB clock).
-* Input1 : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Input2 : TIM_Prescaler: specifies the prescaler value. This parameter
-* can be a value from 0x0 to 0xFF.
-* Output : None
-* Return : None
-*******************************************************************************/
-void TIM_PrescalerConfig(TIM_TypeDef *TIMx, u8 TIM_Prescaler)
-{
- TIMx->CR2 &= 0xFF00;
- TIMx->CR2 |= TIM_Prescaler;
-
-}
-/*******************************************************************************
-* Function Name : TIM_GetPrescalerValue
-* Description : This routine is used to get the TIMx prescaler value
-* (when using the APB clock).
-* Input : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Output : None
-* Return : The prescaler value.
-*******************************************************************************/
-u8 TIM_GetPrescalerValue(TIM_TypeDef *TIMx)
-{
- return TIMx->CR2 & 0x00FF;
-}
-
-/*******************************************************************************
-* Function Name : TIM_GetCounterValue
-* Description : This routine is used to get the TIMx counter value.
-* Input : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Output : None
-* Return : The counter value.
-*******************************************************************************/
-u16 TIM_GetCounterValue(TIM_TypeDef *TIMx)
-{
- return TIMx->CNTR;
-}
-
-/*******************************************************************************
-* Function Name : TIM_GetICAP1Value
-* Description : This routine is used to get the Input Capture 1 value.
-* Input : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Output : None
-* Return : The Input Capture 1 value.
-*******************************************************************************/
-u16 TIM_GetICAP1Value(TIM_TypeDef *TIMx)
-{
- return TIMx->IC1R;
-}
-
-/*******************************************************************************
-* Function Name : TIM_GetICAP2Value
-* Description : This routine is used to get the Input Capture 2 value.
-* Input : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Output : None
-* Return : The Input Capture 2 value.
-*******************************************************************************/
-u16 TIM_GetICAP2Value(TIM_TypeDef *TIMx)
-{
- return TIMx->IC2R;
-}
-
-/*******************************************************************************
-* Function Name : TIM_SetPulse
-* Description : This routine is used to set the pulse value.
-* Input1 : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Input2 : TIM_Channel: specifies the needed channel.
-* This parameter can be one of the following values:
-* - TIM_PWM_OC1_Channel: PWM/Output Compare 1 Channel
-* - TIM_OC2_Channel : Output Compare 2 Channel
-* Input3 : TIM_Pulse: specifies the new pulse value.
-* Output : None
-* Return : None
-*******************************************************************************/
-void TIM_SetPulse(TIM_TypeDef *TIMx,u16 TIM_Channel ,u16 TIM_Pulse)
-{
- if (TIM_Channel == TIM_PWM_OC1_Channel)
- {
- TIMx->OC1R = TIM_Pulse;
- }
- else
- {
- TIMx->OC2R = TIM_Pulse;
- }
-}
-/*******************************************************************************
-* Function Name : TIM_GetFlagStatus
-* Description : Checks whether the specified TIMx flag is set or not.
-* Input1 : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Input2 : TIM_Flag: specifies the flag to check.
-* This parameter can be one of the following values:
-* - TIM_FLAG_IC1: Input Capture Channel 1 Flag
-* - TIM_FLAG_IC2: Input Capture Channel 2 Flag
-* - TIM_FLAG_TO : Timer Overflow Flag
-* - TIM_FLAG_OC1: Output Compare Channel 1 Flag
-* - TIM_FLAG_OC2: Output Compare Channel 2 Flag
-* Output : None
-* Return : The NewState of the TIM_Flag (SET or RESET).
-*******************************************************************************/
-FlagStatus TIM_GetFlagStatus(TIM_TypeDef *TIMx, u16 TIM_Flag)
-{
- if((TIMx->SR & TIM_Flag) == RESET)
- {
- return RESET;
- }
- else
- {
- return SET;
- }
-}
-
-/*******************************************************************************
-* Function Name : TIM_ClearFlag
-* Description : Clears the TIM Flag passed as a parameter.
-* Input1 : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Input2 : TIM_Flag: specifies the flag to clear.
-* This parameter can be one of the following values:
-* - TIM_FLAG_IC1: Input Capture Channel 1 Flag
-* - TIM_FLAG_IC2: Input Capture Channel 2 Flag
-* - TIM_FLAG_TO : Timer Overflow Flag
-* - TIM_FLAG_OC1: Output Compare Channel 1 Flag
-* - TIM_FLAG_OC2: Output Compare Channel 2 Flag
-* Output : None
-* Return : None
-*******************************************************************************/
-void TIM_ClearFlag(TIM_TypeDef *TIMx, u16 TIM_Flag)
-{
- /* Clear TIM_Flag */
- TIMx->SR &= ~TIM_Flag;
-}
-
-/*******************************************************************************
-* Function Name : TIM_GetPWMIPulse
-* Description : This routine is used to get the Pulse value in PWMI Mode.
-* Input : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Output : None
-* Return : The pulse value.
-*******************************************************************************/
-u16 TIM_GetPWMIPulse(TIM_TypeDef *TIMx)
-{
- return TIMx->IC2R;
-}
-
-/*******************************************************************************
-* Function Name : TIM_GetPWMIPeriod
-* Description : This routine is used to get the Period value in PWMI Mode.
-* Input : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Output : None
-* Return : The period value.
-*******************************************************************************/
-u16 TIM_GetPWMIPeriod(TIM_TypeDef *TIMx)
-{
- return TIMx->IC1R;
-}
-
-/*******************************************************************************
-* Function Name : TIM_ITConfig
-* Description : Configures the Timer interrupt source.
-* Input1 : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Input2 : TIM_IT: specifies the TIM interrupt source to be enabled.
-* This parameter can be one of the following values:
-* - TIM_IT_IC1: Input Capture 1 Interrupt source.
-* - TIM_IT_OC1: Output Compare 1 Interrupt source.
-* - TIM_IT_TO : Timer Overflow Interrupt source.
-* - TIM_IT_IC2: Input Capture 2 Interrupt source.
-* - TIM_IT_OC2: Output Compare 2 Interrupt source.
-* Input3 : TIM_Newstate: specifies the new state of the TIMx IT.
-* This parameter can be one of the following values:
-* - ENABLE : Enable the needed interrupt.
-* - DISABLE: Disable the needed interrupt.
-* Output : None
-* Return : None
-*******************************************************************************/
-void TIM_ITConfig(TIM_TypeDef *TIMx, u16 TIM_IT, FunctionalState TIM_Newstate)
-{
- if(TIM_Newstate == ENABLE)
- {
- TIMx->CR2 = (TIMx->CR2 & 0x00FF) | TIM_IT;
- }
- else
- {
- TIMx->CR2 &= ~TIM_IT;
- }
-}
-
-/*******************************************************************************
-* Function Name : TIM_DMAConfig
-* Description : Configures the Timer DMA source.
-* Input1 : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Input2 : TIM_DMA_Souces: specifies the TIM DMA source to be selected.
-* This parameter can be one of the following values:
-* - TIM_DMA_IC1: Input Capture 1 DMA source.
-* - TIM_DMA_OCA1 Output Compare 1 DMA source.
-* - TIM_DMA_TO: Timer Overflow DMA source.
-* - TIM_DMA_IC2: Input Capture 2 DMA source.
-* - TIM_DMA_OC2: Output Compare 2 DMA source.
-* Output : None
-* Return : None
-*******************************************************************************/
-void TIM_DMAConfig(TIM_TypeDef *TIMx, u16 TIM_DMA_Sources)
-{
- /* Reset the DMAS[1:0] bits */
- TIMx->CR1 &= TIM_DMA_CLEAR_MASK;
- /* Set the DMAS[1:0] bits according to TIM_DMA_Sources parameter */
- TIMx->CR1 |= TIM_DMA_Sources;
-}
-
-/*******************************************************************************
-* Function Name : TIM_DMACmd
-* Description : Enables or disables TIMx DMA peripheral.
-* Input1 : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Input2 : TIM_Newstate: new state of the TIMx DMA peripheral
-* This parameter can be one of the following values:
-* - ENABLE : Enable the TIMx DMA.
-* - DISABLE: Disable the TIMx DMA.
-* Output : None
-* Return : None
-*******************************************************************************/
-void TIM_DMACmd(TIM_TypeDef *TIMx, FunctionalState TIM_Newstate)
-{
- if (TIM_Newstate == ENABLE)
- {
- TIMx->CR2 |= TIM_DMA_ENABLE;
- }
- else
- {
- TIMx->CR2 &= TIM_DMA_DISABLE;
- }
-}
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_complex_startup/src/91x_uart.c b/uc_str912/prj_blinky_complex_startup/src/91x_uart.c
deleted file mode 100644
index c31803b..0000000
--- a/uc_str912/prj_blinky_complex_startup/src/91x_uart.c
+++ /dev/null
@@ -1,658 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_uart.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the UART software functions.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_uart.h"
-#include "91x_scu.h"
-
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-/* UART IrDA Mask */
-#define UART_IrDA_Disable_Mask 0xFFFD /* IrDA Disable Mask */
-#define UART_IrDA_Enable_Mask 0x0002 /* IrDA Enable Mask */
-#define IrDA_LowPower_Enable_Mask 0x0004 /*IrDA lower power mode enable*/
-#define IrDA_LowPower_Disable_Mask 0xFFFB /*IrDA lower power mode enable*/
-
-/* UART Mask */
-#define UART_Enable_Mask 0x0001 /* UART Enable Mask */
-#define UART_Disable_Mask 0xFFFE /* UART Disable Mask */
-
-/* UART LoopBack */
-#define UART_LoopBack_Disable_Mask 0xFF7F /* LoopBack Disable Mask */
-#define UART_LoopBack_Enable_Mask 0x0080 /* LoopBack Enable Mask */
-
-#define UART_WordLength_Mask 0xFF9F /* UART Word Length Mask */
-#define UART_Parity_Mask 0xFF79 /* UART Parity Mask */
-#define UART_HardwareFlowControl_Mask 0x3FFF /* UART Hardware Flow Control Mask */
-#define UART_TxRxFIFOLevel_Mask 0xFFC0 /* UART Tx Rx FIFO Level Mask */
-#define UART_BreakChar_Mask 0x0001 /* UART Break Character send Mask*/
-#define UART_FLAG_Mask 0x1F /* UART Flag Mask */
-#define UART_Mode_Mask 0xFCFF /* UART Mode Mask */
-#define UART_RTS_LowLevel_Mask 0x0800 /* RTS signal is low */
-#define UART_RTS_HighLevel_Mask 0xF7FF /* RTS signal is High */
-#define UART_DTR_LowLevel_Mask 0x0400 /* DTR signal is low */
-#define UART_DTR_HighLevel_Mask 0xFBFF /* DTR signal is High */
-#define UART_ClearFlag_Mask 0xAA /* Clear Flag Mask */
-
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-
- /*******************************************************************************
-* Function Name : UART_DeInit
-* Description : Deinitializes the UARTx peripheral registers
-* to their default reset values.
-* Input : UARTx: where x can be 0,1 or 2 to select the UART peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_DeInit(UART_TypeDef* UARTx)
-{
- /* Reset the UARTx registers values */
- if(UARTx == UART0)
- {
- SCU_APBPeriphReset(__UART0,ENABLE);
- SCU_APBPeriphReset(__UART0,DISABLE);
- }
- else if(UARTx == UART1)
- {
- SCU_APBPeriphReset(__UART1,ENABLE);
- SCU_APBPeriphReset(__UART1,DISABLE);
- }
- else if(UARTx == UART2)
- {
- SCU_APBPeriphReset(__UART2,ENABLE);
- SCU_APBPeriphReset(__UART2,DISABLE);
- }
-}
-
-/*******************************************************************************
-* Function Name : UART_Init
-* Description : Initializes the UARTx peripheral according to the specified
-* parameters in the UART_InitStruct .
-* Input : - UARTx: where x can be 0,1or 2 to select the UART peripheral.
-* - UART_InitStruct: pointer to a UART_InitTypeDef structure
-* that contains the configuration information for the
-* specified UART peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_Init(UART_TypeDef* UARTx, UART_InitTypeDef* UART_InitStruct)
-{
-
- u64 UART_MainClock = 0;
- u32 IntegerDivider = 0;
- u32 FractionalDivider = 0;
-
- /* Clear the LCR[6:5] bits */
- UARTx->LCR &= UART_WordLength_Mask;
- /* Set the LCR[6:5] bits according to UART_WordLength value */
- UARTx->LCR |= UART_InitStruct->UART_WordLength;
-
- /* Choose Stop Bits */
- if(UART_InitStruct->UART_StopBits == UART_StopBits_2)
- {
- /* 2 Stop Bit */
- UARTx->LCR |= UART_StopBits_2;
- }
- else
- {
- /* One Stop Bits */
- UARTx->LCR &= UART_StopBits_1;
- }
-
- /* Configure the Parity */
- /* Clear the LCR[7]and LCR[2:1] bits */
- UARTx->LCR &= UART_Parity_Mask;
- /* Set the LCR[7]and LCR[2:1] bits according to UART_Parity value */
- UARTx->LCR |= UART_InitStruct->UART_Parity;
-
- /* Configure the BaudRate */
- UART_MainClock = (SCU_GetMCLKFreqValue())*1000;
- if((SCU->CLKCNTR & 0x200) != 0x200)
- {
- UART_MainClock = UART_MainClock/2;
- }
- /* Determine the integer part */
- IntegerDivider = ((100) * (UART_MainClock) / (16 * (UART_InitStruct->UART_BaudRate)));
- UARTx->IBRD = IntegerDivider / 100;
-
- /* Determine the fractional part */
- FractionalDivider = IntegerDivider - (100 * (UARTx->IBRD));
- UARTx->FBRD = ((((FractionalDivider * 64) + 50) / 100));
-
- /* Choose the Hardware Flow Control */
- /* Clear the CR[15:14] bits */
- UARTx->CR &= UART_HardwareFlowControl_Mask;
- /* Set the CR[15:14] bits according to UART_HardwareFlowControl value */
- UARTx->CR |= UART_InitStruct->UART_HardwareFlowControl;
-
- /* Configure the UART mode */
- /* Clear the CR[9:8] bits */
- UARTx->CR &= UART_Mode_Mask;
- /* Set the CR[9:8] bits according to UART_Mode value */
- UARTx->CR |= UART_InitStruct->UART_Mode;
-
- /* Enable or disable the FIFOs */
- /* Set the FIFOs Levels */
- if(UART_InitStruct->UART_FIFO == UART_FIFO_Enable)
- {
- /* Enable the FIFOs */
- UARTx->LCR |= UART_FIFO_Enable;
-
- /* Clear TXIFLSEL and RXIFLSEL bits */
- UARTx->IFLS &= UART_TxRxFIFOLevel_Mask;
-
- /* Set RXIFLSEL bits according to UART_RxFIFOLevel value */
- UARTx->IFLS |= (UART_InitStruct->UART_RxFIFOLevel << 3);
-
- /* Set TXIFLSEL bits according to UART_TxFIFOLevel value */
- UARTx->IFLS |= UART_InitStruct->UART_TxFIFOLevel;
- }
- else
- {
- /* Disable the FIFOs */
- UARTx->LCR &= UART_FIFO_Disable;
- }
-}
-
-/*******************************************************************************
-* Function Name : UART_StructInit
-* Description : Fills each UART_InitStruct member with its reset value.
-* Input : UART_InitStruct: pointer to a UART_InitTypeDef structure which
-* will be initialized.
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_StructInit(UART_InitTypeDef* UART_InitStruct)
-{
- /* Reset the UART_InitStruct members */
- UART_InitStruct->UART_WordLength = UART_WordLength_8D;
- UART_InitStruct->UART_StopBits = UART_StopBits_1;
- UART_InitStruct->UART_Parity = UART_Parity_Odd ;
- UART_InitStruct->UART_BaudRate = 9600;
- UART_InitStruct->UART_HardwareFlowControl = UART_HardwareFlowControl_None;
- UART_InitStruct->UART_Mode = UART_Mode_Tx_Rx;
- UART_InitStruct->UART_FIFO = UART_FIFO_Enable;
- UART_InitStruct->UART_TxFIFOLevel = UART_FIFOLevel_1_2;
- UART_InitStruct->UART_RxFIFOLevel = UART_FIFOLevel_1_2;
-}
-
-/*******************************************************************************
-* Function Name : UART_Cmd
-* Description : Enables or disables the specified UART peripheral.
-* Input : - UARTx: where x can be 0,1 or 2 to select the UART peripheral
-* - NewState: new state of the UARTx peripheral.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_Cmd(UART_TypeDef* UARTx, FunctionalState NewState)
-{
- if (NewState == ENABLE)
- {
- /* Enable the selected UART by setting the UARTEN bit in the CR register */
- UARTx->CR |= UART_Enable_Mask;
- }
- else
- {
- /* Disable the selected UART by clearing the UARTEN bit in the CR register */
- UARTx->CR &= UART_Disable_Mask;
- }
-}
-
-/*******************************************************************************
-* Function Name : UART_ITConfig
-* Description : Enables or disables the specified UART interrupts.
-* Input : - UARTx: where x can be 0,1 or 2 to select the UART peripheral
-* - UART_IT: specifies the UART interrupts sources to be
-* enabled or disabled. This parameter can be any combination
-* of the following values:
-* - UART_IT_OverrunError: Overrun Error interrupt
-* - UART_IT_BreakError: Break Error interrupt
-* - UART_IT_ParityError: Parity Error interrupt
-* - UART_IT_FrameError: Frame Error interrupt
-* - UART_IT_ReceiveTimeOut: Receive Time Out interrupt
-* - UART_IT_Transmit: Transmit interrupt
-* - UART_IT_Receive: Receive interrupt
-* - UART_IT_DSR: DSR interrupt
-* - UART_IT_DCD: DCD interrupt
-* - UART_IT_CTS: CTS interrupt
-* - UART_IT_RI: RI interrupt
-* - NewState: new state of the UARTx peripheral.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_ITConfig(UART_TypeDef* UARTx, u16 UART_IT, FunctionalState NewState)
-{
- if(NewState == ENABLE)
- {
- /* Enables the selected interrupts */
- UARTx->IMSC |= UART_IT;
- }
- else
- {
- /* Disables the selected interrupts */
- UARTx->IMSC &= ~UART_IT;
- }
-}
-
-/*******************************************************************************
-* Function Name : UART_DMAConfig
-* Description : Configures the UARTx’s DMA interface.
-* Input : - UARTx: where x can be 1 or 2 to select the UART peripheral
-* - UART_DMAOnError: specifies the DMA on error request.
-* This parameter can be:
-* - UART_DMAOnError_Enable: DMA receive request enabled
-* when the UART error interrupt is asserted.
-* - UART_DMAOnError_Disable: DMA receive request disabled
-* when the UART error interrupt is asserted.
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_DMAConfig(UART_TypeDef* UARTx, u16 UART_DMAOnError)
-{
- if(UART_DMAOnError == UART_DMAOnError_Enable)
- {
- UARTx->DMACR &= UART_DMAOnError_Enable;
- }
- else
- {
- UARTx->DMACR |= UART_DMAOnError_Disable;
- }
-}
-
-/*******************************************************************************
-* Function Name : UART_DMACmd
-* Description : Enables or disables the UARTx’s DMA interface.
-* Input : - UARTx: where x can be 1 or 2 to select the UART peripheral
-* - UART_DMAReq: enables or disables the request of DMA from UART.
-* This parameter can be:
-* - UART_DMAReq_Tx: Transmit DMA Enable
-* - UART_DMAReq_Rx: Receive DMA Enable
-* - NewState: new state of the UARTx peripheral.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_DMACmd(UART_TypeDef* UARTx, u8 UART_DMAReq, FunctionalState NewState)
-{
- if(UART_DMAReq == UART_DMAReq_Tx)
- {
- if(NewState == ENABLE)
- {
- UARTx->DMACR |= UART_DMAReq_Tx;
- }
- else
- {
- UARTx->DMACR &= ~UART_DMAReq_Tx;
- }
- }
-
- if(UART_DMAReq == UART_DMAReq_Rx)
- {
- if(NewState == ENABLE)
- {
- UARTx->DMACR |= UART_DMAReq_Rx;
- }
- else
- {
- UARTx->DMACR &= ~UART_DMAReq_Rx;
- }
- }
-}
-
-/*******************************************************************************
-* Function Name : UART_LoopBackConfig
-* Description : Enables or disables the LoopBack mode.
-* Input : - UARTx: where x can be 0,1 or 2 to select the UART peripheral
-* - NewState: new state of the UARTx peripheral.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_LoopBackConfig(UART_TypeDef* UARTx, FunctionalState NewState)
-{
- if (NewState == ENABLE)
- {
- /* Enable the LoopBack mode of the specified UART */
- UARTx->CR |= UART_LoopBack_Enable_Mask;
- }
- else
- {
- /* Disable the LoopBack mode of the specified UART */
- UARTx->CR &= UART_LoopBack_Disable_Mask;
- }
-}
-
-/*******************************************************************************
-* Function Name : UART_GetFlagStatus
-* Description : Checks whether the specified UART flag is set or not.
-* Input : - UARTx: where x can be 0,1 or 2 to select the UART peripheral
-* - UART_FLAG: specifies the flag to check.
-* This parameter can be one of the following values:
-* - UART_FLAG_OverrunError: Overrun error flag
-* - UART_FLAG_Break: break error flag
-* - UART_FLAG_ParityError: parity error flag
-* - UART_FLAG_FrameError: frame error flag
-* - UART_FLAG_RI: RI flag
-* - UART_FLAG_TxFIFOEmpty: Transmit FIFO Empty flag
-* - UART_FLAG_RxFIFOFull: Receive FIFO Full flag
-* - UART_FLAG_TxFIFOFull: Transmit FIFO Full flag
-* - UART_FLAG_RxFIFOEmpty: Receive FIFO Empty flag
-* - UART_FLAG_Busy: UART Busy flag
-* - UART_FLAG_CTS: CTS flag
-* - UART_FLAG_DCD: DCD flag
-* - UART_FLAG_DSR: DSR flag
-* - UART_RawIT_OverrunError: Overrun Error interrupt flag
-* - UART_RawIT_BreakError: Break Error interrupt flag
-* - UART_RawIT_ParityError: Parity Error interrupt flag
-* - UART_RawIT_FrameError: Frame Error interrupt flag
-* - UART_RawIT_ReceiveTimeOut: ReceiveTimeOut interrupt flag
-* - UART_RawIT_Transmit: Transmit interrupt flag
-* - UART_RawIT_Receive: Receive interrupt flag
-* - UART_RawIT_DSR: DSR interrupt flag
-* - UART_RawIT_DCD: DCD interrupt flag
-* - UART_RawIT_CTS: CTS interrupt flag
-* - UART_RawIT_RI: RI interrupt flag
-* Output : None
-* Return : The new state of UART_FLAG (SET or RESET).
-*******************************************************************************/
-FlagStatus UART_GetFlagStatus(UART_TypeDef* UARTx, u16 UART_FLAG)
-{
-
- u32 UARTReg = 0, FlagPos = 0;
- u32 StatusReg = 0;
-
- /* Get the UART register index */
- UARTReg = UART_FLAG >> 5;
-
- /* Get the flag position */
- FlagPos = UART_FLAG & UART_FLAG_Mask;
-
- if(UARTReg == 1) /* The flag to check is in RSR register */
- {
- StatusReg = UARTx->RSECR;
- }
- else if (UARTReg == 2) /* The flag to check is in FR register */
- {
- StatusReg = UARTx->FR;
- }
- else if(UARTReg == 3) /* The flag to check is in RIS register */
- {
- StatusReg = UARTx->RIS;
- }
-
- if((StatusReg & (1 << FlagPos))!= RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : UART_ClearFlag
-* Description : Clears the UARTx’s flags(Frame, Parity, Break, Overrun error).
-* Input : - UARTx: where x can be 0,1or 2 to select the UART peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_ClearFlag(UART_TypeDef* UARTx)
-{
- /* Clear the flag */
- UARTx->RSECR = UART_ClearFlag_Mask;
-}
-
-/*******************************************************************************
-* Function Name : UART_GetITStatus
-* Description : Checks whether the specified UART interrupt has occured or not.
-* Input : - UARTx: where x can be 0,1or 2 to select the UART peripheral.
-* - UART_IT: specifies the interrupt pending bit to be checked.
-* This parameter can be one of the following values:
-* - UART_IT_OverrunError: Overrun Error interrupt
-* - UART_IT_BreakError: Break Error interrupt
-* - UART_IT_ParityError: Parity Error interrupt
-* - UART_IT_FrameError: Frame Error interrupt
-* - UART_IT_ReceiveTimeOut: Receive Time Out interrupt
-* - UART_IT_Transmit: Transmit interrupt
-* - UART_IT_Receive: Receive interrupt
-* - UART_IT_DSR: DSR interrupt
-* - UART_IT_DCD: DCD interrupt
-* - UART_IT_CTS: CTS interrupt
-* - UART_IT_RI: RI interrupt
-* Output : None
-* Return : The new state of UART_IT (SET or RESET).
-*******************************************************************************/
-ITStatus UART_GetITStatus(UART_TypeDef* UARTx, u16 UART_IT)
-{
- if((UARTx->MIS & UART_IT) != RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : UART_ClearITPendingBit
-* Description : Clears the UARTx’s interrupt pending bits.
-* Input : - UARTx: where x can be 0,1or 2 to select the UART peripheral.
-* - UART_IT: specifies the interrupt pending bit to clear.
-* More than one interrupt can be cleared using the “|” operator.
-* This parameter can be:
-* - UART_IT_OverrunError: Overrun Error interrupt
-* - UART_IT_BreakError: Break Error interrupt
-* - UART_IT_ParityError: Parity Error interrupt
-* - UART_IT_FrameError: Frame Error interrupt
-* - UART_IT_ReceiveTimeOut: Receive Time Out interrupt
-* - UART_IT_Transmit: Transmit interrupt
-* - UART_IT_Receive: Receive interrupt
-* - UART_IT_DSR: DSR interrupt
-* - UART_IT_DCD: DCD interrupt
-* - UART_IT_CTS: CTS interrupt
-* - UART_IT_RI: RI interrupt
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_ClearITPendingBit(UART_TypeDef* UARTx, u16 UART_IT)
-{
- /* Clear the specified interrupt */
- UARTx->ICR &= UART_IT;
-}
-
-/*******************************************************************************
-* Function Name : UART_IrDALowPowerConfig
-* Description : Sets the IrDA low power mode
-* Input : - IrDAx: where x can be 0,1 or 2 to select the UART/IrDA peripheral.
-* - NewState: new state of the UARTIrDA peripheral.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_IrDALowPowerConfig(u8 IrDAx, FunctionalState NewState)
-{
- UART_TypeDef* UARTx = UART0;
-
- switch(IrDAx)
- {
- case IrDA0: UARTx = UART0;
- break;
- case IrDA1: UARTx = UART1;
- break;
- case IrDA2: UARTx = UART2;
- break;
- }
-
- if (NewState == ENABLE)
- {
- UARTx->CR |= IrDA_LowPower_Enable_Mask;
- }
- else
- {
- UARTx->CR &= IrDA_LowPower_Disable_Mask;
- }
-}
-
-/*******************************************************************************
-* Function Name : UART_IrDASetCounter
-* Description : Sets the IrDA counter divisor value.
-* Input : - UARTx: where x can be 0,1 or 2 to select the UART/IrDA peripheral.
-* - IrDA_Counter: IrDA counter divisor new value n low power mode(Hz).
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_IrDASetCounter(u8 IrDAx, u32 IrDA_Counter)
-{
- UART_TypeDef* UARTx = UART0;
- u32 APBClock;
- switch(IrDAx)
- {
- case IrDA0: UARTx = UART0;
- break;
- case IrDA1: UARTx = UART1;
- break;
- case IrDA2: UARTx = UART2;
- break;
- }
- /* Get the APB frequency */
- APBClock = (SCU_GetPCLKFreqValue())*1000;
- /* Determine the Counter Divisor part */
- UARTx->ILPR = (((APBClock*10) / ( IrDA_Counter)) + 5 )/10;
- }
-
-/*******************************************************************************
-* Function Name : UART_IrDACmd
-* Description : Enables or disables the UARTx’s IrDA interface.
-* Input : - IrDAx: where x can be 0,1 or 2 to select the UART/IrDA peripheral
-* - NewState: new state of the UARTx peripheral.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_IrDACmd(u8 IrDAx, FunctionalState NewState)
-{
- UART_TypeDef* UARTx = UART0;
-
- switch(IrDAx)
- {
- case IrDA0: UARTx = UART0;
- break;
- case IrDA1: UARTx = UART1;
- break;
- case IrDA2: UARTx = UART2;
- break;
- }
- if(NewState == ENABLE)
- {
- /* Enable the IrDA mode of the specified UART */
- UARTx->CR |= UART_IrDA_Enable_Mask;
- }
- else
- {
- /* Disable the IrDA mode of the specified UART */
- UARTx->CR &= UART_IrDA_Disable_Mask;
- }
-}
-
-/*******************************************************************************
-* Function Name : UART_SendData
-* Description : Transmits signle Byte of data through the UARTx peripheral.
-* Input : - UARTx: where x can be 0,1 or 2 to select the UART peripheral.
-* - Data: the byte to transmit
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_SendData(UART_TypeDef* UARTx, u8 Data)
-{
- /* Transmit one byte */
- UARTx->DR = Data;
-}
-
-/*******************************************************************************
-* Function Name : UART_ReceiveData
-* Description : Returns the most recent received Byte by the UARTx peripheral.
-* Input : UARTx: where x can be 0,1 or 2 to select the UART peripheral.
-* Output : None
-* Return : The received data
-*******************************************************************************/
-u8 UART_ReceiveData(UART_TypeDef* UARTx)
-{
- /* Receive one byte */
- return ((u8)UARTx->DR);
-}
-
-/*******************************************************************************
-* Function Name : UART_SendBreak
-* Description : Transmits break characters.
-* Input : UARTx: where x can be 0,1 or 2 to select the UART peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_SendBreak(UART_TypeDef* UARTx)
-{
- /* Send break characters */
- UARTx->LCR |= UART_BreakChar_Mask;
-}
-
-/*******************************************************************************
-* Function Name : UART_RTSConfig
-* Description : Sets or Resets the RTS signal
-* Input : - LevelState: new state of the RTS signal for UART0 only.
-* This parameter can be: LowLevel or HighLevel
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_RTSConfig(UART_LevelTypeDef LevelState)
-{
- if(LevelState == LowLevel)
- {
- UART0->CR |= UART_RTS_LowLevel_Mask;
- }
- else
- {
- UART0->CR &= UART_RTS_HighLevel_Mask;
- }
-}
-
-/*******************************************************************************
-* Function Name : UART_DTRConfig
-* Description : Sets or Resets the DTR signal for UART0 only
-* Input : - LevelState: new state of the DTR signal.
-* This parameter can be: LowLevel or HighLevel
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_DTRConfig(UART_LevelTypeDef LevelState)
-{
- if(LevelState == LowLevel)
- {
- UART0->CR |= UART_DTR_LowLevel_Mask;
- }
- else
- {
- UART0->CR &= UART_DTR_HighLevel_Mask;
- }
-}
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_complex_startup/src/91x_vic.c b/uc_str912/prj_blinky_complex_startup/src/91x_vic.c
deleted file mode 100644
index fecb890..0000000
--- a/uc_str912/prj_blinky_complex_startup/src/91x_vic.c
+++ /dev/null
@@ -1,830 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_vic.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the VIC software functions.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-
-/* Standard include ----------------------------------------------------------*/
-#include "91x_vic.h"
-
-/* Include of other module interface headers ---------------------------------*/
-/* Local includes ------------------------------------------------------------*/
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-
-#define VIC_REGISTER_NUMBER 16
-#define VIC_PROTECTION_ENABLE_MASK 0x1
-#define VIC_PROTECTION_DISABLE_MASK 0xFFFFFFFE
-#define VIC_VECTOR_ENABLE_MASK 0x20
-#define VIC_IT_SOURCE_MASK 0xFFFFFFE0
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-
-static void VIC_ITModeConfig(u16 VIC_Source, VIC_ITLineMode VIC_LineMode);
-static void VIC_ISRVectAddConfig(u16 VIC_Source, u16 VIC_Priority, \
- void (*VIC_VectAddress)(void));
-static void VIC_VectEnableConfig(u16 VIC_Source, u16 VIC_Priority);
-static void VIC_ITSourceConfig(u16 VIC_Source, u16 VIC_Priority);
-
-/* Interface functions -------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-
-/*******************************************************************************
-* Function Name : VIC_DeInit
-* Description : Deinitialize the VIC module registers to their default reset
-* values.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void VIC_DeInit(void)
-{
- SCU_AHBPeriphReset(__VIC, ENABLE); /* VIC peripheral is under Reset */
- SCU_AHBPeriphReset(__VIC, DISABLE); /* VIC peripheral Reset off */
-}
-
-/*******************************************************************************
-* Function Name : VIC_GetIRQStatus
-* Description : Get the status of interrupts after IRQ masking.
-* Input : VIC_Source: specifies the number of the source line.
-* This parameter can be one of the following values:
-* - WDG_ITLine : VIC source 0
-* - SW_ITLine : VIC source 1
-* - ARMRX_ITLine : VIC source 2
-* - ARMTX_ITLine : VIC source 3
-* - TIM0_ITLine : VIC source 4
-* - TIM1_ITLine : VIC source 5
-* - TIM2_ITLine : VIC source 6
-* - TIM3_ITLine : VIC source 7
-* - USBHP_ITLine : VIC source 8
-* - USBLP_ITLine : VIC source 9
-* - SCU_ITLine : VIC source 10
-* - ENET_ITLine : VIC source 11
-* - DMA_ITLine : VIC source 12
-* - CAN_ITLine : VIC source 13
-* - MC_ITLine : VIC source 14
-* - ADC_ITLine : VIC source 15
-* - UART0_ITLine : VIC source 16
-* - UART1_ITLine : VIC source 17
-* - UART2_ITLine : VIC source 18
-* - I2C0_ITLine : VIC source 19
-* - I2C1_ITLine : VIC source 20
-* - SSP0_ITLine : VIC source 21
-* - SSP1_ITLine : VIC source 22
-* - LVD_ITLine : VIC source 23
-* - RTC_ITLine : VIC source 24
-* - WIU_ITLine : VIC source 25
-* - EXTIT0_ITLine: VIC source 26
-* - EXTIT1_ITLine: VIC source 27
-* - EXTIT2_ITLine: VIC source 28
-* - EXTIT3_ITLine: VIC source 29
-* - USBWU_ITLine : VIC source 30
-* - PFQBC_ITLine : VIC source 31
-* Output : None
-* Return : The status of the IRQ interrupt after masking (SET or RESET).
-*******************************************************************************/
-FlagStatus VIC_GetIRQStatus(u16 VIC_Source)
-{
- u32 VIC_Mask = 1;
- if (VIC_Source < VIC_REGISTER_NUMBER)
- {
- if ((VIC0->ISR | VIC_Mask << VIC_Source) != RESET)
- return SET;
- else
- return RESET;
- }
- else
- {
- if ((VIC1->ISR | VIC_Mask << (VIC_Source - VIC_REGISTER_NUMBER)) != RESET)
- return SET;
- else
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : VIC_GetFIQStatus
-* Description : Get the status of interrupts after FIQ masking
-* Input : VIC_Source: specifies the number of the source line.
-* This parameter can be one of the following values:
-* - WDG_ITLine : VIC source 0
-* - SW_ITLine : VIC source 1
-* - ARMRX_ITLine : VIC source 2
-* - ARMTX_ITLine : VIC source 3
-* - TIM0_ITLine : VIC source 4
-* - TIM1_ITLine : VIC source 5
-* - TIM2_ITLine : VIC source 6
-* - TIM3_ITLine : VIC source 7
-* - USBHP_ITLine : VIC source 8
-* - USBLP_ITLine : VIC source 9
-* - SCU_ITLine : VIC source 10
-* - ENET_ITLine : VIC source 11
-* - DMA_ITLine : VIC source 12
-* - CAN_ITLine : VIC source 13
-* - MC_ITLine : VIC source 14
-* - ADC_ITLine : VIC source 15
-* - UART0_ITLine : VIC source 16
-* - UART1_ITLine : VIC source 17
-* - UART2_ITLine : VIC source 18
-* - I2C0_ITLine : VIC source 19
-* - I2C1_ITLine : VIC source 20
-* - SSP0_ITLine : VIC source 21
-* - SSP1_ITLine : VIC source 22
-* - LVD_ITLine : VIC source 23
-* - RTC_ITLine : VIC source 24
-* - WIU_ITLine : VIC source 25
-* - EXTIT0_ITLine: VIC source 26
-* - EXTIT1_ITLine: VIC source 27
-* - EXTIT2_ITLine: VIC source 28
-* - EXTIT3_ITLine: VIC source 29
-* - USBWU_ITLine : VIC source 30
-* - PFQBC_ITLine : VIC source 31
-* Output : None
-* Return : The status of the FIQ interrupt after masking (SET or RESET)
-*******************************************************************************/
-FlagStatus VIC_GetFIQStatus(u16 VIC_Source)
-{
- u32 VIC_Mask = 1;
- if (VIC_Source < VIC_REGISTER_NUMBER)
- {
- if ((VIC0->RINTSR | VIC_Mask << VIC_Source) != RESET)
- return SET;
- else
- return RESET;
- }
- else
- {
- if ((VIC1->RINTSR | VIC_Mask << (VIC_Source - VIC_REGISTER_NUMBER)) != RESET)
- return SET;
- else
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : VIC_GetSourceITStatus
-* Description : Get the status of the source interrupts before masking.
-* Input : VIC_Source: specifies the number of the source line.
-* This parameter can be one of the following values:
-* - WDG_ITLine : VIC source 0
-* - SW_ITLine : VIC source 1
-* - ARMRX_ITLine : VIC source 2
-* - ARMTX_ITLine : VIC source 3
-* - TIM0_ITLine : VIC source 4
-* - TIM1_ITLine : VIC source 5
-* - TIM2_ITLine : VIC source 6
-* - TIM3_ITLine : VIC source 7
-* - USBHP_ITLine : VIC source 8
-* - USBLP_ITLine : VIC source 9
-* - SCU_ITLine : VIC source 10
-* - ENET_ITLine : VIC source 11
-* - DMA_ITLine : VIC source 12
-* - CAN_ITLine : VIC source 13
-* - MC_ITLine : VIC source 14
-* - ADC_ITLine : VIC source 15
-* - UART0_ITLine : VIC source 16
-* - UART1_ITLine : VIC source 17
-* - UART2_ITLine : VIC source 18
-* - I2C0_ITLine : VIC source 19
-* - I2C1_ITLine : VIC source 20
-* - SSP0_ITLine : VIC source 21
-* - SSP1_ITLine : VIC source 22
-* - LVD_ITLine : VIC source 23
-* - RTC_ITLine : VIC source 24
-* - WIU_ITLine : VIC source 25
-* - EXTIT0_ITLine: VIC source 26
-* - EXTIT1_ITLine: VIC source 27
-* - EXTIT2_ITLine: VIC source 28
-* - EXTIT3_ITLine: VIC source 29
-* - USBWU_ITLine : VIC source 30
-* - PFQBC_ITLine : VIC source 31
-* Output : None
-* Return : The status of the source interrupt before masking
-*******************************************************************************/
-FlagStatus VIC_GetSourceITStatus(u16 VIC_Source)
-{
- u32 VIC_Mask = 1;
- if (VIC_Source < VIC_REGISTER_NUMBER)
- {
- if ((VIC0->FSR | VIC_Mask << VIC_Source) != RESET)
- return SET;
- else
- return RESET;
- }
- else
- {
- if ((VIC1->FSR | VIC_Mask << (VIC_Source - VIC_REGISTER_NUMBER)) != RESET)
- return SET;
- else
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : VIC_ITModeConfig
-* Description : Select the type of interrupt (IRQ or FIQ)
-* Input1 : VIC_Source: specifies the number of the source line.
-* This parameter can be one of the following values:
-* - WDG_ITLine : VIC source 0
-* - SW_ITLine : VIC source 1
-* - ARMRX_ITLine : VIC source 2
-* - ARMTX_ITLine : VIC source 3
-* - TIM0_ITLine : VIC source 4
-* - TIM1_ITLine : VIC source 5
-* - TIM2_ITLine : VIC source 6
-* - TIM3_ITLine : VIC source 7
-* - USBHP_ITLine : VIC source 8
-* - USBLP_ITLine : VIC source 9
-* - SCU_ITLine : VIC source 10
-* - ENET_ITLine : VIC source 11
-* - DMA_ITLine : VIC source 12
-* - CAN_ITLine : VIC source 13
-* - MC_ITLine : VIC source 14
-* - ADC_ITLine : VIC source 15
-* - UART0_ITLine : VIC source 16
-* - UART1_ITLine : VIC source 17
-* - UART2_ITLine : VIC source 18
-* - I2C0_ITLine : VIC source 19
-* - I2C1_ITLine : VIC source 20
-* - SSP0_ITLine : VIC source 21
-* - SSP1_ITLine : VIC source 22
-* - LVD_ITLine : VIC source 23
-* - RTC_ITLine : VIC source 24
-* - WIU_ITLine : VIC source 25
-* - EXTIT0_ITLine: VIC source 26
-* - EXTIT1_ITLine: VIC source 27
-* - EXTIT2_ITLine: VIC source 28
-* - EXTIT3_ITLine: VIC source 29
-* - USBWU_ITLine : VIC source 30
-* - PFQBC_ITLine : VIC source 31
-* Input2 : VIC_LineMode :specifies the type of interrupt of the source
-* line. This parameter can be one of the following values:
-* - VIC_IRQ: the correspondent line is configured as IRQ.
-* - VIC_FIQ: the correspondent line is configured as FIQ.
-* Output : None
-* Return : None
-*******************************************************************************/
-static void VIC_ITModeConfig(u16 VIC_Source, VIC_ITLineMode VIC_LineMode)
-{
- u32 VIC_Mask = 1;
-
- if (VIC_Source < VIC_REGISTER_NUMBER) /* VIC0 */
- {
- if (VIC_LineMode == VIC_IRQ)
- VIC0->INTSR &= ~(VIC_Mask << VIC_Source);
- else /* VIC_LineMode == VIC_FIQ */
- VIC0->INTSR |= (VIC_Mask << VIC_Source);
- }
- else /* VIC1 */
- {
- if (VIC_LineMode == VIC_IRQ)
- VIC1->INTSR &= ~(VIC_Mask << (VIC_Source - VIC_REGISTER_NUMBER));
- else /* VIC_LineMode == VIC_FIQ */
- VIC1->INTSR |= (VIC_Mask << (VIC_Source - VIC_REGISTER_NUMBER));
- }
-}
-
-/*******************************************************************************
-* Function Name : VIC_ITCmd
-* Description : Enable or disable the interrupt request lines.
-* Input1 : VIC_Source: specifies the number of the source line.
-* This parameter can be one of the following values:
-* - WDG_ITLine : VIC source 0
-* - SW_ITLine : VIC source 1
-* - ARMRX_ITLine : VIC source 2
-* - ARMTX_ITLine : VIC source 3
-* - TIM0_ITLine : VIC source 4
-* - TIM1_ITLine : VIC source 5
-* - TIM2_ITLine : VIC source 6
-* - TIM3_ITLine : VIC source 7
-* - USBHP_ITLine : VIC source 8
-* - USBLP_ITLine : VIC source 9
-* - SCU_ITLine : VIC source 10
-* - ENET_ITLine : VIC source 11
-* - DMA_ITLine : VIC source 12
-* - CAN_ITLine : VIC source 13
-* - MC_ITLine : VIC source 14
-* - ADC_ITLine : VIC source 15
-* - UART0_ITLine : VIC source 16
-* - UART1_ITLine : VIC source 17
-* - UART2_ITLine : VIC source 18
-* - I2C0_ITLine : VIC source 19
-* - I2C1_ITLine : VIC source 20
-* - SSP0_ITLine : VIC source 21
-* - SSP1_ITLine : VIC source 22
-* - LVD_ITLine : VIC source 23
-* - RTC_ITLine : VIC source 24
-* - WIU_ITLine : VIC source 25
-* - EXTIT0_ITLine: VIC source 26
-* - EXTIT1_ITLine: VIC source 27
-* - EXTIT2_ITLine: VIC source 28
-* - EXTIT3_ITLine: VIC source 29
-* - USBWU_ITLine : VIC source 30
-* - PFQBC_ITLine : VIC source 31
-* Input2 : FMI_NewState: specifies the line status.
-* This parameter can be one of the following values:
-* - ENABLE: The line is enabled.
-* - DISABLE: The line is disabled.
-* Output : None
-* Return : None
-*******************************************************************************/
-void VIC_ITCmd(u16 VIC_Source, FunctionalState VIC_NewState)
-{
- u32 VIC_Mask = 1;
-
- if (VIC_NewState == ENABLE)
- {
- if (VIC_Source < VIC_REGISTER_NUMBER) /* VIC0 */
- VIC0->INTER |= (VIC_Mask << VIC_Source);
- else /* VIC1 */
- VIC1->INTER |= (VIC_Mask << (VIC_Source - VIC_REGISTER_NUMBER));
- }
- else /* VIC_NewState == DISABLE */
- {
- if (VIC_Source < VIC_REGISTER_NUMBER) /* VIC0 */
- VIC0->INTECR |= (VIC_Mask << VIC_Source);
- else /* VIC1 */
- VIC1->INTECR |= (VIC_Mask << (VIC_Source - VIC_REGISTER_NUMBER));
- }
-}
-
-/*******************************************************************************
-* Function Name : VIC_SWITCmd
-* Description : Generate a software interrupt for the specific source
-* interrupt.
-* Input1 : VIC_Source: specifies the number of the source line.
-* This parameter can be one of the following values:
-* - WDG_ITLine : VIC source 0
-* - SW_ITLine : VIC source 1
-* - ARMRX_ITLine : VIC source 2
-* - ARMTX_ITLine : VIC source 3
-* - TIM0_ITLine : VIC source 4
-* - TIM1_ITLine : VIC source 5
-* - TIM2_ITLine : VIC source 6
-* - TIM3_ITLine : VIC source 7
-* - USBHP_ITLine : VIC source 8
-* - USBLP_ITLine : VIC source 9
-* - SCU_ITLine : VIC source 10
-* - ENET_ITLine : VIC source 11
-* - DMA_ITLine : VIC source 12
-* - CAN_ITLine : VIC source 13
-* - MC_ITLine : VIC source 14
-* - ADC_ITLine : VIC source 15
-* - UART0_ITLine : VIC source 16
-* - UART1_ITLine : VIC source 17
-* - UART2_ITLine : VIC source 18
-* - I2C0_ITLine : VIC source 19
-* - I2C1_ITLine : VIC source 20
-* - SSP0_ITLine : VIC source 21
-* - SSP1_ITLine : VIC source 22
-* - LVD_ITLine : VIC source 23
-* - RTC_ITLine : VIC source 24
-* - WIU_ITLine : VIC source 25
-* - EXTIT0_ITLine: VIC source 26
-* - EXTIT1_ITLine: VIC source 27
-* - EXTIT2_ITLine: VIC source 28
-* - EXTIT3_ITLine: VIC source 29
-* - USBWU_ITLine : VIC source 30
-* - PFQBC_ITLine : VIC source 31
-* Input2 : FMI_NewState: specifies the software interrupt status.
-* This parameter can be one of the following values:
-* - ENABLE: The software interrupt is enabled.
-* - DISABLE: The software interrupt is disabled.
-* Output : None
-* Return : None
-*******************************************************************************/
-void VIC_SWITCmd(u16 VIC_Source, FunctionalState VIC_NewState)
-{
- u32 VIC_Mask = 1;
-
- if (VIC_NewState == ENABLE)
- {
- if (VIC_Source < VIC_REGISTER_NUMBER) /* VIC0 */
- VIC0->SWINTR |= (VIC_Mask << VIC_Source);
- else /* VIC1 */
- VIC1->SWINTR |= (VIC_Mask << (VIC_Source - VIC_REGISTER_NUMBER));
- }
- else /* VIC_NewState == DISABLE */
- {
- if (VIC_Source < VIC_REGISTER_NUMBER) /* VIC0 */
- VIC0->SWINTCR = (VIC_Mask << VIC_Source);
- else /* VIC1 */
- VIC1->SWINTCR = (VIC_Mask << (VIC_Source - VIC_REGISTER_NUMBER));
- }
-}
-
-/*******************************************************************************
-* Function Name : VIC_ProtectionCmd
-* Description : Enable or Disable the register access protection.
-* Input : FMI_NewState: specifies the protection status.
-* This parameter can be one of the following values:
-* - ENABLE: The protection is enabled.
-* - DISABLE: The protection is disabled.
-* Output : None
-* Return : None
-*******************************************************************************/
-void VIC_ProtectionCmd(FunctionalState VIC_NewState)
-{
- if (VIC_NewState == ENABLE)
- {
- VIC0->PER |= VIC_PROTECTION_ENABLE_MASK;
- VIC1->PER |= VIC_PROTECTION_ENABLE_MASK;
- }
- else
- {
- VIC0->PER &= VIC_PROTECTION_DISABLE_MASK;
- VIC1->PER &= VIC_PROTECTION_DISABLE_MASK;
- }
-}
-
-/*******************************************************************************
-* Function Name : VIC_GetCurrentISRAdd
-* Description : Get the address of the current active ISR.
-* Input : VICx: specifies the VIC peripheral
-* This parameter can be one of the following values:
-* - VIC0: To select VIC0.
-* - VIC1: To select VIC1.
-* Output : None
-* Return : The Address of the active ISR.
-*******************************************************************************/
-u32 VIC_GetCurrentISRAdd(VIC_TypeDef* VICx)
-{
- return VICx->VAR;
-}
-
-/*******************************************************************************
-* Function Name : VIC_ISRVectAddConfig
-* Description : Configuration of the ISR vector address.
-* Input1 : VIC_Source: specifies the number of the source line.
-* This parameter can be one of the following values:
-* - WDG_ITLine : VIC source 0
-* - SW_ITLine : VIC source 1
-* - ARMRX_ITLine : VIC source 2
-* - ARMTX_ITLine : VIC source 3
-* - TIM0_ITLine : VIC source 4
-* - TIM1_ITLine : VIC source 5
-* - TIM2_ITLine : VIC source 6
-* - TIM3_ITLine : VIC source 7
-* - USBHP_ITLine : VIC source 8
-* - USBLP_ITLine : VIC source 9
-* - SCU_ITLine : VIC source 10
-* - ENET_ITLine : VIC source 11
-* - DMA_ITLine : VIC source 12
-* - CAN_ITLine : VIC source 13
-* - MC_ITLine : VIC source 14
-* - ADC_ITLine : VIC source 15
-* - UART0_ITLine : VIC source 16
-* - UART1_ITLine : VIC source 17
-* - UART2_ITLine : VIC source 18
-* - I2C0_ITLine : VIC source 19
-* - I2C1_ITLine : VIC source 20
-* - SSP0_ITLine : VIC source 21
-* - SSP1_ITLine : VIC source 22
-* - LVD_ITLine : VIC source 23
-* - RTC_ITLine : VIC source 24
-* - WIU_ITLine : VIC source 25
-* - EXTIT0_ITLine: VIC source 26
-* - EXTIT1_ITLine: VIC source 27
-* - EXTIT2_ITLine: VIC source 28
-* - EXTIT3_ITLine: VIC source 29
-* - USBWU_ITLine : VIC source 30
-* - PFQBC_ITLine : VIC source 31
-* Input2 : VIC_Priority: specifies the priority of the interrupt.
-* It can be a value from 0 to 15. 0 is the highest priority.
-* Input3 : void (*VIC_VectAddress)(void): specifies the ISR vector
-* address pointer.
-* Output : None
-* Return : None
-*******************************************************************************/
-static void VIC_ISRVectAddConfig(u16 VIC_Source, u16 VIC_Priority, \
- void (*VIC_VectAddress)(void))
-{
- if (VIC_Source < VIC_REGISTER_NUMBER) /* VIC0 */
- VIC0->VAiR[VIC_Priority] = (u32)VIC_VectAddress;
- else /* VIC1 */
- VIC1->VAiR[VIC_Priority] = (u32)VIC_VectAddress;
-}
-
-/*******************************************************************************
-* Function Name : VIC_GetISRVectAdd
-* Description : Get the ISR vector address of the correspondent line.
-* Input : VIC_Source: specifies the number of the source line.
-* This parameter can be one of the following values:
-* - WDG_ITLine : VIC source 0
-* - SW_ITLine : VIC source 1
-* - ARMRX_ITLine : VIC source 2
-* - ARMTX_ITLine : VIC source 3
-* - TIM0_ITLine : VIC source 4
-* - TIM1_ITLine : VIC source 5
-* - TIM2_ITLine : VIC source 6
-* - TIM3_ITLine : VIC source 7
-* - USBHP_ITLine : VIC source 8
-* - USBLP_ITLine : VIC source 9
-* - SCU_ITLine : VIC source 10
-* - ENET_ITLine : VIC source 11
-* - DMA_ITLine : VIC source 12
-* - CAN_ITLine : VIC source 13
-* - MC_ITLine : VIC source 14
-* - ADC_ITLine : VIC source 15
-* - UART0_ITLine : VIC source 16
-* - UART1_ITLine : VIC source 17
-* - UART2_ITLine : VIC source 18
-* - I2C0_ITLine : VIC source 19
-* - I2C1_ITLine : VIC source 20
-* - SSP0_ITLine : VIC source 21
-* - SSP1_ITLine : VIC source 22
-* - LVD_ITLine : VIC source 23
-* - RTC_ITLine : VIC source 24
-* - WIU_ITLine : VIC source 25
-* - EXTIT0_ITLine: VIC source 26
-* - EXTIT1_ITLine: VIC source 27
-* - EXTIT2_ITLine: VIC source 28
-* - EXTIT3_ITLine: VIC source 29
-* - USBWU_ITLine : VIC source 30
-* - PFQBC_ITLine : VIC source 31
-* Output : None
-* Return : The correspondent ISR vector address.
-*******************************************************************************/
-u32 VIC_GetISRVectAdd(u16 VIC_Source)
-{
- if (VIC_Source < VIC_REGISTER_NUMBER) /* VIC0 */
- return VIC0->VAiR[VIC_Source];
- else /* VIC1 */
- return VIC1->VAiR[VIC_Source - VIC_REGISTER_NUMBER];
-}
-
-/*******************************************************************************
-* Function Name : VIC_VectEnableConfig
-* Description : Enable the vector interrupt.
-* Input1 : VIC_Source: specifies the number of the source line.
-* This parameter can be one of the following values:
-* - WDG_ITLine : VIC source 0
-* - SW_ITLine : VIC source 1
-* - ARMRX_ITLine : VIC source 2
-* - ARMTX_ITLine : VIC source 3
-* - TIM0_ITLine : VIC source 4
-* - TIM1_ITLine : VIC source 5
-* - TIM2_ITLine : VIC source 6
-* - TIM3_ITLine : VIC source 7
-* - USBHP_ITLine : VIC source 8
-* - USBLP_ITLine : VIC source 9
-* - SCU_ITLine : VIC source 10
-* - ENET_ITLine : VIC source 11
-* - DMA_ITLine : VIC source 12
-* - CAN_ITLine : VIC source 13
-* - MC_ITLine : VIC source 14
-* - ADC_ITLine : VIC source 15
-* - UART0_ITLine : VIC source 16
-* - UART1_ITLine : VIC source 17
-* - UART2_ITLine : VIC source 18
-* - I2C0_ITLine : VIC source 19
-* - I2C1_ITLine : VIC source 20
-* - SSP0_ITLine : VIC source 21
-* - SSP1_ITLine : VIC source 22
-* - LVD_ITLine : VIC source 23
-* - RTC_ITLine : VIC source 24
-* - WIU_ITLine : VIC source 25
-* - EXTIT0_ITLine: VIC source 26
-* - EXTIT1_ITLine: VIC source 27
-* - EXTIT2_ITLine: VIC source 28
-* - EXTIT3_ITLine: VIC source 29
-* - USBWU_ITLine : VIC source 30
-* - PFQBC_ITLine : VIC source 31
-* Input2 : VIC_Priority: specifies the priority of the interrupt.
-* It can be a value from 0 to 15. 0 is the highest priority.
-* Output : None
-* Return : None
-*******************************************************************************/
-static void VIC_VectEnableConfig(u16 VIC_Source, u16 VIC_Priority)
-{
- if (VIC_Source < VIC_REGISTER_NUMBER) /* VIC0 */
- VIC0->VCiR[VIC_Priority] |= VIC_VECTOR_ENABLE_MASK;
- else /* VIC1 */
- VIC1->VCiR[VIC_Priority] |= VIC_VECTOR_ENABLE_MASK;
-}
-
-/*******************************************************************************
-* Function Name : VIC_ITSourceConfig
-* Description : Select the interrupt source.
-* Input1 : VIC_Source: specifies the number of the source line.
-* This parameter can be one of the following values:
-* - WDG_ITLine : VIC source 0
-* - SW_ITLine : VIC source 1
-* - ARMRX_ITLine : VIC source 2
-* - ARMTX_ITLine : VIC source 3
-* - TIM0_ITLine : VIC source 4
-* - TIM1_ITLine : VIC source 5
-* - TIM2_ITLine : VIC source 6
-* - TIM3_ITLine : VIC source 7
-* - USBHP_ITLine : VIC source 8
-* - USBLP_ITLine : VIC source 9
-* - SCU_ITLine : VIC source 10
-* - ENET_ITLine : VIC source 11
-* - DMA_ITLine : VIC source 12
-* - CAN_ITLine : VIC source 13
-* - MC_ITLine : VIC source 14
-* - ADC_ITLine : VIC source 15
-* - UART0_ITLine : VIC source 16
-* - UART1_ITLine : VIC source 17
-* - UART2_ITLine : VIC source 18
-* - I2C0_ITLine : VIC source 19
-* - I2C1_ITLine : VIC source 20
-* - SSP0_ITLine : VIC source 21
-* - SSP1_ITLine : VIC source 22
-* - LVD_ITLine : VIC source 23
-* - RTC_ITLine : VIC source 24
-* - WIU_ITLine : VIC source 25
-* - EXTIT0_ITLine: VIC source 26
-* - EXTIT1_ITLine: VIC source 27
-* - EXTIT2_ITLine: VIC source 28
-* - EXTIT3_ITLine: VIC source 29
-* - USBWU_ITLine : VIC source 30
-* - PFQBC_ITLine : VIC source 31
-* Input2 : VIC_Priority: specifies the priority of the interrupt.
-* It can be a value from 0 to 15. 0 is the highest priority.
-* Output : None
-* Return : None
-*******************************************************************************/
-static void VIC_ITSourceConfig(u16 VIC_Source, u16 VIC_Priority)
-{
- if (VIC_Source < VIC_REGISTER_NUMBER) /* VIC0 */
- {
- VIC0->VCiR[VIC_Priority] &= VIC_IT_SOURCE_MASK;
- VIC0->VCiR[VIC_Priority] |= VIC_Source;
- }
- else /* VIC1 */
- {
- VIC1->VCiR[VIC_Priority] &= VIC_IT_SOURCE_MASK;
- VIC1->VCiR[VIC_Priority] |= VIC_Source - VIC_REGISTER_NUMBER;
- }
-}
-
-/*******************************************************************************
-* Function Name : VIC_Config
-* Description : Configure the ISR, the line, the mode and the priority for
-* each interrupt source line.
-* Input1 : VIC_Source: specifies the number of the source line.
-* This parameter can be one of the following values:
-* - WDG_ITLine : VIC source 0
-* - SW_ITLine : VIC source 1
-* - ARMRX_ITLine : VIC source 2
-* - ARMTX_ITLine : VIC source 3
-* - TIM0_ITLine : VIC source 4
-* - TIM1_ITLine : VIC source 5
-* - TIM2_ITLine : VIC source 6
-* - TIM3_ITLine : VIC source 7
-* - USBHP_ITLine : VIC source 8
-* - USBLP_ITLine : VIC source 9
-* - SCU_ITLine : VIC source 10
-* - ENET_ITLine : VIC source 11
-* - DMA_ITLine : VIC source 12
-* - CAN_ITLine : VIC source 13
-* - MC_ITLine : VIC source 14
-* - ADC_ITLine : VIC source 15
-* - UART0_ITLine : VIC source 16
-* - UART1_ITLine : VIC source 17
-* - UART2_ITLine : VIC source 18
-* - I2C0_ITLine : VIC source 19
-* - I2C1_ITLine : VIC source 20
-* - SSP0_ITLine : VIC source 21
-* - SSP1_ITLine : VIC source 22
-* - LVD_ITLine : VIC source 23
-* - RTC_ITLine : VIC source 24
-* - WIU_ITLine : VIC source 25
-* - EXTIT0_ITLine: VIC source 26
-* - EXTIT1_ITLine: VIC source 27
-* - EXTIT2_ITLine: VIC source 28
-* - EXTIT3_ITLine: VIC source 29
-* - USBWU_ITLine : VIC source 30
-* - PFQBC_ITLine : VIC source 31
-* Input2 : VIC_LineMode :specifies the type of interrupt of the source
-* line. This parameter can be one of the following values:
-* - VIC_IRQ: the correspondent line is configured as IRQ.
-* - VIC_FIQ: the correspondent line is configured as FIQ.
-* Input3 : VIC_Priority: specifies the priority of the interrupt.
-* It can be a value from 0 to 15. 0 is the highest priority.
-* Output : None
-* Return : None
-*******************************************************************************/
-void VIC_Config(u16 VIC_Source, VIC_ITLineMode VIC_LineMode, u8 VIC_Priority)
-{
- switch (VIC_Source)
- {
- case 0: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, WDG_IRQHandler);
- break;
-
- case 1: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, SW_IRQHandler);
- break;
-
- case 2: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, ARMRX_IRQHandler);
- break;
-
- case 3: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, ARMTX_IRQHandler);
- break;
-
- case 4: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, TIM0_IRQHandler);
- break;
-
- case 5: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, TIM1_IRQHandler);
- break;
-
- case 6: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, TIM2_IRQHandler);
- break;
-
- case 7: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, TIM3_IRQHandler);
- break;
-
- case 8: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, USBHP_IRQHandler);
- break;
-
- case 9: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, USBLP_IRQHandler);
- break;
-
- case 10: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, SCU_IRQHandler);
- break;
-
- case 11: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, ENET_IRQHandler);
- break;
-
- case 12: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, DMA_IRQHandler);
- break;
-
- case 13: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, CAN_IRQHandler);
- break;
-
- case 14: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, MC_IRQHandler);
- break;
-
- case 15: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, ADC_IRQHandler);
- break;
-
- case 16: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, UART0_IRQHandler);
- break;
-
- case 17: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, UART1_IRQHandler);
- break;
-
- case 18: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, UART2_IRQHandler);
- break;
-
- case 19: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, I2C0_IRQHandler);
- break;
-
- case 20: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, I2C1_IRQHandler);
- break;
-
- case 21: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, SSP0_IRQHandler);
- break;
-
- case 22: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, SSP1_IRQHandler);
- break;
-
- case 23: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, LVD_IRQHandler);
- break;
-
- case 24: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, RTC_IRQHandler);
- break;
-
- case 25: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, WIU_IRQHandler);
- break;
-
- case 26: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, EXTIT0_IRQHandler);
- break;
-
- case 27: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, EXTIT1_IRQHandler);
- break;
-
- case 28: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, EXTIT2_IRQHandler);
- break;
-
- case 29: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, EXTIT3_IRQHandler);
- break;
-
- case 30: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, USBWU_IRQHandler);
- break;
-
- case 31: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, PFQBC_IRQHandler);
- break;
-
- default: break;
- }
- VIC_ITModeConfig(VIC_Source, VIC_LineMode);
- VIC_VectEnableConfig(VIC_Source, VIC_Priority);
- VIC_ITSourceConfig(VIC_Source, VIC_Priority);
-}
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_complex_startup/src/91x_wdg.c b/uc_str912/prj_blinky_complex_startup/src/91x_wdg.c
deleted file mode 100644
index f933635..0000000
--- a/uc_str912/prj_blinky_complex_startup/src/91x_wdg.c
+++ /dev/null
@@ -1,277 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_wdg.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the WDG software functions.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_wdg.h"
-#include "91x_scu.h"
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-
-
-/* WDG End of Count interrupt Flag */
-#define WDG_FLAG_EC 0x0001
-
-
-/* WDG End of Count interrupt request */
-#define WDG_IT_EC 0x0001
-
-
-
-/* WDG Start/Stop counter */
-#define WDG_Counter_Start 0x0002
-#define WDG_Counter_Stop 0xFFFD
-
-
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Registers reset value */
-/* Private function prototypes -----------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-
-/******************************************************************************
-* Function Name : WDG_DeInit
-* Description : Deinitializes the WDG peripheral registers to their default
-* reset values.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void WDG_DeInit(void)
-{
-
- SCU_APBPeriphReset(__WDG, ENABLE); /*WDG peripheral under Reset */
- SCU_APBPeriphReset(__WDG, DISABLE); /*WDG peripheral Reset off*/
-
-}
-
-/*******************************************************************************
-* Function Name : WDG_StructInit
-* Description : Fills the WDG_InitTypeDef structure member with its reset
-* value.
-* Input : WDG_InitStruct : pointer to a WDG_InitTypeDef structure
-* which will be initialized.
-* Output : None
-* Return : None
-*******************************************************************************/
-void WDG_StructInit(WDG_InitTypeDef *WDG_InitStruct)
-{
- /* Select the Watchdog running mode*/
- WDG_InitStruct->WDG_Mode = WDG_Mode_Timer;
-
- /* Select the source clock */
- WDG_InitStruct-> WDG_ClockSource = WDG_ClockSource_Apb;
-
- /* Initialize Prescaler */
- WDG_InitStruct->WDG_Prescaler =0xFF;
-
- /* Initialize Preload */
- WDG_InitStruct->WDG_Preload =0xFFFF;
-
-
-}
-
-/*******************************************************************************
-* Function Name : WDG_Init
-* Description : Initializes WDG peripheral according to the specified
-* parameters in the WDG_InitStruct.
-* Input : WDG_InitStruct: pointer to a WDG_InitTypeDef structure that
-* contains the configuration information for the WDG peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void WDG_Init(WDG_InitTypeDef* WDG_InitStruct)
-{
-
-
- if(WDG_InitStruct->WDG_ClockSource == WDG_ClockSource_Apb)
- {
- /* Select The APB clock as clock source */
- WDG->CR &= WDG_ClockSource_Apb;
- }
-
- else
- {
- /* Select the RTC clock as source */
- WDG->CR |= WDG_ClockSource_Rtc ;
- }
-
-
- /* Configure WDG Prescaler register value */
- WDG->PR = WDG_InitStruct->WDG_Prescaler;
-
- /* Configure WDG Pre-load register value */
- WDG->VR = WDG_InitStruct->WDG_Preload ;
-
-
- if(WDG_InitStruct->WDG_Mode == WDG_Mode_Timer)
- {
- /* Select Timer mode */
- WDG->CR &= WDG_Mode_Timer;
- }
- else
- {
- /* Select WDG mode */
- WDG->CR |= WDG_Mode_Wdg ;
- }
-
-
-}
-
-/*******************************************************************************
-* Function Name : WDG_Cmd
-* Description : Enables or disables the WDG peripheral.
-* Input : NewState: new state of the WDG peripheral (Newstate can be
-* ENABLE or DISABLE)
-* Output : None
-* Return : None
-*******************************************************************************/
-void WDG_Cmd(FunctionalState NewState )
-{
- if((WDG->CR & WDG_Mode_Wdg) == 0)
- {
- /* Timer mode */
- if(NewState == ENABLE)
- {
- /* Start timer by setting SC bit in Control register */
- WDG->CR |= WDG_Counter_Start;
- }
- else
- {
- /* Stop timer by clearning SC bit in Control register */
- WDG->CR &= WDG_Counter_Stop;
- }
- }
- else
- {
- /* Watchdog mode */
- if(NewState == ENABLE)
- {
- WDG->KR = WDG_KeyValue1;
- WDG->KR = WDG_KeyValue2;
- }
- }
-}
-
-/*******************************************************************************
-* Function Name : WDG_ITConfig
-* Description : Enables or disables the WDG End of Count(EC) interrupt.
-* Input : Newstate: new state of the End of Count(EC) WDG interrupt.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void WDG_ITConfig(FunctionalState NewState)
-{
- if(NewState == ENABLE)
- {
- /* Enable the End of Count interrupt */
- WDG->MR |= WDG_IT_EC;
- }
- else
- {
- /* Disable the End of Count interrupt */
- WDG->MR &= ~WDG_IT_EC;
- }
-}
-
-/*******************************************************************************
-* Function Name : WDG_GetCounter
-* Description : Gets the WDG’s current counter value.
-* Input : None
-* Output : None
-* Return : The WDG current counter value
-*******************************************************************************/
-u16 WDG_GetCounter(void)
-{
- return WDG->CNT;
-}
-
-
-
-
-/*******************************************************************************
-* Function Name : WDG_GetITStatus
-* Description : Checks whether the WDG End of Count(EC) interrupt is occured or not.
-* Input : None
-* Output : None
-* Return : The new state of WDG_IT (SET or RESET).
-*******************************************************************************/
-ITStatus WDG_GetITStatus(void)
-{
- if(((WDG->SR & WDG_IT_EC) != RESET )&&((WDG->MR & WDG_IT_EC) != RESET ))
- {
- return SET;
- }
- else
- {
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : WDG_ClearITPendingBit
-* Description : Clears the WDG's End of Count(EC) interrupt pending bit.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void WDG_ClearITPendingBit(void)
-{
- /* Clear the EC pending bit */
- WDG->SR &= ~WDG_IT_EC;
-
-}
-
-/*******************************************************************************
-* Function Name : WDG_ClearFlag
-* Description : Clears the WDG's End of Count(EC) Flag.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void WDG_ClearFlag(void)
-{
- /* Clear the EC Flag */
-
- WDG->SR &= ~WDG_FLAG_EC;
-
-}
-
-
-/*******************************************************************************
-* Function Name : WDG_GetFlagStatus
-* Description : Checks whether the WDG End of Count(EC) flag is set or not.
-* Input : None
-* Output : None
-* Return : The new state of the WDG_FLAG (SET or RESET).
-*******************************************************************************/
-FlagStatus WDG_GetFlagStatus(void)
-{
- if((WDG->SR & WDG_FLAG_EC) != RESET )
- {
- return SET;
- }
- else
- {
- return RESET;
- }
-}
-
-
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_complex_startup/src/91x_wiu.c b/uc_str912/prj_blinky_complex_startup/src/91x_wiu.c
deleted file mode 100644
index 3154a3c..0000000
--- a/uc_str912/prj_blinky_complex_startup/src/91x_wiu.c
+++ /dev/null
@@ -1,190 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_wiu.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the WIU software functions.
-**********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-**********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*********************************************************************************/
-
-/* Standard include ----------------------------------------------------------*/
-#include "91x_wiu.h"
-#include "91x_scu.h"
-
-/* Include of other module interface headers ---------------------------------*/
-/* Local includes ------------------------------------------------------------*/
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/* Interface functions -------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/******************************************************************************
-* Function Name : WIU_Init
-* Description : Initializes the WIU unit according to the specified parameters
-* in the WIU_InitTypeDef structure.
-* Input : WIU_InitStruct: pointer to a WIU_InitTypeDef structure that
-* contains the configuration information for the WIU peripheral.
-* Output : None
-* Return : None
-******************************************************************************/
-void WIU_Init(WIU_InitTypeDef* WIU_InitStruct)
-{
- /* select the Wake-up line to be used */
- WIU->MR |= WIU_InitStruct->WIU_Line;
-
- /* configure the triggering edge */
- if(WIU_InitStruct->WIU_TriggerEdge == WIU_RisingEdge)
- {
- /* trigger on rising edge */
- WIU->TR |= WIU_InitStruct->WIU_Line;
- }
- else
- {
- /* trigger on falling edge */
- WIU->TR &= ~WIU_InitStruct->WIU_Line;
- }
-
- if(WIU_InitStruct->WIU_Mode == WIU_Mode_SWInterrupt)
- {
- /* enable interrupt mode */
- WIU->CTRL |= WIU_Mode_Interrupt;
-
- /* set the corresponding WUINT bit*/
- WIU->INTR |= WIU_InitStruct->WIU_Line;
- }
- else
- {
- /* configure the WIU mode */
- WIU->CTRL |= WIU_InitStruct->WIU_Mode;
- }
-}
-
-/******************************************************************************
-* Function Name : WIU_DeInit
-* Description : Deinitializes the WIU registers to their default reset values.
-* Input : None
-* Output : None
-* Return : None
-******************************************************************************/
-void WIU_DeInit(void)
-{
- /* initialize the WIU registers to their reset value */
- SCU_APBPeriphReset(__WIU, ENABLE);
- SCU_APBPeriphReset(__WIU, DISABLE);
-}
-
-/******************************************************************************
-* Function Name : WIU_StructInit
-* Description : Fills in a WIU_InitTypeDef structure with the reset value of
-* each parameter.
-* Input : WIU_InitStruct : pointer to a WIU_InitTypeDef structure
-* which will be initialized.
-* Output : None
-* Return : None
-******************************************************************************/
-void WIU_StructInit(WIU_InitTypeDef* WIU_InitStruct)
-{
- /* initialize the WIU_InitStruct fields to their reset values */
- WIU_InitStruct->WIU_Mode = 0x0 ;
- WIU_InitStruct->WIU_Line = 0x0 ;
- WIU_InitStruct->WIU_TriggerEdge = WIU_FallingEdge ;
-}
-
-
-/*******************************************************************************
-* Function Name : WIU_GenerateSWInterrupt
-* Description : Generates a Software interrupt.
-* Input : - WIU_Line: specifies the WIU lines to be enabled or
-* disabled. This parameter can be:
-* - WIU_Linex: External interrupt line x where x(0..31)
-* Output : None
-* Return : None
-*******************************************************************************/
-void WIU_GenerateSWInterrupt(u32 WIU_Line)
-{
- WIU->INTR |= WIU_Line;
-}
-
-/*******************************************************************************
-* Function Name : WIU_GetFlagStatus
-* Description : Checks whether the specified WIU line flag is set or not.
-* Input : - WIU_Line: specifies the WIU lines flag to check.
-* This parameter can be:
-* - WIU_Linex: External interrupt line x where x(0..31)
-* Output : None
-* Return : The new state of WIU_Line (SET or RESET).
-*******************************************************************************/
-FlagStatus WIU_GetFlagStatus(u32 WIU_Line)
-{
- if((WIU->PR & WIU_Line) != RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : WIU_ClearFlag
-* Description : Clears the WIU’s line pending flags.
-* Input : - WIU_Line: specifies the WIU lines flags to clear.
-* This parameter can be:
-* - WIU_Linex: External interrupt line x where x(0..31)
-* Output : None
-* Return : None
-*******************************************************************************/
-void WIU_ClearFlag(u32 WIU_Line)
-{
- WIU->PR = WIU_Line;
-}
-
-/*******************************************************************************
-* Function Name : WIU_GetITStatus
-* Description : Checks whether the specified WIU line is asserted or not.
-* Input : - WIU_Line: specifies the WIU lines to check.
-* This parameter can be:
-* - WIU_Linex: External interrupt line x where x(0..31)
-* Output : None
-* Return : The new state of WIU_Line (SET or RESET).
-*******************************************************************************/
-ITStatus WIU_GetITStatus(u32 WIU_Line)
-{
- if(((WIU->PR & WIU_Line) != RESET)&& ((WIU->MR & WIU_Line) != RESET))
- {
- return SET;
- }
- else
- {
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : WIU_ClearITPendingBit
-* Description : Clears the WIU’s line pending bits.
-* Input : - WIU_Line: specifies the WIU lines to clear.
-* This parameter can be:
-* - WIU_Linex: External interrupt line x where x(0..31)
-* Output : None
-* Return : None
-*******************************************************************************/
-void WIU_ClearITPendingBit(u32 WIU_Line)
-{
- WIU->PR = WIU_Line;
-}
-
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_complex_startup/src/usb_core.c b/uc_str912/prj_blinky_complex_startup/src/usb_core.c
deleted file mode 100644
index aacc3d4..0000000
--- a/uc_str912/prj_blinky_complex_startup/src/usb_core.c
+++ /dev/null
@@ -1,860 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : usb_core.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : USB protocol state machine functions
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-#include "USB_lib.h"
-
-#define ValBit(VAR,Place) (VAR & (1<<Place))
-#define SetBit(VAR,Place) ( VAR |= (1<<Place) )
-#define ClrBit(VAR,Place) ( VAR &= ((1<<Place)^255) )
-
-WORD_BYTE StatusInfo;
-#define StatusInfo0 StatusInfo.bw.bb1 /* Reverse bb0 & bb1 */
-#define StatusInfo1 StatusInfo.bw.bb0
-BYTE *Standard_GetStatus(WORD Length);
-RESULT Standard_ClearFeature(void);
-
-#define Send0LengthData() { \
- SetEPTxCount(ENDP0, 0); \
- vSetEPTxStatus(EP_TX_VALID); \
- }
-
-/* cells saving status during interrupt servicing */
-WORD SaveRState;
-WORD SaveTState;
-#define vSetEPRxStatus(st) (SaveRState = st)
-#define vSetEPTxStatus(st) (SaveTState = st)
-#define USB_StatusIn() Send0LengthData()
-#define USB_StatusOut() vSetEPRxStatus(EP_RX_VALID)
-
-/*******************************************************************************
-* Function Name : Standard_GetConfiguration
-* Description : This routine is called to Get the configuration value
-* Input : Length
-* Output : None
-* Return : -Return a pointer on Current_Configuration value if
-* the "Length" is not 0.
-*******************************************************************************/
-BYTE *Standard_GetConfiguration(WORD Length)
-{
- if (Length == 0)
- return (BYTE *)sizeof(pInformation->Current_Configuration);
- return (BYTE *)&pInformation->Current_Configuration;
-} /* Standard_GetConfiguration */
-
-/*******************************************************************************
-* Function Name : Standard_SetConfiguration
-* Description : This routine is called to set the configuration value
-* Input : None
-* Output : None
-* Return : Return USB_SUCCESS, if the request is performed
-* Return UNSUPPORT, if the request is invalid
-*******************************************************************************/
-RESULT Standard_SetConfiguration(void)
-{
- if (pInformation->USBwValue0 <= Device_Table.Total_Configuration
- && pInformation->USBwValue1==0 && pInformation->USBwIndex==0)
- {
- pInformation->Current_Configuration = pInformation->USBwValue0;
- return USB_SUCCESS;
- }
- else
- return UNSUPPORT;
-} /* Standard_SetConfiguration */
-
-/*******************************************************************************
-* Function Name : Standard_GetInterface
-* Description : Return the Alternate Setting of the current interface
-* Input : Length
-* Output : None
-* Return : Return a pointer on Current_AlternateSetting value
-* if length is not 0
-*******************************************************************************/
-BYTE *Standard_GetInterface(WORD Length)
-{
- if (Length == 0)
- return (BYTE *)sizeof(pInformation->Current_AlternateSetting);
- return (BYTE *)&pInformation->Current_AlternateSetting;
-} /* Standard_GetInterface */
-
-/*******************************************************************************
-* Function Name : Standard_SetInterface
-* Description : This routine is called to set the interface alternate settings
-* Input : None
-* Output : None
-* Return : USB_SCCESS or UNSUPPORT
-*******************************************************************************/
-RESULT Standard_SetInterface(void)
-{
- DEVICE_INFO *pInfo = pInformation;
- DEVICE_PROP *pProp = pProperty;
- RESULT Re;
-
- /*test if the specified Interface and Alternate Setting
- are supported by the application Firmware*/
- Re = (*pProp->Class_Get_Interface_Setting)(pInfo->USBwIndex0,pInfo->USBwValue0);
- if(pInfo->Current_Configuration==0 )
- return UNSUPPORT;
- else
- {
- if (Re!= USB_SUCCESS || pInfo->USBwIndex1!=0 || pInfo->USBwValue1!=0)
- return UNSUPPORT;
- else if ( Re == USB_SUCCESS)
- {
- pInfo->Current_Interface = pInfo->USBwIndex0;
- pInfo->Current_AlternateSetting = pInfo->USBwValue0;
- return USB_SUCCESS;
- }
- else return UNSUPPORT;
- }
-} /* Standard_SetInterface */
-
-
-/*******************************************************************************
-* Function Name : Standard_GetStatus
-* Description : GetStatus request processing (device, interface or endpoint)
-* Input : None
-* Output : None
-* Return : pointer on StatusInfo
-*******************************************************************************/
-
-BYTE *Standard_GetStatus(WORD Length)
-{
- DEVICE_INFO *pInfo = pInformation;
- if (Length == 0)
- return (BYTE *)2;
- StatusInfo.w = 0;
- /* Reset Status Information */
- if (Type_Recipient == (STANDARD_REQUEST | DEVICE_RECIPIENT))
- {
- /*Get Device Status */
- BYTE Feature = pInfo->Current_Feature;
- if (ValBit(Feature, 5))
- SetBit(StatusInfo0, 1); /* Remote Wakeup enabled */
- if (ValBit(Feature, 7))
- ClrBit(StatusInfo0, 0); /* Bus-powered */
- else if (ValBit(Feature, 6))
- SetBit(StatusInfo0, 0); /* Self-powered */
- }
- else if (Type_Recipient == (STANDARD_REQUEST | INTERFACE_RECIPIENT))/*Interface Status*/
- return (BYTE *)&StatusInfo;
- else if (Type_Recipient == (STANDARD_REQUEST | ENDPOINT_RECIPIENT))
- {
- /*Get EndPoint Status*/
- BYTE Related_Endpoint;
- BYTE wIndex0 = pInfo->USBwIndex0;
- Related_Endpoint = (wIndex0 & 0x0f);
- if (ValBit(wIndex0, 7))
- {
- /* IN endpoint */
- if (_GetTxStallStatus( Related_Endpoint ))
- SetBit(StatusInfo0, 0); /* IN Endpoint stalled */
- }
- else
- {
- /* OUT endpoint */
- if (_GetRxStallStatus( Related_Endpoint ))
- SetBit(StatusInfo0, 0); /* OUT Endpoint stalled */
- }
- }
- else
- return NULL;
- return (BYTE *)&StatusInfo;
-} /* Standard_GetStatus */
-
-
-/*******************************************************************************
-* Function Name : Standard_ClearFeature
-* Description : Clear (or disable) a specific feature (device or endpoint)
-* Input : None
-* Output : None
-* Return : USB_SUCCESS or UNSUPPORT
-*******************************************************************************/
-RESULT Standard_ClearFeature(void)
-{
- DEVICE_INFO *pInfo = pInformation;
- BYTE Type_Rec = Type_Recipient;
- WORD Status;
- if ( Type_Rec == (STANDARD_REQUEST | DEVICE_RECIPIENT) )
- {
- if (pInfo->USBwValue != DEVICE_REMOTE_WAKEUP)
- return UNSUPPORT;
- /*Device Clear Feature*/
- ClrBit(pInfo->Current_Feature, 5);
- return USB_SUCCESS;
- }
- else if ( Type_Rec == (STANDARD_REQUEST | ENDPOINT_RECIPIENT) )
- {
- /*EndPoint Clear Feature*/
- DEVICE* pDev;
- BYTE Related_Endpoint;
- BYTE wIndex0;
- BYTE rEP;
- if (pInfo->USBwValue != ENDPOINT_STALL || pInfo->USBwIndex1!=0)
- return UNSUPPORT;
- pDev = &Device_Table;
- wIndex0 = pInfo->USBwIndex0;
- rEP = wIndex0 & ~0x80;
- Related_Endpoint = ENDP0 + rEP;
- if (ValBit(pInfo->USBwIndex0, 7))
- Status =_GetEPTxStatus(Related_Endpoint);
- /*get Status of endpoint & stall the request if the related_ENdpoint is Disabled*/
- else Status =_GetEPRxStatus(Related_Endpoint);
- if (rEP >= pDev->Total_Endpoint || Status==0 || pInfo->Current_Configuration==0)
- return UNSUPPORT;
- if (wIndex0 & 0x80)
- {
- /* IN endpoint */
- if (_GetTxStallStatus(Related_Endpoint ))
- _SetEPTxStatus(Related_Endpoint, EP_TX_NAK);
- }
- else
- {
- /* OUT endpoint */
- if (_GetRxStallStatus(Related_Endpoint))
- {
- if (Related_Endpoint == ENDP0)
- {
- /* After clear the STALL, enable the default endpoint receiver */
- _SetEPRxStatus(Related_Endpoint, EP_RX_VALID);
- }
- else
- _SetEPRxStatus(Related_Endpoint, EP_RX_NAK);
- }
- }
- return USB_SUCCESS;
- }
- return UNSUPPORT;
-} /* Standard_ClearFeature */
-
-
-/*******************************************************************************
-* Function Name : Standard_SetEndPointFeature
-* Description : Sets endpoint feature
-* Input : None
-* Output : None
-* Return : USB_SUCCESS or UNSUPPORT
-*******************************************************************************/
-RESULT Standard_SetEndPointFeature(void)
-{
- DEVICE_INFO *pInfo = pInformation;
- BYTE wIndex0;
- BYTE Related_Endpoint;
- BYTE rEP;
- WORD Status;
- wIndex0 = pInfo->USBwIndex0;
- rEP = wIndex0 & ~0x80;
- Related_Endpoint = ENDP0 + rEP;
- if (ValBit(pInfo->USBwIndex0, 7))
- Status =_GetEPTxStatus(Related_Endpoint);// get Status of endpoint & stall the request if
- //the related_ENdpoint is Disable
- else Status =_GetEPRxStatus(Related_Endpoint);
- if (Related_Endpoint >= Device_Table.Total_Endpoint || pInfo->USBwValue !=0 || Status==0 ||
- pInfo->Current_Configuration==0 /*&& Related_Endpoint!=ENDP0)*/)
- return UNSUPPORT;
- else
- {
- if (wIndex0 & 0x80)
- {
- /* IN endpoint */
- _SetEPTxStatus(Related_Endpoint, EP_TX_STALL);
- }
- else
- {
- /* OUT endpoint */
- _SetEPRxStatus(Related_Endpoint, EP_RX_STALL);
- }
- }
- return USB_SUCCESS;
-} /*Standard_SetEndPointFeature */
-
-
-/*******************************************************************************
-* Function Name : Standard_SetDeviceFeature
-* Description : Set or enable a specific feature of Device
-* Input : None
-* Output : None
-* Return : USB_SUCCESS
-*******************************************************************************/
-RESULT Standard_SetDeviceFeature(void)
-{
- SetBit(pInformation->Current_Feature, 5);
- return USB_SUCCESS;
-
-} /*Standard_SetDeviceFeature */
-
-/*******************************************************************************
-* Function Name : Standard_GetStringDescriptor
-* Description : GetStringDescriptor
-* Input :
-* Output : None
-* Return : Pointer
-*******************************************************************************/
-
-BYTE *Standard_GetStringDescriptor(WORD Length, ONE_DESCRIPTOR *pDesc)
-{
- int len, offset, wOffset;
- wOffset = pInformation->Ctrl_Info.Usb_wOffset;
- if (Length == 0)
- {
- offset = 0;
- do
- {
- len = (int)*(pDesc->Descriptor + offset);
- if (wOffset >= 0 && wOffset < len)
- {
- len -= wOffset;
- if (len > 0)
- return (BYTE*)len;
- break;
- }
- wOffset -= len;
- offset += len;
- }
- while (offset < pDesc->Descriptor_Size);
- return 0;
- }
- return pDesc->Descriptor + wOffset;
-}/* Standard_GetStringDescriptor */
-
-/*******************************************************************************
-* Function Name : Standard_GetDescriptorData
-* Description : GetDescriptorData
-* Input :
-* Output : None
-* Return : Return pointer on string descriptor if length is not 0
-* Return string descriptor length if length is 0
-*******************************************************************************/
-
-BYTE *Standard_GetDescriptorData(WORD Length, ONE_DESCRIPTOR *pDesc)
-{
- int len, wOffset;
- wOffset = pInformation->Ctrl_Info.Usb_wOffset;
- if (Length == 0)
- {
- len = pDesc->Descriptor_Size - wOffset;
- if (len <= 0)
- return 0;
- return (BYTE *)len;
- }
- return pDesc->Descriptor + wOffset;
-} /* Standard_GetDescriptorData */
-
-/*******************************************************************************
-* Function Name : DataStageOut
-* Description : Data OUT stage of a control transfer
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void DataStageOut()
-{
- ENDPOINT_INFO *pEPinfo = &pInformation->Ctrl_Info;
- WORD save_rLength;
- save_rLength = pEPinfo->Usb_rLength;
- if (pEPinfo->CopyData && save_rLength)
- {
- BYTE *Buffer;
- WORD Length;
- WORD wBuffer;
- WORD *Source;
- Length = pEPinfo->PacketSize;
- if (Length > save_rLength)
- Length = save_rLength;
- Buffer = (*pEPinfo->CopyData)(Length);
- pEPinfo->Usb_rLength -= Length;
- pEPinfo->Usb_rOffset += Length;
- Source = (WORD*)(PMAAddr + GetEPRxAddr(ENDP0));
- while (Length)
- {
- wBuffer = *Source;
- Source++;
- *Buffer = wBuffer&0x00FF;
- *(Buffer+1) = ((wBuffer&0xFF00)>>8);
- Buffer++;
- Buffer++;
- Length--;
- if(Length == 0) break; /* odd counter */
- Length--;
- }
- }
- if(pEPinfo->Usb_rLength !=0)
- {
- vSetEPRxStatus(EP_RX_VALID);/* reenable for next data reception */
- SetEPTxCount(ENDP0, 0);
- vSetEPTxStatus(EP_TX_VALID);/* Expect the host to abort the data OUT stage */
- }
- /* Set the next State*/
- if (pEPinfo->Usb_rLength >= pEPinfo->PacketSize)
- pInformation->ControlState = OUT_DATA;
- else
- {
- if (pEPinfo->Usb_rLength >0)
- pInformation->ControlState = LAST_OUT_DATA;
- else if (pEPinfo->Usb_rLength == 0)
- {
- pInformation->ControlState = WAIT_STATUS_IN;
- USB_StatusIn();
- }
- }
-} /* DataStageOut */
-
-/*******************************************************************************
-* Function Name : DataStageIn
-* Description : Data IN stage of a Control Transfer
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void DataStageIn(void)
-{
- ENDPOINT_INFO *pEPinfo = &pInformation->Ctrl_Info;
- WORD save_wLength = pEPinfo->Usb_wLength;
- BYTE ControlState;
- BYTE *DataBuffer;
- WORD Length;
- DWORD tmp;
- int i;
- DWORD *pTxBuff;
-
-
-
- if (save_wLength == 0)
- {
- /* no more data to send so STALL the TX Status*/
- ControlState = WAIT_STATUS_OUT;
- vSetEPTxStatus(EP_TX_STALL);
- goto Expect_Status_Out;
- }
- Length = pEPinfo->PacketSize;
- ControlState = (save_wLength < Length) ? LAST_IN_DATA : IN_DATA;
-
- /* Same as UsbWrite */
- if (Length > save_wLength)
- Length = save_wLength;
- DataBuffer = (*pEPinfo->CopyData)(Length);
- /* transfer data from buffer to PMA */
- pTxBuff = (DWORD *)(PMAAddr + GetEPTxAddr(ENDP0));
- for(i=0;i < Length;)
- {
- tmp = *DataBuffer;
- tmp|=*(DataBuffer+1)<<8;
- tmp|=*(DataBuffer+2)<<16;
- tmp|=*(DataBuffer+3)<<24;
- DataBuffer = DataBuffer+4;
- i=i+4;
- *pTxBuff=tmp;
- pTxBuff++;
- }
- SetEPTxCount(ENDP0, Length);
- pEPinfo->Usb_wLength -= Length;
- pEPinfo->Usb_wOffset += Length;
- vSetEPTxStatus(EP_TX_VALID);
- USB_StatusOut();/* Expect the host to abort the data IN stage */
-
-Expect_Status_Out: pInformation->ControlState = ControlState;
-
-}/* DataStageIn */
-
-/*******************************************************************************
-* Function Name : NoData_Setup0
-* Description : Proceed the processing of setup request without data stage
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void NoData_Setup0()
-{
- DEVICE_INFO *pInfo = pInformation;
- RESULT Result;
- BYTE RequestNo = pInformation->USBbRequest;
- BYTE ControlState;
-
- /*Standard Device Requests*/
- if (Type_Recipient == (STANDARD_REQUEST | DEVICE_RECIPIENT))
- {
- /*SET_CONFIGURATION*/
- if (RequestNo == SET_CONFIGURATION)
- Result = Standard_SetConfiguration();
-
- /*SET ADDRESS*/
- else if (RequestNo == SET_ADDRESS)
- {
- if(pInfo->USBwValue0 > 127 || pInfo->USBwValue1!=0
- ||pInfo->USBwIndex!=0 || pInfo->Current_Configuration!=0)
- {
- ControlState = STALLED;
- goto exit_NoData_Setup0;
- }
- else Result = USB_SUCCESS;
- }
-
- /*SET FEATURE*/
- else if (RequestNo == SET_FEATURE)
- {
- if (pInfo->USBwValue0==DEVICE_REMOTE_WAKEUP && pInfo->USBwIndex==0
- && ValBit(pInfo->Current_Feature,5))
- Result = Standard_SetDeviceFeature();
- else
- Result = UNSUPPORT;
- }
-
- /*Clear FEATURE */
- else if (RequestNo == CLEAR_FEATURE)
- {
- if (pInfo->USBwValue0==DEVICE_REMOTE_WAKEUP && pInfo->USBwIndex==0
- &&ValBit(pInfo->Current_Feature,5))
- Result = Standard_ClearFeature();
- else
- Result = UNSUPPORT;
- }
- }
-
- /*Standard Interface Requests*/
- else if (Type_Recipient == (STANDARD_REQUEST | INTERFACE_RECIPIENT))
- {
- /*SET INTERFACE*/
- if (RequestNo == SET_INTERFACE)
- Result = Standard_SetInterface();
- }
-
- /*Standard EndPoint Requests*/
- else if (Type_Recipient == (STANDARD_REQUEST | ENDPOINT_RECIPIENT))
- {
- /*CLEAR FEATURE for EndPoint*/
- if (RequestNo == CLEAR_FEATURE)
- Result = Standard_ClearFeature();
-
- /*SET FEATURE for EndPoint*/
- else if (RequestNo == SET_FEATURE)
- {
- Result = Standard_SetEndPointFeature();
- }
- }
-
- else Result = UNSUPPORT;
- if (Result != USB_SUCCESS)
- {
- /*Check and Process possible Class_NoData_Setup Requests*/
- Result = (*pProperty->Class_NoData_Setup)(RequestNo);
- if (Result == NOT_READY)
- {
- ControlState = PAUSE;
- goto exit_NoData_Setup0;
- }
- }
- if (Result != USB_SUCCESS)
- {
- ControlState = STALLED;
- goto exit_NoData_Setup0;
- }
- ControlState = WAIT_STATUS_IN; /* After no data stage SETUP */
- USB_StatusIn();
-
-exit_NoData_Setup0:
- pInfo->ControlState = ControlState;
- return;
-} /* NoData_Setup0 */
-
-/*******************************************************************************
-* Function Name : Data_Setup0
-* Description : Processing Setup Requests with data stage
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void Data_Setup0()
-{
- DEVICE_INFO *pInfo = pInformation;
- DEVICE_PROP *pProp = pProperty;
- BYTE *(*CopyRoutine)(WORD);
- RESULT Result;
- BYTE Request_No = pInfo->USBbRequest;
- BYTE *pbLen;
- BYTE Related_Endpoint,Reserved;
- WORD wOffset,wLen,Status;
-
- CopyRoutine = NULL;
- wOffset = 0;
-
- /*GET_DESCRIPTOR*/
- if (Request_No == GET_DESCRIPTOR)
- {
- if (Type_Recipient == (STANDARD_REQUEST | DEVICE_RECIPIENT))
- {
- BYTE wValue1 = pInfo->USBwValue1;
- if (wValue1 == DEVICE_DESCRIPTOR)
- CopyRoutine = pProp->GetDeviceDescriptor;
- else if (wValue1 == CONFIG_DESCRIPTOR)
- CopyRoutine = pProp->GetConfigDescriptor;
- else if (wValue1 == STRING_DESCRIPTOR)
- {
- wOffset = pInfo->USBwValue0;
- CopyRoutine = pProp->GetStringDescriptor;
- }
- }
- }
-
- /*GET STATUS*/
- else if (Request_No == GET_STATUS && pInfo->USBwValue==0
- && pInfo->USBwLength == 0x0002 && pInfo->USBwIndex1==0)
- {
- /* GET STATUS for Device*/
- if (Type_Recipient == (STANDARD_REQUEST | DEVICE_RECIPIENT) && pInfo->USBwIndex==0)
- {
- CopyRoutine = Standard_GetStatus;
- }
-
- /* GET STATUS for Interface*/
- else if (Type_Recipient == (STANDARD_REQUEST | INTERFACE_RECIPIENT))
- {
- if ((*pProp->Class_Get_Interface_Setting)(pInfo->USBwIndex0,0)==USB_SUCCESS
- && pInfo->Current_Configuration!=0)
- CopyRoutine = Standard_GetStatus;
- }
-
- /* GET STATUS for EndPoint*/
- else if (Type_Recipient == (STANDARD_REQUEST | ENDPOINT_RECIPIENT))
- {
- Related_Endpoint = (pInfo->USBwIndex0 & 0x0f);
- Reserved= pInfo->USBwIndex0 & 0x70;
- if (ValBit(pInfo->USBwIndex0, 7))
- Status =_GetEPTxStatus(Related_Endpoint);
- else Status =_GetEPRxStatus(Related_Endpoint);
- if(Related_Endpoint < Device_Table.Total_Endpoint && Reserved==0 && Status != 0)
- CopyRoutine = Standard_GetStatus;
- }
- }
-
- /*GET CONFIGURATION*/
- else if (Request_No == GET_CONFIGURATION)
- {
- if ( Type_Recipient == (STANDARD_REQUEST | DEVICE_RECIPIENT) )
- CopyRoutine = Standard_GetConfiguration;
- }
-
- /*GET INTERFACE*/
- else if (Request_No == GET_INTERFACE)
- {
- if (Type_Recipient == (STANDARD_REQUEST | INTERFACE_RECIPIENT)
- && pInfo->Current_Configuration!=0 && pInfo->USBwValue==0
- && pInfo->USBwIndex1==0 && pInfo->USBwLength == 0x0001
- && (*pProperty->Class_Get_Interface_Setting)(pInfo->USBwIndex0,0)==USB_SUCCESS)
- CopyRoutine = Standard_GetInterface;
- }
-
- if (CopyRoutine)
- {
- pInfo->Ctrl_Info.Usb_wOffset = wOffset;
- pInfo->Ctrl_Info.CopyData = CopyRoutine;
- pbLen = (*CopyRoutine)(0);
- wLen = (WORD)((DWORD)pbLen);
- pInfo->Ctrl_Info.Usb_wLength = wLen;
- Result = USB_SUCCESS;
- }
- else
- {
- /*check and process possible Class_Data_Setup request*/
- Result = (*pProp->Class_Data_Setup)(pInfo->USBbRequest);
- if(Result == NOT_READY)
- {
- pInfo->ControlState = PAUSE;
- return;
- }
- }
- if (pInfo->Ctrl_Info.Usb_wLength == 255)
- {
- /* Data is not ready, wait it */
- pInfo->ControlState = PAUSE;
- return;
- }
- if (Result == UNSUPPORT || pInfo->Ctrl_Info.Usb_wLength == 0)
- {
- /* Unsupported request */
- pInfo->ControlState = STALLED;
- return;
- }
- if (ValBit(pInfo->USBbmRequestType, 7))
- {
- /* Device ==> Host */
- WORD wLength = pInfo->USBwLength;
- /* Restrict the data length to be the one host asks */
- if (pInfo->Ctrl_Info.Usb_wLength > wLength)
- pInfo->Ctrl_Info.Usb_wLength = wLength;
- pInfo->Ctrl_Info.PacketSize = pProp->MaxPacketSize;
- DataStageIn();
- }
- else
- {
- pInfo->ControlState = OUT_DATA;
- vSetEPRxStatus(EP_RX_VALID);/* enable for next data reception */
- }
- return;
-} /* Data_Setup0 */
-
-/*******************************************************************************
-* Function Name : Setup0_Process
-* Description : Setup Token processing (entry point)
-* Input : None
-* Output : None
-* Return : (see Post0_Process)
-*******************************************************************************/
-BYTE Setup0_Process()
-{
- DEVICE_INFO *pInfo = pInformation;
- WORD* pBuf;
-
- pBuf= (WORD *)(GetEPRxAddr(ENDP0)+PMAAddr);
- if (pInfo->ControlState != PAUSE)
- {
- pInfo->USBbmRequestType = (*pBuf)&0xFF; /* bmRequestType */
- pInfo->USBbRequest = ((*pBuf)&0xFF00)>>8; /* bRequest */
- pInfo->USBwValue = ByteSwap(*(pBuf+1)); /* wValue */
- pInfo->USBwIndex = ByteSwap(*(pBuf+2)); /* wIndex */
- pInfo->USBwLength = *(pBuf+3); /* wLength */
- }
- pInfo->ControlState = SETTING_UP;
- if (pInfo->USBwLength == 0)
- {
- /* Setup with no data stage */
- NoData_Setup0();
- }
- else
- {
- /* Setup with data stage */
- Data_Setup0();
- }
- return Post0_Process();
-} /* Setup0_Process */
-
-/*******************************************************************************
-* Function Name : In0_Process
-* Description : Process the IN tocken on control endpoint
-* Input : None
-* Output : None
-* Return : (see Post0_Process)
-*******************************************************************************/
-BYTE In0_Process()
-{
- DEVICE_INFO *pInfo = pInformation;
- BYTE ControlState = pInfo->ControlState;
- if (ControlState == IN_DATA || ControlState == LAST_IN_DATA)
- {
- DataStageIn();
- ControlState = pInfo->ControlState;
- }
- else if (ControlState == WAIT_STATUS_IN)
- {
- if (pInfo->USBbRequest == SET_ADDRESS &&
- Type_Recipient == (STANDARD_REQUEST | DEVICE_RECIPIENT) )
- {
- SetDeviceAddress(pInfo->USBwValue0);
- }
- (*pProperty->Process_Status_IN)();
- ControlState = STALLED;
- }
- else
- ControlState = STALLED;
- pInfo->ControlState = ControlState;
- return Post0_Process();
-} /* In0_Process */
-
-/*******************************************************************************
-* Function Name : Out0_Process
-* Description : Process the OUT token on control endpoint
-* Input : None
-* Output : None
-* Return : (see Post0_Process)
-*******************************************************************************/
-BYTE Out0_Process()
-{
- DEVICE_INFO *pInfo = pInformation;
- BYTE ControlState = pInfo->ControlState;
- if(ControlState == OUT_DATA || ControlState == LAST_OUT_DATA)
- DataStageOut();
- else if (ControlState == WAIT_STATUS_OUT)
- {
- (*pProperty->Process_Status_OUT)();
- ControlState = STALLED;
- }
- else if (ControlState == IN_DATA || ControlState == LAST_IN_DATA)
- {
- /* host aborts the transfer before finish */
- ControlState = STALLED;
- }
- /* Unexpect state, STALL the endpoint */
- else
- {
- ControlState = STALLED;
- }
- pInfo->ControlState = ControlState;
- return Post0_Process();
-} /* Out0_Process */
-
-/*******************************************************************************
-* Function Name : Post0_Process
-* Description : Stalls ENDPOINT0 if ControlState = STALLED
-* Input : None
-* Output : None
-* Return : 0: if ControlState is not " PAUSE "
-* 1: if ControlState is "PAUSE"
-*******************************************************************************/
-BYTE Post0_Process()
-{
- _SetEPRxCount(ENDP0, STD_MAXPACKETSIZE);
- if (pInformation->ControlState == STALLED)
- {
- vSetEPRxStatus(EP_RX_STALL);
- vSetEPTxStatus(EP_TX_STALL);
- }
- return (pInformation->ControlState == PAUSE);
-} /* Post0_Process */
-
-
-/*******************************************************************************
-* Function Name : SetDeviceAddress
-* Description : Set Device Address
-* Input : Val: Device Address
-* Output : None
-* Return : None
-*******************************************************************************/
-void SetDeviceAddress(BYTE Val)
-{
- int i;
- DEVICE *pDevice = &Device_Table;
- /* BYTE EP0 = pDevice->EP0; */
- int nEP = pDevice->Total_Endpoint;
- /* set address in every used endpoint */
- for(i=0;i<nEP;i++)
- {
- _SetEPAddress((BYTE)i, (BYTE)i);
- } /* for */
- _SetDADDR(Val|DADDR_EF); /* set device address and enable function */
-} /* SetDeviceAddress */
-
-
-/*******************************************************************************
-* Function Name : NOP_Process
-* Description : Do Nothing
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void NOP_Process(void)
-{
-}
-
diff --git a/uc_str912/prj_blinky_complex_startup/src/usb_init.c b/uc_str912/prj_blinky_complex_startup/src/usb_init.c
deleted file mode 100644
index 0580c26..0000000
--- a/uc_str912/prj_blinky_complex_startup/src/usb_init.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : usb_init.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : initialization routines & global variables
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-#include "91x_lib.h"
-#include "USB_lib.h"
-
-/* Save token on endpoint 0 */
- BYTE EP0_Token ;
-
-/* Interrupt flags. */
-/* Each bit represents an interrupt is coming to that endpoint */
- WORD Token_Event ;
-
-/* The number of current endpoint, it will be used to specify an endpoint */
- BYTE EPindex;
-
-/* Points to the DEVICE_INFO structure of current device */
-/* The purpose of this register is to speed up the execution */
-DEVICE_INFO *pInformation;
-
-/* Points to the DEVICE_PROP structure of current device */
-/* The purpose of this register is to speed up the execution */
-DEVICE_PROP *pProperty;
-
-/* Temporary save the state of Rx & Tx status. */
-/* Whenever the Rx or Tx state is changed, its value is saved */
-/* in this variable first and will be set to the EPRB or EPRA */
-/* at the end of interrupt process */
- WORD SaveState ;
-
- WORD wInterrupt_Mask;
-
- DEVICE_INFO Device_Info;
-
-/*==========================================================================*/
-/* USB system initialization */
-/*==========================================================================*/
-void USB_Init()
-{
- SetCNTR(0x0003);
- Token_Event = 0; /* Flags of each endpoint interrupt */
- pInformation = &Device_Info;
- pInformation->ControlState = 2;
- pProperty = &Device_Property;
- /* Initialize devices one by one */
- pProperty->Init();
-
-} /* USB_Init() */
-
-/*==========================================================================*/
diff --git a/uc_str912/prj_blinky_complex_startup/src/usb_int.c b/uc_str912/prj_blinky_complex_startup/src/usb_int.c
deleted file mode 100644
index 28c956b..0000000
--- a/uc_str912/prj_blinky_complex_startup/src/usb_int.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : usb_int.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : Endpoint CTR interrupt service routine
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-#include "USB_lib.h"
-extern void (*pEpInt[9])(void);
-
-void CTR_ISR()
-{
- WORD wEPVal;
- /* stay in loop while pending ints */
- while(((wIstr = _GetISTR()) & ISTR_CTR)!= 0)
- {
- _SetISTR((WORD)CLR_CTR); /* clear CTR flag */
- /* extract highest priority endpoint number */
- EPindex = (BYTE)(wIstr & ISTR_EP_ID);
- if(EPindex == 0) /* Decode and service control endpoint interrupt */
- {
- /* save RX & TX status */
- /* and set both to NAK */
- SaveRState = _GetEPRxStatus(ENDP0);
- SaveTState = _GetEPTxStatus(ENDP0);
- _SetEPRxStatus(ENDP0, EP_RX_NAK);
- _SetEPTxStatus(ENDP0, EP_TX_NAK);
- if((wIstr & ISTR_DIR) == 0)
- {
- /* DIR = 0 => IN int */
- _ClearEP_CTR_TX(ENDP0);
- In0_Process();
- /* check if SETUP arrived during IN processing */
- wEPVal = _GetENDPOINT(ENDP0);
- if((wEPVal & (EP_CTR_RX|EP_SETUP)) != 0)
- {
- _ClearEP_CTR_RX(ENDP0); /* SETUP bit kept frozen while CTR_RX = 1 */
- Setup0_Process();
- }
- }
- else
- {
- /* DIR = 1 & CTR_RX => SETUP or OUT int */
- /* DIR = 1 & (CTR_TX | CTR_RX) => 2 int pending */
- wEPVal = _GetENDPOINT(ENDP0);
- if((wEPVal & EP_CTR_TX) != 0)
- {
- _ClearEP_CTR_TX(ENDP0);
- In0_Process();
- }
- if((wEPVal &EP_SETUP) != 0)
- {
- _ClearEP_CTR_RX(ENDP0); /* SETUP bit kept frozen while CTR_RX = 1 */
- Setup0_Process();
- }
- else if((wEPVal & EP_CTR_RX) != 0)
- {
- _ClearEP_CTR_RX(ENDP0);
- Out0_Process();
- }
- }
- /* before terminate set Tx & Rx status */
- _SetEPRxStatus(ENDP0, SaveRState);
- _SetEPTxStatus(ENDP0, SaveTState);
- }
- else /* Decode and service non control endpoints interrupt */
- {
- /* process related endpoint register */
- wEPVal = _GetENDPOINT(EPindex);
- if((wEPVal & EP_CTR_RX) != 0)
- {
- /* clear int flag */
- _ClearEP_CTR_RX(EPindex);
- }
- if((wEPVal & EP_CTR_TX) != 0)
- {
- /* clear int flag */
- _ClearEP_CTR_TX(EPindex);
- }
- /* call service function */
- (*pEpInt[EPindex-1])();
- }
- }
-} /* CTR_ISR */
-
diff --git a/uc_str912/prj_blinky_complex_startup/src/usb_mem.c b/uc_str912/prj_blinky_complex_startup/src/usb_mem.c
deleted file mode 100644
index 5bb2bda..0000000
--- a/uc_str912/prj_blinky_complex_startup/src/usb_mem.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : usb_mem.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : utility functions for memory transfers
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-#include "usb_lib.h"
-#include "usb_mem.h"
-
-/*******************************************************************************
-* Function Name : UserToPMABufferCopy
-* Description : Copy a buffer from user memory to packet memory area
-* Input : - pbUsrBuf = pointer to user memory area
-* - wPMABufAddr = address into PMA
-* - wNBytes = number of bytes to be copied
-* Output : None
-* Return value : None
-*******************************************************************************/
-void UserToPMABufferCopy(BYTE *pbUsrBuf,WORD wPMABufAddr, WORD wNBytes)
-{
- DWORD *pdwVal;
-
- DWORD wTra, i;
- union
- {
- BYTE *bTra;
- DWORD *wTra;
- }pBuf;
- int wNTrasf=wNBytes;
-
- pdwVal= (DWORD *)(PMAAddr+(DWORD)((wPMABufAddr)));
- pBuf.wTra = &wTra;
- for(i=0;i < wNTrasf;)
- {
- *(pBuf.bTra ) = *pbUsrBuf++;
- i++;
- *(pBuf.bTra+1) = *pbUsrBuf++;
- i++;
- *(pBuf.bTra+2) = *pbUsrBuf++;
- i++;
- *(pBuf.bTra+3) = *pbUsrBuf++;
- i++;
- *pdwVal = wTra;
- pdwVal++;
- }
-} /* UserToPMABufferCopy */
-
-/*******************************************************************************
-* Function Name : PMAToUserBufferCopy
-* Description : Copy a buffer from packet memory area to user memory
-* Input : - pbUsrBuf = pointer to user memory area
-* - wPMABufAddr = address into PMA
-* - wNBytes = number of bytes to be copied
-* Output : None
-* Return value : None
-*******************************************************************************/
-void PMAToUserBufferCopy(BYTE *pbUsrBuf,WORD wPMABufAddr, WORD wNBytes)
-{
- BYTE *pbVal;
- WORD wNTrasf=wNBytes;
- if((wNBytes) == 0) return;
- pbVal = (BYTE *)(PMAAddr + wPMABufAddr);
- while(1)
- {
- *pbUsrBuf++ = *pbVal++;
- if((--wNTrasf) == 0) return;
- *pbUsrBuf++ = *pbVal++;
- if((--wNTrasf) == 0) return;
- }/* while */
-} /* PMAToUserBufferCopy */
-
-
-
diff --git a/uc_str912/prj_blinky_complex_startup/src/usb_regs.c b/uc_str912/prj_blinky_complex_startup/src/usb_regs.c
deleted file mode 100644
index 0555753..0000000
--- a/uc_str912/prj_blinky_complex_startup/src/usb_regs.c
+++ /dev/null
@@ -1,1000 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : usb_regs.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : Interface functions to USB cell registers
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-#include "USB_lib.h"
-
-/*******************************************************************************
-* Function Name : SetCNTR
-* Description : Sets the CNTR (Control Register)
-* Input : wRegValue = register value
-* Output : None
-* Return : None
-*******************************************************************************/
-void SetCNTR(WORD wRegValue)
-{
- _SetCNTR(wRegValue);
-}
-
-/*******************************************************************************
-* Function Name : GetCNTR
-* Description : Gets the CNTR
-* Input : None
-* Output : None
-* Return : CNTR value
-*******************************************************************************/
-WORD GetCNTR(void)
-{
- return(_GetCNTR());
-}
-
-/*******************************************************************************
-* Function Name : SetISTR
-* Description : Sets the ISTR
-* Input : wRegValue = register value
-* Output : None
-* Return : None
-*******************************************************************************/
-void SetISTR(WORD wRegValue)
-{
- _SetISTR(wRegValue);
-}
-
-/*******************************************************************************
-* Function Name : GetISTR
-* Description : Gets the ISTR (Interrupt Status Register)
-* Input : None
-* Output : None
-* Return : ISTR register value
-*******************************************************************************/
-WORD GetISTR(void)
-{
- return(_GetISTR());
-}
-
-/*******************************************************************************
-* Function Name : GetFNR
-* Description : Gets the FNR (Frame Number Register)
-* Input : None
-* Output : None
-* Return : FNR regiter value
-*******************************************************************************/
-WORD GetFNR(void)
-{
- return(_GetFNR());
-}
-
-/*******************************************************************************
-* Function Name : SetDADDR
-* Description : Sets the DADDR (Device Address Register)
-* Input : wRegValue = register value
-* Output : None
-* Return : None
-*******************************************************************************/
-void SetDADDR(WORD wRegValue)
-{
- _SetDADDR(wRegValue);
-}
-
-/*******************************************************************************
-* Function Name : GetDADDR
-* Description : Gets the DADDR (Device Address Register)
-* Input : None
-* Output : None
-* Return : DADDR register value
-*******************************************************************************/
-WORD GetDADDR(void)
-{
- return(_GetDADDR());
-}
-
-/*******************************************************************************
-* Function Name : SetBTABLE
-* Description : Sets the BTABLE (Buffer Table Register)
-* Input : BTABLE value
-* Output : None
-* Return : None
-*******************************************************************************/
-void SetBTABLE(WORD wRegValue)
-{
- _SetBTABLE(wRegValue);
-}
-
-/*******************************************************************************
-* Function Name : GetBTABLE
-* Description : Gets the BTABLE (Buffer Table Register)
-* Input : None
-* Output : None
-* Return : BTABLE value
-*******************************************************************************/
-WORD GetBTABLE(void)
-{
- return(_GetBTABLE());
-}
-
-/*******************************************************************************
-* Function Name : SetENDPOINT
-* Description : Sets the Endpoint Register
-* Input : bEpNum = endpoint Number[0:9], wRegValue= register value
-* Output : None
-* Return : None
-*******************************************************************************/
-void SetENDPOINT(BYTE bEpNum, WORD wRegValue)
-{
- _SetENDPOINT(bEpNum,wRegValue);
-}
-
-/*******************************************************************************
-* Function Name : GetENDPOINT
-* Description : Gets the Endpoint Register value
-* Input : bEpNum = endpoint number[0:9]
-* Output : None
-* Return : Endpoint register value
-*******************************************************************************/
-WORD GetENDPOINT(BYTE bEpNum)
-{
- return(_GetENDPOINT(bEpNum));
-}
-
-/*******************************************************************************
-* Function Name : SetEPtype
-* Description : Sets the Endpoint Type
-* Input : - bEpNum = endpoint number[0:9]
-* - wType = endpint type: EP_BULK,EP_CONTROL,EP_ISOCHRONOUS
-* EP_INTERRUPT
-* Output : None
-* Return : None
-*******************************************************************************/
-void SetEPType(BYTE bEpNum, WORD wType)
-{
- _SetEPType(bEpNum, wType);
-}
-
-/*******************************************************************************
-* Function Name : GetEPtype
-* Description : Gets the Endpoint type
-* Input : bEpNum = endpoint number[0:9]
-* Output : None
-* Return : Endpoint type: EP_BULK,EP_CONTROL,EP_ISOCHRONOUS
-* EP_INTERRUPT
-*******************************************************************************/
-WORD GetEPType(BYTE bEpNum)
-{
- return(_GetEPType(bEpNum));
-}
-
-/*******************************************************************************
-* Function Name : SetEPTxStatus
-* Description : Sets the endpoint Tx status
-* Input : - bEpNum = endpoint number[0:9]
-* - wState = Tx status: EP_TX_DIS,EP_TX_STALL,EP_TX_NAK,EP_TX_VALID
-* Output : None
-* Return : None
-*******************************************************************************/
-void SetEPTxStatus(BYTE bEpNum, WORD wState)
-{
- _SetEPTxStatus(bEpNum,wState);
-}
-
-/*******************************************************************************
-* Function Name : SetEPRxStatus
-* Description : Sets the endpoint Rx status
-* Input : - bEpNum = endpoint number[0:9]
-* - wState = Rx status: EP_RX_DIS,EP_RX_STALL,EP_RX_NAK,EP_RX_VALID
-* Output : None
-* Return : None
-*******************************************************************************/
-void SetEPRxStatus(BYTE bEpNum, WORD wState)
-{
- _SetEPRxStatus(bEpNum,wState);
-}
-
-/*******************************************************************************
-* Function Name : GetEPTxStatus
-* Description : Gets the endpoint Tx Status
-* Input : bEpNum = endpoint number[0:9]
-* Output : None
-* Return : Enpointx Tx Status: EP_TX_DIS,EP_TX_STALL,EP_TX_NAK,EP_TX_VALID
-*******************************************************************************/
-WORD GetEPTxStatus(BYTE bEpNum)
-{
- return(_GetEPTxStatus(bEpNum));
-}
-
-/*******************************************************************************
-* Function Name : GetEPRxStatus
-* Description : Gets the endpoint Rx Status
-* Input : bEpNum = endpoint number[0:9]
-* Output : None
-* Return : Enpointx Rx Status: EP_RX_DIS,EP_RX_STALL,EP_RX_NAK,EP_RX_VALID
-*******************************************************************************/
-WORD GetEPRxStatus(BYTE bEpNum)
-{
- return(_GetEPRxStatus(bEpNum));
-}
-
-/*******************************************************************************
-* Function Name : SetEPTxValid
-* Description : Sets the Endpoint Tx Status as valid
-* Input : bEpNum = endpoint number[0:9]
-* Output : None
-* Return : None
-*******************************************************************************/
-void SetEPTxValid(BYTE bEpNum)
-{
- _SetEPTxStatus(bEpNum, EP_TX_VALID);
-}
-
-/*******************************************************************************
-* Function Name : SetEPRxStatus
-* Description : Sets the Endpoint Rx Status as valid
-* Input : bEpNum = endpoint number[0:9]
-* Output : None
-* Return : None
-*******************************************************************************/
-void SetEPRxValid(BYTE bEpNum)
-{
- _SetEPRxStatus(bEpNum, EP_RX_VALID);
-}
-
-/*******************************************************************************
-* Function Name : SetEP_KIND
-* Description : Sets the Endpoint EP_KIND bit
-* Input : bEpNum = endpoint number[0:9]
-* Output : None
-* Return : None
-*******************************************************************************/
-void SetEP_KIND(BYTE bEpNum)
-{
- _SetEP_KIND(bEpNum);
-}
-
-/*******************************************************************************
-* Function Name : ClearEP_KIND
-* Description : Clears the Endpoint EP_KIND bit
-* Input : bEpNum = endpoint number[0:9]
-* Output : None
-* Return : None
-*******************************************************************************/
-void ClearEP_KIND(BYTE bEpNum)
-{
- _ClearEP_KIND(bEpNum);
-}
-
-/*******************************************************************************
-* Function Name : Clear_Status_Out
-* Description : Clears the Status_Out bit (= EP_KIND bit)
-* Input : bEpNum = endpoint number[0:9]
-* Output : None
-* Return : None
-*******************************************************************************/
-void Clear_Status_Out(BYTE bEpNum)
-{
- _ClearEP_KIND(bEpNum);
-}
-
-/*******************************************************************************
-* Function Name : Set_Status_Out
-* Description : Sets the Status_Out bit (=EP_KIND bit)
-* Input : bEpNum = endpoint number[0:9]
-* Output : None
-* Return : None
-*******************************************************************************/
-void Set_Status_Out(BYTE bEpNum)
-{
- _SetEP_KIND(bEpNum);
-}
-
-/*******************************************************************************
-* Function Name : SetEPDoubleBuff
-* Description : Sets the DBL_BUF bit (=EP_KIND bit)
-* Input : bEpNum = endpoint number[0:9]
-* Output : None
-* Return : None
-*******************************************************************************/
-void SetEPDoubleBuff(BYTE bEpNum)
-{
- _SetEP_KIND(bEpNum);
-}
-
-/*******************************************************************************
-* Function Name : ClearEPDoubleBuff
-* Description : Clears the DBL_BUF bit (=EP_KIND bit)
-* Input : bEpNum = endpoint number[0:9]
-* Output : None
-* Return : None
-*******************************************************************************/
-void ClearEPDoubleBuff(BYTE bEpNum)
-{
- _ClearEP_KIND(bEpNum);
-}
-
-/*******************************************************************************
-* Function Name : GetTxStallStatus
-* Description : checks if endpoint Tx status== STALL
-* Input : bEpNum: endpoint number[0:9]
-* Output : None
-* Return : TRUE or FALSE
-*******************************************************************************/
-BOOL GetTxStallStatus(BYTE bEpNum)
-{
- return(_GetTxStallStatus(bEpNum));
-}
-
-/*******************************************************************************
-* Function Name : GetRxStallStatus
-* Description : checks if endpoint Rx status ==STALL
-* Input : bEpNum: endpoint number[0:9]
-* Output : None
-* Return : TRUE or FALSE
-*******************************************************************************/
-BOOL GetRxStallStatus(BYTE bEpNum)
-{
- return(_GetRxStallStatus(bEpNum));
-}
-
-/*******************************************************************************
-* Function Name : ClearEP_CTR_RX
-* Description : Clears the CTR_RX flag in endpoint
-* Input : bEpNum: endpoint number[0:9]
-* Output : None
-* Return : None
-*******************************************************************************/
-void ClearEP_CTR_RX(BYTE bEpNum)
-{
- _ClearEP_CTR_RX(bEpNum);
-}
-
-/*******************************************************************************
-* Function Name : ClearEP_CTR_Tx
-* Description : Clears the CTR_Tx flag
-* Input : bEpNum: endpoint number[0:9]
-* Output : None
-* Return : None
-*******************************************************************************/
-void ClearEP_CTR_TX(BYTE bEpNum)
-{
- _ClearEP_CTR_TX(bEpNum);
-}
-
-/*******************************************************************************
-* Function Name : ToggleDTOG_RX
-* Description : Toggles the DTOG_RX bit
-* Input : bEpNum: endpoint number[0:9]
-* Output : None
-* Return : None
-*******************************************************************************/
-void ToggleDTOG_RX(BYTE bEpNum)
-{
- _ToggleDTOG_RX(bEpNum);
-}
-
-/*******************************************************************************
-* Function Name : ToggleDTOG_TX
-* Description : Toggles the DTOG_Tx bit
-* Input : bEpNum: endpoint number[0:9]
-* Output : None
-* Return : None
-*******************************************************************************/
-void ToggleDTOG_TX(BYTE bEpNum)
-{
- _ToggleDTOG_TX(bEpNum);
-}
-
-/*******************************************************************************
-* Function Name : ClearDTOG_RX
-* Description : Clears the DTOG_RX bit
-* Input : bEpNum: endpoint number[0:9]
-* Output : None
-* Return : None
-*******************************************************************************/
-void ClearDTOG_RX(BYTE bEpNum)
-{
- _ClearDTOG_RX(bEpNum);
-}
-
-/*******************************************************************************
-* Function Name : ClearDTOG_TX
-* Description : Clears the DTOG_TX bit
-* Input : bEpNum: endpoint number[0:9]
-* Output : None
-* Return : None
-*******************************************************************************/
-void ClearDTOG_TX(BYTE bEpNum)
-{
- _ClearDTOG_TX(bEpNum);
-}
-
-/*******************************************************************************
-* Function Name : SetEPAddress
-* Description : Sets the Endpoint Address
-* Input : -bEpNum: endpoint number[0:9]
-* -bAddr : Address value
-* Output : None
-* Return : None
-*******************************************************************************/
-void SetEPAddress(BYTE bEpNum,BYTE bAddr)
-{
- _SetEPAddress(bEpNum,bAddr);
-}
-
-/*******************************************************************************
-* Function Name : GetEPAddress
-* Description : Gets the Endpoint Address
-* Input : bEpNum: endpoint number[0:9]
-* Output : None
-* Return : Endpoint address value
-*******************************************************************************/
-BYTE GetEPAddress(BYTE bEpNum)
-{
- return(_GetEPAddress(bEpNum));
-}
-
-/*******************************************************************************
-* Function Name : SetEPTxAddr
-* Description : Sets the Endpoint Tx buffer Addr offset in the PMA
-* Input : - bEpNum: endpoint number[0:9]
-* - wAddr : Tx buffer address offset value in the PMA
-* Output : None
-* Return : None
-*******************************************************************************/
-void SetEPTxAddr(BYTE bEpNum, WORD wAddr)
-{
- _SetEPTxAddr(bEpNum,wAddr);
-}
-
-/*******************************************************************************
-* Function Name : SetEPRxAddr
-* Description : Sets the Endpoint Rx buffer Addr in the Packet Memory Area PMA
-* Input : - bEpNum: endpoint number[0:9]
-* - wAddr : Rx buffer address offset value in the PMA
-* Output : None
-* Return : None
-*******************************************************************************/
-void SetEPRxAddr(BYTE bEpNum, WORD wAddr)
-{
- _SetEPRxAddr(bEpNum,wAddr);
-}
-
-/*******************************************************************************
-* Function Name : GetEPTxAddr
-* Description : Gets the Endpoint Tx buffer address offset in PMA
-* Input : bEpNum: endpoint number[0:9]
-* Output : None
-* Return : Endpoint Tx buffer Address offset in PMA
-*******************************************************************************/
-WORD GetEPTxAddr(BYTE bEpNum)
-{
- return (_GetEPTxAddr(bEpNum));
-}
-
-/*******************************************************************************
-* Function Name : GetEPRxAddr
-* Description : Gets the Endpoint Rx buffer address offset in the PMA
-* Input : bEpNum: endpoint number[0:9]
-* Output : None
-* Return : Endpoint Rx buffer Address offset in PMA
-*******************************************************************************/
-WORD GetEPRxAddr(BYTE bEpNum)
-{
- return(_GetEPRxAddr(bEpNum));
-}
-
-/*******************************************************************************
-* Function Name : SetEPTxCount
-* Description : Sets the Endpoint Tx buffer size
-* Input : - bEpNum: endpoint number[0:9]
-* - wCount: size (in bytes) of the Tx buffer in the PMA
-* Output : None
-* Return : None
-*******************************************************************************/
-void SetEPTxCount(BYTE bEpNum, WORD wCount)
-{
- _SetEPTxCount(bEpNum,wCount);
-}
-
-/*******************************************************************************
-* Function Name : SetEPRxCount
-* Description : Sets the Endpoint Rx buffer size
-* Input : - bEpNum: endpoint number[0:9]
-* - wCount : size (in bytes) of the Rx buffer in the PMA
-* Output : None
-* Return : None
-*******************************************************************************/
-void SetEPRxCount(BYTE bEpNum, WORD wCount)
-{
- _SetEPRxCount(bEpNum,wCount);
-}
-/*******************************************************************************
-* Function Name : GetEPTxCount
-* Description : Gets the Endpoint count value
-* Input : bEpNum: endpoint number[0:9]
-* Output : None
-* Return : Endpoint TxCount value
-*******************************************************************************/
-
-WORD GetEPTxCount(BYTE bEpNum)
-{
- return(_GetEPTxCount(bEpNum));
-}
-
-/*******************************************************************************
-* Function Name : GetEPRxCount
-* Description : Gets the Endpoint Count register value
-* Input : bEpNum: endpoint number[0:9]
-* Output : None
-* Return : Endpoint Rx Count value
-*******************************************************************************/
-WORD GetEPRxCount(BYTE bEpNum)
-{
- return(_GetEPRxCount(bEpNum));
-}
-
-/*******************************************************************************
-* Function Name : SetEPDblBuffAddr
-* Description : Set double buffer buffer0, buffer1 addresses in the PMA
-* Input : - bEpNum: endpoint number[0:9]
-* - wBuf0Addr : buffer0 Address offset in PMA
-* - wBuf1Addr : buffer1 Address offset in PMA
-* Output : None
-* Return : None
-*******************************************************************************/
-void SetEPDblBuffAddr(BYTE bEpNum, WORD wBuf0Addr, WORD wBuf1Addr)
-{
- _SetEPDblBuffAddr(bEpNum, wBuf0Addr, wBuf1Addr);
-}
-
-/*******************************************************************************
-* Function Name : SetEPDBlBuf0Addr
-* Description : Set buffer0 address in PMA
-* Input : -bEpNum: endpoint number[0:9]
-* -wBuf0Addr: buffer0 Address offset in PMA
-* Output : None
-* Return : None
-*******************************************************************************/
-void SetEPDblBuf0Addr(BYTE bEpNum,WORD wBuf0Addr)
-{
- _SetEPDblBuf0Addr(bEpNum, wBuf0Addr);
-}
-/*******************************************************************************
-* Function Name : SetEPDBlBuf1Addr
-* Description : Set buffer1 address in PMA
-* Input : -bEpNum: endpoint number[0:9]
-* -wBuf1Addr: buffer1 Address offset in PMA
-* Output : None
-* Return : None
-*******************************************************************************/
-void SetEPDblBuf1Addr(BYTE bEpNum,WORD wBuf1Addr)
-{
- _SetEPDblBuf1Addr(bEpNum, wBuf1Addr);
-}
-
-/*******************************************************************************
-* Function Name : GetEPDblBuf0Addr
-* Description : Gets buffer0 address
-* Input : bEpNum: endpoint number[0:9]
-* Output : None
-* Return : Buffer 0 Address offset in PMA
-*******************************************************************************/
-WORD GetEPDblBuf0Addr(BYTE bEpNum)
-{
- return(_GetEPDblBuf0Addr(bEpNum));
-}
-
-/*******************************************************************************
-* Function Name : GetEPDblbuf1Addr
-* Description : Gets buffer1 address
-* Input : bEpNum: endpoint number[0:9]
-* Output : None
-* Return : Buffer 1 Address offset in PMA
-*******************************************************************************/
-WORD GetEPDblBuf1Addr(BYTE bEpNum)
-{
- return(_GetEPDblBuf1Addr(bEpNum));
-}
-/*******************************************************************************
-* Function Name : SetEPDblBuf1Count
-* Description : Set buffer1 size
-* Input : - bEpNum: endpoint number[0:9]
-* - bDir: buffer direction : EP_DBUF_OUT or EP_DBUF_IN
-* - wCount: bytes count value
-* Output : None
-* Return : None
-*******************************************************************************/
-void SetEPDblBuf1Count(BYTE bEpNum, BYTE bDir,WORD wCount)
-{
- if(bDir == EP_DBUF_IN)
- /* IN double buffered endpoint */
- {
- *_pEPBufCount(bEpNum)&= 0x000FFFF;
- *_pEPBufCount(bEpNum)|=(wCount<<16);
- }
- else if(bDir == EP_DBUF_OUT)
- /* OUT double buffered endpoint */
- _SetEPRxCount(bEpNum, wCount);
-}
-
-
-/*******************************************************************************
-* Function Name : SetEPDblBuf0Count
-* Description : Set buffer0 size
-* Input : - bEpNum: endpoint number[0:9]
-* - bDir: buffer direction : EP_DBUF_OUT or EP_DBUF_IN
-* - wCount: bytes count value
-* Output : None
-* Return : None
-*******************************************************************************/
-void SetEPDblBuf0Count(BYTE bEpNum, BYTE bDir,WORD wCount)
-{
-DWORD BLsize=0;
-DWORD Blocks;
-if(bDir == EP_DBUF_IN)
-/* IN double bufferd endpoint */
-SetEPTxCount(bEpNum,wCount);
-else if(bDir == EP_DBUF_OUT) {
-/* OUT double bufferd endpoint */
-
- if (wCount < 64) Blocks = wCount>>1;
- else
- {
- BLsize = 0x8000;
- Blocks = wCount>>6;
- }
- *_pEPBufCount(bEpNum) &=~0x8000;
- *_pEPBufCount(bEpNum) |=BLsize;
- *_pEPBufCount(bEpNum) &=~0x7C00;
- *_pEPBufCount(bEpNum) |=Blocks<<10;
- *_pEPBufCount(bEpNum) &=0xFFFFFC00;
- }
-}
-
-/*******************************************************************************
-* Function Name : SetEPDblBuffCount
-* Description : Set buffer0 or 1 size
-* Input : - bEpNum: endpoint number[0:9]
- - bDir: buffer direction : EP_DBUF_OUT, EP_DBUF_IN
- - wCount: bytes count value
-* Output : None
-* Return : None
-*******************************************************************************/
-void SetEPDblBuffCount(BYTE bEpNum, BYTE bDir, WORD wCount)
-{
- SetEPDblBuf0Count(bEpNum, bDir,wCount);
- SetEPDblBuf1Count(bEpNum, bDir,wCount);
-}
-
-/*******************************************************************************
-* Function Name : GetEPDblBuf0Count
-* Description : Get buffer0 bytes count
-* Input : bEpNum: endpoint number[0:9]
-* Output : None
-* Return : buffer0 bytes count
-*******************************************************************************/
-WORD GetEPDblBuf0Count(BYTE bEpNum)
-{
- return(_GetEPDblBuf0Count(bEpNum));
-}
-
-/*******************************************************************************
-* Function Name : GetEPDBuf1Count
-* Description : Get buffer1 bytes count
-* Input : bEpNum: endpoint number[0:9]
-* Output : None
-* Return : buffer1 bytes count
-*******************************************************************************/
-WORD GetEPDblBuf1Count(BYTE bEpNum)
-{
- return(_GetEPDblBuf1Count(bEpNum));
-}
-
-/*******************************************************************************
-* Function Name : Free User buffer
-* Description : Toggles the SW_Buf bit
-* Input : bEpNum: endpoint number[0:9]
-* Output : None
-* Return : None
-*******************************************************************************/
-void FreeUserBuffer(BYTE bEpNum, BYTE bDir)
-{
- if(bDir== EP_DBUF_OUT)
- { /* OUT double buffered endpoint */
- _ToggleDTOG_TX(bEpNum);
- }
- else if(bDir == EP_DBUF_IN)
- { /* IN double buffered endpoint */
- _ToggleDTOG_RX(bEpNum);
- }
-}
-
-/*******************************************************************************
-* Function Name : ToWord
-* Description : Puts 2 bytes into a single word
-* Input : -bh : MSB byte
- -bl : LSB byte
-* Output : None
-* Return : Word
-*******************************************************************************/
-WORD ToWord(BYTE bh, BYTE bl)
-{
- WORD wRet;
- wRet = (WORD)bl | ((WORD)bh << 8);
- return(wRet);
-}
-
-/*******************************************************************************
-* Function Name : ByteSwap
-* Description : Swaps two bytes in a word
-* Input : wSwW: word
-* Output : None
-* Return : Word swapped
-*******************************************************************************/
-WORD ByteSwap(WORD wSwW)
-{
- BYTE bTemp;
- WORD wRet;
- bTemp = (BYTE)(wSwW & 0xff);
- wRet = (wSwW >> 8) | ((WORD)bTemp << 8);
- return(wRet);
-}
-
-
-/* DMA Functions */
-
-/*******************************************************************************
-* Function Name : SetDMAburstTxSize
-* Description : Configure the Burst Size for a Tx Endpoint
-* Input : DestBsize: Destination Burst Size
-* Output : None
-* Return : None
-*******************************************************************************/
-void SetDMABurstTxSize(BYTE DestBsize)
-{
- *DMABSIZE &=~0xEF;
- *DMABSIZE = (DestBsize<<4);
-}
-
-/*******************************************************************************
-* Function Name : SetDMABurstRxSize
-* Description : Configure the Burst Size for a Rx Endpoint
-* Input : SrcBsize: Source Burst
-* Output : None
-* Return : None
-*******************************************************************************/
-void SetDMABurstRxSize(BYTE SrcBsize)
-{
- *DMABSIZE &=~0x7;
- *DMABSIZE = SrcBsize;
-}
-
-/*******************************************************************************
-* Function Name : DMAUnlinkedModeTxConfig
-* Description : Configure a Tx Endpoint to trigger TX Unlinked DMA request
-* Note : Up to three endpoints could be configured to trigger DMA
- request, an index[0:2] must be associated to an endpoint
-* Input : -bEpNum: endpoint number[0:9]
-* -index: 0,1 or 2
-* Output : None
-* Return : None
-*******************************************************************************/
-void DMAUnlinkedModeTxConfig(BYTE bEpNum ,BYTE index)
-{
- *DMACR2 &=~(0x0F<<(4*index));
- *DMACR2 |=bEpNum<<(4*index);
-}
-
-/*******************************************************************************
-* Function Name : DMAUnlinkedModeTxEnable
-* Description : Enable a Tx endpoint to trigger Tx DMA request
-* Input : -index :0,1 or 2 = index associated to endpoint in function
-* "DMAUnlinkedModeTxConfig"
-* Output : None
-* Return : None
-*******************************************************************************/
-void DMAUnlinkedModeTxEnable(BYTE index)
-{
- *DMACR3 &=~0x01; /*DMA Tx linked mode disabled*/
- *DMACR2 &=~0x3000;
- *DMACR2 |=(index+1)<<12;
-}
-
-/*******************************************************************************
-* Function Name : DMAUnlinkedModeTxDisable
-* Description : Enable a Tx endpoint to trigger Tx DMA request
-* Input : index :0,1 or 2 = index associated to endpoint in function
-* "DMAUnlinkedModeTxConfig"
-* Output : None
-* Return : None
-*******************************************************************************/
-void DMAUnlinkedModeTxDisable(BYTE index)
-{
- *DMACR2 &=~0x3000;
-}
-
-/*******************************************************************************
-* Function Name : DMAUnlinkedModeRxEnable
-* Description : Enable a Rx Endpoint to trigger Rx DMA
-* Input : bEpNum: endpoint number[0:9]
-* Output : None
-* Return : None
-*******************************************************************************/
-void DMAUnlinkedModeRxEnable(BYTE bEpNum)
-{
- *DMACR3 &=~0x80; /*DMA Rx linked mode disabled*/
- *DMACR1 |=(0x1<<bEpNum);
-}
-
-/*******************************************************************************
-* Function Name : DMAUnlinkedModeRxDisable
-* Description : Disable a Rx Endpoint to trigger Rx DMA
-* Input : bEpNum: endpoint number[0:9]
-* Output : None
-* Return : None
-*******************************************************************************/
-void DMAUnlinkedModeRxDisable(BYTE bEpNum)
-{
- *DMACR1 &=~(0x1<<bEpNum);
-}
-
-/*******************************************************************************
-* Function Name : DMALinkedModeRxConfig
-* Description : Configure a Rx endpoint to trigger DMA linked request
-* Input : bEpNum: endpoint number[0:9]
-* Output : None
-* Return : None
-*******************************************************************************/
-void DMALinkedModeRxConfig(BYTE bEpNum)
-{
- *DMACR3 &=~0x1E00;
- *DMACR3 |=bEpNum<<9;
-}
-
-/*******************************************************************************
-* Function Name : DMALinkedModeTxConfig
-* Description : Configure a Tx endpoint to trigger DMA linked request
-* Input : bEpNum: endpoint number[0:9]
-* Output : None
-* Return : None
-*******************************************************************************/
-void DMALinkedModeTxConfig(BYTE bEpNum)
-{
- *DMACR3 &=~0x1E;
- *DMACR3 |=bEpNum<<1;
-}
-
-/*******************************************************************************
-* Function Name : DMALinkedModeRxEnable
-* Description : Enable the DMA Linked Rx mode
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void DMALinkedModeRxEnable(void)
-{
- *DMACR3 |=0x100;
- *DMACR3 |=0x2000;
-}
-
-/*******************************************************************************
-* Function Name : DMALinkedModeTxEnable
-* Description : Enable the DMA Linked Tx mode
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void DMALinkedModeTxEnable(void)
-{
- *DMACR3 |=0x1;
- *DMACR3 |=0x20;
-}
-/*******************************************************************************
-* Function Name : DMALinkedModeRxDisable
-* Description : Disable the DMA Linked Rx mode
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void DMALinkedModeRxDisable(void)
-{
- *DMACR3 &=~0x100;
- *DMACR3 &=~0x2000;
-}
-
-/*******************************************************************************
-* Function Name : DMALinkedModeTxDisable
-* Description : Disable the DMA Linked Tx mode
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void DMALinkedModeTxDisable(void)
-{
- *DMACR3 &=~0x1;
- *DMACR3 &=~0x20;
-}
-/*******************************************************************************
-* Function Name : USB_DMASynchEnable
-* Description : Enable the Synchronization Logic
-* Input : TRUE or FALSE
-* Output : None
-* Return : None
-*******************************************************************************/
-void DMASynchEnable(void)
-{
- *DMACR3 |=0x40;
-}
-
-/*******************************************************************************
-* Function Name : USB_DMASynchDisable
-* Description : Disable the Synchronization Logic
-* Input : TRUE or FALSE
-* Output : None
-* Return : None
-*******************************************************************************/
-void DMASynchDisable(void)
-{
- *DMACR3 &=~0x40;
-}
-
-/*******************************************************************************
-* Function Name : SetDMALLITxLength
-* Description : Set the DMA LLI Tx length
-* Input : length
-* Output : None
-* Return : None
-*******************************************************************************/
-void SetDMALLITxLength(BYTE length)
-{
- *DMALLI &=~0xFF;
- *DMALLI |= length;
-}
-
-/*******************************************************************************
-* Function Name : SetDMALLIRxLength
-* Description : Set the DMA LLI Rx length
-* Input : length
-* Output : None
-* Return : None
-*******************************************************************************/
-void SetDMALLIRxLength(BYTE length )
-{
- *DMALLI &=~0xFF00;
- *DMALLI |= length<<8;
-}
-
-/*******************************************************************************
-* Function Name : SetDMALLIRxPacketNum
-* Description : Set the LLI_RX_NPACKETS field in register USB_DMABSIZE register
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void SetDMALLIRxPacketNum(BYTE PacketNum)
-{
- *DMABSIZE &=0xFF;
- *DMABSIZE |=(PacketNum<<8);
-}
-
-/*******************************************************************************
-* Function Name : GetDMALLIPacketNum
-* Description : gets the LLI_RX_NPACKETS field value
-* Input : None
-* Output : None
-* Return : LLI_RX_NPACKETS field value
-*******************************************************************************/
-BYTE GetDMALLIRxPacketNum(void)
-{
- return((BYTE)(*DMABSIZE & 0xFF00)>>8);
-}
diff --git a/uc_str912/prj_blinky_complex_startup/startup912.S b/uc_str912/prj_blinky_complex_startup/startup912.S
deleted file mode 100644
index 84cf524..0000000
--- a/uc_str912/prj_blinky_complex_startup/startup912.S
+++ /dev/null
@@ -1,405 +0,0 @@
-#*************************************************************************
-# *** STR912 Startup Code For GNU Tools (executed after Reset) ***
-#
-# (C) Hitex (UK) Ltd. 2006
-#
-# Disclaimer: Whilst every effort has been made to ensure the correctness
-# of this code, Hitex (UK) Ltd. cannot be held responsible for the consequences
-# of its use. Users should therefore verify its operation before including it
-# in any program.
-#*************************************************************************
-#
-#
-# ---------------------------------------------
-# Include startup macros
-# ---------------------------------------------
-
-//#include "stacks.h"
-
- .include "startup_generic.s"
-
-#
-#
-# System Memory definitions
-#
-# Internal RAM definitions
- .equ RAM_Size, 0x00018000 /* 96K */
- .equ RAM_Base, 0x04000000
-
-#*************************************************************************
-# Control Startup Code Operation
-#*************************************************************************
-.equ SRAM_SETUP , 1 /* Enable setup of SRAM */
-.equ FMI_SETUP , 1 /* Enable FMI Setup */
-.equ CLOCK_SETUP , 0 /* Enable clock setup */
-.equ ETM_SETUP , 0 /* Enable ETM setup */
-
-#*************************************************************************
-# Hardware Definitions
-#*************************************************************************
-
-# Flash Memory Interface (FMI) definitions (Flash banks sizes and addresses)
-.equ FMI_BASE , 0x54000000 /* FMI Base Address (non-buffered) */
-.equ FMI_BBSR_OFS , 0x00 /* Boot Bank Size Register */
-.equ FMI_NBBSR_OFS , 0x04 /* Non-boot Bank Size Register */
-.equ FMI_BBADR_OFS , 0x0C /* Boot Bank Base Address Register #!!! Documentation page 30,*/
-.equ FMI_NBBADR_OFS , 0x10 /* Non-boot Bank Base Address Register #!!! adresseses do not correspond*/
-.equ FMI_CR_OFS , 0x18 /* Control Register */
-.equ FMI_SR_OFS , 0x1C /* Status Register */
-
-
-.equ FMI_CR_Val , 0x00000018 /* NBBEN = 1, BBEN = 1 */
-.equ FMI_BBSR_Val , 0x00000004
-.equ FMI_BBADR_Val , 0x00000000
-.equ FMI_NBBSR_Val , 0x00000002
-.equ FMI_NBBADR_Val , 0x00080000
-#.equ FLASH_CFG_Val , 0x00001010 /* WSTATES = 3, buscfg = 1 */
-.equ FLASH_CFG_Val , 0x00000000 /* WSTATES = 0, buscfg = 0 */
-.equ FMI_SR_Val , 0x0000000B /* Clear status errors RM0006 1.10.6 */
-
-
-# System Control Unit (SCU) definitions
-.equ SCU_BASE , 0x5C002000 /* SCU Base Address (non-buffered) */
-.equ SCU_CLKCNTR_OFS , 0x00 /* Clock Control register Offset */
-.equ SCU_PLLCONF_OFS , 0x04 /* PLL Configuration register Offset */
-.equ SCU_SYSTAT_OFS , 0x08 /* SCU status register offset */
-.equ SCU_PWRMNG , 0x0C /* Power Management register */
-.equ SCU_PCGR0_OFS , 0x14 /* Peripheral Clock Gating Register 0 Offset */
-.equ SCU_PCGR1_OFS , 0x18 /* Peripheral Clock Gating Register 1 Offset */
-.equ SCU_PRR0_OFS , 0x1C /* Peripheral reset register 0 */
-.equ SCU_PRR1_OFS , 0x1C /* Peripheral reset register 1 */
-.equ SCU_SCR0_OFS , 0x34 /* System Configuration Register 0 Offset */
-
-
-.equ SCU_CLKCNTR_Val , 0x00030000 /* Use PLL, external memory ratio/2 */
-.equ SCU_PLLCONF_Val , 0x000AC019
-.equ SCU_PCGR0_Val , 0x0000001B /* Setup SRAM, Prefetch Queue/Branch cache, FMI */
-.equ SCU_PCGR1_Val , 0x00C40000 /* Setup GPIO8, 9 & 4 */
-.equ SCU_PRR0_Val , 0x00001013 /* reset VIC, EMI, DMA, USB, MAC */
-.equ SCU_SCR0_Val , 0x00000196 /* Disable Prefetch Queue and Branch cache, SRAM = 96kb */
-.equ SCU_SYSSTAT_LOCK , 0x01 /* Check for PLL locked */
-
-# APB Bridge 1 & 2 definitions (Peripherals)
-.equ APB0_BUF_BASE , 0x48001802 /* APB Bridge 0 Buffered Base Address */
-.equ APB0_NBUF_BASE , 0x58000000 /* APB Bridge 0 Non-buffered Base Address */
-.equ APB1_BUF_BASE , 0x4C000000 /* APB Bridge 1 Buffered Base Address */
-.equ APB1_NBUF_BASE , 0x5C000000 /* APB Bridge 1 Non-buffered Base Address */
-
-# ETM Definitions
-.equ IOPORT2_ETM_ENABLE_BASE , 0x5C00204C
-.equ IOPORT6_ETM_ENABLE_BASE , 0x5C00205C
-
-.equ IOPORT2_ETM_ENABLE_VAL , 0x0000FFFF
-.equ IOPORT6_ETM_ENABLE_VAL , 0x0000FFFF
-
-#*************************************************************************
-# Stack definitions
-#*************************************************************************
-
- .equ UND_Stack_Size, 8
- .equ SVC_Stack_Size, 256
- .equ ABT_Stack_Size, 8
- .equ FIQ_Stack_Size, 32
- .equ IRQ_Stack_Size, 512
- .equ Top_Stack, RAM_Base + RAM_Size
-
-# NOTE: Startup Code must be linked first at Address at which it expects to run.
-
-#*************************************************************************
-# STARTUP EXECUTABLE CODE
-#*************************************************************************
-
- .text
- .arm
- .extern main
- .global _startup
-
-_startup:
-
-#*************************************************************************
-# Exception Vectors
-#*************************************************************************
-Vectors:
- LDR PC, Reset_Addr /* 0x0000 */
- LDR PC, Undef_Addr /* 0x0004 */
- LDR PC, SWI_Addr /* 0x0008 */
- LDR PC, PAbt_Addr /* 0x000C */
- LDR PC, DAbt_Addr /* 0x0010 */
- NOP /* 0x0014 Reserved Vector */
- LDR PC, [PC, #-0xFF0] /* 0x0018 wraps around address space to 0xFFFFFF030. Vector from VicVECAddr */
- LDR PC, FIQ_Addr /* 0x001C FIQ has no VIC vector slot! */
-
-#*************************************************************************
-# Interrupt Vectors
-#*************************************************************************
-
-Reset_Addr: .word Hard_Reset /* CPU reset vector and entry point */
-Undef_Addr: .word Undefined_Handler
-SWI_Addr: .word SWI_Handler
-PAbt_Addr: .word PAbt_Handler
-DAbt_Addr: .word DAbt_Handler
- .word 0 /* Reserved Address */
-IRQ_Addr: .word IRQ_Handler /* Does not get used due to "LDR PC, [PC, #-0xFF0]" above */
-FIQ_Addr: .word FIQ_Handler
-
-# Dummy Interrupt Vector Table (real service routines in INTERRUPT.C)
-
-Undefined_Handler: B Undefined_Handler
-SWI_Handler: B SWI_Handler
-PAbt_Handler: B PAbt_Handler
-DAbt_Handler: B DAbt_Handler
-IRQ_Handler: B IRQ_Handler /* should never get here as IRQ is via VIC slot... */
-FIQ_Handler: B FIQ_Handler
-
-
-#*************************************************************************
-# Reset Handler Entry Point
-#*************************************************************************
-Hard_Reset:
-
- StartupDelay 900000
-
-after_delay:
- # enable buffered mode
- MRC P15, 0, R0, C1, C0, 0
- ORR R0, R0, #0x8
- MCR P15, 0, R0, C1, C0, 0
-
- # workaround for flash write/read
- # set bit 17 (data TCM order)
- # and bit 18 (instruction TCM order)
- MOV R0, #0x60000
- MCR P15, 0x1, R0, C15, C1, 0
-
-
- # clear enables of the VIC1_INTENCR
- LDR R0, =0xfc000014
- LDR R1, =0xffffffff
- STR R1, [R0, #0]
-
- # clear enables of the VIC0_INTENCR
- LDR R0, =0xfffff014
- LDR R1, =0xffffffff
- STR R1, [R0, #0]
-
-#*************************************************************************
-# Setup SRAM Size
-
- .IF SRAM_SETUP == 1
-
- LDR R0, =SCU_BASE
- LDR R1, =SCU_SCR0_Val
- STR R1, [R0, #SCU_SCR0_OFS]
-
- .ENDIF
-
-#*************************************************************************
-# Setup Flash Memory Interface (FMI)
-
- .IF FMI_SETUP == 1
-
- LDR R0, =FMI_BASE
- LDR R1, =(FMI_BBADR_Val >> 2)
- STR R1, [R0, #FMI_BBADR_OFS]
- LDR R1, =FMI_BBSR_Val
- STR R1, [R0, #FMI_BBSR_OFS]
- LDR R1, =(FMI_NBBADR_Val >> 2)
- STR R1, [R0, #FMI_NBBADR_OFS]
- LDR R1, =FMI_NBBSR_Val
- STR R1, [R0, #FMI_NBBSR_OFS]
-
- LDR R2, =FMI_CR_Val
- STR R2, [R0, #FMI_CR_OFS]
- LDR R2, =FMI_SR_Val
- STR R2, [R0, #FMI_SR_OFS]
-
-# # Write "Write flash configuration" command (60h)
-# MOV R0, R1, LSL #2
-# MOV R1, #0x60
-# STRH R1, [R0, #0]
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
-
- # Write "Write flash configuration confirm" command (03h)
-# LDR R2, =(FLASH_CFG_Val >> 2)
-# ADD R0, R0, R2
-# MOV R1, #0x03
-# STRH R1, [R0, #0]
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
-
- .ENDIF
-
-#*************************************************************************
-# Setup Clock PLL
-
- .IF CLOCK_SETUP == 1
-
- LDR R0, =SCU_BASE
- LDR R1, =0x00020002
- STR R1, [R0, #SCU_CLKCNTR_OFS] /* Select OSC as clock src */
-
- NOP /* Wait for oscillator stabilisation */
- NOP /* Must be more than 10 oscillator periods */
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
-
- LDR R1, =0x00000000
- STR R1, [R0, #SCU_PWRMNG] /* power management */
-
- LDR R1, =0x0003C019 /* Disable PLL */
- STR R1, [R0, #SCU_PLLCONF_OFS]
- LDR R1, =SCU_PLLCONF_Val
- STR R1, [R0, #SCU_PLLCONF_OFS] /* Set new PLL values */
-
- .IF (SCU_PLLCONF_Val & 0x8000) /* See if PLL is being used */
-
- LDR R1, =SCU_SYSSTAT_LOCK
-PLL_LOCK_LOOP:
- LDR R2,[R0, #SCU_SYSTAT_OFS] /* Wait for PLL lock */
- ANDS R2, R2, R1
- BEQ PLL_LOCK_LOOP
-
- .ENDIF
-
- LDR R1, =SCU_PLLCONF_Val
- STR R1, [R0, #SCU_PLLCONF_OFS]
- LDR R1, =SCU_CLKCNTR_Val
- STR R1, [R0, #SCU_CLKCNTR_OFS]
-
- LDR R1, =SCU_PCGR0_Val /* Enable clock gating */
- STR R1, [R0, #SCU_PCGR0_OFS]
- LDR R1, =SCU_PRR0_Val
- STR R1, [R0, #SCU_PRR0_OFS]
-
-# LDR R1, =SCU_PCGR1_Val
-# STR R1, [R0, #SCU_PCGR1_OFS]
- .ENDIF
-
-
-#*************************************************************************
-# Embedded Trace Module Setup
-#*************************************************************************
-
- .IF ETM_SETUP == 1
-
-# Configure IOPORT2 for ETM operation
- LDR R0, =IOPORT2_ETM_ENABLE_BASE
- LDR R1, =IOPORT2_ETM_ENABLE_VAL
- STR R1, [R0, #0]
-
-# Configure IOPORT6 for ETM operation
- LDR R0, =IOPORT6_ETM_ENABLE_BASE
- LDR R1, =IOPORT6_ETM_ENABLE_VAL
- STR R1, [R0, #0]
-
- .ENDIF
-
-
-#*************************************************************************
-# Compiler Runtime Environment Setup
-#*************************************************************************
-# Note: R13 = SP
-
-# Setup Stack for each mode
- LDR R0, =Top_Stack
-
-# Set up Fast Interrupt Mode and set FIQ Mode Stack
- MSR CPSR_c, #Mode_FIQ|I_BIT|F_BIT
- mov r13, r0
- sub r0, r0, #FIQ_Stack_Size
-
-# Set up Interrupt Mode and set IRQ Mode Stack
- msr CPSR_c, #Mode_IRQ|I_BIT|F_BIT
- mov r13, r0
- sub r0, r0, #IRQ_Stack_Size
-
-# Set up Abort Mode and set Abort Mode Stack
- msr CPSR_c, #Mode_ABT|I_BIT|F_BIT
- mov r13, r0
- sub r0, r0, #ABT_Stack_Size
-
-# Set up Undefined Instruction Mode and set Undef Mode Stack
- msr CPSR_c, #Mode_UND|I_BIT|F_BIT
- mov r13, r0
- sub r0, r0, #UND_Stack_Size
-
-# Set up Supervisor Mode and set Supervisor Mode Stack
- msr CPSR_c, #Mode_SVC|I_BIT|F_BIT
- mov r13, r0
- sub r0, r0, #SVC_Stack_Size
-
-# Set up User Mode and set User Mode Stack
- msr CPSR_c, #Mode_USR /* Leave interrupts enabled in user mode */
- mov r13, r0 /* Note: interrupts will not happen until VIC is enabled */
-
-# Setup a default Stack Limit (when compiled with "-mapcs-stack-check")
-# SUB SL, SP, #1<<10 /* 1kB */
-
-# Initialise current CPU status to prevent unwanted interrupts
-# msr CPSR_c, #0x000000D3
-
-#*************************************************************************
-# Initialise RAM For Compiler Variables
-#*************************************************************************
-
- copy_section2 data, _efixed, _srelocate, _erelocate
-
-#*************************************************************************
-# Clear .bss section
-#*************************************************************************
-
- clear_section bss, _szero, _ezero
-
-#*************************************************************************
-# Enter the C code
-#*************************************************************************
-# Jump to main()
-
-# variant for "long jump"
-# ldr r0, =main
-# mov lr, pc
-# bx r0
-
-# variant for "short jump"
- B main
-
-# secure loop
-forever:
- B forever
-
-#*************************************************************************
-# END
-#*************************************************************************
- .end
diff --git a/uc_str912/prj_blinky_complex_startup/startup912.S_old b/uc_str912/prj_blinky_complex_startup/startup912.S_old
deleted file mode 100644
index 91d7f88..0000000
--- a/uc_str912/prj_blinky_complex_startup/startup912.S_old
+++ /dev/null
@@ -1,361 +0,0 @@
-#*************************************************************************
-# *** STR912 Startup Code For GNU Tools (executed after Reset) ***
-#
-# (C) Hitex (UK) Ltd. 2006
-#
-# Disclaimer: Whilst every effort has been made to ensure the correctness
-# of this code, Hitex (UK) Ltd. cannot be held responsible for the consequences
-# of its use. Users should therefore verify its operation before including it
-# in any program.
-#*************************************************************************
-#
-#
-# ---------------------------------------------
-# Include startup macros
-# ---------------------------------------------
-
- .include "./startup_generic.S"
-
-# reference to external interrupt handlers
-#
-
-# .extern SWI_Handler
-# .extern PAbt_Handler
-# .extern DAbt_Handler
-# .extern Undefined_Handler
-# .extern FIQ_Handler
-
-#
-# Standard definitions of Mode bits and Interrupt (I & F) flags in PSRs
-#
- .equ Mode_USR, 0x10
- .equ Mode_FIQ, 0x11
- .equ Mode_IRQ, 0x12
- .equ Mode_SVC, 0x13
- .equ Mode_ABT, 0x17
- .equ Mode_UND, 0x1B
- .equ Mode_SYS, 0x1F
-#
- .equ I_BIT, 0x80 /* when I bit is set, IRQ is disabled */
- .equ F_BIT, 0x40 /* when F bit is set, FIQ is disabled */
-#
-#
-# System Memory definitions
-#
-# Internal RAM definitions
- .equ RAM_Size, 0x00018000 /* 96K */
- .equ RAM_Base, 0x04000000
-
-#*************************************************************************
-# Control Startup Code Operation
-#*************************************************************************
-.equ SRAM_SETUP , 0 /* Enable setup of SRAM */
-.equ FMI_SETUP , 0 /* Enable FMI Setup */
-.equ CLOCK_SETUP , 1 /* Enable clock setup */
-.equ ETM_SETUP , 0 /* Enable ETM setup */
-
-#*************************************************************************
-# Hardware Definitions
-#*************************************************************************
-
-# Flash Memory Interface (FMI) definitions (Flash banks sizes and addresses)
-.equ FMI_BASE , 0x54000000 /* FMI Base Address (non-buffered) */
-.equ FMI_BBSR_OFS , 0x00 /* Boot Bank Size Register */
-.equ FMI_NBBSR_OFS , 0x04 /* Non-boot Bank Size Register */
-.equ FMI_BBADR_OFS , 0x0C /* Boot Bank Base Address Register #!!! Documentation page 30,*/
-.equ FMI_NBBADR_OFS , 0x10 /* Non-boot Bank Base Address Register #!!! adresseses do not correspond*/
-.equ FMI_CR_OFS , 0x18 /* Control Register */
-.equ FMI_SR_OFS , 0x1C /* Status Register */
-
-
-.equ FMI_CR_Val , 0x00000018
-.equ FMI_BBSR_Val , 0x00000004
-.equ FMI_BBADR_Val , 0x00000000
-.equ FMI_NBBSR_Val , 0x00000002
-.equ FMI_NBBADR_Val , 0x00080000
-.equ FLASH_CFG_Val , 0x00001010
-.equ FMI_SR_Val , 0x00000003 /* Clear status errors (register not in STR912 manual! */
-
-
-# System Control Unit (SCU) definitions
-.equ SCU_BASE , 0x5C002000 /* SCU Base Address (non-buffered) */
-.equ SCU_CLKCNTR_OFS , 0x00 /* Clock Control register Offset */
-.equ SCU_PLLCONF_OFS , 0x04 /* PLL Configuration register Offset */
-.equ SCU_SYSTAT_OFS , 0x08 /* SCU status register offset */
-.equ SCU_PCGR0_OFS , 0x14 /* Peripheral Clock Gating Register 0 Offset */
-.equ SCU_PCGR1_OFS , 0x18 /* Peripheral Clock Gating Register 1 Offset */
-.equ SCU_SCR0_OFS , 0x34 /* System Configuration Register 0 Offset */
-
-
-.equ SCU_CLKCNTR_Val , 0x00030000 /* Use PLL, external memory ratio/2 */
-.equ SCU_PLLCONF_Val , 0x000AC019
-.equ SCU_PCGR0_Val , 0x000000DB /* Setup ext mem clock, EMI, SRAM, Prefetch Queue/Branch cache, FMI */
-.equ SCU_PCGR1_Val , 0x00C40000 /* Setup GPIO8, 9 & 4 */
-.equ SCU_SCR0_Val , 0x00000196 /* Disable Prefetch Queue and Branch cache, SRAM = 96kb */
-.equ SCU_SYSSTAT_LOCK , 0x01 /* Check for PLL locked */
-
-# APB Bridge 1 & 2 definitions (Peripherals)
-.equ APB0_BUF_BASE , 0x48001802 /* APB Bridge 0 Buffered Base Address */
-.equ APB0_NBUF_BASE , 0x58000000 /* APB Bridge 0 Non-buffered Base Address */
-.equ APB1_BUF_BASE , 0x4C000000 /* APB Bridge 1 Buffered Base Address */
-.equ APB1_NBUF_BASE , 0x5C000000 /* APB Bridge 1 Non-buffered Base Address */
-
-# ETM Definitions
-.equ IOPORT2_ETM_ENABLE_BASE , 0x5C00204C
-.equ IOPORT6_ETM_ENABLE_BASE , 0x5C00205C
-
-.equ IOPORT2_ETM_ENABLE_VAL , 0x0000FFFF
-.equ IOPORT6_ETM_ENABLE_VAL , 0x0000FFFF
-
-#*************************************************************************
-# Stack definitions
-#*************************************************************************
-
- .equ UND_Stack_Size, 8
- .equ SVC_Stack_Size, 256
- .equ ABT_Stack_Size, 8
- .equ FIQ_Stack_Size, 32
- .equ IRQ_Stack_Size, 512
- .equ USR_Stack_Size, 512
- .equ Top_Stack, RAM_Base + RAM_Size
-
-# NOTE: Startup Code must be linked first at Address at which it expects to run.
-
-#*************************************************************************
-# STARTUP EXECUTABLE CODE
-#*************************************************************************
-
- .text
- .arm
- .extern main
- .global _startup
-
-_startup:
-
-#*************************************************************************
-# Exception Vectors
-#*************************************************************************
-Vectors:
- LDR PC, Reset_Addr /* 0x0000 */
- LDR PC, Undef_Addr /* 0x0004 */
- LDR PC, SWI_Addr /* 0x0008 */
- LDR PC, PAbt_Addr /* 0x000C */
- LDR PC, DAbt_Addr /* 0x0010 */
- NOP /* 0x0014 Reserved Vector */
- LDR PC, [PC, #-0xFF0] /* 0x0018 wraps around address space to 0xFFFFFF030. Vector from VicVECAddr */
- LDR PC, FIQ_Addr /* 0x001C FIQ has no VIC vector slot! */
-
-#*************************************************************************
-# Interrupt Vectors
-#*************************************************************************
-
-Reset_Addr: .word Hard_Reset /* CPU reset vector and entry point */
-Undef_Addr: .word Undefined_Handler
-SWI_Addr: .word SWI_Handler
-PAbt_Addr: .word PAbt_Handler
-DAbt_Addr: .word DAbt_Handler
- .word 0 /* Reserved Address */
-IRQ_Addr: .word IRQ_Handler /* Does not get used due to "LDR PC, [PC, #-0xFF0]" above */
-FIQ_Addr: .word FIQ_Handler
-
-# Dummy Interrupt Vector Table (real service routines in INTERRUPT.C)
-
-Undefined_Handler: B Undefined_Handler
-SWI_Handler: B SWI_Handler
-PAbt_Handler: B PAbt_Handler
-DAbt_Handler: B DAbt_Handler
-IRQ_Handler: B IRQ_Handler /* should never get here as IRQ is via VIC slot... */
-FIQ_Handler: B FIQ_Handler
-
-
-#*************************************************************************
-# Reset Handler Entry Point
-#*************************************************************************
-Hard_Reset:
- StartupDelay 500000
-
-#*************************************************************************
-# Setup SRAM Size
-
- .IF SRAM_SETUP == 1
-
- LDR R0, =SCU_BASE
- LDR R1, =SCU_SCR0_Val
- STR R1, [R0, #SCU_SCR0_OFS]
-
- .ENDIF
-
-#*************************************************************************
-# Setup Flash Memory Interface (FMI)
-
- .IF FMI_SETUP == 1
-
- LDR R0, =FMI_BASE
- LDR R1, =FMI_BBSR_Val
- STR R1, [R0, #FMI_BBSR_OFS]
- LDR R1, =FMI_NBBSR_Val
- STR R1, [R0, #FMI_NBBSR_OFS]
- LDR R1, =(FMI_BBADR_Val >> 2)
- STR R1, [R0, #FMI_BBADR_OFS]
- LDR R1, =(FMI_NBBADR_Val >> 2)
- STR R1, [R0, #FMI_NBBADR_OFS]
- LDR R2, =FMI_CR_Val
- STR R2, [R0, #FMI_CR_OFS]
-
- LDR R2, =FMI_SR_Val
- STR R2, [R0, #FMI_SR_OFS]
-
- # Write "Write flash configuration" command (60h)
- MOV R0, R1, LSL #2
- MOV R1, #0x60
- STRH R1, [R0, #0]
-
- # Write "Write flash configuration confirm" command (03h)
- LDR R2, =(FLASH_CFG_Val >> 2)
- ADD R0, R0, R2
- MOV R1, #0x03
- STRH R1, [R0, #0]
-
- .ENDIF
-
-#*************************************************************************
-# Setup Clock PLL
-
- .IF CLOCK_SETUP == 1
-
- LDR R0, =SCU_BASE
- LDR R1, =0x00020002
- STR R1, [R0, #SCU_CLKCNTR_OFS] /* Select OSC as clock src */
-
- NOP /* Wait for oscillator stabilisation */
- NOP /* Must be more than 10 oscillator periods */
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
-
- LDR R1, =0x0003C019 /* Disable PLL */
- STR R1, [R0, #SCU_PLLCONF_OFS]
- LDR R1, =SCU_PLLCONF_Val
- STR R1, [R0, #SCU_PLLCONF_OFS] /* Set new PLL values */
-
- .IF (SCU_PLLCONF_Val & 0x8000) /* See if PLL is being used */
-
- LDR R1, =SCU_SYSSTAT_LOCK
-PLL_LOCK_LOOP:
- LDR R2,[R0, #SCU_SYSTAT_OFS] /* Wait for PLL lock */
- ANDS R2, R2, R1
- BEQ PLL_LOCK_LOOP
-
- .ENDIF
-
- LDR R1, =SCU_PLLCONF_Val
- STR R1, [R0, #SCU_PLLCONF_OFS]
- LDR R1, =SCU_CLKCNTR_Val
- STR R1, [R0, #SCU_CLKCNTR_OFS]
-
- LDR R1, =SCU_PCGR0_Val /* Enable clock gating */
- STR R1, [R0, #SCU_PCGR0_OFS]
- LDR R1, =SCU_PCGR1_Val
- STR R1, [R0, #SCU_PCGR1_OFS]
- .ENDIF
-
-
-#*************************************************************************
-# Embedded Trace Module Setup
-#*************************************************************************
-
- .IF ETM_SETUP == 1
-
-# Configure IOPORT2 for ETM operation
- LDR R0, =IOPORT2_ETM_ENABLE_BASE
- LDR R1, =IOPORT2_ETM_ENABLE_VAL
- STR R1, [R0, #0]
-
-# Configure IOPORT6 for ETM operation
- LDR R0, =IOPORT6_ETM_ENABLE_BASE
- LDR R1, =IOPORT6_ETM_ENABLE_VAL
- STR R1, [R0, #0]
-
- .ENDIF
-
-
-#*************************************************************************
-# Compiler Runtime Environment Setup
-#*************************************************************************
-# Note: R13 = SP
-
-# Setup Stack for each mode
- LDR R0, =Top_Stack
-
-# Set up Fast Interrupt Mode and set FIQ Mode Stack
- MSR CPSR_c, #Mode_FIQ|I_BIT|F_BIT
- mov r13, r0
- sub r0, r0, #FIQ_Stack_Size
-
-# Set up Interrupt Mode and set IRQ Mode Stack
- msr CPSR_c, #Mode_IRQ|I_BIT|F_BIT
- mov r13, r0
- sub r0, r0, #IRQ_Stack_Size
-
-# Set up Abort Mode and set Abort Mode Stack
- msr CPSR_c, #Mode_ABT|I_BIT|F_BIT
- mov r13, r0
- sub r0, r0, #ABT_Stack_Size
-
-# Set up Undefined Instruction Mode and set Undef Mode Stack
- msr CPSR_c, #Mode_UND|I_BIT|F_BIT
- mov r13, r0
- sub r0, r0, #UND_Stack_Size
-
-# Set up Supervisor Mode and set Supervisor Mode Stack
- msr CPSR_c, #Mode_SVC|I_BIT|F_BIT
- mov r13, r0
- sub r0, r0, #SVC_Stack_Size
-
-# Set up User Mode and set User Mode Stack
- msr CPSR_c, #Mode_USR /* Leave interrupts enabled in user mode */
- mov r13, r0 /* Note: interrupts will not happen until VIC is enabled */
-
-# Setup a default Stack Limit (when compiled with "-mapcs-stack-check")
- SUB SL, SP, #1<<10 /* 1kB */
-
-# Initialise current CPU status to prevent unwanted interrupts
-# msr CPSR_c,#0xD3
-
-#*************************************************************************
-# Initialise RAM For Compiler Variables
-#*************************************************************************
-
- copy_section2 data, _etext, __data_start__, _edata
-
-#*************************************************************************
-# Clear .bss section
-#*************************************************************************
-
- clear_section bss, __bss_start__, __bss_end__
- clear_section bss2, __bss2_start__, __bss2_end__
-
-#*************************************************************************
-# Enter the C code
-#*************************************************************************
-# Jump to main()
-
- B main
-
- .size _startup, . - _startup
-
-#*************************************************************************
-# END
-#*************************************************************************
- .end
diff --git a/uc_str912/prj_blinky_complex_startup/startup_generic.S b/uc_str912/prj_blinky_complex_startup/startup_generic.S
deleted file mode 100644
index 711a5d0..0000000
--- a/uc_str912/prj_blinky_complex_startup/startup_generic.S
+++ /dev/null
@@ -1,162 +0,0 @@
-#*****************************************************************************
-#*
-#* Project: Generic include file for ARM startup
-#* Filename: startup.inc
-#* Date: 11.05.2004
-#* Rights: Hitex Development Tools GmbH
-#* Greschbachstr. 12
-#* 76229 Karlsruhe
-#*
-#****************************************************************************
-
-# *** Startup Code (executed after Reset) ***
-
-
-# Standard definitions of Mode bits and Interrupt (I & F) flags in PSRs
-
- .equ Mode_USR, 0x10
- .equ Mode_FIQ, 0x11
- .equ Mode_IRQ, 0x12
- .equ Mode_SVC, 0x13
- .equ Mode_ABT, 0x17
- .equ Mode_UND, 0x1B
- .equ Mode_SYS, 0x1F
-
- .equ T_BIT, 0x20 /* when T bit is set, thumb mode active */
- .equ F_BIT, 0x40 /* when F bit is set, FIQ is disabled */
- .equ I_BIT, 0x80 /* when I bit is set, IRQ is disabled */
-
-# ---------------------------------------------
-# macro definition for stack memory reservation
-# ---------------------------------------------
-# use this macro to setup the stack
- .macro setup_stack label1, size, mode_bits
-
- .lcomm __range_\label1, (\size - 1) * 4
- .global \label1
- .lcomm \label1, 4
-
- ldr r0, adr_\label1
- msr CPSR_c, \mode_bits
- mov r13, r0
-
- .endm
-
-# use this macro to define the label for the setup_stack mcaro!
- .macro stack_adr label1
-adr_\label1:
- .word \label1
- .endm
-# ---------------------------------------------
-# copy section
-# use this macro to copy a section
-# parameters:
-# - individual name, used to create labels
-# - source pointer
-# - destination pointer
-# - source pointer + length > end address of source
-# ---------------------------------------------
- .macro copy_section sec_name, source, destination, source_end
-
- ldr R1, =\source
- ldr R2, =\destination
- ldr R3, =\source_end
-_cplp_\sec_name:
- cmp R1, R3
- ldrlo R0, [R1], #4
- strlo R0, [R2], #4
- blo _cplp_\sec_name
-
- .endm
-
-# ---------------------------------------------
-# copy section 2
-# use this macro to copy a section
-# parameters:
-# - individual name, used to create labels
-# - source pointer
-# - destination pointer
-# - destination pointer + length > end address of destination
-# ---------------------------------------------
- .macro copy_section2 sec_name, source, destination, destination_end
-
- ldr R1, =\source
- ldr R2, =\destination
- ldr R3, =\destination_end
-_cplp_\sec_name:
- cmp R2, R3
- ldrlo R0, [R1], #4
- strlo R0, [R2], #4
- blo _cplp_\sec_name
-
- .endm
-
-# ---------------------------------------------
-# clear section
-# use this macro to clear bss sections
-# ---------------------------------------------
- .macro clear_section sec_name, source, source_end
-
- mov R0, #0
- ldr R1, =\source
- ldr R2, =\source_end
-_cllp_\sec_name:
- cmp R1, R2
- strlo R0, [R1], #4
- blo _cllp_\sec_name
- .endm
-
-# ---------------------------------------------
-# examples how to use the macros
-# ---------------------------------------------
-# Setup stacks for the operating modes
-# ---------------------------------------------
-
-# setup_stack UND_Stack, UND_Stack_Size, #Mode_UND|I_BIT|F_BIT
-# setup_stack SVC_Stack, SVC_Stack_Size, #Mode_SVC|I_BIT|F_BIT
-# setup_stack ABT_Stack, ABT_Stack_Size, #Mode_ABT|I_BIT|F_BIT
-# setup_stack FIQ_Stack, FIQ_Stack_Size, #Mode_FIQ|I_BIT|F_BIT
-# setup_stack IRQ_Stack, IRQ_Stack_Size, #Mode_IRQ|I_BIT|F_BIT
-# setup_stack USR_Stack, USR_Stack_Size, #Mode_USR
-
-# ---------------------------------------------
-# copy sections
-# ---------------------------------------------
-
-# copy code into internal ram
-# copy_section code, __code_start__, RAM_Base_Boot, __code_end__
-
-# Relocate .data section (Copy from ROM to RAM)
-# copy_section data, __data_start__, __data_start__+RAM_Base_Boot, __data_end__
-
-# ---------------------------------------------
-# Clear .bss section
-# ---------------------------------------------
-
-# Clear .bss section (Zero init)
-# clear_section bss, __bss_start__, __bss_end__
-
-# ---------------------------------------------
-# startup delay
-# use this macro if you are working with an debugger
-# the startup delay avoid problems while
-# the application start before the debug interface
-# becomes controled by the debugger
-# ---------------------------------------------
-
-# a goodf choice for the delay value is
-# cpu clock / 100 with ATMEL controllers
-# cpu clock / 40 with Philips controllers
-
- .macro StartupDelay delay_value
-
- ldr R1, =\delay_value
- ldr R2, =0
-__StartDelay:
- sub R1, R1, #1
- cmp R1, R2
- bhi __StartDelay
-
- .endm
-
-# ---------------------------------------------
diff --git a/uc_str912/prj_blinky_complex_startup/syscalls.c b/uc_str912/prj_blinky_complex_startup/syscalls.c
deleted file mode 100644
index ce25753..0000000
--- a/uc_str912/prj_blinky_complex_startup/syscalls.c
+++ /dev/null
@@ -1,180 +0,0 @@
-/****************************************************************************
-* Copyright (c) 2009 by Michael Fischer. All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions
-* are met:
-*
-* 1. Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* 2. Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* 3. Neither the name of the author nor the names of its contributors may
-* be used to endorse or promote products derived from this software
-* without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
-* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
-* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-* SUCH DAMAGE.
-*
-****************************************************************************
-* History:
-*
-* 28.03.09 mifi First Version, based on the original syscall.c from
-* newlib version 1.17.0
-****************************************************************************/
-
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-
-/***************************************************************************/
-
-int _read_r (struct _reent *r, int file, char * ptr, int len)
-{
- r = r;
- file = file;
- ptr = ptr;
- len = len;
-
- errno = EINVAL;
- return -1;
-}
-
-/***************************************************************************/
-
-int _lseek_r (struct _reent *r, int file, int ptr, int dir)
-{
- r = r;
- file = file;
- ptr = ptr;
- dir = dir;
-
- return 0;
-}
-
-/***************************************************************************/
-
-int _write_r (struct _reent *r, int file, char * ptr, int len)
-{
- r = r;
- file = file;
- ptr = ptr;
-
-#if 0
- int index;
-
- /* For example, output string by UART */
- for(index=0; index<len; index++)
- {
- if (ptr[index] == '\n')
- {
- uart_putc('\r');
- }
-
- uart_putc(ptr[index]);
- }
-#endif
-
- return len;
-}
-
-/***************************************************************************/
-
-int _close_r (struct _reent *r, int file)
-{
- return 0;
-}
-
-/***************************************************************************/
-
-/* Register name faking - works in collusion with the linker. */
-register char * stack_ptr asm ("sp");
-
-caddr_t _sbrk_r (struct _reent *r, int incr)
-{
- extern char end asm ("end"); /* Defined by the linker. */
- static char * heap_end;
- char * prev_heap_end;
-
- if (heap_end == NULL)
- heap_end = & end;
-
- prev_heap_end = heap_end;
-
- if (heap_end + incr > stack_ptr)
- {
- /* Some of the libstdc++-v3 tests rely upon detecting
- out of memory errors, so do not abort here. */
-#if 0
- extern void abort (void);
-
- _write (1, "_sbrk: Heap and stack collision\n", 32);
-
- abort ();
-#else
- errno = ENOMEM;
- return (caddr_t) -1;
-#endif
- }
-
- heap_end += incr;
-
- return (caddr_t) prev_heap_end;
-}
-
-/***************************************************************************/
-
-int _fstat_r (struct _reent *r, int file, struct stat * st)
-{
- r = r;
- file = file;
-
- memset (st, 0, sizeof (* st));
- st->st_mode = S_IFCHR;
- return 0;
-}
-
-/***************************************************************************/
-
-int _isatty_r(struct _reent *r, int fd)
-{
- r = r;
- fd = fd;
-
- return 1;
-}
-
-
-
-void _exit()
-{
- while(1);
-}
-
-
-int _getpid()
-{
- return 0;
-}
-
-int _kill(int pid, int sig)
-{
- return 0;
-}
-
-/*** EOF ***/
-
-
diff --git a/uc_str912/prj_blinky_simple_startup/Makefile b/uc_str912/prj_blinky_simple_startup/Makefile
deleted file mode 100644
index 171319e..0000000
--- a/uc_str912/prj_blinky_simple_startup/Makefile
+++ /dev/null
@@ -1,495 +0,0 @@
-# Hey Emacs, this is a -*- makefile -*-
-#
-# WinARM template makefile
-# by Giacomo Fazio and Antonio Nasca, Catania, Italy
-# <giacomofazio@gmail.com>
-# <antodani.nasca@hotmail.it>
-#
-# based on the WinARM template makefile written by Martin Thomas
-# Released to the Public Domain
-# Please read the make user manual!
-#
-#
-# On command line:
-#
-# make all = Make software.
-#
-# make clean = Clean out built project files.
-#
-# make program = Download the hex file to the device
-#
-# (TODO: make filename.s = Just compile filename.c into the assembler code only)
-#
-# To rebuild project do "make clean" then "make all".
-# Toolchain prefix (i.e arm-elf -> arm-elf-gcc.exe)
-#TCHAIN = arm-elf
-TCHAIN = arm-none-eabi
-
-#USE_THUMB_MODE = YES
-USE_THUMB_MODE = NO
-
-# MCU name and submodel
-MCU = arm966e-s
-SUBMDL = STR91x
-
-## Create ROM-Image
-RUN_MODE=ROM_RUN
-## Create RAM-Image
-#RUN_MODE=RAM_RUN
-
-## not supported in this example:
-## Exception-Vector placement only supported for "ROM_RUN"
-## (placement settings ignored when using "RAM_RUN")
-## - Exception vectors in ROM:
-#VECTOR_LOCATION=VECTORS_IN_ROM
-## - Exception vectors in RAM:
-#VECTOR_LOCATION=VECTORS_IN_RAM
-
-
-# Target file name (without extension).
-TARGET = main
-
-# List C source files here. (C dependencies are automatically generated.)
-# use file-extension c for "c-only"-files
-SRC = src/$(TARGET).c
-
-# List C source files here which must be compiled in ARM-Mode.
-# use file-extension c for "c-only"-files
-SRCARM = src/vectors.c
-# thumb is possible too for vectors.c - keep ARM, TODO: profile
-
-# List C++ source files here.
-# use file-extension cpp for C++-files (use extension .cpp)
-CPPSRC =
-
-# List C++ source files here which must be compiled in ARM-Mode.
-# use file-extension cpp for C++-files (use extension .cpp)
-#CPPSRCARM = $(TARGET).cpp
-CPPSRCARM =
-
-# List Assembler source files here.
-# Make them always end in a capital .S. Files ending in a lowercase .s
-# will not be considered source files but generated files (assembler
-# output from the compiler), and will be deleted upon "make clean"!
-# Even though the DOS/Win* filesystem matches both .s and .S the same,
-# it will preserve the spelling of the filenames, and gcc itself does
-# care about how the name is spelled on its command-line.
-ASRC =
-
-# List Assembler source files here which must be assembled in ARM-Mode..
-ASRCARM = src/vector.S src/startup.S
-
-# Path to Linker-Scripts
-LINKERSCRIPTPATH = .
-
-## Output format. (can be ihex or binary or both)
-## (binary i.e. for openocd and SAM-BA, hex i.e. for lpc21isp and uVision)
-#FORMAT = ihex
-#FORMAT = binary
-FORMAT = both
-
-# Optimization level, can be [0, 1, 2, 3, s].
-# 0 = turn off optimization. s = optimize for size.
-# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
-#OPT = s
-OPT = 0
-
-## Using the Atmel AT91_lib produces warning with
-## the default warning-levels.
-## yes - disable these warnings; no - keep default settings
-#AT91LIBNOWARN = yes
-AT91LIBNOWARN = no
-
-# Debugging format.
-# Native formats for AVR-GCC's -g are stabs [default], or dwarf-2.
-# AVR (extended) COFF requires stabs, plus an avr-objcopy run.
-#DEBUG = stabs
-DEBUG = dwarf-2
-
-# List any extra directories to look for include files here.
-# Each directory must be seperated by a space.
-EXTRAINCDIRS = ./include ./str91x_lib/include
-
-# List any extra directories to look for library files here.
-# Each directory must be seperated by a space.
-#EXTRA_LIBDIRS = ../arm7_efsl_0_2_4
-EXTRA_LIBDIRS = ./str91x_lib
-
-
-# Compiler flag to set the C Standard level.
-# c89 - "ANSI" C
-# gnu89 - c89 plus GCC extensions
-# c99 - ISO C99 standard (not yet fully implemented)
-# gnu99 - c99 plus GCC extensions
-CSTANDARD = -std=gnu99
-
-# Place -D or -U options for C here
-CDEFS = -D$(RUN_MODE)
-
-# Place -I options here
-CINCS =
-
-# Place -D or -U options for ASM here
-ADEFS = -D$(RUN_MODE)
-
-ifdef VECTOR_LOCATION
-CDEFS += -D$(VECTOR_LOCATION)
-ADEFS += -D$(VECTOR_LOCATION)
-endif
-
-CDEFS += -D__WinARM__ -D__WINARMSUBMDL_$(SUBMDL)__
-ADEFS += -D__WinARM__ -D__WINARMSUBMDL_$(SUBMDL)__
-
-# Compiler flags.
-
-ifeq ($(USE_THUMB_MODE),YES)
-THUMB = -mthumb
-THUMB_IW = -mthumb-interwork
-else
-THUMB =
-THUMB_IW =
-endif
-
-# -g*: generate debugging information
-# -O*: optimization level
-# -f...: tuning, see GCC manual and avr-libc documentation
-# -Wall...: warning level
-# -Wa,...: tell GCC to pass this to the assembler.
-# -adhlns...: create assembler listing
-#
-# Flags for C and C++ (arm-elf-gcc/arm-elf-g++)
-CFLAGS = -g$(DEBUG)
-CFLAGS += $(CDEFS) $(CINCS)
-CFLAGS += -O$(OPT)
-CFLAGS += -Wall -Wcast-align -Wimplicit
-CFLAGS += -Wpointer-arith -Wswitch
-CFLAGS += -ffunction-sections -fdata-sections
-CFLAGS += -Wredundant-decls -Wreturn-type -Wshadow -Wunused
-CFLAGS += -Wa,-adhlns=$(subst $(suffix $<),.lst,$<)
-CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
-
-# flags only for C
-CONLYFLAGS += -Wnested-externs
-CONLYFLAGS += $(CSTANDARD)
-
-ifneq ($(AT91LIBNOWARN),yes)
-#AT91-lib warnings with:
-CFLAGS += -Wcast-qual
-CONLYFLAGS += -Wmissing-prototypes
-CONLYFLAGS += -Wstrict-prototypes
-CONLYFLAGS += -Wmissing-declarations
-endif
-
-# flags only for C++ (arm-elf-g++)
-# CPPFLAGS = -fno-rtti -fno-exceptions
-CPPFLAGS =
-
-# Assembler flags.
-# -Wa,...: tell GCC to pass this to the assembler.
-# -ahlns: create listing
-# -g$(DEBUG): have the assembler create line number information
-ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:.S=.lst),-g$(DEBUG)
-
-
-#Additional libraries.
-
-# Extra libraries
-# Each library-name must be seperated by a space.
-# To add libxyz.a, libabc.a and libefsl.a:
-# EXTRA_LIBS = xyz abc efsl
-#EXTRA_LIBS = efsl
-EXTRA_LIBS = STR91x_lib
-
-#Support for newlibc-lpc (file: libnewlibc-lpc.a)
-#NEWLIBLPC = -lnewlib-lpc
-
-MATH_LIB = -lm
-
-# CPLUSPLUS_LIB = -lstdc++
-
-
-# Linker flags.
-# -Wl,...: tell GCC to pass this to linker.
-# -Map: create map file
-# --cref: add cross reference to map file
-LDFLAGS = -nostartfiles -Wl,-Map=$(TARGET).map,--cref,--gc-sections,--no-warn-mismatch
-LDFLAGS += -lc
-LDFLAGS += $(NEWLIBLPC) $(MATH_LIB)
-LDFLAGS += -lc -lgcc
-LDFLAGS += $(CPLUSPLUS_LIB)
-LDFLAGS += $(patsubst %,-L%,$(EXTRA_LIBDIRS))
-LDFLAGS += $(patsubst %,-l%,$(EXTRA_LIBS))
-
-# Set Linker-Script Depending On Selected Memory and Controller
-ifeq ($(RUN_MODE),RAM_RUN)
-LDFLAGS +=-T$(LINKERSCRIPTPATH)/$(SUBMDL)-RAM.ld
-else
-LDFLAGS +=-T$(LINKERSCRIPTPATH)/$(SUBMDL)-ROM.ld
-endif
-
-
-# Define directories, if needed.
-## DIRARM = c:/WinARM/
-## DIRARMBIN = $(DIRAVR)/bin/
-## DIRAVRUTILS = $(DIRAVR)/utils/bin/
-
-# Define programs and commands.
-SHELL = sh
-CC = $(TCHAIN)-gcc
-CPP = $(TCHAIN)-g++
-AR = $(TCHAIN)-ar
-OBJCOPY = $(TCHAIN)-objcopy
-OBJDUMP = $(TCHAIN)-objdump
-SIZE = $(TCHAIN)-size
-NM = $(TCHAIN)-nm
-REMOVE = rm -f
-REMOVEDIR = rm -f -r
-COPY = cp
-
-# Define Messages
-# English
-MSG_ERRORS_NONE = Errors: none
-MSG_BEGIN = "-------- begin (mode: $(RUN_MODE)) --------"
-MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
-MSG_SIZE_AFTER = Size after:
-MSG_FLASH = Creating load file for Flash:
-MSG_EXTENDED_LISTING = Creating Extended Listing:
-MSG_SYMBOL_TABLE = Creating Symbol Table:
-MSG_LINKING = Linking:
-MSG_COMPILING = Compiling C:
-MSG_COMPILING_ARM = "Compiling C (ARM-only):"
-MSG_COMPILINGCPP = Compiling C++:
-MSG_COMPILINGCPP_ARM = "Compiling C++ (ARM-only):"
-MSG_ASSEMBLING = Assembling:
-MSG_ASSEMBLING_ARM = "Assembling (ARM-only):"
-MSG_CLEANING = Cleaning project:
-MSG_FORMATERROR = Can not handle output-format
-MSG_LPC21_RESETREMINDER = You may have to bring the target in bootloader-mode now.
-
-# Define all object files.
-COBJ = $(SRC:.c=.o)
-AOBJ = $(ASRC:.S=.o)
-COBJARM = $(SRCARM:.c=.o)
-AOBJARM = $(ASRCARM:.S=.o)
-CPPOBJ = $(CPPSRC:.cpp=.o)
-CPPOBJARM = $(CPPSRCARM:.cpp=.o)
-
-# Define all listing files.
-LST = $(ASRC:.S=.lst) $(ASRCARM:.S=.lst) $(SRC:.c=.lst) $(SRCARM:.c=.lst)
-LST += $(CPPSRC:.cpp=.lst) $(CPPSRCARM:.cpp=.lst)
-
-# Compiler flags to generate dependency files.
-### GENDEPFLAGS = -Wp,-M,-MP,-MT,$(*F).o,-MF,.dep/$(@F).d
-GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d
-
-# Combine all necessary flags and optional flags.
-# Add target processor to flags.
-ALL_CFLAGS = -mcpu=$(MCU) $(THUMB_IW) -I. $(CFLAGS) $(GENDEPFLAGS)
-ALL_ASFLAGS = -mcpu=$(MCU) $(THUMB_IW) -I. -x assembler-with-cpp $(ASFLAGS)
-
-
-# Default target.
-all: begin gccversion sizebefore build sizeafter finished end
-
-ifeq ($(FORMAT),ihex)
-build: elf hex lss sym
-hex: $(TARGET).hex
-IMGEXT=hex
-else
-ifeq ($(FORMAT),binary)
-build: elf bin lss sym
-bin: $(TARGET).bin
-IMGEXT=bin
-else
-ifeq ($(FORMAT),both)
-build: elf hex bin lss sym
-hex: $(TARGET).hex
-bin: $(TARGET).bin
-else
-$(error "$(MSG_FORMATERROR) $(FORMAT)")
-endif
-endif
-endif
-
-elf: $(TARGET).elf
-lss: $(TARGET).lss
-sym: $(TARGET).sym
-
-# Eye candy.
-begin:
- @echo
- @echo $(MSG_BEGIN)
-
-finished:
- @echo $(MSG_ERRORS_NONE)
-
-end:
- @echo $(MSG_END)
- @echo
-
-
-# Display size of file.
-HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
-ELFSIZE = $(SIZE) -A $(TARGET).elf
-sizebefore:
- @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi
-
-sizeafter:
- @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi
-
-
-# Display compiler version information.
-gccversion :
- @$(CC) --version
-
-# FLASH Programming with OPENOCD
-
-# specify the directory where openocd executable resides (openocd-ftd2xx.exe or openocd-pp.exe)
-# Note: you may have to adjust this if a newer version of YAGARTO has been downloaded
-OPENOCD_DIR = 'c:\Programmi\openocd\bin\'
-
-# specify OpenOCD executable (pp is for the wiggler, ftd2xx is for the USB debugger)
-OPENOCD = $(OPENOCD_DIR)openocd-pp.exe
-#OPENOCD = $(OPENOCD_DIR)openocd-ftd2xx.exe
-
-# specify OpenOCD configuration file (pick the one for your device)
-#OPENOCD_CFG = C:\openocd-configs\str91x-configs\str91x_signalyzer-flash-program.cfg
-#OPENOCD_CFG = C:\openocd-configs\str91x-configs\str91x_jtagkey-flash-program.cfg
-#OPENOCD_CFG = C:\openocd-configs\str91x-configs\str91x_armusbocd-flash-program.cfg
-OPENOCD_CFG = C:\openocd-configs\str91x-configs\str91x_pp-flash-program.cfg
-
-program:
- @echo
- @echo "Flash Programming with OpenOCD..."
- $(OPENOCD) -f $(OPENOCD_CFG)
- @echo
- @echo
- @echo "Flash Programming Finished."
-
-
-# Create final output file (.hex) from ELF output file.
-%.hex: %.elf
- @echo
- @echo $(MSG_FLASH) $@
- $(OBJCOPY) -O ihex $< $@
-
-# Create final output file (.bin) from ELF output file.
-%.bin: %.elf
- @echo
- @echo $(MSG_FLASH) $@
- $(OBJCOPY) -O binary $< $@
-
-
-# Create extended listing file from ELF output file.
-# testing: option -C
-%.lss: %.elf
- @echo
- @echo $(MSG_EXTENDED_LISTING) $@
- $(OBJDUMP) -h -S -C $< > $@
-
-
-# Create a symbol table from ELF output file.
-%.sym: %.elf
- @echo
- @echo $(MSG_SYMBOL_TABLE) $@
- $(NM) -n $< > $@
-
-
-# Link: create ELF output file from object files.
-.SECONDARY : $(TARGET).elf
-.PRECIOUS : $(AOBJARM) $(AOBJ) $(COBJARM) $(COBJ) $(CPPOBJ) $(CPPOBJARM)
-%.elf: $(AOBJARM) $(AOBJ) $(COBJARM) $(COBJ) $(CPPOBJ) $(CPPOBJARM)
- @echo
- @echo $(MSG_LINKING) $@
- $(CC) $(THUMB) $(ALL_CFLAGS) $(AOBJARM) $(AOBJ) $(COBJARM) $(COBJ) $(CPPOBJ) $(CPPOBJARM) --output $@ $(LDFLAGS)
-# $(CPP) $(THUMB) $(ALL_CFLAGS) $(AOBJARM) $(AOBJ) $(COBJARM) $(COBJ) $(CPPOBJ) $(CPPOBJARM) --output $@ $(LDFLAGS)
-
-# Compile: create object files from C source files. ARM/Thumb
-$(COBJ) : %.o : %.c
- @echo
- @echo $(MSG_COMPILING) $<
- $(CC) -c $(THUMB) $(ALL_CFLAGS) $(CONLYFLAGS) $< -o $@
-
-# Compile: create object files from C source files. ARM-only
-$(COBJARM) : %.o : %.c
- @echo
- @echo $(MSG_COMPILING_ARM) $<
- $(CC) -c $(ALL_CFLAGS) $(CONLYFLAGS) $< -o $@
-
-# Compile: create object files from C++ source files. ARM/Thumb
-$(CPPOBJ) : %.o : %.cpp
- @echo
- @echo $(MSG_COMPILINGCPP) $<
- $(CPP) -c $(THUMB) $(ALL_CFLAGS) $(CPPFLAGS) $< -o $@
-
-# Compile: create object files from C++ source files. ARM-only
-$(CPPOBJARM) : %.o : %.cpp
- @echo
- @echo $(MSG_COMPILINGCPP_ARM) $<
- $(CPP) -c $(ALL_CFLAGS) $(CPPFLAGS) $< -o $@
-
-
-# Compile: create assembler files from C source files. ARM/Thumb
-## does not work - TODO - hints welcome
-##$(COBJ) : %.s : %.c
-## $(CC) $(THUMB) -S $(ALL_CFLAGS) $< -o $@
-
-
-# Assemble: create object files from assembler source files. ARM/Thumb
-$(AOBJ) : %.o : %.S
- @echo
- @echo $(MSG_ASSEMBLING) $<
- $(CC) -c $(THUMB) $(ALL_ASFLAGS) $< -o $@
-
-
-# Assemble: create object files from assembler source files. ARM-only
-$(AOBJARM) : %.o : %.S
- @echo
- @echo $(MSG_ASSEMBLING_ARM) $<
- $(CC) -c $(ALL_ASFLAGS) $< -o $@
-
-
-# Target: clean project.
-clean: begin clean_list finished end
-
-
-clean_list :
- @echo
- @echo $(MSG_CLEANING)
- $(REMOVE) $(TARGET).hex
- $(REMOVE) $(TARGET).bin
- $(REMOVE) $(TARGET).obj
- $(REMOVE) $(TARGET).elf
- $(REMOVE) $(TARGET).map
- $(REMOVE) $(TARGET).obj
- $(REMOVE) $(TARGET).a90
- $(REMOVE) $(TARGET).sym
- $(REMOVE) $(TARGET).lnk
- $(REMOVE) $(TARGET).lss
- $(REMOVE) $(COBJ)
- $(REMOVE) $(CPPOBJ)
- $(REMOVE) $(AOBJ)
- $(REMOVE) $(COBJARM)
- $(REMOVE) $(CPPOBJARM)
- $(REMOVE) $(AOBJARM)
- $(REMOVE) $(LST)
- $(REMOVE) $(SRC:.c=.s)
- $(REMOVE) $(SRC:.c=.d)
- $(REMOVE) $(SRCARM:.c=.s)
- $(REMOVE) $(SRCARM:.c=.d)
- $(REMOVE) $(CPPSRC:.cpp=.s)
- $(REMOVE) $(CPPSRC:.cpp=.d)
- $(REMOVE) $(CPPSRCARM:.cpp=.s)
- $(REMOVE) $(CPPSRCARM:.cpp=.d)
- $(REMOVEDIR) .dep | exit 0
-
-
-# Include the dependency files.
--include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
-
-
-# Listing of phony targets.
-.PHONY : all begin finish end sizebefore sizeafter gccversion \
-build elf hex bin lss sym clean clean_list program
-
diff --git a/uc_str912/prj_blinky_simple_startup/STR91x-RAM.ld b/uc_str912/prj_blinky_simple_startup/STR91x-RAM.ld
deleted file mode 100644
index aced384..0000000
--- a/uc_str912/prj_blinky_simple_startup/STR91x-RAM.ld
+++ /dev/null
@@ -1,218 +0,0 @@
-/***********************************************************************************
-* Copyright 2005 Anglia Design
-* This demo code and associated components are provided as is and has no warranty,
-* implied or otherwise. You are free to use/modify any of the provided
-* code at your own risk in your applications with the expressed limitation
-* of liability (see below)
-*
-* LIMITATION OF LIABILITY: ANGLIA OR ANGLIA DESIGNS SHALL NOT BE LIABLE FOR ANY
-* LOSS OF PROFITS, LOSS OF USE, LOSS OF DATA, INTERRUPTION OF BUSINESS, NOR FOR
-* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND WHETHER UNDER
-* THIS AGREEMENT OR OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-*
-* Author : Spencer Oliver
-* Web : www.anglia-designs.com
-*
-***********************************************************************************/
-
-/* Stack Sizes */
-
- _STACKSIZE = 1024;
- _STACKSIZE_IRQ = 256;
- _STACKSIZE_FIQ = 256;
- _STACKSIZE_SVC = 0;
- _STACKSIZE_ABT = 0;
- _STACKSIZE_UND = 0;
- _HEAPSIZE = 1024;
-
-/* Memory Definitions */
-
-MEMORY
-{
- DATA (rw) : ORIGIN = 0x04000000, LENGTH = 0x00018000
-}
-
-/* Section Definitions */
-
-SECTIONS
-{
- /* first section is .text which is used for code */
-
- .text :
- {
- KEEP(*(.vectors))
- KEEP(*(.init))
- *(.text .text.*)
- *(.gnu.linkonce.t.*)
- *(.glue_7t .glue_7)
- KEEP(*(.fini))
- *(.gcc_except_table)
- } >DATA =0
- . = ALIGN(4);
-
- /* .ctors .dtors are used for c++ constructors/destructors */
-
- .ctors :
- {
- PROVIDE(__ctors_start__ = .);
- KEEP(*(SORT(.ctors.*)))
- KEEP(*(.ctors))
- PROVIDE(__ctors_end__ = .);
- } >DATA
-
- .dtors :
- {
- PROVIDE(__dtors_start__ = .);
- KEEP(*(SORT(.dtors.*)))
- KEEP(*(.dtors))
- PROVIDE(__dtors_end__ = .);
- } >DATA
-
- /* .rodata section which is used for read-only data (constants) */
-
- .rodata :
- {
- *(.rodata .rodata.*)
- *(.gnu.linkonce.r.*)
- } >DATA
- . = ALIGN(4);
-
- _etext = .;
- PROVIDE (etext = .);
-
- /* .data section which is used for initialized data */
-
- .data : AT (_etext)
- {
- *(.data .data.*)
- *(.gnu.linkonce.d.*)
- SORT(CONSTRUCTORS)
- } >DATA
- . = ALIGN(4);
-
- __data_start = .;
- _edata = .;
- PROVIDE (edata = .);
-
- /* .bss section which is used for uninitialized data */
-
- .bss :
- {
- __bss_start = .;
- __bss_start__ = .;
- *(.bss .bss.*)
- *(.gnu.linkonce.b.*)
- *(COMMON)
- . = ALIGN(4);
- } >DATA
- . = ALIGN(4);
- __bss_end__ = .;
-
- _end = .;
- PROVIDE(end = .);
-
- /* .heap section which is used for memory allocation */
-
- .heap (NOLOAD) :
- {
- __heap_start__ = .;
- *(.heap)
- . = MAX(__heap_start__ + _HEAPSIZE , .);
- } >DATA
- __heap_end__ = __heap_start__ + SIZEOF(.heap);
-
- /* .stack section - user mode stack */
-
- .stack (__heap_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_start__ = .;
- *(.stack)
- . = MAX(__stack_start__ + _STACKSIZE , .);
- } >DATA
- __stack_end__ = __stack_start__ + SIZEOF(.stack);
-
- /* .stack_irq section */
-
- .stack_irq (__stack_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_irq_start__ = .;
- *(.stack_irq)
- . = MAX(__stack_irq_start__ + _STACKSIZE_IRQ , .);
- } >DATA
- __stack_irq_end__ = __stack_irq_start__ + SIZEOF(.stack_irq);
-
- /* .stack_fiq section */
-
- .stack_fiq (__stack_irq_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_fiq_start__ = .;
- *(.stack_fiq)
- . = MAX(__stack_fiq_start__ + _STACKSIZE_FIQ , .);
- } >DATA
- __stack_fiq_end__ = __stack_fiq_start__ + SIZEOF(.stack_fiq);
-
- /* .stack_svc section */
-
- .stack_svc (__stack_fiq_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_svc_start__ = .;
- *(.stack_svc)
- . = MAX(__stack_svc_start__ + _STACKSIZE_SVC , .);
- } >DATA
- __stack_svc_end__ = __stack_svc_start__ + SIZEOF(.stack_svc);
-
- /* .stack_abt section */
-
- .stack_abt (__stack_svc_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_abt_start__ = .;
- *(.stack_abt)
- . = MAX(__stack_abt_start__ + _STACKSIZE_ABT , .);
- } >DATA
- __stack_abt_end__ = __stack_abt_start__ + SIZEOF(.stack_abt);
-
- /* .stack_und section */
-
- .stack_und (__stack_abt_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_und_start__ = .;
- *(.stack_und)
- . = MAX(__stack_und_start__ + _STACKSIZE_UND , .);
- } >DATA
- __stack_und_end__ = __stack_und_start__ + SIZEOF(.stack_und);
-
- /* 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) }
-}
-
diff --git a/uc_str912/prj_blinky_simple_startup/STR91x-ROM.ld b/uc_str912/prj_blinky_simple_startup/STR91x-ROM.ld
deleted file mode 100644
index ed2979b..0000000
--- a/uc_str912/prj_blinky_simple_startup/STR91x-ROM.ld
+++ /dev/null
@@ -1,221 +0,0 @@
-/***********************************************************************************
-* Copyright 2005 Anglia Design
-* This demo code and associated components are provided as is and has no warranty,
-* implied or otherwise. You are free to use/modify any of the provided
-* code at your own risk in your applications with the expressed limitation
-* of liability (see below)
-*
-* LIMITATION OF LIABILITY: ANGLIA OR ANGLIA DESIGNS SHALL NOT BE LIABLE FOR ANY
-* LOSS OF PROFITS, LOSS OF USE, LOSS OF DATA, INTERRUPTION OF BUSINESS, NOR FOR
-* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND WHETHER UNDER
-* THIS AGREEMENT OR OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-*
-* Author : Spencer Oliver
-* Web : www.anglia-designs.com
-*
-***********************************************************************************/
-
-/* Stack Sizes */
-
- _STACKSIZE = 1024;
- _STACKSIZE_IRQ = 256;
- _STACKSIZE_FIQ = 256;
- _STACKSIZE_SVC = 0;
- _STACKSIZE_ABT = 0;
- _STACKSIZE_UND = 0;
- _HEAPSIZE = 1024;
-
-/* Memory Definitions */
-
-MEMORY
-{
- CODE (rx) : ORIGIN = 0x00000000, LENGTH = 0x00080000
- DATA (rw) : ORIGIN = 0x04000000, LENGTH = 0x00018000
-}
-
-/* Section Definitions */
-
-SECTIONS
-{
- /* first section is .text which is used for code */
-
- .text :
- {
- KEEP(*(.vectors))
- KEEP(*(.init))
- *(.text .text.*)
- *(.gnu.linkonce.t.*)
- *(.glue_7t .glue_7)
- KEEP(*(.fini))
- *(.gcc_except_table)
- } >CODE =0
- . = ALIGN(4);
-
- /* .ctors .dtors are used for c++ constructors/destructors */
-
- .ctors :
- {
- PROVIDE(__ctors_start__ = .);
- KEEP(*(SORT(.ctors.*)))
- KEEP(*(.ctors))
- PROVIDE(__ctors_end__ = .);
- } >CODE
-
- .dtors :
- {
- PROVIDE(__dtors_start__ = .);
- KEEP(*(SORT(.dtors.*)))
- KEEP(*(.dtors))
- PROVIDE(__dtors_end__ = .);
- } >CODE
-
- /* .rodata section which is used for read-only data (constants) */
-
- .rodata :
- {
- *(.rodata .rodata.*)
- *(.gnu.linkonce.r.*)
- } >CODE
- . = ALIGN(4);
-
- _etext = .;
- PROVIDE (etext = .);
-
- /* .data section which is used for initialized data */
-
- .data : AT (_etext)
- {
- __data_start = .;
- *(.data .data.*)
- *(.gnu.linkonce.d.*)
- SORT(CONSTRUCTORS)
- . = ALIGN(4);
- *(.fastrun .fastrun.*)
- } >DATA
- . = ALIGN(4);
-
- _edata = .;
- PROVIDE (edata = .);
-
- /* .bss section which is used for uninitialized data */
-
- .bss :
- {
- __bss_start = .;
- __bss_start__ = .;
- *(.bss .bss.*)
- *(.gnu.linkonce.b.*)
- *(COMMON)
- . = ALIGN(4);
- } >DATA
- . = ALIGN(4);
- __bss_end__ = .;
-
- _end = .;
- PROVIDE(end = .);
-
- /* .heap section which is used for memory allocation */
-
- .heap (NOLOAD) :
- {
- __heap_start__ = .;
- *(.heap)
- . = MAX(__heap_start__ + _HEAPSIZE , .);
- } >DATA
- __heap_end__ = __heap_start__ + SIZEOF(.heap);
-
- /* .stack section - user mode stack */
-
- .stack (__heap_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_start__ = .;
- *(.stack)
- . = MAX(__stack_start__ + _STACKSIZE , .);
- } >DATA
- __stack_end__ = __stack_start__ + SIZEOF(.stack);
-
- /* .stack_irq section */
-
- .stack_irq (__stack_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_irq_start__ = .;
- *(.stack_irq)
- . = MAX(__stack_irq_start__ + _STACKSIZE_IRQ , .);
- } >DATA
- __stack_irq_end__ = __stack_irq_start__ + SIZEOF(.stack_irq);
-
- /* .stack_fiq section */
-
- .stack_fiq (__stack_irq_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_fiq_start__ = .;
- *(.stack_fiq)
- . = MAX(__stack_fiq_start__ + _STACKSIZE_FIQ , .);
- } >DATA
- __stack_fiq_end__ = __stack_fiq_start__ + SIZEOF(.stack_fiq);
-
- /* .stack_svc section */
-
- .stack_svc (__stack_fiq_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_svc_start__ = .;
- *(.stack_svc)
- . = MAX(__stack_svc_start__ + _STACKSIZE_SVC , .);
- } >DATA
- __stack_svc_end__ = __stack_svc_start__ + SIZEOF(.stack_svc);
-
- /* .stack_abt section */
-
- .stack_abt (__stack_svc_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_abt_start__ = .;
- *(.stack_abt)
- . = MAX(__stack_abt_start__ + _STACKSIZE_ABT , .);
- } >DATA
- __stack_abt_end__ = __stack_abt_start__ + SIZEOF(.stack_abt);
-
- /* .stack_und section */
-
- .stack_und (__stack_abt_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_und_start__ = .;
- *(.stack_und)
- . = MAX(__stack_und_start__ + _STACKSIZE_UND , .);
- } >DATA
- __stack_und_end__ = __stack_und_start__ + SIZEOF(.stack_und);
-
- /* 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) }
-}
-
diff --git a/uc_str912/prj_blinky_simple_startup/include/vectors.h b/uc_str912/prj_blinky_simple_startup/include/vectors.h
deleted file mode 100644
index d48e61f..0000000
--- a/uc_str912/prj_blinky_simple_startup/include/vectors.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/***********************************************************************************
-* Copyright 2005 Anglia Design
-* This demo code and associated components are provided as is and has no warranty,
-* implied or otherwise. You are free to use/modify any of the provided
-* code at your own risk in your applications with the expressed limitation
-* of liability (see below)
-*
-* LIMITATION OF LIABILITY: ANGLIA OR ANGLIA DESIGNS SHALL NOT BE LIABLE FOR ANY
-* LOSS OF PROFITS, LOSS OF USE, LOSS OF DATA, INTERRUPTION OF BUSINESS, NOR FOR
-* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND WHETHER UNDER
-* THIS AGREEMENT OR OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-*
-* Author : Spencer Oliver
-* Web : www.anglia-designs.com
-*
-***********************************************************************************/
-
-#ifndef _VECTOR_H
-#define _VECTOR_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void Undefined_Handler(void);
-void FIQ_Handler(void);
-void SWI_Handler(void);
-void Prefetch_Handler(void);
-void Abort_Handler(void);
-void WDG_IRQHandler(void);
-void SW_IRQHandler(void);
-void ARMRX_IRQHandler(void);
-void ARMTX_IRQHandler(void);
-void TIM0_IRQHandler(void);
-void TIM1_IRQHandler(void);
-void TIM2_IRQHandler(void);
-void TIM3_IRQHandler(void);
-void USBHP_IRQHandler(void);
-void USBLP_IRQHandler(void);
-void SCU_IRQHandler(void);
-void ENET_IRQHandler(void);
-void DMA_IRQHandler(void);
-void CAN_IRQHandler(void);
-void MC_IRQHandler(void);
-void ADC_IRQHandler(void);
-void UART0_IRQHandler(void);
-void UART1_IRQHandler(void);
-void UART2_IRQHandler(void);
-void I2C0_IRQHandler(void);
-void I2C1_IRQHandler(void);
-void SSP0_IRQHandler(void);
-void SSP1_IRQHandler(void);
-void LVD_IRQHandler(void);
-void RTC_IRQHandler(void);
-void WIU_IRQHandler(void);
-void EXTIT0_IRQHandler(void);
-void EXTIT1_IRQHandler(void);
-void EXTIT2_IRQHandler(void);
-void EXTIT3_IRQHandler(void);
-void USBWU_IRQHandler(void);
-void PFQBC_IRQHandler(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //_VECTOR_H
diff --git a/uc_str912/prj_blinky_simple_startup/load_segger.gdb b/uc_str912/prj_blinky_simple_startup/load_segger.gdb
deleted file mode 100644
index 95d2621..0000000
--- a/uc_str912/prj_blinky_simple_startup/load_segger.gdb
+++ /dev/null
@@ -1,20 +0,0 @@
-set complaints 1
-set output-radix 16
-set input-radix 16
-set prompt (arm-gdb)
-
-target remote localhost:2331
-
-monitor speed adaptive
-monitor endian little
-
-monitor reset
-monitor flash device = STR912FAW44
-monitor flash breakpoints = 1
-monitor flash download = 1
-monitor halt
-
-
-pwd
-load main.elf
-file main.elf
diff --git a/uc_str912/prj_blinky_simple_startup/src/main.c b/uc_str912/prj_blinky_simple_startup/src/main.c
deleted file mode 100644
index 61ab08c..0000000
--- a/uc_str912/prj_blinky_simple_startup/src/main.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : main.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : Main program body
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_lib.h"
-
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
- GPIO_InitTypeDef GPIO_InitStructure;
-
-/* Private function prototypes -----------------------------------------------*/
- void SCU_Configuration(void);
- static void Delay(u32 nCount);
-
-/* Private functions ---------------------------------------------------------*/
-/*******************************************************************************
-* Function Name : main
-* Description : Main program
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-int main()
-{
- /* Configure the system clocks */
- SCU_Configuration();
-
-/* GPIO Configuration --------------------------------------------------------*/
- GPIO_DeInit(GPIO8);
- GPIO_InitStructure.GPIO_Direction = GPIO_PinOutput;
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_2 | GPIO_Pin_4 | GPIO_Pin_6;
- GPIO_InitStructure.GPIO_Type = GPIO_Type_PushPull ;
- GPIO_Init (GPIO8, &GPIO_InitStructure);
-
- while(1)
- {
- /* Turn OFF leds connected to P9.0, P9.1, P9.2 and P9.3 pins */
- GPIO_WriteBit(GPIO8, GPIO_Pin_0, Bit_SET);
- Delay(0x7FFFF);
- GPIO_WriteBit(GPIO8, GPIO_Pin_2, Bit_SET);
- Delay(0x7FFFF);
- GPIO_WriteBit(GPIO8, GPIO_Pin_4, Bit_SET);
- Delay(0x7FFFF);
- GPIO_WriteBit(GPIO8, GPIO_Pin_6, Bit_SET);
- Delay(0x7FFFF);
- /* Turn ON leds connected to P9.0, P9.1, P9.2 and P9.3 pins */
- GPIO_WriteBit(GPIO8, GPIO_Pin_0, Bit_RESET);
- Delay(0x7FFFF);
- GPIO_WriteBit(GPIO8, GPIO_Pin_2, Bit_RESET);
- Delay(0x7FFFF);
- GPIO_WriteBit(GPIO8, GPIO_Pin_4, Bit_RESET);
- Delay(0x7FFFF);
- GPIO_WriteBit(GPIO8, GPIO_Pin_6, Bit_RESET);
- Delay(0x7FFFF);
- }
-}
-
-/*******************************************************************************
-* Function Name : SCU_Configuration
-* Description : Configures the system clocks.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_Configuration(void)
-{
- /* Enable the __GPIO9 */
- SCU_APBPeriphClockConfig(__GPIO8 ,ENABLE);
-}
-
-/*******************************************************************************
-* Function Name : Delay
-* Description : Inserts a delay time.
-* Input : nCount: specifies the delay time length.
-* Output : None
-* Return : None
-*******************************************************************************/
-static void Delay(u32 nCount)
-{
- u32 j = 0;
-
- for(j = nCount; j != 0; j--);
-}
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
-
diff --git a/uc_str912/prj_blinky_simple_startup/src/startup.s b/uc_str912/prj_blinky_simple_startup/src/startup.s
deleted file mode 100644
index cef54d8..0000000
--- a/uc_str912/prj_blinky_simple_startup/src/startup.s
+++ /dev/null
@@ -1,233 +0,0 @@
-/***********************************************************************************
-* Copyright 2005 Anglia Design
-* This demo code and associated components are provided as is and has no warranty,
-* implied or otherwise. You are free to use/modify any of the provided
-* code at your own risk in your applications with the expressed limitation
-* of liability (see below)
-*
-* LIMITATION OF LIABILITY: ANGLIA OR ANGLIA DESIGNS SHALL NOT BE LIABLE FOR ANY
-* LOSS OF PROFITS, LOSS OF USE, LOSS OF DATA, INTERRUPTION OF BUSINESS, NOR FOR
-* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND WHETHER UNDER
-* THIS AGREEMENT OR OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-*
-* Author : Spencer Oliver
-* Web : www.anglia-designs.com
-*
-***********************************************************************************/
-
-/**** Startup Code (executed after Reset) ****/
-
-/* Frequency values kHz */
-/* set to suit target hardware */
-
- .equ FOSC, 25000
-
-/* Standard definitions of Mode bits and Interrupt (I & F) flags in PSRs */
-
- .equ Mode_USR, 0x10
- .equ Mode_FIQ, 0x11
- .equ Mode_IRQ, 0x12
- .equ Mode_SVC, 0x13
- .equ Mode_ABT, 0x17
- .equ Mode_UND, 0x1B
- .equ Mode_SYS, 0x1F /* available on ARM Arch 4 and later */
-
- .equ I_Bit, 0x80 /* when I bit is set, IRQ is disabled */
- .equ F_Bit, 0x40 /* when F bit is set, FIQ is disabled */
-
- .equ SRAM32, 0x00
- .equ SRAM64, 0x08
- .equ SRAM96, 0x10
-
-/* --- System memory locations */
-
- .equ SCRO_AHB_UMB, 0x5C002034 /* System configuration register 0 (unbuffered) */
-
- .equ FMI_BASE_UMB, 0x54000000 /* Flash FMI base address (unbuffered) */
- .equ BBSR_off_addr, 0x00
- .equ NBBSR_off_addr, 0x04
- .equ BBADR_off_addr, 0x0C
- .equ NBBADR_off_addr, 0x10
- .equ CR_off_addr, 0x18
-
-.ifndef LIBUFF
- .equ LIBUFF, 0
-.endif
-
-/* Startup Code must be linked first at Address at which it expects to run. */
-
- .text
- .arm
- .section .init, "ax"
-
- .global _start
- .global _Main_Crystal
-
-/* After remap this will be our reset handler */
-
-_start:
- LDR pc, =NextInst
-NextInst:
-
- NOP /* Wait for OSC stabilization */
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
-
-/* Enable buffered mode */
-
-.if LIBUFF
- MRC p15, 0, r0, c1, c0, 0 /* Read CP15 register 1 into r0 */
- ORR r0, r0, #0x8 /* Enable Write Buffer on AHB */
- MCR p15, 0, r0, c1, c0, 0 /* Write CP15 register 1 */
-.endif
-
-/* Remap Flash Bank 0 at address 0x0 and Bank 1 at address 0x80000, */
-/* when the bank 0 is the boot bank, then enable the Bank 1. */
-
- LDR r0, =FMI_BASE_UMB
- LDR r1, =0x4 /* configure 512KB Boot bank 0 */
- STR r1, [r0, #BBSR_off_addr]
-
- LDR r1, =0x2 /* configure 32KB Non Boot bank 1 */
- STR r1, [r0, #NBBSR_off_addr]
-
- LDR r1, =(0x00000000 >> 2) /* Boot Bank Base Address */
- STR r1, [r0, #BBADR_off_addr]
-
- LDR r1, =(0x00080000 >> 2) /* Non Boot Bank Base Address */
- STR r1, [r0, #NBBADR_off_addr]
-
- LDR r1, =0x18 /* Flash Banks 0 1 enabled */
- STR r1, [r0, #CR_off_addr]
-
-/* Enable 96K RAM */
-
- LDR r0, =SCRO_AHB_UMB
-# LDR r1, =0x0196 /* prefetch disabled, default enabled */
- LDR r1, =0x0187|SRAM96
- STR r1, [r0]
-
-/* Set bits 17-18 (Instruction/Data TCM order) of the */
-/* Core Configuration Control Register */
-
- MOV r0, #0x60000
- MCR p15, 0x1, r0, c15, c1, 0
-
-/* Setup Stack for each mode */
-
-/* Enter Abort Mode and set its Stack Pointer */
-
- MSR cpsr_c, #Mode_ABT|I_Bit|F_Bit
- LDR sp, =__stack_abt_end__
-
-/* Enter Undefined Instruction Mode and set its Stack Pointer */
-
- MSR cpsr_c, #Mode_UND|I_Bit|F_Bit
- LDR sp, =__stack_und_end__
-
-/* Enter Supervisor Mode and set its Stack Pointer */
-
- MSR cpsr_c, #Mode_SVC|I_Bit|F_Bit
- LDR sp, =__stack_svc_end__
-
-/* Enter FIQ Mode and set its Stack Pointer */
-
- MSR cpsr_c, #Mode_FIQ|I_Bit|F_Bit
- LDR sp, =__stack_fiq_end__
-
-/* Enter IRQ Mode and set its Stack Pointer */
-
- MSR cpsr_c, #Mode_IRQ|I_Bit|F_Bit
- LDR sp, =__stack_irq_end__
-
-/* Enter System/User Mode and set its Stack Pointer */
-
- MSR cpsr_c, #Mode_SYS
- LDR sp, =__stack_end__
-
-/* Setup a default Stack Limit (when compiled with "-mapcs-stack-check") */
-
- LDR sl, =__bss_end__
-
-/* Relocate .data section (Copy from ROM to RAM) */
-
- LDR r1, =_etext
- LDR r2, =__data_start
- LDR r3, =_edata
-LoopRel:
- CMP r2, r3
- LDRLO r0, [r1], #4
- STRLO r0, [r2], #4
- BLO LoopRel
-
-/* Clear .bss section (Zero init) */
-
- MOV r0, #0
- LDR r1, =__bss_start__
- LDR r2, =__bss_end__
-LoopZI:
- CMP r1, r2
- STRLO r0, [r1], #4
- BLO LoopZI
-
-/* Call C++ constructors */
-
- LDR r0, =__ctors_start__
- LDR r1, =__ctors_end__
-ctor_loop:
- CMP r0, r1
- BEQ ctor_end
- LDR r2, [r0], #4
- STMFD sp!, {r0-r1}
- BLX r2
- LDMFD sp!, {r0-r1}
- B ctor_loop
-ctor_end:
-
-/* Need to set up standard file handles */
-/* Only used under simulator, normally overide syscall.c */
-
-# BL initialise_monitor_handles
-
-/* if we use debug version of str9lib this will call the init function */
-
- BL libdebug
-libdebug:
-
-/* Enter the C code, use B instruction so as to never return */
-/* use BL main if you want to use c++ destructors below */
-
- B main
-
-/* Call destructors */
-
-# LDR r0, =__dtors_start__
-# LDR r1, =__dtors_end__
-#dtor_loop:
-# CMP r0, r1
-# BEQ dtor_end
-# LDR r2, [r0], #4
-# STMFD sp!, {r0-r1}
-# BLX r2
-# LDMFD sp!, {r0-r1}
-# B dtor_loop
-#dtor_end:
-
-/* Return from main, loop forever. */
-
-#exit_loop:
-# B exit_loop
-
-/* Fosc values, used by libstr9 */
-
-_Main_Crystal: .long FOSC
-
- .weak libdebug
-
- .end
diff --git a/uc_str912/prj_blinky_simple_startup/src/vector.s b/uc_str912/prj_blinky_simple_startup/src/vector.s
deleted file mode 100644
index 7708f54..0000000
--- a/uc_str912/prj_blinky_simple_startup/src/vector.s
+++ /dev/null
@@ -1,202 +0,0 @@
-/***********************************************************************************
-* Copyright 2005 Anglia Design
-* This demo code and associated components are provided as is and has no warranty,
-* implied or otherwise. You are free to use/modify any of the provided
-* code at your own risk in your applications with the expressed limitation
-* of liability (see below)
-*
-* LIMITATION OF LIABILITY: ANGLIA OR ANGLIA DESIGNS SHALL NOT BE LIABLE FOR ANY
-* LOSS OF PROFITS, LOSS OF USE, LOSS OF DATA, INTERRUPTION OF BUSINESS, NOR FOR
-* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND WHETHER UNDER
-* THIS AGREEMENT OR OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-*
-* Author : Spencer Oliver
-* Web : www.anglia-designs.com
-*
-***********************************************************************************/
-
- .equ VectorAddress, 0xFFFFF030 /* VIC Vector address register address. */
- .equ VectorAddressDaisy, 0xFC000030 /* Daisy VIC Vector address register */
-
- .equ Mode_USR, 0x10
- .equ Mode_FIQ, 0x11
- .equ Mode_IRQ, 0x12
- .equ Mode_SVC, 0x13
- .equ Mode_ABT, 0x17
- .equ Mode_UND, 0x1B
- .equ Mode_SYS, 0x1F /* available on ARM Arch 4 and later */
-
- .equ I_Bit, 0x80 /* when I bit is set, IRQ is disabled */
- .equ F_Bit, 0x40 /* when F bit is set, FIQ is disabled */
-
- .text
- .arm
- .section .vectors, "ax"
-
- .global Reset_Vec
-
-/* Note: LDR PC instructions are used here, though branch (B) instructions */
-/* could also be used, unless the ROM is at an address >32MB. */
-
-/*******************************************************************************
- Exception vectors
-*******************************************************************************/
-
-Reset_Vec: LDR pc, Reset_Addr /* Reset Handler */
-Undef_Vec: LDR pc, Undefined_Addr
-SWI_Vec: LDR pc, SWI_Addr
-PAbt_Vec: LDR pc, Prefetch_Addr
-DAbt_Vec: LDR pc, Abort_Addr
- NOP /* Reserved vector */
-IRQ_Vec: LDR pc, IRQ_Addr
-FIQ_Vec: LDR pc, FIQ_Addr
-
-/*******************************************************************************
- Exception handlers address table
-*******************************************************************************/
-
-Reset_Addr: .word _start
-Undefined_Addr: .word UndefinedHandler
-SWI_Addr: .word SWIHandler
-Prefetch_Addr: .word PrefetchHandler
-Abort_Addr: .word AbortHandler
- .word 0 /* reserved */
-IRQ_Addr: .word IRQHandler
-FIQ_Addr: .word FIQHandler
-
-/*******************************************************************************
- Exception Handlers
-*******************************************************************************/
-
-/*******************************************************************************
-* Macro Name : SaveContext
-* Description : This macro used to save the context before entering
- an exception handler.
-* Input : The range of registers to store.
-* Output : none
-*******************************************************************************/
-
-.macro SaveContext reg1 reg2
- STMFD sp!,{\reg1-\reg2,lr} /* Save The workspace plus the current return */
- /* address lr_ mode into the stack */
- MRS r1, spsr /* Save the spsr_mode into r1 */
- STMFD sp!, {r1} /* Save spsr */
-.endm
-
-/*******************************************************************************
-* Macro Name : RestoreContext
-* Description : This macro used to restore the context to return from
- an exception handler and continue the program execution.
-* Input : The range of registers to restore.
-* Output : none
-*******************************************************************************/
-
-.macro RestoreContext reg1 reg2
- LDMFD sp!, {r1} /* Restore the saved spsr_mode into r1 */
- MSR spsr_cxsf, r1 /* Restore spsr_mode */
- LDMFD sp!, {\reg1-\reg2,pc}^ /* Return to the instruction following */
- /* the exception interrupt */
-.endm
-
-/*******************************************************************************
-* Function Name : IRQHandler
-* Description : This function called when IRQ exception is entered.
-* Input : none
-* Output : none
-*******************************************************************************/
-
-IRQHandler:
- SUB lr, lr, #4 /* Update the link register */
- SaveContext r0, r12 /* Save the workspace plus the current */
- /* return address lr_irq and spsr_irq */
- LDR r0, =VectorAddress
- LDR r0, [r0] /* Read the routine address */
- LDR r1, =VectorAddressDaisy
- LDR r1, [r1]
- /* Padding between the acknowledge and re-enable of interrupts */
- /* For more details, please refer to the following URL */
- /* http://www.arm.com/support/faqip/3682.html */
- NOP
- NOP
- MSR cpsr_c, #Mode_SYS /* Switch to SYS mode and enable IRQ */
- STMFD sp!, {lr} /* Save the link register. */
- LDR lr, =ReturnAddress /* Read the return address. */
- MOV pc, r0 /* Branch to the IRQ handler. */
-ReturnAddress:
- LDMFD sp!, {lr} /* Restore the link register. */
- MSR cpsr_c, #Mode_IRQ|I_Bit|F_Bit /* Switch to IRQ mode and disable IRQ */
- LDR r0, =VectorAddress /* Write to the VectorAddress to clear the */
- STR r0, [r0] /* respective interrupt in the internal interrupt */
- LDR r1, =VectorAddressDaisy /* Write to the VectorAddressDaisy to clear the */
- STR r1, [r1] /* respective interrupt in the internal interrupt */
- RestoreContext r0, r12 /* Restore the context and return to the program execution. */
-
-/*******************************************************************************
-* Function Name : SWIHandler
-* Description : This function called when SWI instruction executed.
-* Input : none
-* Output : none
-*******************************************************************************/
-
-SWIHandler:
- SaveContext r0, r12 /* r0 holds swi number */
- MOV r1, sp /* load regs */
- BL SWI_Handler
- RestoreContext r0, r12
-
-/*******************************************************************************
-* Function Name : UndefinedHandler
-* Description : This function called when undefined instruction
- exception is entered.
-* Input : none
-* Output : none
-*******************************************************************************/
-
-UndefinedHandler:
- SaveContext r0, r12
- BL Undefined_Handler
- RestoreContext r0, r12
-
-/*******************************************************************************
-* Function Name : PrefetchAbortHandler
-* Description : This function called when Prefetch Abort
- exception is entered.
-* Input : none
-* Output : none
-*******************************************************************************/
-
-PrefetchHandler:
- SUB lr, lr, #4 /* Update the link register. */
- SaveContext r0, r12
- BL Prefetch_Handler
- RestoreContext r0, r12
-
-/*******************************************************************************
-* Function Name : DataAbortHandler
-* Description : This function is called when Data Abort
- exception is entered.
-* Input : none
-* Output : none
-*******************************************************************************/
-
-AbortHandler:
- SUB lr, lr, #8 /* Update the link register. */
- SaveContext r0, r12
- BL Abort_Handler
- RestoreContext r0, r12
-
-/*******************************************************************************
-* Function Name : FIQHandler
-* Description : This function is called when FIQ
- exception is entered.
-* Input : none
-* Output : none
-*******************************************************************************/
-
-FIQHandler:
- SUB lr, lr, #4 /* Update the link register. */
- SaveContext r0, r7
- BL FIQ_Handler
- RestoreContext r0, r7
-
- .end
diff --git a/uc_str912/prj_blinky_simple_startup/src/vectors.c b/uc_str912/prj_blinky_simple_startup/src/vectors.c
deleted file mode 100644
index 4022391..0000000
--- a/uc_str912/prj_blinky_simple_startup/src/vectors.c
+++ /dev/null
@@ -1,462 +0,0 @@
-/***********************************************************************************
-* Copyright 2005 Anglia Design
-* This demo code and associated components are provided as is and has no warranty,
-* implied or otherwise. You are free to use/modify any of the provided
-* code at your own risk in your applications with the expressed limitation
-* of liability (see below)
-*
-* LIMITATION OF LIABILITY: ANGLIA OR ANGLIA DESIGNS SHALL NOT BE LIABLE FOR ANY
-* LOSS OF PROFITS, LOSS OF USE, LOSS OF DATA, INTERRUPTION OF BUSINESS, NOR FOR
-* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND WHETHER UNDER
-* THIS AGREEMENT OR OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-*
-* Author : Spencer Oliver
-* Web : www.anglia-designs.com
-*
-***********************************************************************************/
-
-#include "vectors.h"
-
-/*******************************************************************************
-* Function Name : Undefined_Handler
-* Description : This function Undefined instruction exception.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void Undefined_Handler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : SWI_Handler
-* Description : This function handles SW exception.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void SWI_Handler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : Prefetch_Handler
-* Description : This function handles preftetch abort exception.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void Prefetch_Handler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : Abort_Handler
-* Description : This function handles data abort exception.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void Abort_Handler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : FIQ_Handler
-* Description : This function handles FIQ exception.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void FIQ_Handler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : WDG_IRQHandler
-* Description : This function handles the WDG interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void WDG_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : SW_IRQHandler
-* Description : This function handles the SW interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void SW_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : ARMRX_IRQHandler
-* Description : This function handles the ARMRX interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void ARMRX_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : ARMTX_IRQHandler
-* Description : This function handles the ARMTX interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void ARMTX_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : TIM0_IRQHandler
-* Description : This function handles the TIM0 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void TIM0_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : TIM1_IRQHandler
-* Description : This function handles the TIM1 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void TIM1_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : TIM2_IRQHandler
-* Description : This function handles the TIM2 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void TIM2_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : TIM3_IRQHandler
-* Description : This function handles the TIM3 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void TIM3_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : USBHP_IRQHandler
-* Description : This function handles the USBHP interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void USBHP_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : USBLP_IRQHandler
-* Description : This function handles the USBLP interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void USBLP_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : SCU_IRQHandler
-* Description : This function handles the SCU interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : ENET_IRQHandler
-* Description : This function handles the ENET interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void ENET_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : DMA_IRQHandler
-* Description : This function handles the DMA interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void DMA_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : CAN_IRQHandler
-* Description : This function handles the CAN interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void CAN_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : MC_IRQHandler
-* Description : This function handles the MC interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : ADC_IRQHandler
-* Description : This function handles the ADC interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void ADC_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : UART0_IRQHandler
-* Description : This function handles the UART0 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART0_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : UART1_IRQHandler
-* Description : This function handles the UART1 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART1_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : UART2_IRQHandler
-* Description : This function handles the UART2 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART2_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : I2C0_IRQHandler
-* Description : This function handles the I2C0 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void I2C0_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : I2C1_IRQHandler
-* Description : This function handles the I2C1 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void I2C1_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : SSP0_IRQHandler
-* Description : This function handles the SSP0 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void SSP0_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : SSP1_IRQHandler
-* Description : This function handles the SSP1 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void SSP1_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : LVD_IRQHandler
-* Description : This function handles the LVD interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void LVD_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : RTC_IRQHandler
-* Description : This function handles the RTC interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void RTC_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : WIU_IRQHandler
-* Description : This function handles the WIU interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void WIU_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : EXTIT0_IRQHandler
-* Description : This function handles the EXTIT0 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void EXTIT0_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : EXTIT1_IRQHandler
-* Description : This function handles the EXTIT1 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void EXTIT1_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : EXTIT2_IRQHandler
-* Description : This function handles the EXTIT2 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void EXTIT2_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : EXTIT3_IRQHandler
-* Description : This function handles the EXTIT3 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void EXTIT3_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : USBWU_IRQHandler
-* Description : This function handles the USBWU interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void USBWU_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : PFQBC_IRQHandler
-* Description : This function handles the PFQBC interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void PFQBC_IRQHandler(void)
-{
- while(1);
-}
diff --git a/uc_str912/prj_blinky_simple_startup/str91x_lib/Makefile b/uc_str912/prj_blinky_simple_startup/str91x_lib/Makefile
deleted file mode 100644
index e65be4d..0000000
--- a/uc_str912/prj_blinky_simple_startup/str91x_lib/Makefile
+++ /dev/null
@@ -1,38 +0,0 @@
-# efsl library Makefile for STR910 by Giacomo Fazio and Antonio Nasca
-# (based on efsl library makefile for AT91SAM7S by Martin Thomas)
-
-
-MCU = arm9e
-#THUMB = -mthumb -mthumb-interwork
-THUMB =
-
-LIBNAME = libSTR91x_lib.a
-
-COPT= -mcpu=$(MCU) $(THUMB) -gdwarf-2 -Wall -Os
-INCLUDEDIRS=-Iinclude
-CFLAGS=$(COPT) $(INCLUDEDIRS)
-# gcc4 unused code-removal:
-CFLAGS += -ffunction-sections -fdata-sections
-
-CC=arm-elf-gcc
-AR=arm-elf-ar
-OBJCOPY=arm-elf-objcopy
-
-OBJ=src/91x_adc.o src/91x_ahbapb.o src/91x_can.o src/91x_dma.o
-OBJ+=src/91x_emi.o src/91x_fmi.o src/91x_gpio.o src/91x_i2c.o src/91x_lib.o src/91x_mc.o
-OBJ+=src/91x_rtc.o src/91x_scu.o src/91x_ssp.o src/91x_tim.o
-OBJ+=src/91x_wdg.o src/91x_wiu.o src/91x_uart.o src/91x_vic.o
-
-
-all: lib
-
-libandclean: lib srcclean
-
-lib: $(OBJ)
- $(AR) rcs $(LIBNAME) $(OBJ)
-
-srcclean :
- rm -f $(OBJ)
-
-clean :
- rm -f $(OBJ) $(LIBNAME)
diff --git a/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_adc.h b/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_adc.h
deleted file mode 100644
index 25a396d..0000000
--- a/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_adc.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_adc.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* ADC software library.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-
-/* Define to prevent recursive inclusion ------------------------------------ */
-
-#ifndef __91x_ADC_H
-#define __91x_ADC_H
-
-/* Includes ------------------------------------------------------------------*/
-
-#include "91x_map.h"
-
-/* Exported types ------------------------------------------------------------*/
-
-/* ADC Init structure define */
-typedef struct
-{
- u16 ADC_WDG_High_Threshold;
- u16 ADC_WDG_Low_Threshold;
- u16 ADC_Channel_0_Mode;
- u16 ADC_Channel_1_Mode;
- u16 ADC_Channel_2_Mode;
- u16 ADC_Channel_3_Mode;
- u16 ADC_Channel_4_Mode;
- u16 ADC_Channel_5_Mode;
- u16 ADC_Channel_6_Mode;
- u16 ADC_Channel_7_Mode;
- u16 ADC_Select_Channel;
- FunctionalState ADC_Scan_Mode;
- u16 ADC_Conversion_Mode;
-}ADC_InitTypeDef;
-
-/* ADC watchdog thresholds */
-typedef enum
-{
- ADC_HighThreshold,
- ADC_LowThreshold
-}ADC_ThresholdType;
-
-/* Exported constants --------------------------------------------------------*/
-
-/* ADC channels */
-#define ADC_Channel_0 0x00 /* Channel 0 */
-#define ADC_Channel_1 0x01 /* Channel 1 */
-#define ADC_Channel_2 0x02 /* Channel 2 */
-#define ADC_Channel_3 0x03 /* Channel 3 */
-#define ADC_Channel_4 0x04 /* Channel 4 */
-#define ADC_Channel_5 0x05 /* Channel 5 */
-#define ADC_Channel_6 0x06 /* Channel 6 */
-#define ADC_Channel_7 0x07 /* Channel 7 */
-
-/* ADC modes */
-#define ADC_Continuous_Mode 0x0010 /* Continuous mode conversion */
-#define ADC_Single_Mode 0xFFEF /* Single mode conversion */
-
-/* ADC Flags */
-#define ADC_FLAG_ECV 0x002F /* End of Conversion Flag */
-#define ADC_FLAG_AWD 0x002E /* Analog WatchDog Flag */
-
-#define ADC_FLAG_OV_CH_0 0x00CF /* Overflow Flag for channel 0 */
-#define ADC_FLAG_OV_CH_1 0x00EF /* Overflow Flag for channel 1 */
-#define ADC_FLAG_OV_CH_2 0x010F /* Overflow Flag for channel 2 */
-#define ADC_FLAG_OV_CH_3 0x012F /* Overflow Flag for channel 3 */
-#define ADC_FLAG_OV_CH_4 0x014F /* Overflow Flag for channel 4 */
-#define ADC_FLAG_OV_CH_5 0x016F /* Overflow Flag for channel 5 */
-#define ADC_FLAG_OV_CH_6 0x018F /* Overflow Flag for channel 6 */
-#define ADC_FLAG_OV_CH_7 0x01AF /* Overflow Flag for channel 7 */
-
-/* ADC conversion modes */
-#define ADC_NoThreshold_Conversion 0x0003 /* Conversion w/o thresholds */
-#define ADC_LowThreshold_Conversion 0x0002 /* Low threshold conversion */
-#define ADC_HighThreshold_Conversion 0x0001 /* High threshold conversion */
-#define ADC_No_Conversion 0x0000 /* No ADC conversion */
-
-/* ADC interrupts */
-#define ADC_IT_ECV 0x0400 /* End of Conversion Interrupt */
-#define ADC_IT_AWD 0x0200 /* Analog Watchdog Interrupt */
-
-/* ADC Start/Stop conversion */
-#define ADC_Conversion_Start 0x0001 /* ADC start conversion */
-#define ADC_Conversion_Stop 0xFFFE /* ADC stop conversion */
-
-/* Module private variables --------------------------------------------------*/
-/* Exported macro ------------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-
-void ADC_DeInit(void);
-void ADC_Init(ADC_InitTypeDef* ADC_InitStruct);
-void ADC_StructInit(ADC_InitTypeDef* ADC_InitStruct);
-void ADC_PrescalerConfig(u8 ADC_Prescaler);
-u8 ADC_GetPrescalerValue(void);
-FlagStatus ADC_GetFlagStatus(u16 ADC_Flag);
-void ADC_ClearFlag(u16 ADC_Flag);
-u16 ADC_GetConversionValue(u16 ADC_Channel);
-FlagStatus ADC_GetAnalogWatchdogResult(u16 ADC_Channel);
-void ADC_ClearAnalogWatchdogResult(u16 ADC_Channel);
-u16 ADC_GetWatchdogThreshold(ADC_ThresholdType ADC_Threshold);
-void ADC_ITConfig(u16 ADC_IT, FunctionalState ADC_NewState);
-void ADC_StandbyModeCmd(FunctionalState ADC_NewState);
-void ADC_Cmd(FunctionalState ADC_NewState);
-void ADC_ConversionCmd(u16 ADC_Conversion);
-
-#endif /* __91x_ADC_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
-
diff --git a/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_ahbapb.h b/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_ahbapb.h
deleted file mode 100644
index 1828d48..0000000
--- a/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_ahbapb.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_ahbapb.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* AHBAPB software library.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef _91x_AHBAPB_H
-#define _91x_AHBAPB_H
-
-#include "91x_map.h"
-
-#define AHBAPB_Split_Enable 0x01000000
-#define AHBAPB_Split_Disable 0xFEFFFFFF
-#define AHBAPB_Error_Enable 0x0000100
-#define AHBAPB_Error_Disable 0xFFFFEFF
-
-/*FLAG*/
-#define AHBAPB_FLAG_ERROR 0x01 /* error flag*/
-#define AHBAPB_FLAG_OUTM 0x10 /* Out of Memory flag */
-#define AHBAPB_FLAG_APBT 0x20 /* APB Time-out flag */
-#define AHBAPB_FLAG_RW 0x40 /*Access type flag*/
-
-/* Includes ------------------------------------------------------------------*/
-
-
-/* AHBAPB Init structure definition */
-typedef struct
-{
- u32 AHBAPB_SetTimeOut;
- u32 AHBAPB_Error;
- u32 AHBAPB_Split;
- u8 AHBAPB_SplitCounter;
-}AHBAPB_InitTypeDef;
-
-/* Exported constants --------------------------------------------------------*/
-void AHBAPB_DeInit(AHBAPB_TypeDef* AHBAPBx);
-void AHBAPB_Init(AHBAPB_TypeDef* AHBAPBx, AHBAPB_InitTypeDef* AHBAPB_InitStruct);
-void AHBAPB_StructInit(AHBAPB_InitTypeDef* AHBAPB_InitStruct);
-FlagStatus AHBAPB_GetFlagStatus(AHBAPB_TypeDef* AHBAPBx, u8 AHBAPB_FLAG);
-void AHBAPB_ClearFlag(AHBAPB_TypeDef* AHBAPBx, u8 AHBAPB_FLAG);
-u32 AHBAPB_GetPeriphAddrError(AHBAPB_TypeDef* AHBAPBx);
-
-
-#endif /* _91x_AHBAPB_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_can.h b/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_can.h
deleted file mode 100644
index b3d0653..0000000
--- a/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_can.h
+++ /dev/null
@@ -1,165 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_can.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* CAN bus software library.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __91x_CAN_H
-#define __91x_CAN_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_map.h"
-
-/* Exported types ------------------------------------------------------------*/
-
-/* CAN Init structure define */
-typedef struct
-{
- u8 CAN_ConfigParameters;
- u32 CAN_Bitrate;
-}CAN_InitTypeDef;
-
-/* Exported constants --------------------------------------------------------*/
-/* Standard bitrates available*/
-enum
-{
- CAN_BITRATE_100K,
- CAN_BITRATE_125K,
- CAN_BITRATE_250K,
- CAN_BITRATE_500K,
- CAN_BITRATE_1M
-};
-
-/* Control register*/
-#define CAN_CR_TEST 0x0080
-#define CAN_CR_CCE 0x0040
-#define CAN_CR_DAR 0x0020
-#define CAN_CR_EIE 0x0008
-#define CAN_CR_SIE 0x0004
-#define CAN_CR_IE 0x0002
-#define CAN_CR_INIT 0x0001
-
-/* Status register */
-#define CAN_SR_BOFF 0x0080
-#define CAN_SR_EWARN 0x0040
-#define CAN_SR_EPASS 0x0020
-#define CAN_SR_RXOK 0x0010
-#define CAN_SR_TXOK 0x0008
-#define CAN_SR_LEC 0x0007
-
-/* Test register*/
-#define CAN_TESTR_RX 0x0080
-#define CAN_TESTR_TX1 0x0040
-#define CAN_TESTR_TX0 0x0020
-#define CAN_TESTR_LBACK 0x0010
-#define CAN_TESTR_SILENT 0x0008
-#define CAN_TESTR_BASIC 0x0004
-
-/* IFn / Command Request register*/
-#define CAN_CRR_BUSY 0x8000
-
-/* IFn / Command Mask register*/
-#define CAN_CMR_WRRD 0x0080
-#define CAN_CMR_MASK 0x0040
-#define CAN_CMR_ARB 0x0020
-#define CAN_CMR_CONTROL 0x0010
-#define CAN_CMR_CLRINTPND 0x0008
-#define CAN_CMR_TXRQSTNEWDAT 0x0004
-#define CAN_CMR_DATAA 0x0002
-#define CAN_CMR_DATAB 0x0001
-
-/* IFn / Mask 2 register*/
-#define CAN_M2R_MXTD 0x8000
-#define CAN_M2R_MDIR 0x4000
-
-/* IFn / Arbitration 2 register*/
-#define CAN_A2R_MSGVAL 0x8000
-#define CAN_A2R_XTD 0x4000
-#define CAN_A2R_DIR 0x2000
-
-/* IFn / Message Control register*/
-#define CAN_MCR_NEWDAT 0x8000
-#define CAN_MCR_MSGLST 0x4000
-#define CAN_MCR_INTPND 0x2000
-#define CAN_MCR_UMASK 0x1000
-#define CAN_MCR_TXIE 0x0800
-#define CAN_MCR_RXIE 0x0400
-#define CAN_MCR_RMTEN 0x0200
-#define CAN_MCR_TXRQST 0x0100
-#define CAN_MCR_EOB 0x0080
-
-
-/* Wake-up modes*/
-enum
-{
- CAN_WAKEUP_ON_EXT,
- CAN_WAKEUP_ON_CAN
-};
-
-
-/* CAN message structure*/
-typedef struct
-{
- u32 IdType;
- u32 Id;
- u8 Dlc;
- u8 Data[8];
-} canmsg;
-
-/* Message ID types*/
-enum
-{
- CAN_STD_ID,
- CAN_EXT_ID
-};
-
-/* Message ID limits*/
-
-#define CAN_LAST_STD_ID ((1<<11) - 1)
-#define CAN_LAST_EXT_ID ((1L<<29) - 1)
-
-/* Exported functions ------------------------------------------------------- */
-
-void CAN_Init (CAN_InitTypeDef *CAN_InitStruct);
-void CAN_DeInit (void);
-void CAN_StructInit(CAN_InitTypeDef *CAN_InitStruct);
-void CAN_SetBitrate(u32 bitrate);
-void CAN_SetTiming(u32 tseg1, u32 tseg2, u32 sjw, u32 brp);
-ErrorStatus CAN_SetUnusedMsgObj(u32 msgobj);
-ErrorStatus CAN_SetTxMsgObj(u32 msgobj, u32 idType);
-ErrorStatus CAN_SetRxMsgObj(u32 msgobj, u32 idType, u32 idLow, u32 idHigh, bool singleOrFifoLast);
-void CAN_InvalidateAllMsgObj(void);
-ErrorStatus CAN_ReleaseMessage(u32 msgobj);
-ErrorStatus CAN_SendMessage(u32 msgobj, canmsg* pCanMsg);
-ErrorStatus CAN_ReceiveMessage(u32 msgobj, bool release, canmsg* pCanMsg);
-ErrorStatus CAN_WaitEndOfTx(void);
-ErrorStatus CAN_BasicSendMessage(canmsg* pCanMsg);
-ErrorStatus CAN_BasicReceiveMessage(canmsg* pCanMsg);
-void CAN_EnterTestMode(u8 TestMask);
-void CAN_EnterInitMode(u8 InitMask);
-void CAN_LeaveInitMode(void);
-void CAN_LeaveTestMode(void);
-void CAN_ReleaseTxMessage(u32 msgobj);
-void CAN_ReleaseRxMessage(u32 msgobj);
-u32 CAN_IsMessageWaiting(u32 msgobj);
-u32 CAN_IsTransmitRequested(u32 msgobj);
-u32 CAN_IsInterruptPending(u32 msgobj);
-u32 CAN_IsObjectValid(u32 msgobj);
-
-#endif /* __91x_CAN_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_conf.h b/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_conf.h
deleted file mode 100644
index a39d57e..0000000
--- a/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_conf.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_conf.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : Library configuration.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-
-#ifndef __91x_CONF_H
-#define __91x_CONF_H
-
-/* To work in buffered mode just decomment the following line */
-
-//#define LIBUFF
-
-/* Comment the line below to put the library in release mode */
-//#define LIBDEBUG
-
-#define inline static __inline
-
-/************************* AHBAPB *************************/
-#define _AHBAPB
-#define _AHBAPB0
-#define _AHBAPB1
-/************************* VIC *************************/
-#define _VIC
-#define _VIC0
-#define _VIC1
-/************************* DMA *************************/
-#define _DMA
-#define _DMA_Channel0
-#define _DMA_Channel1
-#define _DMA_Channel2
-#define _DMA_Channel3
-#define _DMA_Channel4
-#define _DMA_Channel5
-#define _DMA_Channel6
-#define _DMA_Channel7
-
-/************************* EMI *************************/
-#define _EMI
-#define _EMI_Bank0
-#define _EMI_Bank1
-#define _EMI_Bank2
-#define _EMI_Bank3
-/************************* FMI *************************/
-#define _FMI
-/************************* WIU *************************/
-#define _WIU
-/************************* TIM *************************/
-#define _TIM
-#define _TIM0
-#define _TIM1
-#define _TIM2
-#define _TIM3
-/************************* GPIO ************************/
-#define _GPIO
-#define _GPIO0
-#define _GPIO1
-#define _GPIO2
-#define _GPIO3
-#define _GPIO4
-#define _GPIO5
-#define _GPIO6
-#define _GPIO7
-#define _GPIO8
-#define _GPIO9
-/************************* RTC *************************/
-#define _RTC
-/************************* SCU *************************/
-#define _SCU
-/************************* MC **************************/
-#define _MC
-/************************* UART ************************/
-#define _UART
-#define _UART0
-#define _UART1
-#define _UART2
-/************************* SSP *************************/
-#define _SSP
-#define _SSP0
-#define _SSP1
-/************************* CAN *************************/
-#define _CAN
-/************************* ADC *************************/
-#define _ADC
-/************************* WDG *************************/
-#define _WDG
-/************************* I2C *************************/
-#define _I2C
-#define _I2C0
-#define _I2C1
-/************************ ENET *************************/
-#define _ENET
-
-/*---------------------------- _Main_Crystal frequency value (KHz)------------*/
-
-//#ifndef _Main_Crystal
-//#define _Main_Crystal 25000
-//#endif
-/*------------------------------------------------------------------------------*/
-
-
-#endif /* __91x_CONF_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_dma.h b/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_dma.h
deleted file mode 100644
index 6a383aa..0000000
--- a/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_dma.h
+++ /dev/null
@@ -1,247 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : template.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : provide a short description of the source file indicating
-* its purpose.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __91x_DMA_H
-#define __91x_DMA_H
-
-/* Includes ------------------------------------------------------------------*/
-#include"91x_map.h"
-
-
-/* Exported types ------------------------------------------------------------*/
-
-typedef struct
-{
- u32 DMA_Channel_SrcAdd; /* The current source address (byte-aligned) of the data to be transferred.*/
-
- u32 DMA_Channel_DesAdd; /* The current destination address (byte-aligned) of the data to be transferred.*/
-
- u32 DMA_Channel_LLstItm; /* The word- aligned address for the next Linked List Item. */
-
- u32 DMA_Channel_DesWidth; /* Destination transfer width. */
-
- u32 DMA_Channel_SrcWidth; /* Source transfer width. */
-
- u32 DMA_Channel_DesBstSize; /* The destination burst size which indicates the number of transfers that make up a destination burst transfer request.*/
-
- u32 DMA_Channel_SrcBstSize; /* The source burst size.Indicates the number of transfers that make up a source burst */
-
- u32 DMA_Channel_TrsfSize; /* Transfer size which indicates the size of the transfer when the DMA controller is the flow controller*/
-
- u32 DMA_Channel_FlowCntrl; /* Flow control and transfer type. */
-
- u32 DMA_Channel_Src; /* Source peripheral: selects the DMA source request peripheral. */
-
- u32 DMA_Channel_Des; /* Destination peripheral:selects the DMA destination request peripheral. */
-
-} DMA_InitTypeDef;
-
-/* Exported constants --------------------------------------------------------*/
-
- /* Interrupts masks */
-
-#define DMA_ITMask_IE 0x4000 /* Interrupt error mask. */
-#define DMA_ITMask_ITC 0x8000 /* Terminal count interrupt mask.*/
-#define DMA_ITMask_ALL 0xC000 /* All DMA_Channelx interrupts enable/disable mask*/
-
- /* Sources Request (used as masks) */
-
-#define DMA_USB_RX_Mask 0x0001
-#define DMA_USB_TX_Mask 0x0002
-#define DMA_TIM0_Mask 0x0004
-#define DMA_TIM1_Mask 0x0008
-#define DMA_UART0_RX_Mask 0x0010
-#define DMA_UART0_TX_Mask 0x0020
-#define DMA_UART1_RX_Mask 0x0040
-#define DMA_UART1_TX_Mask 0x0080
-#define DMA_External_Req0_Mask 0x0100
-#define DMA_External_Req1_Mask 0x0200
-#define DMA_I2C0_Mask 0x0400
-#define DMA_I2C1_Mask 0x0800
-#define DMA_SSP0_RX_Mask 0x1000
-#define DMA_SSP0_TX_Mask 0x2000
-#define DMA_SSP1_RX_Mask 0x4000
-#define DMA_SSP1_TX_Mask 0x8000
-
-
-/* Previleged Mode and user mode */
-
-#define DMA_PrevilegedMode 0x10000000
-#define DMA_UserMode 0xEFFFFFFF
-
-
-/* Error and Terminal Count interrupts Status, after and before"raw" masking */
-#define DMA_IS 0x01
-#define DMA_TCS 0x02
-#define DMA_ES 0x03
-#define DMA_TCRS 0x04
-#define DMA_ERS 0x05
-
-
-/* interrupt clear: Terminal Count flag Clear and Error flag clear*/
-
-#define DMA_TCC 0x01
-#define DMA_EC 0x02
-
-/* channel index "0...7"*/
-
-#define Channel0 0
-#define Channel1 1
-#define Channel2 2
-#define Channel3 3
-#define Channel4 4
-#define Channel5 5
-#define Channel6 6
-#define Channel7 7
-
-
-
-/* Destination request selection: selects the DMA Destination request peripheral */
-
-#define DMA_DES_USB_RX 0x00
-#define DMA_DES_USB_TX 0x40
-#define DMA_DES_TIM1 0x80
-#define DMA_DES_TIM2 0xC0
-#define DMA_DES_UART0_RX 0x100
-#define DMA_DES_UART0_TX 0x140
-#define DMA_DES_UART1_RX 0x180
-#define DMA_DES_UART1_TX 0x1C0
-#define DMA_DES_External_Req0 0x200
-#define DMA_DES_External_Req1 0x240
-#define DMA_DES_I2C0 0x280
-#define DMA_DES_I2C1 0x2C0
-#define DMA_DES_SSP0_RX 0x300
-#define DMA_DES_SSP0_TX 0x340
-#define DMA_DES_SSP1_RX 0x380
-#define DMA_DES_SSP1_TX 0x3C0
-
-
-
-
-/* Source request selection: selects the DMA Source request peripheral */
-
-#define DMA_SRC_USB_RX 0x00
-#define DMA_SRC_USB_TX 0x02
-#define DMA_SRC_TIM1 0x04
-#define DMA_SRC_TIM2 0x06
-#define DMA_SRC_UART0_RX 0x08
-#define DMA_SRC_UART0_TX 0x0A
-#define DMA_SRC_UART1_RX 0x0C
-#define DMA_SRC_UART1_TX 0x0E
-#define DMA_SRC_External_Req0 0x10
-#define DMA_SRC_External_Req1 0x12
-#define DMA_SRC_I2C0 0x14
-#define DMA_SRC_I2C1 0x16
-#define DMA_SRC_SSP0_RX 0x18
-#define DMA_SRC_SSP0_TX 0x1A
-#define DMA_SRC_SSP1_RX 0x1C
-#define DMA_SRC_SSP1_TX 0x1E
-
-
-
-
-
-#define DMA_FlowCntrlt0_DMA 0x00000000 /* transfer type :Memory-to-memory, flow controller:DMA */
-#define DMA_FlowCntrl1_DMA 0x00000800 /* transfer type :Memory-to-peripheral, flow controller:DMA */
-#define DMA_FlowCntrl2_DMA 0x00001000 /* transfer type :Peripheral-to-memory, flow controller:DMA */
-#define DMA_FlowCntrl3_DMA 0x00001800 /* transfer type :Source peripheral-to-destination peripheral, flow controller:DMA */
-#define DMA_FlowCntrl_DestPerip 0x00002000 /* transfer type :Source peripheral-to-destination peripheral, flow controller:Destination peripheral */
-#define DMA_FlowCntrl_Perip1 0x00002800 /* transfer type :Memory-to-peripheral, flow controller:peripheral */
-#define DMA_FlowCntrl_Perip2 0x00003000 /* transfer type : Peripheral-to-memory, flow controller:peripheral */
-#define DMA_FlowCntrl_SrcPerip 0x00003800 /* transfer type :Source peripheral-to-destination peripheral, flow controller:Source peripheral */
-
-
-
-
-#define DMA_SrcBst_1Data 0x00000000 /* Source Burst transfer request IS 1 Data ( DATA = Source transfer width ) */
-#define DMA_SrcBst_4Data 0x00001000 /* Source Burst transfer request IS 4 Data */
-#define DMA_SrcBst_8Data 0x00002000 /* Source Burst transfer request IS 8 Data */
-#define DMA_SrcBst_16Data 0x00003000 /* Source Burst transfer request IS 16 Data */
-#define DMA_SrcBst_32Data 0x00004000 /* Source Burst transfer request IS 32 Data */
-#define DMA_SrcBst_64Data 0x00005000 /* Source Burst transfer request IS 64Data */
-#define DMA_SrcBst_128Data 0x00006000 /* Source Burst transfer request IS 128 Data */
-#define DMA_SrcBst_256Data 0x00007000 /* Source Burst transfer request IS 256 Data */
-
-
-
-
-#define DMA_DesBst_1Data 0x00000000 /*Destination Burst transfer request IS 1Data ( DATA = destination transfer width ) */
-#define DMA_DesBst_4Data 0x00008000 /*Destination Burst transfer request IS 1 Data */
-#define DMA_DesBst_8Data 0x00010000 /*Destination Burst transfer request IS 4 Data */
-#define DMA_DesBst_16Data 0x00018000 /*Destination Burst transfer request IS 8 Data */
-#define DMA_DesBst_32Data 0x00020000 /*Destination Burst transfer request IS 16 Data */
-#define DMA_DesBst_64Data 0x00028000 /*Destination Burst transfer request IS 32 Data */
-#define DMA_DesBst_128Data 0x00030000 /*Destination Burst transfer request IS 128 Data */
-#define DMA_DesBst_256Data 0x00038000 /*Destination Burst transfer request IS 256 Data */
-
-
-
-
-
-#define DMA_SrcWidth_Byte 0x00000000 /* source Width is one Byte */
-#define DMA_SrcWidth_HalfWord 0x00040000 /* source Width is one HalfWord */
-#define DMA_SrcWidth_Word 0x00080000 /* source Width is one Word */
-
-
-
-
-#define DMA_DesWidth_Byte 0x00000000 /* Destination Width is one Byte */
-#define DMA_DesWidth_HalfWord 0x00200000 /* Destination Width is one HalfWord */
-#define DMA_DesWidth_Word 0x00400000 /* Destination Width is one Word */
-
-
-
-
-
-
-/* Exported macro ------------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-
-void DMA_DeInit(void);
-void DMA_Init(DMA_Channel_TypeDef * DMA_Channelx, DMA_InitTypeDef * DMA_InitStruct);
-void DMA_StructInit(DMA_InitTypeDef *DMA_InitStruct);
-void DMA_Cmd(FunctionalState NewState);
-void DMA_ITMaskConfig(DMA_Channel_TypeDef * DMA_Channelx, u16 DMA_ITMask, FunctionalState NewState);
-void DMA_ITConfig(DMA_Channel_TypeDef * DMA_Channelx, FunctionalState NewState);
-FlagStatus DMA_GetChannelStatus(u8 ChannelIndx );
-ITStatus DMA_GetITStatus(u8 ChannelIndx,u8 DMA_ITReq);
-void DMA_ClearIT(u8 ChannelIndx,u8 DMA_ITClr);
-void DMA_SyncConfig(u16 DMA_SrcReq, FunctionalState NewState);
-FlagStatus DMA_GetSReq(u16 DMA_SrcReq);
-FlagStatus DMA_GetLSReq(u16 DMA_SrcReq);
-FlagStatus DMA_GetBReq(u16 DMA_SrcReq);
-FlagStatus DMA_GetLBReq(u16 DMA_SrcReq);
-FlagStatus DMA_GetChannelActiveStatus( DMA_Channel_TypeDef * DMA_Channelx);
-void DMA_SetSReq(u16 DMA_SrcReq);
-void DMA_SetLSReq(u16 DMA_SrcReq);
-void DMA_SetBReq(u16 DMA_SrcReq);
-void DMA_SetLBReq(u16 DMA_SrcReq);
-void DMA_ChannelCmd (DMA_Channel_TypeDef * DMA_Channelx,FunctionalState NewState);
-void DMA_ChannelHalt (DMA_Channel_TypeDef * DMA_Channelx,FunctionalState NewState);
-void DMA_ChannelBuffering (DMA_Channel_TypeDef * DMA_Channelx,FunctionalState NewState);
-void DMA_ChannelLockTrsf(DMA_Channel_TypeDef * DMA_Channelx,FunctionalState NewState);
-void DMA_ChannelCache(DMA_Channel_TypeDef * DMA_Channelx,FunctionalState NewState);
-void DMA_ChannelProt0Mode(DMA_Channel_TypeDef * DMA_Channelx,u32 Prot0Mode);
-void DMA_ChannelSRCIncConfig (DMA_Channel_TypeDef * DMA_Channelx, FunctionalState NewState);
-void DMA_ChannelDESIncConfig (DMA_Channel_TypeDef * DMA_Channelx, FunctionalState NewState);
-
-#endif /* __91x_DMA_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_emi.h b/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_emi.h
deleted file mode 100644
index 4633020..0000000
--- a/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_emi.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_emi.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* EMI software library.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __91x_EMI_H
-#define __91x_EMI_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_map.h"
-
-/* Exported types ------------------------------------------------------------*/
- typedef struct
- {
- u32 EMI_Bank_IDCY;
-
- u32 EMI_Bank_WSTRD;
-
- u32 EMI_Bank_WSTWR;
-
- u32 EMI_Bank_WSTROEN;
-
- u32 EMI_Bank_WSTWEN;
-
- u32 EMI_Bank_MemWidth ;
-
- u32 EMI_Bank_WriteProtection;
-
- u32 EMI_PageModeRead_TransferLength;
-
- u32 EMI_PageModeRead_Selection;
-
- } EMI_InitTypeDef;
-
-/* Exported constants --------------------------------------------------------*/
-
-
-/* page transfer length for page mode read */
-#define EMI_4Data 0x00000000 /*4 transfers burst*/
-#define EMI_8Data 0x00000400 /*8 transfers burst*/
-
-
-/*Select or deselect the page mode read*/
-#define EMI_NormalMode 0x00000000 /*Normal Mode*/
-#define EMI_PageModeRead 0x00000100 /*Page Mode Read*/
-
-
-/*memory width*/
-#define EMI_Width_Byte 0x00000000 /*8 bits width*/
-#define EMI_Width_HalfWord 0x00000010 /*16 bits width*/
-
-/*Write protection feature */
-#define EMI_Bank_NonWriteProtect 0x00000000 /*No write protection*/
-#define EMI_Bank_WriteProtect 0x00000008 /*bank is write protected*/
-
-
-/* Exported macro ------------------------------------------------------------*/
-
-
-/* Exported functions ------------------------------------------------------- */
-
-void EMI_DeInit(void);
-void EMI_Init( EMI_Bank_TypeDef* EMI_Bankx, EMI_InitTypeDef* EMI_InitStruct);
-void EMI_StructInit(EMI_InitTypeDef* EMI_InitStruct);
-
-#endif /* __EMI_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_fmi.h b/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_fmi.h
deleted file mode 100644
index 06e8115..0000000
--- a/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_fmi.h
+++ /dev/null
@@ -1,184 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_fmi.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* FMI software library.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-
-/* Define to prevent recursive inclusion ------------------------------------ */
-
-#ifndef __91x_FMI_H
-#define __91x_FMI_H
-
-/* ========================================================================== */
-/* When bank 1 is remapped at address 0x0, decomment the following line */
-/* ========================================================================== */
-
-//#define Remap_Bank_1
-
-
-/* Includes ------------------------------------------------------------------*/
-
-#include "91x_map.h"
-
-/* Exported types ------------------------------------------------------------*/
-/* Exported constants --------------------------------------------------------*/
-
-/* FMI banks */
-
-#ifdef Remap_Bank_1
-
-#define FMI_BANK_0 ((*(vu32*)0x54000010) << 2) /* FMI Bank 0 */
-#define FMI_BANK_1 ((*(vu32*)0x5400000C) << 2) /* FMI Bank 1 */
-
-#else /* Remap Bank 0 */
-
-#define FMI_BANK_0 ((*(vu32*)0x5400000C) << 2) /* FMI Bank 0 */
-#define FMI_BANK_1 ((*(vu32*)0x54000010) << 2) /* FMI Bank 1 */
-
-#endif
-
-/* FMI sectors */
-
-#define FMI_B0S0 0x00000000 + FMI_BANK_0 /* Bank 0 sector 0 */
-#define FMI_B0S1 0x00010000 + FMI_BANK_0 /* Bank 0 sector 1 */
-#define FMI_B0S2 0x00020000 + FMI_BANK_0 /* Bank 0 sector 2 */
-#define FMI_B0S3 0x00030000 + FMI_BANK_0 /* Bank 0 sector 3 */
-#define FMI_B0S4 0x00040000 + FMI_BANK_0 /* Bank 0 sector 4 */
-#define FMI_B0S5 0x00050000 + FMI_BANK_0 /* Bank 0 sector 5 */
-#define FMI_B0S6 0x00060000 + FMI_BANK_0 /* Bank 0 sector 6 */
-#define FMI_B0S7 0x00070000 + FMI_BANK_0 /* Bank 0 sector 7 */
-
-#define FMI_B1S0 0x00000000 + FMI_BANK_1 /* Bank 1 sector 0 */
-#define FMI_B1S1 0x00002000 + FMI_BANK_1 /* Bank 1 sector 1 */
-#define FMI_B1S2 0x00004000 + FMI_BANK_1 /* Bank 1 sector 2 */
-#define FMI_B1S3 0x00006000 + FMI_BANK_1 /* Bank 1 sector 3 */
-
-/* FMI Flags */
-
-#define FMI_FLAG_SPS 0x02 /* Sector Protection Status Flag */
-#define FMI_FLAG_PSS 0x04 /* Program Suspend Status Flag */
-#define FMI_FLAG_PS 0x10 /* Program Status Flag */
-#define FMI_FLAG_ES 0x20 /* Erase Status Flag */
-#define FMI_FLAG_ESS 0x40 /* Erase Suspend Status Flag */
-#define FMI_FLAG_PECS 0x80 /* FPEC Status Flag */
-
-/* FMI read wait states */
-
-#define FMI_READ_WAIT_STATE_1 0x0000 /* One read wait state */
-#define FMI_READ_WAIT_STATE_2 0x2000 /* Two read wait states */
-#define FMI_READ_WAIT_STATE_3 0x4000 /* Three read wait states */
-
-/* FMI write wait states */
-
-#define FMI_WRITE_WAIT_STATE_0 0xFFFFFEFF /* Zero wait state */
-#define FMI_WRITE_WAIT_STATE_1 0x00000100 /* One wait state */
-
-/* FMI power down configuration */
-
-#define FMI_PWD_ENABLE 0x1000 /* FMI Power Down Enable */
-#define FMI_PWD_DISABLE 0x0000 /* FMI Power Down Disable */
-
-/* FMI low voltage detector */
-
-#define FMI_LVD_ENABLE 0x0000 /* FMI Low Voltage Detector Enable */
-#define FMI_LVD_DISABLE 0x0800 /* FMI Low Voltage Detector Disable */
-
-/* FMI frequency range */
-
-#define FMI_FREQ_LOW 0x0000 /* FMI Low bus working frequency */
-#define FMI_FREQ_HIGH 0x0040 /* FMI High bus working gfrequency */
- /* Above 66 MHz*/
-/* FMI OTP word addresses */
-
-#define FMI_OTP_WORD_0 0x00 /* OTP word 0 */
-#define FMI_OTP_WORD_1 0x04 /* OTP word 1 */
-#define FMI_OTP_WORD_2 0x08 /* OTP word 2 */
-#define FMI_OTP_WORD_3 0x0C /* OTP word 3 */
-#define FMI_OTP_WORD_4 0x10 /* OTP word 4 */
-#define FMI_OTP_WORD_5 0x14 /* OTP word 5 */
-#define FMI_OTP_WORD_6 0x18 /* OTP word 6 */
-#define FMI_OTP_WORD_7 0x1C /* OTP word 7 */
-
-/* FMI OTP halfword addresses */
-
-#define FMI_OTP_LOW_HALFWORD_0 0x00 /* OTP Low halfword 0 */
-#define FMI_OTP_HIGH_HALFWORD_0 0x02 /* OTP High halfword 0 */
-#define FMI_OTP_LOW_HALFWORD_1 0x04 /* OTP Low halfword 1 */
-#define FMI_OTP_HIGH_HALFWORD_1 0x06 /* OTP High halfword 1 */
-#define FMI_OTP_LOW_HALFWORD_2 0x08 /* OTP Low halfword 2 */
-#define FMI_OTP_HIGH_HALFWORD_2 0x0A /* OTP High halfword 2 */
-#define FMI_OTP_LOW_HALFWORD_3 0x0C /* OTP Low halfword 3 */
-#define FMI_OTP_HIGH_HALFWORD_3 0x0E /* OTP High halfword 3 */
-#define FMI_OTP_LOW_HALFWORD_4 0x10 /* OTP Low halfword 4 */
-#define FMI_OTP_HIGH_HALFWORD_4 0x12 /* OTP High halfword 4 */
-#define FMI_OTP_LOW_HALFWORD_5 0x14 /* OTP Low halfword 5 */
-#define FMI_OTP_HIGH_HALFWORD_5 0x16 /* OTP High halfword 5 */
-#define FMI_OTP_LOW_HALFWORD_6 0x18 /* OTP Low halfword 6 */
-#define FMI_OTP_HIGH_HALFWORD_6 0x1A /* OTP High halfword 6 */
-#define FMI_OTP_LOW_HALFWORD_7 0x1C /* OTP Low halfword 7 */
-#define FMI_OTP_HIGH_HALFWORD_7 0x1E /* OTP High halfword 7 */
-
-/* FMI sectors Masks */
-
-#define FMI_B0S0_MASK 0x0001 /* FMI B0S0 mask */
-#define FMI_B0S1_MASK 0x0002 /* FMI B0S1 mask */
-#define FMI_B0S2_MASK 0x0004 /* FMI B0S2 mask */
-#define FMI_B0S3_MASK 0x0008 /* FMI B0S3 mask */
-#define FMI_B0S4_MASK 0x0010 /* FMI B0S4 mask */
-#define FMI_B0S5_MASK 0x0020 /* FMI B0S5 mask */
-#define FMI_B0S6_MASK 0x0040 /* FMI B0S6 mask */
-#define FMI_B0S7_MASK 0x0080 /* FMI B0S7 mask */
-
-#define FMI_B1S0_MASK 0x0100 /* FMI B1S0 mask */
-#define FMI_B1S1_MASK 0x0200 /* FMI B1S1 mask */
-#define FMI_B1S2_MASK 0x0400 /* FMI B1S2 mask */
-#define FMI_B1S3_MASK 0x0800 /* FMI B1S3 mask */
-
-/* Timeout error */
-
-#define FMI_TIME_OUT_ERROR 0x00 /* Timeout error */
-#define FMI_NO_TIME_OUT_ERROR 0x01 /* No Timeout error */
-
-/* Module private variables --------------------------------------------------*/
-/* Exported macro ------------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-
-void FMI_BankRemapConfig(u8 FMI_BootBankSize, u8 FMI_NonBootBankSize, \
- u32 FMI_BootBankAddress, u32 FMI_NonBootBankAddress);
-void FMI_Config(u16 FMI_ReadWaitState, u32 FMI_WriteWaitState, u16 FMI_PWD,\
- u16 FMI_LVDEN, u16 FMI_FreqRange);
-void FMI_EraseSector(vu32 FMI_Sector);
-void FMI_EraseBank(vu32 FMI_Bank);
-void FMI_WriteHalfWord(u32 FMI_Address, u16 FMI_Data);
-void FMI_WriteOTPHalfWord(u8 FMI_OTPHWAddress, u16 FMI_OTPData);
-u32 FMI_ReadWord(u32 FMI_Address);
-u32 FMI_ReadOTPData(u8 FMI_OTPAddress);
-FlagStatus FMI_GetFlagStatus(u8 FMI_Flag, vu32 FMI_Bank);
-u16 FMI_GetReadWaitStateValue(void);
-u16 FMI_GetWriteWaitStateValue(void);
-void FMI_SuspendEnable(vu32 FMI_Bank);
-void FMI_ResumeEnable(vu32 FMI_Bank);
-void FMI_ClearFlag(vu32 FMI_Bank);
-void FMI_WriteProtectionCmd(vu32 FMI_Sector, FunctionalState FMI_NewState);
-FlagStatus FMI_GetWriteProtectionStatus(u32 FMI_Sector_Protection);
-u8 FMI_WaitForLastOperation(vu32 FMI_Bank);
-
-#endif /* __91x_FMI_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
-
diff --git a/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_gpio.h b/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_gpio.h
deleted file mode 100644
index f4e5658..0000000
--- a/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_gpio.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_gpio.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* GPIO software library.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion ------------------------------------ */
-
-#ifndef _91x_GPIO_H
-#define _91x_GPIO_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_map.h"
-
-/* GPIO Init structure definition */
-typedef struct
-{
- u8 GPIO_Pin;
- u8 GPIO_Direction;
- u8 GPIO_Type;
- u8 GPIO_IPConnected;
- u16 GPIO_Alternate;
-}GPIO_InitTypeDef;
-
-/* Bit_SET and Bit_RESET enumeration */
-typedef enum
-{ Bit_RESET = 0,
- Bit_SET
-}BitAction;
-
-
-/* Exported constants --------------------------------------------------------*/
-#define GPIO_Pin_None 0x00
-#define GPIO_Pin_0 0x01
-#define GPIO_Pin_1 0x02
-#define GPIO_Pin_2 0x04
-#define GPIO_Pin_3 0x08
-#define GPIO_Pin_4 0x10
-#define GPIO_Pin_5 0x20
-#define GPIO_Pin_6 0x40
-#define GPIO_Pin_7 0x80
-#define GPIO_Pin_All 0xFF
-
-#define GPIO_PinInput 0x00
-#define GPIO_PinOutput 0x01
-
-#define GPIO_Type_PushPull 0x00
-#define GPIO_Type_OpenCollector 0x01
-
-#define GPIO_IPConnected_Disable 0x00
-#define GPIO_IPConnected_Enable 0x01
-
-#define GPIO_InputAlt1 0x00
-#define GPIO_OutputAlt1 0x01
-#define GPIO_OutputAlt2 0x02
-#define GPIO_OutputAlt3 0x03
-
-#define GPIO_ANAChannel0 0x01
-#define GPIO_ANAChannel1 0x02
-#define GPIO_ANAChannel2 0x04
-#define GPIO_ANAChannel3 0x08
-#define GPIO_ANAChannel4 0x10
-#define GPIO_ANAChannel5 0x20
-#define GPIO_ANAChannel6 0x40
-#define GPIO_ANAChannel7 0x80
-#define GPIO_ANAChannelALL 0xFF
-
-void GPIO_DeInit(GPIO_TypeDef* GPIOx);
-void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct);
-void GPIO_StructInit(GPIO_InitTypeDef* GPIO_InitStruct);
-u8 GPIO_ReadBit(GPIO_TypeDef* GPIOx, u8 GPIO_Pin);
-u8 GPIO_Read(GPIO_TypeDef* GPIOx);
-void GPIO_WriteBit(GPIO_TypeDef* GPIOx, u8 GPIO_Pin, BitAction BitVal);
-void GPIO_Write(GPIO_TypeDef* GPIOx, u8 PortVal);
-void GPIO_EMIConfig(FunctionalState NewState);
-void GPIO_ANAPinConfig(u8 GPIO_ANAChannel, FunctionalState NewState);
-
-#endif /* _91x_GPIO_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_i2c.h b/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_i2c.h
deleted file mode 100644
index f4d0c66..0000000
--- a/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_i2c.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_i2c.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* I2C software library.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion ------------------------------------ */
-#ifndef __91x_I2C_H
-#define __91x_I2C_H
-
-/* Includes ----------------------------------------------------------------- */
-#include "91x_map.h"
-
-/* Exported types ----------------------------------------------------------- */
-/* I2C Init structure definition */
-typedef struct
-{
- u32 I2C_CLKSpeed;
- u16 I2C_OwnAddress;
- u8 I2C_GeneralCall;
- u8 I2C_Ack;
-}I2C_InitTypeDef;
-
-/* Exported constants --------------------------------------------------------*/
-#define I2C_GeneralCall_Enable 0x10
-#define I2C_GeneralCall_Disable 0xEF
-/* Acknowledgement */
-#define I2C_Ack_Enable 0x04
-#define I2C_Ack_Disable 0xFB
-
-/* I2C Flags */
-#define I2C_FLAG_SB 0x0001
-#define I2C_FLAG_M_SL 0x0002
-#define I2C_FLAG_ADSL 0x0004
-#define I2C_FLAG_BTF 0x0008
-#define I2C_FLAG_BUSY 0x0010
-#define I2C_FLAG_TRA 0x0020
-#define I2C_FLAG_ADD10 0x0040
-#define I2C_FLAG_EVF 0x0080
-#define I2C_FLAG_GCAL 0x0100
-#define I2C_FLAG_BERR 0x0200
-#define I2C_FLAG_ARLO 0x0400
-#define I2C_FLAG_STOPF 0x0800
-#define I2C_FLAG_AF 0x1000
-#define I2C_FLAG_ENDAD 0x2000
-#define I2C_FLAG_ACK 0x4000
-
-/* I2C Events */
-#define I2C_EVENT_SLAVE_ADDRESS_MATCHED ( I2C_FLAG_EVF | I2C_FLAG_BUSY | I2C_FLAG_ADSL)
-#define I2C_EVENT_SLAVE_BYTE_RECEIVED ( I2C_FLAG_EVF | I2C_FLAG_BUSY | I2C_FLAG_BTF )
-#define I2C_EVENT_SLAVE_BYTE_TRANSMITTED ( I2C_FLAG_EVF | I2C_FLAG_BUSY | I2C_FLAG_BTF | I2C_FLAG_TRA )
-#define I2C_EVENT_MASTER_MODE_SELECT ( I2C_FLAG_EVF | I2C_FLAG_BUSY | I2C_FLAG_M_SL | I2C_FLAG_SB )
-#define I2C_EVENT_MASTER_MODE_SELECTED ( I2C_FLAG_EVF | I2C_FLAG_BUSY | I2C_FLAG_M_SL | I2C_FLAG_ENDAD )
-#define I2C_EVENT_MASTER_BYTE_RECEIVED ( I2C_FLAG_EVF | I2C_FLAG_BUSY | I2C_FLAG_M_SL | I2C_FLAG_BTF )
-#define I2C_EVENT_MASTER_BYTE_TRANSMITTED ( I2C_FLAG_EVF | I2C_FLAG_BUSY | I2C_FLAG_M_SL | I2C_FLAG_BTF | I2C_FLAG_TRA )
-#define I2C_EVENT_MASTER_MODE_ADDRESS10 ( I2C_FLAG_EVF | I2C_FLAG_BUSY | I2C_FLAG_M_SL |I2C_FLAG_ADD10 )
-#define I2C_EVENT_SLAVE_STOP_DETECTED I2C_FLAG_STOPF
-#define I2C_EVENT_SLAVE_ACK_FAILURE ( I2C_FLAG_EVF | I2C_FLAG_BUSY | I2C_FLAG_BTF | I2C_FLAG_TRA | I2C_FLAG_AF)
-
-#define I2C_BUS_ERROR_DETECTED I2C_FLAG_BERR
-#define I2C_ARBITRATION_LOST I2C_FLAG_ARLO
-#define I2C_SLAVE_GENERAL_CALL (I2C_FLAG_BUSY | I2C_FLAG_GCAL)
-
-/* Master/Receiver Mode */
-#define I2C_MODE_TRANSMITTER 0x00
-#define I2C_MODE_RECEIVER 0x01
-
-/* I2C Registers offset */
-#define I2C_CR 0x00
-#define I2C_SR1 0x04
-#define I2C_SR2 0x08
-#define I2C_CCR 0x0C
-#define I2C_OAR1 0x10
-#define I2C_OAR2 0x14
-#define I2C_DR 0x18
-#define I2C_ECCR 0x1C
-
-/* Exported macro ------------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-void I2C_DeInit(I2C_TypeDef* I2Cx);
-void I2C_Init(I2C_TypeDef* I2Cx, I2C_InitTypeDef* I2C_InitStruct);
-void I2C_StructInit(I2C_InitTypeDef* I2C_InitStruct);
-void I2C_Cmd(I2C_TypeDef* I2Cx, FunctionalState NewState);
-void I2C_GenerateStart(I2C_TypeDef* I2Cx, FunctionalState NewState);
-void I2C_GenerateSTOP(I2C_TypeDef* I2Cx, FunctionalState NewState);
-void I2C_AcknowledgeConfig(I2C_TypeDef *I2Cx, FunctionalState NewState);
-void I2C_ITConfig(I2C_TypeDef *I2Cx, FunctionalState NewState);
-void I2C_Send7bitAddress(I2C_TypeDef* I2Cx, u8 Address, u8 Direction);
-u8 I2C_ReadRegister(I2C_TypeDef* I2Cx, u8 I2C_Register);
-FlagStatus I2C_GetFlagStatus(I2C_TypeDef* I2Cx, u16 I2C_FLAG);
-void I2C_ClearFlag(I2C_TypeDef* I2Cx, u16 I2C_FLAG, ...);
-void I2C_SendData(I2C_TypeDef* I2Cx, u8 bData);
-u8 I2C_ReceiveData(I2C_TypeDef* I2Cx);
-u16 I2C_GetLastEvent(I2C_TypeDef* I2Cx);
-ErrorStatus I2C_CheckEvent(I2C_TypeDef* I2Cx,u16 I2C_Event);
-
-#endif /* __91x_I2C_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_it.h b/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_it.h
deleted file mode 100644
index a8e35fc..0000000
--- a/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_it.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_it.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains the headers of the interrupt
-* handlers'routines
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion ------------------------------------ */
-#ifndef _91x_IT_H
-#define _91x_IT_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_lib.h"
-
-/* Exported types ------------------------------------------------------------*/
-/* Exported constants --------------------------------------------------------*/
-/* Module private variables --------------------------------------------------*/
-/* Exported macro ------------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-void Undefined_Handler (void);
-void SWI_Handler (void);
-void Prefetch_Handler (void);
-void Abort_Handler (void);
-void FIQ_Handler (void);
-void WDG_IRQHandler (void);
-void SW_IRQHandler (void);
-void ARMRX_IRQHandler (void);
-void ARMTX_IRQHandler (void);
-void TIM0_IRQHandler (void);
-void TIM1_IRQHandler (void);
-void TIM2_IRQHandler (void);
-void TIM3_IRQHandler (void);
-void USBHP_IRQHandler (void);
-void USBLP_IRQHandler (void);
-void SCU_IRQHandler (void);
-void ENET_IRQHandler (void);
-void DMA_IRQHandler (void);
-void CAN_IRQHandler (void);
-void MC_IRQHandler (void);
-void ADC_IRQHandler (void);
-void UART0_IRQHandler (void);
-void UART1_IRQHandler (void);
-void UART2_IRQHandler (void);
-void I2C0_IRQHandler (void);
-void I2C1_IRQHandler (void);
-void SSP0_IRQHandler (void);
-void SSP1_IRQHandler (void);
-void LVD_IRQHandler (void);
-void RTC_IRQHandler (void);
-void WIU_IRQHandler (void);
-void EXTIT0_IRQHandler (void);
-void EXTIT1_IRQHandler (void);
-void EXTIT2_IRQHandler (void);
-void EXTIT3_IRQHandler (void);
-void USBWU_IRQHandler (void);
-void PFQBC_IRQHandler (void);
-
-#endif /* _91x_IT_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_lib.h b/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_lib.h
deleted file mode 100644
index 3df7ced..0000000
--- a/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_lib.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_lib.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : Used to include the peripherals header file in the
-* user application.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-#ifndef __91x_LIB_H
-#define __91x_LIB_H
-
-#include "91x_map.h"
-#include "91x_conf.h"
-
-#ifdef _AHBAPB
- #include "91x_ahbapb.h"
-#endif /* _AHBAPB */
-
-#ifdef _EMI
- #include "91x_emi.h"
-#endif /* _EMI */
-
-#ifdef _DMA
- #include "91x_dma.h"
-#endif /* _DMA */
-
-#ifdef _FMI
- #include "91x_fmi.h"
-#endif /* _FMI */
-
-#ifdef _VIC
- #include "91x_vic.h"
-#endif /* _VIC */
-
-#ifdef _WIU
- #include "91x_wiu.h"
-#endif /* _WIU */
-
-#ifdef _TIM
- #include "91x_tim.h"
-#endif /* _TIM */
-
-#ifdef _GPIO
- #include "91x_gpio.h"
-#endif /* _GPIO */
-
-#ifdef _RTC
- #include "91x_rtc.h"
-#endif /* _RTC */
-
-#ifdef _SCU
- #include "91x_scu.h"
-#endif /* _SCU */
-
-#ifdef _UART
- #include "91x_uart.h"
-#endif /* _UART */
-
-#ifdef _SSP
- #include "91x_ssp.h"
-#endif /* _SSP */
-
-#ifdef _CAN
- #include "91x_can.h"
-#endif /* _CAN */
-
-#ifdef _ADC
- #include "91x_adc.h"
-#endif /* _ADC */
-
-#ifdef _WDG
- #include "91x_wdg.h"
-#endif /* _WDG */
-
-#ifdef _I2C
- #include "91x_i2c.h"
-#endif /* _I2C */
-
-#ifdef _WIU
- #include "91x_wiu.h"
-#endif
-
-#ifdef _MC
- #include "91x_mc.h"
-#endif
-
-#ifdef _ENET
-#endif
-
-/* Exported types ------------------------------------------------------------*/
-/* Exported constants --------------------------------------------------------*/
-/* Module private variables --------------------------------------------------*/
-/* Exported macro ------------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-
- void libdebug( void );
-
-
-#endif /* __91x_LIB_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_map.h b/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_map.h
deleted file mode 100644
index 5fe67cf..0000000
--- a/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_map.h
+++ /dev/null
@@ -1,878 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_map.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : Peripherals registers definition and memory mapping.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion ------------------------------------ */
-#ifndef __91x_MAP_H
-#define __91x_MAP_H
-
-#ifndef EXT
- #define EXT extern
-#endif /* EXT */
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_conf.h"
-#include "91x_type.h"
-
-/******************************************************************************/
-/* IP registers structures */
-/******************************************************************************/
-
-/*------------------------------------ FMI -----------------------------------*/
-
-typedef struct
-{
- vu32 BBSR; /* Boot Bank Size Register */
- vu32 NBBSR; /* Non-Boot Bank Size Register */
- vu32 EMPTY1;
- vu32 BBADR; /* Boot Bank Base Address Register */
- vu32 NBBADR; /* Non-Boot Bank Base Address Register */
- vu32 EMPTY2;
- vu32 CR; /* Control Register */
- vu32 SR; /* Status Register */
- vu32 BCE5ADDR; /* BC Fifth Entry Target Address Register */
-} FMI_TypeDef;
-
-/*---------------------- Analog to Digital Convertor ------------------------*/
-
-typedef struct
-{
- vu16 CR; /* Control Register */
- vu16 EMPTY1;
- vu16 CCR; /* Channel Configuration Register */
- vu16 EMPTY2;
- vu16 HTR; /* Higher Threshold Register */
- vu16 EMPTY3;
- vu16 LTR; /* Lower Threshold Register */
- vu16 EMPTY4;
- vu16 CRR; /* Compare Result Register */
- vu16 EMPTY5;
- vu16 DR0; /* Data Register for Channel 0 */
- vu16 EMPTY6;
- vu16 DR1; /* Data Register for Channel 1 */
- vu16 EMPTY7;
- vu16 DR2; /* Data Register for Channel 2 */
- vu16 EMPTY8;
- vu16 DR3; /* Data Register for Channel 3 */
- vu16 EMPTY9;
- vu16 DR4; /* Data Register for Channel 4 */
- vu16 EMPTY10;
- vu16 DR5; /* Data Register for Channel 5 */
- vu16 EMPTY11;
- vu16 DR6; /* Data Register for Channel 6 */
- vu16 EMPTY12;
- vu16 DR7; /* Data Register for Channel 7 */
- vu16 EMPTY13;
- vu16 PRS; /* Prescaler Value Register */
- vu16 EMPTY14;
-} ADC_TypeDef;
-
-/*--------------------- AHB APB BRIDGE registers strcture --------------------*/
-
-typedef struct
-{
- vu32 BSR; /* Bridge Status Register */
- vu32 BCR; /* Bridge Configuration Register */
- vu32 PAER; /* Peripheral Address Error register */
-} AHBAPB_TypeDef;
-
-/*--------------- Controller Area Network Interface Register -----------------*/
-
-typedef struct
-{
- vu16 CRR; /* IFn Command request Register */
- vu16 EMPTY1;
- vu16 CMR; /* IFn Command Mask Register */
- vu16 EMPTY2;
- vu16 M1R; /* IFn Message Mask 1 Register */
- vu16 EMPTY3;
- vu16 M2R; /* IFn Message Mask 2 Register */
- vu16 EMPTY4;
- vu16 A1R; /* IFn Message Arbitration 1 Register */
- vu16 EMPTY5;
- vu16 A2R; /* IFn Message Arbitration 2 Register */
- vu16 EMPTY6;
- vu16 MCR; /* IFn Message Control Register */
- vu16 EMPTY7;
- vu16 DA1R; /* IFn DATA A 1 Register */
- vu16 EMPTY8;
- vu16 DA2R; /* IFn DATA A 2 Register */
- vu16 EMPTY9;
- vu16 DB1R; /* IFn DATA B 1 Register */
- vu16 EMPTY10;
- vu16 DB2R; /* IFn DATA B 2 Register */
- vu16 EMPTY11[27];
-} CAN_MsgObj_TypeDef;
-
-typedef struct
-{
- vu16 CR; /* Control Register */
- vu16 EMPTY1;
- vu16 SR; /* Status Register */
- vu16 EMPTY2;
- vu16 ERR; /* Error counter Register */
- vu16 EMPTY3;
- vu16 BTR; /* Bit Timing Register */
- vu16 EMPTY4;
- vu16 IDR; /* Interrupt Identifier Register */
- vu16 EMPTY5;
- vu16 TESTR; /* Test Register */
- vu16 EMPTY6;
- vu16 BRPR; /* BRP Extension Register */
- vu16 EMPTY7[3];
- CAN_MsgObj_TypeDef sMsgObj[2];
- vu16 EMPTY8[16];
- vu16 TXR1R; /* Transmission request 1 Register */
- vu16 EMPTY9;
- vu16 TXR2R; /* Transmission Request 2 Register */
- vu16 EMPTY10[13];
- vu16 ND1R; /* New Data 1 Register */
- vu16 EMPTY11;
- vu16 ND2R; /* New Data 2 Register */
- vu16 EMPTY12[13];
- vu16 IP1R; /* Interrupt Pending 1 Register */
- vu16 EMPTY13;
- vu16 IP2R; /* Interrupt Pending 2 Register */
- vu16 EMPTY14[13];
- vu16 MV1R; /* Message Valid 1 Register */
- vu16 EMPTY15;
- vu16 MV2R; /* Message VAlid 2 Register */
- vu16 EMPTY16;
-} CAN_TypeDef;
-
-/*----------------------- System Control Unit---------------------------------*/
-
-typedef struct
-{
- vu32 CLKCNTR; /* Clock Control Register */
- vu32 PLLCONF; /* PLL Configuration Register */
- vu32 SYSSTATUS; /* System Status Register */
- vu32 PWRMNG; /* Power Management Register */
- vu32 ITCMSK; /* Interrupt Mask Register */
- vu32 PCGRO; /* Peripheral Clock Gating Register 0 */
- vu32 PCGR1; /* Peripheral Clock Gating Register 1 */
- vu32 PRR0; /* Peripheral Reset Register 0 */
- vu32 PRR1; /* Peripheral Reset Register 1 */
- vu32 MGR0; /* Idle Mode Mask Gating Register 0 */
- vu32 MGR1; /* Idle Mode Mask Gating Register 1 */
- vu32 PECGR0; /* Peripheral Emulation Clock Gating Register 0 */
- vu32 PECGR1; /* Peripheral Emulation Clock Gating Register 1 */
- vu32 SCR0; /* System Configuration Register 0 */
- vu32 SCR1; /* System Configuration Register 1 */
- vu32 SCR2; /* System Configuration Register 2 */
- u32 EMPTY1;
- vu32 GPIOOUT[8]; /* GPIO Output Registers */
- vu32 GPIOIN[8]; /* GPIO Input Registers */
- vu32 GPIOTYPE[10]; /* GPIO Type Registers */
- vu32 GPIOEMI; /* GPIO EMI Selector Register */
- vu32 WKUPSEL; /* Wake-Up Selection Register */
- u32 EMPTY2[2];
- vu32 GPIOANA; /* GPIO Analag mode Register */
-} SCU_TypeDef;
-
-/*------------------------- DMA Channelx Registers ---------------------------*/
-
-typedef struct
-{
- vu32 SRC; /* Channelx Source Address Register */
- vu32 DES; /* Channelx Destination Address Register */
- vu32 LLI; /* Channelx Lincked List Item Register */
- vu32 CC; /* Channelx Contol Register */
- vu32 CCNF; /* Channelx Configuration Register */
-} DMA_Channel_TypeDef;
-
-/* x can be ,0,1,2,3,4,5,6 or 7. There are eight Channels AHB BUS Master */
-
-/*----------------------------- DMA Controller -------------------------------*/
-
-typedef struct
-{
- vu32 ISR; /* Interrupt Status Register */
- vu32 TCISR; /* Terminal Count Interrupt Status Register */
- vu32 TCICR; /* Terminal CountInterrupt Clear Register */
- vu32 EISR; /* Error Interrupt Status Register */
- vu32 EICR; /* Error Interrupt Clear Register */
- vu32 TCRISR; /* Terminal Count Raw Interrupt Status Register */
- vu32 ERISR; /* Raw Error Interrupt Status Register */
- vu32 ENCSR; /* Enabled Channel Status Register */
- vu32 SBRR; /* Software Burst Request Register */
- vu32 SSRR; /* Software Single Request Register */
- vu32 SLBRR; /* Software Last Burst Request Register */
- vu32 SLSRR; /* Software Last Single Request Register */
- vu32 CNFR; /* Configuration Register */
- vu32 SYNR; /* Syncronization Register */
-} DMA_TypeDef;
-
-/*--------------------------------- TIM Timer --------------------------------*/
-
-typedef struct
-{
- vu16 IC1R; /* Input Capture 1 Register */
- vu16 EMPTY1;
- vu16 IC2R; /* Input Capture 2 Register */
- vu16 EMPTY2;
- vu16 OC1R; /* Output Compare 1 Register */
- vu16 EMPTY3;
- vu16 OC2R; /* Output Compare 2 Register */
- vu16 EMPTY4;
- vu16 CNTR; /* Counter Register */
- vu16 EMPTY5;
- vu16 CR1; /* Control Register 1 */
- vu16 EMPTY6;
- vu16 CR2; /* Control Register 2 */
- vu16 EMPTY7;
- vu16 SR; /* Status Register */
- vu16 EMPTY8;
-} TIM_TypeDef;
-
-/*---------------------------- EMI Bankx Registers ---------------------------*/
-
-typedef struct
-{
- vu32 ICR; /* Bankx Idle Cycle Control Register */
- vu32 RCR; /* Bankx Read Wait State Control Register */
- vu32 WCR; /* Bankx Write Wait State Control Register */
- vu32 OECR; /* Bankx Output Enable Assertion Delay Control Register */
- vu32 WECR; /* Bankx Write Enable Assertion Delay Control Register */
- vu32 BCR; /* Bankx Control Register */
- } EMI_Bank_TypeDef;
-
-/*---------------------------- Ethernet Controller ---------------------------*/
-
-/* MAC Registers */
-typedef struct
-{
- vu32 MCR; /* ENET Control Register */
- vu32 MAH; /* ENET Address High Register */
- vu32 MAL; /* ENET Address Low Register */
- vu32 MCHA; /* Multicast Address High Register */
- vu32 MCLA; /* Multicast Address Low Register */
- vu32 MIIA; /* MII Address Register */
- vu32 MIID; /* MII Data Register */
- vu32 MCF; /* ENET Control Frame Register */
- vu32 VL1; /* VLAN1 Register */
- vu32 VL2; /* VLAN2 register */
- vu32 MTS; /* ENET Transmission Status Register */
- vu32 MRS; /* ENET Reception Status Register */
-} ENET_MAC_TypeDef;
-
-/* DMA Registers */
-typedef struct
-{
- vu32 SCR; /* DMA Status and Control Register */
- vu32 IER; /* DMA Interrupt Sources Enable Register */
- vu32 ISR; /* DMA Interrupt Status Register */
- vu32 CCR; /* Clock Control Relation : HCLK, PCLK and
- ENET_CLK phase relations */
- vu32 RXSTR; /* Rx DMA start Register */
- vu32 RXCR; /* Rx DMA Control Register */
- vu32 RXSAR; /* Rx DMA Base Address Register */
- vu32 RXNDAR; /* Rx DMA Next Descriptor Address Register */
- vu32 RXCAR; /* Rx DMA Current Address Register */
- vu32 RXCTCR; /* Rx DMA Current Transfer Count Register */
- vu32 RXTOR; /* Rx DMA FIFO Time Out Register */
- vu32 RXSR; /* Rx DMA FIFO Status Register */
- vu32 TXSTR; /* Tx DMA start Register */
- vu32 TXCR; /* Tx DMA Control Register */
- vu32 TXSAR; /* Tx DMA Base Address Register */
- vu32 TXNDAR; /* Tx DMA Next Descriptor Address Register */
- vu32 TXCAR; /* Tx DMA Current Address Register */
- vu32 TXTCR; /* Tx DMA Current Transfer Count Register */
- vu32 TXTOR; /* Tx DMA FIFO Time Out Register */
- vu32 TXSR; /* Tx DMA FIFO Status Register */
-} ENET_DMA_TypeDef;
-
-/*------------------------------------- GPIO ---------------------------------*/
-
-typedef struct
-{
- vu8 DR[1021]; /* Data Register */
- vu32 DDR; /* Data Direction Register */
-} GPIO_TypeDef;
-
-/*-------------------------------- I2C interface -----------------------------*/
-
-typedef struct
-{
- vu8 CR; /* Control Register */
- vu8 EMPTY1[3];
- vu8 SR1; /* Status Register 1 */
- vu8 EMPTY2[3];
- vu8 SR2; /* Status Register 2 */
- vu8 EMPTY3[3];
- vu8 CCR; /* Clock Control Register */
- vu8 EMPTY4[3];
- vu8 OAR1; /* Own Address Register 1 */
- vu8 EMPTY5[3];
- vu8 OAR2; /* Own Address Register 2 */
- vu8 EMPTY6[3];
- vu8 DR; /* Data Register */
- vu8 EMPTY7[3];
- vu8 ECCR; /* Extended Clock Control Register */
- vu8 EMPTY8[3];
-} I2C_TypeDef;
-
-/*------------------------------------- VIC ----------------------------------*/
-
-typedef struct
-{
- vu32 ISR; /* IRQ Status Register */
- vu32 FSR; /* FIQ Status Register */
- vu32 RINTSR; /* Raw Interrupt Status Register */
- vu32 INTSR; /* Interrupt Select Register */
- vu32 INTER; /* Interrupt Enable Register */
- vu32 INTECR; /* Interrupt Enable Clear Register */
- vu32 SWINTR; /* Software Interrupt Register */
- vu32 SWINTCR; /* Software Interrupt clear Register */
- vu32 PER; /* Protection Enable Register */
- vu32 EMPTY1[3];
- vu32 VAR; /* Vector Address Register */
- vu32 DVAR; /* Default Vector Address Register */
- vu32 EMPTY2[50];
- vu32 VAiR[16]; /* Vector Address 0-15 Register */
- vu32 EMPTY3[48];
- vu32 VCiR[16]; /* Vector Control 0-15 Register */
-} VIC_TypeDef;
-
-/*-------------------------------- Motor Control -----------------------------*/
-
-typedef struct
-{
- vu16 TCPT; /* Tacho Capture Register */
- vu16 EMPTY1;
- vu16 TCMP; /* Tacho Compare Register */
- vu16 EMPTY2;
- vu16 IPR; /* Input Pending Register */
- vu16 EMPTY3;
- vu16 TPRS; /* Tacho Prescaler Register */
- vu16 EMPTY4;
- vu16 CPRS; /* PWM Counter Prescaler Register */
- vu16 EMPTY5;
- vu16 REP; /* Repetition Counter Register */
- vu16 EMPTY6;
- vu16 CMPW; /* Compare Phase W Preload Register */
- vu16 EMPTY7;
- vu16 CMPV; /* Compare Phase V Preload Register */
- vu16 EMPTY8;
- vu16 CMPU; /* Compare Phase U Preload Register */
- vu16 EMPTY9;
- vu16 CMP0; /* Compare 0 Preload Register */
- vu16 EMPTY10;
- vu16 PCR0; /* Peripheral Control Register 0 */
- vu16 EMPTY11;
- vu16 PCR1; /* Peripheral Control Register 1 */
- vu16 EMPTY12;
- vu16 PCR2; /* Peripheral Control Register 2 */
- vu16 EMPTY13;
- vu16 PSR; /* Polarity Selection Register */
- vu16 EMPTY14;
- vu16 OPR; /* Output Peripheral Register */
- vu16 EMPTY15;
- vu16 IMR; /* Interrupt Mask Register */
- vu16 EMPTY16;
- vu16 DTG; /* Dead Time Generator Register */
- vu16 EMPTY17;
- vu16 ESC; /* Emergency Stop Clear Register */
- vu16 EMPTY18;
-}MC_TypeDef;
-
-/*------------------------------------- RTC ----------------------------------*/
-
-typedef struct
-{
- vu32 TR; /* Time Register */
- vu32 DTR; /* Date Register */
- vu32 ATR; /* Alarm time Register */
- vu32 CR; /* Control Register */
- vu32 SR; /* Status Register */
- vu32 MILR; /* Millisec Register */
-}RTC_TypeDef;
-
-/*------------------------------------- SSP ----------------------------------*/
-
-typedef struct
-{
- vu16 CR0; /* Control Register 1 */
- vu16 EMPTY1;
- vu16 CR1; /* Control Register 2 */
- vu16 EMPTY2;
- vu16 DR; /* Data Register */
- vu16 EMPTY3;
- vu16 SR; /* Status Register */
- vu16 EMPTY4;
- vu16 PR; /* Clock Prescale Register */
- vu16 EMPTY5;
- vu16 IMSCR; /* Interrupt Mask Set or Clear Register */
- vu16 EMPTY6;
- vu16 RISR; /* Raw Interrupt Status Register */
- vu16 EMPTY7;
- vu16 MISR; /* Masked Interrupt Status Register */
- vu16 EMPTY8;
- vu16 ICR; /* Interrupt Clear Register */
- vu16 EMPTY9;
- vu16 DMACR; /* DMA Control Register */
- vu16 EMPTY10;
-}SSP_TypeDef;
-
-/*------------------------------------ UART ----------------------------------*/
-
-typedef struct
-{
- vu16 DR; /* Data Register */
- vu16 EMPTY1;
- vu16 RSECR; /* Receive Status Register (read)/Error Clear Register (write) */
- vu16 EMPTY2[9];
- vu16 FR; /* Flag Register */
- vu16 EMPTY3[3];
- vu16 ILPR; /* IrDA Low-Power counter Register */
- vu16 EMPTY4;
- vu16 IBRD; /* Integer Baud Rate Divisor Register */
- vu16 EMPTY5;
- vu16 FBRD; /* Fractional Baud Rate Divisor Register */
- vu16 EMPTY6;
- vu16 LCR; /* Line Control Register, High byte */
- vu16 EMPTY7;
- vu16 CR; /* Control Register */
- vu16 EMPTY8;
- vu16 IFLS; /* Interrupt FIFO Level Select Register */
- vu16 EMPTY9;
- vu16 IMSC; /* Interrupt Mask Set/Clear Register */
- vu16 EMPTY10;
- vu16 RIS; /* Raw Interrupt Status Register */
- vu16 EMPTY11;
- vu16 MIS; /* Masked Interrupt Status Register */
- vu16 EMPTY12;
- vu16 ICR; /* Interrupt Clear Register */
- vu16 EMPTY13;
- vu16 DMACR; /* DMA Control Register */
- vu16 EMPTY14;
-}UART_TypeDef;
-
-/*------------------------------- Wake-up System -----------------------------*/
-
-typedef struct
-{
- vu32 CTRL; /* Control Register */
- vu32 MR; /* Mask Register */
- vu32 TR; /* Trigger Register */
- vu32 PR; /* Pending Register */
- vu32 INTR; /* Software Interrupt Register */
-} WIU_TypeDef;
-
-/*------------------------------- WatchDog Timer -----------------------------*/
-
-typedef struct
-{
- vu16 CR; /* Control Register */
- vu16 EMPTY1;
- vu16 PR; /* Presclar Register */
- vu16 EMPTY2;
- vu16 VR; /* Pre-load Value Register */
- vu16 EMPTY3;
- vu16 CNT; /* Counter Register */
- vu16 EMPTY4;
- vu16 SR; /* Status Register */
- vu16 EMPTY5;
- vu16 MR; /* Mask Register */
- vu16 EMPTY6;
- vu16 KR; /* Key Register */
- vu16 EMPTY7;
-} WDG_TypeDef;
-
-/*******************************************************************************
-* Memory Mapping of STR91x *
-*******************************************************************************/
-
-#define AHB_APB_BRDG0_U (0x58000000) /* AHB/APB Bridge 0 UnBuffered Space */
-#define AHB_APB_BRDG0_B (0x48000000) /* AHB/APB Bridge 0 Buffered Space */
-
-#define AHB_APB_BRDG1_U (0x5C000000) /* AHB/APB Bridge 1 UnBuffered Space */
-#define AHB_APB_BRDG1_B (0x4C000000) /* AHB/APB Bridge 1 Buffered Space */
-
-#define AHB_EMI_U (0x74000000) /* EMI UnBuffered Space */
-#define AHB_EMI_B (0x64000000) /* EMI Buffered Space */
-
-#define AHB_DMA_U (0x78000000) /* DMA UnBuffered Space */
-#define AHB_DMA_B (0x68000000) /* DMA Buffered Space */
-
-#define AHB_ENET_MAC_U (0x7C000400) /* ENET_MAC UnBuffered Space */
-#define AHB_ENET_MAC_B (0x6C000000) /* ENET_MAC Buffered Space */
-
-#define AHB_ENET_DMA_U (0x7C000000) /* ENET_DMA Unbuffered Space */
-#define AHB_ENET_DMA_B (0x6C000400) /* ENET_DMA Buffered Space */
-
-#define AHB_VIC1_U (0xFC000000) /* Secondary VIC1 UnBuffered Space */
-#define AHB_VIC0_U (0xFFFFF000) /* Primary VIC0 UnBuffered Space */
-
-#define AHB_FMI_U (0x54000000) /* FMI Unbuffered Space */
-#define AHB_FMI_B (0x44000000) /* FMI buffered Space */
-
-/*******************************************************************************
-* Addresses related to the VICs' peripherals *
-*******************************************************************************/
-
-#define VIC0_BASE (AHB_VIC0_U)
-#define VIC1_BASE (AHB_VIC1_U)
-
-/*******************************************************************************
-* Addresses related to the EMI banks *
-*******************************************************************************/
-
-#define AHB_EMIB3_OFST (0x00000040) /* Offset of EMI bank3 */
-#define AHB_EMIB2_OFST (0x00000020) /* Offset of EMI bank2 */
-#define AHB_EMIB1_OFST (0x00000000) /* Offset of EMI bank1 */
-#define AHB_EMIB0_OFST (0x000000E0) /* Offset of EMI bank0 */
-
-/*******************************************************************************
-* Addresses related to the DMA peripheral *
-*******************************************************************************/
-
-#define AHB_DMA_Channel0_OFST (0x00000100) /* Offset of Channel 0 */
-#define AHB_DMA_Channel1_OFST (0x00000120) /* Offset of Channel 1 */
-#define AHB_DMA_Channel2_OFST (0x00000140) /* Offset of Channel 2 */
-#define AHB_DMA_Channel3_OFST (0x00000160) /* Offset of Channel 3 */
-#define AHB_DMA_Channel4_OFST (0x00000180) /* Offset of Channel 4 */
-#define AHB_DMA_Channel5_OFST (0x000001A0) /* Offset of Channel 5 */
-#define AHB_DMA_Channel6_OFST (0x000001C0) /* Offset of Channel 6 */
-#define AHB_DMA_Channel7_OFST (0x000001E0) /* Offset of Channel 7 */
-
-/*******************************************************************************
-* Addresses related to the APB0 sub-system *
-*******************************************************************************/
-
-#define APB_WIU_OFST (0x00001000) /* Offset of WIU */
-#define APB_TIM0_OFST (0x00002000) /* Offset of TIM0 */
-#define APB_TIM1_OFST (0x00003000) /* Offset of TIM1 */
-#define APB_TIM2_OFST (0x00004000) /* Offset of TIM2 */
-#define APB_TIM3_OFST (0x00005000) /* Offset of TIM3 */
-#define APB_GPIO0_OFST (0x00006000) /* Offset of GPIO0 */
-#define APB_GPIO1_OFST (0x00007000) /* Offset of GPIO1 */
-#define APB_GPIO2_OFST (0x00008000) /* Offset of GPIO2 */
-#define APB_GPIO3_OFST (0x00009000) /* Offset of GPIO3 */
-#define APB_GPIO4_OFST (0x0000A000) /* Offset of GPIO4 */
-#define APB_GPIO5_OFST (0x0000B000) /* Offset of GPIO5 */
-#define APB_GPIO6_OFST (0x0000C000) /* Offset of GPIO6 */
-#define APB_GPIO7_OFST (0x0000D000) /* Offset of GPIO7 */
-#define APB_GPIO8_OFST (0x0000E000) /* Offset of GPIO8 */
-#define APB_GPIO9_OFST (0x0000F000) /* Offset of GPIO9 */
-
-/*******************************************************************************
-* Addresses related to the APB1 sub-system *
-*******************************************************************************/
-
-#define APB_RTC_OFST (0x00001000) /* Offset of RTC */
-#define APB_SCU_OFST (0x00002000) /* Offset of System Controller */
-#define APB_MC_OFST (0x00003000) /* Offset of Motor Control */
-#define APB_UART0_OFST (0x00004000) /* Offset of UART0 */
-#define APB_UART1_OFST (0x00005000) /* Offset of UART1 */
-#define APB_UART2_OFST (0x00006000) /* Offset of UART2 */
-#define APB_SSP0_OFST (0x00007000) /* Offset of SSP0 */
-#define APB_SSP1_OFST (0x00008000) /* Offset of SSPI */
-#define APB_CAN_OFST (0x00009000) /* Offset of CAN */
-#define APB_ADC_OFST (0x0000A000) /* Offset of ADC */
-#define APB_WDG_OFST (0x0000B000) /* Offset of WDG */
-#define APB_I2C0_OFST (0x0000C000) /* Offset of I2C0 */
-#define APB_I2C1_OFST (0x0000D000) /* Offset of I2C1 */
-
-/*----------------------------------------------------------------------------*/
-/*----------------------------- Unbuffered Mode ------------------------------*/
-/*----------------------------------------------------------------------------*/
-
-#ifndef LIBUFF
-
-/*******************************************************************************
-* AHBAPB peripheral Unbuffered Base Address *
-*******************************************************************************/
-
-#define AHBAPB0_BASE (AHB_APB_BRDG0_U)
-#define AHBAPB1_BASE (AHB_APB_BRDG1_U)
-
-/*******************************************************************************
-* ENET peripheral Unbuffered Base Address *
-*******************************************************************************/
-
-#define ENET_MAC_BASE (AHB_ENET_MAC_U)
-#define ENET_DMA_BASE (AHB_ENET_DMA_U)
-
-/*******************************************************************************
-* DMA peripheral Unbuffered Base Address *
-*******************************************************************************/
-
-#define DMA_BASE (AHB_DMA_U)
-
-/*******************************************************************************
-* EMI peripheral Unbuffered Base Address *
-*******************************************************************************/
-
-#define EMI_BASE (AHB_EMI_U)
-
-/*******************************************************************************
-* FMI peripheral Unbuffered Base Address *
-*******************************************************************************/
-
-#define FMI_BASE (AHB_FMI_U)
-
-
-#else /* LIBUFF */
-
-/*----------------------------------------------------------------------------*/
-/*------------------------------ Buffered Mode -------------------------------*/
-/*----------------------------------------------------------------------------*/
-
-/*******************************************************************************
-* AHBAPB peripheral Buffered Base Address *
-*******************************************************************************/
-
-#define AHBAPB0_BASE (AHB_APB_BRDG0_B)
-#define AHBAPB1_BASE (AHB_APB_BRDG1_B)
-
-/*******************************************************************************
-* ENET peripheral Unbuffered Base Address *
-*******************************************************************************/
-
-#define ENET_MAC_BASE (AHB_ENET_MAC_B)
-#define ENET_DMA_BASE (AHB_ENET_DMA_B)
-
-/*******************************************************************************
-* DMA peripheral Buffered Base Address *
-*******************************************************************************/
-
-#define DMA_BASE (AHB_DMA_B)
-
-/*******************************************************************************
-* EMI peripheral Buffered Base Address *
-*******************************************************************************/
-
-#define EMI_BASE (AHB_EMI_B)
-
-/*******************************************************************************
-* FMI peripheral Buffered Base Address *
-*******************************************************************************/
-
-#define FMI_BASE (AHB_FMI_B)
-
-#endif /* LIBUFF */
-
-/*******************************************************************************
-* DMA channels Base Address *
-*******************************************************************************/
-#define DMA_Channel0_BASE (DMA_BASE + AHB_DMA_Channel0_OFST)
-#define DMA_Channel1_BASE (DMA_BASE + AHB_DMA_Channel1_OFST)
-#define DMA_Channel2_BASE (DMA_BASE + AHB_DMA_Channel2_OFST)
-#define DMA_Channel3_BASE (DMA_BASE + AHB_DMA_Channel3_OFST)
-#define DMA_Channel4_BASE (DMA_BASE + AHB_DMA_Channel4_OFST)
-#define DMA_Channel5_BASE (DMA_BASE + AHB_DMA_Channel5_OFST)
-#define DMA_Channel6_BASE (DMA_BASE + AHB_DMA_Channel6_OFST)
-#define DMA_Channel7_BASE (DMA_BASE + AHB_DMA_Channel7_OFST)
-
-/*******************************************************************************
-* EMI Banks peripheral Base Address *
-*******************************************************************************/
-
-#define EMI_Bank0_BASE (EMI_BASE + AHB_EMIB0_OFST)
-#define EMI_Bank1_BASE (EMI_BASE + AHB_EMIB1_OFST)
-#define EMI_Bank2_BASE (EMI_BASE + AHB_EMIB2_OFST)
-#define EMI_Bank3_BASE (EMI_BASE + AHB_EMIB3_OFST)
-
-/*******************************************************************************
-* APB0 Peripherals' Base addresses *
-*******************************************************************************/
-
-#define WIU_BASE (AHBAPB0_BASE + APB_WIU_OFST)
-#define TIM0_BASE (AHBAPB0_BASE + APB_TIM0_OFST)
-#define TIM1_BASE (AHBAPB0_BASE + APB_TIM1_OFST)
-#define TIM2_BASE (AHBAPB0_BASE + APB_TIM2_OFST)
-#define TIM3_BASE (AHBAPB0_BASE + APB_TIM3_OFST)
-#define GPIO0_BASE (AHBAPB0_BASE + APB_GPIO0_OFST)
-#define GPIO1_BASE (AHBAPB0_BASE + APB_GPIO1_OFST)
-#define GPIO2_BASE (AHBAPB0_BASE + APB_GPIO2_OFST)
-#define GPIO3_BASE (AHBAPB0_BASE + APB_GPIO3_OFST)
-#define GPIO4_BASE (AHBAPB0_BASE + APB_GPIO4_OFST)
-#define GPIO5_BASE (AHBAPB0_BASE + APB_GPIO5_OFST)
-#define GPIO6_BASE (AHBAPB0_BASE + APB_GPIO6_OFST)
-#define GPIO7_BASE (AHBAPB0_BASE + APB_GPIO7_OFST)
-#define GPIO8_BASE (AHBAPB0_BASE + APB_GPIO8_OFST)
-#define GPIO9_BASE (AHBAPB0_BASE + APB_GPIO9_OFST)
-
-/*******************************************************************************
-* APB1 Peripherals' Base addresses *
-*******************************************************************************/
-
-#define RTC_BASE (AHBAPB1_BASE + APB_RTC_OFST)
-#define SCU_BASE (AHBAPB1_BASE + APB_SCU_OFST)
-#define MC_BASE (AHBAPB1_BASE + APB_MC_OFST)
-#define UART0_BASE (AHBAPB1_BASE + APB_UART0_OFST)
-#define UART1_BASE (AHBAPB1_BASE + APB_UART1_OFST)
-#define UART2_BASE (AHBAPB1_BASE + APB_UART2_OFST)
-#define SSP0_BASE (AHBAPB1_BASE + APB_SSP0_OFST)
-#define SSP1_BASE (AHBAPB1_BASE + APB_SSP1_OFST)
-#define CAN_BASE (AHBAPB1_BASE + APB_CAN_OFST)
-#define ADC_BASE (AHBAPB1_BASE + APB_ADC_OFST)
-#define WDG_BASE (AHBAPB1_BASE + APB_WDG_OFST)
-#define I2C0_BASE (AHBAPB1_BASE + APB_I2C0_OFST)
-#define I2C1_BASE (AHBAPB1_BASE + APB_I2C1_OFST)
-
-/*******************************************************************************
-* IPs' declaration *
-*******************************************************************************/
-
-/*------------------------------ Non Debug Mode ------------------------------*/
-
-#ifndef LIBDEBUG
-
-/*********************************** AHBAPB ***********************************/
-
-#define AHBAPB0 ((AHBAPB_TypeDef *)AHBAPB0_BASE)
-#define AHBAPB1 ((AHBAPB_TypeDef *)AHBAPB1_BASE)
-
-/************************************* EMI ************************************/
-
-#define EMI ((EMI_TypeDef *)EMI_BASE)
-
-/************************************* DMA ************************************/
-
-#define DMA ((DMA_TypeDef *)DMA_BASE)
-#define DMA_Channel0 ((DMA_Channel_TypeDef *)DMA_Channel0_BASE)
-#define DMA_Channel1 ((DMA_Channel_TypeDef *)DMA_Channel1_BASE)
-#define DMA_Channel2 ((DMA_Channel_TypeDef *)DMA_Channel2_BASE)
-#define DMA_Channel3 ((DMA_Channel_TypeDef *)DMA_Channel3_BASE)
-#define DMA_Channel4 ((DMA_Channel_TypeDef *)DMA_Channel4_BASE)
-#define DMA_Channel5 ((DMA_Channel_TypeDef *)DMA_Channel5_BASE)
-#define DMA_Channel6 ((DMA_Channel_TypeDef *)DMA_Channel6_BASE)
-#define DMA_Channel7 ((DMA_Channel_TypeDef *)DMA_Channel7_BASE)
-
-/************************************* EMI ************************************/
-
-#define EMI_Bank0 ((EMI_Bank_TypeDef *)EMI_Bank0_BASE)
-#define EMI_Bank1 ((EMI_Bank_TypeDef *)EMI_Bank1_BASE)
-#define EMI_Bank2 ((EMI_Bank_TypeDef *)EMI_Bank2_BASE)
-#define EMI_Bank3 ((EMI_Bank_TypeDef *)EMI_Bank3_BASE)
-
-/************************************* ENET_MAC ************************************/
-
-#define ENET_MAC ((ENET_MAC_TypeDef *)ENET_MAC_BASE)
-
-/************************************* ENET_DMA ************************************/
-
-#define ENET_DMA ((ENET_DMA_TypeDef *)ENET_DMA_BASE)
-
-/************************************* FMI ************************************/
-
-#define FMI ((FMI_TypeDef *)FMI_BASE)
-
-/************************************* VIC ************************************/
-
-#define VIC0 ((VIC_TypeDef *)VIC0_BASE)
-#define VIC1 ((VIC_TypeDef *)VIC1_BASE)
-
-/*******************************************************************************
-* APB0 Peripherals' *
-*******************************************************************************/
-#define WIU ((WIU_TypeDef *)WIU_BASE)
-#define TIM0 ((TIM_TypeDef *)TIM0_BASE)
-#define TIM1 ((TIM_TypeDef *)TIM1_BASE)
-#define TIM2 ((TIM_TypeDef *)TIM2_BASE)
-#define TIM3 ((TIM_TypeDef *)TIM3_BASE)
-#define GPIO0 ((GPIO_TypeDef *)GPIO0_BASE)
-#define GPIO1 ((GPIO_TypeDef *)GPIO1_BASE)
-#define GPIO2 ((GPIO_TypeDef *)GPIO2_BASE)
-#define GPIO3 ((GPIO_TypeDef *)GPIO3_BASE)
-#define GPIO4 ((GPIO_TypeDef *)GPIO4_BASE)
-#define GPIO5 ((GPIO_TypeDef *)GPIO5_BASE)
-#define GPIO6 ((GPIO_TypeDef *)GPIO6_BASE)
-#define GPIO7 ((GPIO_TypeDef *)GPIO7_BASE)
-#define GPIO8 ((GPIO_TypeDef *)GPIO8_BASE)
-#define GPIO9 ((GPIO_TypeDef *)GPIO9_BASE)
-/*******************************************************************************
-* APB1 Peripherals' *
-*******************************************************************************/
-#define RTC ((RTC_TypeDef *)RTC_BASE)
-#define SCU ((SCU_TypeDef *)SCU_BASE)
-#define MC ((MC_TypeDef *)MC_BASE)
-#define UART0 ((UART_TypeDef *)UART0_BASE)
-#define UART1 ((UART_TypeDef *)UART1_BASE)
-#define UART2 ((UART_TypeDef *)UART2_BASE)
-#define SSP0 ((SSP_TypeDef *)SSP0_BASE)
-#define SSP1 ((SSP_TypeDef *)SSP1_BASE)
-#define CAN ((CAN_TypeDef *)CAN_BASE)
-#define ADC ((ADC_TypeDef *)ADC_BASE)
-#define WDG ((WDG_TypeDef *)WDG_BASE)
-#define I2C0 ((I2C_TypeDef *)I2C0_BASE)
-#define I2C1 ((I2C_TypeDef *)I2C1_BASE)
-#define ENET_MAC ((ENET_MAC_TypeDef *)ENET_MAC_BASE)
-#define ENET_DMA ((ENET_DMA_TypeDef *)ENET_DMA_BASE)
-
-#else /* LIBDEBUG */
-
-/*-------------------------------- Debug Mode --------------------------------*/
-
-EXT AHBAPB_TypeDef *AHBAPB0;
-EXT AHBAPB_TypeDef *AHBAPB1;
-EXT DMA_TypeDef *DMA;
-EXT DMA_Channel_TypeDef *DMA_Channel0;
-EXT DMA_Channel_TypeDef *DMA_Channel1;
-EXT DMA_Channel_TypeDef *DMA_Channel2;
-EXT DMA_Channel_TypeDef *DMA_Channel3;
-EXT DMA_Channel_TypeDef *DMA_Channel4;
-EXT DMA_Channel_TypeDef *DMA_Channel5;
-EXT DMA_Channel_TypeDef *DMA_Channel6;
-EXT DMA_Channel_TypeDef *DMA_Channel7;
-EXT EMI_Bank_TypeDef *EMI_Bank0;
-EXT EMI_Bank_TypeDef *EMI_Bank1;
-EXT EMI_Bank_TypeDef *EMI_Bank2;
-EXT EMI_Bank_TypeDef *EMI_Bank3;
-EXT FMI_TypeDef *FMI;
-EXT VIC_TypeDef *VIC0;
-EXT VIC_TypeDef *VIC1;
-EXT WIU_TypeDef *WIU;
-EXT TIM_TypeDef *TIM0;
-EXT TIM_TypeDef *TIM1;
-EXT TIM_TypeDef *TIM2;
-EXT TIM_TypeDef *TIM3;
-EXT GPIO_TypeDef *GPIO0;
-EXT GPIO_TypeDef *GPIO1;
-EXT GPIO_TypeDef *GPIO2;
-EXT GPIO_TypeDef *GPIO3;
-EXT GPIO_TypeDef *GPIO4;
-EXT GPIO_TypeDef *GPIO5;
-EXT GPIO_TypeDef *GPIO6;
-EXT GPIO_TypeDef *GPIO7;
-EXT GPIO_TypeDef *GPIO8;
-EXT GPIO_TypeDef *GPIO9;
-EXT RTC_TypeDef *RTC;
-EXT SCU_TypeDef *SCU;
-EXT MC_TypeDef *MC;
-EXT UART_TypeDef *UART0;
-EXT UART_TypeDef *UART1;
-EXT UART_TypeDef *UART2;
-EXT SSP_TypeDef *SSP0;
-EXT SSP_TypeDef *SSP1;
-EXT CAN_TypeDef *CAN;
-EXT ADC_TypeDef *ADC;
-EXT WDG_TypeDef *WDG;
-EXT I2C_TypeDef *I2C0;
-EXT I2C_TypeDef *I2C1;
-EXT ENET_MAC_TypeDef *ENET_MAC;
-EXT ENET_DMA_TypeDef *ENET_DMA;
-
-
-#endif /* LIBDEBUG */
-
-#endif /* __91x_MAP_H*/
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
-
diff --git a/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_mc.h b/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_mc.h
deleted file mode 100644
index b33b7c3..0000000
--- a/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_mc.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_mc.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* MC software library.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __91x_MC_H
-#define __91x_MC_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_map.h"
-
-/* Exported types ------------------------------------------------------------*/
-typedef struct
-{
- u16 MC_OperatingMode;
- u16 MC_TachoMode;
- u16 MC_TachoEvent_Mode;
- u8 MC_Prescaler;
- u8 MC_ForcedPWMState;
- u16 MC_TachoPrescaler;
- u16 MC_PWMMode;
- u16 MC_Complementary;
- u16 MC_Emergency;
- u16 MC_Period;
- u16 MC_TachoPeriod;
- u16 MC_Channel;
- u16 MC_PulseU;
- u16 MC_PulseV;
- u16 MC_PulseW;
- u16 MC_PolarityUL;
- u16 MC_PolarityUH;
- u16 MC_PolarityVL;
- u16 MC_PolarityVH;
- u16 MC_PolarityWL;
- u16 MC_PolarityWH;
- u16 MC_TachoPolarity;
- u16 MC_DeadTime;
- u8 MC_RepetitionCounter;
-} MC_InitTypeDef;
-
-typedef enum { DOWN = 0, UP = !DOWN} CountingStatus;
-
-/* Exported constants --------------------------------------------------------*/
-#define MC_Complementary_Enable 0x0001
-#define MC_Complementary_Disable 0x0002
-
-#define MC_HardwareOperating_Mode 0x0001
-#define MC_SoftwareOperating_Mode 0x0002
-
-#define MC_PWMClassical_Mode 0x0001
-#define MC_PWMZeroCentered_Mode 0x0002
-
-#define MC_Emergency_Enable 0x0001
-#define MC_Emergency_Disable 0x0002
-
-#define MC_Polarity_Inverted 0x0001
-#define MC_Polarity_NonInverted 0x0002
-
-#define MC_TachoOneShot_Mode 0x0001
-#define MC_TachoContinuous_Mode 0x0002
-
-#define MC_TachoEventEdge_None 0x0000
-#define MC_TachoEventEdge_Falling 0x0001
-#define MC_TachoEventEdge_Rising 0x0002
-#define MC_TachoEventEdge_RisingFalling 0x0003
-
-#define MC_Channel_U 0x0001
-#define MC_Channel_V 0x0002
-#define MC_Channel_W 0x0003
-#define MC_Channel_ALL 0x0004
-
-
-#define MC_TachoEvent_Hardware_Mode 0x0001
-#define MC_TachoEvent_Software_Mode 0x0002
-
-#define MC_IT_CMPW 0x0001
-#define MC_IT_CMPV 0x0002
-#define MC_IT_CMPU 0x0004
-#define MC_IT_ZPC 0x0008
-#define MC_IT_ADT 0x0010
-#define MC_IT_OTC 0x0020
-#define MC_IT_CPT 0x0040
-#define MC_IT_CM0 0x0080
-
-#define MC_FLAG_CMPW 0x0001
-#define MC_FLAG_CMPV 0x0002
-#define MC_FLAG_CMPU 0x0004
-#define MC_FLAG_ZPC 0x0008
-#define MC_FLAG_ADT 0x0010
-#define MC_FLAG_OTC 0x0020
-#define MC_FLAG_CPT 0x0040
-#define MC_FLAG_CM0 0x0080
-#define MC_FLAG_EST 0x0100
-/* Exported macro ------------------------------------------------------------*/
-/* Exported functions --------------------------------------------------------*/
-void MC_Init(MC_InitTypeDef* MC_InitStruct);
-void MC_DeInit(void);
-void MC_StructInit(MC_InitTypeDef* MC_InitStruct);
-void MC_Cmd(FunctionalState NewState);
-void MC_CtrlPWMOutputs(FunctionalState Newstate);
-void MC_ITConfig(u16 MC_IT, FunctionalState NewState);
-void MC_SetPrescaler(u8 Prescaler);
-void MC_SetPeriod(u16 MC_Period);
-void MC_SetPulseU(u16 MC_PulseU);
-void MC_SetPulseV(u16 MC_PulseV);
-void MC_SetPulseW(u16 MC_PulseW);
-void MC_SetTachoCompare(u8 MC_Compare);
-void MC_PWMModeConfig(u16 MC_PWMMode);
-void MC_SetDeadTime(u16 MC_DeadTime);
-void MC_EmergencyCmd(FunctionalState NewState);
-void MC_EmergencyClear(void);
-u16 MC_GetPeriod(void);
-u16 MC_GetPulseU(void);
-u16 MC_GetPulseV(void);
-u16 MC_GetPulseW(void);
-u16 MC_GetTachoCapture(void);
-void MC_ClearOnTachoCapture(FunctionalState NewState);
-void MC_ForceDataTransfer(u8 MC_ForcedData);
-void MC_SoftwarePreloadConfig(void);
-void MC_SoftwareTachoCapture(void);
-CountingStatus MC_GetCountingStatus(void);
-FlagStatus MC_GetFlagStatus(u16 MC_FLAG);
-void MC_ClearFlag(u16 MC_FLAG);
-ITStatus MC_GetITStatus(u16 MC_IT);
-void MC_ClearITPendingBit(u16 MC_IT);
-
-#endif /* __91x_MC_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
-
diff --git a/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_rtc.h b/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_rtc.h
deleted file mode 100644
index 25a2805..0000000
--- a/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_rtc.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_rtc.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides the RTC library software functions
-* prototypes & definitions
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __91x_RTC_H
-#define __91x_RTC_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_map.h"
-
-/* Private typedef -----------------------------------------------------------*/
-typedef struct
-{
- u8 century;
- u8 year;
- u8 month;
- u8 day;
- u8 weekday;
-}RTC_DATE;
-
-typedef struct
-{
- u8 hours;
- u8 minutes;
- u8 seconds;
- u16 milliseconds;
-}RTC_TIME;
-
-typedef struct
-{
- u8 day;
- u8 hours;
- u8 minutes;
- u8 seconds;
-}RTC_ALARM;
-
-/* Exported constants --------------------------------------------------------*/
-
-#define BINARY 0
-#define BCD 1
-
-/*TamperMode*/
-#define RTC_TamperMode_Edge 0xFFFFFFEF
-#define RTC_TamperMode_Level 0x10
-
-/*TamperPol*/
-#define RTC_TamperPol_High 0x4
-#define RTC_TamperPol_Low 0xFFFFFFFB
-
-/*PeriodicClock*/
-#define RTC_Per_2Hz 0x10000
-#define RTC_Per_16Hz 0x20000
-#define RTC_Per_128Hz 0x40000
-#define RTC_Per_1024Hz 0x80000
-#define RTC_Per_DISABLE 0x0
-
-/*RTC_IT*/
-#define RTC_IT_Per 0x200000
-#define RTC_IT_Alarm 0x800000
-#define RTC_IT_Tamper 0x400000
-
-/*RTC_FLAG*/
-#define RTC_FLAG_Per 0x80000000
-#define RTC_FLAG_Alarm 0x40000000
-#define RTC_FLAG_Tamper 0x10000000
-
-
-/* Module private variables --------------------------------------------------*/
-/* Exported macro ------------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-void RTC_DeInit(void);
-void RTC_SetDate(RTC_DATE Date);
-void RTC_SetTime(RTC_TIME Time);
-void RTC_SetAlarm(RTC_ALARM Alarm);
-void RTC_GetDate(u8 Format, RTC_DATE * Date);
-void RTC_GetTime(u8 Format, RTC_TIME * Time);
-void RTC_GetAlarm(u8 Format, RTC_ALARM * Alarm);
-void RTC_TamperConfig(u32 TamperMode, u32 TamperPol);
-void RTC_TamperCmd(FunctionalState NewState);
-void RTC_AlarmCmd(FunctionalState NewState);
-void RTC_CalibClockCmd(FunctionalState NewState);
-void RTC_SRAMBattPowerCmd(FunctionalState NewState);
-void RTC_PeriodicIntConfig(u32 PeriodicClock);
-void RTC_ITConfig(u32 RTC_IT, FunctionalState NewState);
-FlagStatus RTC_GetFlagStatus(u32 RTC_FLAG);
-void RTC_ClearFlag(u32 RTC_FLAG);
-#endif /*__91x_RTC_H*/
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
-
-
-
diff --git a/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_scu.h b/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_scu.h
deleted file mode 100644
index 22d9260..0000000
--- a/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_scu.h
+++ /dev/null
@@ -1,198 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_scu.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides the SCU library software functions
-* prototypes & definitions
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __91x_SCU_H
-#define __91x_SCU_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_map.h"
-
-/* Exported constants --------------------------------------------------------*/
-
-/*MCLK_Source*/
-#define SCU_MCLK_PLL 0x0
-#define SCU_MCLK_RTC 0x1
-#define SCU_MCLK_OSC 0x2
-
-/*RCLK_Divisor*/
-#define SCU_RCLK_Div1 0xFFFFFFE3
-#define SCU_RCLK_Div2 0x4
-#define SCU_RCLK_Div4 0x8
-#define SCU_RCLK_Div8 0xC
-#define SCU_RCLK_Div16 0x10
-#define SCU_RCLK_Div1024 0x14
-
-/*HCLK_Divisor*/
-#define SCU_HCLK_Div1 0xFFFFFF9F
-#define SCU_HCLK_Div2 0x20
-#define SCU_HCLK_Div4 0x40
-
-/*PCLK_Divisor*/
-#define SCU_PCLK_Div1 0xFFFFFE7F
-#define SCU_PCLK_Div2 0x80
-#define SCU_PCLK_Div4 0x100
-#define SCU_PCLK_Div8 0x180
-
-/*FMICLK_Divisor*/
-#define SCU_FMICLK_Div1 0xFFFEFFFF
-#define SCU_FMICLK_Div2 0x10000
-
-/*BRCLK_Divisor*/
-#define SCU_BRCLK_Div1 0xFFFFFDFF
-#define SCU_BRCLK_Div2 0x200
-
-/*TIMCLK_Source*/
-#define SCU_TIMCLK_EXT 0x1
-#define SCU_TIMCLK_INT 0x0
-
-/*TIMx*/
-#define SCU_TIM01 0x0
-#define SCU_TIM23 0x1
-
-
-/*USBCLK_Source*/
-#define SCU_USBCLK_MCLK 0xFFFFF3FF
-#define SCU_USBCLK_MCLK2 0x400
-#define SCU_USBCLK_EXT 0x800
-
-/*SCU_EMIBCLK*/
-#define SCU_EMIBCLK_Div1 0xFFF9FFFF
-#define SCU_EMIBCLK_Div2 0x20000
-
-/*SCU_EMIMODE*/
-#define SCU_EMI_MUX 0xFFFFFFBF
-#define SCU_EMI_DEMUX 0x40
-
-/*SCU_EMIALE_LEN*/
-#define SCU_EMIALE_LEN1 0xFFFFFEFF
-#define SCU_EMIALE_LEN2 0x100
-
-/*SCU_EMIALE_POL*/
-#define SCU_EMIALE_POLLow 0xFFFFFF7F
-#define SCU_EMIALE_POLHigh 0x80
-
-/*UART_IrDA_Mode*/
-#define SCU_UARTMode_IrDA 0x1
-#define SCU_UARTMode_UART 0x0
-
-/*APBPeriph*/
-#define __TIM01 0x1
-#define __TIM23 0x2
-#define __MC 0x4
-#define __UART0 0x8
-#define __UART1 0x10
-#define __UART2 0x20
-#define __I2C0 0x40
-#define __I2C1 0x80
-#define __SSP0 0x100
-#define __SSP1 0x200
-#define __CAN 0x400
-#define __ADC 0x800
-#define __WDG 0x1000
-#define __WIU 0x2000
-#define __GPIO0 0x4000
-#define __GPIO1 0x8000
-#define __GPIO2 0x10000
-#define __GPIO3 0x20000
-#define __GPIO4 0x40000
-#define __GPIO5 0x80000
-#define __GPIO6 0x100000
-#define __GPIO7 0x200000
-#define __GPIO8 0x400000
-#define __GPIO9 0x800000
-#define __RTC 0x1000000
-
-/*AHBPeriph*/
-#define __FMI 0x1
-#define __FPQBC 0x2
-#define __SRAM 0x8
-#define __SRAM_ARBITER 0x10
-#define __VIC 0x20
-#define __EMI 0x40
-#define __EMI_MEM_CLK 0x80
-#define __DMA 0x100
-#define __USB 0x200
-#define __USB48M 0x400
-#define __ENET 0x800
-#define __PFQBC_AHB 0x1000
-
-/*SCU_IT*/
-#define SCU_IT_LVD_RST 0x10
-#define SCU_IT_SRAM_ERROR 0x8
-#define SCU_IT_ACK_PFQBC 0x4
-#define SCU_IT_LOCK_LOST 0x2
-#define SCU_IT_LOCK 0x1
-
-/*SCU_FLAG*/
-#define SCU_FLAG_SRAM_ERROR 0x20
-#define SCU_FLAG_ACK_PFQBC 0x10
-#define SCU_FLAG_LVD_RESET 0x8
-#define SCU_FLAG_WDG_RST 0x4
-#define SCU_FLAG_LOCK_LOST 0x2
-#define SCU_FLAG_LOCK 0x1
-
-
-/* Module private variables --------------------------------------------------*/
-/* Exported macro ------------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-ErrorStatus SCU_MCLKSourceConfig(u32 MCLK_Source);
-ErrorStatus SCU_PLLFactorsConfig(u8 PLLN, u8 PLLM, u8 PLLP);
-ErrorStatus SCU_PLLCmd(FunctionalState NewState);
-void SCU_RCLKDivisorConfig(u32 RCLK_Divisor);
-void SCU_HCLKDivisorConfig(u32 HCLK_Divisor);
-void SCU_PCLKDivisorConfig(u32 PCLK_Divisor);
-void SCU_APBPeriphClockConfig(u32 APBPeriph, FunctionalState NewState);
-void SCU_AHBPeriphClockConfig(u32 AHBPeriph, FunctionalState NewState);
-void SCU_APBPeriphReset(u32 APBPeriph, FunctionalState NewState);
-void SCU_AHBPeriphReset(u32 AHBPeriph, FunctionalState NewState);
-void SCU_APBPeriphIdleConfig(u32 APBPeriph, FunctionalState NewState);
-void SCU_AHBPeriphIdleConfig(u32 AHBPeriph, FunctionalState NewState);
-void SCU_APBPeriphDebugConfig(u32 APBPeriph, FunctionalState NewState);
-void SCU_AHBPeriphDebugConfig(u32 AHBPeriph, FunctionalState NewState);
-void SCU_BRCLKDivisorConfig(u32 BRCLK_Divisor);
-void SCU_TIMCLKSourceConfig(u8 TIMx, u32 TIMCLK_Source);
-void SCU_TIMPresConfig(u8 TIMx, u16 Prescaler);
-void SCU_USBCLKConfig(u32 USBCLK_Source);
-void SCU_PHYCLKConfig(FunctionalState NewState);
-void SCU_FMICLKDivisorConfig(u32 FMICLK_Divisor);
-void SCU_EMIBCLKDivisorConfig(u32 SCU_EMIBCLK);
-void SCU_EMIModeConfig(u32 SCU_EMIMODE);
-void SCU_EMIALEConfig(u32 SCU_EMIALE_LEN, u32 SCU_EMIALE_POL);
-void SCU_ITConfig(u32 SCU_IT, FunctionalState NewState);
-FlagStatus SCU_GetFlagStatus(u32 SCU_Flag);
-void SCU_ClearFlag(u32 SCU_Flag);
-u32 SCU_GetPLLFreqValue(void);
-u32 SCU_GetMCLKFreqValue(void);
-u32 SCU_GetRCLKFreqValue(void);
-u32 SCU_GetHCLKFreqValue(void);
-u32 SCU_GetPCLKFreqValue(void);
-void SCU_WakeUpLineConfig(u8 EXTint);
-void SCU_SpecIntRunModeConfig(FunctionalState NewState);
-void SCU_EnterIdleMode(void);
-void SCU_EnterSleepMode(void);
-void SCU_UARTIrDASelect(UART_TypeDef * UARTx, u8 UART_IrDA_Mode);
-void SCU_PFQBCCmd(FunctionalState NewState);
-
-extern const u32 _Main_Crystal;
-
-#endif /*__91x_SCU_H*/
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_ssp.h b/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_ssp.h
deleted file mode 100644
index e356d4f..0000000
--- a/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_ssp.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_ssp.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* SSP software library.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __91x_SSP_H
-#define __91x_SSP_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_map.h"
-
-/* Exported types ------------------------------------------------------------*/
-/* SSP Init structure definition */
-typedef struct
-{
- u16 SSP_FrameFormat ;
- u16 SSP_Mode ;
- u16 SSP_CPOL ;
- u16 SSP_CPHA ;
- u16 SSP_DataSize ;
- u16 SSP_SlaveOutput ;
- u8 SSP_ClockRate ;
- u8 SSP_ClockPrescaler ;
-}SSP_InitTypeDef;
-
-/* Exported constants --------------------------------------------------------*/
-/* SSP Frame Format Select */
-#define SSP_FrameFormat_TI 0x0010
-#define SSP_FrameFormat_Motorola 0xFFCF
-#define SSP_FrameFormat_Microwire 0x0020
-
-/* SSP Master/Slave Select */
-#define SSP_Mode_Master 0xFFFB
-#define SSP_Mode_Slave 0x0004
-
-/* SSP Clock Polarity */
-#define SSP_CPOL_Low 0xFFBF
-#define SSP_CPOL_High 0x0040
-
-/* SSP Clock Phase */
-#define SSP_CPHA_1Edge 0xFF7F
-#define SSP_CPHA_2Edge 0x0080
-
-/* SSP Data Size */
-#define SSP_DataSize_16b 0x000F
-#define SSP_DataSize_15b 0x000E
-#define SSP_DataSize_14b 0x000D
-#define SSP_DataSize_13b 0x000C
-#define SSP_DataSize_12b 0x000B
-#define SSP_DataSize_11b 0x000A
-#define SSP_DataSize_10b 0x0009
-#define SSP_DataSize_9b 0x0008
-#define SSP_DataSize_8b 0x0007
-#define SSP_DataSize_7b 0x0006
-#define SSP_DataSize_6b 0x0005
-#define SSP_DataSize_5b 0x0004
-#define SSP_DataSize_4b 0x0003
-
-/* SSP Slave output config */
-#define SSP_SlaveOutput_Enable 0xFFF7
-#define SSP_SlaveOutput_Disable 0x0008
-
-/* SSP Interrupts */
-#define SSP_IT_TxFifo 0x0008
-#define SSP_IT_RxFifo 0x0004
-#define SSP_IT_RxTimeOut 0x0002
-#define SSP_IT_RxOverrun 0x0001
-
-/* SSP Flags */
-#define SSP_FLAG_Busy 0x0024
-#define SSP_FLAG_RxFifoFull 0x0023
-#define SSP_FLAG_RxFifoNotEmpty 0x0022
-#define SSP_FLAG_TxFifoNotFull 0x0021
-#define SSP_FLAG_TxFifoEmpty 0x0020
-#define SSP_FLAG_TxFifo 0x0043
-#define SSP_FLAG_RxFifo 0x0042
-#define SSP_FLAG_RxTimeOut 0x0041
-#define SSP_FLAG_RxOverrun 0x0040
-
-/* SSP DMA Requests */
-#define SSP_DMA_Transmit 0x0002
-#define SSP_DMA_Receive 0x0001
-
-/* Exported macro ------------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-
-void SSP_DeInit(SSP_TypeDef* SSPx);
-void SSP_Init(SSP_TypeDef* SSPx, SSP_InitTypeDef* SSP_InitStruct);
-void SSP_StructInit(SSP_InitTypeDef* SSP_InitStruct);
-void SSP_Cmd(SSP_TypeDef* SSPx, FunctionalState NewState);
-void SSP_ITConfig(SSP_TypeDef* SSPx, u16 SSP_IT, FunctionalState NewState);
-void SSP_DMACmd(SSP_TypeDef* SSPx, u16 SSP_DMATransfert, FunctionalState NewState);
-void SSP_SendData(SSP_TypeDef* SSPx, u16 Data);
-u16 SSP_ReceiveData(SSP_TypeDef* SSPx);
-void SSP_LoopBackConfig(SSP_TypeDef* SSPx, FunctionalState NewState);
-FlagStatus SSP_GetFlagStatus(SSP_TypeDef* SSPx, u16 SSP_FLAG);
-void SSP_ClearFlag(SSP_TypeDef* SSPx, u16 SSP_FLAG);
-ITStatus SSP_GetITStatus(SSP_TypeDef* SSPx, u16 SSP_IT);
-void SSP_ClearITPendingBit(SSP_TypeDef* SSPx, u16 SSP_IT);
-
-#endif /* __91x_SSP_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
-
diff --git a/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_tim.h b/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_tim.h
deleted file mode 100644
index b587c27..0000000
--- a/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_tim.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_tim.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* TIM software library.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __91x_TIM_H
-#define __91x_TIM_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_map.h"
-#include "91x_scu.h"
-
-/* Exported types ----------------------------------------------------------- */
-
-/* TIM Init structure define */
-typedef struct
-{
- u16 TIM_Mode; /* Timer mode */
- u16 TIM_OC1_Modes; /* Output Compare 1 Mode: Timing or Wave */
- u16 TIM_OC2_Modes; /* Output Compare 2 Mode: Timing or Wave */
- u16 TIM_Clock_Source; /* Timer Clock source APB/SCU/EXTERNAL */
- u16 TIM_Clock_Edge; /* Timer Clock Edge: Rising or Falling Edge */
- u16 TIM_OPM_INPUT_Edge; /* Timer Input Capture 1 Edge used in OPM Mode */
- u16 TIM_ICAP1_Edge; /* Timer Input Capture 1 Edge used in ICAP1 Mode */
- u16 TIM_ICAP2_Edge; /* Timer Input Capture 2 Edge used in ICAP2 Mode */
- u8 TIM_Prescaler; /* Timer Prescaler factor */
- u16 TIM_Pulse_Level_1; /* Level applied on the Output Compare Pin 1 */
- u16 TIM_Pulse_Level_2; /* Level applied on the Output Compare Pin 2 */
- u16 TIM_Period_Level; /* Level applied during the Period of a PWM Mode */
- u16 TIM_Pulse_Length_1; /* Pulse 1 Length used in Output Compare 1 Mode */
- u16 TIM_Pulse_Length_2; /* Pulse 2 Length used in Output Compare 2 Mode */
- u16 TIM_Full_Period; /* Period Length used in PWM Mode */
-} TIM_InitTypeDef;
-
-typedef enum
-{
- TIM_START,
- TIM_STOP,
- TIM_CLEAR
-} TIM_CounterOperations;
-
-/* Exported constants --------------------------------------------------------*/
-
-/* TIM MODE */
-#define TIM_PWMI 0x4000 /* PWM INPUT Mode */
-#define TIM_OCM_CHANNEL_1 0x0040 /* OUTPUT COMPARE CHANNEL 1 Mode */
-#define TIM_OCM_CHANNEL_2 0x0080 /* OUTPUT COMPARE CHANNEL 2 Mode */
-#define TIM_OCM_CHANNEL_12 0x00C0 /* OUTPUT COMPARE CHANNEL 1 & 2 Mode */
-#define TIM_PWM 0x0010 /* PWM Mode */
-#define TIM_OPM 0x0020 /* ONE PULSE Mode */
-#define TIM_ICAP_CHANNEL_1 0x0400 /* INPUT CAPTURE 1 Mode */
-#define TIM_ICAP_CHANNEL_2 0x0500 /* INPUT CAPTURE 2 Mode */
-#define TIM_ICAP_CHANNEL_12 0x0600 /* INPUT CAPTURE 1 & 2 Mode */
-
-/* TIM OUTPUT COMPARE MODE */
-#define TIM_WAVE 0x0001
-#define TIM_TIMING 0x0002
-
-/* TIM CLOCK SOURCE */
-#define TIM_CLK_APB 0xFFFE
-#define TIM_CLK_EXTERNAL 0x0001
-#define TIM_CLK_SCU 0x0001
-
-/* TIM CLOCK EDGE */
-#define TIM_CLK_EDGE_FALLING 0xFFFD
-#define TIM_CLK_EDGE_RISING 0x0002
-
-/* TIM OPM INPUT EDGE */
-#define TIM_OPM_EDGE_FALLING 0xFFFB
-#define TIM_OPM_EDGE_RISING 0x0004
-
-/* TIM ICAPA INPUT EDGE */
-#define TIM_ICAP1_EDGE_FALLING 0xFFFB
-#define TIM_ICAP1_EDGE_RISING 0x0004
-
-/* TIM ICAPB INPUT EDGE */
-#define TIM_ICAP2_EDGE_FALLING 0xFFF7
-#define TIM_ICAP2_EDGE_RISING 0x0008
-
-/* TIM OUTPUT LEVEL */
-#define TIM_HIGH 0x0200
-#define TIM_LOW 0x0300
-
-/* TIM OUTPUT EDGE */
-#define TIM_OUTPUT_EDGE_RISING 0x8000
-#define TIM_OUTPUT_EDGE_FALLING 0x0800
-
-/* TIM channels */
-#define TIM_PWM_OC1_Channel 0x1 /* PWM/Output Compare 1 Channel */
-#define TIM_OC2_Channel 0x2 /* Output Compare 2 Channel */
-
-/* TIM DMA SOURCE */
-#define TIM_DMA_IC1 0x0000 /* Input Capture Channel 1 DMA Source */
-#define TIM_DMA_OC1 0x1000 /* OUTPUT Compare Channel 1 DMA Source */
-#define TIM_DMA_IC2 0x2000 /* Input Capture Channel 2 DMA Source */
-#define TIM_DMA_OC2 0x3000 /* OUTPUT Compare Channel 2 DMA Source */
-
-/* TIM DMA ENABLE or DISABLE */
-#define TIM_DMA_ENABLE 0x0400 /* DMA Enable */
-#define TIM_DMA_DISABLE 0xFBFF /* DMA Disable */
-
-/* TIM Interruption Sources*/
-#define TIM_IT_IC1 0x8000 /* Input Capture Channel 1 Interrupt Source */
-#define TIM_IT_OC1 0x4000 /* Output Compare Channel 1 Interrupt Source */
-#define TIM_IT_TO 0x2000 /* Timer OverFlow Interrupt Source */
-#define TIM_IT_IC2 0x1000 /* Input Capture Channel 2 Interrupt Source */
-#define TIM_IT_OC2 0x0800 /* Output Compare Channel 2 Interrupt Source */
-
-/* TIM Flags */
-#define TIM_FLAG_IC1 0x8000 /* Input Capture Channel 1 Flag */
-#define TIM_FLAG_OC1 0x4000 /* Output Compare Channel 1 Flag */
-#define TIM_FLAG_TO 0x2000 /* Timer OverFlow Flag */
-#define TIM_FLAG_IC2 0x1000 /* Input Capture Channel 2 Flag */
-#define TIM_FLAG_OC2 0x0800 /* Output Compare Channel 2 Flag */
-
-/* Module private variables --------------------------------------------------*/
-/* Exported macro ------------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-void TIM_Init(TIM_TypeDef *TIMx, TIM_InitTypeDef *TIM_InitStruct);
-void TIM_DeInit(TIM_TypeDef *TIMx);
-void TIM_StructInit(TIM_InitTypeDef *TIM_InitStruct);
-void TIM_CounterCmd(TIM_TypeDef *TIMx, TIM_CounterOperations TIM_operation);
-void TIM_PrescalerConfig(TIM_TypeDef *TIMx, u8 TIM_Prescaler);
-u8 TIM_GetPrescalerValue(TIM_TypeDef *TIMx);
-u16 TIM_GetCounterValue(TIM_TypeDef *TIMx);
-u16 TIM_GetICAP1Value(TIM_TypeDef *TIMx);
-u16 TIM_GetICAP2Value(TIM_TypeDef *TIMx);
-void TIM_SetPulse(TIM_TypeDef *TIMx,u16 TIM_Channel ,u16 TIM_Pulse);
-FlagStatus TIM_GetFlagStatus(TIM_TypeDef *TIMx, u16 TIM_Flag);
-void TIM_ClearFlag(TIM_TypeDef *TIMx, u16 TIM_Flag);
-u16 TIM_GetPWMIPulse(TIM_TypeDef *TIMx);
-u16 TIM_GetPWMIPeriod(TIM_TypeDef *TIMx);
-void TIM_ITConfig(TIM_TypeDef *TIMx, u16 TIM_IT, FunctionalState TIM_Newstate);
-void TIM_DMAConfig(TIM_TypeDef *TIMx, u16 TIM_DMA_Sources);
-void TIM_DMACmd(TIM_TypeDef *TIMx, FunctionalState TIM_Newstate);
-
-#endif /* __91x_TIM_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_type.h b/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_type.h
deleted file mode 100644
index 916d81c..0000000
--- a/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_type.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_type.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : It contains common types and constants used in all the
-* peripherals' drivers.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-**********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*********************************************************************************/
-
-#ifndef __91x_type_H
-#define __91x_type_H
-
- typedef long long u64;
- typedef unsigned long u32;
- typedef unsigned short u16;
- typedef unsigned char u8;
-
- typedef signed long s32;
- typedef signed short s16;
- typedef signed char s8;
-
- typedef volatile unsigned long vu32;
- typedef volatile unsigned short vu16;
- typedef volatile unsigned char vu8;
-
- typedef volatile signed long vs32;
- typedef volatile signed short vs16;
- typedef volatile signed char vs8;
-
-typedef enum { FALSE = 0, TRUE = !FALSE } bool;
-
-typedef enum { RESET = 0, SET = !RESET } FlagStatus, ITStatus;
-
-typedef enum { DISABLE = 0, ENABLE = !DISABLE} FunctionalState;
-
-typedef enum { ERROR = 0, SUCCESS = !ERROR} ErrorStatus;
-
-#endif /* __91x_type_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_uart.h b/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_uart.h
deleted file mode 100644
index b979438..0000000
--- a/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_uart.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_uart.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* UART software library.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __91x_UART_H
-#define __91x_UART_H
-
-/* Includes ------------------------------------------------------------------*/
-#include <91x_map.h>
-
-/* Exported types ------------------------------------------------------------*/
-/* UART FIFO Level enumeration */
-typedef enum
-{
- UART_FIFOLevel_1_8 = 0x0000, /* FIFO size 16 bytes, FIFO level 2 bytes */
- UART_FIFOLevel_1_4 = 0x0001, /* FIFO size 16 bytes, FIFO level 4 bytes */
- UART_FIFOLevel_1_2 = 0x0002, /* FIFO size 16 bytes, FIFO level 8 bytes */
- UART_FIFOLevel_3_4 = 0x0003, /* FIFO size 16 bytes, FIFO level 12 bytes */
- UART_FIFOLevel_7_8 = 0x0004 /* FIFO size 16 bytes, FIFO level 14 bytes */
-}UART_FIFOLevel;
-
-/* UART Init Structure definition */
-typedef struct
-{
- u16 UART_WordLength;
- u16 UART_StopBits;
- u16 UART_Parity;
- u32 UART_BaudRate;
- u16 UART_HardwareFlowControl;
- u16 UART_Mode;
- u16 UART_FIFO;
- UART_FIFOLevel UART_TxFIFOLevel;
- UART_FIFOLevel UART_RxFIFOLevel;
-}UART_InitTypeDef;
-
-
-/* UART RTS enumeration */
-typedef enum
-{
- LowLevel = 0,
- HighLevel
-}UART_LevelTypeDef;
-
-/* Exported constants --------------------------------------------------------*/
-/* UART Data Length */
-#define UART_WordLength_5D 0x0000 /* 5 bits Data */
-#define UART_WordLength_6D 0x0020 /* 6 bits Data */
-#define UART_WordLength_7D 0x0040 /* 7 bits Data */
-#define UART_WordLength_8D 0x0060 /* 8 bits Data */
-
-/* UART Stop Bits */
-#define UART_StopBits_1 0xFFF7 /* Disable two stop bit is transmitted
- at the end of frame */
-#define UART_StopBits_2 0x0008 /* Enable Two stop bits are transmitted
- at the end of frame */
-/* UART Parity */
-#define UART_Parity_No 0x0000 /* Parity Disable */
-#define UART_Parity_Even 0x0006 /* Even Parity */
-#define UART_Parity_Odd 0x0002 /* Odd Parity */
-#define UART_Parity_OddStick 0x0082 /* 1 is transmitted as bit parity */
-#define UART_Parity_EvenStick 0x0086 /* 0 is transmitted as bit parity */
-
-/* UART Hardware Flow Control */
-#define UART_HardwareFlowControl_None 0x0000 /* HFC Disable */
-#define UART_HardwareFlowControl_RTS 0x4000 /* RTS Enable */
-#define UART_HardwareFlowControl_CTS 0x8000 /* CTS Enable */
-#define UART_HardwareFlowControl_RTS_CTS 0xC000 /* CTS and RTS Enable */
-
-/* UART Mode */
-#define UART_Mode_Rx 0x0200 /* UART Rx Enabled */
-#define UART_Mode_Tx 0x0100 /* UART Tx Enbled */
-#define UART_Mode_Tx_Rx 0x0300 /* UART Tx and Rx Enabled */
-
-/* UART FIFO */
-#define UART_FIFO_Disable 0xFFEF /* FIFOs Disable */
-#define UART_FIFO_Enable 0x0010 /* FIFOs Enable */
-
-/* UART Interrupt definition */
-#define UART_IT_OverrunError 0x0400 /* Overrun Error interrupt mask */
-#define UART_IT_BreakError 0x0200 /* Break Error interrupt mask */
-#define UART_IT_ParityError 0x0100 /* Parity Error interrupt mask */
-#define UART_IT_FrameError 0x0080 /* Frame Error interrupt mask */
-#define UART_IT_ReceiveTimeOut 0x0040 /* Receive Time Out interrupt mask */
-#define UART_IT_Transmit 0x0020 /* Transmit interrupt mask */
-#define UART_IT_Receive 0x0010 /* Receive interrupt mask */
-#define UART_IT_DSR 0x0008 /* DSR interrupt mask */
-#define UART_IT_DCD 0x0004 /* DCD interrupt mask */
-#define UART_IT_CTS 0x0002 /* CTS interrupt mask */
-#define UART_IT_RI 0x0001 /* RI interrupt mask */
-
-/* UART DMA On Error */
-#define UART_DMAOnError_Enable 0xFFFB /* DMA receive request enabled
- when the UART error interrupt
- is asserted. */
-#define UART_DMAOnError_Disable 0x0004 /* DMA receive request disabled
- when the UART error interrupt
- is asserted. */
-/* UART DMA Request */
-#define UART_DMAReq_Tx 0x02 /* Transmit DMA Enable */
-#define UART_DMAReq_Rx 0x01 /* Receive DMA Enable */
-
-/* UART FLAG */
-#define UART_FLAG_OverrunError 0x23 /* Overrun error flag */
-#define UART_FLAG_Break 0x22 /* break error flag */
-#define UART_FLAG_ParityError 0x21 /* parity error flag */
-#define UART_FLAG_FrameError 0x20 /* frame error flag */
-#define UART_FLAG_RI 0x48 /* RI flag */
-#define UART_FLAG_TxFIFOEmpty 0x47 /* Transmit FIFO Empty flag */
-#define UART_FLAG_RxFIFOFull 0x46 /* Receive FIFO Full flag */
-#define UART_FLAG_TxFIFOFull 0x45 /* Transmit FIFO Full flag */
-#define UART_FLAG_RxFIFOEmpty 0x44 /* Receive FIFO Empty flag */
-#define UART_FLAG_Busy 0x43 /* UART Busy flag */
-#define UART_FLAG_DCD 0x42 /* DCD flag */
-#define UART_FLAG_DSR 0x41 /* DSR flag */
-#define UART_FLAG_CTS 0x40 /* CTS flag */
-#define UART_RawIT_OverrunError 0x6A /* Overrun Error Raw IT flag */
-#define UART_RawIT_BreakError 0x69 /* Break Error Raw IT flag */
-#define UART_RawIT_ParityError 0x68 /* Parity Error Raw IT flag */
-#define UART_RawIT_FrameError 0x67 /* Frame Error Raw IT flag */
-#define UART_RawIT_ReceiveTimeOut 0x66 /* ReceiveTimeOut Raw IT flag */
-#define UART_RawIT_Transmit 0x65 /* Transmit Raw IT flag */
-#define UART_RawIT_Receive 0x64 /* Receive Raw IT flag */
-#define UART_RawIT_DSR 0x63 /* DSR Raw IT flag */
-#define UART_RawIT_DCD 0x62 /* DCD Raw IT flag */
-#define UART_RawIT_CTS 0x61 /* CTS Raw IT flag */
-#define UART_RawIT_RI 0x60 /* RI Raw IT flag */
-
-/*IrDAx select*/
-#define IrDA0 0x01 /*IrDA0 select*/
-#define IrDA1 0x02 /*IrDA0 select*/
-#define IrDA2 0x03 /*IrDA0 select*/
-
-/* Exported macro ------------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-void UART_DeInit(UART_TypeDef* UARTx);
-void UART_Init(UART_TypeDef* UARTx, UART_InitTypeDef* UART_InitStruct);
-void UART_StructInit(UART_InitTypeDef* UART_InitStruct);
-void UART_Cmd(UART_TypeDef* UARTx, FunctionalState NewState);
-void UART_ITConfig(UART_TypeDef* UARTx, u16 UART_IT, FunctionalState NewState);
-void UART_DMAConfig(UART_TypeDef* UARTx, u16 UART_DMAOnError);
-void UART_DMACmd(UART_TypeDef* UARTx, u8 UART_DMAReq, FunctionalState NewState);
-void UART_LoopBackConfig(UART_TypeDef* UARTx, FunctionalState NewState);
-FlagStatus UART_GetFlagStatus(UART_TypeDef* UARTx, u16 UART_FLAG);
-void UART_ClearFlag(UART_TypeDef* UARTx);
-void UART_ClearITPendingBit(UART_TypeDef* UARTx, u16 UART_IT);
-void UART_IrDALowPowerConfig(u8 IrDAx, FunctionalState NewState);
-void UART_IrDACmd(u8 IrDAx, FunctionalState NewState);
-void UART_IrDASetCounter(u8 IrDAx, u32 IrDA_Counter);
-void UART_SendData(UART_TypeDef* UARTx, u8 Data);
-u8 UART_ReceiveData(UART_TypeDef* UARTx);
-void UART_SendBreak(UART_TypeDef* UARTx);
-void UART_DTRConfig(UART_LevelTypeDef LevelState);
-void UART_RTSConfig(UART_LevelTypeDef LevelState);
-ITStatus UART_GetITStatus(UART_TypeDef* UARTx, u16 UART_IT);
-
-#endif /* __91x_UART_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_vic.h b/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_vic.h
deleted file mode 100644
index 127716a..0000000
--- a/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_vic.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_vic.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* VIC software library.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-
-/* Define to prevent recursive inclusion ------------------------------------ */
-#ifndef __91x_VIC_H
-#define __91x_VIC_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_map.h"
-#include "91x_it.h"
-
-/* Exported types ------------------------------------------------------------*/
-/* Type of interrupt */
-typedef enum
-{
- VIC_IRQ,
- VIC_FIQ
-} VIC_ITLineMode;
-
-/* Exported constants --------------------------------------------------------*/
-
-/* VIC sources*/
-
-#define WDG_ITLine 0
-#define SW_ITLine 1
-#define ARMRX_ITLine 2
-#define ARMTX_ITLine 3
-#define TIM0_ITLine 4
-#define TIM1_ITLine 5
-#define TIM2_ITLine 6
-#define TIM3_ITLine 7
-#define USBHP_ITLine 8
-#define USBLP_ITLine 9
-#define SCU_ITLine 10
-#define ENET_ITLine 11
-#define DMA_ITLine 12
-#define CAN_ITLine 13
-#define MC_ITLine 14
-#define ADC_ITLine 15
-#define UART0_ITLine 16
-#define UART1_ITLine 17
-#define UART2_ITLine 18
-#define I2C0_ITLine 19
-#define I2C1_ITLine 20
-#define SSP0_ITLine 21
-#define SSP1_ITLine 22
-#define LVD_ITLine 23
-#define RTC_ITLine 24
-#define WIU_ITLine 25
-#define EXTIT0_ITLine 26
-#define EXTIT1_ITLine 27
-#define EXTIT2_ITLine 28
-#define EXTIT3_ITLine 29
-#define USBWU_ITLine 30
-#define PFQBC_ITLine 31
-
-
-/* Module private variables --------------------------------------------------*/
-/* Exported macro ------------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-
-void VIC_DeInit(void);
-FlagStatus VIC_GetIRQStatus(u16 VIC_Source);
-FlagStatus VIC_GetFIQStatus(u16 VIC_Source);
-FlagStatus VIC_GetSourceITStatus(u16 VIC_Source);
-void VIC_ITCmd(u16 VIC_Source, FunctionalState VIC_NewState);
-void VIC_SWITCmd(u16 VIC_Source, FunctionalState VIC_NewState);
-void VIC_ProtectionCmd(FunctionalState VIC_NewState);
-u32 VIC_GetCurrentISRAdd(VIC_TypeDef* VICx);
-u32 VIC_GetISRVectAdd(u16 VIC_Source);
-void VIC_Config(u16 VIC_Source, VIC_ITLineMode VIC_LineMode, u8 VIC_Priority);
-
-#endif /* __91x_VIC_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
-
diff --git a/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_wdg.h b/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_wdg.h
deleted file mode 100644
index fc70547..0000000
--- a/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_wdg.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_wdg.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* WDG software library.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __91x_WDG_H
-#define __91x_WDG_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_map.h"
-
-/* Exported types ------------------------------------------------------------*/
-typedef struct
-{
-u16 WDG_Mode;
-u16 WDG_ClockSource;
-u16 WDG_Prescaler;
-u16 WDG_Preload;
-
-} WDG_InitTypeDef;
-
-/* Exported constants --------------------------------------------------------*/
-
-/* WDG_Mode */
-#define WDG_Mode_Wdg 0x0001 /*WDG configured to run in watchdog mode.*/
-#define WDG_Mode_Timer 0xFFFE /*WDG configured to be in Free-running Timer mode.*/
-
-
-/* WDG_ClockSource */
-#define WDG_ClockSource_Rtc 0x0004 /* External clock ( 32 khz RTC clock ) will be used as counting clock.*/
-#define WDG_ClockSource_Apb 0xFFFB /*The APB clock signal will be used as counting clock.*/
-
-/* WDG_Prescaler */
-/*This member must be a number between 0x00 and 0xFF.
-Specifies the Prescaler value to divide the clock source.
-The clock of the Watchdog Timer Counter is divided by " WDG_Prescaler + 1".*/
-
-
-
-/* WDG_Preload */
-/*This member must be a number between 0x0000 and 0xFFFF.
-This value is loaded in the WDG Counter when it starts counting.*/
-
-
-/* WDG Sequence */
-#define WDG_KeyValue1 0xA55A
-#define WDG_KeyValue2 0x5AA5
-
-/* Exported macro ------------------------------------------------------------*/
-
-
-/* Exported functions ------------------------------------------------------- */
-
-void WDG_DeInit(void);
-void WDG_Init(WDG_InitTypeDef* WDG_InitStruct);
-void WDG_StructInit(WDG_InitTypeDef* WDG_InitStruct);
-void WDG_Cmd(FunctionalState NewState);
-void WDG_ITConfig(FunctionalState NewState);
-u16 WDG_GetCounter(void);
-FlagStatus WDG_GetFlagStatus(void);
-void WDG_ClearFlag(void);
-ITStatus WDG_GetITStatus(void);
-void WDG_ClearITPendingBit(void);
-
-#endif /* __WDG_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_wiu.h b/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_wiu.h
deleted file mode 100644
index 8b0349c..0000000
--- a/uc_str912/prj_blinky_simple_startup/str91x_lib/include/91x_wiu.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_wiu.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* WIU software library.
-**********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-**********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*********************************************************************************/
-
-/* Define to prevent recursive inclusion ------------------------------------ */
-#ifndef __91x_WIU_H
-#define __91x_WIU_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_map.h"
-
-/* Exported types ------------------------------------------------------------*/
-/* WIU Init structure type define */
-typedef struct
-{
- u8 WIU_Mode ;
- u8 WIU_TriggerEdge;
- u32 WIU_Line ;
-}WIU_InitTypeDef ;
-
-/* Exported constants --------------------------------------------------------*/
-/* Wake-up line triggering edge */
-#define WIU_FallingEdge 0x00
-#define WIU_RisingEdge 0x01
-
-/* Wake-up unit modes */
-#define WIU_Mode_WakeUp 0x01
-#define WIU_Mode_Interrupt 0x02
-#define WIU_Mode_WakeUpInterrupt 0x03
-#define WIU_Mode_SWInterrupt 0x04
-
-/* Wake-up lines*/
-#define WIU_Line0 0x0001
-#define WIU_Line1 (WIU_Line0<<1)
-#define WIU_Line2 (WIU_Line1<<1)
-#define WIU_Line3 (WIU_Line2<<1)
-#define WIU_Line4 (WIU_Line3<<1)
-#define WIU_Line5 (WIU_Line4<<1)
-#define WIU_Line6 (WIU_Line5<<1)
-#define WIU_Line7 (WIU_Line6<<1)
-#define WIU_Line8 (WIU_Line7<<1)
-#define WIU_Line9 (WIU_Line8<<1)
-#define WIU_Line10 (WIU_Line9<<1)
-#define WIU_Line11 (WIU_Line10<<1)
-#define WIU_Line12 (WIU_Line11<<1)
-#define WIU_Line13 (WIU_Line12<<1)
-#define WIU_Line14 (WIU_Line13<<1)
-#define WIU_Line15 (WIU_Line14<<1)
-#define WIU_Line16 (WIU_Line15<<1)
-#define WIU_Line17 (WIU_Line16<<1)
-#define WIU_Line18 (WIU_Line17<<1)
-#define WIU_Line19 (WIU_Line18<<1)
-#define WIU_Line20 (WIU_Line19<<1)
-#define WIU_Line21 (WIU_Line20<<1)
-#define WIU_Line22 (WIU_Line21<<1)
-#define WIU_Line23 (WIU_Line22<<1)
-#define WIU_Line24 (WIU_Line23<<1)
-#define WIU_Line25 (WIU_Line24<<1)
-#define WIU_Line26 (WIU_Line25<<1)
-#define WIU_Line27 (WIU_Line26<<1)
-#define WIU_Line28 (WIU_Line27<<1)
-#define WIU_Line29 (WIU_Line28<<1)
-#define WIU_Line30 (WIU_Line29<<1)
-#define WIU_Line31 (WIU_Line30<<1)
-
-/* Exported constants --------------------------------------------------------*/
-/* Module private variables --------------------------------------------------*/
-/* Exported macro ------------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-
-void WIU_DeInit(void);
-void WIU_StructInit(WIU_InitTypeDef* WIU_InitStruct);
-void WIU_Init(WIU_InitTypeDef* WIU_InitStruct);
-void WIU_GenerateSWInterrupt(u32 WIU_Line);
-FlagStatus WIU_GetFlagStatus(u32 WIU_Line);
-void WIU_ClearFlag(u32 WIU_Line);
-ITStatus WIU_GetITStatus(u32 WIU_Line);
-void WIU_ClearITPendingBit(u32 WIU_Line);
-
-#endif /* __91x_WIU_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
-
diff --git a/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_adc.c b/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_adc.c
deleted file mode 100644
index a6a07d3..0000000
--- a/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_adc.c
+++ /dev/null
@@ -1,590 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_adc.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the ADC software functions.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-
-/* Standard include ----------------------------------------------------------*/
-#include "91x_adc.h"
-#include "91x_scu.h"
-/* Include of other module interface headers ---------------------------------*/
-/* Local includes ------------------------------------------------------------*/
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-
-/* ADC mask */
-#define ADC_FLAG_MASK 0x001F /* ADC Flag Mask */
-#define ADC_RESULT_MASK 0x03FF /* ADC Result Mask */
-#define ADC_SCAN_MODE_MASK 0x0020 /* ADC Sacn Mode Mask */
-#define ADC_STANDBY_MODE_MASK 0x0008 /* ADC Standby Mode Mask */
-#define ADC_CMD_MASK 0x0002 /* ADC Command Mask */
-#define ADC_CHANNEL_MASK 0xFE3F /* ADC Channel Select Mask */
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/* Interface functions -------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-
-/*******************************************************************************
-* Function Name : ADC_DeInit
-* Description : Deinitialize the ADC module registers to their default reset
-* values
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void ADC_DeInit(void)
-{
- /* Reset the ADC registers values */
- SCU_APBPeriphReset(__ADC,ENABLE);
- SCU_APBPeriphReset(__ADC,DISABLE);
-}
-
-/*******************************************************************************
-* Function Name : ADC_Init
-* Description : Initializes ADC peripheral according to the specified
-* parameters in the ADC_InitTypeDef structure.
-* Input : ADC_InitStruct: pointer to a ADC_InitTypeDef structure that
-* contains the configuration information for the specified
-* ADC peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void ADC_Init(ADC_InitTypeDef* ADC_InitStruct)
-{
- /* Set the low threshold of the watchdog */
- ADC->LTR = ADC_InitStruct->ADC_WDG_Low_Threshold;
-
- /* Set the high threshold of the watchdog */
- ADC->HTR = ADC_InitStruct->ADC_WDG_High_Threshold;
-
-
- /* Channel 0 conversion mode */
- ADC->CCR &= 0xFFFC;
- ADC->CCR |= ADC_InitStruct->ADC_Channel_0_Mode;
-
- /* Channel 1 conversion mode */
- ADC->CCR &= 0xFFF3;
- ADC->CCR |= ADC_InitStruct->ADC_Channel_1_Mode << 0x2;
-
- /* Channel 2 conversion mode */
- ADC->CCR &= 0xFFCF;
- ADC->CCR |= ADC_InitStruct->ADC_Channel_2_Mode << 0x4;
-
- /* Channel 3 conversion mode */
- ADC->CCR &= 0xFF3F;
- ADC->CCR |= ADC_InitStruct->ADC_Channel_3_Mode << 0x6;
-
- /* Channel 4 conversion mode */
- ADC->CCR &= 0xFCFF;
- ADC->CCR |= ADC_InitStruct->ADC_Channel_4_Mode << 0x8;
-
- /* Channel 5 conversion mode */
- ADC->CCR &= 0xF3FF;
- ADC->CCR |= ADC_InitStruct->ADC_Channel_5_Mode << 0xA;
-
- /* Channel 6 conversion mode */
- ADC->CCR &= 0xCFFF;
- ADC->CCR |= ADC_InitStruct->ADC_Channel_6_Mode << 0xC;
-
- /* Channel 7 conversion mode */
- ADC->CCR &= 0x3FFF;
- ADC->CCR |= ADC_InitStruct->ADC_Channel_7_Mode << 0xE;
-
- /* Select the channel to be converted */
- ADC->CR &= ADC_CHANNEL_MASK;
- ADC->CR |= ADC_InitStruct->ADC_Select_Channel << 0x6;
-
- /* Enable/disable the scan mode */
- if (ADC_InitStruct->ADC_Scan_Mode == ENABLE)
- {
- /* Enable the scan mode */
- ADC->CR |= ADC_SCAN_MODE_MASK;
- }
- else
- {
- /* Disable the scan mode */
- ADC->CR &= ~ADC_SCAN_MODE_MASK;
- }
-
- /* Configure the conversion mode */
- if (ADC_InitStruct->ADC_Conversion_Mode == ADC_Continuous_Mode)
- {
- /* ADC continuous mode */
- ADC->CR |= ADC_Continuous_Mode;
- }
- else
- {
- /* ADC single mode */
- ADC->CR &= ADC_Single_Mode;
- }
-}
-
-/*******************************************************************************
-* Function Name : ADC_StructInit
-* Description : Fills each ADC_InitStruct member with its reset value.
-* Input : ADC_InitStruct : pointer to a ADC_InitTypeDef structure
-* which will be initialized.
-* Output : None
-* Return : None.
-*******************************************************************************/
-void ADC_StructInit(ADC_InitTypeDef* ADC_InitStruct)
-{
- ADC_InitStruct->ADC_WDG_High_Threshold = 0x0000;
- ADC_InitStruct->ADC_WDG_Low_Threshold = 0x0000;
- ADC_InitStruct->ADC_Channel_0_Mode = ADC_No_Conversion;
- ADC_InitStruct->ADC_Channel_1_Mode = ADC_No_Conversion;
- ADC_InitStruct->ADC_Channel_2_Mode = ADC_No_Conversion;
- ADC_InitStruct->ADC_Channel_3_Mode = ADC_No_Conversion;
- ADC_InitStruct->ADC_Channel_4_Mode = ADC_No_Conversion;
- ADC_InitStruct->ADC_Channel_5_Mode = ADC_No_Conversion;
- ADC_InitStruct->ADC_Channel_6_Mode = ADC_No_Conversion;
- ADC_InitStruct->ADC_Channel_7_Mode = ADC_No_Conversion;
- ADC_InitStruct->ADC_Select_Channel = ADC_Channel_0;
- ADC_InitStruct->ADC_Scan_Mode = DISABLE;
- ADC_InitStruct->ADC_Conversion_Mode = ADC_Single_Mode;
-}
-
-/*******************************************************************************
-* Function Name : ADC_PrescalerConfig
-* Description : This routine is used to configure the ADC prescaler value.
-* Input : ADC_Prescaler: specifies the prescaler value. This parameter
-* can be a value from 0x0 to 0xFF.
-* Output : None
-* Return : None
-*******************************************************************************/
-void ADC_PrescalerConfig(u8 ADC_Prescaler)
-{
- ADC->PRS &= 0xFF00;
- ADC->PRS |= ADC_Prescaler;
-
-}
-/*******************************************************************************
-* Function Name : ADC_GetPrescalerValue
-* Description : This routine is used to get the ADC prescaler value.
-* Input : None
-* Output : None
-* Return : The prescaler value.
-*******************************************************************************/
-u8 ADC_GetPrescalerValue(void)
-{
- return ADC->PRS & 0x00FF;
-}
-/*******************************************************************************
-* Function Name : ADC_GetFlagStatus
-* Description : Checks whether the specified ADC flag is set or not.
-* Input : ADC_Flag: flag to check.
-* This parameter can be one of the following values:
-* - ADC_FLAG_OV_CH_0: Conversion overflow status for
-* channel 0.
-* - ADC_FLAG_OV_CH_1: Conversion overflow status for
-* channel 1.
-* - ADC_FLAG_OV_CH_2: Conversion overflow status for
-* channel 2.
-* - ADC_FLAG_OV_CH_3: Conversion overflow status for
-* channel 3.
-* - ADC_FLAG_OV_CH_4: Conversion overflow status for
-* channel 4.
-* - ADC_FLAG_OV_CH_5: Conversion overflow status for
-* channel 5.
-* - ADC_FLAG_OV_CH_6: Conversion overflow status for
-* channel 6.
-* - ADC_FLAG_OV_CH_7: Conversion overflow status for
-* channel 7.
-* - ADC_FLAG_ECV: End of conversion status.
-* - ADC_FLAG_AWD: Analog watchdog status.
-* Output : None
-* Return : The NewState of the ADC_Flag (SET or RESET).
-*******************************************************************************/
-FlagStatus ADC_GetFlagStatus(u16 ADC_Flag)
-{
- u8 AdcReg = 0, FlagPos = 0;
-
- /* Get the ADC register index */
- AdcReg = ADC_Flag >> 5;
-
- /* Get the flag position */
- FlagPos = ADC_Flag & ADC_FLAG_MASK;
-
- if(AdcReg == 1) /* The flag to check is in CR register */
- {
- if((ADC->CR & (1<<FlagPos))!= RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
- }
- else if(AdcReg == 6) /* The flag to check is in DR0 register */
- {
- if((ADC->DR0 & (1<<FlagPos))!= RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
- }
- else if(AdcReg == 7) /* The flag to check is in DR1 register */
- {
- if((ADC->DR1 & (1<<FlagPos))!= RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
- }
- else if(AdcReg == 8) /* The flag to check is in DR2 register */
- {
- if((ADC->DR2 & (1<<FlagPos))!= RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
- }
- else if(AdcReg == 9) /* The flag to check is in DR3 register */
- {
- if((ADC->DR3 & (1<<FlagPos))!= RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
- }
-
- else if(AdcReg == 0xA) /* The flag to check is in DR4 register */
- {
- if((ADC->DR4 & (1<<FlagPos))!= RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
- }
- else if(AdcReg == 0xB) /* The flag to check is in DR5 register */
- {
- if((ADC->DR5 & (1<<FlagPos))!= RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
- }
- else if(AdcReg == 0xC) /* The flag to check is in DR6 register */
- {
- if((ADC->DR6 & (1<<FlagPos))!= RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
- }
- else /* (AdcReg == 0xD), The flag to check is in DR7 register */
- {
- if((ADC->DR7 & (1<<FlagPos))!= RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
- }
-}
-
-/*******************************************************************************
-* Function Name : ADC_ClearFlag
-* Description : Clears the ADC Flag passed as a parameter.
-* Input : ADC_Flag: flag to clear.
-* This parameter can be one of the following values:
-* - ADC_FLAG_ECV: End of conversion status.
-* - ADC_FLAG_AWD: Analog watchdog status.
-* Output : None
-* Return : None
-*******************************************************************************/
-void ADC_ClearFlag(u16 ADC_Flag)
-{
- /* Clear the correspondent flag */
- ADC->CR |= (1<<(ADC_Flag & ADC_FLAG_MASK));
-}
-
-/*******************************************************************************
-* Function Name : ADC_GetConversionValue
-* Description : Read the result of conversion from the appropriate data
-* register.
-* Input : ADC_Channel: the correspondent channel of the ADC peripheral.
-* This parameter can be one of the following values:
-* - ADC_Channel_0: ADC channel 0.
-* - ADC_Channel_1: ADC channel 1.
-* - ADC_Channel_2: ADC channel 2.
-* - ADC_Channel_3: ADC channel 3.
-* - ADC_Channel_4: ADC channel 4.
-* - ADC_Channel_5: ADC channel 5.
-* - ADC_Channel_6: ADC channel 6.
-* - ADC_Channel_7: ADC channel 7.
-* Output : None
-* Return : The result of the conversion for the specific channel.
-*******************************************************************************/
-u16 ADC_GetConversionValue(u16 ADC_Channel)
-{
- u16 ADC_Conversion_Value = 0;
-
- switch (ADC_Channel)
- {
- case (ADC_Channel_0):
- /* Get the conversion value of the channel 0 */
- ADC_Conversion_Value = ADC->DR0 & ADC_RESULT_MASK;
- break;
-
- case (ADC_Channel_1):
- /* Get the conversion value of the channel 1 */
- ADC_Conversion_Value = ADC->DR1 & ADC_RESULT_MASK;
- break;
-
- case (ADC_Channel_2):
- /* Get the conversion value of the channel 2 */
- ADC_Conversion_Value = ADC->DR2 & ADC_RESULT_MASK;
- break;
-
- case (ADC_Channel_3):
- /* Get the conversion value of the channel 3 */
- ADC_Conversion_Value = ADC->DR3 & ADC_RESULT_MASK;
- break;
-
- case (ADC_Channel_4):
- /* Get the conversion value of the channel 4 */
- ADC_Conversion_Value = ADC->DR4 & ADC_RESULT_MASK;
- break;
-
- case (ADC_Channel_5):
- /* Get the conversion value of the channel 5 */
- ADC_Conversion_Value = ADC->DR5 & ADC_RESULT_MASK;
- break;
-
- case (ADC_Channel_6):
- /* Get the conversion value of the channel 6 */
- ADC_Conversion_Value = ADC->DR6 & ADC_RESULT_MASK;
- break;
-
- case (ADC_Channel_7):
- /* Get the conversion value of the channel 7 */
- ADC_Conversion_Value = ADC->DR7 & ADC_RESULT_MASK;
- break;
-
- default:
- break;
- }
-
- return(ADC_Conversion_Value);
-}
-
-/*******************************************************************************
-* Function Name : ADC_GetAnalogWatchdogResult
-* Description : Return the result of the comparaison on the selected Analog
-* Watchdog.
-* Input : ADC_Channel: the correspondent channel of the ADC peripheral.
-* This parameter can be one of the following values:
-* - ADC_Channel_0: ADC channel 0.
-* - ADC_Channel_1: ADC channel 1.
-* - ADC_Channel_2: ADC channel 2.
-* - ADC_Channel_3: ADC channel 3.
-* - ADC_Channel_4: ADC channel 4.
-* - ADC_Channel_5: ADC channel 5.
-* - ADC_Channel_6: ADC channel 6.
-* - ADC_Channel_7: ADC channel 7.
-* Output : None
-* Return : The state of the comparision (SET or RESET).
-*******************************************************************************/
-FlagStatus ADC_GetAnalogWatchdogResult(u16 ADC_Channel)
-{
- if (ADC->CRR & (1<<ADC_Channel) != RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : ADC_ClearAnalogWatchdogResult
-* Description : Clear the result of the comparaison on the selected Analog
-* Watchdog.
-* Input : ADC_Channel: the correspondent channel of the ADC peripheral.
-* This parameter can be one of the following values:
-* - ADC_Channel_0: ADC channel 0.
-* - ADC_Channel_1: ADC channel 1.
-* - ADC_Channel_2: ADC channel 2.
-* - ADC_Channel_3: ADC channel 3.
-* - ADC_Channel_4: ADC channel 4.
-* - ADC_Channel_5: ADC channel 5.
-* - ADC_Channel_6: ADC channel 6.
-* - ADC_Channel_7: ADC channel 7.
-* Output : None
-* Return : None
-*******************************************************************************/
-void ADC_ClearAnalogWatchdogResult(u16 ADC_Channel)
-{
- /* Clear the correspondent watchdog result */
- ADC->CRR = 1<<ADC_Channel;
-}
-
-/*******************************************************************************
-* Function Name : ADC_GetWatchdogThreshold
-* Description : Get the higher/lower thresholds values of the watchdog.
-* Input : ADC_Threshold: the lower or the higher threshold.
-* This parameter can be one of the following values:
-* - ADC_HigherThreshold: The higher threshold.
-* - ADC_LowerThreshold: The lower threshold.
-* Output : None
-* Return : The selected threshold value.
-*******************************************************************************/
-u16 ADC_GetWatchdogThreshold(ADC_ThresholdType ADC_Threshold)
-{
- u16 ADC_Threshold_Value = 0;
-
- switch (ADC_Threshold)
- {
- case ADC_LowThreshold:
- /* Get the low threshold of the watchdog */
- ADC_Threshold_Value = ADC->LTR;
- break;
-
- case ADC_HighThreshold:
- /* Get the high threshol of the watchdog */
- ADC_Threshold_Value = ADC->HTR;
- break;
-
- default:
- break;
- }
-
- return(ADC_Threshold_Value);
-}
-
-/*******************************************************************************
-* Function Name : ADC_ITConfig
-* Description : Enables or disables the specified ADC interrupts.
-* Input : - ADC_IT: specifies the ADC interrupts sources to be enabled
-* or disabled.
-* This parameter can be one of the following values:
-* - ADC_IT_EndOfConversion: End of conversion interrupt.
-* - ADC_IT_AnalogWDG: Analog watchdog interrupt.
-* - ADC_NewState: new state of the specified ADC interrupts.
-* (ADC_Newstate can be ENABLE or DISABLE).
-* Output : None
-* Return : None
-*******************************************************************************/
-void ADC_ITConfig(u16 ADC_IT, FunctionalState ADC_NewState)
-{
- if (ADC_NewState == ENABLE)
- {
- /* Enable the interrupt */
- ADC->CR |= ADC_IT;
- }
- else
- {
- /* Disable the interrupt */
- ADC->CR &= ~ADC_IT;
- }
-}
-
-/*******************************************************************************
-* Function Name : ADC_StandbyModeCmd
-* Description : Enable or disable the standby mode.
-* Input : ADC_NewState: new state of the ADC standby mode.
-* (ADC_Newstate can be ENABLE or DISABLE).
-* Output : None
-* Return : None
-*******************************************************************************/
-void ADC_StandbyModeCmd(FunctionalState ADC_NewState)
-{
- if (ADC_NewState == ENABLE)
- {
- /* Enable the standby mode */
- ADC->CR |= ADC_STANDBY_MODE_MASK;
- }
- else
- {
- /* Disable the standby mode */
- ADC->CR &= ~ADC_STANDBY_MODE_MASK;
- }
-}
-
-/*******************************************************************************
-* Function Name : ADC_Cmd
-* Description : Power on or put in reset mode the ADC peripheral.
-* Input : ADC_NewState: new state of the ADC peripheral.
-* (ADC_Newstate can be ENABLE or DISABLE).
-* Output : None
-* Return : None
-*******************************************************************************/
-void ADC_Cmd(FunctionalState ADC_NewState)
-{
- if (ADC_NewState == ENABLE)
- {
- /* Enable the ADC */
- ADC->CR |= ADC_CMD_MASK;
- }
- else
- {
- /* Disable the ADC */
- ADC->CR &= ~ADC_CMD_MASK;
- }
-}
-
-/*******************************************************************************
-* Function Name : ADC_ConversionCmd
-* Description : Start or stop the ADC conversion in the selected mode.
-* Input : ADC_Conversion: the conversion command.
-* This parameter can be one of the following values:
-* - ADC_Conversion_Start: Start the conversion.
-* - ADC_Conversion_Stop: Stop the Conversion.
-* Output : None
-* Return : None
-*******************************************************************************/
-void ADC_ConversionCmd(u16 ADC_Conversion)
-{
- if (ADC_Conversion == ADC_Conversion_Start)
- {
- /* Start the ADC conversion */
- ADC->CR |= ADC_Conversion_Start;
- }
- else
- {
- /* Stop the ADC conversion */
- ADC->CR &= ADC_Conversion_Stop;
- }
-}
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_ahbapb.c b/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_ahbapb.c
deleted file mode 100644
index 41489ac..0000000
--- a/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_ahbapb.c
+++ /dev/null
@@ -1,177 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_ahbapb.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the AHBAPB software functions.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_ahbapb.h"
-
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-#define AHBAPB_SplitCounter_Mask 0xFFE0FFFF
-#define AHBAPB_SetTimeOut_Mask 0xFFFFFFE0
-#define AHBAPB_Address_Mask 0xFEFFFFFF
-#define AHBAPB_FLAG_RW_Mask 0x01000000
-/*******************************************************************************
-* Function Name : AHBAPB_DeInit
-* Description : Deinitializes the AHBAPBx peripheral registers to their default
-* reset values.
-* Input : AHBAPBx: where x can be 0 or 1 to select the AHBAPB peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void AHBAPB_DeInit(AHBAPB_TypeDef* AHBAPBx)
-{
- AHBAPBx->BCR = 0x00000000;
- AHBAPBx->BSR = 0x00000000;
-}
-/*******************************************************************************
-* Function Name : AHBAPB_Init
-* Description : Initializes the AHBAPBx peripheral according to the specified
-* parameters in the AHBAPB_InitStruct .
-* Input :- AHBAPBx: where x can be 0 or 1 to select the AHBAPB peripheral.
-* - AHBAPB_InitStruct: pointer to a AHBAPB_InitTypeDef structure that
-* contains the configuration information for the specified AHBAPB
-* peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void AHBAPB_Init(AHBAPB_TypeDef* AHBAPBx, AHBAPB_InitTypeDef* AHBAPB_InitStruct)
-{
-
- if(AHBAPB_InitStruct->AHBAPB_Split == AHBAPB_Split_Enable)
- {
- /* Set SPLITEN bit;*/
- AHBAPBx->BCR |= AHBAPB_Split_Enable;
- /*Split_CNT bits[20:16]*/
- AHBAPBx->BCR &= AHBAPB_SplitCounter_Mask;
- AHBAPBx->BCR |= (AHBAPB_InitStruct->AHBAPB_SplitCounter)<<16;
- }
- else
- {
- /*/ Clear SPLITEN bit;*/
- AHBAPBx->BCR &= AHBAPB_Split_Disable;
- }
- /*APB Time out*/
- if(AHBAPB_InitStruct->AHBAPB_Error == AHBAPB_Error_Enable)
- {
- /* Set ERREN bit*/
- AHBAPBx->BCR |= AHBAPB_Error_Enable;
- /*Time ouit counter*/
- AHBAPBx->BCR &= AHBAPB_SetTimeOut_Mask;
- AHBAPBx->BCR |= AHBAPB_InitStruct->AHBAPB_SetTimeOut;
- }
- else
- {
- /* Clear ERREN bit*/
- AHBAPBx->BCR &= AHBAPB_Error_Disable;
- }
-}
-
-/*******************************************************************************
-* Function Name : AHBAPB_StructInit
-* Description : Initialize the AHBAPB Init Structure parameters
-* Input : AHBAPB_InitStruct : pointer to a AHBAPB_InitTypeDef structure
-* which will be initialized.
-* Output : None
-* Return : None
-*******************************************************************************/
-void AHBAPB_StructInit(AHBAPB_InitTypeDef* AHBAPB_InitStruct)
-{
- /* Reset AHBAPB init structure parameters values */
- AHBAPB_InitStruct->AHBAPB_Split = AHBAPB_Split_Enable;
- AHBAPB_InitStruct->AHBAPB_SplitCounter = 0xFF;
- AHBAPB_InitStruct->AHBAPB_Error = AHBAPB_Error_Enable;
- AHBAPB_InitStruct->AHBAPB_SetTimeOut = 0xFF;
-
-}
-
-/*******************************************************************************
-* Function Name : AHBAPB_GetFlagStatus
-* Description : Checks whether the specified AHBAPB flag is set or not.
-* Input : - AHBAPB: where x can be 0 or 1 to select the AHBAPB peripheral
-* - AHBAPB_FLAG: specifies the flag to check.
-* This parameter can be one of the following values:
-* - AHBAPB_FLAG_ERROR: error flag
-* - AHBAPB_FLAG_OUTM : Out of Memory flag
-* - AHBAPB_FLAG_APBT : APB Time-out flag
-* - AHBAPB_FLAG_RW : Access type flag
-* Output : None
-* Return : The new state of AHBAPB_FLAG (SET or RESET).
-*******************************************************************************/
-FlagStatus AHBAPB_GetFlagStatus(AHBAPB_TypeDef* AHBAPBx, u8 AHBAPB_FLAG)
-{
- if(AHBAPB_FLAG == AHBAPB_FLAG_RW)
- {
- if ((AHBAPBx->PAER & AHBAPB_FLAG_RW_Mask) == RESET)
- {
- return RESET;
- }
- else
- {
- return SET;
- }
- }
- else
- {
- if ((AHBAPBx->BSR & AHBAPB_FLAG) == RESET)
- {
- return RESET;
- }
- else
- {
- return SET;
- }
- }
-}
-/*******************************************************************************
-* Function Name : AHBAPB_ClearFlag
-* Description : Clears the AHBAPBx flags.
-* Input : - AHBAPB: where x can be 0 or 1 to select the AHBAPB peripheral
-* - AHBAPB_FLAG: flags to clear. This parameter one of the
-* following values:
-* - AHBAPB_FLAG_ERROR: error flag
-* - AHBAPB_FLAG_OUTM : Out of Memory flag
-* - AHBAPB_FLAG_APBT : APB Time-out flag
-* Output : None
-* Return : None
-*******************************************************************************/
-void AHBAPB_ClearFlag(AHBAPB_TypeDef* AHBAPBx, u8 AHBAPB_FLAG)
-{
- /* Clear the flag */
- AHBAPBx->BSR &= AHBAPB_FLAG;
-}
-/*******************************************************************************
-* Function Name : AHBAPB_GetPeriphAddrError
-* Description : Gets the AHBAPB error address peripherals.
-* Input : - AHBAPB: where x can be 0 or 1 to select the AHBAPB peripheral
-* Output : None
-* Return : The Peropheral address error
-*******************************************************************************/
-u32 AHBAPB_GetPeriphAddrError(AHBAPB_TypeDef* AHBAPBx)
-{
- u32 AHBAPB_Address = 0x00000000;
-
- /*Return Oeripheral address without RW bit*/
- AHBAPB_Address = (AHBAPBx->PAER)& AHBAPB_Address_Mask;
- return (AHBAPB_Address);
-}
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_can.c b/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_can.c
deleted file mode 100644
index e560d03..0000000
--- a/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_can.c
+++ /dev/null
@@ -1,768 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_can.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the CAN software functions.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_can.h"
-#include "91x_scu.h"
-
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-/* Private macro -------------------------------------------------------------*/
-/*----------------------------------------------------------------------------*/
-/* Macro Name : xxx_ID_MSK, xxx_ID_ARB */
-/* Description : Form the Mask and Arbitration registers value to filter */
-/* a range of identifiers or a fixed identifier, for standard*/
-/* and extended IDs */
-/*----------------------------------------------------------------------------*/
-#define RANGE_ID_MSK(range_start, range_end) (~((range_end) - (range_start)))
-#define RANGE_ID_ARB(range_start, range_end) ((range_start) & (range_end))
-
-#define FIXED_ID_MSK(id) RANGE_ID_MSK((id), (id))
-#define FIXED_ID_ARB(id) RANGE_ID_ARB((id), (id))
-
-#define STD_RANGE_ID_MSK(range_start, range_end) ((u16)((RANGE_ID_MSK((range_start), (range_end)) & 0x7FF) << 2))
-#define STD_RANGE_ID_ARB(range_start, range_end) ((u16)(RANGE_ID_ARB((range_start), (range_end)) << 2))
-
-#define STD_FIXED_ID_MSK(id) ((u16)((FIXED_ID_MSK(id) & 0x7FF) << 2))
-#define STD_FIXED_ID_ARB(id) ((u16)(FIXED_ID_ARB(id) << 2))
-
-#define EXT_RANGE_ID_MSK_L(range_start, range_end) ((u16)(RANGE_ID_MSK((range_start), (range_end)) >> 11))
-#define EXT_RANGE_ID_MSK_H(range_start, range_end) ((u16)(STD_RANGE_ID_MSK((range_start), (range_end)) | ((RANGE_ID_MSK((range_start), (range_end)) >> 27) & 0x03)))
-#define EXT_RANGE_ID_ARB_L(range_start, range_end) ((u16)(RANGE_ID_ARB((range_start), (range_end)) >> 11))
-#define EXT_RANGE_ID_ARB_H(range_start, range_end) ((u16)(STD_RANGE_ID_ARB((range_start), (range_end)) | ((RANGE_ID_ARB((range_start), (range_end)) >> 27) & 0x03)))
-
-#define EXT_FIXED_ID_MSK_L(id) ((u16)(FIXED_ID_MSK(id) >> 11))
-#define EXT_FIXED_ID_MSK_H(id) ((u16)(STD_FIXED_ID_MSK(id) | ((FIXED_ID_MSK(id) >> 27) & 0x03)))
-#define EXT_FIXED_ID_ARB_L(id) ((u16)(FIXED_ID_ARB(id) >> 11))
-#define EXT_FIXED_ID_ARB_H(id) ((u16)(STD_FIXED_ID_ARB(id) | ((FIXED_ID_ARB(id) >> 27) & 0x03)))
-
-/* macro to format the timing register value from the timing parameters*/
-#define CAN_TIMING(tseg1, tseg2, sjw, brp) ((((tseg2-1) & 0x07) << 12) | (((tseg1-1) & 0x0F) << 8) | (((sjw-1) & 0x03) << 6) | ((brp-1) & 0x3F))
-
-/* Private variables ---------------------------------------------------------*/
-/* array of pre-defined timing parameters for standard bitrates*/
-u16 CanTimings[] = { /* value bitrate NTQ TSEG1 TSEG2 SJW BRP */
- CAN_TIMING(11, 4, 4, 5), /* 0x3AC4 100 kbit/s 16 11 4 4 5 */
- CAN_TIMING(11, 4, 4, 4), /* 0x3AC3 125 kbit/s 16 11 4 4 4 */
- CAN_TIMING( 4, 3, 3, 4), /* 0x2383 250 kbit/s 8 4 3 3 4 */
- CAN_TIMING(13, 2, 1, 1), /* 0x1C00 500 kbit/s 16 13 2 1 1 */
- CAN_TIMING( 4, 3, 1, 1), /* 0x2300 1 Mbit/s 8 4 3 1 1 */
-};
-
-/* Private function prototypes -----------------------------------------------*/
-static u32 GetFreeIF(void);
-/* Private functions ---------------------------------------------------------*/
-
-/*******************************************************************************
-* Function Name : CAN_DeInit
-* Description : Deinitializes the CAN peripheral registers to their default
-* reset values.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void CAN_DeInit (void)
-{
- /* Reset the CAN registers values*/
-
- SCU_APBPeriphReset(__CAN,ENABLE); /*CAN peripheral is under Reset */
- SCU_APBPeriphReset(__CAN,DISABLE); /*CAN peripheral Reset off*/
-
-
-}
-
-/*******************************************************************************
-* Function Name : CAN_Init
-* Description : Initializes the CAN peripheral according to the specified
-* parameters in the CAN_InitStruct.
-* Input : CAN_InitStruct: pointer to a CAN_InitTypeDef structure that
-* contains the configuration information for the CAN peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void CAN_Init(CAN_InitTypeDef* CAN_InitStruct)
-{
- CAN_EnterInitMode(CAN_CR_CCE | CAN_InitStruct->CAN_ConfigParameters);
- CAN_SetBitrate(CAN_InitStruct->CAN_Bitrate);
- CAN_LeaveInitMode();
- CAN_LeaveTestMode();
-}
-
-/*******************************************************************************
-* Function Name : CAN_StructInit
-* Description : Fills each CAN_InitStruct member with its reset value.
-* Input : CAN_InitStruct : pointer to a CAN_InitTypeDef structure which
-* will be initialized.
-* Output : None
-* Return : None.
-*******************************************************************************/
-void CAN_StructInit(CAN_InitTypeDef* CAN_InitStruct)
-{
-/* Reset CAN init structure parameters values */
- CAN_InitStruct->CAN_ConfigParameters = 0x0;
- CAN_InitStruct->CAN_Bitrate = 0x2301;
-}
-
-/*******************************************************************************
-* Function Name : CAN_SetBitrate
-* Description : Setups a standard CAN bitrate.
-* Input : bitrate: specifies the bit rate.
-* Output : None
-* Return : None
-*******************************************************************************/
-void CAN_SetBitrate(u32 bitrate)
-{
- CAN->BTR = CanTimings[bitrate]; /* write the predefined timing value */
- CAN->BRPR = 0; /* clear the Extended Baud Rate Prescaler */
-}
-
-/*******************************************************************************
-* Function Name : CAN_SetTiming
-* Description : Setups the CAN timing with specific parameters
-* Input : - tseg1: specifies Time Segment before the sample point.
-* This parameter must be a number between 1 and 16.
-* - tseg2: Time Segment after the sample point. This parameter
-* must be a number between 1 and 8.
-* - sjw: Synchronisation Jump Width. This parameter must be
-* a number between 1 and 4.
-* - brp: Baud Rate Prescaler. This parameter must be a number
-* between 1 and 1024.
-* Output : None
-* Return : None
-*******************************************************************************/
-void CAN_SetTiming(u32 tseg1, u32 tseg2, u32 sjw, u32 brp)
-{
- CAN->BTR = CAN_TIMING(tseg1, tseg2, sjw, brp);
- CAN->BRPR = ((brp-1) >> 6) & 0x0F;
-}
-
-/*******************************************************************************
-* Function Name : GetFreeIF
-* Description : Searchs the first free message interface, starting from 0.
-* Input : None
-* Output : None
-* Return : A free message interface number (0 or 1) if found, else 2
-*******************************************************************************/
-static u32 GetFreeIF(void)
-{
- if ((CAN->sMsgObj[0].CRR & CAN_CRR_BUSY) == 0)
- return 0;
- else if ((CAN->sMsgObj[1].CRR & CAN_CRR_BUSY) == 0)
- return 1;
- else
- return 2;
-}
-
-/*******************************************************************************
-* Function Name : CAN_SetUnusedMsgObj
-* Description : Configures the message object as unused
-* Input : msgobj: specifies the Message object number, from 0 to 31.
-* Output : None
-* Return : An ErrorStatus enumuration value:
-* - SUCCESS: Interface to treat the message
-* - ERROR: No interface to treat the message
-*******************************************************************************/
-ErrorStatus CAN_SetUnusedMsgObj(u32 msgobj)
-{
- u32 msg_if=0;
-
- if ((msg_if = GetFreeIF()) == 2)
- {
- return ERROR;
- }
-
- CAN->sMsgObj[msg_if].CMR = CAN_CMR_WRRD
- | CAN_CMR_MASK
- | CAN_CMR_ARB
- | CAN_CMR_CONTROL
- | CAN_CMR_DATAA
- | CAN_CMR_DATAB;
-
- CAN->sMsgObj[msg_if].M1R = 0;
- CAN->sMsgObj[msg_if].M2R = 0;
-
- CAN->sMsgObj[msg_if].A1R = 0;
- CAN->sMsgObj[msg_if].A2R = 0;
-
- CAN->sMsgObj[msg_if].MCR = 0;
-
- CAN->sMsgObj[msg_if].DA1R = 0;
- CAN->sMsgObj[msg_if].DA2R = 0;
- CAN->sMsgObj[msg_if].DB1R = 0;
- CAN->sMsgObj[msg_if].DB2R = 0;
-
- CAN->sMsgObj[msg_if].CRR = 1 + msgobj;
-
- return SUCCESS;
-}
-
-/*******************************************************************************
-* Function Name : CAN_SetTxMsgObj
-* Description : Configures the message object as TX.
-* Input : - msgobj: specifies the Message object number, from 0 to 31.
-* - idType: specifies the identifier type of the frames that
-* will be transmitted using this message object.
-* This parameter can be one of the following values:
-* - CAN_STD_ID (standard ID, 11-bit)
-* - CAN_EXT_ID (extended ID, 29-bit)
-* Output : None
-* Return : An ErrorStatus enumuration value:
-* - SUCCESS: Interface to treat the message
-* - ERROR: No interface to treat the message
-*******************************************************************************/
-ErrorStatus CAN_SetTxMsgObj(u32 msgobj, u32 idType)
-{
- u32 msg_if=0;
-
- if ((msg_if = GetFreeIF()) == 2)
- {
- return ERROR;
- }
-
- CAN->sMsgObj[msg_if].CMR = CAN_CMR_WRRD
- | CAN_CMR_MASK
- | CAN_CMR_ARB
- | CAN_CMR_CONTROL
- | CAN_CMR_DATAA
- | CAN_CMR_DATAB;
-
- CAN->sMsgObj[msg_if].M1R = 0;
- CAN->sMsgObj[msg_if].A1R = 0;
-
- if (idType == CAN_STD_ID)
- {
- CAN->sMsgObj[msg_if].M2R = CAN_M2R_MDIR;
- CAN->sMsgObj[msg_if].A2R = CAN_A2R_MSGVAL | CAN_A2R_DIR;
- }
- else
- {
- CAN->sMsgObj[msg_if].M2R = CAN_M2R_MDIR | CAN_M2R_MXTD;
- CAN->sMsgObj[msg_if].A2R = CAN_A2R_MSGVAL | CAN_A2R_DIR | CAN_A2R_XTD;
- }
-
- CAN->sMsgObj[msg_if].MCR = CAN_MCR_TXIE | CAN_MCR_EOB;
-
- CAN->sMsgObj[msg_if].DA1R = 0;
- CAN->sMsgObj[msg_if].DA2R = 0;
- CAN->sMsgObj[msg_if].DB1R = 0;
- CAN->sMsgObj[msg_if].DB2R = 0;
-
- CAN->sMsgObj[msg_if].CRR = 1 + msgobj;
-
- return SUCCESS;
-}
-
-/*******************************************************************************
-* Function Name : CAN_SetRxMsgObj
-* Description : Configures the message object as RX.
-* Input : - msgobj: specifies the Message object number, from 0 to 31.
-* - idType: specifies the identifier type of the frames that
-* will be transmitted using this message object.
-* This parameter can be one of the following values:
-* - CAN_STD_ID (standard ID, 11-bit)
-* - CAN_EXT_ID (extended ID, 29-bit)
-* - idLow: specifies the low part of the identifier range used
-* for acceptance filtering.
-* - idHigh: specifies the high part of the identifier range
-* used for acceptance filtering.
-* - singleOrFifoLast: specifies the end-of-buffer indicator.
-* This parameter can be one of the following values:
-* - TRUE: for a single receive object or a FIFO receive
-* object that is the last one of the FIFO.
-* - FALSE: for a FIFO receive object that is not the
-* last one.
-* Output : None
-* Return : An ErrorStatus enumuration value:
-* - SUCCESS: Interface to treat the message
-* - ERROR: No interface to treat the message
-*******************************************************************************/
-ErrorStatus CAN_SetRxMsgObj(u32 msgobj, u32 idType, u32 idLow, u32 idHigh, bool singleOrFifoLast)
-{
- u32 msg_if=0;
-
- if ((msg_if = GetFreeIF()) == 2)
- {
- return ERROR;
- }
-
- CAN->sMsgObj[msg_if].CMR = CAN_CMR_WRRD
- | CAN_CMR_MASK
- | CAN_CMR_ARB
- | CAN_CMR_CONTROL
- | CAN_CMR_DATAA
- | CAN_CMR_DATAB;
-
- if (idType == CAN_STD_ID)
- {
- CAN->sMsgObj[msg_if].M1R = 0;
- CAN->sMsgObj[msg_if].M2R = STD_RANGE_ID_MSK(idLow, idHigh);
-
- CAN->sMsgObj[msg_if].A1R = 0;
- CAN->sMsgObj[msg_if].A2R = CAN_A2R_MSGVAL | STD_RANGE_ID_ARB(idLow, idHigh);
- }
- else
- {
- CAN->sMsgObj[msg_if].M1R = EXT_RANGE_ID_MSK_L(idLow, idHigh);
- CAN->sMsgObj[msg_if].M2R = CAN_M2R_MXTD | EXT_RANGE_ID_MSK_H(idLow, idHigh);
-
- CAN->sMsgObj[msg_if].A1R = EXT_RANGE_ID_ARB_L(idLow, idHigh);
- CAN->sMsgObj[msg_if].A2R = CAN_A2R_MSGVAL | CAN_A2R_XTD | EXT_RANGE_ID_ARB_H(idLow, idHigh);
- }
-
- CAN->sMsgObj[msg_if].MCR = CAN_MCR_RXIE | CAN_MCR_UMASK | (singleOrFifoLast ? CAN_MCR_EOB : 0);
-
- CAN->sMsgObj[msg_if].DA1R = 0;
- CAN->sMsgObj[msg_if].DA2R = 0;
- CAN->sMsgObj[msg_if].DB1R = 0;
- CAN->sMsgObj[msg_if].DB2R = 0;
-
- CAN->sMsgObj[msg_if].CRR = 1 + msgobj;
-
- return SUCCESS;
-}
-
-/*******************************************************************************
-* Function Name : CAN_InvalidateAllMsgObj
-* Description : Configures all the message objects as unused.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void CAN_InvalidateAllMsgObj(void)
-{
- u32 i=0;
- for (i = 0; i < 32; i++)
- CAN_SetUnusedMsgObj(i);
-}
-
-
-/*******************************************************************************
-* Function Name : CAN_ReleaseMessage
-* Description : Releases the message object
-* Input : - msgobj: specifies the Message object number, from 0 to 31.
-* Output : None
-* Return : An ErrorStatus enumuration value:
-* - SUCCESS: Interface to treat the message
-* - ERROR: No interface to treat the message
-*******************************************************************************/
-ErrorStatus CAN_ReleaseMessage(u32 msgobj)
-{
- u32 msg_if=0;
-
- if ((msg_if = GetFreeIF()) == 2)
- {
- return ERROR;
- }
-
- CAN->sMsgObj[msg_if].CMR = CAN_CMR_CLRINTPND | CAN_CMR_TXRQSTNEWDAT;
- CAN->sMsgObj[msg_if].CRR = 1 + msgobj;
-
- return SUCCESS;
-}
-
-/*******************************************************************************
-* Function Name : CAN_SendMessage
-* Description : Start transmission of a message
-* Input : - msgobj: specifies the Message object number, from 0 to 31.
-* : - pCanMsg: pointer to the message structure containing data
-* to transmit.
-* Output : None
-* Return : An ErrorStatus enumuration value:
-* - SUCCESS: Transmission OK
-* - ERROR: No transmission
-*******************************************************************************/
-ErrorStatus CAN_SendMessage(u32 msgobj, canmsg* pCanMsg)
-{
- if (CAN->sMsgObj[0].CRR & CAN_CRR_BUSY)
- {
- return ERROR;
- }
-
- CAN->SR &= ~CAN_SR_TXOK;
-
- /* read the Arbitration and Message Control*/
- CAN->sMsgObj[0].CMR = CAN_CMR_ARB | CAN_CMR_CONTROL;
-
- CAN->sMsgObj[0].CRR = 1 + msgobj;
-
- if (CAN->sMsgObj[0].CRR & CAN_CRR_BUSY)
- {
- return ERROR;
- }
-
- /* update the contents needed for transmission*/
- CAN->sMsgObj[0].CMR = CAN_CMR_WRRD
- | CAN_CMR_ARB
- | CAN_CMR_CONTROL
- | CAN_CMR_DATAA
- | CAN_CMR_DATAB;
-
- if ((CAN->sMsgObj[0].A2R & CAN_A2R_XTD) == 0)
- {
- /* standard ID*/
- CAN->sMsgObj[0].A1R = 0;
- CAN->sMsgObj[0].A2R = (CAN->sMsgObj[0].A2R & 0xE000) | STD_FIXED_ID_ARB(pCanMsg->Id);
- }
- else
- {
- /* extended ID*/
- CAN->sMsgObj[0].A1R = EXT_FIXED_ID_ARB_L(pCanMsg->Id);
- CAN->sMsgObj[0].A2R = (CAN->sMsgObj[0].A2R & 0xE000) | EXT_FIXED_ID_ARB_H(pCanMsg->Id);
- }
-
- CAN->sMsgObj[0].MCR = (CAN->sMsgObj[0].MCR & 0xFEF0) | CAN_MCR_NEWDAT | CAN_MCR_TXRQST | pCanMsg->Dlc;
-
- CAN->sMsgObj[0].DA1R = ((u16)pCanMsg->Data[1]<<8) | pCanMsg->Data[0];
- CAN->sMsgObj[0].DA2R = ((u16)pCanMsg->Data[3]<<8) | pCanMsg->Data[2];
- CAN->sMsgObj[0].DB1R = ((u16)pCanMsg->Data[5]<<8) | pCanMsg->Data[4];
- CAN->sMsgObj[0].DB2R = ((u16)pCanMsg->Data[7]<<8) | pCanMsg->Data[6];
-
- CAN->sMsgObj[0].CRR = 1 + msgobj;
-
- return SUCCESS;
-}
-
-/*******************************************************************************
-* Function Name : CAN_ReceiveMessage
-* Description : Gets the message, if received.
-* Input : - msgobj: specifies the Message object number, from 0 to 31.
-* - release: specifies the message release indicator.
-* This parameter can be one of the following values:
-* - TRUE: the message object is released when getting
-* the data.
-* - FALSE: the message object is not released.
-* - pCanMsg: pointer to the message structure where received
-* data is copied.
-* Output : None
-* Return : An ErrorStatus enumuration value:
-* - SUCCESS: Reception OK
-* - ERROR: No message pending
-*******************************************************************************/
-ErrorStatus CAN_ReceiveMessage(u32 msgobj, bool release, canmsg* pCanMsg)
-{
- if (!CAN_IsMessageWaiting(msgobj))
- {
- return ERROR;
- }
-
- CAN->SR &= ~CAN_SR_RXOK;
-
- /* read the message contents*/
- CAN->sMsgObj[1].CMR = CAN_CMR_MASK
- | CAN_CMR_ARB
- | CAN_CMR_CONTROL
- | CAN_CMR_CLRINTPND
- | (release ? CAN_CMR_TXRQSTNEWDAT : 0)
- | CAN_CMR_DATAA
- | CAN_CMR_DATAB;
-
- CAN->sMsgObj[1].CRR = 1 + msgobj;
-
- if (CAN->sMsgObj[1].CRR & CAN_CRR_BUSY)
- {
- return ERROR;
- }
-
- if ((CAN->sMsgObj[1].A2R & CAN_A2R_XTD) == 0)
- {
- /* standard ID*/
- pCanMsg->IdType = CAN_STD_ID;
- pCanMsg->Id = (CAN->sMsgObj[1].A2R >> 2) & 0x07FF;
- }
- else
- {
- /* extended ID*/
- pCanMsg->IdType = CAN_EXT_ID;
- pCanMsg->Id = ((CAN->sMsgObj[1].A2R >> 2) & 0x07FF);
- pCanMsg->Id |= ((u32)CAN->sMsgObj[1].A1R << 11);
- pCanMsg->Id |= (((u32)CAN->sMsgObj[1].A2R & 0x0003) << 27);
- }
-
- pCanMsg->Dlc = CAN->sMsgObj[1].MCR & 0x0F;
-
- pCanMsg->Data[0] = (u8) CAN->sMsgObj[1].DA1R;
- pCanMsg->Data[1] = (u8)(CAN->sMsgObj[1].DA1R >> 8);
- pCanMsg->Data[2] = (u8) CAN->sMsgObj[1].DA2R;
- pCanMsg->Data[3] = (u8)(CAN->sMsgObj[1].DA2R >> 8);
- pCanMsg->Data[4] = (u8) CAN->sMsgObj[1].DB1R;
- pCanMsg->Data[5] = (u8)(CAN->sMsgObj[1].DB1R >> 8);
- pCanMsg->Data[6] = (u8) CAN->sMsgObj[1].DB2R;
- pCanMsg->Data[7] = (u8)(CAN->sMsgObj[1].DB2R >> 8);
-
- return SUCCESS;
-}
-
-/*******************************************************************************
-* Function Name : CAN_WaitEndOfTx
-* Description : Waits until current transmission is finished.
-* Input : None
-* Output : None
-* Return : An ErrorStatus enumuration value:
-* - SUCCESS: Transmission ended
-* - ERROR: Transmission did not occur yet
-*******************************************************************************/
-ErrorStatus CAN_WaitEndOfTx(void)
-{
- if ((CAN->SR & CAN_SR_TXOK) == 0)
- {
- return ERROR;
- }
- CAN->SR &= ~CAN_SR_TXOK;
-
- return SUCCESS;
-}
-
-/*******************************************************************************
-* Function Name : CAN_BasicSendMessage
-* Description : Starts transmission of a message in BASIC mode. This mode
-* does not use the message RAM.
-* Input : pCanMsg: Pointer to the message structure containing data to
-* transmit.
-* Output : None
-* Return : An ErrorStatus enumuration value:
-* - SUCCESS: Transmission OK
-* - ERROR: No transmission
-*******************************************************************************/
-ErrorStatus CAN_BasicSendMessage(canmsg* pCanMsg)
-{
- /* clear NewDat bit in IF2 to detect next reception*/
- CAN->sMsgObj[1].MCR &= ~CAN_MCR_NEWDAT;
-
- CAN->SR &= ~CAN_SR_TXOK;
- CAN->sMsgObj[0].CMR = CAN_CMR_WRRD
- | CAN_CMR_ARB
- | CAN_CMR_CONTROL
- | CAN_CMR_DATAA
- | CAN_CMR_DATAB;
-
- if (pCanMsg->IdType == CAN_STD_ID)
- {
- /* standard ID*/
- CAN->sMsgObj[0].A1R = 0;
- CAN->sMsgObj[0].A2R = (CAN->sMsgObj[0].A2R & 0xE000) | STD_FIXED_ID_ARB(pCanMsg->Id);
- }
- else
- {
- /* extended ID*/
- CAN->sMsgObj[0].A1R = EXT_FIXED_ID_ARB_L(pCanMsg->Id);
- CAN->sMsgObj[0].A2R = ((CAN->sMsgObj[0].A2R) & 0xE000) | EXT_FIXED_ID_ARB_H(pCanMsg->Id);
- }
-
- CAN->sMsgObj[0].MCR = (CAN->sMsgObj[0].MCR & 0xFCF0) | pCanMsg->Dlc;
-
- CAN->sMsgObj[0].DA1R = ((u16)pCanMsg->Data[1]<<8) | pCanMsg->Data[0];
- CAN->sMsgObj[0].DA2R = ((u16)pCanMsg->Data[3]<<8) | pCanMsg->Data[2];
- CAN->sMsgObj[0].DB1R = ((u16)pCanMsg->Data[5]<<8) | pCanMsg->Data[4];
- CAN->sMsgObj[0].DB2R = ((u16)pCanMsg->Data[7]<<8) | pCanMsg->Data[6];
-
- /* request transmission*/
- if (CAN->sMsgObj[0].CRR == CAN_CRR_BUSY )
- {
- return ERROR;
- }
-
- return SUCCESS;
-}
-
-/*******************************************************************************
-* Function Name : CAN_BasicReceiveMessage
-* Description : Gets the message in BASIC mode, if received. This mode does
-* not use the message RAM.
-* Input : pCanMsg: pointer to the message structure where message is copied.
-* Output : None
-* Return : An ErrorStatus enumuration value:
-* - SUCCESS: Reception OK
-* - ERROR: No message pending
-*******************************************************************************/
-ErrorStatus CAN_BasicReceiveMessage(canmsg* pCanMsg)
-{
- if ((CAN->sMsgObj[1].MCR & CAN_MCR_NEWDAT) == 0)
- {
- return ERROR;
- }
-
- CAN->SR &= ~CAN_SR_RXOK;
-
- CAN->sMsgObj[1].CMR = CAN_CMR_ARB
- | CAN_CMR_CONTROL
- | CAN_CMR_DATAA
- | CAN_CMR_DATAB;
-
- if ((CAN->sMsgObj[1].A2R & CAN_A2R_XTD) == 0)
- {
- /* standard ID*/
- pCanMsg->IdType = CAN_STD_ID;
- pCanMsg->Id = (CAN->sMsgObj[1].A2R >> 2) & 0x07FF;
- }
- else
- {
- /* extended ID*/
- pCanMsg->IdType = CAN_EXT_ID;
- pCanMsg->Id = ((CAN->sMsgObj[1].A2R >> 2) & 0x07FF);
- pCanMsg->Id |= ((u32)CAN->sMsgObj[1].A1R << 11);
- pCanMsg->Id |= (((u32)CAN->sMsgObj[1].A2R & 0x0003) << 27);
- }
-
- pCanMsg->Dlc = CAN->sMsgObj[1].MCR & 0x0F;
-
- pCanMsg->Data[0] = (u8) CAN->sMsgObj[1].DA1R;
- pCanMsg->Data[1] = (u8)(CAN->sMsgObj[1].DA1R >> 8);
- pCanMsg->Data[2] = (u8) CAN->sMsgObj[1].DA2R;
- pCanMsg->Data[3] = (u8)(CAN->sMsgObj[1].DA2R >> 8);
- pCanMsg->Data[4] = (u8) CAN->sMsgObj[1].DB1R;
- pCanMsg->Data[5] = (u8)(CAN->sMsgObj[1].DB1R >> 8);
- pCanMsg->Data[6] = (u8) CAN->sMsgObj[1].DB2R;
- pCanMsg->Data[7] = (u8)(CAN->sMsgObj[1].DB2R >> 8);
-
- return SUCCESS;
-}
-
-/*******************************************************************************
-* Function Name : CAN_EnterInitMode
-* Description : Switchs the CAN into initialization mode. This function must
-* be used in conjunction with CAN_LeaveInitMode().
-* Input : InitMask: specifies the CAN configuration in normal mode.
-* Output : None
-* Return : None
-*******************************************************************************/
-void CAN_EnterInitMode(u8 InitMask)
-{
- CAN->CR = InitMask | CAN_CR_INIT;
- CAN->SR = 0; /* reset the status*/
-}
-
-/*******************************************************************************
-* Function Name : CAN_LeaveInitMode
-* Description : Leaves the initialization mode (switch into normal mode).
-* This function must be used in conjunction with CAN_EnterInitMode().
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void CAN_LeaveInitMode(void)
-{
- CAN->CR &= ~(CAN_CR_INIT | CAN_CR_CCE);
-}
-
-/*******************************************************************************
-* Function Name : CAN_EnterTestMode
-* Description : Switchs the CAN into test mode. This function must be used in
-* conjunction with CAN_LeaveTestMode().
-* Input : TestMask: specifies the configuration in test modes.
-* Output : None
-* Return : None
-*******************************************************************************/
-void CAN_EnterTestMode(u8 TestMask)
-{
- CAN->CR |= CAN_CR_TEST;
- CAN->TESTR |= TestMask;
-}
-
-/*******************************************************************************
-* Function Name : CAN_LeaveTestMode
-* Description : Leaves the current test mode (switch into normal mode).
-* This function must be used in conjunction with CAN_EnterTestMode().
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void CAN_LeaveTestMode(void)
-{
- CAN->CR |= CAN_CR_TEST;
- CAN->TESTR &= ~(CAN_TESTR_LBACK | CAN_TESTR_SILENT | CAN_TESTR_BASIC);
- CAN->CR &= ~CAN_CR_TEST;
-}
-
-/*******************************************************************************
-* Function Name : CAN_ReleaseTxMessage
-* Description : Releases the transmit message object.
-* Input : - msgobj: specifies the Message object number, from 0 to 31.
-* Output : None
-* Return : None
-*******************************************************************************/
-void CAN_ReleaseTxMessage(u32 msgobj)
-{
- CAN->sMsgObj[0].CMR = CAN_CMR_CLRINTPND | CAN_CMR_TXRQSTNEWDAT;
- CAN->sMsgObj[0].CRR = 1 + msgobj;
-}
-
-/*******************************************************************************
-* Function Name : CAN_ReleaseRxMessage
-* Description : Releases the receive message object.
-* Input : - msgobj: specifies the Message object number, from 0 to 31.
-* Output : None
-* Return : None
-*******************************************************************************/
-void CAN_ReleaseRxMessage(u32 msgobj)
-{
- CAN->sMsgObj[1].CMR = CAN_CMR_CLRINTPND | CAN_CMR_TXRQSTNEWDAT;
- CAN->sMsgObj[1].CRR = 1 + msgobj;
-}
-
-/*******************************************************************************
-* Function Name : CAN_IsMessageWaiting
-* Description : Tests the waiting status of a received message.
-* Input : - msgobj: specifies the Message object number, from 0 to 31.
-* Output : None
-* Return : A non-zero value if the corresponding message object has
-* received a message waiting to be copied, else 0.
-*******************************************************************************/
-u32 CAN_IsMessageWaiting(u32 msgobj)
-{
- return (msgobj < 16 ? CAN->ND1R & (1 << msgobj) : CAN->ND2R & (1 << (msgobj-16)));
-}
-
-/*******************************************************************************
-* Function Name : CAN_IsTransmitRequested
-* Description : Tests the request status of a transmitted message.
-* Input : - msgobj: specifies the Message object number, from 0 to 31.
-* Output : None
-* Return : A non-zero value if the corresponding message is requested
-* to transmit, else 0.
-*******************************************************************************/
-u32 CAN_IsTransmitRequested(u32 msgobj)
-{
- return (msgobj < 16 ? CAN->TXR1R & (1 << msgobj) : CAN->TXR2R & (1 << (msgobj-16)));
-}
-
-/*******************************************************************************
-* Function Name : CAN_IsInterruptPending
-* Description : Tests the interrupt status of a message object.
-* Input : - msgobj: specifies the Message object number, from 0 to 31.
-* Output : None
-* Return : A non-zero value if the corresponding message has an
-* interrupt pending, else 0.
-*******************************************************************************/
-u32 CAN_IsInterruptPending(u32 msgobj)
-{
- return (msgobj < 16 ? CAN->IP1R & (1 << msgobj) : CAN->IP2R & (1 << (msgobj-16)));
-}
-
-/*******************************************************************************
-* Function Name : CAN_IsObjectValid
-* Description : Tests the validity of a message object (ready to use).
-* Input : - msgobj: specifies the Message object number, from 0 to 31.
-* Output : None
-* Return : A non-zero value if the corresponding message object is
-* valid, else 0.
-*******************************************************************************/
-u32 CAN_IsObjectValid(u32 msgobj)
-{
- return (msgobj < 16 ? CAN->MV1R & (1 << msgobj) : CAN->MV2R & (1 << (msgobj-16)));
-}
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_dma.c b/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_dma.c
deleted file mode 100644
index db6ad6e..0000000
--- a/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_dma.c
+++ /dev/null
@@ -1,1125 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_dma.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the DMA software functions
-* needed to access all DMA registers.
-********************************************************************************
-* History:v 1.0
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-
-# include"91x_dma.h"
-# include"91x_scu.h"
-
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-
-
-/* DMA Masks "used" only in this module */
-
-#define DMA_Width_DES_MASK 0xFF1FFFFF
-#define DMA_Width_SRC_MASK 0xFFE3FFFF
-#define DMA_Bst_DES_MASK 0xFFFC7FFF
-#define DMA_Bst_SRC_MASK 0xFFFF8FFF
-#define DMA_FlowCntrl_Mask 0xFFFFC7FF
-#define DMA_TrsfSisze_Mask 0xFFFFF000
-#define SRC_Mask 0xFFFFFFE1
-#define DES_Mask 0xFFFFFC3F
-#define DMA_TCIE 0x80000000
-#define DMA_ChannelDESInc 0x08000000
-#define DMA_ChannelSRCInc 0x04000000
-#define DMA_BufferChannel 0x20000000
-#define DMA_HaltChannel 0x00040000
-#define DMA_LockChannel 0x00010000
-#define DMA_CacheChannel 0x40000000
-#define DMA_ChannelActive 0x00020000
-#define DMA_Enable 0x00000001
-#define DMA_ChannelEnable 0x00000001
-
-
-
-
-/* Private function prototypes -----------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-
-/*******************************************************************************
-* Function Name : DMA_ITMaskConfig
-* Description : Enables or disables the specified DMA_Channelx Mask interrupt.
-* Input :
-* -DMA_Channelx: where x can be 0,1,2,3,4,5,6,or 7 to select the DMA Channel.
-* -DMA_ITMask: specifies the DMA interrupt mask source to be enabled or disabled.
-* This parameter can be:
-* - DMA_ITMask_IE (Interrupt error mask).
-* - DMA_ITMask_ITC (Terminal count interrupt mask).
-* - DMA_ITMask_ALL ( All interrupts mask)
-*
-* -NewState: new state of the specified DMA_Channelx mask interrupt.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-
-void DMA_ITMaskConfig(DMA_Channel_TypeDef * DMA_Channelx, u16 DMA_ITMask , FunctionalState NewState)
-
-{
- if (NewState==ENABLE) /* Mask the Interrupt */
- {
- DMA_Channelx-> CCNF |= DMA_ITMask ;
- }
-
- else /* Disable the Interrupt Mask*/
- {
- DMA_Channelx-> CCNF &= ~ DMA_ITMask ;
- }
-}
-
-
-
-
-
-/*******************************************************************************
-* Function Name : DMA_ITConfig
-* Description : Enables or disables the DMA_Channelx Terminal Count interrupt.
-* Input :
-* -DMA_Channelx: where x can be 0,1,2,3,4,5,6,or 7 to select the DMA Channel.
-* -NewState: new state of the specified DMA_Channelx mask interrupt.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-
-void DMA_ITConfig(DMA_Channel_TypeDef * DMA_Channelx, FunctionalState NewState)
-
-{
- if (NewState==ENABLE) /* Enable the Terminal Count Interrupt */
- {
- DMA_Channelx->CC |= DMA_TCIE ;
- }
-
- else /* Disable the Terminal Count Interrupt */
- {
- DMA_Channelx-> CC &= ~ DMA_TCIE ;
- }
-}
-
-
-/********************************************************************************
-* Function Name : DMA_SyncConfig
-* Description : Enables or disables synchronization logic for the corresponding DMA Request Signal.
-* Input :
-* -SRCReq:specifies the DMA Request Source.
-* This parameter can be:
-* -DMA_USB_RX_Mask
-* -DMA_USB_TX_Mask
-* -DMA_TIM0_Mask
-* -DMA_TIM1_Mask
-* -DMA_UART0_RX_Mask
-* -DMA_UART0_TX_Mask
-* -DMA_UART1_RX_Mask
-* -DMA_UART1_TX_Mask
-* -DMA_External_Req0_Mask
-* -DMA_External_Req1_Mask
-* -DMA_I2C0_Mask
-* -DMA_I2C1_Mask
-* -DMA_SSP0_RX_Mask
-* -DMA_SSP0_TX_Mask
-* -DMA_SSP1_RX_Mask
-* -DMA_SSP1_TX_Mask
-*
-* -NewState: new state of the specified DMA_Channelx mask interrupt.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-
-void DMA_SyncConfig(u16 SRCReq, FunctionalState NewState)
-
-{
- if (NewState==ENABLE) /* Enable the synchronization logic for the corresponding DMA Request Signal */
- {
-
- DMA->SYNR &= ~ SRCReq ;
-
- }
-
- else /* Disable the synchronization logic for the corresponding DMA Request Signal. */
- {
- DMA->SYNR |= SRCReq ;
-
- }
-}
-
-
-/********************************************************************************
-* Function Name : DMA_SetSReq
-* Description : Set the DMA to generate a Single transfer request for the corresponding DMA Request Source.
-* Input :
-* -SRCReq:specifies the DMA Request Source.
-* This parameter can be:
-* -DMA_USB_RX_Mask
-* -DMA_USB_TX_Mask
-* -DMA_TIM0_Mask
-* -DMA_TIM1_Mask
-* -DMA_UART0_RX_Mask
-* -DMA_UART0_TX_Mask
-* -DMA_UART1_RX_Mask
-* -DMA_UART1_TX_Mask
-* -DMA_External_Req0_Mask
-* -DMA_External_Req1_Mask
-* -DMA_I2C0_Mask
-* -DMA_I2C1_Mask
-* -DMA_SSP0_RX_Mask
-* -DMA_SSP0_TX_Mask
-* -DMA_SSP1_RX_Mask
-* -DMA_SSP1_TX_Mask
-*
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-
-void DMA_SetSReq(u16 SRCReq)
-
-{ /* Set the DMA to generate a Single transfer request for the corresponding DMA Request Source */
- DMA->SSRR |= SRCReq ;
-}
-
-
-
-
-/********************************************************************************
-* Function Name : DMA_SetLSReq
-* Description : Set the DMA to generate a Last Single transfer request for the corresponding DMA Request Source.
-* Input :
-* -SRCReq:specifies the DMA Request Source.
-* This parameter can be:
-* -DMA_USB_RX_Mask
-* -DMA_USB_TX_Mask
-* -DMA_TIM0_Mask
-* -DMA_TIM1_Mask
-* -DMA_UART0_RX_Mask
-* -DMA_UART0_TX_Mask
-* -DMA_UART1_RX_Mask
-* -DMA_UART1_TX_Mask
-* -DMA_External_Req0_Mask
-* -DMA_External_Req1_Mask
-* -DMA_I2C0_Mask
-* -DMA_I2C1_Mask
-* -DMA_SSP0_RX_Mask
-* -DMA_SSP0_TX_Mask
-* -DMA_SSP1_RX_Mask
-* -DMA_SSP1_TX_Mask
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-void DMA_SetLSReq(u16 SRCReq )
-{ /* Set the DMA to generate a Last Single transfer request for the corresponding DMA Request Source */
- DMA->SLSRR |= SRCReq ;
-}
-
-
-/********************************************************************************
-* Function Name : DMA_SetBReq
-* Description : Set the DMA to generate a Burst transfer request for the corresponding DMA Request Source.
-* Input :
-* -SRCReq:specifies the DMA Request Source.
-* This parameter can be:
-* -DMA_USB_RX_Mask
-* -DMA_USB_TX_Mask
-* -DMA_TIM0_Mask
-* -DMA_TIM1_Mask
-* -DMA_UART0_RX_Mask
-* -DMA_UART0_TX_Mask
-* -DMA_UART1_RX_Mask
-* -DMA_UART1_TX_Mask
-* -DMA_External_Req0_Mask
-* -DMA_External_Req1_Mask
-* -DMA_I2C0_Mask
-* -DMA_I2C1_Mask
-* -DMA_SSP0_RX_Mask
-* -DMA_SSP0_TX_Mask
-* -DMA_SSP1_RX_Mask
-* -DMA_SSP1_TX_Mask
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-
-void DMA_SetBReq(u16 SRCReq)
-
-{ /* Set the DMA to generate a Burst transfer request for the corresponding DMA Request Source */
- DMA->SBRR |= SRCReq ;
-}
-
-
-
-/********************************************************************************
-* Function Name : DMA_SetLBReq
-* Description : Set the DMA to generate a Last Burst transfer request for the corresponding DMA Request Source.
-* Input :
-* -SRCReq:specifies the DMA Request Source.
-* This parameter can be:
-* -DMA_USB_RX_Mask
-* -DMA_USB_TX_Mask
-* -DMA_TIM0_Mask
-* -DMA_TIM1_Mask
-* -DMA_UART0_RX_Mask
-* -DMA_UART0_TX_Mask
-* -DMA_UART1_RX_Mask
-* -DMA_UART1_TX_Mask
-* -DMA_External_Req0_Mask
-* -DMA_External_Req1_Mask
-* -DMA_I2C0_Mask
-* -DMA_I2C1_Mask
-* -DMA_SSP0_RX_Mask
-* -DMA_SSP0_TX_Mask
-* -DMA_SSP1_RX_Mask
-* -DMA_SSP1_TX_Mask
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-
-void DMA_SetLBReq(u16 SRCReq)
-
-{ /* Set the DMA to generate a Last Burst transfer request for the corresponding DMA Request Source */
- DMA->SLBRR |= SRCReq ;
-}
-
-
-/********************************************************************************
-* Function Name : DMA_GetSReq
-* Description : Check for a specific source if it request a Single transfer .
-* Input :
-* Input :
-* -SRCReq:specifies the DMA Request Source.
-* This parameter can be:
-* -DMA_USB_RX_Mask
-* -DMA_USB_TX_Mask
-* -DMA_TIM0_Mask
-* -DMA_TIM1_Mask
-* -DMA_UART0_RX_Mask
-* -DMA_UART0_TX_Mask
-* -DMA_UART1_RX_Mask
-* -DMA_UART1_TX_Mask
-* -DMA_External_Req0_Mask
-* -DMA_External_Req1_Mask
-* -DMA_I2C0_Mask
-* -DMA_I2C1_Mask
-* -DMA_SSP0_RX_Mask
-* -DMA_SSP0_TX_Mask
-* -DMA_SSP1_RX_Mask
-* -DMA_SSP1_TX_Mask
-* Output : None.
-* Return : SET or RESET.
-*******************************************************************************/
-
-
-FlagStatus DMA_GetSReq(u16 SRCReq)
-
-{ /* Check for a specific source if it request a Single transfer . */
- if ( (DMA->SSRR & SRCReq )!= RESET )
- {
- return SET;
- }
-
- else
- {
- return RESET;
- }
-}
-
-
-/********************************************************************************
-* Function Name : DMA_GetLSReq
-* Description : Check for a specific source if it request a Last Single transfer .
-* Input :
-* -SRCReq:specifies the DMA Request Source.
-* This parameter can be:
-* -DMA_USB_RX_Mask
-* -DMA_USB_TX_Mask
-* -DMA_TIM0_Mask
-* -DMA_TIM1_Mask
-* -DMA_UART0_RX_Mask
-* -DMA_UART0_TX_Mask
-* -DMA_UART1_RX_Mask
-* -DMA_UART1_TX_Mask
-* -DMA_External_Req0_Mask
-* -DMA_External_Req1_Mask
-* -DMA_I2C0_Mask
-* -DMA_I2C1_Mask
-* -DMA_SSP0_RX_Mask
-* -DMA_SSP0_TX_Mask
-* -DMA_SSP1_RX_Mask
-* -DMA_SSP1_TX_Mask
-* Output : None.
-* Return : SET or RESET.
-*******************************************************************************/
-
-
-FlagStatus DMA_GetLSReq(u16 SRCReq)
-
-{ /* Check for a specific source if it request a Last Single transfer . */
- if ( (DMA->SLSRR & SRCReq)!= RESET )
- {
- return SET;
- }
-
- else
- {
- return RESET;
- }
-}
-
-/********************************************************************************
-* Function Name : DMA_GetBReq
-* Description : Check for a specific source if it request a Burst transfer .
-* Input :
-* -SRCReq:specifies the DMA Request Source.
-* This parameter can be:
-* -DMA_USB_RX_Mask
-* -DMA_USB_TX_Mask
-* -DMA_TIM0_Mask
-* -DMA_TIM1_Mask
-* -DMA_UART0_RX_Mask
-* -DMA_UART0_TX_Mask
-* -DMA_UART1_RX_Mask
-* -DMA_UART1_TX_Mask
-* -DMA_External_Req0_Mask
-* -DMA_External_Req1_Mask
-* -DMA_I2C0_Mask
-* -DMA_I2C1_Mask
-* -DMA_SSP0_RX_Mask
-* -DMA_SSP0_TX_Mask
-* -DMA_SSP1_RX_Mask
-* -DMA_SSP1_TX_Mask
-* Output : None.
-* Return : SET or RESET.
-*******************************************************************************/
-
-
-FlagStatus DMA_GetBReq(u16 SRCReq)
-
-{ /* Check for a specific source if it request a Burst transfer . */
- if (( DMA->SBRR & SRCReq ) != RESET )
- {
- return SET;
- }
-
- else
- {
- return RESET;
- }
-}
-
-/********************************************************************************
-* Function Name : DMA_GetLSReq
-* Description : Check for a specific source if it request a Last Burst transfer .
-* Input :
-* Input :
-* - SRCReq:specifies the DMA Request Source.
-* This parameter can be:
-* -DMA_USB_RX_Mask
-* -DMA_USB_TX_Mask
-* -DMA_TIM0_Mask
-* -DMA_TIM1_Mask
-* -DMA_UART0_RX_Mask
-* -DMA_UART0_TX_Mask
-* -DMA_UART1_RX_Mask
-* -DMA_UART1_TX_Mask
-* -DMA_External_Req0_Mask
-* -DMA_External_Req1_Mask
-* -DMA_I2C0_Mask
-* -DMA_I2C1_Mask
-* -DMA_SSP0_RX_Mask
-* -DMA_SSP0_TX_Mask
-* -DMA_SSP1_RX_Mask
-* -DMA_SSP1_TX_Mask
-* Output : None.
-* Return : SET or RESET.
-*******************************************************************************/
-
-
-FlagStatus DMA_GetLBReq(u16 SRCReq)
-
-{ /* Check for a specific source if it request a Last Burst transfer . */
- if ( ( DMA->SLBRR & SRCReq ) != RESET )
- {
- return SET;
- }
-
- else
- {
- return RESET;
- }
-}
-
-
-
-/*******************************************************************************
-* Function Name : DMA_ChannelHalt
-* Description : Enables DMA requests or ignore extra source DMA requests for
- the specified channel.
-* Input :
- -DMA_Channelx: where x can be 0,1,2,3,4,5,6,or 7 to select the DMA Channel.
- -NewState: new state of the specified DMA_Channelx mask interrupt.
- This parameter can be: ENABLE or DISABLE.
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-
-void DMA_ChannelHalt(DMA_Channel_TypeDef * DMA_Channelx, FunctionalState NewState)
-
-{
- if (NewState==ENABLE) /* Enables DMA requests */
-
- {
- DMA_Channelx->CCNF |= DMA_HaltChannel ;
- }
-
- else /* Ignore extra source DMA request */
- {
- DMA_Channelx->CCNF &= ~ DMA_HaltChannel ;
- }
-}
-
-
-/*******************************************************************************
-* Function Name : DMA_ChannelLockTrsf
-* Description : Enables or disables the Locked Transfers Feature for the specified DMA_Channelx
-* Input :
-* -DMA_Channelx: where x can be 0,1,2,3,4,5,6,or 7 to select the DMA Channel.
-* -NewState: new state of the specified DMA_Channelx mask interrupt.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-
-void DMA_ChannelLockTrsf(DMA_Channel_TypeDef * DMA_Channelx, FunctionalState NewState)
-
-{
- if (NewState==ENABLE) /* Locked transfers enabled on channel x */
-
- {
- DMA_Channelx->CCNF |= DMA_LockChannel ;
- }
-
- else /* Locked transfers disabled on channel xt */
- {
- DMA_Channelx->CCNF &= ~ DMA_LockChannel;
- }
-}
-
-
-/*******************************************************************************
-* Function Name : DMA_ChannelCache
-* Description : Enables or disables the cacheability Feature for the specified DMA_Channelx
-* Input :
-* -DMA_Channelx: where x can be 0,1,2,3,4,5,6,or 7 to select the DMA Channel.
-* -NewState: new state of the specified DMA_Channelx mask interrupt.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-
-void DMA_ChannelCache (DMA_Channel_TypeDef * DMA_Channelx, FunctionalState NewState)
-
-{
- if (NewState==ENABLE) /* Cacheability Feature enabled on channelx */
-
- {
- DMA_Channelx->CC |= DMA_CacheChannel ;
- }
-
- else /* Cacheability Feature disabled on channelx */
- {
- DMA_Channelx->CC &= ~ DMA_CacheChannel ;
- }
-}
-
-
-/*******************************************************************************
-* Function Name : DMA_ChannelBuffering
-* Description : Enables or disables the Buffering Feature for the specified DMA_Channelx
-* Input :
-* -DMA_Channelx: where x can be 0,1,2,3,4,5,6,or 7 to select the DMA Channel.
-* -NewState: new state of the specified DMA_Channelx mask interrupt.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-
-void DMA_ChannelBuffering (DMA_Channel_TypeDef * DMA_Channelx, FunctionalState NewState)
-
-{
- if (NewState==ENABLE) /* Cacheability Feature enabled on channel x */
-
- {
- DMA_Channelx->CC |= DMA_BufferChannel ;
- }
-
- else /* Cacheability Feature disabled on channel xt */
- {
- DMA_Channelx->CC &= ~ DMA_BufferChannel ;
- }
-}
-
-/*******************************************************************************
-* Function Name : MA_ChannelProt0Mod
-* Description : Sets The User or Privileged mode for the specified DMA_Channelx
-* Input :
-* -DMA_Channelx: where x can be 0,1,2,3,4,5,6,or 7 to select the DMA Channel.
-* -Prot0Mode: Specifies the Privileged mode Or the User mode.
-* This parameter can be:
-* - DMA_PrevilegedMode
-* - DMA_UserMode
-*
-*
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-
-void DMA_ChannelProt0Mode (DMA_Channel_TypeDef * DMA_Channelx, u32 Prot0Mode)
-
-{
- if (Prot0Mode==DMA_PrevilegedMode) /* Privileged mode */
- {
- DMA_Channelx->CC |= DMA_PrevilegedMode ;
- }
-
- else /* User mode */
- {
- DMA_Channelx->CC &= DMA_UserMode ;
- }
-}
-
-
-
-
-
-/*******************************************************************************
-* Function Name : DMA_ChannelSRCIncConfig
-* Description : Enables or disables the Source address incrementation after each transfer for
-* the specified DMA_Channelx
-* Input :
-* -DMA_Channelx: where x can be 0,1,2,3,4,5,6,or 7 to select the DMA Channel.
-* -NewState: new state of the specified DMA_Channelx mask interrupt.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-
-void DMA_ChannelSRCIncConfig (DMA_Channel_TypeDef * DMA_Channelx, FunctionalState NewState)
-
-{
- if (NewState==ENABLE) /* The Source address is incremented after each transfer */
-
- {
- DMA_Channelx->CC |= DMA_ChannelSRCInc ;
- }
-
- else /* The Source address is not incremented after each Transfer */
- {
- DMA_Channelx->CC &= ~ DMA_ChannelSRCInc ;
- }
-}
-
-
-/*******************************************************************************
-* Function Name : DMA_ChannelDESIncConfig
-* Description : Enables or disables the Destination address incrementation after each transfer for
-* the specified DMA_Channelx
-* Input :
-* -DMA_Channelx: where x can be 0,1,2,3,4,5,6,or 7 to select the DMA Channel.
-* -NewState: new state of the specified DMA_Channelx mask interrupt.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-
-void DMA_ChannelDESIncConfig (DMA_Channel_TypeDef * DMA_Channelx, FunctionalState NewState)
-
-{
- if (NewState==ENABLE) /* The Destination address is incremented after each transfer */
-
- {
- DMA_Channelx->CC |= DMA_ChannelDESInc ;
- }
-
- else /* The Destination address is not incremented after each Transfer */
- {
- DMA_Channelx->CC &= ~ DMA_ChannelDESInc ;
- }
-}
-
-
-
-/********************************************************************************
-* Function Name : DMA_GetChannelStatus
-* Description : Checks the status of DMA channelx ( Enabled or Disabled).
-* - ChannelIndx:specifies the DMA Channel to be checked.
-* This parameter can be:
-* - Channel0
-* - Channel1
-* - Channel2
-* - Channel3
-* - Channel4
-* - Channel5
-* - Channel6
-* - Channel7
-* Output : None.
-*
-* Return : SET or RESET.
-*******************************************************************************/
-
-
-FlagStatus DMA_GetChannelStatus(u8 ChannelIndx )
-
-{
-
- if ( ( DMA->ENCSR & (1 << ChannelIndx )) != RESET )
- {
- return SET; /* Channelx Enabled */
- }
-
- else
-
- {
-
- return RESET; /* Channelx Disabled */
-
- }
-
-}
-
-
-
-/********************************************************************************
-* Function Name : DMA_GetITStatus
-* Description : Checks the status of Terminal Count and Error interrupts request after and before Masking.
-* Input :
-* - ChannelIndx:specifies the DMA Channel to be checked.
-* This parameter can be:
-* - Channel0
-* - Channel1
-* - Channel2
-* - Channel3
-* - Channel4
-* - Channel5
-* - Channel6
-* - Channel7
-*
-*. - DMA_ITReq: specifies the DMA interrupt request status to be checked.
-* This parameter can be:
-*
-* - DMA_IS
-* - DMA_TCS
-* - DMA_ES
-* - DMA_TCRS
-* - DMA_ERS.
-*
-* Output : None.
-*
-* Return : SET or RESET.
-*******************************************************************************/
-
-
-ITStatus DMA_GetITStatus(u8 ChannelIndx,u8 DMA_ITReq)
-
-{
- u32 DMAReg = 0;
-
- switch(DMA_ITReq)
-
- {
-
- case (DMA_IS): /*The status of the interrupts after masking : logical or of all Interrupts after Masking*/
- DMAReg = DMA->ISR;
- break;
-
-
-
- case (DMA_TCS): /* The status of the Terminal count request after masking */
- DMAReg = DMA->TCISR;
- break;
-
-
- case (DMA_ES): /* The status of the error request after masking */
- DMAReg = DMA->EISR;
- break;
-
-
- case (DMA_TCRS): /* Indicates if the DMA channel is requesting a transfer complete (terminal count Interrupt) prior to masking or Not. */
- DMAReg = DMA->TCRISR;
- break;
-
- case (DMA_ERS): /* Indicates if the DMA channel is requesting an Error Interrupt prior to masking or Not. */
- DMAReg = DMA->ERISR;
- break;
-
-
- }
-
- if((DMAReg &(1 << ChannelIndx )) != RESET )
-
- {
- return SET;
- }
-
- else
-
- {
-
- return RESET;
-
-
- }
-
-}
-
-
-/********************************************************************************
-* Function Name : DMA_ClearIT
-* Description : Clears The Interrupt pending bits for termnal count or Error interrupts for a specified DMA Channel.
-* - ChannelIndx:specifies the DMA Channel to be checked.
-* This parameter can be:
-* - Channel0
-* - Channel1
-* - Channel2
-* - Channel3
-* - Channel4
-* - Channel5
-* - Channel6
-* - Channel7
-* - DMA_ITClr : Specifies the DMA interrupt pending to be cleared.
-*. This parameter can be:
-* - DMA_TCC
-* - DMA_EC.
-*
-* Output : None.
-
-* Return : SET or RESET.
-*******************************************************************************/
-
-
-void DMA_ClearIT(u8 ChannelIndx,u8 DMA_ITClr)
-
-{
-
-
- switch(DMA_ITClr)
-
- {
-
- case (DMA_TCC): /* Clear The status of the Terminal count interrupt on the corresponding channel.*/
- DMA->TCICR |=(1 << ChannelIndx );
- break;
-
-
-
- case (DMA_EC): /* Clear The status of the error interrupt on the corresponding channel.*/
- DMA->EICR |=(1 << ChannelIndx );
- break;
-
-
-
- }
-
-
-
-}
-
-
-/*******************************************************************************
-* Function Name : DMA_Cmd(FunctionalState NewState)
-* Description : Enables or disables the DMA peripheral.
-*
-* Input :
-* -NewState: new state of the DMA.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-
-void DMA_Cmd(FunctionalState NewState)
-
-{
- if (NewState==ENABLE) /* ENABLE the DMA peripheral */
-
- {
- DMA-> CNFR |= DMA_Enable ;
- }
-
- else /* DISABLE the DMA peripheral */
- {
- DMA-> CNFR &= ~ DMA_Enable ;
- }
-}
-
-
-
-/*******************************************************************************
-* Function Name : DMA_ChannelCmd
-* Description : Enables or disables the specified DMA_Channelx
-*
-* Input :
-* -DMA_Channelx: where x can be 0,1,2,3,4,5,6,or 7 to select the DMA Channel.
-* -NewState: new state of the specified DMA_Channelx mask interrupt.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-
-void DMA_ChannelCmd (DMA_Channel_TypeDef *DMA_Channelx,FunctionalState NewState)
-
-{
- if (NewState==ENABLE) /* Enable The Channelx */
-
- {
- DMA_Channelx->CCNF |= DMA_ChannelEnable ;
- }
-
- else /* Disable The Channelx */
- {
- DMA_Channelx-> CCNF &= ~ DMA_ChannelEnable ;
- }
-}
-
-
-
-/********************************************************************************
-* Function Name : DMA_GetChannelActiveStatus
-* Description : Checks The DMA_Channelx FIFO if it has data or not.
-* Input :
-* -DMA_Channelx: where x can be 0,1,2,3,4,5,6,or 7 to select the DMA Channel.
-*
-*
-* Output : None.
-*
-* Return : SET or RESET.
-*******************************************************************************/
-
-
-FlagStatus DMA_GetChannelActiveStatus( DMA_Channel_TypeDef * DMA_Channelx )
-
-{
-
- if ( ( DMA_Channelx->CCNF & DMA_ChannelActive) != RESET )
- {
- return SET; /* The DMA_Channelx FIFO has data */
- }
-
- else
-
- {
-
- return RESET; /* No data in the DMA_Channelx FIFO */
-
-
- }
-
-}
-
-
-/********************************************************************************
-* Function Name : DMA_DeInit
-* Description : Initializes the DMA peripheral registers to their default reset values.
-*
-*
-* Input : None
-*
-* Output : None.
-*
-* Called Functions:
-*
-* - SCU_AHBPeriphReset: Function defined in the System clock Unit "scu.c".
-*
-*
-* Return : None
-*******************************************************************************/
-
-
-void DMA_DeInit(void)
-
-{
-
- SCU_AHBPeriphReset(__DMA, ENABLE); /*DMA peripheral is under Reset " Reset on"*/
- SCU_AHBPeriphReset(__DMA, DISABLE); /*DMA peripheral Reset off*/
-}
-
-
-
-/********************************************************************************
-* Function Name : DMA_StructInit
-* Description : Fills each DMA_InitStruct member with its reset value.
-* Input :
-* -DMA_InitStruct: pointer to a DMA_InitTypeDef structure which will be initialized.
-*
-* Output : None.
-*
-* Return : None
-*******************************************************************************/
-
-
-void DMA_StructInit(DMA_InitTypeDef * DMA_InitStruct)
-
-{
-
- /* Initialize The current source address */
- DMA_InitStruct-> DMA_Channel_SrcAdd =0x0000000;
-
-
- /* Initialize The current Destination address */
- DMA_InitStruct->DMA_Channel_DesAdd=0x00000000;
-
-
-
- /* Initialize The Linked List Items */
- DMA_InitStruct->DMA_Channel_LLstItm=0x00000000 ;
-
-
-
- /* Initialize The Destination width */
- DMA_InitStruct->DMA_Channel_DesWidth= DMA_DesWidth_Byte;
-
-
-
- /* Initialize The source width */
- DMA_InitStruct->DMA_Channel_SrcWidth= DMA_SrcWidth_Byte;
-
-
- /* Initialize The Burst Size for the Destination */
- DMA_InitStruct->DMA_Channel_DesBstSize= DMA_DesBst_1Data; /* 1 Data "one Data can be byte, halfword or word depending on the Destination width */
-
-
-
- /* Initialize The Burst Size for the Source*/
- DMA_InitStruct->DMA_Channel_SrcBstSize= DMA_SrcBst_1Data; /* 1 Data "one Data can be byte, halfword or word depending on the source width */
-
- /* Initialize The Flow control and transfer type for the DMA transfer */
- DMA_InitStruct->DMA_Channel_FlowCntrl=DMA_FlowCntrlt0_DMA; /* memory to memory transfer with DMA as flow controller */
-
-
- /* Initialize The Transfer Size */
- DMA_InitStruct->DMA_Channel_TrsfSize =0x00;
-
-
-
- /* Initialize the DMA source request peripheral :"This field is ignored if the source of the transfer is from memory" */
- DMA_InitStruct->DMA_Channel_Src =0x00;
-
-
-
- /* Initialize the DMA Destination request peripheral :"This field is ignored if the destination of the transfer is to memory.*/
-
- DMA_InitStruct->DMA_Channel_Des=0x00;
-
-
-}
-
-
-
-
-/********************************************************************************
-* Function Name : DMA_Init
-* Description : Initializes the DMA_Channelx according to the specified parameters
-* in the DMA_InitStruct .
-*
-* Input :
-* -DMA_Channelx: where x can be 0,1,2,3,4,5,6,or 7 to select the DMA Channel.
-* -DMA_InitStruct: pointer to a DMA_InitTypeDef structure
-* ( Structure Config to be load in DMA Registers). .
-*
-* Output : None.
-*
-* Return : None
-*******************************************************************************/
-
-
-void DMA_Init(DMA_Channel_TypeDef * DMA_Channelx, DMA_InitTypeDef * DMA_InitStruct)
-
-{
-
-
-
- /* Select the DMA source peripheral request */
- DMA_Channelx->CCNF &= SRC_Mask;
- DMA_Channelx->CCNF |= DMA_InitStruct->DMA_Channel_Src;
-
-
- /* Select the flow controller and the transfer type */
- DMA_Channelx->CCNF &= DMA_FlowCntrl_Mask;
- DMA_Channelx->CCNF |=DMA_InitStruct->DMA_Channel_FlowCntrl;
-
-
- /* Select the DMA Destination peripheral request*/
- DMA_Channelx->CCNF &= DES_Mask;
- DMA_Channelx->CCNF |= DMA_InitStruct->DMA_Channel_Des;
-
- /* Set the source address */
- DMA_Channelx->SRC = DMA_InitStruct-> DMA_Channel_SrcAdd ;
-
-
- /* Set the destination address */
-
- DMA_Channelx->DES = DMA_InitStruct->DMA_Channel_DesAdd ;
-
-
-
- /* Set the linked list Items address */
- DMA_Channelx->LLI = DMA_InitStruct->DMA_Channel_LLstItm ;
-
-
- /* Set The Destination width */
- DMA_Channelx->CC &= DMA_Width_DES_MASK;
- DMA_Channelx->CC |= DMA_InitStruct->DMA_Channel_DesWidth;
-
-
- /* Set The Source width */
- DMA_Channelx->CC &= DMA_Width_SRC_MASK;
- DMA_Channelx->CC |= DMA_InitStruct->DMA_Channel_SrcWidth;
-
- /* Set The Burst Size for the Destination */
- DMA_Channelx->CC &= DMA_Bst_DES_MASK;
- DMA_Channelx->CC |= DMA_InitStruct->DMA_Channel_DesBstSize;
-
- /* Set The Burst Size for the Source */
- DMA_Channelx->CC &= DMA_Bst_SRC_MASK;
- DMA_Channelx->CC |=DMA_InitStruct->DMA_Channel_SrcBstSize;
-
-
- /* Initialize The Transfer Size for the Source */
- DMA_Channelx->CC &= DMA_TrsfSisze_Mask;
- DMA_Channelx->CC |= DMA_InitStruct->DMA_Channel_TrsfSize;
-
-
-}
-
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_emi.c b/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_emi.c
deleted file mode 100644
index deadae8..0000000
--- a/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_emi.c
+++ /dev/null
@@ -1,167 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_emi.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the EMI software functions.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_emi.h"
-#include "91x_scu.h"
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-
-/* These constant variables are used as masks to handle the EMI registers. */
-
-#define EMI_PageModeRead_TL_Mask 0xFFFFF3FF
-#define EMI_PageModeRead_Sel_Mask 0xFFFFFEFF
-#define EMI_MemWidth_Mask 0xFFFFFFCF
-#define EMI_WriteProtect_Mask 0xFFFFFEF7
-
-
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Registers reset value */
-/* Private function prototypes -----------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-
-/******************************************************************************
-* Function Name : EMI_DeInit
-* Description : Deinitializes the EMI peripheral registers to their default
-* reset values.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-
-void EMI_DeInit(void)
-{
-
- SCU_AHBPeriphReset(__EMI, ENABLE); /* EMI peripheral under Reset */
- SCU_AHBPeriphReset(__EMI,DISABLE ); /* EMI not under Reset */
-
-}
-
-/*******************************************************************************
-* Function Name : EMI_StructInit
-* Description : Fills the EMI_InitTypeDef structure member with its reset
-* value.
-* Input : EMI_InitStruct : pointer to a EMI_InitTypeDef structure
-* which will be initialized.
-* Output : None
-* Return : None
-*******************************************************************************/
-
-void EMI_StructInit( EMI_InitTypeDef *EMI_InitStruct)
-{
-
- /* Number of bus turnaround cycles added between read and write accesses.*/
- /*This member can be 0x01,0x02,0x03, ....0xF (Reset value:0xF "15 cycles"*/
-
- EMI_InitStruct->EMI_Bank_IDCY =0xF;
-
-
- /* Number of wait states for read accesses*/
- /*This member can be: 0x01,0x02,0x03, ....0x1F (Reset value:0x1F "31 cycles"*/
-
- EMI_InitStruct->EMI_Bank_WSTRD =0x1F;
-
-
- /* Number of wait states for write accesses*/
- /*This member can be: 0x01,0x02,0x03, ....0x1F (Reset value:0x1F "31 cycles"*/
-
- EMI_InitStruct->EMI_Bank_WSTWR =0x1F;
-
- /*Output enable assertion delay from chip select assertion*/
- /*This member can be: 0x01,0x02,0x03, ....0xF (Reset value:0x01 "1 cycle"*/
-
- EMI_InitStruct->EMI_Bank_WSTROEN =0x01;
-
-
- /*Write enable assertion delay from chip select assertion*/
- /*This member can be: 0x01,0x02,0x03, ....0xF (Reset value:0x00 "0 cycle"*/
-
- EMI_InitStruct->EMI_Bank_WSTWEN =0x00;
-
-
- /*This member Controls the memory width*/
- /*This member can be :"EMI_Width_Byte" = 8 bits width or "EMI_Width_HalfWord" = 16 bits width*/
-
- EMI_InitStruct->EMI_Bank_MemWidth = EMI_Width_Byte;
-
-
- /*Write protection feature */
- /*This member can be :"EMI_Bank_NonWriteProtect" = No write protection or "EMI_Bank_WriteProtect" = bank is write protected*/
-
- EMI_InitStruct-> EMI_Bank_WriteProtection= EMI_Bank_NonWriteProtect;
-
-
- /* page transfer length for page mode read */
- /*This member can be :"EMI_4Data" = 4 transfers burst or "EMI_8Data" = 8 transfers burst*/
-
- EMI_InitStruct->EMI_PageModeRead_TransferLength= EMI_4Data;
-
- /*Select or deselect the page mode read*/
- /*This member can be :"EMI_NormalMode" =Normal Mode or "EMI_PageModeRead" = Page Mode Read*/
-
- EMI_InitStruct->EMI_PageModeRead_Selection = EMI_NormalMode;
-
-
-}
-
-/*******************************************************************************
-* Function Name : EMI_Init
-* Description : Initializes EMI peripheral according to the specified
-* parameters in the EMI_InitStruct.
-
-* Input : EMI_Bankx:where x can be 0,1,2 or 3 to select the EMI Bank.
- EMI_InitStruct: pointer to a EMI_InitTypeDef structure
- ( Structure Config to be loaded in EMI Registers). .
-
-* Output : None
-* Return : None
-*******************************************************************************/
-
-void EMI_Init( EMI_Bank_TypeDef* EMI_Bankx, EMI_InitTypeDef* EMI_InitStruct)
-
-{
-
- EMI_Bankx->ICR = EMI_InitStruct-> EMI_Bank_IDCY ;
-
- EMI_Bankx->RCR = EMI_InitStruct->EMI_Bank_WSTRD ;
-
- EMI_Bankx->WCR = EMI_InitStruct->EMI_Bank_WSTWR ;
-
- EMI_Bankx->OECR = EMI_InitStruct->EMI_Bank_WSTROEN;
-
- EMI_Bankx->WECR = EMI_InitStruct->EMI_Bank_WSTWEN ;
-
- EMI_Bankx->BCR &= EMI_MemWidth_Mask;
- EMI_Bankx->BCR |= EMI_InitStruct->EMI_Bank_MemWidth;
-
- EMI_Bankx->BCR &= EMI_WriteProtect_Mask;
- EMI_Bankx->BCR |= EMI_InitStruct->EMI_Bank_WriteProtection;
-
- EMI_Bankx->BCR &= EMI_PageModeRead_TL_Mask;
- EMI_Bankx->BCR |= EMI_InitStruct->EMI_PageModeRead_TransferLength;
-
- EMI_Bankx->BCR &= EMI_PageModeRead_Sel_Mask;
- EMI_Bankx->BCR |= EMI_InitStruct->EMI_PageModeRead_Selection;
-
-
-}
-
-
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_fmi.c b/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_fmi.c
deleted file mode 100644
index fb558ad..0000000
--- a/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_fmi.c
+++ /dev/null
@@ -1,519 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_fmi.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the FMI software functions.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-
-/* Standard include ----------------------------------------------------------*/
-#include "91x_fmi.h"
-
-/* Include of other module interface headers ---------------------------------*/
-/* Local includes ------------------------------------------------------------*/
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-
-#define TIMEOUT 0xFFFFFF /* Timeout value */
-
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/* Interface functions -------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-
-
-/*******************************************************************************
-* Function Name : FMI_BankRemapConfig
-* Description : Configure the addresses and sizes of bank 0 and bank 1.
-* Input1 : FMI_BootBankSize: specifies the boot bank size.
-* This parameter can be one of the following values:
-* - 0x0: 32KBytes.
-* - 0x1: 64KBytes.
-* - 0x2: 128KBytes.
-* - 0x3: 256KBytes.
-* - 0x4: 512KBytes.
-* ....
-* - 0xB: 64MBytes.
-* Input2 : FMI_NonBootBankSize: specifies the non boot bank size.
-* This parameter can be one of the following values:
-* - 0x0: 8KBytes.
-* - 0x1: 16KBytes.
-* - 0x2: 32KBytes.
-* - 0x3: 64KBytes.
-* ....
-* - 0xD: 64MBytes.
-* Input3 : FMI_BootBankAddress: specifies the address of the boot bank.
-* Input4 : FMI_NonBootBankAddress: specifies the address of the non
-* boot bank.
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_BankRemapConfig(u8 FMI_BootBankSize, u8 FMI_NonBootBankSize, \
- u32 FMI_BootBankAddress, u32 FMI_NonBootBankAddress)
-{
- FMI->BBSR = FMI_BootBankSize;
- FMI->NBBSR = FMI_NonBootBankSize;
- FMI->BBADR = (FMI_BootBankAddress >> 2);
- FMI->NBBADR = (FMI_NonBootBankAddress >> 2);
- FMI->CR |= 0x18; /* Enable bank 1 */
-}
-
-/*******************************************************************************
-* Function Name : FMI_Config
-* Description : Configure the FMI.
-* Input1 : FMI_ReadWaitState: specifies the needed read wait states.
-* This parameter can be one of the following values:
-* - FMI_READ_WAIT_STATE_1: One read wait state.
-* - FMI_READ_WAIT_STATE_2: Two read wait states.
-* - FMI_READ_WAIT_STATE_3: Three read wait states.
-* Input2 : FMI_WriteWaitState: specifies the needed write wait states.
-* This parameter can be one of the following values:
-* - FMI_WRITE_WAIT_STATE_1: One write wait state.
-* - FMI_WRITE_WAIT_STATE_2: Two write wait states.
-* Input3 : FMI_PWD: specifies the power down mode status.
-* This parameter can be one of the following values:
-* - FMI_PWD_ENABLE: Enable the PWD.
-* - FMI_PWD_DISABLE: Disable the PWD.
-* Input4 : FMI_LVDEN: specifies the low voltage detector status.
-* This parameter can be one of the following values:
-* - FMI_LVD_ENABLE: Enable the LVD.
-* - FMI_LVD_DISABLE: Disable the LVD.
-* Input5 : FMI_FreqRange: specifies the working frequency range.
-* This parameter can be one of the following values:
-* - FMI_FREQ_LOW: Low working frequency (up to 66MHz).
-* - FMI_FREQ_HIGH: High working frequency (above 66MHz) .
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_Config(u16 FMI_ReadWaitState, u32 FMI_WriteWaitState, u16 FMI_PWD,\
- u16 FMI_LVDEN, u16 FMI_FreqRange)
-{
- /* Configure the write wait state value */
- if (FMI_WriteWaitState == FMI_WRITE_WAIT_STATE_1)
- {
- FMI->CR |= FMI_WRITE_WAIT_STATE_1;
- }
- else
- {
- FMI->CR &= FMI_WRITE_WAIT_STATE_0;
- }
-
- /* Write a write flash configuration register command */
- *(vu16 *)FMI_BANK_1 = 0x60;
-
- /* Configure the flash configuration register */
- *(vu16 *)(FMI_BANK_1|FMI_ReadWaitState|FMI_PWD|FMI_LVDEN|FMI_FreqRange) = 0x03;
-}
-
-/*******************************************************************************
-* Function Name : FMI_EraseSector
-* Description : Erase the needed sector.
-* Input : FMI_Sector: specifies the sector to be erased.
-* This parameter can be one of the following values:
-* - FMI_B0S0: FMI bank 0 sector 0.
-* - FMI_B0S1: FMI bank 0 sector 1.
-* - FMI_B0S2: FMI bank 0 sector 2.
-* - FMI_B0S3: FMI bank 0 sector 3.
-* - FMI_B0S4: FMI bank 0 sector 4.
-* - FMI_B0S5: FMI bank 0 sector 5.
-* - FMI_B0S6: FMI bank 0 sector 6.
-* - FMI_B0S7: FMI bank 0 sector 7.
-* - FMI_B1S0: FMI bank 1 sector 0.
-* - FMI_B1S1: FMI bank 1 sector 1.
-* - FMI_B1S2: FMI bank 1 sector 2.
-* - FMI_B1S3: FMI bank 1 sector 3.
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_EraseSector(vu32 FMI_Sector)
-{
- /* Write an erase set-up command to the sector */
- *(vu16 *)FMI_Sector = 0x20;
-
- /* Write an erase confirm command to the sector */
- *(vu16 *)FMI_Sector = 0xD0;
-}
-
-/*******************************************************************************
-* Function Name : FMI_EraseBank
-* Description : Erase the needed bank.
-* Input : FMI_Bank: specifies the bank to be erased.
-* This parameter can be one of the following values:
-* - FMI_BANK_0: FMI bank 0.
-* - FMI_BANK_1: FMI bank 1.
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_EraseBank(vu32 FMI_Bank)
-{
- /* Write a bank erase set-up command to the bank */
- *(vu16 *)FMI_Bank = 0x80;
-
- /* Write an erase confirm command to the sector */
- *(vu16 *)FMI_Bank = 0xD0;
-}
-
-/*******************************************************************************
-* Function Name : FMI_WriteHalfWord
-* Description : Write a halfword to the needed Flash memory address.
-* Input 1 : FMI_Address: specifies the address offset where the data will
-* be written.
-* Input 2 : FMI_Data: the needed data.
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_WriteHalfWord(u32 FMI_Address, u16 FMI_Data)
-{
- /* Write a program command to the sector to be written */
- *(vu16 *)(FMI_Address & 0xFFFFFFFC) = 0x40;
-
- /* Write the halfword to the destination address */
- *(vu16 *)FMI_Address = FMI_Data;
-}
-
-/*******************************************************************************
-* Function Name : FMI_WriteOTPHalfWord
-* Description : Write a halfword to the needed OTP sector address.
-* Input 1 : FMI_OTPHWAddress: specifies the halfword address offset
-* where the data will be written.
-* This parameter can be one of the following values:
-* - FMI_OTP_LOW_HALFWORD_0: OTP Low halfword 0.
-* - FMI_OTP_HIGH_HALFWORD_0: OTP High halfword 0.
-* - FMI_OTP_LOW_HALFWORD_1: OTP Low halfword 1.
-* - FMI_OTP_HIGH_HALFWORD_1: OTP High halfword 1.
-* - FMI_OTP_LOW_HALFWORD_2: OTP Low halfword 2.
-* - FMI_OTP_HIGH_HALFWORD_2: OTP High halfword 2.
-* - FMI_OTP_LOW_HALFWORD_3: OTP Low halfword 3.
-* - FMI_OTP_HIGH_HALFWORD_3: OTP High halfword 3.
-* - FMI_OTP_LOW_HALFWORD_4: OTP Low halfword 4.
-* - FMI_OTP_HIGH_HALFWORD_4: OTP High halfword 4.
-* - FMI_OTP_LOW_HALFWORD_5: OTP Low halfword 5.
-* - FMI_OTP_HIGH_HALFWORD_5: OTP High halfword 5.
-* - FMI_OTP_LOW_HALFWORD_6: OTP Low halfword 6.
-* - FMI_OTP_HIGH_HALFWORD_6: OTP High halfword 6.
-* - FMI_OTP_LOW_HALFWORD_7: OTP Low halfword 7.
-* - FMI_OTP_HIGH_HALFWORD_7: OTP High halfword 7.
-* Input 2 : FMI_OTPData: The needed OTP data.
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_WriteOTPHalfWord(u8 FMI_OTPHWAddress, u16 FMI_OTPData)
-{
- /* Write a write OTP command to the needed address */
- *(vu16 *)(FMI_BANK_1) = 0xC0;
-
- /* Write the halfword to the destination address */
- *(vu16 *)(FMI_BANK_1 + FMI_OTPHWAddress) = FMI_OTPData;
-}
-
-/*******************************************************************************
-* Function Name : FMI_ReadWord
-* Description : Read the correspondent data.
-* Input : FMI_Address: specifies the needed address.
-* Output : None
-* Return : The data contained in the specified address.
-*******************************************************************************/
-u32 FMI_ReadWord(u32 FMI_Address)
-{
- return(*(u32*)FMI_Address);
-}
-
-/*******************************************************************************
-* Function Name : FMI_ReadOTPData
-* Description : Read data from the OTP sector.
-* Input : FMI_OTPAddress: specifies the address of the data to be read.
-* This parameter can be one of the following values:
-* - FMI_OTP_WORD_0: FMI bank 0 sector 0.
-* - FMI_OTP_WORD_1: FMI bank 0 sector 1.
-* - FMI_OTP_WORD_2: FMI bank 0 sector 2.
-* - FMI_OTP_WORD_3: FMI bank 0 sector 3.
-* - FMI_OTP_WORD_4: FMI bank 0 sector 4.
-* - FMI_OTP_WORD_5: FMI bank 0 sector 5.
-* - FMI_OTP_WORD_6: FMI bank 0 sector 6.
-* - FMI_OTP_WORD_7: FMI bank 0 sector 7.
-* Output : None
-* Return : The needed OTP words.
-*******************************************************************************/
-u32 FMI_ReadOTPData(u8 FMI_OTPAddress)
-{
- u32 OTP_Data = 0x0;
- /* write a read OTP sector command */
- *(vu16 *)(FMI_BANK_1) = 0x98;
-
- /* Read the correspondent data */
- OTP_Data = (*(vu32*)(FMI_BANK_1 + FMI_OTPAddress));
-
- /* Write a read array command */
- *(vu16 *)(FMI_BANK_1) = 0xFF;
-
- return OTP_Data;
-}
-
-/*******************************************************************************
-* Function Name : FMI_GetFlagStatus
-* Description : Check whether the specified FMI flag is set or not.
-* Input1 : FMI_Flag: flag to check.
-* This parameter can be one of the following values:
-* - FMI_FLAG_SPS: Sector Protection Status Flag.
-* - FMI_FLAG_PSS: Program Suspend Status Flag.
-* - FMI_FLAG_PS: Program Status Flag.
-* - FMI_FLAG_ES: Erase Status Flag.
-* - FMI_FLAG_ESS: Erase Suspend Status Flag.
-* - FMI_FLAG_PECS: FPEC Status Flag.
-* Input2 : FMI_Bank: specifies the needed bank.
-* This parameter can be one of the following values:
-* - FMI_BANK_0: FMI bank 0.
-* - FMI_BANK_1: FMI bank 1.
-* Output : None
-* Return : None
-*******************************************************************************/
-FlagStatus FMI_GetFlagStatus(u8 FMI_Flag, vu32 FMI_Bank)
-{
- u16 FMI_Status_Register = 0;
-
- /* Write a read status register command */
- *(vu16 *)FMI_Bank = 0x70;
-
- /* Wait until operation completion */
- while(!((*(vu16 *)FMI_Bank) & 0x80));
-
- /* Read the status register */
- FMI_Status_Register = *(vu16 *)FMI_Bank;
-
- /* Write a read array command */
- *(vu16 *)FMI_Bank = 0xFF;
-
- if((FMI_Status_Register & FMI_Flag) != RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : FMI_GetReadWaitStateValue
-* Description : Get the current Read wait state value.
-* Input : None
-* Output : None
-* Return : The current read wait states value.
-*******************************************************************************/
-u16 FMI_GetReadWaitStateValue(void)
-{
- u16 FMI_Configuration_Register = 0;
- /* Write a read flash configuration register command */
- *(vu16 *)FMI_BANK_1 = 0x90;
-
- /* Read the flash configuration register */
- FMI_Configuration_Register = *(vu16 *)(FMI_BANK_1 + 0x14);
-
- /* Write a read array command */
- *(vu16 *)FMI_BANK_1 = 0xFF;
-
- FMI_Configuration_Register = ((FMI_Configuration_Register>>11) + 1) & 0x3;
-
- /* Return the wait states value */
- return FMI_Configuration_Register;
-}
-
-/*******************************************************************************
-* Function Name : FMI_GetWriteWaitStateValue
-* Description : Get the current write wait state value.
-* Input : None
-* Output : None
-* Return : The current write wait states value.
-*******************************************************************************/
-u16 FMI_GetWriteWaitStateValue(void)
-{
- return ((u16)((FMI->CR & 0x100) >> 8));
-}
-
-/*******************************************************************************
-* Function Name : FMI_SuspendEnable
-* Description : Suspend command enable.
-* Input : FMI_Bank: specifies the bank to be suspended.
-* This parameter can be one of the following values:
-* - FMI_BANK_0: FMI bank 0.
-* - FMI_BANK_1: FMI bank 1.
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_SuspendEnable(vu32 FMI_Bank)
-{
- /* Write a suspend command to the bank */
- *(vu16 *)FMI_Bank = 0xB0;
-}
-
-/*******************************************************************************
-* Function Name : FMI_ResumeEnable
-* Description : Resume the suspended command.
-* Input : FMI_Bank: specifies the suspended bank.
-* This parameter can be one of the following values:
-* - FMI_BANK_0: FMI bank 0.
-* - FMI_BANK_1: FMI bank 1.
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_ResumeEnable(vu32 FMI_Bank)
-{
- /* Write a resume command to the bank */
- *(vu16 *)FMI_Bank = 0xD0;
-}
-
-/*******************************************************************************
-* Function Name : FMI_ClearFlag
-* Description : Clear the FMI Flags on the correspondent bank.
-* Input : FMI_Bank: specifies the needed bank.
-* This parameter can be one of the following values:
-* - FMI_BANK_0: FMI bank 0.
-* - FMI_BANK_1: FMI bank 1.
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_ClearFlag(vu32 FMI_Bank)
-{
- /* Write a clear status register command */
- *(vu16 *)FMI_Bank = 0x50;
-}
-
-/*******************************************************************************
-* Function Name : FMI_WriteProtectionCmd
-* Description : Enable or disable the write protection for the needed sector.
-* Input1 : FMI_Sector: specifies the sector to be protected or
-* unprotected.
-* This parameter can be one of the following values:
-* - FMI_B0S0: FMI bank 0 sector 0.
-* - FMI_B0S1: FMI bank 0 sector 1.
-* - FMI_B0S2: FMI bank 0 sector 2.
-* - FMI_B0S3: FMI bank 0 sector 3.
-* - FMI_B0S4: FMI bank 0 sector 4.
-* - FMI_B0S5: FMI bank 0 sector 5.
-* - FMI_B0S6: FMI bank 0 sector 6.
-* - FMI_B0S7: FMI bank 0 sector 7.
-* - FMI_B1S0: FMI bank 1 sector 0.
-* - FMI_B1S1: FMI bank 1 sector 1.
-* - FMI_B1S2: FMI bank 1 sector 2.
-* - FMI_B1S3: FMI bank 1 sector 3.
-* Input2 : FMI_NewState: specifies the protection status.
-* This parameter can be one of the following values:
-* - ENABLE: Enable the protection.
-* - DISABLE: Disable the protection.
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_WriteProtectionCmd(vu32 FMI_Sector, FunctionalState FMI_NewState)
-{
- if (FMI_NewState == ENABLE)
- {
- *(vu16*)FMI_Sector = 0x60;
- *(vu16*)FMI_Sector = 0x01;
- *(vu16*)FMI_Sector = 0xFF;
- }
- else /* DISABLE */
- {
- *(vu16*)FMI_Sector = 0x60;
- *(vu16*)FMI_Sector = 0xD0;
- *(vu16*)FMI_Sector = 0xFF;
- }
-}
-
-/*******************************************************************************
-* Function Name : FMI_GetWriteProtectionStatus
-* Description : Get the write protection status for the needed sector.
-* Input : FMI_Sector_Mask: specifies the needed sector mask.
-* This parameter can be one of the following values:
-* - FMI_B0S0_MASK: FMI bank 0 sector 0.
-* - FMI_B0S1_MASK: FMI bank 0 sector 1.
-* - FMI_B0S2_MASK: FMI bank 0 sector 2.
-* - FMI_B0S3_MASK: FMI bank 0 sector 3.
-* - FMI_B0S4_MASK: FMI bank 0 sector 4.
-* - FMI_B0S5_MASK: FMI bank 0 sector 5.
-* - FMI_B0S6_MASK: FMI bank 0 sector 6.
-* - FMI_B0S7_MASK: FMI bank 0 sector 7.
-* - FMI_B1S0_MASK: FMI bank 1 sector 0.
-* - FMI_B1S1_MASK: FMI bank 1 sector 1.
-* - FMI_B1S2_MASK: FMI bank 1 sector 2.
-* - FMI_B1S3_MASK: FMI bank 1 sector 3.
-* Output : None
-* Return : The Protection Status of the needed sector.
-* - RESET: The needed sector is not write protected.
-* - SET : The needed sector is write protected.
-*******************************************************************************/
-FlagStatus FMI_GetWriteProtectionStatus(u32 FMI_Sector_Mask)
-{
- u16 Protection_Level_1_Register = 0;
- /* Write a read flash protection level 1 register command */
- *(vu16 *)FMI_BANK_1 = 0x90;
-
- /* Read the flash protection level 1 register */
- Protection_Level_1_Register = *(vu16 *)(FMI_BANK_1 + 0x10);
-
- /* Write a read array command */
- *(vu16 *)FMI_BANK_1 = 0xFF;
-
- if (Protection_Level_1_Register &= FMI_Sector_Mask)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : FMI_WaitForLastOperation
-* Description : Wait until the last operation (Write halfword, Write OTP
-* halfword, Erase sector and Erase bank) completion.
-* Input : FMI_Bank: specifies the bank where the operation is on going.
-* This parameter can be one of the following values:
-* - FMI_BANK_0: FMI bank 0.
-* - FMI_BANK_1: FMI bank 1.
-* Output : None
-* Return : The timeout status.
-* This parameter can be one of the following values:
-* - FMI_TIME_OUT_ERROR: Timeout error occurred.
-* - FMI_NO_TIME_OUT_ERROR: No timeout error.
-*******************************************************************************/
-u8 FMI_WaitForLastOperation(vu32 FMI_Bank)
-{
- u32 Time_Out = 0;
-
- /* Write a read status register command */
- *(vu16 *)(FMI_Bank) = 0x70;
-
- /* Wait until operation compeletion */
- while((!((*(vu16 *)FMI_Bank) & 0x80))&&(Time_Out < TIMEOUT ))
- {
- Time_Out ++; /* Time Out */
- }
-
- /* Write a read array command */
- *(vu16 *)FMI_Bank = 0xFF;
-
- if (Time_Out == TIMEOUT)
- {
- return FMI_TIME_OUT_ERROR;
- }
- else
- {
- return FMI_NO_TIME_OUT_ERROR;
- }
-}
-
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_gpio.c b/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_gpio.c
deleted file mode 100644
index f2d0941..0000000
--- a/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_gpio.c
+++ /dev/null
@@ -1,407 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_gpio.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the GPIO software functions.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_gpio.h"
-#include "91x_scu.h"
-
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
- static u8 GPIO_GetGPIONumber(GPIO_TypeDef* GPIOx);
-
-/* Private functions ---------------------------------------------------------*/
-
-/*******************************************************************************
-* Function Name : GPIO_DeInit
-* Description : Deinitializes the GPIOx peripheral registers to their default
-* reset values.
-* Input : GPIOx: where x can be (0..9) to select the GPIO peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void GPIO_DeInit(GPIO_TypeDef* GPIOx)
-{
-
- /* Reset the GPIO registers values */
- if(GPIOx == GPIO0)
- {
- SCU_APBPeriphReset(__GPIO0,ENABLE);
- SCU_APBPeriphReset(__GPIO0,DISABLE);
- SCU->GPIOTYPE[0x00] = 0x0000 ;
- SCU->GPIOOUT[0x00] = 0x0000;
- SCU->GPIOIN[0x00] = 0x0000;
- }
-
- if(GPIOx == GPIO1)
- {
- SCU_APBPeriphReset(__GPIO1,ENABLE);
- SCU_APBPeriphReset(__GPIO1,DISABLE);
- SCU->GPIOTYPE[0x01] = 0x0000 ;
- SCU->GPIOOUT[0x01] = 0x0000;
- SCU->GPIOIN[0x01] = 0x0000;
- }
-
- if(GPIOx == GPIO2)
- {
- SCU_APBPeriphReset(__GPIO2,ENABLE);
- SCU_APBPeriphReset(__GPIO2,DISABLE);
- SCU->GPIOTYPE[0x02] = 0x0000 ;
- SCU->GPIOOUT[0x02] = 0x0000;
- SCU->GPIOIN[0x02] = 0x0000;
- }
-
- if(GPIOx == GPIO3)
- {
- SCU_APBPeriphReset(__GPIO3,ENABLE);
- SCU_APBPeriphReset(__GPIO3,DISABLE);
- SCU->GPIOTYPE[0x03] = 0x0000 ;
- SCU->GPIOOUT[0x03] = 0x0000;
- SCU->GPIOIN[0x03] = 0x0000;
- }
-
- if(GPIOx == GPIO4)
- {
- SCU_APBPeriphReset(__GPIO4,ENABLE);
- SCU_APBPeriphReset(__GPIO4,DISABLE);
- SCU->GPIOTYPE[0x04] = 0x0000 ;
- SCU->GPIOOUT[0x04] = 0x0000;
- SCU->GPIOIN[0x04] = 0x0000;
- SCU->GPIOANA = 0x00;
- }
-
- if(GPIOx == GPIO5)
- {
- SCU_APBPeriphReset(__GPIO5,ENABLE);
- SCU_APBPeriphReset(__GPIO5,DISABLE);
- SCU->GPIOTYPE[0x05] = 0x0000 ;
- SCU->GPIOOUT[0x05] = 0x0000;
- SCU->GPIOIN[0x05] = 0x0000;
- }
-
- if(GPIOx == GPIO6)
- {
- SCU_APBPeriphReset(__GPIO6,ENABLE);
- SCU_APBPeriphReset(__GPIO6,DISABLE);
- SCU->GPIOTYPE[0x06] = 0x0000 ;
- SCU->GPIOOUT[0x06] = 0x0000;
- SCU->GPIOIN[0x06] = 0x0000;
- }
-
- if(GPIOx == GPIO7)
- {
- SCU_APBPeriphReset(__GPIO7,ENABLE);
- SCU_APBPeriphReset(__GPIO7,DISABLE);
- SCU->GPIOOUT[0x07] = 0xAAAA;
- SCU->GPIOOUT[0x07] = 0x0000;
- SCU->GPIOIN[0x07] = 0x0000;
- }
-
- if(GPIOx == GPIO8)
- {
- SCU_APBPeriphReset(__GPIO8,ENABLE);
- SCU_APBPeriphReset(__GPIO8,DISABLE);
- SCU->GPIOEMI = 0x00;
- }
-
- if(GPIOx == GPIO9)
- {
- SCU_APBPeriphReset(__GPIO9,ENABLE);
- SCU_APBPeriphReset(__GPIO9,DISABLE);
- SCU->GPIOEMI = 0x00;
- }
-}
-/*******************************************************************************
-* Function Name : GPIO_Init
-* Description : Initializes the GPIOx peripheral according to the specified
-* parameters in the GPIO_InitStruct .
-* Input :- GPIOx: where x can be (0..9) to select the GPIO peripheral.
-* - GPIO_InitStruct: pointer to a GPIO_InitTypeDef structure that
-* contains the configuration information for the specified GPIO
-* peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct)
-{
- /* Select pin direction */
- u8 PinNumber = 0;
- u8 Counter = 0;
- u8 GPIO_Number = 0;
-
- GPIO_Number = GPIO_GetGPIONumber(GPIOx);
-
-
- if(GPIO_InitStruct->GPIO_Direction == GPIO_PinOutput)
- {
- GPIOx->DDR |= GPIO_InitStruct->GPIO_Pin;
- }
- else
- {
- GPIOx->DDR &= ~GPIO_InitStruct->GPIO_Pin;
- }
-
- for (Counter = 0; Counter < 8;Counter++)
- {
- /*Search pin number*/
- PinNumber = (GPIO_InitStruct->GPIO_Pin & (1 <<Counter));
- if((PinNumber >> Counter) == 1)
- {
- /*Output ALternate 0*/
- SCU->GPIOOUT[GPIO_Number] &= ~(0x3 <<(Counter *2));
- if(GPIO_InitStruct->GPIO_Alternate == GPIO_OutputAlt1)
- {
- /*Output ALternate 1*/
- SCU->GPIOOUT[GPIO_Number] |= 1 << (Counter *2);
- }
- if(GPIO_InitStruct->GPIO_Alternate == GPIO_OutputAlt2)
- {
- /*Output ALternate 2*/
- SCU->GPIOOUT[GPIO_Number] |= 0x2 << (Counter *2);
- }
- if(GPIO_InitStruct->GPIO_Alternate == GPIO_OutputAlt3)
- {
- /*Output ALternate 3*/
- SCU->GPIOOUT[GPIO_Number] |= 0x3 << (Counter *2);
- }
-
- /*Type configuration: PushPull or Open Collector*/
- SCU->GPIOTYPE[GPIO_Number] &= ~(0x1 << Counter) ;
- if(GPIO_InitStruct->GPIO_Type == GPIO_Type_OpenCollector)
- {
- /*Open Drain configuration*/
- SCU->GPIOTYPE[GPIO_Number] |= 0x1 << Counter;
- }
-
- /*IP Connected disable*/
- SCU->GPIOIN[GPIO_Number] &= ~(0x1 << Counter) ;
- if(GPIO_InitStruct->GPIO_IPConnected == GPIO_IPConnected_Enable)
- {
- /*IP Connected enable*/
- SCU->GPIOIN[GPIO_Number] |= 0x1 << Counter;
- }
- }
- }
-}
-
-/*******************************************************************************
-* Function Name : GPIO_StructInit
-* Description : Initialize the GPIO Init Structure parameters
-* Input : GPIO_InitStruct : pointer to a GPIO_InitTypeDef structure
-* which will be initialized.
-* Output : None
-* Return : None
-*******************************************************************************/
-void GPIO_StructInit(GPIO_InitTypeDef* GPIO_InitStruct)
-{
- /* Reset GPIO init structure parameters values */
- GPIO_InitStruct->GPIO_Pin = GPIO_Pin_All;
- GPIO_InitStruct->GPIO_Direction = GPIO_PinInput;
- GPIO_InitStruct->GPIO_Type = GPIO_Type_PushPull;
- GPIO_InitStruct->GPIO_IPConnected = GPIO_IPConnected_Disable;
- GPIO_InitStruct->GPIO_Alternate = GPIO_InputAlt1;
-}
-
-/*******************************************************************************
-* Function Name : GPIO_ReadBit
-* Description : Reads the specified port pin
-* Input : - GPIOx: where x can be (0..9) to select the GPIO peripheral.
-* : - GPIO_Pin: the Pin number. This parameter can be GPIO_Pin_x
-* where x can be (0..7).
-* Output : None
-* Return : The port pin value
-*******************************************************************************/
-u8 GPIO_ReadBit(GPIO_TypeDef* GPIOx, u8 GPIO_Pin)
-{
- if ((((GPIOx->DR[GPIO_Pin<<2])) & GPIO_Pin) != Bit_RESET )
- {
- return Bit_SET;
- }
- else
- {
- return Bit_RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : GPIO_Read
-* Description : Reads the specified GPIO data port
-* Input : - GPIOx: where x can be (0..9) to select the GPIO peripheral.
-* Output : None
-* Return : GPIO data port word value.
-*******************************************************************************/
-u8 GPIO_Read(GPIO_TypeDef* GPIOx)
-{
- return (GPIOx->DR[0x3FC]);
-}
-
-/*******************************************************************************
-* Function Name : GPIO_WriteBit
-* Description : Sets or clears the selected data port bit.
-* Input : - GPIOx: where x can be (0..9) to select the GPIO peripheral.
-* - GPIO_Pin: the Pin number. This parameter can be GPIO_Pin_x
-* where x can be (0..7).
-* - BitVal: this parameter specifies the value to be written
-* to the selected bit.
-* BitVal must be one of the BitAction enum values:
-* - Bit_RESET: to clear the port pin
-* - Bit_SET: to set the port pin
-* Output : None
-* Return : None
-*******************************************************************************/
-void GPIO_WriteBit(GPIO_TypeDef* GPIOx, u8 GPIO_Pin, BitAction BitVal)
-{
- if(BitVal == Bit_SET)
- {
- GPIOx->DR[GPIO_Pin <<2] = GPIO_Pin;
- }
- else
- {
- GPIOx->DR[GPIO_Pin <<2] = 0x00;
- }
-}
-
-/*******************************************************************************
-* Function Name : GPIO_Write
-* Description : Writes the passed value in the selected data GPIOx port
-* register.
-* Input :- GPIOx: where x can be (0..9) to select the GPIO peripheral.
-* - PortVal: the value to be written to the data port register.
-* Output : None
-* Return : None
-*******************************************************************************/
-void GPIO_Write(GPIO_TypeDef* GPIOx, u8 PortVal)
-{
- GPIOx->DR[0x3FC] = PortVal;
-}
-
-/*******************************************************************************
-* Function Name : GPIO_EMIConfig
-* Description : Enables or disables GPIO 8 and 9 in EMI mode.
-* Input : - NewState: new state of the EMI.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void GPIO_EMIConfig(FunctionalState NewState)
-{
- if(NewState == ENABLE)
- {
- SCU->GPIOEMI = 0x01;
- }
- else
- {
- SCU->GPIOEMI = 0x00;
- }
-}
-
-/*******************************************************************************
-* Function Name : GPIO_ANAPinConfig
-* Description : Enables or disables pins from GPIO 4 in Analogue mode.
-* Input :- GPIO_ANAChannel: selects the ADC channel pin.
-* This parameter can be one of the following values:
-* GPIO_ANAChannel0
-* GPIO_ANAChannel1
-* GPIO_ANAChannel2
-* GPIO_ANAChannel3
-* GPIO_ANAChannel4
-* GPIO_ANAChannel5
-* GPIO_ANAChannel6
-* GPIO_ANAChannel7
-* GPIO_ANAChannelALL
-* - NewState: new state of the port pin.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void GPIO_ANAPinConfig(u8 GPIO_ANAChannel, FunctionalState NewState)
-{
-
- if(NewState == ENABLE)
- {
- if(GPIO_ANAChannel == GPIO_ANAChannelALL)
- {
- SCU->GPIOOUT[4] = 0x0000;
- SCU->GPIOIN[4] = 0x00;
- }
- else
- {
- SCU->GPIOOUT[4] &= ~(0x3<<(GPIO_ANAChannel-1));
- SCU->GPIOIN[4] &= ~GPIO_ANAChannel;
- }
- SCU->GPIOANA |= GPIO_ANAChannel;
-
- }
- else
- {
- SCU->GPIOANA &= ~GPIO_ANAChannel;
- }
-}
-
-/*******************************************************************************
-* Function Name : GPIO_GetGPIONumber
-* Description : searche the GPIO number.
-* Input : GPIOx: where x can be (0..9) to select the GPIO peripheral.
-* Output : None
-* Return : GPIO number
-*******************************************************************************/
-u8 GPIO_GetGPIONumber(GPIO_TypeDef* GPIOx)
-{
-
- if(GPIOx == GPIO1)
- {
- return 1;
- }
- if(GPIOx == GPIO2)
- {
- return 2;
- }
- if(GPIOx == GPIO3)
- {
- return 3;
- }
- if(GPIOx == GPIO4)
- {
- return 4;
- }
- if(GPIOx == GPIO5)
- {
- return 5;
- }
- if(GPIOx == GPIO6)
- {
- return 6;
- }
- if(GPIOx == GPIO7)
- {
- return 7;
- }
- if(GPIOx == GPIO8)
- {
- return 8;
- }
- if(GPIOx == GPIO9)
- {
- return 9;
- }
- return 0;
-}
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_i2c.c b/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_i2c.c
deleted file mode 100644
index 9f15adb..0000000
--- a/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_i2c.c
+++ /dev/null
@@ -1,616 +0,0 @@
-/******************** (C) COPYRIGHT 2005 STMicroelectronics ********************
-* File Name : 91x_i2c.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the I2C software functions.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_i2c.h"
-#include "91x_scu.h"
-
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-
-/* I2C IT enable */
-#define I2C_IT_Enable 0x01
-#define I2C_IT_Disable 0xFE
-
-/* I2C Peripheral Enable/Disable */
-#define I2C_PE_Set 0x20
-#define I2C_PE_Reset 0xDF
-
-/* Address direction bit */
-#define I2C_ADD0_Set 0x01
-#define I2C_ADD0_Reset 0xFE
-
-/* I2C START Enable/Disable */
-#define I2C_Start_Enable 0x08
-#define I2C_Start_Disable 0xF7
-
-/* I2C STOP Enable/Disable */
-#define I2C_Stop_Enable 0x02
-#define I2C_Stop_Disable 0xFD
-
-/* I2C Masks */
-#define I2C_Frequency_Mask 0x1F
-#define I2C_AddressHigh_Mask 0xF9
-#define I2C_OwnAddress_Mask 0x0300
-#define I2C_StandardMode_Mask 0x7f
-#define I2C_FastMode_Mask 0x80
-#define I2C_Event_Mask 0x3FFF
-#define I2C_HeaderSet_Mask 0xF1
-#define I2C_HeaderReset_Mask 0xFE
-
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/*******************************************************************************
-* Function Name : I2C_DeInit
-* Description : Deinitializes the I2C peripheral registers to their default
-* reset values.
-* Input :- I2Cx: I2C peripheral can be:
-* - I2C0
-* - I2C1
-* Output : None
-* Return : None
-*******************************************************************************/
-void I2C_DeInit(I2C_TypeDef* I2Cx)
-{
- if (I2Cx == I2C0)
- {
- /* Reset the I2C0 registers values */
- SCU_APBPeriphReset(__I2C0, ENABLE);
- SCU_APBPeriphReset(__I2C0, DISABLE);
- }
- if (I2Cx == I2C1)
- {
- /* Reset the I2C1 registers values */
- SCU_APBPeriphReset(__I2C1, ENABLE);
- SCU_APBPeriphReset(__I2C1, DISABLE);
- }
-}
-
-/*******************************************************************************
-* Function Name : I2C_Init
-* Description : Initializes the I2C peripheral according to the specified
-* parameters in the I2C_InitTypeDef structure.
-* Input :- I2Cx: I2C peripheral can be:
-* - I2C0
-* - I2C1
-*
-* - I2C_InitStruct: pointer to an I2C_InitTypeDef structure that
-* contains the configuration information for the specified I2C
-* peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void I2C_Init(I2C_TypeDef* I2Cx, I2C_InitTypeDef* I2C_InitStruct)
-{
- u16 wResult = 0x0F;
- u32 dPCLK = 25000000;
-
- /* Get PCLK frequency value */
- dPCLK = SCU_GetPCLKFreqValue()*1000;
- /* Disable I2C peripheral to set FR[2:0] bits */
- I2C_Cmd (I2Cx, DISABLE);
- /* Clear frequency FR[2:0] bits */
- I2Cx->OAR2 &= I2C_Frequency_Mask;
- /* Set frequency bits depending on PCLK value */
- if ((dPCLK <1667000) & (dPCLK > 10000000))
- I2Cx->OAR2 |= 0x20;
- else if (dPCLK < 26670000)
- I2Cx->OAR2 |= 0x40;
- else if (dPCLK < 40000000)
- I2Cx->OAR2 |= 0x60;
- else if (dPCLK < 53330000)
- I2Cx->OAR2 |= 0x80;
- else if (dPCLK < 66000000)
- I2Cx->OAR2 |= 0xA0;
- else if (dPCLK < 80000000)
- I2Cx->OAR2 |= 0xC0;
- else if (dPCLK < 100000000)
- I2Cx->OAR2 |= 0xE0;
- I2C_Cmd (I2Cx, ENABLE);
-
- /* Configure general call */
- if (I2C_InitStruct->I2C_GeneralCall == I2C_GeneralCall_Enable)
- {
- /* Enable general call */
- I2Cx->CR |= I2C_GeneralCall_Enable;
- }
- else
- {
- /* Disable general call */
- I2Cx->CR &= I2C_GeneralCall_Disable;
- }
- /* Configure acknowledgement */
- if (I2C_InitStruct->I2C_Ack == I2C_Ack_Enable)
- {
- /* Enable acknowledgement */
- I2Cx->CR |= I2C_Ack_Enable;
- }
- else
- {
- /* Disable acknowledgement */
- I2Cx->CR &= I2C_Ack_Disable;
- }
-
- /* Configure LSB own address */
- I2Cx->OAR1 = I2C_InitStruct->I2C_OwnAddress;
- /* Clear MSB own address ADD[9:8] bits */
- I2Cx->OAR2 &= I2C_AddressHigh_Mask;
- /* Set MSB own address value */
- I2Cx->OAR2 |= (I2C_InitStruct->I2C_OwnAddress & I2C_OwnAddress_Mask)>>7;
-
- /* Configure speed in standard mode */
- if (I2C_InitStruct->I2C_CLKSpeed <= 100000)
- {
- /* Standard mode speed calculate */
- wResult = ((dPCLK/I2C_InitStruct->I2C_CLKSpeed)-7)/2;
- /* Set speed value and clear FM/SM bit for standard mode in LSB clock divider */
- I2Cx->CCR = wResult & I2C_StandardMode_Mask;
- }
- /* Configure speed in fast mode */
- else if (I2C_InitStruct->I2C_CLKSpeed <= 400000)
- {
- /* Fast mode speed calculate */
- wResult = ((dPCLK/I2C_InitStruct->I2C_CLKSpeed)-9)/3;
- /* Set speed value and set FM/SM bit for fast mode in LSB clock divider */
- I2Cx->CCR = wResult | I2C_FastMode_Mask;
- }
- /* Set speed in MSB clock divider */
- I2Cx->ECCR = wResult >>7;
-}
-
-/*******************************************************************************
-* Function Name : I2C_StructInit
-* Description : Initialize the I2C Init Structure parameters
-* Input : - I2C_InitStruct: pointer to an I2C_InitTypeDef structure
- which will be initialized.
-* Output : None
-* Return : None.
-*******************************************************************************/
-void I2C_StructInit(I2C_InitTypeDef* I2C_InitStruct)
-{
- /* Initialize the I2C_CLKSpeed member */
- I2C_InitStruct->I2C_CLKSpeed = 5000;
-
- /* Initialize the I2C_OwnAddress member */
- I2C_InitStruct->I2C_OwnAddress = 0x0;
-
- /* Initialize the I2C_GeneralCall member */
- I2C_InitStruct->I2C_GeneralCall = I2C_GeneralCall_Disable;
-
- /* Initialize the I2C_Ack member */
- I2C_InitStruct->I2C_Ack = I2C_Ack_Disable;
-}
-
-/*******************************************************************************
-* Function Name : I2C_Cmd
-* Description : Enables or disables the specified I2C peripheral.
-* Input :- I2Cx: I2C peripheral can be:
-* - I2C0
-* - I2C1
-* - NewState: new state of the I2C peripheral. This parameter
-* can be: ENABLE or DISABLE.
-* Output : None
-* Return : None.
-*******************************************************************************/
-void I2C_Cmd(I2C_TypeDef* I2Cx, FunctionalState NewState)
-{
- if (NewState == ENABLE)
- {
- /* Enable the I2C peripheral by setting twice the PE bit on the CR register */
- I2Cx->CR |= I2C_PE_Set;
- I2Cx->CR |= I2C_PE_Set;
- }
- else
- {
- /* Disable the I2C peripheral */
- I2Cx->CR &= I2C_PE_Reset;
- }
-}
-
-/*******************************************************************************
-* Function Name : I2C_GenerateSTART
-* Description : Generates I2C communication START condition.
-* Input :- I2Cx: I2C peripheral can be:
-* - I2C0
-* - I2C1
-*
-* - NewState: new state of the Start condition. This parameter
-* can be: ENABLE or DISABLE.
-* Output : None
-* Return : None.
-*******************************************************************************/
-void I2C_GenerateStart(I2C_TypeDef* I2Cx, FunctionalState NewState)
-{
- if (NewState == ENABLE)
- {
- /* Generate a START condition */
- I2Cx->CR |= I2C_Start_Enable;
- }
- else
- {
- /* Disable the START condition generation */
- I2Cx->CR &= I2C_Start_Disable;
- }
-}
-
-/*******************************************************************************
-* Function Name : I2C_GenerateSTOP
-* Description : Generates I2C communication STOP condition.
-* Input :- I2Cx: I2C peripheral can be:
-* - I2C0
-* - I2C1
-*
-* - NewState: new state of the Stop condition. This parameter
-* can be: ENABLE or DISABLE.
-* Output : None
-* Return : None.
-*******************************************************************************/
-void I2C_GenerateSTOP(I2C_TypeDef* I2Cx, FunctionalState NewState)
-{
- if (NewState == ENABLE)
- {
- /* Generate a SIOP condition */
- I2Cx->CR |= I2C_Stop_Enable;
- }
- else
- {
- /* Disable the STOP condition generation */
- I2Cx->CR &= I2C_Stop_Disable;
- }
-}
-
-/*******************************************************************************
-* Function Name : I2C_AcknowledgeConfig
-* Description : Enables or disables I2C acknowledge feature.
-* Input :- I2Cx: I2C peripheral can be:
-* - I2C0
-* - I2C1
-* - NewState: new state of the Acknowledgement. This parameter
-* can be: ENABLE or DISABLE.
-* Output : None
-* Return : None.
-*******************************************************************************/
-void I2C_AcknowledgeConfig(I2C_TypeDef *I2Cx, FunctionalState NewState)
-{
- if (NewState == ENABLE)
- {
- /* Enable the acknowledgement */
- I2Cx->CR |= I2C_Ack_Enable;
- }
- else
- {
- /* Disable the acknowledgement */
- I2Cx->CR &= I2C_Ack_Disable;
- }
-}
-
-/*******************************************************************************
-* Function Name : I2C_ITConfig
-* Description : Enables or disables I2C interrupt feature.
-* Input :- I2Cx: I2C peripheral can be:
-* - I2C0
-* - I2C1
-* - NewState: new state of the specified I2C interrupt.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None.
-*******************************************************************************/
-void I2C_ITConfig(I2C_TypeDef *I2Cx, FunctionalState NewState)
-{
- if (NewState == ENABLE)
- {
- /* Enable the I2C interrupt */
- I2Cx->CR |= I2C_IT_Enable;
- }
- else
- {
- /* Disable the I2C interrupt */
- I2Cx->CR &= I2C_IT_Disable;
- }
-}
-
-/*******************************************************************************
-* Function Name : I2C_ReadRegister
-* Description : Reads any I2C register and returns its value.
-* Input :- I2Cx: I2C peripheral can be:
-* - I2C0
-* - I2C1
-* - I2C_Register: the I2C register to be read. This parameter
-* can be one of the following values:
-* - I2C_CR: CR register.
-* - I2C_SR1: SR1 register.
-* - I2C_SR2: SR2 register.
-* - I2C_CCR: CCR register.
-* - I2C_OAR1: OAR1 register.
-* - I2C_OAR2: OAR2 register.
-* - I2C_DR: DR register.
-* - I2C_ECCR: ECCR register.
-* Output : None
-* Return : The value of the register passed as parameter
-*******************************************************************************/
-u8 I2C_ReadRegister(I2C_TypeDef* I2Cx, u8 I2C_Register)
-{
- /* Return the selected register value */
- if (I2Cx == I2C0)
- {
- return (*(u8 *)(I2C0_BASE + I2C_Register));
- }
- if (I2Cx == I2C1)
- {
- return (*(u8 *)(I2C1_BASE + I2C_Register));
- }
- return 0;
-}
-
-/*******************************************************************************
-* Function Name : I2C_GetFlagStatus
-* Description : Checks whether the specified I2C flag is set or not.
-* Input :- I2Cx: I2C peripheral can be:
-* - I2C0
-* - I2C1
-* - I2C_FLAG: flag to check. This parameter can be one of the
-* following values:
-* - I2C_FLAG_SB: Start bit flag
-* - I2C_FLAG_M_SL: Master/Slave flag
-* - I2C_FLAG_ADSL: Adress matched flag
-* - I2C_FLAG_BTF: Byte transfer finished flag
-* - I2C_FLAG_BUSY: Bus busy flag
-* - I2C_FLAG_TRA: Transmitter/Receiver flag
-* - I2C_FLAG_ADD10: 10-bit addressing in Master mode flag
-* - I2C_FLAG_EVF: Event flag
-* - I2C_FLAG_GCAL: General call flag
-* - I2C_FLAG_BERR: Bus error flag
-* - I2C_FLAG_ARLO: Arbitration lost flag
-* - I2C_FLAG_STOPF: Stop detection flag
-* - I2C_FLAG_AF: Acknowledge failure flag
-* - I2C_FLAG_ENDAD: End of address transmission flag
-* - I2C_FLAG_ACK: Acknowledge enable flag
-* Output : None
-* Return : The NewState of the I2C_Flag (SET or RESET).
-*******************************************************************************/
-FlagStatus I2C_GetFlagStatus(I2C_TypeDef* I2Cx, u16 I2C_FLAG)
-{
- u16 wFlag1=0, wFlag2=0, wTmp=0;
-
- wFlag1 = I2Cx->SR2;
- wFlag1 = wFlag1<<8;
- wFlag2 = I2Cx->CR & 0x04;
-
- /* Get all the I2C flags in a unique register*/
- wTmp = (((I2Cx->SR1 | (wFlag1)) & I2C_Event_Mask) | (wFlag2<<12));
-
- /* Check the status of the specified I2C flag */
- if((wTmp & I2C_FLAG) != RESET)
- {
- /* Return SET if I2C_FLAG is set */
- return SET;
- }
- else
- {
- /* Return RESET if I2C_FLAG is reset */
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : I2C_ClearFlag
-* Description : Clears the I2C Flag passed as a parameter
-* Input :- I2Cx: I2C peripheral can be:
-* - I2C0
-* - I2C1
-* - I2C_FLAG: flag to check. This parameter can be one of the
-* following values:
-* - I2C_FLAG_SB: Start bit flag
-* - I2C_FLAG_M_SL: Master/Slave flag
-* - I2C_FLAG_ADSL: Adress matched flag
-* - I2C_FLAG_BTF: Byte transfer finished flag
-* - I2C_FLAG_BUSY: Bus busy flag
-* - I2C_FLAG_TRA: Transmitter/Receiver flag
-* - I2C_FLAG_ADD10: 10-bit addressing in Master mode flag
-* - I2C_FLAG_EVF: Event flag
-* - I2C_FLAG_GCAL: General call flag
-* - I2C_FLAG_BERR: Bus error flag
-* - I2C_FLAG_ARLO: Arbitration lost flag
-* - I2C_FLAG_STOPF: Stop detection flag
-* - I2C_FLAG_AF: Acknowledge failure flag
-* - I2C_FLAG_ENDAD: End of address transmission flag
-* - I2C_FLAG_ACK: Acknowledge enable flag
-* - parameter needed in the case that the flag to be cleared
-* need a write in one register
-* Output : None
-* Return : None.
-*******************************************************************************/
-void I2C_ClearFlag(I2C_TypeDef* I2Cx, u16 I2C_FLAG, ...)
-{
- u8 bTmp = (u8)*((u32 *) & I2C_FLAG + sizeof(I2C_FLAG));
-
- /* flags that need a read of the SR2 register to be cleared */
- if ((I2C_FLAG==I2C_FLAG_ADD10) || (I2C_FLAG==I2C_FLAG_EVF) || (I2C_FLAG==I2C_FLAG_BERR) || (I2C_FLAG==I2C_FLAG_ARLO) |
- (I2C_FLAG==I2C_FLAG_STOPF) ||(I2C_FLAG==I2C_FLAG_AF) || (I2C_FLAG==I2C_FLAG_ENDAD))
- {
- /* Read the SR2 register */
- I2Cx->SR2;
-
- /* Two flags need a second step to be cleared */
- switch (I2C_FLAG)
- {
- case I2C_FLAG_ADD10:
- /* Send the MSB 10bit address passed as second parameter */
- I2Cx->DR = bTmp;
- break;
- case I2C_FLAG_ENDAD:
- /* Write to the I2C_CR register by setting PE bit */
- I2Cx->CR |= I2C_PE_Set;
- break;
- }
- }
-
- /* flags that need a read of the SR1 register to be cleared */
- else if (I2C_FLAG==I2C_FLAG_SB || I2C_FLAG==I2C_FLAG_ADSL || I2C_FLAG==I2C_FLAG_BTF || I2C_FLAG==I2C_FLAG_TRA)
- {
- /* Read the SR1 register */
- (void)I2Cx->SR1;
-
- /* three flags need a second step to be cleared */
- if (I2C_FLAG == I2C_FLAG_SB)
- {
- /* Send the address byte passed as second parameter */
- I2Cx->DR = bTmp;
- }
- else if (I2C_FLAG==I2C_FLAG_BTF || I2C_FLAG==I2C_FLAG_TRA)
- {
- /* return the received byte in the variable passed as second parameter */
- bTmp=I2Cx->DR;
- }
- }
-
- /* flags that need to disable the I2C interface */
- else if ( I2C_FLAG==I2C_FLAG_M_SL || I2C_FLAG==I2C_FLAG_GCAL)
- {
- I2C_Cmd(I2Cx, DISABLE);
- I2C_Cmd(I2Cx, ENABLE);
- }
-}
-
-/*******************************************************************************
-* Function Name : I2C_Send7bitAddress
-* Description : Transmits the address byte to select the slave device.
-* Input :- I2Cx: I2C peripheral can be:
-* - I2C0
-* - I2C1
-* - Address: specifies the slave address which will be transmitted
-* - Direction: specifies whether the I2C device will be a
-* Transmitter or a Receiver. This parameter can be one of the
-* following values
-* - I2C_MODE_TRANSMITTER: Transmitter mode
-* - I2C_MODE_RECEIVER: Receiver mode
-* Output : None
-* Return : None.
-*******************************************************************************/
-void I2C_Send7bitAddress(I2C_TypeDef* I2Cx, u8 Address, u8 Direction)
-{
- /* Test on the direction to define the read/write bit */
- if (Direction == I2C_MODE_RECEIVER)
- {
- /* Set the address bit0 for read */
- Address |= I2C_ADD0_Set;
- }
- else
- {
- /* Reset the address bit0 for write */
- Address &= I2C_ADD0_Reset;
- }
- /* Send the address */
- I2Cx->DR = Address;
-}
-
-/*******************************************************************************
-* Function Name : I2C_SendData
-* Description : Send a data byte.
-* Input :- I2Cx: I2C peripheral can be:
-* - I2C0
-* - I2C1
-* - bData : the byte to be sent
-* Output : None
-* Return : None.
-*******************************************************************************/
-void I2C_SendData(I2C_TypeDef* I2Cx, u8 bData)
-{
- /* Write in the DR register the byte to be sent */
- I2Cx->DR = bData;
-}
-
-/*******************************************************************************
-* Function Name : I2C_ReceiveData
-* Description : Read the received byte.
-* Input : - I2Cx: I2C peripheral can be:
-* - I2C0
-* - I2C1
-* Output : None
-* Return : The received byte
-*******************************************************************************/
-u8 I2C_ReceiveData(I2C_TypeDef* I2Cx)
-{
- /* Return from the DR register the received byte */
- return I2Cx->DR;
-}
-
-/*******************************************************************************
-* Function Name : I2C_GetLastEvent
-* Description : Get the Last happened I2C Event.
-* Input :- I2Cx: I2C peripheral can be:
-* - I2C0
-* - I2C1
-* Output : None
-* Return : The Last happened Event.
-*******************************************************************************/
-u16 I2C_GetLastEvent(I2C_TypeDef* I2Cx)
-{
- u16 wFlag1=0, wLastEvent=0;
- wFlag1 = I2Cx->SR2;
- wFlag1 = wFlag1<<8;
- /* Get the last event value from I2C status register */
- wLastEvent = (((I2Cx->SR1 | (wFlag1)) & I2C_Event_Mask));
- /* Return the last event */
- return wLastEvent;
-}
-
-/*******************************************************************************
-* Function Name : I2C_CheckEvent
-* Description : Checks whether the Last I2C Event is equal to the one passed
-* as parameter.
-* Input :- I2Cx: I2C peripheral can be:
-* - I2C0
-* - I2C1
-* - I2C_EVENT: the event to check. This parameter can be one of
-* the following values:
-* - I2C_EVENT_SLAVE_ADDRESS_MATCHED
-* - I2C_EVENT_SLAVE_BYTE_RECEIVED
-* - I2C_EVENT_SLAVE_BYTE_TRANSMITTED
-* - I2C_EVENT_MASTER_MODE_SELECT
-* - I2C_EVENT_MASTER_MODE_SELECTED
-* - I2C_EVENT_MASTER_BYTE_RECEIVED
-* - I2C_EVENT_MASTER_BYTE_TRANSMITTED
-* - I2C_EVENT_MASTER_MODE_ADDRESS10
-* - I2C_EVENT_SLAVE_STOP_DETECTED
-* - I2C_EVENT_SLAVE_ACK_FAILURE
-* Output : None
-* Return : An ErrorStatus enumuration value:
-* - SUCCESS: Last event is equal to the I2C_Event
-* - ERROR: Last event is different from the I2C_Event
-*******************************************************************************/
-ErrorStatus I2C_CheckEvent(I2C_TypeDef* I2Cx,u16 I2C_EVENT)
-{
- u16 wLastEvent = I2C_GetLastEvent(I2Cx);
-
- /* Check whther the last event is equal to I2C_EVENT */
- if (wLastEvent == I2C_EVENT)
- {
- /* Return SUCCESS when last event is equal to I2C_EVENT */
- return SUCCESS;
- }
- else
- {
- /* Return ERROR when last event is different from I2C_EVENT */
- return ERROR;
- }
-}
-
-/******************* (C) COPYRIGHT 2005 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_lib.c b/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_lib.c
deleted file mode 100644
index 3fab413..0000000
--- a/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_lib.c
+++ /dev/null
@@ -1,281 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_lib.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all peripherals pointers
- : initialization.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-#define EXT
-
-/* Standard include ----------------------------------------------------------*/
-#include "91x_map.h"
-
-/* Include of other module interface headers ---------------------------------*/
-/* Local includes ------------------------------------------------------------*/
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/* Interface functions -------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-#ifdef LIBDEBUG
-
-/*******************************************************************************
-* Function Name : debug
-* Description : this function initialize peripherals pointers
-* Input : no one
-* Output : no one
-* Return : no one
-*******************************************************************************/
-void libdebug(void)
-{
-
-
-/************************* DMA *************************/
-
-#ifdef _DMA
- DMA = (DMA_TypeDef *)DMA_BASE;
-#endif /* _DMA */
-
-/************************* DMA *************************/
-
-
-#ifdef _DMA_Channel0
- DMA_Channel0= (DMA_Channel_TypeDef *)DMA_Channel0_BASE;
-#endif /* _DMA_Channel0 */
-
-#ifdef _DMA_Channel1
- DMA_Channel1= (DMA_Channel_TypeDef *)DMA_Channel1_BASE;
-#endif /* _DMA_Channel1 */
-
-#ifdef _DMA_Channel2
- DMA_Channel2 = (DMA_Channel_TypeDef *)DMA_Channel2_BASE;
-#endif /* _DMA_Channel2 */
-
-#ifdef _DMA_Channel3
- DMA_Channel3 = (DMA_Channel_TypeDef *)DMA_Channel3_BASE;
-#endif /* _DMA_Channel3 */
-
-#ifdef _DMA_Channel4
- DMA_Channel4 = (DMA_Channel_TypeDef *)DMA_Channel4_BASE;
-#endif /* _DMA_Channel4 */
-
-#ifdef _DMA_Channel5
- DMA_Channel5= (DMA_Channel_TypeDef *)DMA_Channel5_BASE;
-#endif /* _DMA_Channel5*/
-
-
-#ifdef _DMA_Channel6
- DMA_Channel6 = (DMA_Channel_TypeDef *)DMA_Channel6_BASE;
-#endif /* _DMA_Channel6 */
-
-#ifdef _DMA_Channel7
- DMA_Channel7 = (DMA_Channel_TypeDef *)DMA_Channel7_BASE;
-#endif /* _DMA_Channel7 */
-
-
-
- /************************* EMI *************************/
-
-#ifdef _EMI_Bank0
- EMI_Bank0= (EMI_Bank_TypeDef *)EMI_Bank0_BASE;
-#endif /* _EMI_Bank0 */
-
-#ifdef _EMI_Bank1
- EMI_Bank1= (EMI_Bank_TypeDef *)EMI_Bank1_BASE;
-#endif /* _EMI_Bank1 */
-
-#ifdef _EMI_Bank2
- EMI_Bank2 = (EMI_Bank_TypeDef *)EMI_Bank2_BASE;
-#endif /* _EMI_Bank2 */
-
-#ifdef _EMI_Bank3
- EMI_Bank3 = (EMI_Bank_TypeDef *)EMI_Bank3_BASE;
- #endif /* _EMI_Bank3 */
-
-
-
-/************************* AHBAPB *************************/
-
-#ifdef _AHBAPB0
- AHBAPB0 = (AHBAPB_TypeDef *)AHBAPB0_BASE;
-#endif /* _AHBAPB0 */
-
-#ifdef _AHBAPB1
- AHBAPB1 = (AHBAPB_TypeDef *)AHBAPB1_BASE;
-#endif /*_AHBAPB1 */
-
-
-
-/************************* FMI *************************/
-
-#ifdef _FMI
- FMI = (FMI_TypeDef *)FMI_BASE;
-#endif /* _FMI */
-
-/************************* VIC *************************/
-
-#ifdef _VIC0
- VIC0 = (VIC_TypeDef *)VIC0_BASE;
-#endif /* _VIC0 */
-
-#ifdef _VIC1
- VIC1 = (VIC_TypeDef *)VIC1_BASE;
-#endif /* _VIC1 */
-
-/************************* WIU *************************/
-
-#ifdef _WIU
- WIU = (WIU_TypeDef *)WIU_BASE;
-#endif /* _WIU */
-
-/************************* TIM *************************/
-
-#ifdef _TIM0
- TIM0 = (TIM_TypeDef *)TIM0_BASE;
-#endif /* _TIM0 */
-
-#ifdef _TIM1
- TIM1 = (TIM_TypeDef *)TIM1_BASE;
-#endif /* _TIM1 */
-
-#ifdef _TIM2
- TIM2 = (TIM_TypeDef *)TIM2_BASE;
-#endif /* _TIM2 */
-
-#ifdef _TIM3
- TIM3 = (TIM_TypeDef *)TIM3_BASE;
-#endif /* _TIM3 */
-
-/************************* GPIO ************************/
-
-#ifdef _GPIO0
- GPIO0 = (GPIO_TypeDef *)GPIO0_BASE;
-#endif /* _GPIO0 */
-
-#ifdef _GPIO1
- GPIO1 = (GPIO_TypeDef *)GPIO1_BASE;
-#endif /* _GPIO1 */
-
-#ifdef _GPIO2
- GPIO2 = (GPIO_TypeDef *)GPIO2_BASE;
-#endif /* _GPIO2 */
-
-#ifdef _GPIO3
- GPIO3 = (GPIO_TypeDef *)GPIO3_BASE;
-#endif /* _GPIO3 */
-
-#ifdef _GPIO4
- GPIO4 = (GPIO_TypeDef *)GPIO4_BASE;
-#endif /* _GPIO4 */
-
-#ifdef _GPIO5
- GPIO5 = (GPIO_TypeDef *)GPIO5_BASE;
-#endif /* _GPIO5 */
-
-#ifdef _GPIO6
- GPIO6 = (GPIO_TypeDef *)GPIO6_BASE;
-#endif /* _GPIO6 */
-
-#ifdef _GPIO7
- GPIO7 = (GPIO_TypeDef *)GPIO7_BASE;
-#endif /* _GPIO7 */
-
-#ifdef _GPIO8
- GPIO8 = (GPIO_TypeDef *)GPIO8_BASE;
-#endif /* _GPIO8 */
-
-#ifdef _GPIO9
- GPIO9 = (GPIO_TypeDef *)GPIO9_BASE;
-#endif /* _GPIO9 */
-
-/************************* RTC *************************/
-
-#ifdef _RTC
- RTC = (RTC_TypeDef *)RTC_BASE;
-#endif /* _RTC */
-
-/************************* PRCCU ***********************/
-
-#ifdef _SCU
- SCU = (SCU_TypeDef *)SCU_BASE;
-#endif /* _PRCCU */
-
-/************************** MC *************************/
-
-#ifdef _MC
- MC = (MC_TypeDef *)MC_BASE;
-#endif /* _MC */
-
-/************************* UART ************************/
-
-#ifdef _UART0
- UART0 = (UART_TypeDef *)UART0_BASE;
-#endif /* _UART0 */
-
-#ifdef _UART1
- UART1 = (UART_TypeDef *)UART1_BASE;
-#endif /* _UART1 */
-
-#ifdef _UART2
- UART2 = (UART_TypeDef *)UART2_BASE;
-#endif /* _UART2 */
-
-/************************* SSP *************************/
-
-#ifdef _SSP0
- SSP0 = (SSP_TypeDef *)SSP0_BASE;
-#endif /* _SSP0 */
-
-#ifdef _SSP1
- SSP1 = (SSP_TypeDef *)SSP1_BASE;
-#endif /* _SSP1 */
-
-/************************* CAN *************************/
-
-#ifdef _CAN
- CAN = (CAN_TypeDef *)CAN_BASE;
-#endif /* _CAN */
-
-/************************* ADC *************************/
-
-#ifdef _ADC
- ADC = (ADC_TypeDef *)ADC_BASE;
-#endif /* _ADC */
-
-/************************* WDG *************************/
-
-#ifdef _WDG
- WDG = (WDG_TypeDef *)WDG_BASE;
-#endif /* _WDG */
-
-/************************* I2C *************************/
-
-#ifdef _I2C0
- I2C0 = (I2C_TypeDef *)I2C0_BASE;
-#endif /* _I2C0 */
-
-#ifdef _I2C1
- I2C1 = (I2C_TypeDef *)I2C1_BASE;
-#endif /* _I2C1 */
-/********************** ENET **************************/
-#ifdef _ENET
- ENET_MAC = (ENET_MAC_TypeDef *)ENET_MAC_BASE;
- ENET_DMA = (ENET_DMA_TypeDef *)ENET_DMA_BASE;
-#endif /* _ENET */
-}
-#endif /* LIBDEBUG */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_mc.c b/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_mc.c
deleted file mode 100644
index d3ca96a..0000000
--- a/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_mc.c
+++ /dev/null
@@ -1,932 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_mc.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the MC software functions.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_mc.h"
-#include "91x_scu.h"
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-
-#define MC_ODCS_Set 0x0001
-#define MC_ODCS_Reset 0x00FE
-
-#define MC_CMS_Set 0x0004
-#define MC_CMS_Reset 0x00FB
-
-#define MC_CPC_Set 0x0008
-#define MC_CTC_Set 0x0010
-
-#define MC_PCE_Set 0x0020
-#define MC_PCE_Reset 0xFFDF
-
-#define MC_TCE_Set 0x0040
-#define MC_TCE_Reset 0x00BF
-
-#define MC_DTE_Set 0x0080
-#define MC_DTE_Reset 0x007F
-
-#define MC_TCB_Set 0x0004
-#define MC_TCB_Reset 0x00FB
-
-#define MC_STC_Set 0x0008
-
-#define MC_TES_Set 0x0010
-#define MC_TES_Reset 0x00EF
-
-#define MC_CCPT_Set 0x0020
-#define MC_CCPT_Reset 0x005F
-
-#define MC_DISEST_Set 0x0040
-#define MC_DISEST_Reset 0x003F
-
-#define MC_DTS_Set 0x0001
-#define MC_DTS_Reset 0x00FE
-
-#define MC_SDT_Set 0x0002
-
-#define MC_C0SE_Set 0x0004
-#define MC_C0SE_Reset 0x00FB
-
-#define MC_CUSE_Set 0x0008
-#define MC_CUSE_Reset 0x00F7
-
-#define MC_CVSE_Set 0x0010
-#define MC_CVSE_Reset 0x00EF
-
-#define MC_CWSE_Set 0x0020
-#define MC_CWSE_Reset 0x00D0
-
-#define MC_RSE_Set 0x0040
-#define MC_RSE_Reset 0x00BF
-
-#define MC_GPI_Set 0x0080
-#define MC_GPI_Reset 0x007F
-
-#define MC_PUH_Set 0x0020
-#define MC_PUH_Reset 0x005F
-#define MC_PUL_Set 0x0010
-#define MC_PUL_Reset 0x006F
-
-#define MC_PVH_Set 0x0008
-#define MC_PVH_Reset 0x0077
-#define MC_PVL_Set 0x0004
-#define MC_PVL_Reset 0x007B
-
-#define MC_PWH_Set 0x0002
-#define MC_PWH_Reset 0x007D
-#define MC_PWL_Set 0x0001
-#define MC_PWL_Reset 0x007E
-
-#define MC_ODS_Set 0x0040
-#define MC_ODS_Reset 0xFF3F
-
-#define MC_ESC_Clear 0x4321
-
-#define MC_PCR1_TIN_MASK 0xFFFC
-#define MC_OPR_Mask 0x0040
-#define MC_UDCS_Mask 0x0002
-/* Private function prototypes -----------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/******************************************************************************
-* Function Name : MC_DeInit
-* Description : Deinitializes MC peripheral registers to their default reset
-* values.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_DeInit(void)
-{
- /* MC peripheral is under Reset */
- SCU_APBPeriphReset(__MC, ENABLE);
-
- /* MC peripheral Reset off */
- SCU_APBPeriphReset(__MC, DISABLE);
-}
-
-/*******************************************************************************
-* Function Name : MC_Init
-* Description : Initializes the MC peripheral according to the specified
-* parameters in the MC_InitStruct .
-* Input : IMC_InitStruct: pointer to a MC_InitTypeDef structure that
-* contains the configuration information for the MC peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_Init(MC_InitTypeDef* MC_InitStruct)
-{
- /* Select the operating Mode */
- if(MC_InitStruct->MC_OperatingMode == MC_SoftwareOperating_Mode)
- {
- /* Select the Data transfer Mode */
- MC->PCR2 |= MC_DTS_Set;
-
- /* Enable the registers Software Data Transfer */
- MC->PCR2 |= MC_C0SE_Set | MC_CUSE_Set | MC_CVSE_Set | MC_CWSE_Set
- |MC_RSE_Set;
-
- }
- else
- {
- /* Select the Data transfer Mode */
- MC->PCR2 &= MC_DTS_Reset;
-
- /* Disable the registers Software Data Transfer */
- MC->PCR2 &= MC_C0SE_Reset | MC_CUSE_Reset | MC_CVSE_Reset | MC_CWSE_Reset
- |MC_RSE_Reset;
- }
-
- /* Select the MC PWM counter Mode */
- if(MC_InitStruct->MC_PWMMode == MC_PWMZeroCentered_Mode)
- {
- MC->PCR0 |= MC_CMS_Set;
- }
- else
- {
- MC->PCR0 &= MC_CMS_Reset;
- }
-
- /* Set the MC PWM counter Prescaler */
- MC->CPRS = MC_InitStruct->MC_Prescaler;
-
- /* Set the MC PWM Period */
- MC->CMP0 = MC_InitStruct->MC_Period;
-
- /* Set the MC PWM Repetition counter */
- MC->REP = MC_InitStruct->MC_RepetitionCounter;
-
- /* Set the Tacho Compare value */
- MC->TCMP = MC_InitStruct->MC_TachoPeriod;
-
- /* Set the Tacho Prescaler value */
- MC->TPRS = MC_InitStruct->MC_TachoPrescaler;
-
- /* Set the MC Tacho Input Polarity */
- MC->PCR1 = (MC->PCR1 & MC_PCR1_TIN_MASK) | MC_InitStruct->MC_TachoPolarity;
-
- /* Set the MC PWM Forced State */
- MC->OPR |= MC_ODS_Set;
- MC->OPR = (MC->OPR & MC_OPR_Mask) | MC_InitStruct->MC_ForcedPWMState;
-
- /* Select the Tacho Mode */
- if(MC_InitStruct->MC_TachoMode == MC_TachoOneShot_Mode)
- {
- MC->PCR1 |= MC_TCB_Set;
- }
- else
- {
- MC->PCR1 &= MC_TCB_Reset;
- }
-
- /* Select the Tacho Event Mode */
- if(MC_InitStruct->MC_TachoEvent_Mode == MC_TachoEvent_Software_Mode)
- {
- MC->PCR1 |= MC_TES_Set;
- }
- else
- {
- MC->PCR1 &= MC_TES_Reset;
- }
-
- /* Enable or disable the emergency input */
- if(MC_InitStruct->MC_Emergency == MC_Emergency_Enable)
- {
- MC->PCR1 &= MC_DISEST_Reset;
- }
- else
- {
- MC->PCR1 |= MC_DISEST_Set;
- }
-
-/* Select the complementary Mode */
- if(MC_InitStruct->MC_Complementary == MC_Complementary_Enable)
- {
- MC->DTG = MC_InitStruct->MC_DeadTime;
- MC->PCR0 |= MC_ODCS_Set;
- }
- else
- {
- MC->PCR0 &= MC_ODCS_Reset;
- }
-
- /* Tacho Mode selection */
- if(MC_InitStruct->MC_TachoMode == MC_TachoOneShot_Mode)
- {
- MC->PCR1 |= MC_TCB_Set;
- }
- else
- {
- MC->PCR1 &= MC_TCB_Reset;
- }
-
- switch(MC_InitStruct->MC_Channel)
- {
- /* Channel U configuration */
- case MC_Channel_U:
- {
- MC->CMPU = MC_InitStruct->MC_PulseU;
-
- if(MC_InitStruct->MC_PolarityUL == MC_Polarity_Inverted)
- {
- MC->PSR |= MC_PUL_Set;
- }
- else
- {
- MC->PSR &= MC_PUL_Reset;
- }
- if(MC_InitStruct->MC_PolarityUH == MC_Polarity_Inverted)
- {
- MC->PSR |= MC_PUH_Set;
- }
- else
- {
- MC->PSR &= MC_PUH_Reset;
- }
- break;
- }
-
- /* Channel V configuration */
- case MC_Channel_V:
- {
- MC->CMPV = MC_InitStruct->MC_PulseV;
-
- if(MC_InitStruct->MC_PolarityVL == MC_Polarity_Inverted)
- {
- MC->PSR |= MC_PVL_Set;
- }
- else
- {
- MC->PSR &= MC_PVL_Reset;
- }
- if(MC_InitStruct->MC_PolarityVH == MC_Polarity_Inverted)
- {
- MC->PSR |= MC_PVH_Set;
- }
- else
- {
- MC->PSR &= MC_PVH_Reset;
- }
- break;
- }
-
- /* Channel W configuration */
- case MC_Channel_W:
- {
- MC->CMPW = MC_InitStruct->MC_PulseW;
-
- if(MC_InitStruct->MC_PolarityWL == MC_Polarity_Inverted)
- {
- MC->PSR |= MC_PWL_Set;
- }
- else
- {
- MC->PSR &= MC_PWL_Reset;
- }
- if(MC_InitStruct->MC_PolarityWH == MC_Polarity_Inverted)
- {
- MC->PSR |= MC_PWH_Set;
- }
- else
- {
- MC->PSR &= MC_PWH_Reset;
- }
- break;
- }
- /* All Channel Configuration */
- case MC_Channel_ALL:
- {
- MC->CMPU = MC_InitStruct->MC_PulseU;
- MC->CMPV = MC_InitStruct->MC_PulseV;
- MC->CMPW = MC_InitStruct->MC_PulseW;
-
- if(MC_InitStruct->MC_PolarityUL == MC_Polarity_Inverted)
- {
- MC->PSR |= MC_PUL_Set;
- }
- else
- {
- MC->PSR &= MC_PUL_Reset;
- }
- if(MC_InitStruct->MC_PolarityUH == MC_Polarity_Inverted)
- {
- MC->PSR |= MC_PUH_Set;
- }
- else
- {
- MC->PSR &= MC_PUH_Reset;
- }
-
- if(MC_InitStruct->MC_PolarityVL == MC_Polarity_Inverted)
- {
- MC->PSR |= MC_PVL_Set;
- }
- else
- {
- MC->PSR &= MC_PVL_Reset;
- }
- if(MC_InitStruct->MC_PolarityVH == MC_Polarity_Inverted)
- {
- MC->PSR |= MC_PVH_Set;
- }
- else
- {
- MC->PSR &= MC_PVH_Reset;
- }
-
- if(MC_InitStruct->MC_PolarityWL == MC_Polarity_Inverted)
- {
- MC->PSR |= MC_PWL_Set;
- }
- else
- {
- MC->PSR &= MC_PWL_Reset;
- }
- if(MC_InitStruct->MC_PolarityWH == MC_Polarity_Inverted)
- {
- MC->PSR |= MC_PWH_Set;
- }
- else
- {
- MC->PSR &= MC_PWH_Reset;
- }
- }
- default:
- break;
- }
-}
-
-/*******************************************************************************
-* Function Name : MC_StructInit
-* Description : Fills each MC_InitStruct member with its default value.
-* Input : MC_InitStruct : pointer to a MC_InitTypeDef structure which
-* will be initialized.
-* Output : None
-* Return : None.
-*******************************************************************************/
-void MC_StructInit(MC_InitTypeDef* MC_InitStruct)
-{
- MC_InitStruct->MC_OperatingMode = MC_HardwareOperating_Mode;
- MC_InitStruct->MC_TachoMode = MC_TachoContinuous_Mode;
- MC_InitStruct->MC_TachoEvent_Mode = MC_TachoEvent_Hardware_Mode;
- MC_InitStruct->MC_Prescaler = 0x00;
- MC_InitStruct->MC_TachoPrescaler = 0x0000;
- MC_InitStruct->MC_PWMMode = MC_PWMClassical_Mode;
- MC_InitStruct->MC_Complementary = MC_Complementary_Enable;
- MC_InitStruct->MC_Emergency = MC_Emergency_Disable;
- MC_InitStruct->MC_ForcedPWMState = 0x003F;
- MC_InitStruct->MC_Period = 0x0000;
- MC_InitStruct->MC_TachoPeriod = 0x00FF;
- MC_InitStruct->MC_Channel = MC_Channel_ALL;
- MC_InitStruct->MC_PulseU = 0x0000;
- MC_InitStruct->MC_PulseV = 0x0000;
- MC_InitStruct->MC_PulseW = 0x0000;
- MC_InitStruct->MC_PolarityUL = MC_Polarity_NonInverted;
- MC_InitStruct->MC_PolarityUH = MC_Polarity_NonInverted;
- MC_InitStruct->MC_PolarityVL = MC_Polarity_NonInverted;
- MC_InitStruct->MC_PolarityVH = MC_Polarity_NonInverted;
- MC_InitStruct->MC_PolarityWL = MC_Polarity_NonInverted;
- MC_InitStruct->MC_PolarityWH = MC_Polarity_NonInverted;
- MC_InitStruct->MC_TachoPolarity = MC_TachoEventEdge_RisingFalling;
- MC_InitStruct->MC_DeadTime = 0x003F;
- MC_InitStruct->MC_RepetitionCounter = 0x0000;
-}
-
-/*******************************************************************************
-* Function Name : MC_Cmd
-* Description : Enables or disables the MC peripheral.
-* Input : Newstate: new state of the MC peripheral.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_Cmd(FunctionalState NewState)
-{
- if(NewState == ENABLE)
- {
- /* Enable the PWM counter */
- MC->PCR0 |= MC_PCE_Set;
-
- /* Enable the Tacho counter */
- MC->PCR0 |= MC_TCE_Set;
-
- /* Enable the Dead Time counter */
- MC->PCR0 |= MC_DTE_Set;
- }
- else
- {
- /* Disable the PWM counter */
- MC->PCR0 &= MC_PCE_Reset;
-
- /* Disable the Tacho counter */
- MC->PCR0 &= MC_TCE_Reset;
-
- /* Disable the Dead counter */
- MC->PCR0 &= MC_DTE_Reset;
- }
-}
-
-/*******************************************************************************
-* Function Name : MC_ClearPWMCounter
-* Description : Clears the MC PWM counter.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_ClearPWMCounter(void)
-{
-/* Clear the PWM counter */
- MC->PCR0 |= MC_CPC_Set;
-}
-
-/*******************************************************************************
-* Function Name : MC_ClearTachoCounter
-* Description : Clears the MC Tacho counter.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_ClearTachoCounter(void)
-{
-/* Clear the Tacho counter */
- MC->PCR0 |= MC_CTC_Set;
-}
-
-/*******************************************************************************
-* Function Name : MC_CtrlPWMOutputs
-* Description : Enables or disables MC peripheral Main Outputs.
-* Input : Newstate: new state of the MC peripheral Main Outputs.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_CtrlPWMOutputs(FunctionalState Newstate)
-{
- if(Newstate == ENABLE)
- {
- /* Enable the dead time generator data */
- MC->OPR &= MC_ODS_Reset;
- }
- else
- {
- /* Enable the default state data */
- MC->OPR |= MC_ODS_Set;
- }
-}
-
-/*******************************************************************************
-* Function Name : MC_ITConfig
-* Description : Enables or disables the MC interrupts.
-* Input : - MC_IT: specifies the MC interrupts sources to be enabled
-* or disabled.
-* This parameter can be any combination of the following values:
-* - MC_IT_CMPW: Compare W Interrupt.
-* - MC_IT_CMPV: Compare V Interrupt.
-* - MC_IT_CMPU: Compare U Interrupt.
-* - MC_IT_ZPC: Zero of PWM counter Interrupt.
-* - MC_IT_ADT: Automatic Data Transfer Interrupt.
-* - MC_IT_OTC: Overflow of Tacho counter Interrupt.
-* - MC_IT_CPT: Capture of Tacho counter Interrupt.
-* - MC_IT_CM0: Compare 0 Interrupt.
-* - Newstate: new state of IMC interrupts.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_ITConfig(u16 MC_IT, FunctionalState NewState)
-{
- if(NewState == ENABLE)
- {
- /* Enable the specific interrupt source */
- MC->IMR |= MC_IT;
-
- /* Enable the global peripheral interrupt sources */
- MC->PCR2 |= MC_GPI_Set;
- }
- else
- {
- /* Disable the specific interrupt source */
- MC->IMR &= ~MC_IT;
-
- /* Disable the global peripheral interrupt sources */
- MC->PCR2 &= MC_GPI_Reset;
- }
-}
-
-/*******************************************************************************
-* Function Name : MC_SetPrescaler
-* Description : Sets the MC prescaler value.
-* Input : MC_Prescaler: MC prescaler new value.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_SetPrescaler(u8 MC_Prescaler)
-{
-/* Set the Prescaler Register value */
- MC->CPRS = MC_Prescaler;
-}
-
-/*******************************************************************************
-* Function Name : MC_SetPeriod
-* Description : Sets the MC period value.
-* Input : MC_Period: MC period new value.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_SetPeriod(u16 MC_Period)
-{
-/* Set the Period Register value */
- MC->CMP0 = MC_Period;
-}
-
-/*******************************************************************************
-* Function Name : MC_SetPulseU
-* Description : Sets the MC pulse U value.
-* Input : MC_PulseU: MC pulse U new value.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_SetPulseU(u16 MC_PulseU)
-{
-/* Set the Pulse U Register value */
- MC->CMPU = MC_PulseU;
-}
-
-/*******************************************************************************
-* Function Name : MC_SetPulseV
-* Description : Sets the MC pulse V value.
-* Input : MC_PulseV: MC pulse V new value.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_SetPulseV(u16 MC_PulseV)
-{
-/* Set the Pulse V Register value */
- MC->CMPV = MC_PulseV;
-}
-
-/*******************************************************************************
-* Function Name : MC_SetPulseW
-* Description : Sets the MC pulse W value.
-* Input : MC_PulseW: MC pulse W new value.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_SetPulseW(u16 MC_PulseW)
-{
-/* Set the Pulse W Register value */
- MC->CMPW = MC_PulseW;
-}
-
-/*******************************************************************************
-* Function Name : MC_PWMModeConfig
-* Description : Selects the MC PWM counter Mode.
-* Input : MC_PWMMode: MC PWM counter Mode.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_PWMModeConfig(u16 MC_PWMMode)
-{
- /* Select the MC PWM counter Mode */
- if(MC_PWMMode == MC_PWMZeroCentered_Mode)
- {
- MC->PCR0 |= MC_CMS_Set;
- }
- else
- {
- MC->PCR0 &= MC_CMS_Reset;
- }
-}
-
-/*******************************************************************************
-* Function Name : MC_SetDeadTime
-* Description : Sets the MC dead time value.
-* Input : MC_DeadTime: MC dead time new value.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_SetDeadTime(u16 MC_DeadTime)
-{
-/* Set the dead time Register value */
- MC->DTG = MC_DeadTime;
-}
-
-/*******************************************************************************
-* Function Name : MC_SetTachoCompare
-* Description : Sets the MC Tacho Compare Register value.
-* Input : MC_Compare: MC Tacho compare new value.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_SetTachoCompare(u8 MC_Compare)
-{
- /* Sets the Tacho Compare Register value */
- MC->TCMP = MC_Compare;
-}
-/*******************************************************************************
-* Function Name : MC_EmergencyCmd
-* Description : Enables or disables the MC emergency feauture.
-* Input : Newstate: new state of the MC peripheral Emergency.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_EmergencyCmd(FunctionalState NewState)
-{
- if(NewState == ENABLE)
- {
- /* Reset the DISEST Bit in the PCR1 Register to enable the emergency stop input */
- MC->PCR1 &= MC_DISEST_Reset;
- }
- else
- {
- /* Set the DISEST Bit in the PCR1 Register to disable the emergency stop input */
- MC->PCR1 |= MC_DISEST_Reset;
- }
-}
-
-/*******************************************************************************
-* Function Name : MC_EmergencyClear
-* Description : Clears the MC Emergency Register.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_EmergencyClear(void)
-{
-/* Force PWM outputs in safe state (All OFF) */
- MC->OPR |= MC_ODS_Set;
-
-/* Clear EST bit */
- MC->ESC = MC_ESC_Clear;
-
-/* Re-enable protection */
- MC->ESC = 0;
-
-/* Enables the Outputs */
- MC->OPR &= MC_ODS_Reset;
-}
-
-/*******************************************************************************
-* Function Name : MC_GetPeriod
-* Description : Gets the MC period value.
-* Input : None
-* Output : None
-* Return : MC period value.
-*******************************************************************************/
-u16 MC_GetPeriod(void)
-{
-/* Return the PWM signal period value */
- return MC->CMP0;
-}
-
-/*******************************************************************************
-* Function Name : MC_GetPulseU
-* Description : Gets the MC pulse U value.
-* Input : None
-* Output : None
-* Return : MC pulse U value.
-*******************************************************************************/
-u16 MC_GetPulseU(void)
-{
-/* Return the PWM pulse U Register value */
- return MC->CMPU;
-}
-
-/*******************************************************************************
-* Function Name : MC_GetPulseV
-* Description : Gets the MC pulse V value.
-* Input : None
-* Output : None
-* Return : MC pulse V value.
-*******************************************************************************/
-u16 MC_GetPulseV(void)
-{
-/* Return the PWM pulse V Register value */
- return MC->CMPV;
-}
-
-/*******************************************************************************
-* Function Name : MC_GetPulseW
-* Description : Gets the MC pulse W value.
-* Input : None
-* Output : None
-* Return : MC pulse W value.
-*******************************************************************************/
-u16 MC_GetPulseW(void)
-{
-/* Return the PWM pulse W Register value */
- return MC->CMPW;
-}
-
-/*******************************************************************************
-* Function Name : MC_GetTachoCapture
-* Description : Gets the MC Tacho period value.
-* Input : None
-* Output : None
-* Return : MC Tacho capture value.
-*******************************************************************************/
-u16 MC_GetTachoCapture(void)
-{
-/* Return the Tacho Capture Register value */
- return MC->TCPT;
-}
-
-/*******************************************************************************
-* Function Name : MC_ClearOnTachoCapture
-* Description : Enables or disables the the Clear on capture of tacho counter.
-* Input : Newstate: new state of the CCPT bit.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_ClearOnTachoCapture(FunctionalState NewState)
-{
- if(NewState == ENABLE)
- {
- /* Enable the Clear on capture of tacho counter */
- MC->PCR1 |= MC_CCPT_Set;
- }
- else
- {
- /* Disable the Clear on capture of tacho counter */
- MC->PCR1 &= MC_CCPT_Reset;
- }
-}
-/*******************************************************************************
-* Function Name : MC_ForceDataTransfer
-* Description : Sets the MC Outputs default states.
-* Input : MC_ForcedData: MC outputs new states.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_ForceDataTransfer(u8 MC_ForcedData)
-{
- /* Set the MC PWM Forced State */
- MC->OPR |= MC_ODS_Set;
- MC->OPR = (MC->OPR & MC_OPR_Mask) | MC_ForcedData;
-}
-
-/*******************************************************************************
-* Function Name : MC_PreloadConfig
-* Description : Enables the Software Data Transfer.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_SoftwarePreloadConfig(void)
-{
- /* Set the SDT: Software Data Transfer bit */
- MC->PCR2 |= MC_SDT_Set;
-}
-
-/*******************************************************************************
-* Function Name : MC_SoftwareTachoCapture
-* Description : Enables the Software Tacho Capture.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_SoftwareTachoCapture(void)
-{
- /* Set the STC: Software Tacho Capture bit */
- MC->PCR1 |= MC_STC_Set;
-}
-
-/*******************************************************************************
-* Function Name : MC_GetCountingStatus
-* Description : Checks whether the PWM Counter is counting Up or Down.
-* Input : None
-* Output : None
-* Return : The new state of the PWM Counter(DOWN or UP).
-*******************************************************************************/
-CountingStatus MC_GetCountingStatus(void)
-{
- if((MC->PCR0 & MC_UDCS_Mask) != DOWN)
- {
- return UP;
- }
- else
- {
- return DOWN;
- }
-}
-
-/*******************************************************************************
-* Function Name : MC_GetFlagStatus
-* Description : Checks whether the specified MC flag is set or not.
-* Input : MC_FLAG: specifies the flag to check.
-* This parameter can be one of the following values:
-* - MC_FLAG_CMPW: Compare W Flag.
-* - MC_FLAG_CMPV: Compare V Flag.
-* - MC_FLAG_CMPU: Compare U Flag.
-* - MC_FLAG_ZPC: Zero of PWM counter Flag.
-* - MC_FLAG_ADT: Automatic Data Transfer Flag.
-* - MC_FLAG_OTC: Overflow of Tacho counter Flag.
-* - MC_FLAG_CPT: Capture of Tacho counter Flag.
-* - MC_FLAG_CM0: Compare 0 Flag.
-* - MC_FLAG_EST: Emergency Stop Flag.
-* Output : None
-* Return : The new state of the MC_FLAG(SET or RESET).
-*******************************************************************************/
-FlagStatus MC_GetFlagStatus(u16 MC_FLAG)
-{
- if((MC->IPR & MC_FLAG) != RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : MC_ClearFlag
-* Description : Clears the MC’s pending flags.
-* Input : MC_FLAG: specifies the flag to clear.
-* This parameter can be any combination of the following values:
-* - MC_FLAG_CMPW: Compare W Flag.
-* - MC_FLAG_CMPV: Compare V Flag.
-* - MC_FLAG_CMPU: Compare U Flag.
-* - MC_FLAG_ZPC: Zero of PWM counter Flag.
-* - MC_FLAG_ADT: Automatic Data Transfer Flag.
-* - MC_FLAG_OTC: Overflow of Tacho counter Flag.
-* - MC_FLAG_CPT: Capture of Tacho counter Flag.
-* - MC_FLAG_CM0: Compare 0 Flag.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_ClearFlag(u16 MC_FLAG)
-{
-/* Clear the corresponding Flag */
- MC->IPR &= ~MC_FLAG;
-}
-
-/*******************************************************************************
-* Function Name : MC_GetITStatus
-* Description : Checks whether the MC interrupt has occurred or not.
-* Input : MC_IT: specifies the MC interrupt source to check.
-* This parameter can be one of the following values:
-* - MC_IT_CMPW: Compare W Interrupt.
-* - MC_IT_CMPV: Compare V Interrupt.
-* - MC_IT_CMPU: Compare U Interrupt.
-* - MC_IT_ZPC: Zero of PWM counter Interrupt.
-* - MC_IT_ADT: Automatic Data Transfer Interrupt.
-* - MC_IT_OTC: Overflow of Tacho counter Interrupt.
-* - MC_IT_CPT: Capture of Tacho counter Interrupt.
-* - MC_IT_CM0: Compare 0 Interrupt.
-* Output : None
-* Return : The new state of the MC_IT(SET or RESET).
-*******************************************************************************/
-ITStatus MC_GetITStatus(u16 MC_IT)
-{
- if((MC->IPR & MC_IT) && (MC->IMR & MC_IT))
- {
- return SET;
- }
- else
- {
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : MC_ClearITPendingBit
-* Description : Clears the IMC's interrupt pending bits.
-* Input : MC_IT: specifies the pending bit to clear.
-* This parameter can be any combination of the following values:
-* - MC_IT_CMPW: Compare W Interrupt.
-* - MC_IT_CMPV: Compare V Interrupt.
-* - MC_IT_CMPU: Compare U Interrupt.
-* - MC_IT_ZPC: Zero of PWM counter Interrupt.
-* - MC_IT_ADT: Automatic Data Transfer Interrupt.
-* - MC_IT_OTC: Overflow of Tacho counter Interrupt.
-* - MC_IT_CPT: Capture of Tacho counter Interrupt.
-* - MC_IT_CM0: Compare 0 Interrupt.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_ClearITPendingBit(u16 MC_IT)
-{
-/* Clear the corresponding interrupt pending bit */
- MC->IPR &= ~MC_IT;
-}
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_rtc.c b/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_rtc.c
deleted file mode 100644
index 2d0751b..0000000
--- a/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_rtc.c
+++ /dev/null
@@ -1,400 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_rtc.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides the RTC library software functions
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_rtc.h"
-#include "91x_scu.h"
-
-/* Include of other module interface headers ---------------------------------*/
-/* Local includes ------------------------------------------------------------*/
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-u8 BYTEToBCD2(u8 value);
-u16 WORDToBCD3(u16 value);
-u8 BCD2ToBYTE(u8 value);
-u16 BCD3ToBYTE(u16 value);
-/* Interface functions -------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-
-/*******************************************************************************
-* Function Name : BYTEToBCD2
-* Description : Converts a 2 digit decimal to BCD format
-* Input : None
-* Output : None
-* Return : Converted byte
-*******************************************************************************/
-u8 BYTEToBCD2(u8 value)
-{
- u8 bcdhigh = 0;
- while (value >= 10)
- {
- bcdhigh++;
- value -= 10;
- }
- return (bcdhigh << 4) | value;
-}
-/*******************************************************************************
-* Function Name : WORDToBCD3
-* Description : Converts a 3 digit decimal to BCD format
-* Input : None
-* Output : None
-* Return : Converted word
-*******************************************************************************/
-u16 WORDToBCD3(u16 value)
-{
- u16 bcdhigh = 0;
- while (value >= 100)
- {
- bcdhigh++;
- value -= 100;
- }
- bcdhigh <<= 4;
- while (value >= 10)
- {
- bcdhigh++;
- value -= 10;
- }
- return (bcdhigh << 4) | value;
-}
-
-/*******************************************************************************
-* Function Name : BCD3ToWORD
-* Description : convert from 3 digit BCD to Binary
-* Input : None
-* Output : None
-* Return : Converted word
-*******************************************************************************/
-u16 BCD3ToWORD(u16 value)
-{
- return (u16)((((value&0xF00)>>8)*100) + (((value&0x0F0)>>4)*10) + (value&0x0F));
-}
-
-/*******************************************************************************
-* Function Name : BCD2ToBYTE
-* Description : convert from 2 digit BCD to Binary
-* Input : None
-* Output : None
-* Return : Converted word
-*******************************************************************************/
-u8 BCD2ToBYTE(u8 value)
-{
- u32 tmp;
- tmp= ((value&0xF0)>>4)*10;
- return (u8)(tmp+ (value&0x0F));
-}
-
-/*******************************************************************************
-* Function Name : RTC_DeInit
-* Description : Resets the RTC peripheral registers
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void RTC_DeInit(void)
-{
- SCU_APBPeriphReset(__RTC,ENABLE);
- SCU_APBPeriphReset(__RTC,DISABLE);
-}
-
-/*******************************************************************************
-* Function Name : RTC_SetDate
-* Description : Sets the Date register
-* Input : struct of type RTC_DATE
-* Output : None
-* Return : None
-*******************************************************************************/
-void RTC_SetDate(RTC_DATE Date)
-{
- u32 tmp = 0;
-
- RTC->CR |=0x80; /*Enable write operation in DTR register*/
- RTC->DTR = 0;
- tmp = BYTEToBCD2(Date.century);
- RTC->DTR|=tmp<<24;
- tmp = BYTEToBCD2(Date.year);
- RTC->DTR|=tmp<<16;
- tmp = BYTEToBCD2(Date.month);
- RTC->DTR|=tmp<<8;
- tmp = BYTEToBCD2(Date.weekday);
- RTC->DTR|=tmp;
- RTC->TR &=0xFFFFFF;
- tmp = BYTEToBCD2(Date.day);
- RTC->TR|=tmp<<24;
- RTC->CR &=~0x80; /*Disable write operation in DTR register*/
-}
-/*******************************************************************************
-* Function Name : RTC_SetTime
-* Description : Sets the Time register
-* Input : struct of type RTC_TIME
-* Output : None
-* Return : None
-*******************************************************************************/
-void RTC_SetTime(RTC_TIME Time)
-{
- u32 tmp = 0;
-
- RTC->CR |=0x80; /*Enable write operation in TR register*/
- RTC->TR &= 0xFF000000;
- tmp = BYTEToBCD2(Time.hours);
- RTC->TR|=tmp<<16;
- tmp = BYTEToBCD2(Time.minutes);
- RTC->TR|=tmp<<8;
- tmp = BYTEToBCD2(Time.seconds);
- RTC->TR|=tmp;
- RTC->MILR = 0;
- RTC->MILR |= WORDToBCD3(Time.milliseconds);
- RTC->CR &=~0x80; /*Disable write operation in TR register*/
-}
-/*******************************************************************************
-* Function Name : RTC_SetAlarm
-* Description : Sets the Alarm register
-* Input : Struct of type RTC_ALARM
-* Output : Date
-* Return : None
-*******************************************************************************/
-void RTC_SetAlarm(RTC_ALARM Alarm)
-{
- u32 tmp = 0;
-
- RTC->CR |=0x80; /*Enable write operation in ATR register*/
- RTC->ATR = 0;
- tmp = BYTEToBCD2(Alarm.day);
- RTC->ATR|=tmp<<24;
- tmp = BYTEToBCD2(Alarm.hours);
- RTC->ATR|=tmp<<16;
- tmp = BYTEToBCD2(Alarm.minutes);
- RTC->ATR|=tmp<<8;
- tmp = BYTEToBCD2(Alarm.seconds);
- RTC->ATR|=tmp;
- RTC->CR &=~0x80; /*Disable write operation in ATR register*/
-}
-
-/*******************************************************************************
-* Function Name : RTC_GetDate
-* Description : Gets RTC date in BCD coded or BINARY code
-* Input : -Format: BCD or BINARY
-* -Date: pointer to structure of type RTC_DATE to be filled by function
-* Output : None
-* Return : None
-*******************************************************************************/
-void RTC_GetDate(u8 Format, RTC_DATE * Date)
-{
- Date->century = (u8)((RTC->DTR&0xFF000000)>>24);
- Date->year = (u8)((RTC->DTR&0x00FF0000)>>16);
- Date->month = (u8)((RTC->DTR&0x00001F00)>>8);
- Date->day = (u8)((RTC->TR&0x3F000000)>>24);
- Date->weekday = (u8)(RTC->DTR&0xF);
- if (Format == BINARY)
- {
- Date->century = BCD2ToBYTE(Date->century);
- Date->year = BCD2ToBYTE(Date->year);
- Date->month = BCD2ToBYTE(Date->month);
- Date->day = BCD2ToBYTE(Date->day);
- Date->weekday = BCD2ToBYTE(Date->weekday);
- }
-}
-
-/*******************************************************************************
-* Function Name : RTC_GetTime
-* Description : Gets TIME in BCD coded or BINARY code
-* Input : -Format: BCD or BINARY
-* -Time : pointer to structure of type RTC_TIME to be filled by function
-* Output : Time
-* Return : None
-*******************************************************************************/
-void RTC_GetTime(u8 Format, RTC_TIME * Time)
-{
-
- Time->hours = (u8)((RTC->TR&0x003F0000)>>16);
- Time->minutes = (u8)((RTC->TR&0x00007F00)>>8);
- Time->seconds = (u8)(RTC->TR&0x7F);
- Time->milliseconds =(u16)(RTC->MILR&0xFFF);
- if (Format == BINARY)
- {
- Time->hours = BCD2ToBYTE(Time->hours);
- Time->minutes = BCD2ToBYTE(Time->minutes);
- Time->seconds = BCD2ToBYTE(Time->seconds);
- Time->milliseconds = BCD3ToWORD(Time->milliseconds);
- }
-}
-
-
-/*******************************************************************************
-* Function Name : RTC_GetAlarm
-* Description : Gets the RTC Alarm in BCD or BINARY code
-* Input : -Format: BCD or BINARY
-* -Alarm : pointer to structure of type RTC_ALARM to be filled by function
-* Output : Alarm
-* Return : None
-*******************************************************************************/
-void RTC_GetAlarm(u8 Format,RTC_ALARM * Alarm)
-{
- Alarm->day = (u8)((RTC->ATR&0x3F000000)>>24);
- Alarm->hours = (u8)((RTC->ATR&0x003F0000)>>16);
- Alarm->minutes = (u8)((RTC->ATR&0x00007F00)>>8);
- Alarm->seconds = (u8)((RTC->ATR)&0x7F);
- if (Format == BINARY)
- {
- Alarm->day = BCD2ToBYTE(Alarm->day);
- Alarm->hours = BCD2ToBYTE(Alarm->hours);
- Alarm->minutes = BCD2ToBYTE(Alarm->minutes);
- Alarm->seconds = BCD2ToBYTE(Alarm->seconds);
- }
-}
-
-/*******************************************************************************
-* Function Name : RTC_TamperConfig
-* Description : configures the Tamper mode and tamper polarity
-* Input : -TamperMode: RTC_TamperMode_Edge or RTC_TamperMode_Level
-* -TamperPol : RTC_TamperPol_Low or RTC_TamperMode_High
-* Output : None
-* Return : None
-*******************************************************************************/
-void RTC_TamperConfig(u32 TamperMode, u32 TamperPol)
-{
- RTC->CR&=RTC_TamperMode_Edge;
- if (TamperMode!=RTC_TamperMode_Edge)
- RTC->CR|=RTC_TamperMode_Level;
-
- RTC->CR&=RTC_TamperPol_Low;
- if (TamperPol!=RTC_TamperPol_Low)
- RTC->CR|=RTC_TamperPol_High;
-}
-
-/*******************************************************************************
-* Function Name : RTC_TamperCmd
-* Description : Enable or Disable Tamper
-* Input : NewState: ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void RTC_TamperCmd(FunctionalState NewState)
-{
- RTC->CR&=0xFFFFFFFE;
- if (NewState==ENABLE)
- RTC->CR|=0x1;
-}
-
-/*******************************************************************************
-* Function Name : RTC_AlarmCmd
-* Description : Enable or Disable Alarm
-* Input : NewState: ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void RTC_AlarmCmd(FunctionalState NewState)
-{
- RTC->CR&=~0x100000;
- if (NewState==ENABLE)
- RTC->CR|=0x100000;
-}
-
-/*******************************************************************************
-* Function Name : RTC_CalibClockCmd
-* Description : Enable or Disable RTC Calibration Clock Output
-* Input : NewState: ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void RTC_CalibClockCmd(FunctionalState NewState)
-{
- RTC->CR&=~0x40;
- if (NewState ==ENABLE)
- RTC->CR|=0x40;
-}
-
-/*******************************************************************************
-* Function Name : SRAMBattPowerCmd
-* Description : Enable or Disable SRAM backup Power by VBATT
-* Input : NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void RTC_SRAMBattPowerCmd(FunctionalState NewState)
-{
- RTC->CR&=~0x8;
- if (NewState ==ENABLE)
- RTC->CR|=0x8;
-}
-
-/*******************************************************************************
-* Function Name : RTC_PeridicIntConfig
-* Description : Select a Periodic CLock
-* Input : PeriodicClock
-* Output : None
-* Return : None
-* Note : When PeriodicClock = RTC_Per_DISABLE the Periodic clock generation
-* will be disabled.
-*******************************************************************************/
-void RTC_PeriodicIntConfig(u32 PeriodicClock)
-{
- RTC->CR &=~0xF0000;
- RTC->CR|=PeriodicClock;
-}
-
-/*******************************************************************************
-* Function Name : RTC_ITConfig
-* Description : Enable or Disable an interrupt
-* Input : -RTC_IT : RTC interrupt
-* -Newstate: Enable or Disable
-* Output : None
-* Return : None
-*******************************************************************************/
-void RTC_ITConfig(u32 RTC_IT, FunctionalState NewState)
-{
- RTC->CR&=~RTC_IT;
- if (NewState==ENABLE)
- RTC->CR|=RTC_IT;
-}
-
-/*******************************************************************************
-* Function Name : RTC_GetFlagStatus
-* Description : Gets a RTC flag status
-* Input : RTC_FLAG
-* Output : None
-* Return : FlagStatus :SET or RESET
-*******************************************************************************/
-FlagStatus RTC_GetFlagStatus(u32 RTC_FLAG)
-{
- if (RTC->SR&RTC_FLAG) return SET;
- else return RESET;
-}
-
-/*******************************************************************************
-* Function Name : RTC_ClearFlag
-* Description : Clears a RTC flag
-* Input : RTC_FLAG
-* Output : None
-* Return : None
-* Note : Before clearing the RTC Periodic Flag you need to disable the
-* Periodic interrupt generation, to do this use function
-* RTC_PeriodicIntConfig(RTC_Per_DISABLE)
-*******************************************************************************/
-void RTC_ClearFlag(u32 RTC_FLAG)
-{
- vu32 tmp=0;
- if (RTC_FLAG == RTC_FLAG_Per) tmp=RTC->SR;
- else if (RTC_FLAG == RTC_FLAG_Alarm) RTC->CR&=~0x100000;
- else if (RTC_FLAG == RTC_FLAG_Tamper) RTC->CR&=~0x1;
-}
-
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_scu.c b/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_scu.c
deleted file mode 100644
index 21116b2..0000000
--- a/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_scu.c
+++ /dev/null
@@ -1,661 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_scu.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides the SCU library software functions
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_scu.h"
-
-/* Include of other module interface headers ---------------------------------*/
-/* Local includes ------------------------------------------------------------*/
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-#define SCU_PLLEN 0x80000
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/* Interface functions -------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-
-/*******************************************************************************
-* Function Name : SCU_MCLKSourceConfig
-* Description : Configures the MCLK source clock
-* Input : MCLK_Source = SCU_MCLK_OSC, SCU_MCLK_PLL or SCU_MCLK_RTC
-* Output : None
-* Return : ErrorStatus: SUCCESS or ERROR
-* Note : this function returns ERROR if trying to select the PLL as
-* clock source while the PLL is disabled or not locked.
-*******************************************************************************/
-ErrorStatus SCU_MCLKSourceConfig(u32 MCLK_Source)
-{
- u32 CLKCNTR_Value;
-
- CLKCNTR_Value = SCU->CLKCNTR; /*get CLKCNTR register value*/
- CLKCNTR_Value &=~0x3; /*clear field MCLKSEL*/
- if (MCLK_Source == SCU_MCLK_PLL) /*PLL selected as clock source*/
- {
- /*check if PLL enabled & locked*/
- if (!((SCU->PLLCONF&SCU_PLLEN)&&(SCU->SYSSTATUS&SCU_FLAG_LOCK)))
- return ERROR;
- }
- else CLKCNTR_Value |=MCLK_Source; /*OSC or RTC selected as clock source*/
- SCU->CLKCNTR = CLKCNTR_Value; /*Update CLKCNTR register value*/
- return SUCCESS;
-}
-
-/*******************************************************************************
-* Function Name : SCU_PLLFactorsConfig
-* Description : Sets the PLL factors
-* Input : PLLN, PLLM and PLLP
-* Output : None
-* Return : ErrorStatus: ERROR or SUCCESS
-* Notes : -The PLL factors must respect the PLL specification requirements
-* -The function returns ERROR if trying to change PLL
-* factors while PLL is selected as Main Clock source (MCLK)
-* -This function disables the PLL, to enable the PLL use
-* function" SCU_PLLCmd(ENABLE)" after setting the PLL factors
-******************************************************************************/
-ErrorStatus SCU_PLLFactorsConfig(u8 PLLN, u8 PLLM, u8 PLLP)
-{
- if (SCU_PLLCmd(DISABLE)==SUCCESS) /*Disable PLL*/
- {
- SCU->PLLCONF =0; /*clear PLLCONF register*/
- SCU->PLLCONF |=(PLLN<<8); /*update PLLN field*/
- SCU->PLLCONF |=PLLM; /*update PLLM field*/
- SCU->PLLCONF |=PLLP<<16; /*update PLLP field*/
- return SUCCESS;
- }
- return ERROR;
-}
-
-/*******************************************************************************
-* Function Name : SCU_PLLCmd
-* Description : Enable or Disable the PLL
-* Input : NewState = ENABLE or DISABLE
-* Output : None
-* Return : ErrorStatus: SUCCESS or ERROR
-* Note : -The function returns ERROR if:
-* *trying to disable the PLL while it is selected as the MCLK
-* *trying to enable the PLL while it is already enabled and
-* locked
-*******************************************************************************/
-ErrorStatus SCU_PLLCmd(FunctionalState NewState)
-{
- vu32 i;
- if (NewState==ENABLE)
- {
- if (!((SCU->PLLCONF&SCU_PLLEN)&&(SCU->SYSSTATUS&SCU_FLAG_LOCK)))
- {
- SCU->SYSSTATUS|=SCU_FLAG_LOCK; /*clear LOCK bit*/
- SCU->PLLCONF |=SCU_PLLEN; /*PLL Enable*/
- while(!SCU->SYSSTATUS&SCU_FLAG_LOCK); /*Wait PLL to lock*/
- return SUCCESS;
- }
- else return ERROR;
- }
- else /*NewState = DISABLE*/
- {
- if(SCU->CLKCNTR&0x3) /*check if PLL not sys CLK*/
- {
- for(i=10;i>0;i--); /*delay before PLL disabling*/
- SCU->PLLCONF &=~SCU_PLLEN; /*PLL Disable*/
- return SUCCESS;
- }
- else return ERROR;
- }
-}
-
-/*******************************************************************************
-* Function Name : SCU_RCLKDivisorConfig
-* Description : Sets the RCLK divisor value
-* Input : RCLK_Divisor
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_RCLKDivisorConfig(u32 RCLK_Divisor)
-{
- SCU->CLKCNTR &=SCU_RCLK_Div1; /*clear RCLKDIV[2:0] field*/
- if (RCLK_Divisor!=SCU_RCLK_Div1)
- SCU->CLKCNTR |= RCLK_Divisor; /*update field with RCLK divisor*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_HCLKDivisorConfig
-* Description : Sets the HCLK divisor value
-* Input : HCLK_Divisor
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_HCLKDivisorConfig(u32 HCLK_Divisor)
-{
- SCU->CLKCNTR &=SCU_HCLK_Div1; /*clear AHBDIV[1:0] field*/
- if (HCLK_Divisor!=SCU_HCLK_Div1)
- SCU->CLKCNTR |= HCLK_Divisor; /*update field with HCLK divisor*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_PCLKDivisorConfig
-* Description : Sets the PCLK divisor value
-* Input : PCLK_Divisor
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_PCLKDivisorConfig(u32 PCLK_Divisor)
-{
- SCU->CLKCNTR &=SCU_PCLK_Div1; /*clear APBDIV[1:0] field*/
- if (PCLK_Divisor!=SCU_PCLK_Div1)
- SCU->CLKCNTR |= PCLK_Divisor; /*update field with PCLK Divisor*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_APBPeriphClockConfig
-* Description : Enable the clock for an APB peripheral
-* Input : -APBPerip : APB peripherals(__RTC, __ADC ,...)
-* -NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_APBPeriphClockConfig(u32 APBPeriph, FunctionalState NewState)
-{
- if (NewState==ENABLE) /*Enable clock for APB peripheral*/
- SCU->PCGR1 |=APBPeriph;
- else
- SCU->PCGR1 &=~APBPeriph; /*Disable clock for APB peripheral*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_AHBPeriphClockConfig
-* Description : Enable the clock for an AHB peripheral
-* Input : -AHBPerip: AHB peripherals(__USB, __DMA,...)
-* -NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_AHBPeriphClockConfig(u32 AHBPeriph, FunctionalState NewState)
-{
- if (NewState==ENABLE) /*Enable clock for AHB peripheral*/
- SCU->PCGRO |=AHBPeriph;
- else
- SCU->PCGRO &=~AHBPeriph; /*Disable clock for AHB peripheral*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_APBPeriphReset
-* Description : Assert or deassert Reset on APB peripheral
-* Input : -APBPeriph: APB peripherals(__RTC, __ADC,...)
- -NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_APBPeriphReset(u32 APBPeriph, FunctionalState NewState)
-{
- if (NewState==DISABLE) /*APB peripheral not held in Reset*/
- SCU->PRR1 |=APBPeriph;
- else
- SCU->PRR1 &=~APBPeriph; /*APB peripheral held in Reset*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_AHBPeriphReset
-* Description : Assert or deassert Reset on AHB peripheral
-* Input : -AHBPeriph: AHB peripherals(__USB, __DMA,...)
- -NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_AHBPeriphReset(u32 AHBPeriph, FunctionalState NewState)
-{
- if (NewState==DISABLE)
- SCU->PRR0 |=AHBPeriph; /*AHB peripheral not held in Reset*/
- else
- SCU->PRR0 &=~AHBPeriph; /*AHB peripheral held in Reset*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_APBPeriphIdleConfig
-* Description : Enable or Disable Periph Clock during Idle mode
-* Input : -APBPeriph: APB peripherals(__RTC, __ADC,...)
- -NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_APBPeriphIdleConfig(u32 APBPeriph, FunctionalState NewState)
-{
- if (NewState==ENABLE)
- SCU->MGR1 |=APBPeriph; /*APB peripheral clock enabled during Idle mode*/
- else
- SCU->MGR1 &=~APBPeriph; /*APB peripheral clock disabled during Idle mode*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_AHBPeriphIdleConfig
-* Description : Enable or Disable Periph Clock during Idle mode
-* Input : -AHBPeriph: AHB peripherals(__USB, __DMA,...)
- -NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_AHBPeriphIdleConfig(u32 AHBPeriph, FunctionalState NewState)
-{
- if (NewState==ENABLE)
- SCU->MGR0 |=AHBPeriph; /*AHB peripheral clock enabled during Idle mode*/
- else
- SCU->MGR0 &=~AHBPeriph; /*AHB peripheral clock disabled during Idle mode*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_APBPeriphDebugConfig
-* Description : Enable or Disable Periph Clock during ARM debug state
-* Input : -APBPeriph: APB peripherals(__RTC, __ADC,...)
- -NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_APBPeriphDebugConfig(u32 APBPeriph, FunctionalState NewState)
-{
- if (NewState==ENABLE)
- SCU->PECGR1 |=APBPeriph; /*APB peripheral clock enabled during ARM debug state*/
- else
- SCU->PECGR1 &=~APBPeriph; /*APB peripheral clock disabled during ARM debug state*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_AHBPeriphDebugConfig
-* Description : Enable or Disable Periph Clock during ARM debug state
-* Input : -AHBPeriph: AHB peripherals(__USB, __DMA,...)
- -NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_AHBPeriphDebugConfig(u32 AHBPeriph, FunctionalState NewState)
-{
- if (NewState==ENABLE)
- SCU->PECGR0 |=AHBPeriph; /*AHB peripheral clock enabled during ARM debug state*/
- else
- SCU->PECGR0 &=~AHBPeriph; /*AHB peripheral clock disabled during ARM debug state*/
-}
-/*******************************************************************************
-* Function Name : SCU_BRCLKDivisorConfig
-* Description : Sets the BRCLK divisor value
-* Input : BRCLK_Divisor
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_BRCLKDivisorConfig(u32 BRCLK_Divisor)
-{
- SCU->CLKCNTR &=SCU_BRCLK_Div1; /*Clear BRSEL bit*/
- if (BRCLK_Divisor!=SCU_BRCLK_Div1)
- SCU->CLKCNTR |= SCU_BRCLK_Div2; /*set bit BRSEL*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_TIMCLKSourceConfig
-* Description : Sets the TIMx clock source
-* Input : - TIMx : SCU_TIM01 or SCU_TIM23
-* - TIMCLK_Source = SCU_TIMCLK_EXT or SCU_TIMCLK_INT
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_TIMCLKSourceConfig(u8 TIMx, u32 TIMCLK_Source)
-{
- if (TIMx== SCU_TIM01) /*TIM01 clock source configuration*/
- {
- SCU->CLKCNTR &=0xFFFFDFFF;
- if (TIMCLK_Source == SCU_TIMCLK_EXT)
- SCU->CLKCNTR |=0x2000;
- }
- else
- {
- SCU->CLKCNTR &=0xFFFFBFFF; /*TIM23 clock source configuration*/
- if (TIMCLK_Source == SCU_TIMCLK_EXT)
- SCU->CLKCNTR |=0x4000;
- }
-}
-
-/*******************************************************************************
-* Function Name : SCU_TIMPresConfig
-* Description : Sets the TIMx Prescaler Value
-* Input : - TIMx : SCU_TIM01 or SCU_TIM23
-* - Prescaler (16 bit value)
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_TIMPresConfig(u8 TIMx, u16 Prescaler)
-{
- if (TIMx==SCU_TIM01) /*TIM01 Prescaler configuration*/
- SCU->SCR1 = Prescaler&0xFFFF;
- else
- SCU->SCR2 = Prescaler&0xFFFF; /*TIM23 Prescaler configuration*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_USBCLKConfig
-* Description : Configures the clock source for the 48MHz USBCLK
-* Input : USBCLK_Source: SCU_USBCLK_MCLK,SCU_USBCLK_MCLK2 or SCU_USBCLK_EXT
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_USBCLKConfig(u32 USBCLK_Source)
-{
- SCU->CLKCNTR &=SCU_USBCLK_MCLK; /*clear USBSEL[1:0] field*/
- if (USBCLK_Source!=SCU_USBCLK_MCLK)
- SCU->CLKCNTR |= USBCLK_Source; /*update field with USBCLK_Source*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_PHYCLKConfig
-* Description : Enable or Disable PHY clock output
-* Input : NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_PHYCLKConfig(FunctionalState NewState)
-{
- if (NewState==ENABLE)
- SCU->CLKCNTR |= 0x1000; /*enable MIIPHY clock*/
- else
- SCU->CLKCNTR &=~0x1000; /*disable MIIPHY clock*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_FMICLKDivisorConfig
-* Description : Set the FMI clock divisor
-* Input : FMICLK_Divisor: SCU_FMICLK_Div1 or SCU_FMICLK_DIV2
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_FMICLKDivisorConfig(u32 FMICLK_Divisor)
-{
- SCU->CLKCNTR &=SCU_FMICLK_Div1; /*FMICLK = RCLK*/
- if (FMICLK_Divisor!=SCU_FMICLK_Div1)
- SCU->CLKCNTR |=SCU_FMICLK_Div2; /*FMICLK = RCLK/2 */
-}
-
-/*******************************************************************************
-* Function Name : SCU_EMIBCLKDivisorConfig
-* Description : Set the EMI Bus clock divisor: EMIBCLK = HCLK or HCLK/2
-* Input : SCU_EMICLK: SCU_EMIBCLK_Div1 , SCU_EMIBCLK_Div2
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_EMIBCLKDivisorConfig(u32 SCU_EMIBCLK)
-{
- SCU->CLKCNTR &=SCU_EMIBCLK_Div1; /*EMIBCLK = HCLK */
- if (SCU_EMIBCLK!=SCU_EMIBCLK_Div1)
- SCU->CLKCNTR |= SCU_EMIBCLK_Div2; /*EMIBCLK = HCLK/2 */
-}
-
-/*******************************************************************************
-* Function Name : SCU_EMIModeConfig
-* Description : Configure the EMI as Multiplexed or Demultiplexed
-* Input : SCU_EMIMODE : SCU_EMI_MUX or SCU_EMI_DEMUX
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_EMIModeConfig(u32 SCU_EMIMODE)
-{
- SCU->SCR0 &=SCU_EMI_MUX; /*EMI mode = Multiplexed*/
- if (SCU_EMIMODE!=SCU_EMI_MUX)
- SCU->SCR0 |= SCU_EMI_DEMUX; /*EMI mode = Demultiplexed*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_EMIALEConfig
-* Description : Configure the ALE signal (length & polarity)
-* Input : -SCU_EMIALE_LEN : SCU_EMIALE_LEN1 or SCU_EMIALE_LEN2
-* -SCU_EMIALE_POL : SCU_EMIALE_POLLow or SCU_EMI_POLHigh
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_EMIALEConfig(u32 SCU_EMIALE_LEN, u32 SCU_EMIALE_POL)
-{
- /*Configure EMI ALE Length*/
- SCU->SCR0 &=SCU_EMIALE_LEN1;
- if (SCU_EMIALE_LEN!=SCU_EMIALE_LEN1)
- SCU->SCR0 |= SCU_EMIALE_LEN2;
-
- /*Configure EMI ALE POL*/
- SCU->SCR0 &=SCU_EMIALE_POLLow;
- if (SCU_EMIALE_POL!=SCU_EMIALE_POLLow)
- SCU->SCR0 |= SCU_EMIALE_POLHigh;
-}
-
-/*******************************************************************************
-* Function Name : SCU_ITConfig
-* Description : ENBALE or DISABLE an SCU interrupt
-* Input : -SCU_IT: interrupt mask
-* -NewState: ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_ITConfig(u32 SCU_IT, FunctionalState NewState)
-{
- if (NewState==ENABLE)
- SCU->ITCMSK&=~SCU_IT; /*IT enable */
- else
- SCU->ITCMSK|=SCU_IT; /*IT disable( mask)*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_GetFlagStatus
-* Description : Returns flag status
-* Input : SCU_Flag
-* Output : NONE
-* Return : SET or RESET
-*******************************************************************************/
-FlagStatus SCU_GetFlagStatus(u32 SCU_Flag)
-{
- if (SCU->SYSSTATUS&SCU_Flag)
- return SET;
- else return RESET;
-}
-
-/*******************************************************************************
-* Function Name : SCU_ClearFlag
-* Description : Clears a SYSTATUS Flag
-* Input : SCU_Flag
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_ClearFlag(u32 SCU_Flag)
-{
- SCU->SYSSTATUS = SCU_Flag;
-}
-/*******************************************************************************
-* Function Name : SCU_GetPLLfreqValue
-* Description : Gets the current PLL frequency
-* Input : None
-* Output : None
-* Return : PLL frequency (KHz)
-*******************************************************************************/
-u32 SCU_GetPLLFreqValue(void)
-{
- u8 PLL_M;
- u8 PLL_N;
- u8 PLL_P;
-
- PLL_M = SCU->PLLCONF&0xFF;
- PLL_N = (SCU->PLLCONF&0xFF00)>>8;
- PLL_P = (SCU->PLLCONF&0x70000)>>16;
-
- if ((PLL_M>0)&&(PLL_N>0))
- return (u32)(((_Main_Crystal*2)*PLL_N)/(PLL_M<<PLL_P));
-
- else return 0;
-}
-/*******************************************************************************
-* Function Name : SCU_GetMCLKFreqValue
-* Description : Gets the current MCLK frequency
-* Input : None
-* Output : None
-* Return : MCLK frequency (KHz)
-*******************************************************************************/
-u32 SCU_GetMCLKFreqValue(void)
-{
- if ((SCU->CLKCNTR&0x3) == 0x2) return (u32)(_Main_Crystal);
- if ((SCU->CLKCNTR&0x3) == 0x1) return (u32)(32);
- else return (SCU_GetPLLFreqValue());
-}
-
-/*******************************************************************************
-* Function Name : SCU_GetRCLKFreqValue
-* Description : Gets the current RCLK frequency
-* Input : None
-* Output : None
-* Return : RCLK frequency (KHz)
-*******************************************************************************/
-u32 SCU_GetRCLKFreqValue(void)
-{
- u8 RCLK_Div;
- RCLK_Div = (SCU->CLKCNTR&0x1C)>>2;
- if (RCLK_Div==0x5) RCLK_Div=10;
- return (u32)(SCU_GetMCLKFreqValue() >>RCLK_Div);
-}
-
-/*******************************************************************************
-* Function Name : SCU_GetHCLKFreqValue
-* Description : Gets the current PCLK frequency
-* Input : None
-* Output : None
-* Return : HCLK frequency (KHz)
-*******************************************************************************/
-u32 SCU_GetHCLKFreqValue(void)
-{
- u8 HCLK_Div;
- HCLK_Div = (SCU->CLKCNTR&0x60)>>5;
- return (u32)(SCU_GetRCLKFreqValue() >>HCLK_Div);
-}
-
-/*******************************************************************************
-* Function Name : SCU_GetPCLKFreqValue
-* Description : Gets the current HCLK frequency
-* Input : None
-* Output : None
-* Return : PCLK frequency (KHz)
-*******************************************************************************/
-u32 SCU_GetPCLKFreqValue(void)
-{
- u8 PCLK_Div;
- PCLK_Div = (SCU->CLKCNTR&0x180)>>7;
- return (u32)(SCU_GetRCLKFreqValue() >>PCLK_Div);
-}
-
-/*******************************************************************************
-* Function Name : SCU_WakeUpLineConfig
-* Description : Configures an External interrupt as WakeUp line
-* Input : EXTint : 0 -> 31
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_WakeUpLineConfig(u8 EXTint)
-{
- if (EXTint < 8)
- {
- SCU->WKUPSEL&=~0x7;
- SCU->WKUPSEL|=EXTint;
- }
- else if (EXTint<16)
- {
- SCU->WKUPSEL&=~0x38;
- SCU->WKUPSEL|=(EXTint-8)<<3;
- }
- else if (EXTint<24)
- {
- SCU->WKUPSEL&=~0x1C0;
- SCU->WKUPSEL|=(EXTint-16)<<6;
- }
- else
- {
- SCU->WKUPSEL&=~0xE00;
- SCU->WKUPSEL|=(EXTint-24)<<9;
- }
-}
-
-/*******************************************************************************
-* Function Name : SCU_SpecIntRunModeConfig
-* Description : Enables or Disables the Special Run mode
-* Input : newstate = ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_SpecIntRunModeConfig(FunctionalState NewState)
-{
- if (NewState == ENABLE)
- SCU->PWRMNG |=0x8;
- else
- SCU->PWRMNG &=~0x8;
-}
-/*******************************************************************************
-* Function Name : SCU_EnterIdleMode
-* Description : Enters in Idle mode
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_EnterIdleMode(void)
-{
- SCU->PWRMNG |=0x1;
-}
-/*******************************************************************************
-* Function Name : SCU_EnterSleepMode
-* Description : Enters in Sleep mode
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_EnterSleepMode(void)
-{
- SCU->PWRMNG |=0x2;
-}
-
-/*******************************************************************************
-* Function Name : SCU_UARTIrDAConfig
-* Description : Enable or Disable the Irda mode for UARTx
-* Input : - UARTx :x=0,1 or 2
-* - UART_IrDA_Mode : SCU_UARTMode_IrDA or SCU_UARTMode_UART
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_UARTIrDASelect(UART_TypeDef * UARTx, u8 UART_IrDA_Mode)
-{
- if (UART_IrDA_Mode == SCU_UARTMode_IrDA)
- {
- if (UARTx== UART0) SCU->SCR0 |=0x400;
- else if (UARTx==UART1) SCU->SCR0 |=0x800;
- else SCU->SCR0 |=0x1000;
- }
- else
- {
- if (UARTx== UART0) SCU->SCR0 &=~0x400;
- else if (UARTx==UART1) SCU->SCR0 &=~0x800;
- else SCU->SCR0 &=~0x1000;
- }
-}
-/*******************************************************************************
-* Function Name : SCU_PFQBCCmd
-* Description : Enable or Disable PFQBC
-* Input : NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_PFQBCCmd(FunctionalState NewState)
-{
- if (NewState==ENABLE)
- SCU->SCR0 |=0x1;
- else SCU->SCR0 &=~0x1;
-}
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_ssp.c b/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_ssp.c
deleted file mode 100644
index 06bf30c..0000000
--- a/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_ssp.c
+++ /dev/null
@@ -1,469 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_ssp.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the SSP software functions.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_ssp.h"
-#include "91x_scu.h"
-
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-
-/* SSP peripheral Enable */
-#define SSP_Enable 0x0002
-#define SSP_Disable 0xFFFD
-
-/* SSP Loop Back Mode Enable */
-#define SSP_LoopBackMode_Enable 0x0001
-#define SSP_LoopBackMode_Disable 0xFFFE
-
-/* SSP Flag Mask */
-#define SSP_Flag_Mask 0x001F
-
-/* SSP DMA transmit/ receive enable/disable Masks */
-#define SSP_DMA_TransmitEnable 0x0002
-#define SSP_DMA_TransmitDisable 0xFFFD
-#define SSP_DMA_ReceiveEnable 0x0001
-#define SSP_DMA_ReceiveDisable 0xFFFE
-
-/* SSP Masks */
-#define SSP_FrameFormat_Mask 0xFFCF
-#define SSP_DataSize_Mask 0xFFF0
-#define SSP_ClockRate_Mask 0x00FF
-#define SSP_ClockPrescaler_Mask 0xFF00
-
-/* Private function prototypes -----------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-
-/*******************************************************************************
-* Function Name : SSP_DeInit
-* Description : Deinitializes the SSPx peripheral registers to their default
-* reset values.
-* Input : SSPx: where x can be 0 or 1 to select the SSP peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void SSP_DeInit(SSP_TypeDef* SSPx)
-{
- if(SSPx == SSP0)
- {
- /* Reset the SSP0 registers values*/
- SCU_APBPeriphReset(__SSP0,ENABLE);
- SCU_APBPeriphReset(__SSP0,DISABLE);
- }
- else if (SSPx == SSP1)
- {
- /* Reset the SSP1 registers values*/
- SCU_APBPeriphReset(__SSP1,ENABLE);
- SCU_APBPeriphReset(__SSP1,DISABLE);
- }
-}
-
-/*******************************************************************************
-* Function Name : SSP_Init
-* Description : Initializes the SSPx peripheral according to the specified
-* parameters in the SSP_InitTypeDef structure.
-* Input : - SSPx: where x can be 0 or 1 to select the SSP peripheral.
-* - SSP_InitStruct: pointer to a SSP_InitTypeDef structure that
-* contains the configuration information for the specified SSP
-* peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void SSP_Init(SSP_TypeDef* SSPx, SSP_InitTypeDef* SSP_InitStruct)
-{
- if(SSP_InitStruct->SSP_FrameFormat == SSP_FrameFormat_Motorola)
- {
- /* Set the Motorola frame format */
- SSPx->CR0 &= SSP_FrameFormat_Motorola;
- /* Configure the Clock polarity */
- if(SSP_InitStruct->SSP_CPOL == SSP_CPOL_High)
- {
- /* SCK is held high when no data is being transfered */
- SSPx->CR0 |= SSP_CPOL_High;
- }
- else
- {
- /* SCK is held low when no data is being transfered */
- SSPx->CR0 &= SSP_CPOL_Low;
- }
- /* Configure the Clock Phase */
- if(SSP_InitStruct->SSP_CPHA == SSP_CPHA_2Edge)
- {
- /* Data captured on second clock edge */
- SSPx->CR0 |= SSP_CPHA_2Edge;
- }
- else
- {
- /* Data captured on first clock edge */
- SSPx->CR0 &= SSP_CPHA_1Edge;
- }
- }
- /* Configure the Frame format */
- else
- {
- /* Clear the FRF[1:0] bits */
- SSPx->CR0 &= SSP_FrameFormat_Mask;
- /* Set the TI frame format */
- SSPx->CR0 |= SSP_InitStruct->SSP_FrameFormat;
- }
- /* Configure the Mode */
- if(SSP_InitStruct->SSP_Mode == SSP_Mode_Slave)
- {
- /* Set the slave mode */
- SSPx->CR1 |= SSP_Mode_Slave;
- /* Configure the Slave output */
- if(SSP_InitStruct->SSP_SlaveOutput == SSP_SlaveOutput_Disable)
- {
- /* Slave output disabled */
- SSPx->CR1 |= SSP_SlaveOutput_Disable;
- }
- else
- {
- /* Slave output enabled */
- SSPx->CR1 &= SSP_SlaveOutput_Enable;
- }
- }
- else
- {
- /* Set the master mode */
- SSPx->CR1 &= SSP_Mode_Master;
- /* Clear clock rate SCR[7:0] bits */
- SSPx->CR0 &= SSP_ClockRate_Mask;
- /* Set the serial clock rate */
- SSPx->CR0 |= (SSP_InitStruct->SSP_ClockRate<<8);
- /* Clear clock prescaler CPSDVSR[7:0] bits */
- SSPx->PR &= SSP_ClockPrescaler_Mask;
- /* Set the serial clock prescaler */
- SSPx->PR |= SSP_InitStruct->SSP_ClockPrescaler;
- }
-
- /* Clear data size DSS[3:0] bits */
- SSPx->CR0 &= SSP_DataSize_Mask;
- /* Set the data size */
- SSPx->CR0 |= SSP_InitStruct->SSP_DataSize;
-}
-/*******************************************************************************
-* Function Name : SSP_StructInit
-* Description : Fills in a SSP_InitTypeDef structure with the reset value of
-* each parameter.
-* Input : SSP_InitStruct : pointer to a SSP_InitTypeDef structure
- which will be initialized.
-* Output : None
-* Return : None
-*******************************************************************************/
-void SSP_StructInit(SSP_InitTypeDef* SSP_InitStruct)
-{
- /* Initialize the SSP_FrameFormat member */
- SSP_InitStruct->SSP_FrameFormat = SSP_FrameFormat_Motorola;
-
- /* Initialize the SSP_Mode member */
- SSP_InitStruct->SSP_Mode = SSP_Mode_Master;
-
- /* Initialize the SSP_CPOL member */
- SSP_InitStruct->SSP_CPOL = SSP_CPOL_Low;
-
- /* Initialize the SSP_CPHA member */
- SSP_InitStruct->SSP_CPHA = SSP_CPHA_1Edge;
-
- /* Initialize the SSP_DataSize member */
- SSP_InitStruct->SSP_DataSize = SSP_DataSize_8b;
-
- /* Initialize the SSP_SlaveOutput member */
- SSP_InitStruct->SSP_SlaveOutput = SSP_SlaveOutput_Enable;
-
- /* Initialize the SSP_ClockRate member */
- SSP_InitStruct->SSP_ClockRate = 0;
-
- /* Initialize the SSP_ClockPrescaler member */
- SSP_InitStruct->SSP_ClockPrescaler = 0;
-}
-
-/*******************************************************************************
-* Function Name : SSP_Cmd
-* Description : Enables or disables the specified SSP peripheral.
-* Input : - SSPx: where x can be 0 or 1 to select the SSP peripheral.
-* - NewState: new state of the SSPx peripheral. This parameter
-* can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void SSP_Cmd(SSP_TypeDef* SSPx, FunctionalState NewState)
-{
- if(NewState == ENABLE)
- {
- /* Enable the SSP peripheral */
- SSPx->CR1 |= SSP_Enable;
- }
- else
- {
- /* Disable the SSP peripheral */
- SSPx->CR1 &= SSP_Disable;
- }
-}
-
-/*******************************************************************************
-* Function Name : SSP_ITConfig
-* Description : Enables or disables the specified SSP interrupts.
-* Input : - SSPx: where x can be 0 or 1 to select the SSP peripheral.
-* - SSP_IT: specifies the SSP interrupts sources to be enabled
-* or disabled. This parameter can be any combination of the
-* following values:
-* - SSP_IT_TxFifo: Transmit FIFO half empty or less interrupt
-* - SSP_IT_RxFifo: Receive FIFO half full or less interrupt
-* - SSP_IT_RxTimeOut: Receive timeout interrupt
-* - SSP_IT_RxOverrun: Receive overrun interrupt
-* - NewState: new state of the specified SSP interrupts.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void SSP_ITConfig(SSP_TypeDef* SSPx, u16 SSP_IT, FunctionalState NewState)
-{
- if(NewState == ENABLE)
- {
- /* Enable the selected SSP interrupts */
- SSPx->IMSCR |= SSP_IT;
- }
- else
- {
- /* Disable the selected SSP interrupts */
- SSPx->IMSCR &= ~SSP_IT;
- }
-}
-
-/*******************************************************************************
-* Function Name : SSP_DMACmd
-* Description : Configures the SSP0 DMA interface.
-* Input : - SSPx: where x can be 0 or 1 to select the SSP peripheral.
-* - SSP_DMATransfert : specifies the DMA transfert to be
-* enabled or disabled. This parameter can be one of the
-* following values:
-* - SSP_DMA_Transmit: transmit Fifo DMA transfert
-* - SSP_DMA_Receive : receive Fifo DMA transfert
-* - NewState: new state of the DMA transfert.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void SSP_DMACmd(SSP_TypeDef* SSPx, u16 SSP_DMATransfert, FunctionalState NewState)
-{
- if(NewState == ENABLE)
- {
- if(SSP_DMATransfert == SSP_DMA_Transmit)
- {
- /* Enable DMA for the transmit FIFO */
- SSPx->DMACR |= SSP_DMA_TransmitEnable;
- }
- else
- {
- /* Enable DMA for the receive FIFO */
- SSPx->DMACR |= SSP_DMA_ReceiveEnable;
- }
- }
- else
- {
- if(SSP_DMATransfert == SSP_DMA_Transmit)
- {
- /* Disable DMA for the transmit FIFO */
- SSPx->DMACR &= SSP_DMA_TransmitDisable;
- }
- else
- {
- /* Disable DMA for the receive FIFO */
- SSPx->DMACR &= SSP_DMA_ReceiveDisable;
- }
- }
-}
-
-/*******************************************************************************
-* Function Name : SSP_SendData.
-* Description : Transmits a Data through the SSP peripheral.
-* Input : - SSPx: where x can be 0 or 1 to select the SSP peripheral.
-* - Data : Data to be transmitted.
-* Output : None
-* Return : None
-*******************************************************************************/
-void SSP_SendData(SSP_TypeDef* SSPx, u16 Data)
-{
- /* Write in the DR register the data to be sent */
- SSPx->DR = Data;
-}
-
-/*******************************************************************************
-* Function Name : SSP_ReceiveData.
-* Description : Returns the most recent received data by the SSP peripheral.
-* Input : SSPx: where x can be 0 or 1 to select the SSP peripheral.
-* Output : None
-* Return : The value of the received data.
-*******************************************************************************/
-u16 SSP_ReceiveData(SSP_TypeDef* SSPx)
-{
- /* Return the data in the DR register */
- return SSPx->DR;
-}
-
-/*******************************************************************************
-* Function Name : SSP_LoopBackMode
-* Description : Enable or disable the Loop back mode for the selected SSPx peripheral.
-* Input : - SSPx: where x can be 0 or 1 to select the SSP peripheral.
-* - NewState: new state of the Loop Back mode.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None.
-*******************************************************************************/
-void SSP_LoopBackMode(SSP_TypeDef* SSPx, FunctionalState NewState)
-{
- if(NewState == ENABLE)
- {
- /* Enable loop back mode */
- SSPx->CR1 |= SSP_LoopBackMode_Enable;
- }
- else
- {
- /* Disable loop back mode */
- SSPx->CR1 &= SSP_LoopBackMode_Disable;
- }
-}
-
-
-
-/*******************************************************************************
-* Function Name : SSP_GetFlagStatus
-* Description : Checks whether the specified SSP flag is set or not.
-* Input : - SSPx: where x can be 0 or 1 to select the SSP peripheral.
-* - SSP_FLAG: flag to check. This parameter can be one of the
-* following values:
-* - SSP_FLAG_Busy: busy flag
-* - SSP_FLAG_RxFifoFull: Receive FIFO full flag
-* - SSP_FLAG_RxFifoNotEmpty: Receive FIFO not empty flag
-* - SSP_FLAG_TxFifoNotFull: Transmit FIFO not full flag
-* - SSP_FLAG_TxFifoEmpty: Transmit FIFO empty flag
-* - SSP_FLAG_TxFifo: Transmit FIFO half empty or less flag
-* - SSP_FLAG_RxFifo: Receive FIFO half full or less flag
-* - SSP_FLAG_RxTimeOut: Receive timeout flag
-* - SSP_FLAG_RxOverrun: Receive overrun flag
-* Output : None
-* Return : The new state of SSP_Flag (SET or RESET).
-*******************************************************************************/
-FlagStatus SSP_GetFlagStatus(SSP_TypeDef* SSPx, u16 SSP_FLAG)
-{
- u32 SSPReg = 0, FlagPos = 0;
- u32 StatusReg = 0;
-
- /* Get the SSP register index */
- SSPReg = SSP_FLAG >> 5;
-
- /* Get the flag position */
- FlagPos = SSP_FLAG & SSP_Flag_Mask;
-
- /* Find the register of the flag to check */
- if(SSPReg == 1)
- {
- /* The flag to check is in SR register */
- StatusReg = SSPx->SR;
- }
- else if (SSPReg == 2)
- {
- /* The flag to check is in RISR register */
- StatusReg = SSPx->RISR;
- }
-
- /* Check the status of the specified SSP flag */
- if((StatusReg & (1 << FlagPos)) != RESET)
- {
- /* Return SET if the SSP flag is set */
- return SET;
- }
- else
- {
- /* Return RESET if the SSP flag is reset */
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : SSP_ClearFlag
-* Description : Clears the SSPx flags.
-* Input : - SSPx: where x can be 0 or 1 to select the SSP peripheral.
-* - SSP_FLAG: flags to clear. This parameter one of the
-* following values:
-* - SSP_FLAG_RxTimeOut: Receive timeout flag
-* - SSP_FLAG_RxOverrun: Receive overrun flag
-* Output : None
-* Return : None
-*******************************************************************************/
-void SSP_ClearFlag(SSP_TypeDef* SSPx, u16 SSP_FLAG)
-{
- u8 FlagPos = 0;
-
- /* Get the flag position */
- FlagPos = SSP_FLAG & SSP_Flag_Mask;
-
- /* Clear the selected SSP flag */
- SSPx->ICR = (1 << FlagPos);
-}
-
-/*******************************************************************************
-* Function Name : SSP_GetITStatus
-* Description : Checks whether the specified SSP interrupt flag is set or not.
-* Input : - SSPx: where x can be 0 or 1 to select the SSP peripheral.
-* - SSP_IT: interrupt flag to check. This parameter can be one
-* of the following values:
-* - SSP_IT_TxFifo: Transmit FIFO half empty or less interrupt
-* - SSP_IT_RxFifo: Receive FIFO half full or less interrupt
-* - SSP_IT_RxTimeOut: Receive timeout interrupt
-* - SSP_IT_RxOverrun: Receive overrun interrupt
-* Output : None
-* Return : The new state of SSP_IT flag (SET or RESET).
-*******************************************************************************/
-ITStatus SSP_GetITStatus(SSP_TypeDef* SSPx, u16 SSP_IT)
-{
- /* Check the status of the specified interrupt flag */
- if((SSPx->MISR & SSP_IT) != RESET)
- {
- /* Return SET if the SSP interrupt flag is set */
- return SET;
- }
- else
- {
- /* Return RESET if SSP interrupt flag is reset */
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : SSP_ClearITPendingBit
-* Description : Clears the pending interrupt flags.
-* Input : - SSPx: where x can be 0 or 1 to select the SSP peripheral.
-* - SSP_IT: interrupts pending bits to clear. This parameter
-* can be any combination of the following values:
-* - SSP_IT_RxTimeOut: Receive timeout interrupt
-* - SSP_IT_RxOverrun: Receive overrun interrupt
-* Output : None
-* Return : None
-*******************************************************************************/
-void SSP_ClearITPendingBit(SSP_TypeDef* SSPx, u16 SSP_IT)
-{
- /* Clear the selected SSP interrupts pending bits */
- SSPx->ICR = SSP_IT;
-}
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
-
diff --git a/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_tim.c b/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_tim.c
deleted file mode 100644
index 7957168..0000000
--- a/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_tim.c
+++ /dev/null
@@ -1,694 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_tim.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the TIM software functions.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_tim.h"
-
-/* Include of other module interface headers ---------------------------------*/
-/* Local includes ------------------------------------------------------------*/
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-
-/* TIM Bits Masks */
-
-#define TIM_PWM_MASK 0x0010
-#define TIM_OPM_MASK 0x0020
-#define TIM_OC1_ENABLE_MASK 0x0040
-#define TIM_OC1_DISABLE_MASK 0xFFBF
-#define TIM_OC2_ENABLE_MASK 0x0080
-#define TIM_OC2_DISABLE_MASK 0xFF7F
-
-#define TIM_OLVL1_SET_MASK 0x0100
-#define TIM_OLVL1_RESET_MASK 0xFEFF
-
-#define TIM_OLVL2_SET_MASK 0x0200
-#define TIM_OLVL2_RESET_MASK 0xFDFF
-
-#define TIM_ENABLE_MASK 0x8000
-#define TIM_DISABLE_MASK 0x7FFF
-
-#define TIM_DMA_CLEAR_MASK 0xCFFF
-
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/* Interface functions -------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/*******************************************************************************
-* Function Name : TIM_DeInit
-* Description : Initializes TIM peripheral control and registers to their
-* : default reset values.
-* Input : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void TIM_DeInit(TIM_TypeDef *TIMx)
-{
- if((TIMx == TIM0)||(TIMx == TIM1))
- {
- SCU_APBPeriphReset(__TIM01, DISABLE); /* TIM0 & TIM1 Reset's off */
- }
- else
- {
- SCU_APBPeriphReset(__TIM23, DISABLE); /* TIM2 & TIM3 Reset's off */
- }
-
- /* Set all the TIMx registers to thier default values */
- TIMx->OC1R = 0x8000;
- TIMx->OC2R = 0x8000;
- TIMx->CR1 = 0x0;
- TIMx->CR2 = 0x1;
- TIMx->CNTR = 0x1234;
- TIMx->SR = 0x0;
-}
-
-/*******************************************************************************
-* Function Name : TIM_StructInit
-* Description : Fills in a TIM_InitTypeDef structure with the reset value of
-* each parameter.
-* Input : TIM_InitStruct : pointer to a TIM_InitTypeDef structure
- which will be initialized.
-* Output : None
-* Return : None.
-*******************************************************************************/
-void TIM_StructInit(TIM_InitTypeDef *TIM_InitStruct)
-{
- TIM_InitStruct->TIM_Mode = 0x0000;
- TIM_InitStruct->TIM_OC1_Modes = 0x0000;
- TIM_InitStruct->TIM_OC2_Modes = 0x0000;
- TIM_InitStruct->TIM_Clock_Source = 0x0000;
- TIM_InitStruct->TIM_Clock_Edge = 0x0000;
- TIM_InitStruct->TIM_OPM_INPUT_Edge = 0x0000;
- TIM_InitStruct->TIM_ICAP1_Edge = 0x0000;
- TIM_InitStruct->TIM_ICAP2_Edge = 0x0000;
- TIM_InitStruct->TIM_Prescaler = 0x0000;
- TIM_InitStruct->TIM_Pulse_Level_1 = 0x0000;
- TIM_InitStruct->TIM_Pulse_Level_2 = 0x0000;
- TIM_InitStruct->TIM_Period_Level = 0x0000;
- TIM_InitStruct->TIM_Pulse_Length_1 = 0x0000;
- TIM_InitStruct->TIM_Pulse_Length_2 = 0x0000;
- TIM_InitStruct->TIM_Full_Period = 0x0000;
-}
-
-/*******************************************************************************
-* Function Name : TIM_Init
-* Description : Initializes TIM peripheral according to the specified
-* parameters in the TIM_InitTypeDef structure.
-* Input1 : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Input2 : TIM_InitStruct: pointer to a TIM_InitTypeDef structure that
-* contains the configuration information for the specified
-* TIM peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-
-void TIM_Init(TIM_TypeDef *TIMx, TIM_InitTypeDef *TIM_InitStruct)
-{
-/***************************** Clock configuration ****************************/
-
- if (TIM_InitStruct->TIM_Clock_Source == TIM_CLK_APB)
- {
- /* APB clock */
- TIMx->CR1 &= TIM_CLK_APB;
- }
- else
- {
- /* External/SCU clock */
- TIMx->CR1 |= TIM_CLK_EXTERNAL;
- if (TIM_InitStruct->TIM_Clock_Edge == TIM_CLK_EDGE_RISING)
- {
- /* Clock rising edge */
- TIMx->CR1 |= TIM_CLK_EDGE_RISING;
- }
- else
- {
- /* Clock falling edge */
- TIMx->CR1 &= TIM_CLK_EDGE_FALLING;
- }
- }
-
-/************************** Prescaler configuration ***************************/
-
- TIMx->CR2 =( TIMx->CR2 & 0xFF00 )|TIM_InitStruct->TIM_Prescaler ;
-
-/********************************** TIM Modes *********************************/
-
- switch ( TIM_InitStruct->TIM_Mode)
- {
-/******************************* PWM Input mode *******************************/
-
- case TIM_PWMI:
-
- /* Set the PWMI Bit */
- TIMx->CR1 |= TIM_PWMI;
-
- /* Set the first edge Level */
- if ( TIM_InitStruct->TIM_ICAP1_Edge == TIM_ICAP1_EDGE_RISING)
- {
- TIMx->CR1 |= TIM_ICAP1_EDGE_RISING;
- }
- else
- {
- TIMx->CR1 &= TIM_ICAP1_EDGE_FALLING;
- }
-
- /* Set the Second edge Level ( Opposite of the first level ) */
- if ( TIM_InitStruct->TIM_ICAP1_Edge == TIM_ICAP1_EDGE_RISING)
- {
- TIMx->CR1 &= TIM_ICAP2_EDGE_FALLING;
- }
- else
- {
- TIMx->CR1 |= TIM_ICAP2_EDGE_RISING;
- }
-
- break;
-
-/************************** Output compare channel 1 **************************/
-
- case TIM_OCM_CHANNEL_1:
-
- if (TIM_InitStruct->TIM_Pulse_Level_1 == TIM_HIGH)
- {
- TIMx->CR1 |= TIM_OLVL1_SET_MASK;
- }
- else
- {
- TIMx->CR1 &= TIM_OLVL1_RESET_MASK;
- }
-
- TIMx->OC1R = TIM_InitStruct->TIM_Pulse_Length_1;
-
- if (TIM_InitStruct->TIM_OC1_Modes == TIM_TIMING)
- {
- TIMx->CR1 &= TIM_OC1_DISABLE_MASK;
- }
- else
- {
- TIMx->CR1 |= TIM_OC1_ENABLE_MASK;
- }
-
- break;
-
-/************************** Output compare channel 2 **************************/
-
- case TIM_OCM_CHANNEL_2:
-
- if (TIM_InitStruct->TIM_Pulse_Level_2 == TIM_HIGH)
- {
- TIMx->CR1 |= TIM_OLVL2_SET_MASK;
- }
- else
- {
- TIMx->CR1 &= TIM_OLVL2_RESET_MASK;
- }
-
- TIMx->OC2R = TIM_InitStruct->TIM_Pulse_Length_2;
-
- if (TIM_InitStruct->TIM_OC2_Modes == TIM_TIMING)
- {
- TIMx->CR1 &= TIM_OC2_DISABLE_MASK;
- }
- else
- {
- TIMx->CR1 |= TIM_OC2_ENABLE_MASK;
- }
-
- break;
-
-/************************ Output compare channel 1 & 2 ************************/
-
- case TIM_OCM_CHANNEL_12:
-
- TIMx->OC2R = TIM_InitStruct->TIM_Pulse_Length_2;
- TIMx->OC1R = TIM_InitStruct->TIM_Pulse_Length_1;
-
- if (TIM_InitStruct->TIM_OC2_Modes == TIM_TIMING)
- {
- TIMx->CR1 &= TIM_OC2_DISABLE_MASK;
- }
- else
- {
- TIMx->CR1 |= TIM_OC2_ENABLE_MASK;
- }
-
- if (TIM_InitStruct->TIM_OC1_Modes == TIM_TIMING)
- {
- TIMx->CR1 &= TIM_OC1_DISABLE_MASK;
- }
- else
- {
- TIMx->CR1 |= TIM_OC1_ENABLE_MASK;
- }
-
- if (TIM_InitStruct->TIM_Pulse_Level_1 == TIM_HIGH)
- {
- TIMx->CR1 |= TIM_OLVL1_SET_MASK;
- }
- else
- {
- TIMx->CR1 &= TIM_OLVL1_RESET_MASK;
- }
-
- if (TIM_InitStruct->TIM_Pulse_Level_2 == TIM_HIGH)
- {
- TIMx->CR1 |= TIM_OLVL2_SET_MASK;
- }
- else
- {
- TIMx->CR1 &= TIM_OLVL2_RESET_MASK;
- }
-
- break;
-
-/********************************** PWM mode **********************************/
-
- case TIM_PWM:
-
- /* Set the Level During the pulse */
- if ( TIM_InitStruct->TIM_Pulse_Level_1 == TIM_HIGH)
- {
- TIMx->CR1 |= TIM_OLVL2_SET_MASK;
- }
- else
- {
- TIMx->CR1 &= TIM_OLVL2_RESET_MASK;
- }
-
- /* Set the Level after the pulse */
- if (TIM_InitStruct->TIM_Period_Level == TIM_HIGH)
- {
- TIMx->CR1 |= TIM_OLVL1_SET_MASK;
- }
- else
- {
- TIMx->CR1 &= TIM_OLVL1_RESET_MASK;
- }
-
- /* Set the OCAE */
- TIMx->CR1 |= TIM_OC1_ENABLE_MASK;
-
- /* Set the PWM Bit */
- TIMx->CR1 |= TIM_PWM_MASK;
-
- /* Set the Duty Cycle value */
- if ( TIM_InitStruct->TIM_Pulse_Length_1 < 5 )
- {
- TIM_InitStruct->TIM_Pulse_Length_1 = 4;
- }
-
- TIMx->OC1R = TIM_InitStruct->TIM_Pulse_Length_1 - 4;
-
- /* Set the Full Period */
- TIMx->OC2R = TIM_InitStruct->TIM_Full_Period - 4;
-
- break;
-
-/******************************* One pulse mode *******************************/
-
- case TIM_OPM:
-
- /* Set the Level During the pulse */
- if (TIM_InitStruct->TIM_Pulse_Level_1 == TIM_HIGH)
- {
- TIMx->CR1 |= TIM_OLVL2_SET_MASK;
- }
-
- /* Set the Level after the pulse */
- if (TIM_InitStruct->TIM_Period_Level == TIM_HIGH)
- {
- TIMx->CR1 |= TIM_OLVL1_SET_MASK;
- }
-
- /* Set the Activation Edge on the ICAP 1 */
- if (TIM_InitStruct->TIM_OPM_INPUT_Edge == TIM_OPM_EDGE_RISING)
- {
- TIMx->CR1 |= TIM_OPM_EDGE_RISING;
- }
-
- /* Set the Output Compare Function */
- TIMx->CR1 |= TIM_OC1_ENABLE_MASK;
-
- /* Set the One pulse mode */
- TIMx->CR1 |= TIM_OPM_MASK;
-
- /* Set the Pulse length */
- TIMx->OC1R = TIM_InitStruct->TIM_Pulse_Length_1;
-
- break;
-
-/*************************** Input capture channel 1 **************************/
-
- case TIM_ICAP_CHANNEL_1:
-
- if (TIM_InitStruct->TIM_ICAP1_Edge == TIM_ICAP1_EDGE_RISING)
- {
- TIMx->CR1 |= TIM_ICAP1_EDGE_RISING;
- }
- else
- {
- TIMx->CR1 &= TIM_ICAP1_EDGE_FALLING;
- }
-
- break;
-
-/*************************** Input capture channel 2 **************************/
-
- case TIM_ICAP_CHANNEL_2:
-
- if (TIM_InitStruct->TIM_ICAP2_Edge == TIM_ICAP2_EDGE_RISING)
- {
- TIMx->CR1 |= TIM_ICAP2_EDGE_RISING;
- }
- else
- {
- TIMx->CR1 &= TIM_ICAP2_EDGE_FALLING;
- }
-
- break;
-
-/************************* Input capture channel 1 & 2 ************************/
-
- case TIM_ICAP_CHANNEL_12:
- if (TIM_InitStruct->TIM_ICAP2_Edge == TIM_ICAP2_EDGE_RISING)
- {
- TIMx->CR1 |= TIM_ICAP2_EDGE_RISING;
- }
- else
- {
- TIMx->CR1 &= TIM_ICAP2_EDGE_FALLING;
- }
-
- if (TIM_InitStruct->TIM_ICAP1_Edge == TIM_ICAP1_EDGE_RISING)
- {
- TIMx->CR1 |= TIM_ICAP1_EDGE_RISING;
- }
- else
- {
- TIMx->CR1 &= TIM_ICAP1_EDGE_FALLING;
- }
-
- break;
-
- default:
- break;
- }
-}
-
-/*******************************************************************************
-* Function Name : TIM_CounterCmd
-* Description : Enables or disables TIMx Counter peripheral.
-* Input1 : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Input2 : TIM_operation: specifies the new state of the TIMx Counter.
-* This parameter can be one of the following values:
-* - TIM_START: Start the timer counter.
-* - TIM_STOP : Stop the timer counter.
-* - TIM_CLEAR: Clear the timer counter.
-* Output : None
-* Return : None
-*******************************************************************************/
-void TIM_CounterCmd(TIM_TypeDef *TIMx, TIM_CounterOperations TIM_operation)
-{
- switch (TIM_operation)
- {
- case TIM_START:
- TIMx->CR1 |= TIM_ENABLE_MASK;
- break;
-
- case TIM_STOP:
- TIMx->CR1 &= TIM_DISABLE_MASK;
- break;
-
- case TIM_CLEAR:
- TIMx->CNTR = 0x1234;
- break;
-
- default:
- break;
- }
-}
-
-/*******************************************************************************
-* Function Name : TIM_PrescalerConfig
-* Description : This routine is used to configure the TIMx prescaler value
-* (when using the APB clock).
-* Input1 : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Input2 : TIM_Prescaler: specifies the prescaler value. This parameter
-* can be a value from 0x0 to 0xFF.
-* Output : None
-* Return : None
-*******************************************************************************/
-void TIM_PrescalerConfig(TIM_TypeDef *TIMx, u8 TIM_Prescaler)
-{
- TIMx->CR2 &= 0xFF00;
- TIMx->CR2 |= TIM_Prescaler;
-
-}
-/*******************************************************************************
-* Function Name : TIM_GetPrescalerValue
-* Description : This routine is used to get the TIMx prescaler value
-* (when using the APB clock).
-* Input : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Output : None
-* Return : The prescaler value.
-*******************************************************************************/
-u8 TIM_GetPrescalerValue(TIM_TypeDef *TIMx)
-{
- return TIMx->CR2 & 0x00FF;
-}
-
-/*******************************************************************************
-* Function Name : TIM_GetCounterValue
-* Description : This routine is used to get the TIMx counter value.
-* Input : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Output : None
-* Return : The counter value.
-*******************************************************************************/
-u16 TIM_GetCounterValue(TIM_TypeDef *TIMx)
-{
- return TIMx->CNTR;
-}
-
-/*******************************************************************************
-* Function Name : TIM_GetICAP1Value
-* Description : This routine is used to get the Input Capture 1 value.
-* Input : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Output : None
-* Return : The Input Capture 1 value.
-*******************************************************************************/
-u16 TIM_GetICAP1Value(TIM_TypeDef *TIMx)
-{
- return TIMx->IC1R;
-}
-
-/*******************************************************************************
-* Function Name : TIM_GetICAP2Value
-* Description : This routine is used to get the Input Capture 2 value.
-* Input : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Output : None
-* Return : The Input Capture 2 value.
-*******************************************************************************/
-u16 TIM_GetICAP2Value(TIM_TypeDef *TIMx)
-{
- return TIMx->IC2R;
-}
-
-/*******************************************************************************
-* Function Name : TIM_SetPulse
-* Description : This routine is used to set the pulse value.
-* Input1 : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Input2 : TIM_Channel: specifies the needed channel.
-* This parameter can be one of the following values:
-* - TIM_PWM_OC1_Channel: PWM/Output Compare 1 Channel
-* - TIM_OC2_Channel : Output Compare 2 Channel
-* Input3 : TIM_Pulse: specifies the new pulse value.
-* Output : None
-* Return : None
-*******************************************************************************/
-void TIM_SetPulse(TIM_TypeDef *TIMx,u16 TIM_Channel ,u16 TIM_Pulse)
-{
- if (TIM_Channel == TIM_PWM_OC1_Channel)
- {
- TIMx->OC1R = TIM_Pulse;
- }
- else
- {
- TIMx->OC2R = TIM_Pulse;
- }
-}
-/*******************************************************************************
-* Function Name : TIM_GetFlagStatus
-* Description : Checks whether the specified TIMx flag is set or not.
-* Input1 : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Input2 : TIM_Flag: specifies the flag to check.
-* This parameter can be one of the following values:
-* - TIM_FLAG_IC1: Input Capture Channel 1 Flag
-* - TIM_FLAG_IC2: Input Capture Channel 2 Flag
-* - TIM_FLAG_TO : Timer Overflow Flag
-* - TIM_FLAG_OC1: Output Compare Channel 1 Flag
-* - TIM_FLAG_OC2: Output Compare Channel 2 Flag
-* Output : None
-* Return : The NewState of the TIM_Flag (SET or RESET).
-*******************************************************************************/
-FlagStatus TIM_GetFlagStatus(TIM_TypeDef *TIMx, u16 TIM_Flag)
-{
- if((TIMx->SR & TIM_Flag) == RESET)
- {
- return RESET;
- }
- else
- {
- return SET;
- }
-}
-
-/*******************************************************************************
-* Function Name : TIM_ClearFlag
-* Description : Clears the TIM Flag passed as a parameter.
-* Input1 : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Input2 : TIM_Flag: specifies the flag to clear.
-* This parameter can be one of the following values:
-* - TIM_FLAG_IC1: Input Capture Channel 1 Flag
-* - TIM_FLAG_IC2: Input Capture Channel 2 Flag
-* - TIM_FLAG_TO : Timer Overflow Flag
-* - TIM_FLAG_OC1: Output Compare Channel 1 Flag
-* - TIM_FLAG_OC2: Output Compare Channel 2 Flag
-* Output : None
-* Return : None
-*******************************************************************************/
-void TIM_ClearFlag(TIM_TypeDef *TIMx, u16 TIM_Flag)
-{
- /* Clear TIM_Flag */
- TIMx->SR &= ~TIM_Flag;
-}
-
-/*******************************************************************************
-* Function Name : TIM_GetPWMIPulse
-* Description : This routine is used to get the Pulse value in PWMI Mode.
-* Input : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Output : None
-* Return : The pulse value.
-*******************************************************************************/
-u16 TIM_GetPWMIPulse(TIM_TypeDef *TIMx)
-{
- return TIMx->IC2R;
-}
-
-/*******************************************************************************
-* Function Name : TIM_GetPWMIPeriod
-* Description : This routine is used to get the Period value in PWMI Mode.
-* Input : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Output : None
-* Return : The period value.
-*******************************************************************************/
-u16 TIM_GetPWMIPeriod(TIM_TypeDef *TIMx)
-{
- return TIMx->IC1R;
-}
-
-/*******************************************************************************
-* Function Name : TIM_ITConfig
-* Description : Configures the Timer interrupt source.
-* Input1 : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Input2 : TIM_IT: specifies the TIM interrupt source to be enabled.
-* This parameter can be one of the following values:
-* - TIM_IT_IC1: Input Capture 1 Interrupt source.
-* - TIM_IT_OC1: Output Compare 1 Interrupt source.
-* - TIM_IT_TO : Timer Overflow Interrupt source.
-* - TIM_IT_IC2: Input Capture 2 Interrupt source.
-* - TIM_IT_OC2: Output Compare 2 Interrupt source.
-* Input3 : TIM_Newstate: specifies the new state of the TIMx IT.
-* This parameter can be one of the following values:
-* - ENABLE : Enable the needed interrupt.
-* - DISABLE: Disable the needed interrupt.
-* Output : None
-* Return : None
-*******************************************************************************/
-void TIM_ITConfig(TIM_TypeDef *TIMx, u16 TIM_IT, FunctionalState TIM_Newstate)
-{
- if(TIM_Newstate == ENABLE)
- {
- TIMx->CR2 = (TIMx->CR2 & 0x00FF) | TIM_IT;
- }
- else
- {
- TIMx->CR2 &= ~TIM_IT;
- }
-}
-
-/*******************************************************************************
-* Function Name : TIM_DMAConfig
-* Description : Configures the Timer DMA source.
-* Input1 : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Input2 : TIM_DMA_Souces: specifies the TIM DMA source to be selected.
-* This parameter can be one of the following values:
-* - TIM_DMA_IC1: Input Capture 1 DMA source.
-* - TIM_DMA_OCA1 Output Compare 1 DMA source.
-* - TIM_DMA_TO: Timer Overflow DMA source.
-* - TIM_DMA_IC2: Input Capture 2 DMA source.
-* - TIM_DMA_OC2: Output Compare 2 DMA source.
-* Output : None
-* Return : None
-*******************************************************************************/
-void TIM_DMAConfig(TIM_TypeDef *TIMx, u16 TIM_DMA_Sources)
-{
- /* Reset the DMAS[1:0] bits */
- TIMx->CR1 &= TIM_DMA_CLEAR_MASK;
- /* Set the DMAS[1:0] bits according to TIM_DMA_Sources parameter */
- TIMx->CR1 |= TIM_DMA_Sources;
-}
-
-/*******************************************************************************
-* Function Name : TIM_DMACmd
-* Description : Enables or disables TIMx DMA peripheral.
-* Input1 : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Input2 : TIM_Newstate: new state of the TIMx DMA peripheral
-* This parameter can be one of the following values:
-* - ENABLE : Enable the TIMx DMA.
-* - DISABLE: Disable the TIMx DMA.
-* Output : None
-* Return : None
-*******************************************************************************/
-void TIM_DMACmd(TIM_TypeDef *TIMx, FunctionalState TIM_Newstate)
-{
- if (TIM_Newstate == ENABLE)
- {
- TIMx->CR2 |= TIM_DMA_ENABLE;
- }
- else
- {
- TIMx->CR2 &= TIM_DMA_DISABLE;
- }
-}
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_uart.c b/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_uart.c
deleted file mode 100644
index 3c87216..0000000
--- a/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_uart.c
+++ /dev/null
@@ -1,658 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_uart.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the UART software functions.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_uart.h"
-#include "91x_scu.h"
-
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-/* UART IrDA Mask */
-#define UART_IrDA_Disable_Mask 0xFFFD /* IrDA Disable Mask */
-#define UART_IrDA_Enable_Mask 0x0002 /* IrDA Enable Mask */
-#define IrDA_LowPower_Enable_Mask 0x0004 /*IrDA lower power mode enable*/
-#define IrDA_LowPower_Disable_Mask 0xFFFB /*IrDA lower power mode enable*/
-
-/* UART Mask */
-#define UART_Enable_Mask 0x0001 /* UART Enable Mask */
-#define UART_Disable_Mask 0xFFFE /* UART Disable Mask */
-
-/* UART LoopBack */
-#define UART_LoopBack_Disable_Mask 0xFF7F /* LoopBack Disable Mask */
-#define UART_LoopBack_Enable_Mask 0x0080 /* LoopBack Enable Mask */
-
-#define UART_WordLength_Mask 0xFF9F /* UART Word Length Mask */
-#define UART_Parity_Mask 0xFF79 /* UART Parity Mask */
-#define UART_HardwareFlowControl_Mask 0x3FFF /* UART Hardware Flow Control Mask */
-#define UART_TxRxFIFOLevel_Mask 0xFFC0 /* UART Tx Rx FIFO Level Mask */
-#define UART_BreakChar_Mask 0x0001 /* UART Break Character send Mask*/
-#define UART_FLAG_Mask 0x1F /* UART Flag Mask */
-#define UART_Mode_Mask 0xFCFF /* UART Mode Mask */
-#define UART_RTS_LowLevel_Mask 0x0800 /* RTS signal is low */
-#define UART_RTS_HighLevel_Mask 0xF7FF /* RTS signal is High */
-#define UART_DTR_LowLevel_Mask 0x0400 /* DTR signal is low */
-#define UART_DTR_HighLevel_Mask 0xFBFF /* DTR signal is High */
-#define UART_ClearFlag_Mask 0xAA /* Clear Flag Mask */
-
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-
- /*******************************************************************************
-* Function Name : UART_DeInit
-* Description : Deinitializes the UARTx peripheral registers
-* to their default reset values.
-* Input : UARTx: where x can be 0,1 or 2 to select the UART peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_DeInit(UART_TypeDef* UARTx)
-{
- /* Reset the UARTx registers values */
- if(UARTx == UART0)
- {
- SCU_APBPeriphReset(__UART0,ENABLE);
- SCU_APBPeriphReset(__UART0,DISABLE);
- }
- else if(UARTx == UART1)
- {
- SCU_APBPeriphReset(__UART1,ENABLE);
- SCU_APBPeriphReset(__UART1,DISABLE);
- }
- else if(UARTx == UART2)
- {
- SCU_APBPeriphReset(__UART2,ENABLE);
- SCU_APBPeriphReset(__UART2,DISABLE);
- }
-}
-
-/*******************************************************************************
-* Function Name : UART_Init
-* Description : Initializes the UARTx peripheral according to the specified
-* parameters in the UART_InitStruct .
-* Input : - UARTx: where x can be 0,1or 2 to select the UART peripheral.
-* - UART_InitStruct: pointer to a UART_InitTypeDef structure
-* that contains the configuration information for the
-* specified UART peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_Init(UART_TypeDef* UARTx, UART_InitTypeDef* UART_InitStruct)
-{
-
- u64 UART_MainClock = 0;
- u32 IntegerDivider = 0;
- u32 FractionalDivider = 0;
-
- /* Clear the LCR[6:5] bits */
- UARTx->LCR &= UART_WordLength_Mask;
- /* Set the LCR[6:5] bits according to UART_WordLength value */
- UARTx->LCR |= UART_InitStruct->UART_WordLength;
-
- /* Choose Stop Bits */
- if(UART_InitStruct->UART_StopBits == UART_StopBits_2)
- {
- /* 2 Stop Bit */
- UARTx->LCR |= UART_StopBits_2;
- }
- else
- {
- /* One Stop Bits */
- UARTx->LCR &= UART_StopBits_1;
- }
-
- /* Configure the Parity */
- /* Clear the LCR[7]and LCR[2:1] bits */
- UARTx->LCR &= UART_Parity_Mask;
- /* Set the LCR[7]and LCR[2:1] bits according to UART_Parity value */
- UARTx->LCR |= UART_InitStruct->UART_Parity;
-
- /* Configure the BaudRate */
- UART_MainClock = (SCU_GetMCLKFreqValue())*1000;
- if((SCU->CLKCNTR & 0x200) != 0x200)
- {
- UART_MainClock = UART_MainClock/2;
- }
- /* Determine the integer part */
- IntegerDivider = ((100) * (UART_MainClock) / (16 * (UART_InitStruct->UART_BaudRate)));
- UARTx->IBRD = IntegerDivider / 100;
-
- /* Determine the fractional part */
- FractionalDivider = IntegerDivider - (100 * (UARTx->IBRD));
- UARTx->FBRD = ((((FractionalDivider * 64) + 50) / 100));
-
- /* Choose the Hardware Flow Control */
- /* Clear the CR[15:14] bits */
- UARTx->CR &= UART_HardwareFlowControl_Mask;
- /* Set the CR[15:14] bits according to UART_HardwareFlowControl value */
- UARTx->CR |= UART_InitStruct->UART_HardwareFlowControl;
-
- /* Configure the UART mode */
- /* Clear the CR[9:8] bits */
- UARTx->CR &= UART_Mode_Mask;
- /* Set the CR[9:8] bits according to UART_Mode value */
- UARTx->CR |= UART_InitStruct->UART_Mode;
-
- /* Enable or disable the FIFOs */
- /* Set the FIFOs Levels */
- if(UART_InitStruct->UART_FIFO == UART_FIFO_Enable)
- {
- /* Enable the FIFOs */
- UARTx->LCR |= UART_FIFO_Enable;
-
- /* Clear TXIFLSEL and RXIFLSEL bits */
- UARTx->IFLS &= UART_TxRxFIFOLevel_Mask;
-
- /* Set RXIFLSEL bits according to UART_RxFIFOLevel value */
- UARTx->IFLS |= (UART_InitStruct->UART_RxFIFOLevel << 3);
-
- /* Set TXIFLSEL bits according to UART_TxFIFOLevel value */
- UARTx->IFLS |= UART_InitStruct->UART_TxFIFOLevel;
- }
- else
- {
- /* Disable the FIFOs */
- UARTx->LCR &= UART_FIFO_Disable;
- }
-}
-
-/*******************************************************************************
-* Function Name : UART_StructInit
-* Description : Fills each UART_InitStruct member with its reset value.
-* Input : UART_InitStruct: pointer to a UART_InitTypeDef structure which
-* will be initialized.
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_StructInit(UART_InitTypeDef* UART_InitStruct)
-{
- /* Reset the UART_InitStruct members */
- UART_InitStruct->UART_WordLength = UART_WordLength_8D;
- UART_InitStruct->UART_StopBits = UART_StopBits_1;
- UART_InitStruct->UART_Parity = UART_Parity_Odd ;
- UART_InitStruct->UART_BaudRate = 9600;
- UART_InitStruct->UART_HardwareFlowControl = UART_HardwareFlowControl_None;
- UART_InitStruct->UART_Mode = UART_Mode_Tx_Rx;
- UART_InitStruct->UART_FIFO = UART_FIFO_Enable;
- UART_InitStruct->UART_TxFIFOLevel = UART_FIFOLevel_1_2;
- UART_InitStruct->UART_RxFIFOLevel = UART_FIFOLevel_1_2;
-}
-
-/*******************************************************************************
-* Function Name : UART_Cmd
-* Description : Enables or disables the specified UART peripheral.
-* Input : - UARTx: where x can be 0,1 or 2 to select the UART peripheral
-* - NewState: new state of the UARTx peripheral.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_Cmd(UART_TypeDef* UARTx, FunctionalState NewState)
-{
- if (NewState == ENABLE)
- {
- /* Enable the selected UART by setting the UARTEN bit in the CR register */
- UARTx->CR |= UART_Enable_Mask;
- }
- else
- {
- /* Disable the selected UART by clearing the UARTEN bit in the CR register */
- UARTx->CR &= UART_Disable_Mask;
- }
-}
-
-/*******************************************************************************
-* Function Name : UART_ITConfig
-* Description : Enables or disables the specified UART interrupts.
-* Input : - UARTx: where x can be 0,1 or 2 to select the UART peripheral
-* - UART_IT: specifies the UART interrupts sources to be
-* enabled or disabled. This parameter can be any combination
-* of the following values:
-* - UART_IT_OverrunError: Overrun Error interrupt
-* - UART_IT_BreakError: Break Error interrupt
-* - UART_IT_ParityError: Parity Error interrupt
-* - UART_IT_FrameError: Frame Error interrupt
-* - UART_IT_ReceiveTimeOut: Receive Time Out interrupt
-* - UART_IT_Transmit: Transmit interrupt
-* - UART_IT_Receive: Receive interrupt
-* - UART_IT_DSR: DSR interrupt
-* - UART_IT_DCD: DCD interrupt
-* - UART_IT_CTS: CTS interrupt
-* - UART_IT_RI: RI interrupt
-* - NewState: new state of the UARTx peripheral.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_ITConfig(UART_TypeDef* UARTx, u16 UART_IT, FunctionalState NewState)
-{
- if(NewState == ENABLE)
- {
- /* Enables the selected interrupts */
- UARTx->IMSC |= UART_IT;
- }
- else
- {
- /* Disables the selected interrupts */
- UARTx->IMSC &= ~UART_IT;
- }
-}
-
-/*******************************************************************************
-* Function Name : UART_DMAConfig
-* Description : Configures the UARTx’s DMA interface.
-* Input : - UARTx: where x can be 1 or 2 to select the UART peripheral
-* - UART_DMAOnError: specifies the DMA on error request.
-* This parameter can be:
-* - UART_DMAOnError_Enable: DMA receive request enabled
-* when the UART error interrupt is asserted.
-* - UART_DMAOnError_Disable: DMA receive request disabled
-* when the UART error interrupt is asserted.
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_DMAConfig(UART_TypeDef* UARTx, u16 UART_DMAOnError)
-{
- if(UART_DMAOnError == UART_DMAOnError_Enable)
- {
- UARTx->DMACR &= UART_DMAOnError_Enable;
- }
- else
- {
- UARTx->DMACR |= UART_DMAOnError_Disable;
- }
-}
-
-/*******************************************************************************
-* Function Name : UART_DMACmd
-* Description : Enables or disables the UARTx’s DMA interface.
-* Input : - UARTx: where x can be 1 or 2 to select the UART peripheral
-* - UART_DMAReq: enables or disables the request of DMA from UART.
-* This parameter can be:
-* - UART_DMAReq_Tx: Transmit DMA Enable
-* - UART_DMAReq_Rx: Receive DMA Enable
-* - NewState: new state of the UARTx peripheral.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_DMACmd(UART_TypeDef* UARTx, u8 UART_DMAReq, FunctionalState NewState)
-{
- if(UART_DMAReq == UART_DMAReq_Tx)
- {
- if(NewState == ENABLE)
- {
- UARTx->DMACR |= UART_DMAReq_Tx;
- }
- else
- {
- UARTx->DMACR &= ~UART_DMAReq_Tx;
- }
- }
-
- if(UART_DMAReq == UART_DMAReq_Rx)
- {
- if(NewState == ENABLE)
- {
- UARTx->DMACR |= UART_DMAReq_Rx;
- }
- else
- {
- UARTx->DMACR &= ~UART_DMAReq_Rx;
- }
- }
-}
-
-/*******************************************************************************
-* Function Name : UART_LoopBackConfig
-* Description : Enables or disables the LoopBack mode.
-* Input : - UARTx: where x can be 0,1 or 2 to select the UART peripheral
-* - NewState: new state of the UARTx peripheral.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_LoopBackConfig(UART_TypeDef* UARTx, FunctionalState NewState)
-{
- if (NewState == ENABLE)
- {
- /* Enable the LoopBack mode of the specified UART */
- UARTx->CR |= UART_LoopBack_Enable_Mask;
- }
- else
- {
- /* Disable the LoopBack mode of the specified UART */
- UARTx->CR &= UART_LoopBack_Disable_Mask;
- }
-}
-
-/*******************************************************************************
-* Function Name : UART_GetFlagStatus
-* Description : Checks whether the specified UART flag is set or not.
-* Input : - UARTx: where x can be 0,1 or 2 to select the UART peripheral
-* - UART_FLAG: specifies the flag to check.
-* This parameter can be one of the following values:
-* - UART_FLAG_OverrunError: Overrun error flag
-* - UART_FLAG_Break: break error flag
-* - UART_FLAG_ParityError: parity error flag
-* - UART_FLAG_FrameError: frame error flag
-* - UART_FLAG_RI: RI flag
-* - UART_FLAG_TxFIFOEmpty: Transmit FIFO Empty flag
-* - UART_FLAG_RxFIFOFull: Receive FIFO Full flag
-* - UART_FLAG_TxFIFOFull: Transmit FIFO Full flag
-* - UART_FLAG_RxFIFOEmpty: Receive FIFO Empty flag
-* - UART_FLAG_Busy: UART Busy flag
-* - UART_FLAG_CTS: CTS flag
-* - UART_FLAG_DCD: DCD flag
-* - UART_FLAG_DSR: DSR flag
-* - UART_RawIT_OverrunError: Overrun Error interrupt flag
-* - UART_RawIT_BreakError: Break Error interrupt flag
-* - UART_RawIT_ParityError: Parity Error interrupt flag
-* - UART_RawIT_FrameError: Frame Error interrupt flag
-* - UART_RawIT_ReceiveTimeOut: ReceiveTimeOut interrupt flag
-* - UART_RawIT_Transmit: Transmit interrupt flag
-* - UART_RawIT_Receive: Receive interrupt flag
-* - UART_RawIT_DSR: DSR interrupt flag
-* - UART_RawIT_DCD: DCD interrupt flag
-* - UART_RawIT_CTS: CTS interrupt flag
-* - UART_RawIT_RI: RI interrupt flag
-* Output : None
-* Return : The new state of UART_FLAG (SET or RESET).
-*******************************************************************************/
-FlagStatus UART_GetFlagStatus(UART_TypeDef* UARTx, u16 UART_FLAG)
-{
-
- u32 UARTReg = 0, FlagPos = 0;
- u32 StatusReg = 0;
-
- /* Get the UART register index */
- UARTReg = UART_FLAG >> 5;
-
- /* Get the flag position */
- FlagPos = UART_FLAG & UART_FLAG_Mask;
-
- if(UARTReg == 1) /* The flag to check is in RSR register */
- {
- StatusReg = UARTx->RSECR;
- }
- else if (UARTReg == 2) /* The flag to check is in FR register */
- {
- StatusReg = UARTx->FR;
- }
- else if(UARTReg == 3) /* The flag to check is in RIS register */
- {
- StatusReg = UARTx->RIS;
- }
-
- if((StatusReg & (1 << FlagPos))!= RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : UART_ClearFlag
-* Description : Clears the UARTx’s flags(Frame, Parity, Break, Overrun error).
-* Input : - UARTx: where x can be 0,1or 2 to select the UART peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_ClearFlag(UART_TypeDef* UARTx)
-{
- /* Clear the flag */
- UARTx->RSECR = UART_ClearFlag_Mask;
-}
-
-/*******************************************************************************
-* Function Name : UART_GetITStatus
-* Description : Checks whether the specified UART interrupt has occured or not.
-* Input : - UARTx: where x can be 0,1or 2 to select the UART peripheral.
-* - UART_IT: specifies the interrupt pending bit to be checked.
-* This parameter can be one of the following values:
-* - UART_IT_OverrunError: Overrun Error interrupt
-* - UART_IT_BreakError: Break Error interrupt
-* - UART_IT_ParityError: Parity Error interrupt
-* - UART_IT_FrameError: Frame Error interrupt
-* - UART_IT_ReceiveTimeOut: Receive Time Out interrupt
-* - UART_IT_Transmit: Transmit interrupt
-* - UART_IT_Receive: Receive interrupt
-* - UART_IT_DSR: DSR interrupt
-* - UART_IT_DCD: DCD interrupt
-* - UART_IT_CTS: CTS interrupt
-* - UART_IT_RI: RI interrupt
-* Output : None
-* Return : The new state of UART_IT (SET or RESET).
-*******************************************************************************/
-ITStatus UART_GetITStatus(UART_TypeDef* UARTx, u16 UART_IT)
-{
- if((UARTx->MIS & UART_IT) != RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : UART_ClearITPendingBit
-* Description : Clears the UARTx’s interrupt pending bits.
-* Input : - UARTx: where x can be 0,1or 2 to select the UART peripheral.
-* - UART_IT: specifies the interrupt pending bit to clear.
-* More than one interrupt can be cleared using the “|” operator.
-* This parameter can be:
-* - UART_IT_OverrunError: Overrun Error interrupt
-* - UART_IT_BreakError: Break Error interrupt
-* - UART_IT_ParityError: Parity Error interrupt
-* - UART_IT_FrameError: Frame Error interrupt
-* - UART_IT_ReceiveTimeOut: Receive Time Out interrupt
-* - UART_IT_Transmit: Transmit interrupt
-* - UART_IT_Receive: Receive interrupt
-* - UART_IT_DSR: DSR interrupt
-* - UART_IT_DCD: DCD interrupt
-* - UART_IT_CTS: CTS interrupt
-* - UART_IT_RI: RI interrupt
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_ClearITPendingBit(UART_TypeDef* UARTx, u16 UART_IT)
-{
- /* Clear the specified interrupt */
- UARTx->ICR = UART_IT;
-}
-
-/*******************************************************************************
-* Function Name : UART_IrDALowPowerConfig
-* Description : Sets the IrDA low power mode
-* Input : - IrDAx: where x can be 0,1 or 2 to select the UART/IrDA peripheral.
-* - NewState: new state of the UARTIrDA peripheral.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_IrDALowPowerConfig(u8 IrDAx, FunctionalState NewState)
-{
- UART_TypeDef* UARTx;
-
- switch(IrDAx)
- {
- case IrDA0: UARTx = UART0;
- break;
- case IrDA1: UARTx = UART1;
- break;
- case IrDA2: UARTx = UART2;
- break;
- }
-
- if (NewState == ENABLE)
- {
- UARTx->CR |= IrDA_LowPower_Enable_Mask;
- }
- else
- {
- UARTx->CR &= IrDA_LowPower_Disable_Mask;
- }
-}
-
-/*******************************************************************************
-* Function Name : UART_IrDASetCounter
-* Description : Sets the IrDA counter divisor value.
-* Input : - UARTx: where x can be 0,1 or 2 to select the UART/IrDA peripheral.
-* - IrDA_Counter: IrDA counter divisor new value n low power mode(Hz).
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_IrDASetCounter(u8 IrDAx, u32 IrDA_Counter)
-{
- UART_TypeDef* UARTx;
- u32 APBClock;
- switch(IrDAx)
- {
- case IrDA0: UARTx = UART0;
- break;
- case IrDA1: UARTx = UART1;
- break;
- case IrDA2: UARTx = UART2;
- break;
- }
- /* Get the APB frequency */
- APBClock = (SCU_GetPCLKFreqValue())*1000;
- /* Determine the Counter Divisor part */
- UARTx->ILPR = (((APBClock*10) / ( IrDA_Counter)) + 5 )/10;
- }
-
-/*******************************************************************************
-* Function Name : UART_IrDACmd
-* Description : Enables or disables the UARTx’s IrDA interface.
-* Input : - IrDAx: where x can be 0,1 or 2 to select the UART/IrDA peripheral
-* - NewState: new state of the UARTx peripheral.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_IrDACmd(u8 IrDAx, FunctionalState NewState)
-{
- UART_TypeDef* UARTx;
-
- switch(IrDAx)
- {
- case IrDA0: UARTx = UART0;
- break;
- case IrDA1: UARTx = UART1;
- break;
- case IrDA2: UARTx = UART2;
- break;
- }
- if(NewState == ENABLE)
- {
- /* Enable the IrDA mode of the specified UART */
- UARTx->CR |= UART_IrDA_Enable_Mask;
- }
- else
- {
- /* Disable the IrDA mode of the specified UART */
- UARTx->CR &= UART_IrDA_Disable_Mask;
- }
-}
-
-/*******************************************************************************
-* Function Name : UART_SendData
-* Description : Transmits signle Byte of data through the UARTx peripheral.
-* Input : - UARTx: where x can be 0,1 or 2 to select the UART peripheral.
-* - Data: the byte to transmit
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_SendData(UART_TypeDef* UARTx, u8 Data)
-{
- /* Transmit one byte */
- UARTx->DR = Data;
-}
-
-/*******************************************************************************
-* Function Name : UART_ReceiveData
-* Description : Returns the most recent received Byte by the UARTx peripheral.
-* Input : UARTx: where x can be 0,1 or 2 to select the UART peripheral.
-* Output : None
-* Return : The received data
-*******************************************************************************/
-u8 UART_ReceiveData(UART_TypeDef* UARTx)
-{
- /* Receive one byte */
- return ((u8)UARTx->DR);
-}
-
-/*******************************************************************************
-* Function Name : UART_SendBreak
-* Description : Transmits break characters.
-* Input : UARTx: where x can be 0,1 or 2 to select the UART peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_SendBreak(UART_TypeDef* UARTx)
-{
- /* Send break characters */
- UARTx->LCR |= UART_BreakChar_Mask;
-}
-
-/*******************************************************************************
-* Function Name : UART_RTSConfig
-* Description : Sets or Resets the RTS signal
-* Input : - LevelState: new state of the RTS signal for UART0 only.
-* This parameter can be: LowLevel or HighLevel
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_RTSConfig(UART_LevelTypeDef LevelState)
-{
- if(LevelState == LowLevel)
- {
- UART0->CR |= UART_RTS_LowLevel_Mask;
- }
- else
- {
- UART0->CR &= UART_RTS_HighLevel_Mask;
- }
-}
-
-/*******************************************************************************
-* Function Name : UART_DTRConfig
-* Description : Sets or Resets the DTR signal for UART0 only
-* Input : - LevelState: new state of the DTR signal.
-* This parameter can be: LowLevel or HighLevel
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_DTRConfig(UART_LevelTypeDef LevelState)
-{
- if(LevelState == LowLevel)
- {
- UART0->CR |= UART_DTR_LowLevel_Mask;
- }
- else
- {
- UART0->CR &= UART_DTR_HighLevel_Mask;
- }
-}
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_vic.c b/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_vic.c
deleted file mode 100644
index fecb890..0000000
--- a/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_vic.c
+++ /dev/null
@@ -1,830 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_vic.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the VIC software functions.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-
-/* Standard include ----------------------------------------------------------*/
-#include "91x_vic.h"
-
-/* Include of other module interface headers ---------------------------------*/
-/* Local includes ------------------------------------------------------------*/
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-
-#define VIC_REGISTER_NUMBER 16
-#define VIC_PROTECTION_ENABLE_MASK 0x1
-#define VIC_PROTECTION_DISABLE_MASK 0xFFFFFFFE
-#define VIC_VECTOR_ENABLE_MASK 0x20
-#define VIC_IT_SOURCE_MASK 0xFFFFFFE0
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-
-static void VIC_ITModeConfig(u16 VIC_Source, VIC_ITLineMode VIC_LineMode);
-static void VIC_ISRVectAddConfig(u16 VIC_Source, u16 VIC_Priority, \
- void (*VIC_VectAddress)(void));
-static void VIC_VectEnableConfig(u16 VIC_Source, u16 VIC_Priority);
-static void VIC_ITSourceConfig(u16 VIC_Source, u16 VIC_Priority);
-
-/* Interface functions -------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-
-/*******************************************************************************
-* Function Name : VIC_DeInit
-* Description : Deinitialize the VIC module registers to their default reset
-* values.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void VIC_DeInit(void)
-{
- SCU_AHBPeriphReset(__VIC, ENABLE); /* VIC peripheral is under Reset */
- SCU_AHBPeriphReset(__VIC, DISABLE); /* VIC peripheral Reset off */
-}
-
-/*******************************************************************************
-* Function Name : VIC_GetIRQStatus
-* Description : Get the status of interrupts after IRQ masking.
-* Input : VIC_Source: specifies the number of the source line.
-* This parameter can be one of the following values:
-* - WDG_ITLine : VIC source 0
-* - SW_ITLine : VIC source 1
-* - ARMRX_ITLine : VIC source 2
-* - ARMTX_ITLine : VIC source 3
-* - TIM0_ITLine : VIC source 4
-* - TIM1_ITLine : VIC source 5
-* - TIM2_ITLine : VIC source 6
-* - TIM3_ITLine : VIC source 7
-* - USBHP_ITLine : VIC source 8
-* - USBLP_ITLine : VIC source 9
-* - SCU_ITLine : VIC source 10
-* - ENET_ITLine : VIC source 11
-* - DMA_ITLine : VIC source 12
-* - CAN_ITLine : VIC source 13
-* - MC_ITLine : VIC source 14
-* - ADC_ITLine : VIC source 15
-* - UART0_ITLine : VIC source 16
-* - UART1_ITLine : VIC source 17
-* - UART2_ITLine : VIC source 18
-* - I2C0_ITLine : VIC source 19
-* - I2C1_ITLine : VIC source 20
-* - SSP0_ITLine : VIC source 21
-* - SSP1_ITLine : VIC source 22
-* - LVD_ITLine : VIC source 23
-* - RTC_ITLine : VIC source 24
-* - WIU_ITLine : VIC source 25
-* - EXTIT0_ITLine: VIC source 26
-* - EXTIT1_ITLine: VIC source 27
-* - EXTIT2_ITLine: VIC source 28
-* - EXTIT3_ITLine: VIC source 29
-* - USBWU_ITLine : VIC source 30
-* - PFQBC_ITLine : VIC source 31
-* Output : None
-* Return : The status of the IRQ interrupt after masking (SET or RESET).
-*******************************************************************************/
-FlagStatus VIC_GetIRQStatus(u16 VIC_Source)
-{
- u32 VIC_Mask = 1;
- if (VIC_Source < VIC_REGISTER_NUMBER)
- {
- if ((VIC0->ISR | VIC_Mask << VIC_Source) != RESET)
- return SET;
- else
- return RESET;
- }
- else
- {
- if ((VIC1->ISR | VIC_Mask << (VIC_Source - VIC_REGISTER_NUMBER)) != RESET)
- return SET;
- else
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : VIC_GetFIQStatus
-* Description : Get the status of interrupts after FIQ masking
-* Input : VIC_Source: specifies the number of the source line.
-* This parameter can be one of the following values:
-* - WDG_ITLine : VIC source 0
-* - SW_ITLine : VIC source 1
-* - ARMRX_ITLine : VIC source 2
-* - ARMTX_ITLine : VIC source 3
-* - TIM0_ITLine : VIC source 4
-* - TIM1_ITLine : VIC source 5
-* - TIM2_ITLine : VIC source 6
-* - TIM3_ITLine : VIC source 7
-* - USBHP_ITLine : VIC source 8
-* - USBLP_ITLine : VIC source 9
-* - SCU_ITLine : VIC source 10
-* - ENET_ITLine : VIC source 11
-* - DMA_ITLine : VIC source 12
-* - CAN_ITLine : VIC source 13
-* - MC_ITLine : VIC source 14
-* - ADC_ITLine : VIC source 15
-* - UART0_ITLine : VIC source 16
-* - UART1_ITLine : VIC source 17
-* - UART2_ITLine : VIC source 18
-* - I2C0_ITLine : VIC source 19
-* - I2C1_ITLine : VIC source 20
-* - SSP0_ITLine : VIC source 21
-* - SSP1_ITLine : VIC source 22
-* - LVD_ITLine : VIC source 23
-* - RTC_ITLine : VIC source 24
-* - WIU_ITLine : VIC source 25
-* - EXTIT0_ITLine: VIC source 26
-* - EXTIT1_ITLine: VIC source 27
-* - EXTIT2_ITLine: VIC source 28
-* - EXTIT3_ITLine: VIC source 29
-* - USBWU_ITLine : VIC source 30
-* - PFQBC_ITLine : VIC source 31
-* Output : None
-* Return : The status of the FIQ interrupt after masking (SET or RESET)
-*******************************************************************************/
-FlagStatus VIC_GetFIQStatus(u16 VIC_Source)
-{
- u32 VIC_Mask = 1;
- if (VIC_Source < VIC_REGISTER_NUMBER)
- {
- if ((VIC0->RINTSR | VIC_Mask << VIC_Source) != RESET)
- return SET;
- else
- return RESET;
- }
- else
- {
- if ((VIC1->RINTSR | VIC_Mask << (VIC_Source - VIC_REGISTER_NUMBER)) != RESET)
- return SET;
- else
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : VIC_GetSourceITStatus
-* Description : Get the status of the source interrupts before masking.
-* Input : VIC_Source: specifies the number of the source line.
-* This parameter can be one of the following values:
-* - WDG_ITLine : VIC source 0
-* - SW_ITLine : VIC source 1
-* - ARMRX_ITLine : VIC source 2
-* - ARMTX_ITLine : VIC source 3
-* - TIM0_ITLine : VIC source 4
-* - TIM1_ITLine : VIC source 5
-* - TIM2_ITLine : VIC source 6
-* - TIM3_ITLine : VIC source 7
-* - USBHP_ITLine : VIC source 8
-* - USBLP_ITLine : VIC source 9
-* - SCU_ITLine : VIC source 10
-* - ENET_ITLine : VIC source 11
-* - DMA_ITLine : VIC source 12
-* - CAN_ITLine : VIC source 13
-* - MC_ITLine : VIC source 14
-* - ADC_ITLine : VIC source 15
-* - UART0_ITLine : VIC source 16
-* - UART1_ITLine : VIC source 17
-* - UART2_ITLine : VIC source 18
-* - I2C0_ITLine : VIC source 19
-* - I2C1_ITLine : VIC source 20
-* - SSP0_ITLine : VIC source 21
-* - SSP1_ITLine : VIC source 22
-* - LVD_ITLine : VIC source 23
-* - RTC_ITLine : VIC source 24
-* - WIU_ITLine : VIC source 25
-* - EXTIT0_ITLine: VIC source 26
-* - EXTIT1_ITLine: VIC source 27
-* - EXTIT2_ITLine: VIC source 28
-* - EXTIT3_ITLine: VIC source 29
-* - USBWU_ITLine : VIC source 30
-* - PFQBC_ITLine : VIC source 31
-* Output : None
-* Return : The status of the source interrupt before masking
-*******************************************************************************/
-FlagStatus VIC_GetSourceITStatus(u16 VIC_Source)
-{
- u32 VIC_Mask = 1;
- if (VIC_Source < VIC_REGISTER_NUMBER)
- {
- if ((VIC0->FSR | VIC_Mask << VIC_Source) != RESET)
- return SET;
- else
- return RESET;
- }
- else
- {
- if ((VIC1->FSR | VIC_Mask << (VIC_Source - VIC_REGISTER_NUMBER)) != RESET)
- return SET;
- else
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : VIC_ITModeConfig
-* Description : Select the type of interrupt (IRQ or FIQ)
-* Input1 : VIC_Source: specifies the number of the source line.
-* This parameter can be one of the following values:
-* - WDG_ITLine : VIC source 0
-* - SW_ITLine : VIC source 1
-* - ARMRX_ITLine : VIC source 2
-* - ARMTX_ITLine : VIC source 3
-* - TIM0_ITLine : VIC source 4
-* - TIM1_ITLine : VIC source 5
-* - TIM2_ITLine : VIC source 6
-* - TIM3_ITLine : VIC source 7
-* - USBHP_ITLine : VIC source 8
-* - USBLP_ITLine : VIC source 9
-* - SCU_ITLine : VIC source 10
-* - ENET_ITLine : VIC source 11
-* - DMA_ITLine : VIC source 12
-* - CAN_ITLine : VIC source 13
-* - MC_ITLine : VIC source 14
-* - ADC_ITLine : VIC source 15
-* - UART0_ITLine : VIC source 16
-* - UART1_ITLine : VIC source 17
-* - UART2_ITLine : VIC source 18
-* - I2C0_ITLine : VIC source 19
-* - I2C1_ITLine : VIC source 20
-* - SSP0_ITLine : VIC source 21
-* - SSP1_ITLine : VIC source 22
-* - LVD_ITLine : VIC source 23
-* - RTC_ITLine : VIC source 24
-* - WIU_ITLine : VIC source 25
-* - EXTIT0_ITLine: VIC source 26
-* - EXTIT1_ITLine: VIC source 27
-* - EXTIT2_ITLine: VIC source 28
-* - EXTIT3_ITLine: VIC source 29
-* - USBWU_ITLine : VIC source 30
-* - PFQBC_ITLine : VIC source 31
-* Input2 : VIC_LineMode :specifies the type of interrupt of the source
-* line. This parameter can be one of the following values:
-* - VIC_IRQ: the correspondent line is configured as IRQ.
-* - VIC_FIQ: the correspondent line is configured as FIQ.
-* Output : None
-* Return : None
-*******************************************************************************/
-static void VIC_ITModeConfig(u16 VIC_Source, VIC_ITLineMode VIC_LineMode)
-{
- u32 VIC_Mask = 1;
-
- if (VIC_Source < VIC_REGISTER_NUMBER) /* VIC0 */
- {
- if (VIC_LineMode == VIC_IRQ)
- VIC0->INTSR &= ~(VIC_Mask << VIC_Source);
- else /* VIC_LineMode == VIC_FIQ */
- VIC0->INTSR |= (VIC_Mask << VIC_Source);
- }
- else /* VIC1 */
- {
- if (VIC_LineMode == VIC_IRQ)
- VIC1->INTSR &= ~(VIC_Mask << (VIC_Source - VIC_REGISTER_NUMBER));
- else /* VIC_LineMode == VIC_FIQ */
- VIC1->INTSR |= (VIC_Mask << (VIC_Source - VIC_REGISTER_NUMBER));
- }
-}
-
-/*******************************************************************************
-* Function Name : VIC_ITCmd
-* Description : Enable or disable the interrupt request lines.
-* Input1 : VIC_Source: specifies the number of the source line.
-* This parameter can be one of the following values:
-* - WDG_ITLine : VIC source 0
-* - SW_ITLine : VIC source 1
-* - ARMRX_ITLine : VIC source 2
-* - ARMTX_ITLine : VIC source 3
-* - TIM0_ITLine : VIC source 4
-* - TIM1_ITLine : VIC source 5
-* - TIM2_ITLine : VIC source 6
-* - TIM3_ITLine : VIC source 7
-* - USBHP_ITLine : VIC source 8
-* - USBLP_ITLine : VIC source 9
-* - SCU_ITLine : VIC source 10
-* - ENET_ITLine : VIC source 11
-* - DMA_ITLine : VIC source 12
-* - CAN_ITLine : VIC source 13
-* - MC_ITLine : VIC source 14
-* - ADC_ITLine : VIC source 15
-* - UART0_ITLine : VIC source 16
-* - UART1_ITLine : VIC source 17
-* - UART2_ITLine : VIC source 18
-* - I2C0_ITLine : VIC source 19
-* - I2C1_ITLine : VIC source 20
-* - SSP0_ITLine : VIC source 21
-* - SSP1_ITLine : VIC source 22
-* - LVD_ITLine : VIC source 23
-* - RTC_ITLine : VIC source 24
-* - WIU_ITLine : VIC source 25
-* - EXTIT0_ITLine: VIC source 26
-* - EXTIT1_ITLine: VIC source 27
-* - EXTIT2_ITLine: VIC source 28
-* - EXTIT3_ITLine: VIC source 29
-* - USBWU_ITLine : VIC source 30
-* - PFQBC_ITLine : VIC source 31
-* Input2 : FMI_NewState: specifies the line status.
-* This parameter can be one of the following values:
-* - ENABLE: The line is enabled.
-* - DISABLE: The line is disabled.
-* Output : None
-* Return : None
-*******************************************************************************/
-void VIC_ITCmd(u16 VIC_Source, FunctionalState VIC_NewState)
-{
- u32 VIC_Mask = 1;
-
- if (VIC_NewState == ENABLE)
- {
- if (VIC_Source < VIC_REGISTER_NUMBER) /* VIC0 */
- VIC0->INTER |= (VIC_Mask << VIC_Source);
- else /* VIC1 */
- VIC1->INTER |= (VIC_Mask << (VIC_Source - VIC_REGISTER_NUMBER));
- }
- else /* VIC_NewState == DISABLE */
- {
- if (VIC_Source < VIC_REGISTER_NUMBER) /* VIC0 */
- VIC0->INTECR |= (VIC_Mask << VIC_Source);
- else /* VIC1 */
- VIC1->INTECR |= (VIC_Mask << (VIC_Source - VIC_REGISTER_NUMBER));
- }
-}
-
-/*******************************************************************************
-* Function Name : VIC_SWITCmd
-* Description : Generate a software interrupt for the specific source
-* interrupt.
-* Input1 : VIC_Source: specifies the number of the source line.
-* This parameter can be one of the following values:
-* - WDG_ITLine : VIC source 0
-* - SW_ITLine : VIC source 1
-* - ARMRX_ITLine : VIC source 2
-* - ARMTX_ITLine : VIC source 3
-* - TIM0_ITLine : VIC source 4
-* - TIM1_ITLine : VIC source 5
-* - TIM2_ITLine : VIC source 6
-* - TIM3_ITLine : VIC source 7
-* - USBHP_ITLine : VIC source 8
-* - USBLP_ITLine : VIC source 9
-* - SCU_ITLine : VIC source 10
-* - ENET_ITLine : VIC source 11
-* - DMA_ITLine : VIC source 12
-* - CAN_ITLine : VIC source 13
-* - MC_ITLine : VIC source 14
-* - ADC_ITLine : VIC source 15
-* - UART0_ITLine : VIC source 16
-* - UART1_ITLine : VIC source 17
-* - UART2_ITLine : VIC source 18
-* - I2C0_ITLine : VIC source 19
-* - I2C1_ITLine : VIC source 20
-* - SSP0_ITLine : VIC source 21
-* - SSP1_ITLine : VIC source 22
-* - LVD_ITLine : VIC source 23
-* - RTC_ITLine : VIC source 24
-* - WIU_ITLine : VIC source 25
-* - EXTIT0_ITLine: VIC source 26
-* - EXTIT1_ITLine: VIC source 27
-* - EXTIT2_ITLine: VIC source 28
-* - EXTIT3_ITLine: VIC source 29
-* - USBWU_ITLine : VIC source 30
-* - PFQBC_ITLine : VIC source 31
-* Input2 : FMI_NewState: specifies the software interrupt status.
-* This parameter can be one of the following values:
-* - ENABLE: The software interrupt is enabled.
-* - DISABLE: The software interrupt is disabled.
-* Output : None
-* Return : None
-*******************************************************************************/
-void VIC_SWITCmd(u16 VIC_Source, FunctionalState VIC_NewState)
-{
- u32 VIC_Mask = 1;
-
- if (VIC_NewState == ENABLE)
- {
- if (VIC_Source < VIC_REGISTER_NUMBER) /* VIC0 */
- VIC0->SWINTR |= (VIC_Mask << VIC_Source);
- else /* VIC1 */
- VIC1->SWINTR |= (VIC_Mask << (VIC_Source - VIC_REGISTER_NUMBER));
- }
- else /* VIC_NewState == DISABLE */
- {
- if (VIC_Source < VIC_REGISTER_NUMBER) /* VIC0 */
- VIC0->SWINTCR = (VIC_Mask << VIC_Source);
- else /* VIC1 */
- VIC1->SWINTCR = (VIC_Mask << (VIC_Source - VIC_REGISTER_NUMBER));
- }
-}
-
-/*******************************************************************************
-* Function Name : VIC_ProtectionCmd
-* Description : Enable or Disable the register access protection.
-* Input : FMI_NewState: specifies the protection status.
-* This parameter can be one of the following values:
-* - ENABLE: The protection is enabled.
-* - DISABLE: The protection is disabled.
-* Output : None
-* Return : None
-*******************************************************************************/
-void VIC_ProtectionCmd(FunctionalState VIC_NewState)
-{
- if (VIC_NewState == ENABLE)
- {
- VIC0->PER |= VIC_PROTECTION_ENABLE_MASK;
- VIC1->PER |= VIC_PROTECTION_ENABLE_MASK;
- }
- else
- {
- VIC0->PER &= VIC_PROTECTION_DISABLE_MASK;
- VIC1->PER &= VIC_PROTECTION_DISABLE_MASK;
- }
-}
-
-/*******************************************************************************
-* Function Name : VIC_GetCurrentISRAdd
-* Description : Get the address of the current active ISR.
-* Input : VICx: specifies the VIC peripheral
-* This parameter can be one of the following values:
-* - VIC0: To select VIC0.
-* - VIC1: To select VIC1.
-* Output : None
-* Return : The Address of the active ISR.
-*******************************************************************************/
-u32 VIC_GetCurrentISRAdd(VIC_TypeDef* VICx)
-{
- return VICx->VAR;
-}
-
-/*******************************************************************************
-* Function Name : VIC_ISRVectAddConfig
-* Description : Configuration of the ISR vector address.
-* Input1 : VIC_Source: specifies the number of the source line.
-* This parameter can be one of the following values:
-* - WDG_ITLine : VIC source 0
-* - SW_ITLine : VIC source 1
-* - ARMRX_ITLine : VIC source 2
-* - ARMTX_ITLine : VIC source 3
-* - TIM0_ITLine : VIC source 4
-* - TIM1_ITLine : VIC source 5
-* - TIM2_ITLine : VIC source 6
-* - TIM3_ITLine : VIC source 7
-* - USBHP_ITLine : VIC source 8
-* - USBLP_ITLine : VIC source 9
-* - SCU_ITLine : VIC source 10
-* - ENET_ITLine : VIC source 11
-* - DMA_ITLine : VIC source 12
-* - CAN_ITLine : VIC source 13
-* - MC_ITLine : VIC source 14
-* - ADC_ITLine : VIC source 15
-* - UART0_ITLine : VIC source 16
-* - UART1_ITLine : VIC source 17
-* - UART2_ITLine : VIC source 18
-* - I2C0_ITLine : VIC source 19
-* - I2C1_ITLine : VIC source 20
-* - SSP0_ITLine : VIC source 21
-* - SSP1_ITLine : VIC source 22
-* - LVD_ITLine : VIC source 23
-* - RTC_ITLine : VIC source 24
-* - WIU_ITLine : VIC source 25
-* - EXTIT0_ITLine: VIC source 26
-* - EXTIT1_ITLine: VIC source 27
-* - EXTIT2_ITLine: VIC source 28
-* - EXTIT3_ITLine: VIC source 29
-* - USBWU_ITLine : VIC source 30
-* - PFQBC_ITLine : VIC source 31
-* Input2 : VIC_Priority: specifies the priority of the interrupt.
-* It can be a value from 0 to 15. 0 is the highest priority.
-* Input3 : void (*VIC_VectAddress)(void): specifies the ISR vector
-* address pointer.
-* Output : None
-* Return : None
-*******************************************************************************/
-static void VIC_ISRVectAddConfig(u16 VIC_Source, u16 VIC_Priority, \
- void (*VIC_VectAddress)(void))
-{
- if (VIC_Source < VIC_REGISTER_NUMBER) /* VIC0 */
- VIC0->VAiR[VIC_Priority] = (u32)VIC_VectAddress;
- else /* VIC1 */
- VIC1->VAiR[VIC_Priority] = (u32)VIC_VectAddress;
-}
-
-/*******************************************************************************
-* Function Name : VIC_GetISRVectAdd
-* Description : Get the ISR vector address of the correspondent line.
-* Input : VIC_Source: specifies the number of the source line.
-* This parameter can be one of the following values:
-* - WDG_ITLine : VIC source 0
-* - SW_ITLine : VIC source 1
-* - ARMRX_ITLine : VIC source 2
-* - ARMTX_ITLine : VIC source 3
-* - TIM0_ITLine : VIC source 4
-* - TIM1_ITLine : VIC source 5
-* - TIM2_ITLine : VIC source 6
-* - TIM3_ITLine : VIC source 7
-* - USBHP_ITLine : VIC source 8
-* - USBLP_ITLine : VIC source 9
-* - SCU_ITLine : VIC source 10
-* - ENET_ITLine : VIC source 11
-* - DMA_ITLine : VIC source 12
-* - CAN_ITLine : VIC source 13
-* - MC_ITLine : VIC source 14
-* - ADC_ITLine : VIC source 15
-* - UART0_ITLine : VIC source 16
-* - UART1_ITLine : VIC source 17
-* - UART2_ITLine : VIC source 18
-* - I2C0_ITLine : VIC source 19
-* - I2C1_ITLine : VIC source 20
-* - SSP0_ITLine : VIC source 21
-* - SSP1_ITLine : VIC source 22
-* - LVD_ITLine : VIC source 23
-* - RTC_ITLine : VIC source 24
-* - WIU_ITLine : VIC source 25
-* - EXTIT0_ITLine: VIC source 26
-* - EXTIT1_ITLine: VIC source 27
-* - EXTIT2_ITLine: VIC source 28
-* - EXTIT3_ITLine: VIC source 29
-* - USBWU_ITLine : VIC source 30
-* - PFQBC_ITLine : VIC source 31
-* Output : None
-* Return : The correspondent ISR vector address.
-*******************************************************************************/
-u32 VIC_GetISRVectAdd(u16 VIC_Source)
-{
- if (VIC_Source < VIC_REGISTER_NUMBER) /* VIC0 */
- return VIC0->VAiR[VIC_Source];
- else /* VIC1 */
- return VIC1->VAiR[VIC_Source - VIC_REGISTER_NUMBER];
-}
-
-/*******************************************************************************
-* Function Name : VIC_VectEnableConfig
-* Description : Enable the vector interrupt.
-* Input1 : VIC_Source: specifies the number of the source line.
-* This parameter can be one of the following values:
-* - WDG_ITLine : VIC source 0
-* - SW_ITLine : VIC source 1
-* - ARMRX_ITLine : VIC source 2
-* - ARMTX_ITLine : VIC source 3
-* - TIM0_ITLine : VIC source 4
-* - TIM1_ITLine : VIC source 5
-* - TIM2_ITLine : VIC source 6
-* - TIM3_ITLine : VIC source 7
-* - USBHP_ITLine : VIC source 8
-* - USBLP_ITLine : VIC source 9
-* - SCU_ITLine : VIC source 10
-* - ENET_ITLine : VIC source 11
-* - DMA_ITLine : VIC source 12
-* - CAN_ITLine : VIC source 13
-* - MC_ITLine : VIC source 14
-* - ADC_ITLine : VIC source 15
-* - UART0_ITLine : VIC source 16
-* - UART1_ITLine : VIC source 17
-* - UART2_ITLine : VIC source 18
-* - I2C0_ITLine : VIC source 19
-* - I2C1_ITLine : VIC source 20
-* - SSP0_ITLine : VIC source 21
-* - SSP1_ITLine : VIC source 22
-* - LVD_ITLine : VIC source 23
-* - RTC_ITLine : VIC source 24
-* - WIU_ITLine : VIC source 25
-* - EXTIT0_ITLine: VIC source 26
-* - EXTIT1_ITLine: VIC source 27
-* - EXTIT2_ITLine: VIC source 28
-* - EXTIT3_ITLine: VIC source 29
-* - USBWU_ITLine : VIC source 30
-* - PFQBC_ITLine : VIC source 31
-* Input2 : VIC_Priority: specifies the priority of the interrupt.
-* It can be a value from 0 to 15. 0 is the highest priority.
-* Output : None
-* Return : None
-*******************************************************************************/
-static void VIC_VectEnableConfig(u16 VIC_Source, u16 VIC_Priority)
-{
- if (VIC_Source < VIC_REGISTER_NUMBER) /* VIC0 */
- VIC0->VCiR[VIC_Priority] |= VIC_VECTOR_ENABLE_MASK;
- else /* VIC1 */
- VIC1->VCiR[VIC_Priority] |= VIC_VECTOR_ENABLE_MASK;
-}
-
-/*******************************************************************************
-* Function Name : VIC_ITSourceConfig
-* Description : Select the interrupt source.
-* Input1 : VIC_Source: specifies the number of the source line.
-* This parameter can be one of the following values:
-* - WDG_ITLine : VIC source 0
-* - SW_ITLine : VIC source 1
-* - ARMRX_ITLine : VIC source 2
-* - ARMTX_ITLine : VIC source 3
-* - TIM0_ITLine : VIC source 4
-* - TIM1_ITLine : VIC source 5
-* - TIM2_ITLine : VIC source 6
-* - TIM3_ITLine : VIC source 7
-* - USBHP_ITLine : VIC source 8
-* - USBLP_ITLine : VIC source 9
-* - SCU_ITLine : VIC source 10
-* - ENET_ITLine : VIC source 11
-* - DMA_ITLine : VIC source 12
-* - CAN_ITLine : VIC source 13
-* - MC_ITLine : VIC source 14
-* - ADC_ITLine : VIC source 15
-* - UART0_ITLine : VIC source 16
-* - UART1_ITLine : VIC source 17
-* - UART2_ITLine : VIC source 18
-* - I2C0_ITLine : VIC source 19
-* - I2C1_ITLine : VIC source 20
-* - SSP0_ITLine : VIC source 21
-* - SSP1_ITLine : VIC source 22
-* - LVD_ITLine : VIC source 23
-* - RTC_ITLine : VIC source 24
-* - WIU_ITLine : VIC source 25
-* - EXTIT0_ITLine: VIC source 26
-* - EXTIT1_ITLine: VIC source 27
-* - EXTIT2_ITLine: VIC source 28
-* - EXTIT3_ITLine: VIC source 29
-* - USBWU_ITLine : VIC source 30
-* - PFQBC_ITLine : VIC source 31
-* Input2 : VIC_Priority: specifies the priority of the interrupt.
-* It can be a value from 0 to 15. 0 is the highest priority.
-* Output : None
-* Return : None
-*******************************************************************************/
-static void VIC_ITSourceConfig(u16 VIC_Source, u16 VIC_Priority)
-{
- if (VIC_Source < VIC_REGISTER_NUMBER) /* VIC0 */
- {
- VIC0->VCiR[VIC_Priority] &= VIC_IT_SOURCE_MASK;
- VIC0->VCiR[VIC_Priority] |= VIC_Source;
- }
- else /* VIC1 */
- {
- VIC1->VCiR[VIC_Priority] &= VIC_IT_SOURCE_MASK;
- VIC1->VCiR[VIC_Priority] |= VIC_Source - VIC_REGISTER_NUMBER;
- }
-}
-
-/*******************************************************************************
-* Function Name : VIC_Config
-* Description : Configure the ISR, the line, the mode and the priority for
-* each interrupt source line.
-* Input1 : VIC_Source: specifies the number of the source line.
-* This parameter can be one of the following values:
-* - WDG_ITLine : VIC source 0
-* - SW_ITLine : VIC source 1
-* - ARMRX_ITLine : VIC source 2
-* - ARMTX_ITLine : VIC source 3
-* - TIM0_ITLine : VIC source 4
-* - TIM1_ITLine : VIC source 5
-* - TIM2_ITLine : VIC source 6
-* - TIM3_ITLine : VIC source 7
-* - USBHP_ITLine : VIC source 8
-* - USBLP_ITLine : VIC source 9
-* - SCU_ITLine : VIC source 10
-* - ENET_ITLine : VIC source 11
-* - DMA_ITLine : VIC source 12
-* - CAN_ITLine : VIC source 13
-* - MC_ITLine : VIC source 14
-* - ADC_ITLine : VIC source 15
-* - UART0_ITLine : VIC source 16
-* - UART1_ITLine : VIC source 17
-* - UART2_ITLine : VIC source 18
-* - I2C0_ITLine : VIC source 19
-* - I2C1_ITLine : VIC source 20
-* - SSP0_ITLine : VIC source 21
-* - SSP1_ITLine : VIC source 22
-* - LVD_ITLine : VIC source 23
-* - RTC_ITLine : VIC source 24
-* - WIU_ITLine : VIC source 25
-* - EXTIT0_ITLine: VIC source 26
-* - EXTIT1_ITLine: VIC source 27
-* - EXTIT2_ITLine: VIC source 28
-* - EXTIT3_ITLine: VIC source 29
-* - USBWU_ITLine : VIC source 30
-* - PFQBC_ITLine : VIC source 31
-* Input2 : VIC_LineMode :specifies the type of interrupt of the source
-* line. This parameter can be one of the following values:
-* - VIC_IRQ: the correspondent line is configured as IRQ.
-* - VIC_FIQ: the correspondent line is configured as FIQ.
-* Input3 : VIC_Priority: specifies the priority of the interrupt.
-* It can be a value from 0 to 15. 0 is the highest priority.
-* Output : None
-* Return : None
-*******************************************************************************/
-void VIC_Config(u16 VIC_Source, VIC_ITLineMode VIC_LineMode, u8 VIC_Priority)
-{
- switch (VIC_Source)
- {
- case 0: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, WDG_IRQHandler);
- break;
-
- case 1: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, SW_IRQHandler);
- break;
-
- case 2: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, ARMRX_IRQHandler);
- break;
-
- case 3: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, ARMTX_IRQHandler);
- break;
-
- case 4: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, TIM0_IRQHandler);
- break;
-
- case 5: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, TIM1_IRQHandler);
- break;
-
- case 6: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, TIM2_IRQHandler);
- break;
-
- case 7: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, TIM3_IRQHandler);
- break;
-
- case 8: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, USBHP_IRQHandler);
- break;
-
- case 9: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, USBLP_IRQHandler);
- break;
-
- case 10: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, SCU_IRQHandler);
- break;
-
- case 11: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, ENET_IRQHandler);
- break;
-
- case 12: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, DMA_IRQHandler);
- break;
-
- case 13: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, CAN_IRQHandler);
- break;
-
- case 14: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, MC_IRQHandler);
- break;
-
- case 15: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, ADC_IRQHandler);
- break;
-
- case 16: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, UART0_IRQHandler);
- break;
-
- case 17: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, UART1_IRQHandler);
- break;
-
- case 18: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, UART2_IRQHandler);
- break;
-
- case 19: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, I2C0_IRQHandler);
- break;
-
- case 20: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, I2C1_IRQHandler);
- break;
-
- case 21: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, SSP0_IRQHandler);
- break;
-
- case 22: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, SSP1_IRQHandler);
- break;
-
- case 23: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, LVD_IRQHandler);
- break;
-
- case 24: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, RTC_IRQHandler);
- break;
-
- case 25: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, WIU_IRQHandler);
- break;
-
- case 26: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, EXTIT0_IRQHandler);
- break;
-
- case 27: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, EXTIT1_IRQHandler);
- break;
-
- case 28: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, EXTIT2_IRQHandler);
- break;
-
- case 29: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, EXTIT3_IRQHandler);
- break;
-
- case 30: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, USBWU_IRQHandler);
- break;
-
- case 31: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, PFQBC_IRQHandler);
- break;
-
- default: break;
- }
- VIC_ITModeConfig(VIC_Source, VIC_LineMode);
- VIC_VectEnableConfig(VIC_Source, VIC_Priority);
- VIC_ITSourceConfig(VIC_Source, VIC_Priority);
-}
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_wdg.c b/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_wdg.c
deleted file mode 100644
index f933635..0000000
--- a/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_wdg.c
+++ /dev/null
@@ -1,277 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_wdg.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the WDG software functions.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_wdg.h"
-#include "91x_scu.h"
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-
-
-/* WDG End of Count interrupt Flag */
-#define WDG_FLAG_EC 0x0001
-
-
-/* WDG End of Count interrupt request */
-#define WDG_IT_EC 0x0001
-
-
-
-/* WDG Start/Stop counter */
-#define WDG_Counter_Start 0x0002
-#define WDG_Counter_Stop 0xFFFD
-
-
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Registers reset value */
-/* Private function prototypes -----------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-
-/******************************************************************************
-* Function Name : WDG_DeInit
-* Description : Deinitializes the WDG peripheral registers to their default
-* reset values.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void WDG_DeInit(void)
-{
-
- SCU_APBPeriphReset(__WDG, ENABLE); /*WDG peripheral under Reset */
- SCU_APBPeriphReset(__WDG, DISABLE); /*WDG peripheral Reset off*/
-
-}
-
-/*******************************************************************************
-* Function Name : WDG_StructInit
-* Description : Fills the WDG_InitTypeDef structure member with its reset
-* value.
-* Input : WDG_InitStruct : pointer to a WDG_InitTypeDef structure
-* which will be initialized.
-* Output : None
-* Return : None
-*******************************************************************************/
-void WDG_StructInit(WDG_InitTypeDef *WDG_InitStruct)
-{
- /* Select the Watchdog running mode*/
- WDG_InitStruct->WDG_Mode = WDG_Mode_Timer;
-
- /* Select the source clock */
- WDG_InitStruct-> WDG_ClockSource = WDG_ClockSource_Apb;
-
- /* Initialize Prescaler */
- WDG_InitStruct->WDG_Prescaler =0xFF;
-
- /* Initialize Preload */
- WDG_InitStruct->WDG_Preload =0xFFFF;
-
-
-}
-
-/*******************************************************************************
-* Function Name : WDG_Init
-* Description : Initializes WDG peripheral according to the specified
-* parameters in the WDG_InitStruct.
-* Input : WDG_InitStruct: pointer to a WDG_InitTypeDef structure that
-* contains the configuration information for the WDG peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void WDG_Init(WDG_InitTypeDef* WDG_InitStruct)
-{
-
-
- if(WDG_InitStruct->WDG_ClockSource == WDG_ClockSource_Apb)
- {
- /* Select The APB clock as clock source */
- WDG->CR &= WDG_ClockSource_Apb;
- }
-
- else
- {
- /* Select the RTC clock as source */
- WDG->CR |= WDG_ClockSource_Rtc ;
- }
-
-
- /* Configure WDG Prescaler register value */
- WDG->PR = WDG_InitStruct->WDG_Prescaler;
-
- /* Configure WDG Pre-load register value */
- WDG->VR = WDG_InitStruct->WDG_Preload ;
-
-
- if(WDG_InitStruct->WDG_Mode == WDG_Mode_Timer)
- {
- /* Select Timer mode */
- WDG->CR &= WDG_Mode_Timer;
- }
- else
- {
- /* Select WDG mode */
- WDG->CR |= WDG_Mode_Wdg ;
- }
-
-
-}
-
-/*******************************************************************************
-* Function Name : WDG_Cmd
-* Description : Enables or disables the WDG peripheral.
-* Input : NewState: new state of the WDG peripheral (Newstate can be
-* ENABLE or DISABLE)
-* Output : None
-* Return : None
-*******************************************************************************/
-void WDG_Cmd(FunctionalState NewState )
-{
- if((WDG->CR & WDG_Mode_Wdg) == 0)
- {
- /* Timer mode */
- if(NewState == ENABLE)
- {
- /* Start timer by setting SC bit in Control register */
- WDG->CR |= WDG_Counter_Start;
- }
- else
- {
- /* Stop timer by clearning SC bit in Control register */
- WDG->CR &= WDG_Counter_Stop;
- }
- }
- else
- {
- /* Watchdog mode */
- if(NewState == ENABLE)
- {
- WDG->KR = WDG_KeyValue1;
- WDG->KR = WDG_KeyValue2;
- }
- }
-}
-
-/*******************************************************************************
-* Function Name : WDG_ITConfig
-* Description : Enables or disables the WDG End of Count(EC) interrupt.
-* Input : Newstate: new state of the End of Count(EC) WDG interrupt.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void WDG_ITConfig(FunctionalState NewState)
-{
- if(NewState == ENABLE)
- {
- /* Enable the End of Count interrupt */
- WDG->MR |= WDG_IT_EC;
- }
- else
- {
- /* Disable the End of Count interrupt */
- WDG->MR &= ~WDG_IT_EC;
- }
-}
-
-/*******************************************************************************
-* Function Name : WDG_GetCounter
-* Description : Gets the WDG’s current counter value.
-* Input : None
-* Output : None
-* Return : The WDG current counter value
-*******************************************************************************/
-u16 WDG_GetCounter(void)
-{
- return WDG->CNT;
-}
-
-
-
-
-/*******************************************************************************
-* Function Name : WDG_GetITStatus
-* Description : Checks whether the WDG End of Count(EC) interrupt is occured or not.
-* Input : None
-* Output : None
-* Return : The new state of WDG_IT (SET or RESET).
-*******************************************************************************/
-ITStatus WDG_GetITStatus(void)
-{
- if(((WDG->SR & WDG_IT_EC) != RESET )&&((WDG->MR & WDG_IT_EC) != RESET ))
- {
- return SET;
- }
- else
- {
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : WDG_ClearITPendingBit
-* Description : Clears the WDG's End of Count(EC) interrupt pending bit.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void WDG_ClearITPendingBit(void)
-{
- /* Clear the EC pending bit */
- WDG->SR &= ~WDG_IT_EC;
-
-}
-
-/*******************************************************************************
-* Function Name : WDG_ClearFlag
-* Description : Clears the WDG's End of Count(EC) Flag.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void WDG_ClearFlag(void)
-{
- /* Clear the EC Flag */
-
- WDG->SR &= ~WDG_FLAG_EC;
-
-}
-
-
-/*******************************************************************************
-* Function Name : WDG_GetFlagStatus
-* Description : Checks whether the WDG End of Count(EC) flag is set or not.
-* Input : None
-* Output : None
-* Return : The new state of the WDG_FLAG (SET or RESET).
-*******************************************************************************/
-FlagStatus WDG_GetFlagStatus(void)
-{
- if((WDG->SR & WDG_FLAG_EC) != RESET )
- {
- return SET;
- }
- else
- {
- return RESET;
- }
-}
-
-
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_wiu.c b/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_wiu.c
deleted file mode 100644
index 3154a3c..0000000
--- a/uc_str912/prj_blinky_simple_startup/str91x_lib/src/91x_wiu.c
+++ /dev/null
@@ -1,190 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_wiu.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the WIU software functions.
-**********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-**********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*********************************************************************************/
-
-/* Standard include ----------------------------------------------------------*/
-#include "91x_wiu.h"
-#include "91x_scu.h"
-
-/* Include of other module interface headers ---------------------------------*/
-/* Local includes ------------------------------------------------------------*/
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/* Interface functions -------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/******************************************************************************
-* Function Name : WIU_Init
-* Description : Initializes the WIU unit according to the specified parameters
-* in the WIU_InitTypeDef structure.
-* Input : WIU_InitStruct: pointer to a WIU_InitTypeDef structure that
-* contains the configuration information for the WIU peripheral.
-* Output : None
-* Return : None
-******************************************************************************/
-void WIU_Init(WIU_InitTypeDef* WIU_InitStruct)
-{
- /* select the Wake-up line to be used */
- WIU->MR |= WIU_InitStruct->WIU_Line;
-
- /* configure the triggering edge */
- if(WIU_InitStruct->WIU_TriggerEdge == WIU_RisingEdge)
- {
- /* trigger on rising edge */
- WIU->TR |= WIU_InitStruct->WIU_Line;
- }
- else
- {
- /* trigger on falling edge */
- WIU->TR &= ~WIU_InitStruct->WIU_Line;
- }
-
- if(WIU_InitStruct->WIU_Mode == WIU_Mode_SWInterrupt)
- {
- /* enable interrupt mode */
- WIU->CTRL |= WIU_Mode_Interrupt;
-
- /* set the corresponding WUINT bit*/
- WIU->INTR |= WIU_InitStruct->WIU_Line;
- }
- else
- {
- /* configure the WIU mode */
- WIU->CTRL |= WIU_InitStruct->WIU_Mode;
- }
-}
-
-/******************************************************************************
-* Function Name : WIU_DeInit
-* Description : Deinitializes the WIU registers to their default reset values.
-* Input : None
-* Output : None
-* Return : None
-******************************************************************************/
-void WIU_DeInit(void)
-{
- /* initialize the WIU registers to their reset value */
- SCU_APBPeriphReset(__WIU, ENABLE);
- SCU_APBPeriphReset(__WIU, DISABLE);
-}
-
-/******************************************************************************
-* Function Name : WIU_StructInit
-* Description : Fills in a WIU_InitTypeDef structure with the reset value of
-* each parameter.
-* Input : WIU_InitStruct : pointer to a WIU_InitTypeDef structure
-* which will be initialized.
-* Output : None
-* Return : None
-******************************************************************************/
-void WIU_StructInit(WIU_InitTypeDef* WIU_InitStruct)
-{
- /* initialize the WIU_InitStruct fields to their reset values */
- WIU_InitStruct->WIU_Mode = 0x0 ;
- WIU_InitStruct->WIU_Line = 0x0 ;
- WIU_InitStruct->WIU_TriggerEdge = WIU_FallingEdge ;
-}
-
-
-/*******************************************************************************
-* Function Name : WIU_GenerateSWInterrupt
-* Description : Generates a Software interrupt.
-* Input : - WIU_Line: specifies the WIU lines to be enabled or
-* disabled. This parameter can be:
-* - WIU_Linex: External interrupt line x where x(0..31)
-* Output : None
-* Return : None
-*******************************************************************************/
-void WIU_GenerateSWInterrupt(u32 WIU_Line)
-{
- WIU->INTR |= WIU_Line;
-}
-
-/*******************************************************************************
-* Function Name : WIU_GetFlagStatus
-* Description : Checks whether the specified WIU line flag is set or not.
-* Input : - WIU_Line: specifies the WIU lines flag to check.
-* This parameter can be:
-* - WIU_Linex: External interrupt line x where x(0..31)
-* Output : None
-* Return : The new state of WIU_Line (SET or RESET).
-*******************************************************************************/
-FlagStatus WIU_GetFlagStatus(u32 WIU_Line)
-{
- if((WIU->PR & WIU_Line) != RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : WIU_ClearFlag
-* Description : Clears the WIU’s line pending flags.
-* Input : - WIU_Line: specifies the WIU lines flags to clear.
-* This parameter can be:
-* - WIU_Linex: External interrupt line x where x(0..31)
-* Output : None
-* Return : None
-*******************************************************************************/
-void WIU_ClearFlag(u32 WIU_Line)
-{
- WIU->PR = WIU_Line;
-}
-
-/*******************************************************************************
-* Function Name : WIU_GetITStatus
-* Description : Checks whether the specified WIU line is asserted or not.
-* Input : - WIU_Line: specifies the WIU lines to check.
-* This parameter can be:
-* - WIU_Linex: External interrupt line x where x(0..31)
-* Output : None
-* Return : The new state of WIU_Line (SET or RESET).
-*******************************************************************************/
-ITStatus WIU_GetITStatus(u32 WIU_Line)
-{
- if(((WIU->PR & WIU_Line) != RESET)&& ((WIU->MR & WIU_Line) != RESET))
- {
- return SET;
- }
- else
- {
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : WIU_ClearITPendingBit
-* Description : Clears the WIU’s line pending bits.
-* Input : - WIU_Line: specifies the WIU lines to clear.
-* This parameter can be:
-* - WIU_Linex: External interrupt line x where x(0..31)
-* Output : None
-* Return : None
-*******************************************************************************/
-void WIU_ClearITPendingBit(u32 WIU_Line)
-{
- WIU->PR = WIU_Line;
-}
-
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_main_add/Makefile b/uc_str912/prj_main_add/Makefile
deleted file mode 100644
index 96db3a9..0000000
--- a/uc_str912/prj_main_add/Makefile
+++ /dev/null
@@ -1,146 +0,0 @@
-#
-# !!!! Do NOT edit this makefile with an editor which replace tabs by spaces !!!!
-#
-##############################################################################################
-#
-# On command line:
-#
-# make all = Create project
-#
-# make clean = Clean project files.
-#
-# To rebuild project do "make clean" and "make all".
-#
-
-##############################################################################################
-# Start of default section
-#
-
-TRGT = arm-none-eabi-
-CC = $(TRGT)gcc
-CP = $(TRGT)objcopy
-AS = $(TRGT)gcc -x assembler-with-cpp
-BIN = $(CP) -O ihex
-
-MCU = arm9e
-
-# List all default C defines here, like -D_DEBUG=1
-DDEFS =
-
-# List all default ASM defines here, like -D_DEBUG=1
-DADEFS =
-
-# List all default directories to look for include files here
-DINCDIR =
-
-# List the default directory to look for the libraries here
-DLIBDIR =
-
-# List all default libraries here
-DLIBS =
-
-#
-# End of default section
-##############################################################################################
-
-##############################################################################################
-# Start of user section
-#
-
-# Define project name here
-PROJECT = test
-
-# Define linker script file here
-LDSCRIPT_RAM = ./prj/str912_ram.ld
-LDSCRIPT_ROM = ./prj/str912_rom.ld
-
-# List all user C define here, like -D_DEBUG=1
-UDEFS =
-
-# Define ASM defines here
-UADEFS =
-
-# List C source files here
-SRC = ./src/main.c
-
-# List ASM source files here
-ASRC = ./src/startup.s
-
-# List all user directories here
-UINCDIR = ./inc
-
-# List the user directory to look for the libraries here
-ULIBDIR =
-
-# List all user libraries here
-ULIBS =
-
-# Define optimisation level here
-OPT = -O0
-
-#
-# End of user defines
-##############################################################################################
-
-
-INCDIR = $(patsubst %,-I%,$(DINCDIR) $(UINCDIR))
-LIBDIR = $(patsubst %,-L%,$(DLIBDIR) $(ULIBDIR))
-DEFS = $(DDEFS) $(UDEFS)
-ADEFS = $(DADEFS) $(UADEFS)
-OBJS = $(ASRC:.s=.o) $(SRC:.c=.o)
-LIBS = $(DLIBS) $(ULIBS)
-MCFLAGS = -mcpu=$(MCU)
-
-ASFLAGS = $(MCFLAGS) -g -gdwarf-2 -Wa,-amhls=$(<:.s=.lst) $(ADEFS)
-CPFLAGS = $(MCFLAGS) $(OPT) -gdwarf-2 -mthumb-interwork -fomit-frame-pointer -Wall -Wstrict-prototypes -fverbose-asm -Wa,-ahlms=$(<:.c=.lst) $(DEFS)
-LDFLAGS_RAM = $(MCFLAGS) -nostartfiles -T$(LDSCRIPT_RAM) -Wl,-Map=$(PROJECT)_ram.map,--cref,--no-warn-mismatch $(LIBDIR)
-LDFLAGS_ROM = $(MCFLAGS) -nostartfiles -T$(LDSCRIPT_ROM) -Wl,-Map=$(PROJECT)_rom.map,--cref,--no-warn-mismatch $(LIBDIR)
-
-# Generate dependency information
-CPFLAGS += -MD -MP -MF .dep/$(@F).d
-
-#
-# makefile rules
-#
-
-all: RAM ROM
-
-RAM: $(OBJS) $(PROJECT)_ram.elf $(PROJECT)_ram.hex
-
-ROM: $(OBJS) $(PROJECT)_rom.elf $(PROJECT)_rom.hex
-
-%o : %c
- $(CC) -c $(CPFLAGS) -I . $(INCDIR) $< -o $@
-
-%o : %s
- $(AS) -c $(ASFLAGS) $< -o $@
-
-%ram.elf: $(OBJS)
- $(CC) $(OBJS) $(LDFLAGS_RAM) $(LIBS) -o $@
-
-%rom.elf: $(OBJS)
- $(CC) $(OBJS) $(LDFLAGS_ROM) $(LIBS) -o $@
-
-%hex: %elf
- $(BIN) $< $@
-
-clean:
- -rm -f $(OBJS)
- -rm -f $(PROJECT)_ram.elf
- -rm -f $(PROJECT)_ram.map
- -rm -f $(PROJECT)_ram.hex
- -rm -f $(PROJECT)_rom.elf
- -rm -f $(PROJECT)_rom.map
- -rm -f $(PROJECT)_rom.hex
- -rm -f $(SRC:.c=.c.bak)
- -rm -f $(SRC:.c=.lst)
- -rm -f $(ASRC:.s=.s.bak)
- -rm -f $(ASRC:.s=.lst)
- -rm -fR .dep
-
-#
-# Include the dependency files, should be the last of the makefile
-#
--include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
-
-# *** EOF ***
diff --git a/uc_str912/prj_main_add/dram.bat b/uc_str912/prj_main_add/dram.bat
deleted file mode 100644
index 9f6bae9..0000000
--- a/uc_str912/prj_main_add/dram.bat
+++ /dev/null
@@ -1 +0,0 @@
-arm-elf-insight -x .\prj\str912_ram.gdb test_ram.elf \ No newline at end of file
diff --git a/uc_str912/prj_main_add/inc/typedefs.h b/uc_str912/prj_main_add/inc/typedefs.h
deleted file mode 100644
index a7201fd..0000000
--- a/uc_str912/prj_main_add/inc/typedefs.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/****************************************************************************
-* Copyright (c) 2006 by Michael Fischer. All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions
-* are met:
-*
-* 1. Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* 2. Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* 3. Neither the name of the author nor the names of its contributors may
-* be used to endorse or promote products derived from this software
-* without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
-* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
-* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-* SUCH DAMAGE.
-*
-****************************************************************************
-* History:
-*
-* 30.03.06 mifi First Version for Insight tutorial
-****************************************************************************/
-#ifndef __TYPEDEFS_H__
-#define __TYPEDEFS_H__
-
-/*
- * Some types to use Windows like source
- */
-typedef char CHAR; /* 8-bit signed data */
-typedef unsigned char BYTE; /* 8-bit unsigned data */
-typedef unsigned short WORD; /* 16-bit unsigned data */
-typedef long LONG; /* 32-bit signed data */
-typedef unsigned long ULONG; /* 32-bit unsigned data */
-typedef unsigned long DWORD; /* 32-bit unsigned data */
-
-
-#endif /* !__TYPEDEFS_H__ */
-/*** EOF ***/
diff --git a/uc_str912/prj_main_add/prj/eclipse_ram.gdb b/uc_str912/prj_main_add/prj/eclipse_ram.gdb
deleted file mode 100644
index 0c72df4..0000000
--- a/uc_str912/prj_main_add/prj/eclipse_ram.gdb
+++ /dev/null
@@ -1,24 +0,0 @@
-target remote localhost:3333
-monitor reset
-monitor sleep 500
-monitor poll
-monitor soft_reset_halt
-monitor arm7_9 sw_bkpts enable
-
-# Set SRAM size to 96 KB
-monitor mww 0x5C002034 0x0197
-monitor mdw 0x5C002034
-
-# Set Flash, Bank0 size to 512 KB
-monitor mww 0x54000000 0xf
-
-# needed for gdb 6.8 and higher
-set mem inaccessible-by-default off
-
-load
-break main
-continue
-
-
-
-
diff --git a/uc_str912/prj_main_add/prj/eclipse_rom.gdb b/uc_str912/prj_main_add/prj/eclipse_rom.gdb
deleted file mode 100644
index 3baf4fe..0000000
--- a/uc_str912/prj_main_add/prj/eclipse_rom.gdb
+++ /dev/null
@@ -1,24 +0,0 @@
-target remote localhost:3333
-monitor reset
-monitor sleep 500
-monitor poll
-monitor soft_reset_halt
-monitor arm7_9 force_hw_bkpts enable
-
-# Set SRAM size to 96 KB
-monitor mww 0x5C002034 0x0197
-monitor mdw 0x5C002034
-
-# Set Flash, Bank0 size to 512 KB
-monitor mww 0x54000000 0xf
-
-# needed for gdb 6.8 and higher
-set mem inaccessible-by-default off
-
-load
-break main
-continue
-
-
-
-
diff --git a/uc_str912/prj_main_add/prj/jtagkey.cfg b/uc_str912/prj_main_add/prj/jtagkey.cfg
deleted file mode 100644
index 4a25c96..0000000
--- a/uc_str912/prj_main_add/prj/jtagkey.cfg
+++ /dev/null
@@ -1,59 +0,0 @@
-# daemon configuration
-telnet_port 4444
-gdb_port 3333
-
-# tell gdb our flash memory map
-# and enable flash programming
-gdb_memory_map enable
-gdb_flash_program enable
-
-#
-# interface, if you want to use an other interface
-# you must replace this section here
-#
-#################### interface start ####################
-
-interface ft2232
-ft2232_device_desc "Amontec JTAGkey A"
-ft2232_layout jtagkey
-ft2232_vid_pid 0x0403 0xcff8
-
-##################### interface end #####################
-
-# jtag speed
-# start slow, speed up after reset
-jtag_khz 16 2000
-
-#delays on reset lines
-jtag_nsrst_delay 100
-jtag_ntrst_delay 100
-
-#use combined on interfaces or targets that can't set TRST/SRST separately
-reset_config trst_and_srst
-
-#jtag scan chain
-#format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)
-jtag_device 8 0x1 0x1 0xfe
-jtag_device 4 0x1 0xf 0xe
-jtag_device 5 0x1 0x1 0x1e
-
-#target configuration
-daemon_startup reset
-
-#target <type> <startup mode>
-#target arm7tdmi <reset mode> <chainpos> <endianness> <variant>
-target arm966e little reset_halt 1 arm966e
-run_and_halt_time 0 30
-
-target_script 0 reset ./prj/str912_reset.script
-
-target_script 0 gdb_program_config ./prj/str912_program.script
-
-working_area 0 0x50000000 16384 nobackup
-
-#flash bank str9x <base> <size> 0 0 <target#> <variant>
-flash bank str9x 0x00000000 0x00080000 0 0 0
-flash bank str9x 0x00080000 0x00008000 0 0 0
-
-# For more information about the configuration files, take a
-# look at the "Open On-Chip Debugger (openocd)" documentation.
diff --git a/uc_str912/prj_main_add/prj/str912_program.script b/uc_str912/prj_main_add/prj/str912_program.script
deleted file mode 100644
index 9f88149..0000000
--- a/uc_str912/prj_main_add/prj/str912_program.script
+++ /dev/null
@@ -1,2 +0,0 @@
-str9x flash_config 0 4 2 0 0x80000
-flash protect 0 0 7 off
diff --git a/uc_str912/prj_main_add/prj/str912_ram.gdb b/uc_str912/prj_main_add/prj/str912_ram.gdb
deleted file mode 100644
index 892f14b..0000000
--- a/uc_str912/prj_main_add/prj/str912_ram.gdb
+++ /dev/null
@@ -1,22 +0,0 @@
-target remote localhost:3333
-monitor reset
-monitor sleep 500
-monitor poll
-monitor soft_reset_halt
-monitor arm7_9 sw_bkpts enable
-
-# Set SRAM size to 96 KB
-monitor mww 0x5C002034 0x0197
-monitor mdw 0x5C002034
-
-# needed for gdb 6.8 and higher
-set mem inaccessible-by-default off
-
-load
-break main
-continue
-
-
-
-
-
diff --git a/uc_str912/prj_main_add/prj/str912_ram.ld b/uc_str912/prj_main_add/prj/str912_ram.ld
deleted file mode 100644
index 0974b39..0000000
--- a/uc_str912/prj_main_add/prj/str912_ram.ld
+++ /dev/null
@@ -1,218 +0,0 @@
-/***********************************************************************************
-* Copyright 2005 Anglia Design
-* This demo code and associated components are provided as is and has no warranty,
-* implied or otherwise. You are free to use/modify any of the provided
-* code at your own risk in your applications with the expressed limitation
-* of liability (see below)
-*
-* LIMITATION OF LIABILITY: ANGLIA OR ANGLIA DESIGNS SHALL NOT BE LIABLE FOR ANY
-* LOSS OF PROFITS, LOSS OF USE, LOSS OF DATA, INTERRUPTION OF BUSINESS, NOR FOR
-* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND WHETHER UNDER
-* THIS AGREEMENT OR OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-*
-* Author : Spencer Oliver
-* Web : www.anglia-designs.com
-*
-***********************************************************************************/
-
-/* Stack Sizes */
-
- _STACKSIZE = 1024;
- _STACKSIZE_IRQ = 256;
- _STACKSIZE_FIQ = 0;
- _STACKSIZE_SVC = 1024;
- _STACKSIZE_ABT = 0;
- _STACKSIZE_UND = 0;
- _HEAPSIZE = 1024;
-
-/* Memory Definitions */
-
-MEMORY
-{
- DATA (rw) : ORIGIN = 0x04000000, LENGTH = 0x00018000
-}
-
-/* Section Definitions */
-
-SECTIONS
-{
- /* first section is .text which is used for code */
-
- .text :
- {
- KEEP(*(.vectors))
- KEEP(*(.init))
- *(.text .text.*)
- *(.gnu.linkonce.t.*)
- *(.glue_7t .glue_7)
- KEEP(*(.fini))
- *(.gcc_except_table)
- } >DATA =0
- . = ALIGN(4);
-
- /* .ctors .dtors are used for c++ constructors/destructors */
-
- .ctors :
- {
- PROVIDE(__ctors_start__ = .);
- KEEP(*(SORT(.ctors.*)))
- KEEP(*(.ctors))
- PROVIDE(__ctors_end__ = .);
- } >DATA
-
- .dtors :
- {
- PROVIDE(__dtors_start__ = .);
- KEEP(*(SORT(.dtors.*)))
- KEEP(*(.dtors))
- PROVIDE(__dtors_end__ = .);
- } >DATA
-
- /* .rodata section which is used for read-only data (constants) */
-
- .rodata :
- {
- *(.rodata .rodata.*)
- *(.gnu.linkonce.r.*)
- } >DATA
- . = ALIGN(4);
-
- _etext = .;
- PROVIDE (etext = .);
-
- /* .data section which is used for initialized data */
-
- .data : AT (_etext)
- {
- *(.data .data.*)
- *(.gnu.linkonce.d.*)
- SORT(CONSTRUCTORS)
- } >DATA
- . = ALIGN(4);
-
- __data_start = .;
- _edata = .;
- PROVIDE (edata = .);
-
- /* .bss section which is used for uninitialized data */
-
- .bss :
- {
- __bss_start = .;
- __bss_start__ = .;
- *(.bss .bss.*)
- *(.gnu.linkonce.b.*)
- *(COMMON)
- . = ALIGN(4);
- } >DATA
- . = ALIGN(4);
- __bss_end__ = .;
-
- _end = .;
- PROVIDE(end = .);
-
- /* .heap section which is used for memory allocation */
-
- .heap (NOLOAD) :
- {
- __heap_start__ = .;
- *(.heap)
- . = MAX(__heap_start__ + _HEAPSIZE , .);
- } >DATA
- __heap_end__ = __heap_start__ + SIZEOF(.heap);
-
- /* .stack section - user mode stack */
-
- .stack (__heap_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_start__ = .;
- *(.stack)
- . = MAX(__stack_start__ + _STACKSIZE , .);
- } >DATA
- __stack_end__ = __stack_start__ + SIZEOF(.stack);
-
- /* .stack_irq section */
-
- .stack_irq (__stack_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_irq_start__ = .;
- *(.stack_irq)
- . = MAX(__stack_irq_start__ + _STACKSIZE_IRQ , .);
- } >DATA
- __stack_irq_end__ = __stack_irq_start__ + SIZEOF(.stack_irq);
-
- /* .stack_fiq section */
-
- .stack_fiq (__stack_irq_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_fiq_start__ = .;
- *(.stack_fiq)
- . = MAX(__stack_fiq_start__ + _STACKSIZE_FIQ , .);
- } >DATA
- __stack_fiq_end__ = __stack_fiq_start__ + SIZEOF(.stack_fiq);
-
- /* .stack_svc section */
-
- .stack_svc (__stack_fiq_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_svc_start__ = .;
- *(.stack_svc)
- . = MAX(__stack_svc_start__ + _STACKSIZE_SVC , .);
- } >DATA
- __stack_svc_end__ = __stack_svc_start__ + SIZEOF(.stack_svc);
-
- /* .stack_abt section */
-
- .stack_abt (__stack_svc_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_abt_start__ = .;
- *(.stack_abt)
- . = MAX(__stack_abt_start__ + _STACKSIZE_ABT , .);
- } >DATA
- __stack_abt_end__ = __stack_abt_start__ + SIZEOF(.stack_abt);
-
- /* .stack_und section */
-
- .stack_und (__stack_abt_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_und_start__ = .;
- *(.stack_und)
- . = MAX(__stack_und_start__ + _STACKSIZE_UND , .);
- } >DATA
- __stack_und_end__ = __stack_und_start__ + SIZEOF(.stack_und);
-
- /* 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) }
-}
-
diff --git a/uc_str912/prj_main_add/prj/str912_reset.script b/uc_str912/prj_main_add/prj/str912_reset.script
deleted file mode 100644
index 8c222a8..0000000
--- a/uc_str912/prj_main_add/prj/str912_reset.script
+++ /dev/null
@@ -1,2 +0,0 @@
-# -- Enable 96K RAM */
-mww 0x5C002034, 0x0191 # PFQBC enabled / DTCM & AHB wait-states disabled
diff --git a/uc_str912/prj_main_add/prj/str912_rom.gdb b/uc_str912/prj_main_add/prj/str912_rom.gdb
deleted file mode 100644
index 4b2649c..0000000
--- a/uc_str912/prj_main_add/prj/str912_rom.gdb
+++ /dev/null
@@ -1,22 +0,0 @@
-target remote localhost:3333
-monitor reset
-monitor sleep 500
-monitor poll
-monitor soft_reset_halt
-monitor arm7_9 force_hw_bkpts enable
-
-# Set SRAM size to 96 KB
-monitor mww 0x5C002034 0x0197
-monitor mdw 0x5C002034
-
-# needed for gdb 6.8 and higher
-set mem inaccessible-by-default off
-
-load
-break main
-continue
-
-
-
-
-
diff --git a/uc_str912/prj_main_add/prj/str912_rom.ld b/uc_str912/prj_main_add/prj/str912_rom.ld
deleted file mode 100644
index 8cbb7f7..0000000
--- a/uc_str912/prj_main_add/prj/str912_rom.ld
+++ /dev/null
@@ -1,249 +0,0 @@
-/***********************************************************************************
-* Copyright 2005 Anglia Design
-* This demo code and associated components are provided as is and has no warranty,
-* implied or otherwise. You are free to use/modify any of the provided
-* code at your own risk in your applications with the expressed limitation
-* of liability (see below)
-*
-* LIMITATION OF LIABILITY: ANGLIA OR ANGLIA DESIGNS SHALL NOT BE LIABLE FOR ANY
-* LOSS OF PROFITS, LOSS OF USE, LOSS OF DATA, INTERRUPTION OF BUSINESS, NOR FOR
-* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND WHETHER UNDER
-* THIS AGREEMENT OR OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-*
-* Author : Spencer Oliver
-* Web : www.anglia-designs.com
-*
-***********************************************************************************/
-
-/* Stack Sizes */
-
- _STACKSIZE = 1024;
- _STACKSIZE_IRQ = 256;
- _STACKSIZE_FIQ = 0;
- _STACKSIZE_SVC = 1024;
- _STACKSIZE_ABT = 0;
- _STACKSIZE_UND = 0;
- _HEAPSIZE = 1024;
-
-/* Memory Definitions */
-
-MEMORY
-{
- CODE (rx) : ORIGIN = 0x00000000, LENGTH = 0x00080000
- DATA (rw) : ORIGIN = 0x04000000, LENGTH = 0x00018000
-}
-
-/* Section Definitions */
-
-SECTIONS
-{
- /* first section is .text which is used for code */
-
- .text :
- {
- CREATE_OBJECT_SYMBOLS
- KEEP(*(.vectors))
- KEEP(*(.init))
- *(.text .text.*)
- *(.gnu.linkonce.t.*)
- *(.glue_7t) *(.glue_7) *(.vfp11_veneer)
- KEEP(*(.fini))
- *(.gcc_except_table)
- } >CODE =0
- . = ALIGN(4);
-
- /* .ctors .dtors are used for c++ constructors/destructors */
-
- .ctors :
- {
- PROVIDE(__ctors_start__ = .);
- KEEP(*(SORT(.ctors.*)))
- KEEP(*(.ctors))
- PROVIDE(__ctors_end__ = .);
- } >CODE
-
- .dtors :
- {
- PROVIDE(__dtors_start__ = .);
- KEEP(*(SORT(.dtors.*)))
- KEEP(*(.dtors))
- PROVIDE(__dtors_end__ = .);
- } >CODE
-
- /* .rodata section which is used for read-only data (constants) */
-
- .rodata :
- {
- *(.rodata .rodata.*)
- *(.gnu.linkonce.r.*)
- } >CODE
- . = ALIGN(4);
-
- .init_array :
- {
- *(.init)
- *(.fini)
- PROVIDE_HIDDEN (__preinit_array_start = .);
- KEEP (*(.preinit_array))
- PROVIDE_HIDDEN (__preinit_array_end = .);
- PROVIDE_HIDDEN (__init_array_start = .);
- KEEP (*(SORT(.init_array.*)))
- KEEP (*(.init_array))
- PROVIDE_HIDDEN (__init_array_end = .);
- PROVIDE_HIDDEN (__fini_array_start = .);
- KEEP (*(.fini_array))
- KEEP (*(SORT(.fini_array.*)))
- PROVIDE_HIDDEN (__fini_array_end = .);
- } >CODE
-
- . = ALIGN(4);
-
- /* .ARM.exidx is sorted, so has to go in its own output section. */
- __exidx_start = .;
- .ARM.exidx :
- {
- *(.ARM.exidx* .gnu.linkonce.armexidx.*)
- } >CODE
- __exidx_end = .;
-
- _etext = .;
- PROVIDE (etext = .);
-
- /* .data section which is used for initialized data */
-
- .data : AT (_etext)
- {
- __data_start = .;
- *(.data .data.*)
- *(.gnu.linkonce.d.*)
- SORT(CONSTRUCTORS)
- . = ALIGN(4);
- *(.fastrun .fastrun.*)
- } >DATA
- . = ALIGN(4);
-
- _edata = .;
- PROVIDE (edata = .);
-
- /* .bss section which is used for uninitialized data */
-
- .bss :
- {
- __bss_start = .;
- __bss_start__ = .;
- *(.bss .bss.*)
- *(.gnu.linkonce.b.*)
- *(COMMON)
- . = ALIGN(4);
- } >DATA
- . = ALIGN(4);
- __bss_end__ = .;
-
- _end = .;
- PROVIDE(end = .);
-
- /* .heap section which is used for memory allocation */
-
- .heap (NOLOAD) :
- {
- __heap_start__ = .;
- *(.heap)
- . = MAX(__heap_start__ + _HEAPSIZE , .);
- } >DATA
- __heap_end__ = __heap_start__ + SIZEOF(.heap);
-
- /* .stack section - user mode stack */
-
- .stack (__heap_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_start__ = .;
- *(.stack)
- . = MAX(__stack_start__ + _STACKSIZE , .);
- } >DATA
- __stack_end__ = __stack_start__ + SIZEOF(.stack);
-
- /* .stack_irq section */
-
- .stack_irq (__stack_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_irq_start__ = .;
- *(.stack_irq)
- . = MAX(__stack_irq_start__ + _STACKSIZE_IRQ , .);
- } >DATA
- __stack_irq_end__ = __stack_irq_start__ + SIZEOF(.stack_irq);
-
- /* .stack_fiq section */
-
- .stack_fiq (__stack_irq_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_fiq_start__ = .;
- *(.stack_fiq)
- . = MAX(__stack_fiq_start__ + _STACKSIZE_FIQ , .);
- } >DATA
- __stack_fiq_end__ = __stack_fiq_start__ + SIZEOF(.stack_fiq);
-
- /* .stack_svc section */
-
- .stack_svc (__stack_fiq_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_svc_start__ = .;
- *(.stack_svc)
- . = MAX(__stack_svc_start__ + _STACKSIZE_SVC , .);
- } >DATA
- __stack_svc_end__ = __stack_svc_start__ + SIZEOF(.stack_svc);
-
- /* .stack_abt section */
-
- .stack_abt (__stack_svc_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_abt_start__ = .;
- *(.stack_abt)
- . = MAX(__stack_abt_start__ + _STACKSIZE_ABT , .);
- } >DATA
- __stack_abt_end__ = __stack_abt_start__ + SIZEOF(.stack_abt);
-
- /* .stack_und section */
-
- .stack_und (__stack_abt_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_und_start__ = .;
- *(.stack_und)
- . = MAX(__stack_und_start__ + _STACKSIZE_UND , .);
- } >DATA
- __stack_und_end__ = __stack_und_start__ + SIZEOF(.stack_und);
-
- /* 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) }
-}
-
diff --git a/uc_str912/prj_main_add/segger.gdb b/uc_str912/prj_main_add/segger.gdb
deleted file mode 100644
index 31f9031..0000000
--- a/uc_str912/prj_main_add/segger.gdb
+++ /dev/null
@@ -1,17 +0,0 @@
-set complaints 1
-set output-radix 16
-set input-radix 16
-set prompt (arm-gdb)
-
-target remote localhost:2331
-
-monitor speed adaptive
-monitor endian little
-
-monitor reset
-monitor flash device = STR912FAW44
-monitor flash breakpoints = 1
-monitor flash download = 1
-monitor halt
-
-pwd
diff --git a/uc_str912/prj_main_add/src/main.c b/uc_str912/prj_main_add/src/main.c
deleted file mode 100644
index b846536..0000000
--- a/uc_str912/prj_main_add/src/main.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/****************************************************************************
-* Copyright (c) 2006 by Michael Fischer. All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions
-* are met:
-*
-* 1. Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* 2. Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* 3. Neither the name of the author nor the names of its contributors may
-* be used to endorse or promote products derived from this software
-* without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
-* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
-* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-* SUCH DAMAGE.
-*
-****************************************************************************
-* History:
-*
-* 30.03.06 mifi First Version for Insight tutorial
-* 26.01.08 mifi Added variable "d" to test const variable.
-****************************************************************************/
-#define __MAIN_C__
-
-/*
- * I use the include only, to show
- * how to setup a include dir in the makefile
- */
-#include "typedefs.h"
-
-/*=========================================================================*/
-/* DEFINE: All Structures and Common Constants */
-/*=========================================================================*/
-
-/*=========================================================================*/
-/* DEFINE: Prototypes */
-/*=========================================================================*/
-
-/*=========================================================================*/
-/* DEFINE: Definition of all local Data */
-/*=========================================================================*/
-static const DWORD d = 7;
-
-/*=========================================================================*/
-/* DEFINE: Definition of all local Procedures */
-/*=========================================================================*/
-
-/*=========================================================================*/
-/* DEFINE: All code exported */
-/*=========================================================================*/
-/***************************************************************************/
-/* main */
-/***************************************************************************/
-int main (void)
-{
- DWORD a = 1;
- DWORD b = 2;
- DWORD c = 0;
-
- a = a + d;
-
- while (1)
- {
- a++;
- b++;
- c = a + b;
- }
-
- /*
- * This return here make no sense.
- * But to prevent the compiler warning:
- * "return type of 'main' is not 'int'
- * we use an int as return :-)
- */
- return(0);
-}
-
-/*** EOF ***/
diff --git a/uc_str912/prj_main_add/src/startup.s b/uc_str912/prj_main_add/src/startup.s
deleted file mode 100644
index cdf2c44..0000000
--- a/uc_str912/prj_main_add/src/startup.s
+++ /dev/null
@@ -1,222 +0,0 @@
-/***********************************************************************************
-* Copyright 2005 Anglia Design
-* This demo code and associated components are provided as is and has no warranty,
-* implied or otherwise. You are free to use/modify any of the provided
-* code at your own risk in your applications with the expressed limitation
-* of liability (see below)
-*
-* LIMITATION OF LIABILITY: ANGLIA OR ANGLIA DESIGNS SHALL NOT BE LIABLE FOR ANY
-* LOSS OF PROFITS, LOSS OF USE, LOSS OF DATA, INTERRUPTION OF BUSINESS, NOR FOR
-* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND WHETHER UNDER
-* THIS AGREEMENT OR OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-*
-* Author : Spencer Oliver
-* Web : www.anglia-designs.com
-*
-* mifi, 22.01.2008, small changes by the init of the C++ eabi constructors.
-* Here I have replaced the eabi init by the normal init.
-* Thanks to Spen for the startup code.
-***********************************************************************************/
-
-/**** Startup Code (executed after Reset) ****/
-
-/* Frequency values kHz */
-/* set to suit target hardware */
-
- .equ FOSC, 25000
-
-/* Standard definitions of Mode bits and Interrupt (I & F) flags in PSRs */
-
- .equ Mode_USR, 0x10
- .equ Mode_FIQ, 0x11
- .equ Mode_IRQ, 0x12
- .equ Mode_SVC, 0x13
- .equ Mode_ABT, 0x17
- .equ Mode_UND, 0x1B
- .equ Mode_SYS, 0x1F /* available on ARM Arch 4 and later */
-
- .equ I_Bit, 0x80 /* when I bit is set, IRQ is disabled */
- .equ F_Bit, 0x40 /* when F bit is set, FIQ is disabled */
-
- .equ SRAM32, 0x00
- .equ SRAM64, 0x08
- .equ SRAM96, 0x10
-
-/* --- System memory locations */
-
- .equ SCRO_AHB_UMB, 0x5C002034 /* System configuration register 0 (unbuffered) */
-
- .equ FMI_BASE_UMB, 0x54000000 /* Flash FMI base address (unbuffered) */
- .equ BBSR_off_addr, 0x00
- .equ NBBSR_off_addr, 0x04
- .equ BBADR_off_addr, 0x0C
- .equ NBBADR_off_addr, 0x10
- .equ CR_off_addr, 0x18
-
-.ifndef LIBUFF
- .equ LIBUFF, 0
-.endif
-
-/* Startup Code must be linked first at Address at which it expects to run. */
-
- .text
- .arm
- .section .init, "ax"
-
- .global _start
- .global _Main_Crystal
-
-/* After remap this will be our reset handler */
-
-_start:
- LDR pc, =NextInst
-NextInst:
-
- NOP /* Wait for OSC stabilization */
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
-
-/* Enable buffered mode */
-
-.if LIBUFF
- MRC p15, 0, r0, c1, c0, 0 /* Read CP15 register 1 into r0 */
- ORR r0, r0, #0x8 /* Enable Write Buffer on AHB */
- MCR p15, 0, r0, c1, c0, 0 /* Write CP15 register 1 */
-.endif
-
-/* Remap Flash Bank 0 at address 0x0 and Bank 1 at address 0x80000, */
-/* when the bank 0 is the boot bank, then enable the Bank 1. */
-
- LDR r0, =FMI_BASE_UMB
- LDR r1, =0x4 /* configure 512KB Boot bank 0 */
- STR r1, [r0, #BBSR_off_addr]
-
- LDR r1, =0x2 /* configure 32KB Non Boot bank 1 */
- STR r1, [r0, #NBBSR_off_addr]
-
- LDR r1, =(0x00000000 >> 2) /* Boot Bank Base Address */
- STR r1, [r0, #BBADR_off_addr]
-
- LDR r1, =(0x00080000 >> 2) /* Non Boot Bank Base Address */
- STR r1, [r0, #NBBADR_off_addr]
-
- LDR r1, =0x18 /* Flash Banks 0 1 enabled */
- STR r1, [r0, #CR_off_addr]
-
-/* Enable 96K RAM */
-
- LDR r0, =SCRO_AHB_UMB
-# LDR r1, =0x0196 /* prefetch disabled, default enabled */
- LDR r1, =0x0187|SRAM96
- STR r1, [r0]
-
-/* Set bits 17-18 (Instruction/Data TCM order) of the */
-/* Core Configuration Control Register */
-
- MOV r0, #0x60000
- MCR p15, 0x1, r0, c15, c1, 0
-
-/* Setup Stack for each mode */
-
-/* Enter Abort Mode and set its Stack Pointer */
-
- MSR cpsr_c, #Mode_ABT|I_Bit|F_Bit
- LDR sp, =__stack_abt_end__
-
-/* Enter Undefined Instruction Mode and set its Stack Pointer */
-
- MSR cpsr_c, #Mode_UND|I_Bit|F_Bit
- LDR sp, =__stack_und_end__
-
-/* Enter Supervisor Mode and set its Stack Pointer */
-
- MSR cpsr_c, #Mode_SVC|I_Bit|F_Bit
- LDR sp, =__stack_svc_end__
-
-/* Enter FIQ Mode and set its Stack Pointer */
-
- MSR cpsr_c, #Mode_FIQ|I_Bit|F_Bit
- LDR sp, =__stack_fiq_end__
-
-/* Enter IRQ Mode and set its Stack Pointer */
-
- MSR cpsr_c, #Mode_IRQ|I_Bit|F_Bit
- LDR sp, =__stack_irq_end__
-
-/* Enter System/User Mode and set its Stack Pointer */
-
- MSR cpsr_c, #Mode_SYS
- LDR sp, =__stack_end__
-
-/* Setup a default Stack Limit (when compiled with "-mapcs-stack-check") */
-
- LDR sl, =__bss_end__
-
-/* Relocate .data section (Copy from ROM to RAM) */
-
- LDR r1, =_etext
- LDR r2, =__data_start
- LDR r3, =_edata
-LoopRel:
- CMP r2, r3
- LDRLO r0, [r1], #4
- STRLO r0, [r2], #4
- BLO LoopRel
-
-/* Clear .bss section (Zero init) */
-
- MOV r0, #0
- LDR r1, =__bss_start__
- LDR r2, =__bss_end__
-LoopZI:
- CMP r1, r2
- STRLO r0, [r1], #4
- BLO LoopZI
-
-/* Call C++ constructors */
-
- LDR r0, =__ctors_start__
- LDR r1, =__ctors_end__
-ctor_loop:
- CMP r0, r1
- BEQ ctor_end
- LDR r2, [r0], #4
- STMFD sp!, {r0-r1}
- BLX r2
- LDMFD sp!, {r0-r1}
- B ctor_loop
-ctor_end:
-
-/* Need to set up standard file handles */
-/* Only used under simulator, normally overide syscall.c */
-
-# BL initialise_monitor_handles
-
-/* if we use debug version of str9lib this will call the init function */
-
- BL libdebug
-libdebug:
-
-/* Enter the C code, use B instruction so as to never return */
-/* use BL main if you want to use c++ destructors below */
-
- B main
-
-/* Return from main, loop forever. */
-
-#exit_loop:
-# B exit_loop
-
-/* Fosc values, used by libstr9 */
-
-_Main_Crystal: .long FOSC
-
- .weak libdebug
-
- .end
diff --git a/uc_str912/prj_template91x/Makefile b/uc_str912/prj_template91x/Makefile
deleted file mode 100644
index 7dad7f7..0000000
--- a/uc_str912/prj_template91x/Makefile
+++ /dev/null
@@ -1,495 +0,0 @@
-# Hey Emacs, this is a -*- makefile -*-
-#
-# WinARM template makefile
-# by Giacomo Fazio and Antonio Nasca, Catania, Italy
-# <giacomofazio@gmail.com>
-# <antodani.nasca@hotmail.it>
-#
-# based on the WinARM template makefile written by Martin Thomas
-# Released to the Public Domain
-# Please read the make user manual!
-#
-#
-# On command line:
-#
-# make all = Make software.
-#
-# make clean = Clean out built project files.
-#
-# make program = Download the hex file to the device
-#
-# (TODO: make filename.s = Just compile filename.c into the assembler code only)
-#
-# To rebuild project do "make clean" then "make all".
-# Toolchain prefix (i.e arm-elf -> arm-elf-gcc.exe)
-#TCHAIN = arm-elf
-TCHAIN = arm-none-eabi
-
-#USE_THUMB_MODE = YES
-USE_THUMB_MODE = NO
-
-# MCU name and submodel
-MCU = arm966e-s
-SUBMDL = STR91x
-
-## Create ROM-Image
-RUN_MODE=ROM_RUN
-## Create RAM-Image
-#RUN_MODE=RAM_RUN
-
-## not supported in this example:
-## Exception-Vector placement only supported for "ROM_RUN"
-## (placement settings ignored when using "RAM_RUN")
-## - Exception vectors in ROM:
-#VECTOR_LOCATION=VECTORS_IN_ROM
-## - Exception vectors in RAM:
-#VECTOR_LOCATION=VECTORS_IN_RAM
-
-
-# Target file name (without extension).
-TARGET = main
-
-# List C source files here. (C dependencies are automatically generated.)
-# use file-extension c for "c-only"-files
-SRC = src/$(TARGET).c
-
-# List C source files here which must be compiled in ARM-Mode.
-# use file-extension c for "c-only"-files
-SRCARM = src/vectors.c
-# thumb is possible too for vectors.c - keep ARM, TODO: profile
-
-# List C++ source files here.
-# use file-extension cpp for C++-files (use extension .cpp)
-CPPSRC =
-
-# List C++ source files here which must be compiled in ARM-Mode.
-# use file-extension cpp for C++-files (use extension .cpp)
-#CPPSRCARM = $(TARGET).cpp
-CPPSRCARM =
-
-# List Assembler source files here.
-# Make them always end in a capital .S. Files ending in a lowercase .s
-# will not be considered source files but generated files (assembler
-# output from the compiler), and will be deleted upon "make clean"!
-# Even though the DOS/Win* filesystem matches both .s and .S the same,
-# it will preserve the spelling of the filenames, and gcc itself does
-# care about how the name is spelled on its command-line.
-ASRC =
-
-# List Assembler source files here which must be assembled in ARM-Mode..
-ASRCARM = src/vector.S src/startup.S
-
-# Path to Linker-Scripts
-LINKERSCRIPTPATH = .
-
-## Output format. (can be ihex or binary or both)
-## (binary i.e. for openocd and SAM-BA, hex i.e. for lpc21isp and uVision)
-#FORMAT = ihex
-#FORMAT = binary
-FORMAT = both
-
-# Optimization level, can be [0, 1, 2, 3, s].
-# 0 = turn off optimization. s = optimize for size.
-# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
-#OPT = s
-OPT = 0
-
-## Using the Atmel AT91_lib produces warning with
-## the default warning-levels.
-## yes - disable these warnings; no - keep default settings
-#AT91LIBNOWARN = yes
-AT91LIBNOWARN = no
-
-# Debugging format.
-# Native formats for AVR-GCC's -g are stabs [default], or dwarf-2.
-# AVR (extended) COFF requires stabs, plus an avr-objcopy run.
-#DEBUG = stabs
-DEBUG = dwarf-2
-
-# List any extra directories to look for include files here.
-# Each directory must be seperated by a space.
-EXTRAINCDIRS = ./include ./str91x_lib/include
-
-# List any extra directories to look for library files here.
-# Each directory must be seperated by a space.
-#EXTRA_LIBDIRS = ../arm7_efsl_0_2_4
-EXTRA_LIBDIRS = ./str91x_lib
-
-
-# Compiler flag to set the C Standard level.
-# c89 - "ANSI" C
-# gnu89 - c89 plus GCC extensions
-# c99 - ISO C99 standard (not yet fully implemented)
-# gnu99 - c99 plus GCC extensions
-CSTANDARD = -std=gnu99
-
-# Place -D or -U options for C here
-CDEFS = -D$(RUN_MODE)
-
-# Place -I options here
-CINCS =
-
-# Place -D or -U options for ASM here
-ADEFS = -D$(RUN_MODE)
-
-ifdef VECTOR_LOCATION
-CDEFS += -D$(VECTOR_LOCATION)
-ADEFS += -D$(VECTOR_LOCATION)
-endif
-
-CDEFS += -D__WinARM__ -D__WINARMSUBMDL_$(SUBMDL)__
-ADEFS += -D__WinARM__ -D__WINARMSUBMDL_$(SUBMDL)__
-
-# Compiler flags.
-
-ifeq ($(USE_THUMB_MODE),YES)
-THUMB = -mthumb
-THUMB_IW = -mthumb-interwork
-else
-THUMB =
-THUMB_IW =
-endif
-
-# -g*: generate debugging information
-# -O*: optimization level
-# -f...: tuning, see GCC manual and avr-libc documentation
-# -Wall...: warning level
-# -Wa,...: tell GCC to pass this to the assembler.
-# -adhlns...: create assembler listing
-#
-# Flags for C and C++ (arm-elf-gcc/arm-elf-g++)
-CFLAGS = -g$(DEBUG)
-CFLAGS += $(CDEFS) $(CINCS)
-CFLAGS += -O$(OPT)
-CFLAGS += -Wall -Wcast-align -Wimplicit
-CFLAGS += -Wpointer-arith -Wswitch
-CFLAGS += -ffunction-sections -fdata-sections
-CFLAGS += -Wredundant-decls -Wreturn-type -Wshadow -Wunused
-CFLAGS += -Wa,-adhlns=$(subst $(suffix $<),.lst,$<)
-CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
-
-# flags only for C
-CONLYFLAGS += -Wnested-externs
-CONLYFLAGS += $(CSTANDARD)
-
-ifneq ($(AT91LIBNOWARN),yes)
-#AT91-lib warnings with:
-CFLAGS += -Wcast-qual
-CONLYFLAGS += -Wmissing-prototypes
-CONLYFLAGS += -Wstrict-prototypes
-CONLYFLAGS += -Wmissing-declarations
-endif
-
-# flags only for C++ (arm-elf-g++)
-# CPPFLAGS = -fno-rtti -fno-exceptions
-CPPFLAGS =
-
-# Assembler flags.
-# -Wa,...: tell GCC to pass this to the assembler.
-# -ahlns: create listing
-# -g$(DEBUG): have the assembler create line number information
-ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:.S=.lst), -g$(DEBUG)
-
-
-#Additional libraries.
-
-# Extra libraries
-# Each library-name must be seperated by a space.
-# To add libxyz.a, libabc.a and libefsl.a:
-# EXTRA_LIBS = xyz abc efsl
-#EXTRA_LIBS = efsl
-EXTRA_LIBS = STR91x_lib
-
-#Support for newlibc-lpc (file: libnewlibc-lpc.a)
-#NEWLIBLPC = -lnewlib-lpc
-
-MATH_LIB = -lm
-
-# CPLUSPLUS_LIB = -lstdc++
-
-
-# Linker flags.
-# -Wl,...: tell GCC to pass this to linker.
-# -Map: create map file
-# --cref: add cross reference to map file
-LDFLAGS = -nostartfiles -Wl,-Map=$(TARGET).map,--cref,--gc-sections,--no-warn-mismatch
-LDFLAGS += -lc
-LDFLAGS += $(NEWLIBLPC) $(MATH_LIB)
-LDFLAGS += -lc -lgcc
-LDFLAGS += $(CPLUSPLUS_LIB)
-LDFLAGS += $(patsubst %,-L%,$(EXTRA_LIBDIRS))
-LDFLAGS += $(patsubst %,-l%,$(EXTRA_LIBS))
-
-# Set Linker-Script Depending On Selected Memory and Controller
-ifeq ($(RUN_MODE),RAM_RUN)
-LDFLAGS +=-T$(LINKERSCRIPTPATH)/$(SUBMDL)-RAM.ld
-else
-LDFLAGS +=-T$(LINKERSCRIPTPATH)/$(SUBMDL)-ROM.ld
-endif
-
-
-# Define directories, if needed.
-## DIRARM = c:/WinARM/
-## DIRARMBIN = $(DIRAVR)/bin/
-## DIRAVRUTILS = $(DIRAVR)/utils/bin/
-
-# Define programs and commands.
-SHELL = sh
-CC = $(TCHAIN)-gcc
-CPP = $(TCHAIN)-g++
-AR = $(TCHAIN)-ar
-OBJCOPY = $(TCHAIN)-objcopy
-OBJDUMP = $(TCHAIN)-objdump
-SIZE = $(TCHAIN)-size
-NM = $(TCHAIN)-nm
-REMOVE = rm -f
-REMOVEDIR = rm -f -r
-COPY = cp
-
-# Define Messages
-# English
-MSG_ERRORS_NONE = Errors: none
-MSG_BEGIN = "-------- begin (mode: $(RUN_MODE)) --------"
-MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
-MSG_SIZE_AFTER = Size after:
-MSG_FLASH = Creating load file for Flash:
-MSG_EXTENDED_LISTING = Creating Extended Listing:
-MSG_SYMBOL_TABLE = Creating Symbol Table:
-MSG_LINKING = Linking:
-MSG_COMPILING = Compiling C:
-MSG_COMPILING_ARM = "Compiling C (ARM-only):"
-MSG_COMPILINGCPP = Compiling C++:
-MSG_COMPILINGCPP_ARM = "Compiling C++ (ARM-only):"
-MSG_ASSEMBLING = Assembling:
-MSG_ASSEMBLING_ARM = "Assembling (ARM-only):"
-MSG_CLEANING = Cleaning project:
-MSG_FORMATERROR = Can not handle output-format
-MSG_LPC21_RESETREMINDER = You may have to bring the target in bootloader-mode now.
-
-# Define all object files.
-COBJ = $(SRC:.c=.o)
-AOBJ = $(ASRC:.S=.o)
-COBJARM = $(SRCARM:.c=.o)
-AOBJARM = $(ASRCARM:.S=.o)
-CPPOBJ = $(CPPSRC:.cpp=.o)
-CPPOBJARM = $(CPPSRCARM:.cpp=.o)
-
-# Define all listing files.
-LST = $(ASRC:.S=.lst) $(ASRCARM:.S=.lst) $(SRC:.c=.lst) $(SRCARM:.c=.lst)
-LST += $(CPPSRC:.cpp=.lst) $(CPPSRCARM:.cpp=.lst)
-
-# Compiler flags to generate dependency files.
-### GENDEPFLAGS = -Wp,-M,-MP,-MT,$(*F).o,-MF,.dep/$(@F).d
-GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d
-
-# Combine all necessary flags and optional flags.
-# Add target processor to flags.
-ALL_CFLAGS = -mcpu=$(MCU) -msoft-float $(THUMB_IW) -I. $(CFLAGS) $(GENDEPFLAGS)
-ALL_ASFLAGS = -mcpu=$(MCU) -msoft-float $(THUMB_IW) -I. -x assembler-with-cpp $(ASFLAGS)
-
-
-# Default target.
-all: begin gccversion sizebefore build sizeafter finished end
-
-ifeq ($(FORMAT),ihex)
-build: elf hex lss sym
-hex: $(TARGET).hex
-IMGEXT=hex
-else
-ifeq ($(FORMAT),binary)
-build: elf bin lss sym
-bin: $(TARGET).bin
-IMGEXT=bin
-else
-ifeq ($(FORMAT),both)
-build: elf hex bin lss sym
-hex: $(TARGET).hex
-bin: $(TARGET).bin
-else
-$(error "$(MSG_FORMATERROR) $(FORMAT)")
-endif
-endif
-endif
-
-elf: $(TARGET).elf
-lss: $(TARGET).lss
-sym: $(TARGET).sym
-
-# Eye candy.
-begin:
- @echo
- @echo $(MSG_BEGIN)
-
-finished:
- @echo $(MSG_ERRORS_NONE)
-
-end:
- @echo $(MSG_END)
- @echo
-
-
-# Display size of file.
-HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
-ELFSIZE = $(SIZE) -A $(TARGET).elf
-sizebefore:
- @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi
-
-sizeafter:
- @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi
-
-
-# Display compiler version information.
-gccversion :
- @$(CC) --version
-
-# FLASH Programming with OPENOCD
-
-# specify the directory where openocd executable resides (openocd-ftd2xx.exe or openocd-pp.exe)
-# Note: you may have to adjust this if a newer version of YAGARTO has been downloaded
-OPENOCD_DIR = '/usr/local/bin/'
-
-# specify OpenOCD executable (pp is for the wiggler, ftd2xx is for the USB debugger)
-OPENOCD = $(OPENOCD_DIR)openocd
-#OPENOCD = $(OPENOCD_DIR)openocd-ftd2xx.exe
-
-# specify OpenOCD configuration file (pick the one for your device)
-#OPENOCD_CFG = /home/l3golas/openocd-configs/str91x-configs/str91x_signalyzer-flash-program.cfg
-#OPENOCD_CFG = /home/l3golas/openocd-configs/str91x-configs/str91x_jtagkey-flash-program.cfg
-#OPENOCD_CFG = /home/l3golas/openocd-configs/str91x-configs/str91x_armusbocd-flash-program.cfg
-OPENOCD_CFG = /home/l3golas/openocd-configs/str91x-configs/str91x_pp-flash-program.cfg
-
-program:
- @echo
- @echo "Flash Programming with OpenOCD..."
- $(OPENOCD) -f $(OPENOCD_CFG)
- @echo
- @echo
- @echo "Flash Programming Finished."
-
-
-# Create final output file (.hex) from ELF output file.
-%.hex: %.elf
- @echo
- @echo $(MSG_FLASH) $@
- $(OBJCOPY) -O ihex $< $@
-
-# Create final output file (.bin) from ELF output file.
-%.bin: %.elf
- @echo
- @echo $(MSG_FLASH) $@
- $(OBJCOPY) -O binary $< $@
-
-
-# Create extended listing file from ELF output file.
-# testing: option -C
-%.lss: %.elf
- @echo
- @echo $(MSG_EXTENDED_LISTING) $@
- $(OBJDUMP) -h -S -C $< > $@
-
-
-# Create a symbol table from ELF output file.
-%.sym: %.elf
- @echo
- @echo $(MSG_SYMBOL_TABLE) $@
- $(NM) -n $< > $@
-
-
-# Link: create ELF output file from object files.
-.SECONDARY : $(TARGET).elf
-.PRECIOUS : $(AOBJARM) $(AOBJ) $(COBJARM) $(COBJ) $(CPPOBJ) $(CPPOBJARM)
-%.elf: $(AOBJARM) $(AOBJ) $(COBJARM) $(COBJ) $(CPPOBJ) $(CPPOBJARM)
- @echo
- @echo $(MSG_LINKING) $@
- $(CC) $(THUMB) $(ALL_CFLAGS) $(AOBJARM) $(AOBJ) $(COBJARM) $(COBJ) $(CPPOBJ) $(CPPOBJARM) --output $@ $(LDFLAGS)
-# $(CPP) $(THUMB) $(ALL_CFLAGS) $(AOBJARM) $(AOBJ) $(COBJARM) $(COBJ) $(CPPOBJ) $(CPPOBJARM) --output $@ $(LDFLAGS)
-
-# Compile: create object files from C source files. ARM/Thumb
-$(COBJ) : %.o : %.c
- @echo
- @echo $(MSG_COMPILING) $<
- $(CC) -c $(THUMB) $(ALL_CFLAGS) $(CONLYFLAGS) $< -o $@
-
-# Compile: create object files from C source files. ARM-only
-$(COBJARM) : %.o : %.c
- @echo
- @echo $(MSG_COMPILING_ARM) $<
- $(CC) -c $(ALL_CFLAGS) $(CONLYFLAGS) $< -o $@
-
-# Compile: create object files from C++ source files. ARM/Thumb
-$(CPPOBJ) : %.o : %.cpp
- @echo
- @echo $(MSG_COMPILINGCPP) $<
- $(CPP) -c $(THUMB) $(ALL_CFLAGS) $(CPPFLAGS) $< -o $@
-
-# Compile: create object files from C++ source files. ARM-only
-$(CPPOBJARM) : %.o : %.cpp
- @echo
- @echo $(MSG_COMPILINGCPP_ARM) $<
- $(CPP) -c $(ALL_CFLAGS) $(CPPFLAGS) $< -o $@
-
-
-# Compile: create assembler files from C source files. ARM/Thumb
-## does not work - TODO - hints welcome
-##$(COBJ) : %.s : %.c
-## $(CC) $(THUMB) -S $(ALL_CFLAGS) $< -o $@
-
-
-# Assemble: create object files from assembler source files. ARM/Thumb
-$(AOBJ) : %.o : %.S
- @echo
- @echo $(MSG_ASSEMBLING) $<
- $(CC) -c $(THUMB) $(ALL_ASFLAGS) $< -o $@
-
-
-# Assemble: create object files from assembler source files. ARM-only
-$(AOBJARM) : %.o : %.S
- @echo
- @echo $(MSG_ASSEMBLING_ARM) $<
- $(CC) -c $(ALL_ASFLAGS) $< -o $@
-
-
-# Target: clean project.
-clean: begin clean_list finished end
-
-
-clean_list :
- @echo
- @echo $(MSG_CLEANING)
- $(REMOVE) $(TARGET).hex
- $(REMOVE) $(TARGET).bin
- $(REMOVE) $(TARGET).obj
- $(REMOVE) $(TARGET).elf
- $(REMOVE) $(TARGET).map
- $(REMOVE) $(TARGET).obj
- $(REMOVE) $(TARGET).a90
- $(REMOVE) $(TARGET).sym
- $(REMOVE) $(TARGET).lnk
- $(REMOVE) $(TARGET).lss
- $(REMOVE) $(COBJ)
- $(REMOVE) $(CPPOBJ)
- $(REMOVE) $(AOBJ)
- $(REMOVE) $(COBJARM)
- $(REMOVE) $(CPPOBJARM)
- $(REMOVE) $(AOBJARM)
- $(REMOVE) $(LST)
- $(REMOVE) $(SRC:.c=.s)
- $(REMOVE) $(SRC:.c=.d)
- $(REMOVE) $(SRCARM:.c=.s)
- $(REMOVE) $(SRCARM:.c=.d)
- $(REMOVE) $(CPPSRC:.cpp=.s)
- $(REMOVE) $(CPPSRC:.cpp=.d)
- $(REMOVE) $(CPPSRCARM:.cpp=.s)
- $(REMOVE) $(CPPSRCARM:.cpp=.d)
- $(REMOVEDIR) .dep | exit 0
-
-
-# Include the dependency files.
--include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
-
-
-# Listing of phony targets.
-.PHONY : all begin finish end sizebefore sizeafter gccversion \
-build elf hex bin lss sym clean clean_list program
-
diff --git a/uc_str912/prj_template91x/STR91x-RAM.ld b/uc_str912/prj_template91x/STR91x-RAM.ld
deleted file mode 100644
index aced384..0000000
--- a/uc_str912/prj_template91x/STR91x-RAM.ld
+++ /dev/null
@@ -1,218 +0,0 @@
-/***********************************************************************************
-* Copyright 2005 Anglia Design
-* This demo code and associated components are provided as is and has no warranty,
-* implied or otherwise. You are free to use/modify any of the provided
-* code at your own risk in your applications with the expressed limitation
-* of liability (see below)
-*
-* LIMITATION OF LIABILITY: ANGLIA OR ANGLIA DESIGNS SHALL NOT BE LIABLE FOR ANY
-* LOSS OF PROFITS, LOSS OF USE, LOSS OF DATA, INTERRUPTION OF BUSINESS, NOR FOR
-* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND WHETHER UNDER
-* THIS AGREEMENT OR OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-*
-* Author : Spencer Oliver
-* Web : www.anglia-designs.com
-*
-***********************************************************************************/
-
-/* Stack Sizes */
-
- _STACKSIZE = 1024;
- _STACKSIZE_IRQ = 256;
- _STACKSIZE_FIQ = 256;
- _STACKSIZE_SVC = 0;
- _STACKSIZE_ABT = 0;
- _STACKSIZE_UND = 0;
- _HEAPSIZE = 1024;
-
-/* Memory Definitions */
-
-MEMORY
-{
- DATA (rw) : ORIGIN = 0x04000000, LENGTH = 0x00018000
-}
-
-/* Section Definitions */
-
-SECTIONS
-{
- /* first section is .text which is used for code */
-
- .text :
- {
- KEEP(*(.vectors))
- KEEP(*(.init))
- *(.text .text.*)
- *(.gnu.linkonce.t.*)
- *(.glue_7t .glue_7)
- KEEP(*(.fini))
- *(.gcc_except_table)
- } >DATA =0
- . = ALIGN(4);
-
- /* .ctors .dtors are used for c++ constructors/destructors */
-
- .ctors :
- {
- PROVIDE(__ctors_start__ = .);
- KEEP(*(SORT(.ctors.*)))
- KEEP(*(.ctors))
- PROVIDE(__ctors_end__ = .);
- } >DATA
-
- .dtors :
- {
- PROVIDE(__dtors_start__ = .);
- KEEP(*(SORT(.dtors.*)))
- KEEP(*(.dtors))
- PROVIDE(__dtors_end__ = .);
- } >DATA
-
- /* .rodata section which is used for read-only data (constants) */
-
- .rodata :
- {
- *(.rodata .rodata.*)
- *(.gnu.linkonce.r.*)
- } >DATA
- . = ALIGN(4);
-
- _etext = .;
- PROVIDE (etext = .);
-
- /* .data section which is used for initialized data */
-
- .data : AT (_etext)
- {
- *(.data .data.*)
- *(.gnu.linkonce.d.*)
- SORT(CONSTRUCTORS)
- } >DATA
- . = ALIGN(4);
-
- __data_start = .;
- _edata = .;
- PROVIDE (edata = .);
-
- /* .bss section which is used for uninitialized data */
-
- .bss :
- {
- __bss_start = .;
- __bss_start__ = .;
- *(.bss .bss.*)
- *(.gnu.linkonce.b.*)
- *(COMMON)
- . = ALIGN(4);
- } >DATA
- . = ALIGN(4);
- __bss_end__ = .;
-
- _end = .;
- PROVIDE(end = .);
-
- /* .heap section which is used for memory allocation */
-
- .heap (NOLOAD) :
- {
- __heap_start__ = .;
- *(.heap)
- . = MAX(__heap_start__ + _HEAPSIZE , .);
- } >DATA
- __heap_end__ = __heap_start__ + SIZEOF(.heap);
-
- /* .stack section - user mode stack */
-
- .stack (__heap_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_start__ = .;
- *(.stack)
- . = MAX(__stack_start__ + _STACKSIZE , .);
- } >DATA
- __stack_end__ = __stack_start__ + SIZEOF(.stack);
-
- /* .stack_irq section */
-
- .stack_irq (__stack_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_irq_start__ = .;
- *(.stack_irq)
- . = MAX(__stack_irq_start__ + _STACKSIZE_IRQ , .);
- } >DATA
- __stack_irq_end__ = __stack_irq_start__ + SIZEOF(.stack_irq);
-
- /* .stack_fiq section */
-
- .stack_fiq (__stack_irq_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_fiq_start__ = .;
- *(.stack_fiq)
- . = MAX(__stack_fiq_start__ + _STACKSIZE_FIQ , .);
- } >DATA
- __stack_fiq_end__ = __stack_fiq_start__ + SIZEOF(.stack_fiq);
-
- /* .stack_svc section */
-
- .stack_svc (__stack_fiq_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_svc_start__ = .;
- *(.stack_svc)
- . = MAX(__stack_svc_start__ + _STACKSIZE_SVC , .);
- } >DATA
- __stack_svc_end__ = __stack_svc_start__ + SIZEOF(.stack_svc);
-
- /* .stack_abt section */
-
- .stack_abt (__stack_svc_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_abt_start__ = .;
- *(.stack_abt)
- . = MAX(__stack_abt_start__ + _STACKSIZE_ABT , .);
- } >DATA
- __stack_abt_end__ = __stack_abt_start__ + SIZEOF(.stack_abt);
-
- /* .stack_und section */
-
- .stack_und (__stack_abt_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_und_start__ = .;
- *(.stack_und)
- . = MAX(__stack_und_start__ + _STACKSIZE_UND , .);
- } >DATA
- __stack_und_end__ = __stack_und_start__ + SIZEOF(.stack_und);
-
- /* 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) }
-}
-
diff --git a/uc_str912/prj_template91x/STR91x-ROM.ld b/uc_str912/prj_template91x/STR91x-ROM.ld
deleted file mode 100644
index ed2979b..0000000
--- a/uc_str912/prj_template91x/STR91x-ROM.ld
+++ /dev/null
@@ -1,221 +0,0 @@
-/***********************************************************************************
-* Copyright 2005 Anglia Design
-* This demo code and associated components are provided as is and has no warranty,
-* implied or otherwise. You are free to use/modify any of the provided
-* code at your own risk in your applications with the expressed limitation
-* of liability (see below)
-*
-* LIMITATION OF LIABILITY: ANGLIA OR ANGLIA DESIGNS SHALL NOT BE LIABLE FOR ANY
-* LOSS OF PROFITS, LOSS OF USE, LOSS OF DATA, INTERRUPTION OF BUSINESS, NOR FOR
-* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND WHETHER UNDER
-* THIS AGREEMENT OR OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-*
-* Author : Spencer Oliver
-* Web : www.anglia-designs.com
-*
-***********************************************************************************/
-
-/* Stack Sizes */
-
- _STACKSIZE = 1024;
- _STACKSIZE_IRQ = 256;
- _STACKSIZE_FIQ = 256;
- _STACKSIZE_SVC = 0;
- _STACKSIZE_ABT = 0;
- _STACKSIZE_UND = 0;
- _HEAPSIZE = 1024;
-
-/* Memory Definitions */
-
-MEMORY
-{
- CODE (rx) : ORIGIN = 0x00000000, LENGTH = 0x00080000
- DATA (rw) : ORIGIN = 0x04000000, LENGTH = 0x00018000
-}
-
-/* Section Definitions */
-
-SECTIONS
-{
- /* first section is .text which is used for code */
-
- .text :
- {
- KEEP(*(.vectors))
- KEEP(*(.init))
- *(.text .text.*)
- *(.gnu.linkonce.t.*)
- *(.glue_7t .glue_7)
- KEEP(*(.fini))
- *(.gcc_except_table)
- } >CODE =0
- . = ALIGN(4);
-
- /* .ctors .dtors are used for c++ constructors/destructors */
-
- .ctors :
- {
- PROVIDE(__ctors_start__ = .);
- KEEP(*(SORT(.ctors.*)))
- KEEP(*(.ctors))
- PROVIDE(__ctors_end__ = .);
- } >CODE
-
- .dtors :
- {
- PROVIDE(__dtors_start__ = .);
- KEEP(*(SORT(.dtors.*)))
- KEEP(*(.dtors))
- PROVIDE(__dtors_end__ = .);
- } >CODE
-
- /* .rodata section which is used for read-only data (constants) */
-
- .rodata :
- {
- *(.rodata .rodata.*)
- *(.gnu.linkonce.r.*)
- } >CODE
- . = ALIGN(4);
-
- _etext = .;
- PROVIDE (etext = .);
-
- /* .data section which is used for initialized data */
-
- .data : AT (_etext)
- {
- __data_start = .;
- *(.data .data.*)
- *(.gnu.linkonce.d.*)
- SORT(CONSTRUCTORS)
- . = ALIGN(4);
- *(.fastrun .fastrun.*)
- } >DATA
- . = ALIGN(4);
-
- _edata = .;
- PROVIDE (edata = .);
-
- /* .bss section which is used for uninitialized data */
-
- .bss :
- {
- __bss_start = .;
- __bss_start__ = .;
- *(.bss .bss.*)
- *(.gnu.linkonce.b.*)
- *(COMMON)
- . = ALIGN(4);
- } >DATA
- . = ALIGN(4);
- __bss_end__ = .;
-
- _end = .;
- PROVIDE(end = .);
-
- /* .heap section which is used for memory allocation */
-
- .heap (NOLOAD) :
- {
- __heap_start__ = .;
- *(.heap)
- . = MAX(__heap_start__ + _HEAPSIZE , .);
- } >DATA
- __heap_end__ = __heap_start__ + SIZEOF(.heap);
-
- /* .stack section - user mode stack */
-
- .stack (__heap_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_start__ = .;
- *(.stack)
- . = MAX(__stack_start__ + _STACKSIZE , .);
- } >DATA
- __stack_end__ = __stack_start__ + SIZEOF(.stack);
-
- /* .stack_irq section */
-
- .stack_irq (__stack_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_irq_start__ = .;
- *(.stack_irq)
- . = MAX(__stack_irq_start__ + _STACKSIZE_IRQ , .);
- } >DATA
- __stack_irq_end__ = __stack_irq_start__ + SIZEOF(.stack_irq);
-
- /* .stack_fiq section */
-
- .stack_fiq (__stack_irq_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_fiq_start__ = .;
- *(.stack_fiq)
- . = MAX(__stack_fiq_start__ + _STACKSIZE_FIQ , .);
- } >DATA
- __stack_fiq_end__ = __stack_fiq_start__ + SIZEOF(.stack_fiq);
-
- /* .stack_svc section */
-
- .stack_svc (__stack_fiq_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_svc_start__ = .;
- *(.stack_svc)
- . = MAX(__stack_svc_start__ + _STACKSIZE_SVC , .);
- } >DATA
- __stack_svc_end__ = __stack_svc_start__ + SIZEOF(.stack_svc);
-
- /* .stack_abt section */
-
- .stack_abt (__stack_svc_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_abt_start__ = .;
- *(.stack_abt)
- . = MAX(__stack_abt_start__ + _STACKSIZE_ABT , .);
- } >DATA
- __stack_abt_end__ = __stack_abt_start__ + SIZEOF(.stack_abt);
-
- /* .stack_und section */
-
- .stack_und (__stack_abt_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_und_start__ = .;
- *(.stack_und)
- . = MAX(__stack_und_start__ + _STACKSIZE_UND , .);
- } >DATA
- __stack_und_end__ = __stack_und_start__ + SIZEOF(.stack_und);
-
- /* 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) }
-}
-
diff --git a/uc_str912/prj_template91x/include/vectors.h b/uc_str912/prj_template91x/include/vectors.h
deleted file mode 100644
index d48e61f..0000000
--- a/uc_str912/prj_template91x/include/vectors.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/***********************************************************************************
-* Copyright 2005 Anglia Design
-* This demo code and associated components are provided as is and has no warranty,
-* implied or otherwise. You are free to use/modify any of the provided
-* code at your own risk in your applications with the expressed limitation
-* of liability (see below)
-*
-* LIMITATION OF LIABILITY: ANGLIA OR ANGLIA DESIGNS SHALL NOT BE LIABLE FOR ANY
-* LOSS OF PROFITS, LOSS OF USE, LOSS OF DATA, INTERRUPTION OF BUSINESS, NOR FOR
-* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND WHETHER UNDER
-* THIS AGREEMENT OR OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-*
-* Author : Spencer Oliver
-* Web : www.anglia-designs.com
-*
-***********************************************************************************/
-
-#ifndef _VECTOR_H
-#define _VECTOR_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void Undefined_Handler(void);
-void FIQ_Handler(void);
-void SWI_Handler(void);
-void Prefetch_Handler(void);
-void Abort_Handler(void);
-void WDG_IRQHandler(void);
-void SW_IRQHandler(void);
-void ARMRX_IRQHandler(void);
-void ARMTX_IRQHandler(void);
-void TIM0_IRQHandler(void);
-void TIM1_IRQHandler(void);
-void TIM2_IRQHandler(void);
-void TIM3_IRQHandler(void);
-void USBHP_IRQHandler(void);
-void USBLP_IRQHandler(void);
-void SCU_IRQHandler(void);
-void ENET_IRQHandler(void);
-void DMA_IRQHandler(void);
-void CAN_IRQHandler(void);
-void MC_IRQHandler(void);
-void ADC_IRQHandler(void);
-void UART0_IRQHandler(void);
-void UART1_IRQHandler(void);
-void UART2_IRQHandler(void);
-void I2C0_IRQHandler(void);
-void I2C1_IRQHandler(void);
-void SSP0_IRQHandler(void);
-void SSP1_IRQHandler(void);
-void LVD_IRQHandler(void);
-void RTC_IRQHandler(void);
-void WIU_IRQHandler(void);
-void EXTIT0_IRQHandler(void);
-void EXTIT1_IRQHandler(void);
-void EXTIT2_IRQHandler(void);
-void EXTIT3_IRQHandler(void);
-void USBWU_IRQHandler(void);
-void PFQBC_IRQHandler(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //_VECTOR_H
diff --git a/uc_str912/prj_template91x/load_segger.gdb b/uc_str912/prj_template91x/load_segger.gdb
deleted file mode 100644
index fe98dd4..0000000
--- a/uc_str912/prj_template91x/load_segger.gdb
+++ /dev/null
@@ -1,23 +0,0 @@
-set complaints 1
-set output-radix 16
-set input-radix 16
-set prompt (arm-gdb)
-
-target remote localhost:2331
-
-monitor speed adaptive
-monitor endian little
-
-monitor reset
-monitor flash device = STR912FAW44
-monitor flash breakpoints = 1
-monitor flash download = 1
-monitor halt
-
-
-pwd
-load main.elf
-file main.elf
-step
-break after_delay
-continue
diff --git a/uc_str912/prj_template91x/src/main.c b/uc_str912/prj_template91x/src/main.c
deleted file mode 100644
index 62d3c59..0000000
--- a/uc_str912/prj_template91x/src/main.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/******************** (C) COPYRIGHT 2005 STMicroelectronics ********************
-* File Name : main.c
-* Author : MCD Application Team
-* Date First Issued : 09/27/2005 : V1.0
-* Description : Main program body
-**********************************************************************************
-* History:
-* 09/27/2005 : V1.0
-**********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*********************************************************************************/
-
-/* Standard include ------------------------------------------------------------*/
-#include "91x_lib.h"
-
-/* Include of other module interface headers -----------------------------------*/
-/* Local includes --------------------------------------------------------------*/
-/* Private typedef -------------------------------------------------------------*/
-/* Private define --------------------------------------------------------------*/
-/* Private macro ---------------------------------------------------------------*/
-/* Private variables -----------------------------------------------------------*/
-
-
-/*---------------------------------main---------------------------------------*/
-
-void main()
-{
- #ifdef LIBDEBUG
- libdebug();
- #endif
- int a=4;
- int b=5;
- int c;
- c=a+b;
-}
-
-
-/******************* (C) COPYRIGHT 2005 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_template91x/src/startup.S b/uc_str912/prj_template91x/src/startup.S
deleted file mode 100644
index cef54d8..0000000
--- a/uc_str912/prj_template91x/src/startup.S
+++ /dev/null
@@ -1,233 +0,0 @@
-/***********************************************************************************
-* Copyright 2005 Anglia Design
-* This demo code and associated components are provided as is and has no warranty,
-* implied or otherwise. You are free to use/modify any of the provided
-* code at your own risk in your applications with the expressed limitation
-* of liability (see below)
-*
-* LIMITATION OF LIABILITY: ANGLIA OR ANGLIA DESIGNS SHALL NOT BE LIABLE FOR ANY
-* LOSS OF PROFITS, LOSS OF USE, LOSS OF DATA, INTERRUPTION OF BUSINESS, NOR FOR
-* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND WHETHER UNDER
-* THIS AGREEMENT OR OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-*
-* Author : Spencer Oliver
-* Web : www.anglia-designs.com
-*
-***********************************************************************************/
-
-/**** Startup Code (executed after Reset) ****/
-
-/* Frequency values kHz */
-/* set to suit target hardware */
-
- .equ FOSC, 25000
-
-/* Standard definitions of Mode bits and Interrupt (I & F) flags in PSRs */
-
- .equ Mode_USR, 0x10
- .equ Mode_FIQ, 0x11
- .equ Mode_IRQ, 0x12
- .equ Mode_SVC, 0x13
- .equ Mode_ABT, 0x17
- .equ Mode_UND, 0x1B
- .equ Mode_SYS, 0x1F /* available on ARM Arch 4 and later */
-
- .equ I_Bit, 0x80 /* when I bit is set, IRQ is disabled */
- .equ F_Bit, 0x40 /* when F bit is set, FIQ is disabled */
-
- .equ SRAM32, 0x00
- .equ SRAM64, 0x08
- .equ SRAM96, 0x10
-
-/* --- System memory locations */
-
- .equ SCRO_AHB_UMB, 0x5C002034 /* System configuration register 0 (unbuffered) */
-
- .equ FMI_BASE_UMB, 0x54000000 /* Flash FMI base address (unbuffered) */
- .equ BBSR_off_addr, 0x00
- .equ NBBSR_off_addr, 0x04
- .equ BBADR_off_addr, 0x0C
- .equ NBBADR_off_addr, 0x10
- .equ CR_off_addr, 0x18
-
-.ifndef LIBUFF
- .equ LIBUFF, 0
-.endif
-
-/* Startup Code must be linked first at Address at which it expects to run. */
-
- .text
- .arm
- .section .init, "ax"
-
- .global _start
- .global _Main_Crystal
-
-/* After remap this will be our reset handler */
-
-_start:
- LDR pc, =NextInst
-NextInst:
-
- NOP /* Wait for OSC stabilization */
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
-
-/* Enable buffered mode */
-
-.if LIBUFF
- MRC p15, 0, r0, c1, c0, 0 /* Read CP15 register 1 into r0 */
- ORR r0, r0, #0x8 /* Enable Write Buffer on AHB */
- MCR p15, 0, r0, c1, c0, 0 /* Write CP15 register 1 */
-.endif
-
-/* Remap Flash Bank 0 at address 0x0 and Bank 1 at address 0x80000, */
-/* when the bank 0 is the boot bank, then enable the Bank 1. */
-
- LDR r0, =FMI_BASE_UMB
- LDR r1, =0x4 /* configure 512KB Boot bank 0 */
- STR r1, [r0, #BBSR_off_addr]
-
- LDR r1, =0x2 /* configure 32KB Non Boot bank 1 */
- STR r1, [r0, #NBBSR_off_addr]
-
- LDR r1, =(0x00000000 >> 2) /* Boot Bank Base Address */
- STR r1, [r0, #BBADR_off_addr]
-
- LDR r1, =(0x00080000 >> 2) /* Non Boot Bank Base Address */
- STR r1, [r0, #NBBADR_off_addr]
-
- LDR r1, =0x18 /* Flash Banks 0 1 enabled */
- STR r1, [r0, #CR_off_addr]
-
-/* Enable 96K RAM */
-
- LDR r0, =SCRO_AHB_UMB
-# LDR r1, =0x0196 /* prefetch disabled, default enabled */
- LDR r1, =0x0187|SRAM96
- STR r1, [r0]
-
-/* Set bits 17-18 (Instruction/Data TCM order) of the */
-/* Core Configuration Control Register */
-
- MOV r0, #0x60000
- MCR p15, 0x1, r0, c15, c1, 0
-
-/* Setup Stack for each mode */
-
-/* Enter Abort Mode and set its Stack Pointer */
-
- MSR cpsr_c, #Mode_ABT|I_Bit|F_Bit
- LDR sp, =__stack_abt_end__
-
-/* Enter Undefined Instruction Mode and set its Stack Pointer */
-
- MSR cpsr_c, #Mode_UND|I_Bit|F_Bit
- LDR sp, =__stack_und_end__
-
-/* Enter Supervisor Mode and set its Stack Pointer */
-
- MSR cpsr_c, #Mode_SVC|I_Bit|F_Bit
- LDR sp, =__stack_svc_end__
-
-/* Enter FIQ Mode and set its Stack Pointer */
-
- MSR cpsr_c, #Mode_FIQ|I_Bit|F_Bit
- LDR sp, =__stack_fiq_end__
-
-/* Enter IRQ Mode and set its Stack Pointer */
-
- MSR cpsr_c, #Mode_IRQ|I_Bit|F_Bit
- LDR sp, =__stack_irq_end__
-
-/* Enter System/User Mode and set its Stack Pointer */
-
- MSR cpsr_c, #Mode_SYS
- LDR sp, =__stack_end__
-
-/* Setup a default Stack Limit (when compiled with "-mapcs-stack-check") */
-
- LDR sl, =__bss_end__
-
-/* Relocate .data section (Copy from ROM to RAM) */
-
- LDR r1, =_etext
- LDR r2, =__data_start
- LDR r3, =_edata
-LoopRel:
- CMP r2, r3
- LDRLO r0, [r1], #4
- STRLO r0, [r2], #4
- BLO LoopRel
-
-/* Clear .bss section (Zero init) */
-
- MOV r0, #0
- LDR r1, =__bss_start__
- LDR r2, =__bss_end__
-LoopZI:
- CMP r1, r2
- STRLO r0, [r1], #4
- BLO LoopZI
-
-/* Call C++ constructors */
-
- LDR r0, =__ctors_start__
- LDR r1, =__ctors_end__
-ctor_loop:
- CMP r0, r1
- BEQ ctor_end
- LDR r2, [r0], #4
- STMFD sp!, {r0-r1}
- BLX r2
- LDMFD sp!, {r0-r1}
- B ctor_loop
-ctor_end:
-
-/* Need to set up standard file handles */
-/* Only used under simulator, normally overide syscall.c */
-
-# BL initialise_monitor_handles
-
-/* if we use debug version of str9lib this will call the init function */
-
- BL libdebug
-libdebug:
-
-/* Enter the C code, use B instruction so as to never return */
-/* use BL main if you want to use c++ destructors below */
-
- B main
-
-/* Call destructors */
-
-# LDR r0, =__dtors_start__
-# LDR r1, =__dtors_end__
-#dtor_loop:
-# CMP r0, r1
-# BEQ dtor_end
-# LDR r2, [r0], #4
-# STMFD sp!, {r0-r1}
-# BLX r2
-# LDMFD sp!, {r0-r1}
-# B dtor_loop
-#dtor_end:
-
-/* Return from main, loop forever. */
-
-#exit_loop:
-# B exit_loop
-
-/* Fosc values, used by libstr9 */
-
-_Main_Crystal: .long FOSC
-
- .weak libdebug
-
- .end
diff --git a/uc_str912/prj_template91x/src/vector.S b/uc_str912/prj_template91x/src/vector.S
deleted file mode 100644
index 7708f54..0000000
--- a/uc_str912/prj_template91x/src/vector.S
+++ /dev/null
@@ -1,202 +0,0 @@
-/***********************************************************************************
-* Copyright 2005 Anglia Design
-* This demo code and associated components are provided as is and has no warranty,
-* implied or otherwise. You are free to use/modify any of the provided
-* code at your own risk in your applications with the expressed limitation
-* of liability (see below)
-*
-* LIMITATION OF LIABILITY: ANGLIA OR ANGLIA DESIGNS SHALL NOT BE LIABLE FOR ANY
-* LOSS OF PROFITS, LOSS OF USE, LOSS OF DATA, INTERRUPTION OF BUSINESS, NOR FOR
-* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND WHETHER UNDER
-* THIS AGREEMENT OR OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-*
-* Author : Spencer Oliver
-* Web : www.anglia-designs.com
-*
-***********************************************************************************/
-
- .equ VectorAddress, 0xFFFFF030 /* VIC Vector address register address. */
- .equ VectorAddressDaisy, 0xFC000030 /* Daisy VIC Vector address register */
-
- .equ Mode_USR, 0x10
- .equ Mode_FIQ, 0x11
- .equ Mode_IRQ, 0x12
- .equ Mode_SVC, 0x13
- .equ Mode_ABT, 0x17
- .equ Mode_UND, 0x1B
- .equ Mode_SYS, 0x1F /* available on ARM Arch 4 and later */
-
- .equ I_Bit, 0x80 /* when I bit is set, IRQ is disabled */
- .equ F_Bit, 0x40 /* when F bit is set, FIQ is disabled */
-
- .text
- .arm
- .section .vectors, "ax"
-
- .global Reset_Vec
-
-/* Note: LDR PC instructions are used here, though branch (B) instructions */
-/* could also be used, unless the ROM is at an address >32MB. */
-
-/*******************************************************************************
- Exception vectors
-*******************************************************************************/
-
-Reset_Vec: LDR pc, Reset_Addr /* Reset Handler */
-Undef_Vec: LDR pc, Undefined_Addr
-SWI_Vec: LDR pc, SWI_Addr
-PAbt_Vec: LDR pc, Prefetch_Addr
-DAbt_Vec: LDR pc, Abort_Addr
- NOP /* Reserved vector */
-IRQ_Vec: LDR pc, IRQ_Addr
-FIQ_Vec: LDR pc, FIQ_Addr
-
-/*******************************************************************************
- Exception handlers address table
-*******************************************************************************/
-
-Reset_Addr: .word _start
-Undefined_Addr: .word UndefinedHandler
-SWI_Addr: .word SWIHandler
-Prefetch_Addr: .word PrefetchHandler
-Abort_Addr: .word AbortHandler
- .word 0 /* reserved */
-IRQ_Addr: .word IRQHandler
-FIQ_Addr: .word FIQHandler
-
-/*******************************************************************************
- Exception Handlers
-*******************************************************************************/
-
-/*******************************************************************************
-* Macro Name : SaveContext
-* Description : This macro used to save the context before entering
- an exception handler.
-* Input : The range of registers to store.
-* Output : none
-*******************************************************************************/
-
-.macro SaveContext reg1 reg2
- STMFD sp!,{\reg1-\reg2,lr} /* Save The workspace plus the current return */
- /* address lr_ mode into the stack */
- MRS r1, spsr /* Save the spsr_mode into r1 */
- STMFD sp!, {r1} /* Save spsr */
-.endm
-
-/*******************************************************************************
-* Macro Name : RestoreContext
-* Description : This macro used to restore the context to return from
- an exception handler and continue the program execution.
-* Input : The range of registers to restore.
-* Output : none
-*******************************************************************************/
-
-.macro RestoreContext reg1 reg2
- LDMFD sp!, {r1} /* Restore the saved spsr_mode into r1 */
- MSR spsr_cxsf, r1 /* Restore spsr_mode */
- LDMFD sp!, {\reg1-\reg2,pc}^ /* Return to the instruction following */
- /* the exception interrupt */
-.endm
-
-/*******************************************************************************
-* Function Name : IRQHandler
-* Description : This function called when IRQ exception is entered.
-* Input : none
-* Output : none
-*******************************************************************************/
-
-IRQHandler:
- SUB lr, lr, #4 /* Update the link register */
- SaveContext r0, r12 /* Save the workspace plus the current */
- /* return address lr_irq and spsr_irq */
- LDR r0, =VectorAddress
- LDR r0, [r0] /* Read the routine address */
- LDR r1, =VectorAddressDaisy
- LDR r1, [r1]
- /* Padding between the acknowledge and re-enable of interrupts */
- /* For more details, please refer to the following URL */
- /* http://www.arm.com/support/faqip/3682.html */
- NOP
- NOP
- MSR cpsr_c, #Mode_SYS /* Switch to SYS mode and enable IRQ */
- STMFD sp!, {lr} /* Save the link register. */
- LDR lr, =ReturnAddress /* Read the return address. */
- MOV pc, r0 /* Branch to the IRQ handler. */
-ReturnAddress:
- LDMFD sp!, {lr} /* Restore the link register. */
- MSR cpsr_c, #Mode_IRQ|I_Bit|F_Bit /* Switch to IRQ mode and disable IRQ */
- LDR r0, =VectorAddress /* Write to the VectorAddress to clear the */
- STR r0, [r0] /* respective interrupt in the internal interrupt */
- LDR r1, =VectorAddressDaisy /* Write to the VectorAddressDaisy to clear the */
- STR r1, [r1] /* respective interrupt in the internal interrupt */
- RestoreContext r0, r12 /* Restore the context and return to the program execution. */
-
-/*******************************************************************************
-* Function Name : SWIHandler
-* Description : This function called when SWI instruction executed.
-* Input : none
-* Output : none
-*******************************************************************************/
-
-SWIHandler:
- SaveContext r0, r12 /* r0 holds swi number */
- MOV r1, sp /* load regs */
- BL SWI_Handler
- RestoreContext r0, r12
-
-/*******************************************************************************
-* Function Name : UndefinedHandler
-* Description : This function called when undefined instruction
- exception is entered.
-* Input : none
-* Output : none
-*******************************************************************************/
-
-UndefinedHandler:
- SaveContext r0, r12
- BL Undefined_Handler
- RestoreContext r0, r12
-
-/*******************************************************************************
-* Function Name : PrefetchAbortHandler
-* Description : This function called when Prefetch Abort
- exception is entered.
-* Input : none
-* Output : none
-*******************************************************************************/
-
-PrefetchHandler:
- SUB lr, lr, #4 /* Update the link register. */
- SaveContext r0, r12
- BL Prefetch_Handler
- RestoreContext r0, r12
-
-/*******************************************************************************
-* Function Name : DataAbortHandler
-* Description : This function is called when Data Abort
- exception is entered.
-* Input : none
-* Output : none
-*******************************************************************************/
-
-AbortHandler:
- SUB lr, lr, #8 /* Update the link register. */
- SaveContext r0, r12
- BL Abort_Handler
- RestoreContext r0, r12
-
-/*******************************************************************************
-* Function Name : FIQHandler
-* Description : This function is called when FIQ
- exception is entered.
-* Input : none
-* Output : none
-*******************************************************************************/
-
-FIQHandler:
- SUB lr, lr, #4 /* Update the link register. */
- SaveContext r0, r7
- BL FIQ_Handler
- RestoreContext r0, r7
-
- .end
diff --git a/uc_str912/prj_template91x/src/vectors.c b/uc_str912/prj_template91x/src/vectors.c
deleted file mode 100644
index 4022391..0000000
--- a/uc_str912/prj_template91x/src/vectors.c
+++ /dev/null
@@ -1,462 +0,0 @@
-/***********************************************************************************
-* Copyright 2005 Anglia Design
-* This demo code and associated components are provided as is and has no warranty,
-* implied or otherwise. You are free to use/modify any of the provided
-* code at your own risk in your applications with the expressed limitation
-* of liability (see below)
-*
-* LIMITATION OF LIABILITY: ANGLIA OR ANGLIA DESIGNS SHALL NOT BE LIABLE FOR ANY
-* LOSS OF PROFITS, LOSS OF USE, LOSS OF DATA, INTERRUPTION OF BUSINESS, NOR FOR
-* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND WHETHER UNDER
-* THIS AGREEMENT OR OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-*
-* Author : Spencer Oliver
-* Web : www.anglia-designs.com
-*
-***********************************************************************************/
-
-#include "vectors.h"
-
-/*******************************************************************************
-* Function Name : Undefined_Handler
-* Description : This function Undefined instruction exception.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void Undefined_Handler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : SWI_Handler
-* Description : This function handles SW exception.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void SWI_Handler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : Prefetch_Handler
-* Description : This function handles preftetch abort exception.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void Prefetch_Handler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : Abort_Handler
-* Description : This function handles data abort exception.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void Abort_Handler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : FIQ_Handler
-* Description : This function handles FIQ exception.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void FIQ_Handler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : WDG_IRQHandler
-* Description : This function handles the WDG interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void WDG_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : SW_IRQHandler
-* Description : This function handles the SW interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void SW_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : ARMRX_IRQHandler
-* Description : This function handles the ARMRX interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void ARMRX_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : ARMTX_IRQHandler
-* Description : This function handles the ARMTX interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void ARMTX_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : TIM0_IRQHandler
-* Description : This function handles the TIM0 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void TIM0_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : TIM1_IRQHandler
-* Description : This function handles the TIM1 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void TIM1_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : TIM2_IRQHandler
-* Description : This function handles the TIM2 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void TIM2_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : TIM3_IRQHandler
-* Description : This function handles the TIM3 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void TIM3_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : USBHP_IRQHandler
-* Description : This function handles the USBHP interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void USBHP_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : USBLP_IRQHandler
-* Description : This function handles the USBLP interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void USBLP_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : SCU_IRQHandler
-* Description : This function handles the SCU interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : ENET_IRQHandler
-* Description : This function handles the ENET interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void ENET_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : DMA_IRQHandler
-* Description : This function handles the DMA interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void DMA_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : CAN_IRQHandler
-* Description : This function handles the CAN interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void CAN_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : MC_IRQHandler
-* Description : This function handles the MC interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : ADC_IRQHandler
-* Description : This function handles the ADC interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void ADC_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : UART0_IRQHandler
-* Description : This function handles the UART0 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART0_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : UART1_IRQHandler
-* Description : This function handles the UART1 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART1_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : UART2_IRQHandler
-* Description : This function handles the UART2 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART2_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : I2C0_IRQHandler
-* Description : This function handles the I2C0 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void I2C0_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : I2C1_IRQHandler
-* Description : This function handles the I2C1 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void I2C1_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : SSP0_IRQHandler
-* Description : This function handles the SSP0 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void SSP0_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : SSP1_IRQHandler
-* Description : This function handles the SSP1 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void SSP1_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : LVD_IRQHandler
-* Description : This function handles the LVD interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void LVD_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : RTC_IRQHandler
-* Description : This function handles the RTC interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void RTC_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : WIU_IRQHandler
-* Description : This function handles the WIU interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void WIU_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : EXTIT0_IRQHandler
-* Description : This function handles the EXTIT0 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void EXTIT0_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : EXTIT1_IRQHandler
-* Description : This function handles the EXTIT1 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void EXTIT1_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : EXTIT2_IRQHandler
-* Description : This function handles the EXTIT2 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void EXTIT2_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : EXTIT3_IRQHandler
-* Description : This function handles the EXTIT3 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void EXTIT3_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : USBWU_IRQHandler
-* Description : This function handles the USBWU interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void USBWU_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : PFQBC_IRQHandler
-* Description : This function handles the PFQBC interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void PFQBC_IRQHandler(void)
-{
- while(1);
-}
diff --git a/uc_str912/prj_template91x/str91x_lib/Makefile b/uc_str912/prj_template91x/str91x_lib/Makefile
deleted file mode 100644
index e65be4d..0000000
--- a/uc_str912/prj_template91x/str91x_lib/Makefile
+++ /dev/null
@@ -1,38 +0,0 @@
-# efsl library Makefile for STR910 by Giacomo Fazio and Antonio Nasca
-# (based on efsl library makefile for AT91SAM7S by Martin Thomas)
-
-
-MCU = arm9e
-#THUMB = -mthumb -mthumb-interwork
-THUMB =
-
-LIBNAME = libSTR91x_lib.a
-
-COPT= -mcpu=$(MCU) $(THUMB) -gdwarf-2 -Wall -Os
-INCLUDEDIRS=-Iinclude
-CFLAGS=$(COPT) $(INCLUDEDIRS)
-# gcc4 unused code-removal:
-CFLAGS += -ffunction-sections -fdata-sections
-
-CC=arm-elf-gcc
-AR=arm-elf-ar
-OBJCOPY=arm-elf-objcopy
-
-OBJ=src/91x_adc.o src/91x_ahbapb.o src/91x_can.o src/91x_dma.o
-OBJ+=src/91x_emi.o src/91x_fmi.o src/91x_gpio.o src/91x_i2c.o src/91x_lib.o src/91x_mc.o
-OBJ+=src/91x_rtc.o src/91x_scu.o src/91x_ssp.o src/91x_tim.o
-OBJ+=src/91x_wdg.o src/91x_wiu.o src/91x_uart.o src/91x_vic.o
-
-
-all: lib
-
-libandclean: lib srcclean
-
-lib: $(OBJ)
- $(AR) rcs $(LIBNAME) $(OBJ)
-
-srcclean :
- rm -f $(OBJ)
-
-clean :
- rm -f $(OBJ) $(LIBNAME)
diff --git a/uc_str912/prj_template91x/str91x_lib/include/91x_adc.h b/uc_str912/prj_template91x/str91x_lib/include/91x_adc.h
deleted file mode 100644
index 25a396d..0000000
--- a/uc_str912/prj_template91x/str91x_lib/include/91x_adc.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_adc.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* ADC software library.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-
-/* Define to prevent recursive inclusion ------------------------------------ */
-
-#ifndef __91x_ADC_H
-#define __91x_ADC_H
-
-/* Includes ------------------------------------------------------------------*/
-
-#include "91x_map.h"
-
-/* Exported types ------------------------------------------------------------*/
-
-/* ADC Init structure define */
-typedef struct
-{
- u16 ADC_WDG_High_Threshold;
- u16 ADC_WDG_Low_Threshold;
- u16 ADC_Channel_0_Mode;
- u16 ADC_Channel_1_Mode;
- u16 ADC_Channel_2_Mode;
- u16 ADC_Channel_3_Mode;
- u16 ADC_Channel_4_Mode;
- u16 ADC_Channel_5_Mode;
- u16 ADC_Channel_6_Mode;
- u16 ADC_Channel_7_Mode;
- u16 ADC_Select_Channel;
- FunctionalState ADC_Scan_Mode;
- u16 ADC_Conversion_Mode;
-}ADC_InitTypeDef;
-
-/* ADC watchdog thresholds */
-typedef enum
-{
- ADC_HighThreshold,
- ADC_LowThreshold
-}ADC_ThresholdType;
-
-/* Exported constants --------------------------------------------------------*/
-
-/* ADC channels */
-#define ADC_Channel_0 0x00 /* Channel 0 */
-#define ADC_Channel_1 0x01 /* Channel 1 */
-#define ADC_Channel_2 0x02 /* Channel 2 */
-#define ADC_Channel_3 0x03 /* Channel 3 */
-#define ADC_Channel_4 0x04 /* Channel 4 */
-#define ADC_Channel_5 0x05 /* Channel 5 */
-#define ADC_Channel_6 0x06 /* Channel 6 */
-#define ADC_Channel_7 0x07 /* Channel 7 */
-
-/* ADC modes */
-#define ADC_Continuous_Mode 0x0010 /* Continuous mode conversion */
-#define ADC_Single_Mode 0xFFEF /* Single mode conversion */
-
-/* ADC Flags */
-#define ADC_FLAG_ECV 0x002F /* End of Conversion Flag */
-#define ADC_FLAG_AWD 0x002E /* Analog WatchDog Flag */
-
-#define ADC_FLAG_OV_CH_0 0x00CF /* Overflow Flag for channel 0 */
-#define ADC_FLAG_OV_CH_1 0x00EF /* Overflow Flag for channel 1 */
-#define ADC_FLAG_OV_CH_2 0x010F /* Overflow Flag for channel 2 */
-#define ADC_FLAG_OV_CH_3 0x012F /* Overflow Flag for channel 3 */
-#define ADC_FLAG_OV_CH_4 0x014F /* Overflow Flag for channel 4 */
-#define ADC_FLAG_OV_CH_5 0x016F /* Overflow Flag for channel 5 */
-#define ADC_FLAG_OV_CH_6 0x018F /* Overflow Flag for channel 6 */
-#define ADC_FLAG_OV_CH_7 0x01AF /* Overflow Flag for channel 7 */
-
-/* ADC conversion modes */
-#define ADC_NoThreshold_Conversion 0x0003 /* Conversion w/o thresholds */
-#define ADC_LowThreshold_Conversion 0x0002 /* Low threshold conversion */
-#define ADC_HighThreshold_Conversion 0x0001 /* High threshold conversion */
-#define ADC_No_Conversion 0x0000 /* No ADC conversion */
-
-/* ADC interrupts */
-#define ADC_IT_ECV 0x0400 /* End of Conversion Interrupt */
-#define ADC_IT_AWD 0x0200 /* Analog Watchdog Interrupt */
-
-/* ADC Start/Stop conversion */
-#define ADC_Conversion_Start 0x0001 /* ADC start conversion */
-#define ADC_Conversion_Stop 0xFFFE /* ADC stop conversion */
-
-/* Module private variables --------------------------------------------------*/
-/* Exported macro ------------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-
-void ADC_DeInit(void);
-void ADC_Init(ADC_InitTypeDef* ADC_InitStruct);
-void ADC_StructInit(ADC_InitTypeDef* ADC_InitStruct);
-void ADC_PrescalerConfig(u8 ADC_Prescaler);
-u8 ADC_GetPrescalerValue(void);
-FlagStatus ADC_GetFlagStatus(u16 ADC_Flag);
-void ADC_ClearFlag(u16 ADC_Flag);
-u16 ADC_GetConversionValue(u16 ADC_Channel);
-FlagStatus ADC_GetAnalogWatchdogResult(u16 ADC_Channel);
-void ADC_ClearAnalogWatchdogResult(u16 ADC_Channel);
-u16 ADC_GetWatchdogThreshold(ADC_ThresholdType ADC_Threshold);
-void ADC_ITConfig(u16 ADC_IT, FunctionalState ADC_NewState);
-void ADC_StandbyModeCmd(FunctionalState ADC_NewState);
-void ADC_Cmd(FunctionalState ADC_NewState);
-void ADC_ConversionCmd(u16 ADC_Conversion);
-
-#endif /* __91x_ADC_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
-
diff --git a/uc_str912/prj_template91x/str91x_lib/include/91x_ahbapb.h b/uc_str912/prj_template91x/str91x_lib/include/91x_ahbapb.h
deleted file mode 100644
index 1828d48..0000000
--- a/uc_str912/prj_template91x/str91x_lib/include/91x_ahbapb.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_ahbapb.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* AHBAPB software library.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef _91x_AHBAPB_H
-#define _91x_AHBAPB_H
-
-#include "91x_map.h"
-
-#define AHBAPB_Split_Enable 0x01000000
-#define AHBAPB_Split_Disable 0xFEFFFFFF
-#define AHBAPB_Error_Enable 0x0000100
-#define AHBAPB_Error_Disable 0xFFFFEFF
-
-/*FLAG*/
-#define AHBAPB_FLAG_ERROR 0x01 /* error flag*/
-#define AHBAPB_FLAG_OUTM 0x10 /* Out of Memory flag */
-#define AHBAPB_FLAG_APBT 0x20 /* APB Time-out flag */
-#define AHBAPB_FLAG_RW 0x40 /*Access type flag*/
-
-/* Includes ------------------------------------------------------------------*/
-
-
-/* AHBAPB Init structure definition */
-typedef struct
-{
- u32 AHBAPB_SetTimeOut;
- u32 AHBAPB_Error;
- u32 AHBAPB_Split;
- u8 AHBAPB_SplitCounter;
-}AHBAPB_InitTypeDef;
-
-/* Exported constants --------------------------------------------------------*/
-void AHBAPB_DeInit(AHBAPB_TypeDef* AHBAPBx);
-void AHBAPB_Init(AHBAPB_TypeDef* AHBAPBx, AHBAPB_InitTypeDef* AHBAPB_InitStruct);
-void AHBAPB_StructInit(AHBAPB_InitTypeDef* AHBAPB_InitStruct);
-FlagStatus AHBAPB_GetFlagStatus(AHBAPB_TypeDef* AHBAPBx, u8 AHBAPB_FLAG);
-void AHBAPB_ClearFlag(AHBAPB_TypeDef* AHBAPBx, u8 AHBAPB_FLAG);
-u32 AHBAPB_GetPeriphAddrError(AHBAPB_TypeDef* AHBAPBx);
-
-
-#endif /* _91x_AHBAPB_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_template91x/str91x_lib/include/91x_can.h b/uc_str912/prj_template91x/str91x_lib/include/91x_can.h
deleted file mode 100644
index b3d0653..0000000
--- a/uc_str912/prj_template91x/str91x_lib/include/91x_can.h
+++ /dev/null
@@ -1,165 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_can.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* CAN bus software library.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __91x_CAN_H
-#define __91x_CAN_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_map.h"
-
-/* Exported types ------------------------------------------------------------*/
-
-/* CAN Init structure define */
-typedef struct
-{
- u8 CAN_ConfigParameters;
- u32 CAN_Bitrate;
-}CAN_InitTypeDef;
-
-/* Exported constants --------------------------------------------------------*/
-/* Standard bitrates available*/
-enum
-{
- CAN_BITRATE_100K,
- CAN_BITRATE_125K,
- CAN_BITRATE_250K,
- CAN_BITRATE_500K,
- CAN_BITRATE_1M
-};
-
-/* Control register*/
-#define CAN_CR_TEST 0x0080
-#define CAN_CR_CCE 0x0040
-#define CAN_CR_DAR 0x0020
-#define CAN_CR_EIE 0x0008
-#define CAN_CR_SIE 0x0004
-#define CAN_CR_IE 0x0002
-#define CAN_CR_INIT 0x0001
-
-/* Status register */
-#define CAN_SR_BOFF 0x0080
-#define CAN_SR_EWARN 0x0040
-#define CAN_SR_EPASS 0x0020
-#define CAN_SR_RXOK 0x0010
-#define CAN_SR_TXOK 0x0008
-#define CAN_SR_LEC 0x0007
-
-/* Test register*/
-#define CAN_TESTR_RX 0x0080
-#define CAN_TESTR_TX1 0x0040
-#define CAN_TESTR_TX0 0x0020
-#define CAN_TESTR_LBACK 0x0010
-#define CAN_TESTR_SILENT 0x0008
-#define CAN_TESTR_BASIC 0x0004
-
-/* IFn / Command Request register*/
-#define CAN_CRR_BUSY 0x8000
-
-/* IFn / Command Mask register*/
-#define CAN_CMR_WRRD 0x0080
-#define CAN_CMR_MASK 0x0040
-#define CAN_CMR_ARB 0x0020
-#define CAN_CMR_CONTROL 0x0010
-#define CAN_CMR_CLRINTPND 0x0008
-#define CAN_CMR_TXRQSTNEWDAT 0x0004
-#define CAN_CMR_DATAA 0x0002
-#define CAN_CMR_DATAB 0x0001
-
-/* IFn / Mask 2 register*/
-#define CAN_M2R_MXTD 0x8000
-#define CAN_M2R_MDIR 0x4000
-
-/* IFn / Arbitration 2 register*/
-#define CAN_A2R_MSGVAL 0x8000
-#define CAN_A2R_XTD 0x4000
-#define CAN_A2R_DIR 0x2000
-
-/* IFn / Message Control register*/
-#define CAN_MCR_NEWDAT 0x8000
-#define CAN_MCR_MSGLST 0x4000
-#define CAN_MCR_INTPND 0x2000
-#define CAN_MCR_UMASK 0x1000
-#define CAN_MCR_TXIE 0x0800
-#define CAN_MCR_RXIE 0x0400
-#define CAN_MCR_RMTEN 0x0200
-#define CAN_MCR_TXRQST 0x0100
-#define CAN_MCR_EOB 0x0080
-
-
-/* Wake-up modes*/
-enum
-{
- CAN_WAKEUP_ON_EXT,
- CAN_WAKEUP_ON_CAN
-};
-
-
-/* CAN message structure*/
-typedef struct
-{
- u32 IdType;
- u32 Id;
- u8 Dlc;
- u8 Data[8];
-} canmsg;
-
-/* Message ID types*/
-enum
-{
- CAN_STD_ID,
- CAN_EXT_ID
-};
-
-/* Message ID limits*/
-
-#define CAN_LAST_STD_ID ((1<<11) - 1)
-#define CAN_LAST_EXT_ID ((1L<<29) - 1)
-
-/* Exported functions ------------------------------------------------------- */
-
-void CAN_Init (CAN_InitTypeDef *CAN_InitStruct);
-void CAN_DeInit (void);
-void CAN_StructInit(CAN_InitTypeDef *CAN_InitStruct);
-void CAN_SetBitrate(u32 bitrate);
-void CAN_SetTiming(u32 tseg1, u32 tseg2, u32 sjw, u32 brp);
-ErrorStatus CAN_SetUnusedMsgObj(u32 msgobj);
-ErrorStatus CAN_SetTxMsgObj(u32 msgobj, u32 idType);
-ErrorStatus CAN_SetRxMsgObj(u32 msgobj, u32 idType, u32 idLow, u32 idHigh, bool singleOrFifoLast);
-void CAN_InvalidateAllMsgObj(void);
-ErrorStatus CAN_ReleaseMessage(u32 msgobj);
-ErrorStatus CAN_SendMessage(u32 msgobj, canmsg* pCanMsg);
-ErrorStatus CAN_ReceiveMessage(u32 msgobj, bool release, canmsg* pCanMsg);
-ErrorStatus CAN_WaitEndOfTx(void);
-ErrorStatus CAN_BasicSendMessage(canmsg* pCanMsg);
-ErrorStatus CAN_BasicReceiveMessage(canmsg* pCanMsg);
-void CAN_EnterTestMode(u8 TestMask);
-void CAN_EnterInitMode(u8 InitMask);
-void CAN_LeaveInitMode(void);
-void CAN_LeaveTestMode(void);
-void CAN_ReleaseTxMessage(u32 msgobj);
-void CAN_ReleaseRxMessage(u32 msgobj);
-u32 CAN_IsMessageWaiting(u32 msgobj);
-u32 CAN_IsTransmitRequested(u32 msgobj);
-u32 CAN_IsInterruptPending(u32 msgobj);
-u32 CAN_IsObjectValid(u32 msgobj);
-
-#endif /* __91x_CAN_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_template91x/str91x_lib/include/91x_conf.h b/uc_str912/prj_template91x/str91x_lib/include/91x_conf.h
deleted file mode 100644
index a39d57e..0000000
--- a/uc_str912/prj_template91x/str91x_lib/include/91x_conf.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_conf.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : Library configuration.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-
-#ifndef __91x_CONF_H
-#define __91x_CONF_H
-
-/* To work in buffered mode just decomment the following line */
-
-//#define LIBUFF
-
-/* Comment the line below to put the library in release mode */
-//#define LIBDEBUG
-
-#define inline static __inline
-
-/************************* AHBAPB *************************/
-#define _AHBAPB
-#define _AHBAPB0
-#define _AHBAPB1
-/************************* VIC *************************/
-#define _VIC
-#define _VIC0
-#define _VIC1
-/************************* DMA *************************/
-#define _DMA
-#define _DMA_Channel0
-#define _DMA_Channel1
-#define _DMA_Channel2
-#define _DMA_Channel3
-#define _DMA_Channel4
-#define _DMA_Channel5
-#define _DMA_Channel6
-#define _DMA_Channel7
-
-/************************* EMI *************************/
-#define _EMI
-#define _EMI_Bank0
-#define _EMI_Bank1
-#define _EMI_Bank2
-#define _EMI_Bank3
-/************************* FMI *************************/
-#define _FMI
-/************************* WIU *************************/
-#define _WIU
-/************************* TIM *************************/
-#define _TIM
-#define _TIM0
-#define _TIM1
-#define _TIM2
-#define _TIM3
-/************************* GPIO ************************/
-#define _GPIO
-#define _GPIO0
-#define _GPIO1
-#define _GPIO2
-#define _GPIO3
-#define _GPIO4
-#define _GPIO5
-#define _GPIO6
-#define _GPIO7
-#define _GPIO8
-#define _GPIO9
-/************************* RTC *************************/
-#define _RTC
-/************************* SCU *************************/
-#define _SCU
-/************************* MC **************************/
-#define _MC
-/************************* UART ************************/
-#define _UART
-#define _UART0
-#define _UART1
-#define _UART2
-/************************* SSP *************************/
-#define _SSP
-#define _SSP0
-#define _SSP1
-/************************* CAN *************************/
-#define _CAN
-/************************* ADC *************************/
-#define _ADC
-/************************* WDG *************************/
-#define _WDG
-/************************* I2C *************************/
-#define _I2C
-#define _I2C0
-#define _I2C1
-/************************ ENET *************************/
-#define _ENET
-
-/*---------------------------- _Main_Crystal frequency value (KHz)------------*/
-
-//#ifndef _Main_Crystal
-//#define _Main_Crystal 25000
-//#endif
-/*------------------------------------------------------------------------------*/
-
-
-#endif /* __91x_CONF_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_template91x/str91x_lib/include/91x_dma.h b/uc_str912/prj_template91x/str91x_lib/include/91x_dma.h
deleted file mode 100644
index 6a383aa..0000000
--- a/uc_str912/prj_template91x/str91x_lib/include/91x_dma.h
+++ /dev/null
@@ -1,247 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : template.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : provide a short description of the source file indicating
-* its purpose.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __91x_DMA_H
-#define __91x_DMA_H
-
-/* Includes ------------------------------------------------------------------*/
-#include"91x_map.h"
-
-
-/* Exported types ------------------------------------------------------------*/
-
-typedef struct
-{
- u32 DMA_Channel_SrcAdd; /* The current source address (byte-aligned) of the data to be transferred.*/
-
- u32 DMA_Channel_DesAdd; /* The current destination address (byte-aligned) of the data to be transferred.*/
-
- u32 DMA_Channel_LLstItm; /* The word- aligned address for the next Linked List Item. */
-
- u32 DMA_Channel_DesWidth; /* Destination transfer width. */
-
- u32 DMA_Channel_SrcWidth; /* Source transfer width. */
-
- u32 DMA_Channel_DesBstSize; /* The destination burst size which indicates the number of transfers that make up a destination burst transfer request.*/
-
- u32 DMA_Channel_SrcBstSize; /* The source burst size.Indicates the number of transfers that make up a source burst */
-
- u32 DMA_Channel_TrsfSize; /* Transfer size which indicates the size of the transfer when the DMA controller is the flow controller*/
-
- u32 DMA_Channel_FlowCntrl; /* Flow control and transfer type. */
-
- u32 DMA_Channel_Src; /* Source peripheral: selects the DMA source request peripheral. */
-
- u32 DMA_Channel_Des; /* Destination peripheral:selects the DMA destination request peripheral. */
-
-} DMA_InitTypeDef;
-
-/* Exported constants --------------------------------------------------------*/
-
- /* Interrupts masks */
-
-#define DMA_ITMask_IE 0x4000 /* Interrupt error mask. */
-#define DMA_ITMask_ITC 0x8000 /* Terminal count interrupt mask.*/
-#define DMA_ITMask_ALL 0xC000 /* All DMA_Channelx interrupts enable/disable mask*/
-
- /* Sources Request (used as masks) */
-
-#define DMA_USB_RX_Mask 0x0001
-#define DMA_USB_TX_Mask 0x0002
-#define DMA_TIM0_Mask 0x0004
-#define DMA_TIM1_Mask 0x0008
-#define DMA_UART0_RX_Mask 0x0010
-#define DMA_UART0_TX_Mask 0x0020
-#define DMA_UART1_RX_Mask 0x0040
-#define DMA_UART1_TX_Mask 0x0080
-#define DMA_External_Req0_Mask 0x0100
-#define DMA_External_Req1_Mask 0x0200
-#define DMA_I2C0_Mask 0x0400
-#define DMA_I2C1_Mask 0x0800
-#define DMA_SSP0_RX_Mask 0x1000
-#define DMA_SSP0_TX_Mask 0x2000
-#define DMA_SSP1_RX_Mask 0x4000
-#define DMA_SSP1_TX_Mask 0x8000
-
-
-/* Previleged Mode and user mode */
-
-#define DMA_PrevilegedMode 0x10000000
-#define DMA_UserMode 0xEFFFFFFF
-
-
-/* Error and Terminal Count interrupts Status, after and before"raw" masking */
-#define DMA_IS 0x01
-#define DMA_TCS 0x02
-#define DMA_ES 0x03
-#define DMA_TCRS 0x04
-#define DMA_ERS 0x05
-
-
-/* interrupt clear: Terminal Count flag Clear and Error flag clear*/
-
-#define DMA_TCC 0x01
-#define DMA_EC 0x02
-
-/* channel index "0...7"*/
-
-#define Channel0 0
-#define Channel1 1
-#define Channel2 2
-#define Channel3 3
-#define Channel4 4
-#define Channel5 5
-#define Channel6 6
-#define Channel7 7
-
-
-
-/* Destination request selection: selects the DMA Destination request peripheral */
-
-#define DMA_DES_USB_RX 0x00
-#define DMA_DES_USB_TX 0x40
-#define DMA_DES_TIM1 0x80
-#define DMA_DES_TIM2 0xC0
-#define DMA_DES_UART0_RX 0x100
-#define DMA_DES_UART0_TX 0x140
-#define DMA_DES_UART1_RX 0x180
-#define DMA_DES_UART1_TX 0x1C0
-#define DMA_DES_External_Req0 0x200
-#define DMA_DES_External_Req1 0x240
-#define DMA_DES_I2C0 0x280
-#define DMA_DES_I2C1 0x2C0
-#define DMA_DES_SSP0_RX 0x300
-#define DMA_DES_SSP0_TX 0x340
-#define DMA_DES_SSP1_RX 0x380
-#define DMA_DES_SSP1_TX 0x3C0
-
-
-
-
-/* Source request selection: selects the DMA Source request peripheral */
-
-#define DMA_SRC_USB_RX 0x00
-#define DMA_SRC_USB_TX 0x02
-#define DMA_SRC_TIM1 0x04
-#define DMA_SRC_TIM2 0x06
-#define DMA_SRC_UART0_RX 0x08
-#define DMA_SRC_UART0_TX 0x0A
-#define DMA_SRC_UART1_RX 0x0C
-#define DMA_SRC_UART1_TX 0x0E
-#define DMA_SRC_External_Req0 0x10
-#define DMA_SRC_External_Req1 0x12
-#define DMA_SRC_I2C0 0x14
-#define DMA_SRC_I2C1 0x16
-#define DMA_SRC_SSP0_RX 0x18
-#define DMA_SRC_SSP0_TX 0x1A
-#define DMA_SRC_SSP1_RX 0x1C
-#define DMA_SRC_SSP1_TX 0x1E
-
-
-
-
-
-#define DMA_FlowCntrlt0_DMA 0x00000000 /* transfer type :Memory-to-memory, flow controller:DMA */
-#define DMA_FlowCntrl1_DMA 0x00000800 /* transfer type :Memory-to-peripheral, flow controller:DMA */
-#define DMA_FlowCntrl2_DMA 0x00001000 /* transfer type :Peripheral-to-memory, flow controller:DMA */
-#define DMA_FlowCntrl3_DMA 0x00001800 /* transfer type :Source peripheral-to-destination peripheral, flow controller:DMA */
-#define DMA_FlowCntrl_DestPerip 0x00002000 /* transfer type :Source peripheral-to-destination peripheral, flow controller:Destination peripheral */
-#define DMA_FlowCntrl_Perip1 0x00002800 /* transfer type :Memory-to-peripheral, flow controller:peripheral */
-#define DMA_FlowCntrl_Perip2 0x00003000 /* transfer type : Peripheral-to-memory, flow controller:peripheral */
-#define DMA_FlowCntrl_SrcPerip 0x00003800 /* transfer type :Source peripheral-to-destination peripheral, flow controller:Source peripheral */
-
-
-
-
-#define DMA_SrcBst_1Data 0x00000000 /* Source Burst transfer request IS 1 Data ( DATA = Source transfer width ) */
-#define DMA_SrcBst_4Data 0x00001000 /* Source Burst transfer request IS 4 Data */
-#define DMA_SrcBst_8Data 0x00002000 /* Source Burst transfer request IS 8 Data */
-#define DMA_SrcBst_16Data 0x00003000 /* Source Burst transfer request IS 16 Data */
-#define DMA_SrcBst_32Data 0x00004000 /* Source Burst transfer request IS 32 Data */
-#define DMA_SrcBst_64Data 0x00005000 /* Source Burst transfer request IS 64Data */
-#define DMA_SrcBst_128Data 0x00006000 /* Source Burst transfer request IS 128 Data */
-#define DMA_SrcBst_256Data 0x00007000 /* Source Burst transfer request IS 256 Data */
-
-
-
-
-#define DMA_DesBst_1Data 0x00000000 /*Destination Burst transfer request IS 1Data ( DATA = destination transfer width ) */
-#define DMA_DesBst_4Data 0x00008000 /*Destination Burst transfer request IS 1 Data */
-#define DMA_DesBst_8Data 0x00010000 /*Destination Burst transfer request IS 4 Data */
-#define DMA_DesBst_16Data 0x00018000 /*Destination Burst transfer request IS 8 Data */
-#define DMA_DesBst_32Data 0x00020000 /*Destination Burst transfer request IS 16 Data */
-#define DMA_DesBst_64Data 0x00028000 /*Destination Burst transfer request IS 32 Data */
-#define DMA_DesBst_128Data 0x00030000 /*Destination Burst transfer request IS 128 Data */
-#define DMA_DesBst_256Data 0x00038000 /*Destination Burst transfer request IS 256 Data */
-
-
-
-
-
-#define DMA_SrcWidth_Byte 0x00000000 /* source Width is one Byte */
-#define DMA_SrcWidth_HalfWord 0x00040000 /* source Width is one HalfWord */
-#define DMA_SrcWidth_Word 0x00080000 /* source Width is one Word */
-
-
-
-
-#define DMA_DesWidth_Byte 0x00000000 /* Destination Width is one Byte */
-#define DMA_DesWidth_HalfWord 0x00200000 /* Destination Width is one HalfWord */
-#define DMA_DesWidth_Word 0x00400000 /* Destination Width is one Word */
-
-
-
-
-
-
-/* Exported macro ------------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-
-void DMA_DeInit(void);
-void DMA_Init(DMA_Channel_TypeDef * DMA_Channelx, DMA_InitTypeDef * DMA_InitStruct);
-void DMA_StructInit(DMA_InitTypeDef *DMA_InitStruct);
-void DMA_Cmd(FunctionalState NewState);
-void DMA_ITMaskConfig(DMA_Channel_TypeDef * DMA_Channelx, u16 DMA_ITMask, FunctionalState NewState);
-void DMA_ITConfig(DMA_Channel_TypeDef * DMA_Channelx, FunctionalState NewState);
-FlagStatus DMA_GetChannelStatus(u8 ChannelIndx );
-ITStatus DMA_GetITStatus(u8 ChannelIndx,u8 DMA_ITReq);
-void DMA_ClearIT(u8 ChannelIndx,u8 DMA_ITClr);
-void DMA_SyncConfig(u16 DMA_SrcReq, FunctionalState NewState);
-FlagStatus DMA_GetSReq(u16 DMA_SrcReq);
-FlagStatus DMA_GetLSReq(u16 DMA_SrcReq);
-FlagStatus DMA_GetBReq(u16 DMA_SrcReq);
-FlagStatus DMA_GetLBReq(u16 DMA_SrcReq);
-FlagStatus DMA_GetChannelActiveStatus( DMA_Channel_TypeDef * DMA_Channelx);
-void DMA_SetSReq(u16 DMA_SrcReq);
-void DMA_SetLSReq(u16 DMA_SrcReq);
-void DMA_SetBReq(u16 DMA_SrcReq);
-void DMA_SetLBReq(u16 DMA_SrcReq);
-void DMA_ChannelCmd (DMA_Channel_TypeDef * DMA_Channelx,FunctionalState NewState);
-void DMA_ChannelHalt (DMA_Channel_TypeDef * DMA_Channelx,FunctionalState NewState);
-void DMA_ChannelBuffering (DMA_Channel_TypeDef * DMA_Channelx,FunctionalState NewState);
-void DMA_ChannelLockTrsf(DMA_Channel_TypeDef * DMA_Channelx,FunctionalState NewState);
-void DMA_ChannelCache(DMA_Channel_TypeDef * DMA_Channelx,FunctionalState NewState);
-void DMA_ChannelProt0Mode(DMA_Channel_TypeDef * DMA_Channelx,u32 Prot0Mode);
-void DMA_ChannelSRCIncConfig (DMA_Channel_TypeDef * DMA_Channelx, FunctionalState NewState);
-void DMA_ChannelDESIncConfig (DMA_Channel_TypeDef * DMA_Channelx, FunctionalState NewState);
-
-#endif /* __91x_DMA_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_template91x/str91x_lib/include/91x_emi.h b/uc_str912/prj_template91x/str91x_lib/include/91x_emi.h
deleted file mode 100644
index 4633020..0000000
--- a/uc_str912/prj_template91x/str91x_lib/include/91x_emi.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_emi.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* EMI software library.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __91x_EMI_H
-#define __91x_EMI_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_map.h"
-
-/* Exported types ------------------------------------------------------------*/
- typedef struct
- {
- u32 EMI_Bank_IDCY;
-
- u32 EMI_Bank_WSTRD;
-
- u32 EMI_Bank_WSTWR;
-
- u32 EMI_Bank_WSTROEN;
-
- u32 EMI_Bank_WSTWEN;
-
- u32 EMI_Bank_MemWidth ;
-
- u32 EMI_Bank_WriteProtection;
-
- u32 EMI_PageModeRead_TransferLength;
-
- u32 EMI_PageModeRead_Selection;
-
- } EMI_InitTypeDef;
-
-/* Exported constants --------------------------------------------------------*/
-
-
-/* page transfer length for page mode read */
-#define EMI_4Data 0x00000000 /*4 transfers burst*/
-#define EMI_8Data 0x00000400 /*8 transfers burst*/
-
-
-/*Select or deselect the page mode read*/
-#define EMI_NormalMode 0x00000000 /*Normal Mode*/
-#define EMI_PageModeRead 0x00000100 /*Page Mode Read*/
-
-
-/*memory width*/
-#define EMI_Width_Byte 0x00000000 /*8 bits width*/
-#define EMI_Width_HalfWord 0x00000010 /*16 bits width*/
-
-/*Write protection feature */
-#define EMI_Bank_NonWriteProtect 0x00000000 /*No write protection*/
-#define EMI_Bank_WriteProtect 0x00000008 /*bank is write protected*/
-
-
-/* Exported macro ------------------------------------------------------------*/
-
-
-/* Exported functions ------------------------------------------------------- */
-
-void EMI_DeInit(void);
-void EMI_Init( EMI_Bank_TypeDef* EMI_Bankx, EMI_InitTypeDef* EMI_InitStruct);
-void EMI_StructInit(EMI_InitTypeDef* EMI_InitStruct);
-
-#endif /* __EMI_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_template91x/str91x_lib/include/91x_fmi.h b/uc_str912/prj_template91x/str91x_lib/include/91x_fmi.h
deleted file mode 100644
index 06e8115..0000000
--- a/uc_str912/prj_template91x/str91x_lib/include/91x_fmi.h
+++ /dev/null
@@ -1,184 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_fmi.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* FMI software library.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-
-/* Define to prevent recursive inclusion ------------------------------------ */
-
-#ifndef __91x_FMI_H
-#define __91x_FMI_H
-
-/* ========================================================================== */
-/* When bank 1 is remapped at address 0x0, decomment the following line */
-/* ========================================================================== */
-
-//#define Remap_Bank_1
-
-
-/* Includes ------------------------------------------------------------------*/
-
-#include "91x_map.h"
-
-/* Exported types ------------------------------------------------------------*/
-/* Exported constants --------------------------------------------------------*/
-
-/* FMI banks */
-
-#ifdef Remap_Bank_1
-
-#define FMI_BANK_0 ((*(vu32*)0x54000010) << 2) /* FMI Bank 0 */
-#define FMI_BANK_1 ((*(vu32*)0x5400000C) << 2) /* FMI Bank 1 */
-
-#else /* Remap Bank 0 */
-
-#define FMI_BANK_0 ((*(vu32*)0x5400000C) << 2) /* FMI Bank 0 */
-#define FMI_BANK_1 ((*(vu32*)0x54000010) << 2) /* FMI Bank 1 */
-
-#endif
-
-/* FMI sectors */
-
-#define FMI_B0S0 0x00000000 + FMI_BANK_0 /* Bank 0 sector 0 */
-#define FMI_B0S1 0x00010000 + FMI_BANK_0 /* Bank 0 sector 1 */
-#define FMI_B0S2 0x00020000 + FMI_BANK_0 /* Bank 0 sector 2 */
-#define FMI_B0S3 0x00030000 + FMI_BANK_0 /* Bank 0 sector 3 */
-#define FMI_B0S4 0x00040000 + FMI_BANK_0 /* Bank 0 sector 4 */
-#define FMI_B0S5 0x00050000 + FMI_BANK_0 /* Bank 0 sector 5 */
-#define FMI_B0S6 0x00060000 + FMI_BANK_0 /* Bank 0 sector 6 */
-#define FMI_B0S7 0x00070000 + FMI_BANK_0 /* Bank 0 sector 7 */
-
-#define FMI_B1S0 0x00000000 + FMI_BANK_1 /* Bank 1 sector 0 */
-#define FMI_B1S1 0x00002000 + FMI_BANK_1 /* Bank 1 sector 1 */
-#define FMI_B1S2 0x00004000 + FMI_BANK_1 /* Bank 1 sector 2 */
-#define FMI_B1S3 0x00006000 + FMI_BANK_1 /* Bank 1 sector 3 */
-
-/* FMI Flags */
-
-#define FMI_FLAG_SPS 0x02 /* Sector Protection Status Flag */
-#define FMI_FLAG_PSS 0x04 /* Program Suspend Status Flag */
-#define FMI_FLAG_PS 0x10 /* Program Status Flag */
-#define FMI_FLAG_ES 0x20 /* Erase Status Flag */
-#define FMI_FLAG_ESS 0x40 /* Erase Suspend Status Flag */
-#define FMI_FLAG_PECS 0x80 /* FPEC Status Flag */
-
-/* FMI read wait states */
-
-#define FMI_READ_WAIT_STATE_1 0x0000 /* One read wait state */
-#define FMI_READ_WAIT_STATE_2 0x2000 /* Two read wait states */
-#define FMI_READ_WAIT_STATE_3 0x4000 /* Three read wait states */
-
-/* FMI write wait states */
-
-#define FMI_WRITE_WAIT_STATE_0 0xFFFFFEFF /* Zero wait state */
-#define FMI_WRITE_WAIT_STATE_1 0x00000100 /* One wait state */
-
-/* FMI power down configuration */
-
-#define FMI_PWD_ENABLE 0x1000 /* FMI Power Down Enable */
-#define FMI_PWD_DISABLE 0x0000 /* FMI Power Down Disable */
-
-/* FMI low voltage detector */
-
-#define FMI_LVD_ENABLE 0x0000 /* FMI Low Voltage Detector Enable */
-#define FMI_LVD_DISABLE 0x0800 /* FMI Low Voltage Detector Disable */
-
-/* FMI frequency range */
-
-#define FMI_FREQ_LOW 0x0000 /* FMI Low bus working frequency */
-#define FMI_FREQ_HIGH 0x0040 /* FMI High bus working gfrequency */
- /* Above 66 MHz*/
-/* FMI OTP word addresses */
-
-#define FMI_OTP_WORD_0 0x00 /* OTP word 0 */
-#define FMI_OTP_WORD_1 0x04 /* OTP word 1 */
-#define FMI_OTP_WORD_2 0x08 /* OTP word 2 */
-#define FMI_OTP_WORD_3 0x0C /* OTP word 3 */
-#define FMI_OTP_WORD_4 0x10 /* OTP word 4 */
-#define FMI_OTP_WORD_5 0x14 /* OTP word 5 */
-#define FMI_OTP_WORD_6 0x18 /* OTP word 6 */
-#define FMI_OTP_WORD_7 0x1C /* OTP word 7 */
-
-/* FMI OTP halfword addresses */
-
-#define FMI_OTP_LOW_HALFWORD_0 0x00 /* OTP Low halfword 0 */
-#define FMI_OTP_HIGH_HALFWORD_0 0x02 /* OTP High halfword 0 */
-#define FMI_OTP_LOW_HALFWORD_1 0x04 /* OTP Low halfword 1 */
-#define FMI_OTP_HIGH_HALFWORD_1 0x06 /* OTP High halfword 1 */
-#define FMI_OTP_LOW_HALFWORD_2 0x08 /* OTP Low halfword 2 */
-#define FMI_OTP_HIGH_HALFWORD_2 0x0A /* OTP High halfword 2 */
-#define FMI_OTP_LOW_HALFWORD_3 0x0C /* OTP Low halfword 3 */
-#define FMI_OTP_HIGH_HALFWORD_3 0x0E /* OTP High halfword 3 */
-#define FMI_OTP_LOW_HALFWORD_4 0x10 /* OTP Low halfword 4 */
-#define FMI_OTP_HIGH_HALFWORD_4 0x12 /* OTP High halfword 4 */
-#define FMI_OTP_LOW_HALFWORD_5 0x14 /* OTP Low halfword 5 */
-#define FMI_OTP_HIGH_HALFWORD_5 0x16 /* OTP High halfword 5 */
-#define FMI_OTP_LOW_HALFWORD_6 0x18 /* OTP Low halfword 6 */
-#define FMI_OTP_HIGH_HALFWORD_6 0x1A /* OTP High halfword 6 */
-#define FMI_OTP_LOW_HALFWORD_7 0x1C /* OTP Low halfword 7 */
-#define FMI_OTP_HIGH_HALFWORD_7 0x1E /* OTP High halfword 7 */
-
-/* FMI sectors Masks */
-
-#define FMI_B0S0_MASK 0x0001 /* FMI B0S0 mask */
-#define FMI_B0S1_MASK 0x0002 /* FMI B0S1 mask */
-#define FMI_B0S2_MASK 0x0004 /* FMI B0S2 mask */
-#define FMI_B0S3_MASK 0x0008 /* FMI B0S3 mask */
-#define FMI_B0S4_MASK 0x0010 /* FMI B0S4 mask */
-#define FMI_B0S5_MASK 0x0020 /* FMI B0S5 mask */
-#define FMI_B0S6_MASK 0x0040 /* FMI B0S6 mask */
-#define FMI_B0S7_MASK 0x0080 /* FMI B0S7 mask */
-
-#define FMI_B1S0_MASK 0x0100 /* FMI B1S0 mask */
-#define FMI_B1S1_MASK 0x0200 /* FMI B1S1 mask */
-#define FMI_B1S2_MASK 0x0400 /* FMI B1S2 mask */
-#define FMI_B1S3_MASK 0x0800 /* FMI B1S3 mask */
-
-/* Timeout error */
-
-#define FMI_TIME_OUT_ERROR 0x00 /* Timeout error */
-#define FMI_NO_TIME_OUT_ERROR 0x01 /* No Timeout error */
-
-/* Module private variables --------------------------------------------------*/
-/* Exported macro ------------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-
-void FMI_BankRemapConfig(u8 FMI_BootBankSize, u8 FMI_NonBootBankSize, \
- u32 FMI_BootBankAddress, u32 FMI_NonBootBankAddress);
-void FMI_Config(u16 FMI_ReadWaitState, u32 FMI_WriteWaitState, u16 FMI_PWD,\
- u16 FMI_LVDEN, u16 FMI_FreqRange);
-void FMI_EraseSector(vu32 FMI_Sector);
-void FMI_EraseBank(vu32 FMI_Bank);
-void FMI_WriteHalfWord(u32 FMI_Address, u16 FMI_Data);
-void FMI_WriteOTPHalfWord(u8 FMI_OTPHWAddress, u16 FMI_OTPData);
-u32 FMI_ReadWord(u32 FMI_Address);
-u32 FMI_ReadOTPData(u8 FMI_OTPAddress);
-FlagStatus FMI_GetFlagStatus(u8 FMI_Flag, vu32 FMI_Bank);
-u16 FMI_GetReadWaitStateValue(void);
-u16 FMI_GetWriteWaitStateValue(void);
-void FMI_SuspendEnable(vu32 FMI_Bank);
-void FMI_ResumeEnable(vu32 FMI_Bank);
-void FMI_ClearFlag(vu32 FMI_Bank);
-void FMI_WriteProtectionCmd(vu32 FMI_Sector, FunctionalState FMI_NewState);
-FlagStatus FMI_GetWriteProtectionStatus(u32 FMI_Sector_Protection);
-u8 FMI_WaitForLastOperation(vu32 FMI_Bank);
-
-#endif /* __91x_FMI_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
-
diff --git a/uc_str912/prj_template91x/str91x_lib/include/91x_gpio.h b/uc_str912/prj_template91x/str91x_lib/include/91x_gpio.h
deleted file mode 100644
index f4e5658..0000000
--- a/uc_str912/prj_template91x/str91x_lib/include/91x_gpio.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_gpio.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* GPIO software library.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion ------------------------------------ */
-
-#ifndef _91x_GPIO_H
-#define _91x_GPIO_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_map.h"
-
-/* GPIO Init structure definition */
-typedef struct
-{
- u8 GPIO_Pin;
- u8 GPIO_Direction;
- u8 GPIO_Type;
- u8 GPIO_IPConnected;
- u16 GPIO_Alternate;
-}GPIO_InitTypeDef;
-
-/* Bit_SET and Bit_RESET enumeration */
-typedef enum
-{ Bit_RESET = 0,
- Bit_SET
-}BitAction;
-
-
-/* Exported constants --------------------------------------------------------*/
-#define GPIO_Pin_None 0x00
-#define GPIO_Pin_0 0x01
-#define GPIO_Pin_1 0x02
-#define GPIO_Pin_2 0x04
-#define GPIO_Pin_3 0x08
-#define GPIO_Pin_4 0x10
-#define GPIO_Pin_5 0x20
-#define GPIO_Pin_6 0x40
-#define GPIO_Pin_7 0x80
-#define GPIO_Pin_All 0xFF
-
-#define GPIO_PinInput 0x00
-#define GPIO_PinOutput 0x01
-
-#define GPIO_Type_PushPull 0x00
-#define GPIO_Type_OpenCollector 0x01
-
-#define GPIO_IPConnected_Disable 0x00
-#define GPIO_IPConnected_Enable 0x01
-
-#define GPIO_InputAlt1 0x00
-#define GPIO_OutputAlt1 0x01
-#define GPIO_OutputAlt2 0x02
-#define GPIO_OutputAlt3 0x03
-
-#define GPIO_ANAChannel0 0x01
-#define GPIO_ANAChannel1 0x02
-#define GPIO_ANAChannel2 0x04
-#define GPIO_ANAChannel3 0x08
-#define GPIO_ANAChannel4 0x10
-#define GPIO_ANAChannel5 0x20
-#define GPIO_ANAChannel6 0x40
-#define GPIO_ANAChannel7 0x80
-#define GPIO_ANAChannelALL 0xFF
-
-void GPIO_DeInit(GPIO_TypeDef* GPIOx);
-void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct);
-void GPIO_StructInit(GPIO_InitTypeDef* GPIO_InitStruct);
-u8 GPIO_ReadBit(GPIO_TypeDef* GPIOx, u8 GPIO_Pin);
-u8 GPIO_Read(GPIO_TypeDef* GPIOx);
-void GPIO_WriteBit(GPIO_TypeDef* GPIOx, u8 GPIO_Pin, BitAction BitVal);
-void GPIO_Write(GPIO_TypeDef* GPIOx, u8 PortVal);
-void GPIO_EMIConfig(FunctionalState NewState);
-void GPIO_ANAPinConfig(u8 GPIO_ANAChannel, FunctionalState NewState);
-
-#endif /* _91x_GPIO_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_template91x/str91x_lib/include/91x_i2c.h b/uc_str912/prj_template91x/str91x_lib/include/91x_i2c.h
deleted file mode 100644
index f4d0c66..0000000
--- a/uc_str912/prj_template91x/str91x_lib/include/91x_i2c.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_i2c.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* I2C software library.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion ------------------------------------ */
-#ifndef __91x_I2C_H
-#define __91x_I2C_H
-
-/* Includes ----------------------------------------------------------------- */
-#include "91x_map.h"
-
-/* Exported types ----------------------------------------------------------- */
-/* I2C Init structure definition */
-typedef struct
-{
- u32 I2C_CLKSpeed;
- u16 I2C_OwnAddress;
- u8 I2C_GeneralCall;
- u8 I2C_Ack;
-}I2C_InitTypeDef;
-
-/* Exported constants --------------------------------------------------------*/
-#define I2C_GeneralCall_Enable 0x10
-#define I2C_GeneralCall_Disable 0xEF
-/* Acknowledgement */
-#define I2C_Ack_Enable 0x04
-#define I2C_Ack_Disable 0xFB
-
-/* I2C Flags */
-#define I2C_FLAG_SB 0x0001
-#define I2C_FLAG_M_SL 0x0002
-#define I2C_FLAG_ADSL 0x0004
-#define I2C_FLAG_BTF 0x0008
-#define I2C_FLAG_BUSY 0x0010
-#define I2C_FLAG_TRA 0x0020
-#define I2C_FLAG_ADD10 0x0040
-#define I2C_FLAG_EVF 0x0080
-#define I2C_FLAG_GCAL 0x0100
-#define I2C_FLAG_BERR 0x0200
-#define I2C_FLAG_ARLO 0x0400
-#define I2C_FLAG_STOPF 0x0800
-#define I2C_FLAG_AF 0x1000
-#define I2C_FLAG_ENDAD 0x2000
-#define I2C_FLAG_ACK 0x4000
-
-/* I2C Events */
-#define I2C_EVENT_SLAVE_ADDRESS_MATCHED ( I2C_FLAG_EVF | I2C_FLAG_BUSY | I2C_FLAG_ADSL)
-#define I2C_EVENT_SLAVE_BYTE_RECEIVED ( I2C_FLAG_EVF | I2C_FLAG_BUSY | I2C_FLAG_BTF )
-#define I2C_EVENT_SLAVE_BYTE_TRANSMITTED ( I2C_FLAG_EVF | I2C_FLAG_BUSY | I2C_FLAG_BTF | I2C_FLAG_TRA )
-#define I2C_EVENT_MASTER_MODE_SELECT ( I2C_FLAG_EVF | I2C_FLAG_BUSY | I2C_FLAG_M_SL | I2C_FLAG_SB )
-#define I2C_EVENT_MASTER_MODE_SELECTED ( I2C_FLAG_EVF | I2C_FLAG_BUSY | I2C_FLAG_M_SL | I2C_FLAG_ENDAD )
-#define I2C_EVENT_MASTER_BYTE_RECEIVED ( I2C_FLAG_EVF | I2C_FLAG_BUSY | I2C_FLAG_M_SL | I2C_FLAG_BTF )
-#define I2C_EVENT_MASTER_BYTE_TRANSMITTED ( I2C_FLAG_EVF | I2C_FLAG_BUSY | I2C_FLAG_M_SL | I2C_FLAG_BTF | I2C_FLAG_TRA )
-#define I2C_EVENT_MASTER_MODE_ADDRESS10 ( I2C_FLAG_EVF | I2C_FLAG_BUSY | I2C_FLAG_M_SL |I2C_FLAG_ADD10 )
-#define I2C_EVENT_SLAVE_STOP_DETECTED I2C_FLAG_STOPF
-#define I2C_EVENT_SLAVE_ACK_FAILURE ( I2C_FLAG_EVF | I2C_FLAG_BUSY | I2C_FLAG_BTF | I2C_FLAG_TRA | I2C_FLAG_AF)
-
-#define I2C_BUS_ERROR_DETECTED I2C_FLAG_BERR
-#define I2C_ARBITRATION_LOST I2C_FLAG_ARLO
-#define I2C_SLAVE_GENERAL_CALL (I2C_FLAG_BUSY | I2C_FLAG_GCAL)
-
-/* Master/Receiver Mode */
-#define I2C_MODE_TRANSMITTER 0x00
-#define I2C_MODE_RECEIVER 0x01
-
-/* I2C Registers offset */
-#define I2C_CR 0x00
-#define I2C_SR1 0x04
-#define I2C_SR2 0x08
-#define I2C_CCR 0x0C
-#define I2C_OAR1 0x10
-#define I2C_OAR2 0x14
-#define I2C_DR 0x18
-#define I2C_ECCR 0x1C
-
-/* Exported macro ------------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-void I2C_DeInit(I2C_TypeDef* I2Cx);
-void I2C_Init(I2C_TypeDef* I2Cx, I2C_InitTypeDef* I2C_InitStruct);
-void I2C_StructInit(I2C_InitTypeDef* I2C_InitStruct);
-void I2C_Cmd(I2C_TypeDef* I2Cx, FunctionalState NewState);
-void I2C_GenerateStart(I2C_TypeDef* I2Cx, FunctionalState NewState);
-void I2C_GenerateSTOP(I2C_TypeDef* I2Cx, FunctionalState NewState);
-void I2C_AcknowledgeConfig(I2C_TypeDef *I2Cx, FunctionalState NewState);
-void I2C_ITConfig(I2C_TypeDef *I2Cx, FunctionalState NewState);
-void I2C_Send7bitAddress(I2C_TypeDef* I2Cx, u8 Address, u8 Direction);
-u8 I2C_ReadRegister(I2C_TypeDef* I2Cx, u8 I2C_Register);
-FlagStatus I2C_GetFlagStatus(I2C_TypeDef* I2Cx, u16 I2C_FLAG);
-void I2C_ClearFlag(I2C_TypeDef* I2Cx, u16 I2C_FLAG, ...);
-void I2C_SendData(I2C_TypeDef* I2Cx, u8 bData);
-u8 I2C_ReceiveData(I2C_TypeDef* I2Cx);
-u16 I2C_GetLastEvent(I2C_TypeDef* I2Cx);
-ErrorStatus I2C_CheckEvent(I2C_TypeDef* I2Cx,u16 I2C_Event);
-
-#endif /* __91x_I2C_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_template91x/str91x_lib/include/91x_it.h b/uc_str912/prj_template91x/str91x_lib/include/91x_it.h
deleted file mode 100644
index a8e35fc..0000000
--- a/uc_str912/prj_template91x/str91x_lib/include/91x_it.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_it.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains the headers of the interrupt
-* handlers'routines
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion ------------------------------------ */
-#ifndef _91x_IT_H
-#define _91x_IT_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_lib.h"
-
-/* Exported types ------------------------------------------------------------*/
-/* Exported constants --------------------------------------------------------*/
-/* Module private variables --------------------------------------------------*/
-/* Exported macro ------------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-void Undefined_Handler (void);
-void SWI_Handler (void);
-void Prefetch_Handler (void);
-void Abort_Handler (void);
-void FIQ_Handler (void);
-void WDG_IRQHandler (void);
-void SW_IRQHandler (void);
-void ARMRX_IRQHandler (void);
-void ARMTX_IRQHandler (void);
-void TIM0_IRQHandler (void);
-void TIM1_IRQHandler (void);
-void TIM2_IRQHandler (void);
-void TIM3_IRQHandler (void);
-void USBHP_IRQHandler (void);
-void USBLP_IRQHandler (void);
-void SCU_IRQHandler (void);
-void ENET_IRQHandler (void);
-void DMA_IRQHandler (void);
-void CAN_IRQHandler (void);
-void MC_IRQHandler (void);
-void ADC_IRQHandler (void);
-void UART0_IRQHandler (void);
-void UART1_IRQHandler (void);
-void UART2_IRQHandler (void);
-void I2C0_IRQHandler (void);
-void I2C1_IRQHandler (void);
-void SSP0_IRQHandler (void);
-void SSP1_IRQHandler (void);
-void LVD_IRQHandler (void);
-void RTC_IRQHandler (void);
-void WIU_IRQHandler (void);
-void EXTIT0_IRQHandler (void);
-void EXTIT1_IRQHandler (void);
-void EXTIT2_IRQHandler (void);
-void EXTIT3_IRQHandler (void);
-void USBWU_IRQHandler (void);
-void PFQBC_IRQHandler (void);
-
-#endif /* _91x_IT_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_template91x/str91x_lib/include/91x_lib.h b/uc_str912/prj_template91x/str91x_lib/include/91x_lib.h
deleted file mode 100644
index 3df7ced..0000000
--- a/uc_str912/prj_template91x/str91x_lib/include/91x_lib.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_lib.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : Used to include the peripherals header file in the
-* user application.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-#ifndef __91x_LIB_H
-#define __91x_LIB_H
-
-#include "91x_map.h"
-#include "91x_conf.h"
-
-#ifdef _AHBAPB
- #include "91x_ahbapb.h"
-#endif /* _AHBAPB */
-
-#ifdef _EMI
- #include "91x_emi.h"
-#endif /* _EMI */
-
-#ifdef _DMA
- #include "91x_dma.h"
-#endif /* _DMA */
-
-#ifdef _FMI
- #include "91x_fmi.h"
-#endif /* _FMI */
-
-#ifdef _VIC
- #include "91x_vic.h"
-#endif /* _VIC */
-
-#ifdef _WIU
- #include "91x_wiu.h"
-#endif /* _WIU */
-
-#ifdef _TIM
- #include "91x_tim.h"
-#endif /* _TIM */
-
-#ifdef _GPIO
- #include "91x_gpio.h"
-#endif /* _GPIO */
-
-#ifdef _RTC
- #include "91x_rtc.h"
-#endif /* _RTC */
-
-#ifdef _SCU
- #include "91x_scu.h"
-#endif /* _SCU */
-
-#ifdef _UART
- #include "91x_uart.h"
-#endif /* _UART */
-
-#ifdef _SSP
- #include "91x_ssp.h"
-#endif /* _SSP */
-
-#ifdef _CAN
- #include "91x_can.h"
-#endif /* _CAN */
-
-#ifdef _ADC
- #include "91x_adc.h"
-#endif /* _ADC */
-
-#ifdef _WDG
- #include "91x_wdg.h"
-#endif /* _WDG */
-
-#ifdef _I2C
- #include "91x_i2c.h"
-#endif /* _I2C */
-
-#ifdef _WIU
- #include "91x_wiu.h"
-#endif
-
-#ifdef _MC
- #include "91x_mc.h"
-#endif
-
-#ifdef _ENET
-#endif
-
-/* Exported types ------------------------------------------------------------*/
-/* Exported constants --------------------------------------------------------*/
-/* Module private variables --------------------------------------------------*/
-/* Exported macro ------------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-
- void libdebug( void );
-
-
-#endif /* __91x_LIB_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_template91x/str91x_lib/include/91x_map.h b/uc_str912/prj_template91x/str91x_lib/include/91x_map.h
deleted file mode 100644
index 5fe67cf..0000000
--- a/uc_str912/prj_template91x/str91x_lib/include/91x_map.h
+++ /dev/null
@@ -1,878 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_map.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : Peripherals registers definition and memory mapping.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion ------------------------------------ */
-#ifndef __91x_MAP_H
-#define __91x_MAP_H
-
-#ifndef EXT
- #define EXT extern
-#endif /* EXT */
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_conf.h"
-#include "91x_type.h"
-
-/******************************************************************************/
-/* IP registers structures */
-/******************************************************************************/
-
-/*------------------------------------ FMI -----------------------------------*/
-
-typedef struct
-{
- vu32 BBSR; /* Boot Bank Size Register */
- vu32 NBBSR; /* Non-Boot Bank Size Register */
- vu32 EMPTY1;
- vu32 BBADR; /* Boot Bank Base Address Register */
- vu32 NBBADR; /* Non-Boot Bank Base Address Register */
- vu32 EMPTY2;
- vu32 CR; /* Control Register */
- vu32 SR; /* Status Register */
- vu32 BCE5ADDR; /* BC Fifth Entry Target Address Register */
-} FMI_TypeDef;
-
-/*---------------------- Analog to Digital Convertor ------------------------*/
-
-typedef struct
-{
- vu16 CR; /* Control Register */
- vu16 EMPTY1;
- vu16 CCR; /* Channel Configuration Register */
- vu16 EMPTY2;
- vu16 HTR; /* Higher Threshold Register */
- vu16 EMPTY3;
- vu16 LTR; /* Lower Threshold Register */
- vu16 EMPTY4;
- vu16 CRR; /* Compare Result Register */
- vu16 EMPTY5;
- vu16 DR0; /* Data Register for Channel 0 */
- vu16 EMPTY6;
- vu16 DR1; /* Data Register for Channel 1 */
- vu16 EMPTY7;
- vu16 DR2; /* Data Register for Channel 2 */
- vu16 EMPTY8;
- vu16 DR3; /* Data Register for Channel 3 */
- vu16 EMPTY9;
- vu16 DR4; /* Data Register for Channel 4 */
- vu16 EMPTY10;
- vu16 DR5; /* Data Register for Channel 5 */
- vu16 EMPTY11;
- vu16 DR6; /* Data Register for Channel 6 */
- vu16 EMPTY12;
- vu16 DR7; /* Data Register for Channel 7 */
- vu16 EMPTY13;
- vu16 PRS; /* Prescaler Value Register */
- vu16 EMPTY14;
-} ADC_TypeDef;
-
-/*--------------------- AHB APB BRIDGE registers strcture --------------------*/
-
-typedef struct
-{
- vu32 BSR; /* Bridge Status Register */
- vu32 BCR; /* Bridge Configuration Register */
- vu32 PAER; /* Peripheral Address Error register */
-} AHBAPB_TypeDef;
-
-/*--------------- Controller Area Network Interface Register -----------------*/
-
-typedef struct
-{
- vu16 CRR; /* IFn Command request Register */
- vu16 EMPTY1;
- vu16 CMR; /* IFn Command Mask Register */
- vu16 EMPTY2;
- vu16 M1R; /* IFn Message Mask 1 Register */
- vu16 EMPTY3;
- vu16 M2R; /* IFn Message Mask 2 Register */
- vu16 EMPTY4;
- vu16 A1R; /* IFn Message Arbitration 1 Register */
- vu16 EMPTY5;
- vu16 A2R; /* IFn Message Arbitration 2 Register */
- vu16 EMPTY6;
- vu16 MCR; /* IFn Message Control Register */
- vu16 EMPTY7;
- vu16 DA1R; /* IFn DATA A 1 Register */
- vu16 EMPTY8;
- vu16 DA2R; /* IFn DATA A 2 Register */
- vu16 EMPTY9;
- vu16 DB1R; /* IFn DATA B 1 Register */
- vu16 EMPTY10;
- vu16 DB2R; /* IFn DATA B 2 Register */
- vu16 EMPTY11[27];
-} CAN_MsgObj_TypeDef;
-
-typedef struct
-{
- vu16 CR; /* Control Register */
- vu16 EMPTY1;
- vu16 SR; /* Status Register */
- vu16 EMPTY2;
- vu16 ERR; /* Error counter Register */
- vu16 EMPTY3;
- vu16 BTR; /* Bit Timing Register */
- vu16 EMPTY4;
- vu16 IDR; /* Interrupt Identifier Register */
- vu16 EMPTY5;
- vu16 TESTR; /* Test Register */
- vu16 EMPTY6;
- vu16 BRPR; /* BRP Extension Register */
- vu16 EMPTY7[3];
- CAN_MsgObj_TypeDef sMsgObj[2];
- vu16 EMPTY8[16];
- vu16 TXR1R; /* Transmission request 1 Register */
- vu16 EMPTY9;
- vu16 TXR2R; /* Transmission Request 2 Register */
- vu16 EMPTY10[13];
- vu16 ND1R; /* New Data 1 Register */
- vu16 EMPTY11;
- vu16 ND2R; /* New Data 2 Register */
- vu16 EMPTY12[13];
- vu16 IP1R; /* Interrupt Pending 1 Register */
- vu16 EMPTY13;
- vu16 IP2R; /* Interrupt Pending 2 Register */
- vu16 EMPTY14[13];
- vu16 MV1R; /* Message Valid 1 Register */
- vu16 EMPTY15;
- vu16 MV2R; /* Message VAlid 2 Register */
- vu16 EMPTY16;
-} CAN_TypeDef;
-
-/*----------------------- System Control Unit---------------------------------*/
-
-typedef struct
-{
- vu32 CLKCNTR; /* Clock Control Register */
- vu32 PLLCONF; /* PLL Configuration Register */
- vu32 SYSSTATUS; /* System Status Register */
- vu32 PWRMNG; /* Power Management Register */
- vu32 ITCMSK; /* Interrupt Mask Register */
- vu32 PCGRO; /* Peripheral Clock Gating Register 0 */
- vu32 PCGR1; /* Peripheral Clock Gating Register 1 */
- vu32 PRR0; /* Peripheral Reset Register 0 */
- vu32 PRR1; /* Peripheral Reset Register 1 */
- vu32 MGR0; /* Idle Mode Mask Gating Register 0 */
- vu32 MGR1; /* Idle Mode Mask Gating Register 1 */
- vu32 PECGR0; /* Peripheral Emulation Clock Gating Register 0 */
- vu32 PECGR1; /* Peripheral Emulation Clock Gating Register 1 */
- vu32 SCR0; /* System Configuration Register 0 */
- vu32 SCR1; /* System Configuration Register 1 */
- vu32 SCR2; /* System Configuration Register 2 */
- u32 EMPTY1;
- vu32 GPIOOUT[8]; /* GPIO Output Registers */
- vu32 GPIOIN[8]; /* GPIO Input Registers */
- vu32 GPIOTYPE[10]; /* GPIO Type Registers */
- vu32 GPIOEMI; /* GPIO EMI Selector Register */
- vu32 WKUPSEL; /* Wake-Up Selection Register */
- u32 EMPTY2[2];
- vu32 GPIOANA; /* GPIO Analag mode Register */
-} SCU_TypeDef;
-
-/*------------------------- DMA Channelx Registers ---------------------------*/
-
-typedef struct
-{
- vu32 SRC; /* Channelx Source Address Register */
- vu32 DES; /* Channelx Destination Address Register */
- vu32 LLI; /* Channelx Lincked List Item Register */
- vu32 CC; /* Channelx Contol Register */
- vu32 CCNF; /* Channelx Configuration Register */
-} DMA_Channel_TypeDef;
-
-/* x can be ,0,1,2,3,4,5,6 or 7. There are eight Channels AHB BUS Master */
-
-/*----------------------------- DMA Controller -------------------------------*/
-
-typedef struct
-{
- vu32 ISR; /* Interrupt Status Register */
- vu32 TCISR; /* Terminal Count Interrupt Status Register */
- vu32 TCICR; /* Terminal CountInterrupt Clear Register */
- vu32 EISR; /* Error Interrupt Status Register */
- vu32 EICR; /* Error Interrupt Clear Register */
- vu32 TCRISR; /* Terminal Count Raw Interrupt Status Register */
- vu32 ERISR; /* Raw Error Interrupt Status Register */
- vu32 ENCSR; /* Enabled Channel Status Register */
- vu32 SBRR; /* Software Burst Request Register */
- vu32 SSRR; /* Software Single Request Register */
- vu32 SLBRR; /* Software Last Burst Request Register */
- vu32 SLSRR; /* Software Last Single Request Register */
- vu32 CNFR; /* Configuration Register */
- vu32 SYNR; /* Syncronization Register */
-} DMA_TypeDef;
-
-/*--------------------------------- TIM Timer --------------------------------*/
-
-typedef struct
-{
- vu16 IC1R; /* Input Capture 1 Register */
- vu16 EMPTY1;
- vu16 IC2R; /* Input Capture 2 Register */
- vu16 EMPTY2;
- vu16 OC1R; /* Output Compare 1 Register */
- vu16 EMPTY3;
- vu16 OC2R; /* Output Compare 2 Register */
- vu16 EMPTY4;
- vu16 CNTR; /* Counter Register */
- vu16 EMPTY5;
- vu16 CR1; /* Control Register 1 */
- vu16 EMPTY6;
- vu16 CR2; /* Control Register 2 */
- vu16 EMPTY7;
- vu16 SR; /* Status Register */
- vu16 EMPTY8;
-} TIM_TypeDef;
-
-/*---------------------------- EMI Bankx Registers ---------------------------*/
-
-typedef struct
-{
- vu32 ICR; /* Bankx Idle Cycle Control Register */
- vu32 RCR; /* Bankx Read Wait State Control Register */
- vu32 WCR; /* Bankx Write Wait State Control Register */
- vu32 OECR; /* Bankx Output Enable Assertion Delay Control Register */
- vu32 WECR; /* Bankx Write Enable Assertion Delay Control Register */
- vu32 BCR; /* Bankx Control Register */
- } EMI_Bank_TypeDef;
-
-/*---------------------------- Ethernet Controller ---------------------------*/
-
-/* MAC Registers */
-typedef struct
-{
- vu32 MCR; /* ENET Control Register */
- vu32 MAH; /* ENET Address High Register */
- vu32 MAL; /* ENET Address Low Register */
- vu32 MCHA; /* Multicast Address High Register */
- vu32 MCLA; /* Multicast Address Low Register */
- vu32 MIIA; /* MII Address Register */
- vu32 MIID; /* MII Data Register */
- vu32 MCF; /* ENET Control Frame Register */
- vu32 VL1; /* VLAN1 Register */
- vu32 VL2; /* VLAN2 register */
- vu32 MTS; /* ENET Transmission Status Register */
- vu32 MRS; /* ENET Reception Status Register */
-} ENET_MAC_TypeDef;
-
-/* DMA Registers */
-typedef struct
-{
- vu32 SCR; /* DMA Status and Control Register */
- vu32 IER; /* DMA Interrupt Sources Enable Register */
- vu32 ISR; /* DMA Interrupt Status Register */
- vu32 CCR; /* Clock Control Relation : HCLK, PCLK and
- ENET_CLK phase relations */
- vu32 RXSTR; /* Rx DMA start Register */
- vu32 RXCR; /* Rx DMA Control Register */
- vu32 RXSAR; /* Rx DMA Base Address Register */
- vu32 RXNDAR; /* Rx DMA Next Descriptor Address Register */
- vu32 RXCAR; /* Rx DMA Current Address Register */
- vu32 RXCTCR; /* Rx DMA Current Transfer Count Register */
- vu32 RXTOR; /* Rx DMA FIFO Time Out Register */
- vu32 RXSR; /* Rx DMA FIFO Status Register */
- vu32 TXSTR; /* Tx DMA start Register */
- vu32 TXCR; /* Tx DMA Control Register */
- vu32 TXSAR; /* Tx DMA Base Address Register */
- vu32 TXNDAR; /* Tx DMA Next Descriptor Address Register */
- vu32 TXCAR; /* Tx DMA Current Address Register */
- vu32 TXTCR; /* Tx DMA Current Transfer Count Register */
- vu32 TXTOR; /* Tx DMA FIFO Time Out Register */
- vu32 TXSR; /* Tx DMA FIFO Status Register */
-} ENET_DMA_TypeDef;
-
-/*------------------------------------- GPIO ---------------------------------*/
-
-typedef struct
-{
- vu8 DR[1021]; /* Data Register */
- vu32 DDR; /* Data Direction Register */
-} GPIO_TypeDef;
-
-/*-------------------------------- I2C interface -----------------------------*/
-
-typedef struct
-{
- vu8 CR; /* Control Register */
- vu8 EMPTY1[3];
- vu8 SR1; /* Status Register 1 */
- vu8 EMPTY2[3];
- vu8 SR2; /* Status Register 2 */
- vu8 EMPTY3[3];
- vu8 CCR; /* Clock Control Register */
- vu8 EMPTY4[3];
- vu8 OAR1; /* Own Address Register 1 */
- vu8 EMPTY5[3];
- vu8 OAR2; /* Own Address Register 2 */
- vu8 EMPTY6[3];
- vu8 DR; /* Data Register */
- vu8 EMPTY7[3];
- vu8 ECCR; /* Extended Clock Control Register */
- vu8 EMPTY8[3];
-} I2C_TypeDef;
-
-/*------------------------------------- VIC ----------------------------------*/
-
-typedef struct
-{
- vu32 ISR; /* IRQ Status Register */
- vu32 FSR; /* FIQ Status Register */
- vu32 RINTSR; /* Raw Interrupt Status Register */
- vu32 INTSR; /* Interrupt Select Register */
- vu32 INTER; /* Interrupt Enable Register */
- vu32 INTECR; /* Interrupt Enable Clear Register */
- vu32 SWINTR; /* Software Interrupt Register */
- vu32 SWINTCR; /* Software Interrupt clear Register */
- vu32 PER; /* Protection Enable Register */
- vu32 EMPTY1[3];
- vu32 VAR; /* Vector Address Register */
- vu32 DVAR; /* Default Vector Address Register */
- vu32 EMPTY2[50];
- vu32 VAiR[16]; /* Vector Address 0-15 Register */
- vu32 EMPTY3[48];
- vu32 VCiR[16]; /* Vector Control 0-15 Register */
-} VIC_TypeDef;
-
-/*-------------------------------- Motor Control -----------------------------*/
-
-typedef struct
-{
- vu16 TCPT; /* Tacho Capture Register */
- vu16 EMPTY1;
- vu16 TCMP; /* Tacho Compare Register */
- vu16 EMPTY2;
- vu16 IPR; /* Input Pending Register */
- vu16 EMPTY3;
- vu16 TPRS; /* Tacho Prescaler Register */
- vu16 EMPTY4;
- vu16 CPRS; /* PWM Counter Prescaler Register */
- vu16 EMPTY5;
- vu16 REP; /* Repetition Counter Register */
- vu16 EMPTY6;
- vu16 CMPW; /* Compare Phase W Preload Register */
- vu16 EMPTY7;
- vu16 CMPV; /* Compare Phase V Preload Register */
- vu16 EMPTY8;
- vu16 CMPU; /* Compare Phase U Preload Register */
- vu16 EMPTY9;
- vu16 CMP0; /* Compare 0 Preload Register */
- vu16 EMPTY10;
- vu16 PCR0; /* Peripheral Control Register 0 */
- vu16 EMPTY11;
- vu16 PCR1; /* Peripheral Control Register 1 */
- vu16 EMPTY12;
- vu16 PCR2; /* Peripheral Control Register 2 */
- vu16 EMPTY13;
- vu16 PSR; /* Polarity Selection Register */
- vu16 EMPTY14;
- vu16 OPR; /* Output Peripheral Register */
- vu16 EMPTY15;
- vu16 IMR; /* Interrupt Mask Register */
- vu16 EMPTY16;
- vu16 DTG; /* Dead Time Generator Register */
- vu16 EMPTY17;
- vu16 ESC; /* Emergency Stop Clear Register */
- vu16 EMPTY18;
-}MC_TypeDef;
-
-/*------------------------------------- RTC ----------------------------------*/
-
-typedef struct
-{
- vu32 TR; /* Time Register */
- vu32 DTR; /* Date Register */
- vu32 ATR; /* Alarm time Register */
- vu32 CR; /* Control Register */
- vu32 SR; /* Status Register */
- vu32 MILR; /* Millisec Register */
-}RTC_TypeDef;
-
-/*------------------------------------- SSP ----------------------------------*/
-
-typedef struct
-{
- vu16 CR0; /* Control Register 1 */
- vu16 EMPTY1;
- vu16 CR1; /* Control Register 2 */
- vu16 EMPTY2;
- vu16 DR; /* Data Register */
- vu16 EMPTY3;
- vu16 SR; /* Status Register */
- vu16 EMPTY4;
- vu16 PR; /* Clock Prescale Register */
- vu16 EMPTY5;
- vu16 IMSCR; /* Interrupt Mask Set or Clear Register */
- vu16 EMPTY6;
- vu16 RISR; /* Raw Interrupt Status Register */
- vu16 EMPTY7;
- vu16 MISR; /* Masked Interrupt Status Register */
- vu16 EMPTY8;
- vu16 ICR; /* Interrupt Clear Register */
- vu16 EMPTY9;
- vu16 DMACR; /* DMA Control Register */
- vu16 EMPTY10;
-}SSP_TypeDef;
-
-/*------------------------------------ UART ----------------------------------*/
-
-typedef struct
-{
- vu16 DR; /* Data Register */
- vu16 EMPTY1;
- vu16 RSECR; /* Receive Status Register (read)/Error Clear Register (write) */
- vu16 EMPTY2[9];
- vu16 FR; /* Flag Register */
- vu16 EMPTY3[3];
- vu16 ILPR; /* IrDA Low-Power counter Register */
- vu16 EMPTY4;
- vu16 IBRD; /* Integer Baud Rate Divisor Register */
- vu16 EMPTY5;
- vu16 FBRD; /* Fractional Baud Rate Divisor Register */
- vu16 EMPTY6;
- vu16 LCR; /* Line Control Register, High byte */
- vu16 EMPTY7;
- vu16 CR; /* Control Register */
- vu16 EMPTY8;
- vu16 IFLS; /* Interrupt FIFO Level Select Register */
- vu16 EMPTY9;
- vu16 IMSC; /* Interrupt Mask Set/Clear Register */
- vu16 EMPTY10;
- vu16 RIS; /* Raw Interrupt Status Register */
- vu16 EMPTY11;
- vu16 MIS; /* Masked Interrupt Status Register */
- vu16 EMPTY12;
- vu16 ICR; /* Interrupt Clear Register */
- vu16 EMPTY13;
- vu16 DMACR; /* DMA Control Register */
- vu16 EMPTY14;
-}UART_TypeDef;
-
-/*------------------------------- Wake-up System -----------------------------*/
-
-typedef struct
-{
- vu32 CTRL; /* Control Register */
- vu32 MR; /* Mask Register */
- vu32 TR; /* Trigger Register */
- vu32 PR; /* Pending Register */
- vu32 INTR; /* Software Interrupt Register */
-} WIU_TypeDef;
-
-/*------------------------------- WatchDog Timer -----------------------------*/
-
-typedef struct
-{
- vu16 CR; /* Control Register */
- vu16 EMPTY1;
- vu16 PR; /* Presclar Register */
- vu16 EMPTY2;
- vu16 VR; /* Pre-load Value Register */
- vu16 EMPTY3;
- vu16 CNT; /* Counter Register */
- vu16 EMPTY4;
- vu16 SR; /* Status Register */
- vu16 EMPTY5;
- vu16 MR; /* Mask Register */
- vu16 EMPTY6;
- vu16 KR; /* Key Register */
- vu16 EMPTY7;
-} WDG_TypeDef;
-
-/*******************************************************************************
-* Memory Mapping of STR91x *
-*******************************************************************************/
-
-#define AHB_APB_BRDG0_U (0x58000000) /* AHB/APB Bridge 0 UnBuffered Space */
-#define AHB_APB_BRDG0_B (0x48000000) /* AHB/APB Bridge 0 Buffered Space */
-
-#define AHB_APB_BRDG1_U (0x5C000000) /* AHB/APB Bridge 1 UnBuffered Space */
-#define AHB_APB_BRDG1_B (0x4C000000) /* AHB/APB Bridge 1 Buffered Space */
-
-#define AHB_EMI_U (0x74000000) /* EMI UnBuffered Space */
-#define AHB_EMI_B (0x64000000) /* EMI Buffered Space */
-
-#define AHB_DMA_U (0x78000000) /* DMA UnBuffered Space */
-#define AHB_DMA_B (0x68000000) /* DMA Buffered Space */
-
-#define AHB_ENET_MAC_U (0x7C000400) /* ENET_MAC UnBuffered Space */
-#define AHB_ENET_MAC_B (0x6C000000) /* ENET_MAC Buffered Space */
-
-#define AHB_ENET_DMA_U (0x7C000000) /* ENET_DMA Unbuffered Space */
-#define AHB_ENET_DMA_B (0x6C000400) /* ENET_DMA Buffered Space */
-
-#define AHB_VIC1_U (0xFC000000) /* Secondary VIC1 UnBuffered Space */
-#define AHB_VIC0_U (0xFFFFF000) /* Primary VIC0 UnBuffered Space */
-
-#define AHB_FMI_U (0x54000000) /* FMI Unbuffered Space */
-#define AHB_FMI_B (0x44000000) /* FMI buffered Space */
-
-/*******************************************************************************
-* Addresses related to the VICs' peripherals *
-*******************************************************************************/
-
-#define VIC0_BASE (AHB_VIC0_U)
-#define VIC1_BASE (AHB_VIC1_U)
-
-/*******************************************************************************
-* Addresses related to the EMI banks *
-*******************************************************************************/
-
-#define AHB_EMIB3_OFST (0x00000040) /* Offset of EMI bank3 */
-#define AHB_EMIB2_OFST (0x00000020) /* Offset of EMI bank2 */
-#define AHB_EMIB1_OFST (0x00000000) /* Offset of EMI bank1 */
-#define AHB_EMIB0_OFST (0x000000E0) /* Offset of EMI bank0 */
-
-/*******************************************************************************
-* Addresses related to the DMA peripheral *
-*******************************************************************************/
-
-#define AHB_DMA_Channel0_OFST (0x00000100) /* Offset of Channel 0 */
-#define AHB_DMA_Channel1_OFST (0x00000120) /* Offset of Channel 1 */
-#define AHB_DMA_Channel2_OFST (0x00000140) /* Offset of Channel 2 */
-#define AHB_DMA_Channel3_OFST (0x00000160) /* Offset of Channel 3 */
-#define AHB_DMA_Channel4_OFST (0x00000180) /* Offset of Channel 4 */
-#define AHB_DMA_Channel5_OFST (0x000001A0) /* Offset of Channel 5 */
-#define AHB_DMA_Channel6_OFST (0x000001C0) /* Offset of Channel 6 */
-#define AHB_DMA_Channel7_OFST (0x000001E0) /* Offset of Channel 7 */
-
-/*******************************************************************************
-* Addresses related to the APB0 sub-system *
-*******************************************************************************/
-
-#define APB_WIU_OFST (0x00001000) /* Offset of WIU */
-#define APB_TIM0_OFST (0x00002000) /* Offset of TIM0 */
-#define APB_TIM1_OFST (0x00003000) /* Offset of TIM1 */
-#define APB_TIM2_OFST (0x00004000) /* Offset of TIM2 */
-#define APB_TIM3_OFST (0x00005000) /* Offset of TIM3 */
-#define APB_GPIO0_OFST (0x00006000) /* Offset of GPIO0 */
-#define APB_GPIO1_OFST (0x00007000) /* Offset of GPIO1 */
-#define APB_GPIO2_OFST (0x00008000) /* Offset of GPIO2 */
-#define APB_GPIO3_OFST (0x00009000) /* Offset of GPIO3 */
-#define APB_GPIO4_OFST (0x0000A000) /* Offset of GPIO4 */
-#define APB_GPIO5_OFST (0x0000B000) /* Offset of GPIO5 */
-#define APB_GPIO6_OFST (0x0000C000) /* Offset of GPIO6 */
-#define APB_GPIO7_OFST (0x0000D000) /* Offset of GPIO7 */
-#define APB_GPIO8_OFST (0x0000E000) /* Offset of GPIO8 */
-#define APB_GPIO9_OFST (0x0000F000) /* Offset of GPIO9 */
-
-/*******************************************************************************
-* Addresses related to the APB1 sub-system *
-*******************************************************************************/
-
-#define APB_RTC_OFST (0x00001000) /* Offset of RTC */
-#define APB_SCU_OFST (0x00002000) /* Offset of System Controller */
-#define APB_MC_OFST (0x00003000) /* Offset of Motor Control */
-#define APB_UART0_OFST (0x00004000) /* Offset of UART0 */
-#define APB_UART1_OFST (0x00005000) /* Offset of UART1 */
-#define APB_UART2_OFST (0x00006000) /* Offset of UART2 */
-#define APB_SSP0_OFST (0x00007000) /* Offset of SSP0 */
-#define APB_SSP1_OFST (0x00008000) /* Offset of SSPI */
-#define APB_CAN_OFST (0x00009000) /* Offset of CAN */
-#define APB_ADC_OFST (0x0000A000) /* Offset of ADC */
-#define APB_WDG_OFST (0x0000B000) /* Offset of WDG */
-#define APB_I2C0_OFST (0x0000C000) /* Offset of I2C0 */
-#define APB_I2C1_OFST (0x0000D000) /* Offset of I2C1 */
-
-/*----------------------------------------------------------------------------*/
-/*----------------------------- Unbuffered Mode ------------------------------*/
-/*----------------------------------------------------------------------------*/
-
-#ifndef LIBUFF
-
-/*******************************************************************************
-* AHBAPB peripheral Unbuffered Base Address *
-*******************************************************************************/
-
-#define AHBAPB0_BASE (AHB_APB_BRDG0_U)
-#define AHBAPB1_BASE (AHB_APB_BRDG1_U)
-
-/*******************************************************************************
-* ENET peripheral Unbuffered Base Address *
-*******************************************************************************/
-
-#define ENET_MAC_BASE (AHB_ENET_MAC_U)
-#define ENET_DMA_BASE (AHB_ENET_DMA_U)
-
-/*******************************************************************************
-* DMA peripheral Unbuffered Base Address *
-*******************************************************************************/
-
-#define DMA_BASE (AHB_DMA_U)
-
-/*******************************************************************************
-* EMI peripheral Unbuffered Base Address *
-*******************************************************************************/
-
-#define EMI_BASE (AHB_EMI_U)
-
-/*******************************************************************************
-* FMI peripheral Unbuffered Base Address *
-*******************************************************************************/
-
-#define FMI_BASE (AHB_FMI_U)
-
-
-#else /* LIBUFF */
-
-/*----------------------------------------------------------------------------*/
-/*------------------------------ Buffered Mode -------------------------------*/
-/*----------------------------------------------------------------------------*/
-
-/*******************************************************************************
-* AHBAPB peripheral Buffered Base Address *
-*******************************************************************************/
-
-#define AHBAPB0_BASE (AHB_APB_BRDG0_B)
-#define AHBAPB1_BASE (AHB_APB_BRDG1_B)
-
-/*******************************************************************************
-* ENET peripheral Unbuffered Base Address *
-*******************************************************************************/
-
-#define ENET_MAC_BASE (AHB_ENET_MAC_B)
-#define ENET_DMA_BASE (AHB_ENET_DMA_B)
-
-/*******************************************************************************
-* DMA peripheral Buffered Base Address *
-*******************************************************************************/
-
-#define DMA_BASE (AHB_DMA_B)
-
-/*******************************************************************************
-* EMI peripheral Buffered Base Address *
-*******************************************************************************/
-
-#define EMI_BASE (AHB_EMI_B)
-
-/*******************************************************************************
-* FMI peripheral Buffered Base Address *
-*******************************************************************************/
-
-#define FMI_BASE (AHB_FMI_B)
-
-#endif /* LIBUFF */
-
-/*******************************************************************************
-* DMA channels Base Address *
-*******************************************************************************/
-#define DMA_Channel0_BASE (DMA_BASE + AHB_DMA_Channel0_OFST)
-#define DMA_Channel1_BASE (DMA_BASE + AHB_DMA_Channel1_OFST)
-#define DMA_Channel2_BASE (DMA_BASE + AHB_DMA_Channel2_OFST)
-#define DMA_Channel3_BASE (DMA_BASE + AHB_DMA_Channel3_OFST)
-#define DMA_Channel4_BASE (DMA_BASE + AHB_DMA_Channel4_OFST)
-#define DMA_Channel5_BASE (DMA_BASE + AHB_DMA_Channel5_OFST)
-#define DMA_Channel6_BASE (DMA_BASE + AHB_DMA_Channel6_OFST)
-#define DMA_Channel7_BASE (DMA_BASE + AHB_DMA_Channel7_OFST)
-
-/*******************************************************************************
-* EMI Banks peripheral Base Address *
-*******************************************************************************/
-
-#define EMI_Bank0_BASE (EMI_BASE + AHB_EMIB0_OFST)
-#define EMI_Bank1_BASE (EMI_BASE + AHB_EMIB1_OFST)
-#define EMI_Bank2_BASE (EMI_BASE + AHB_EMIB2_OFST)
-#define EMI_Bank3_BASE (EMI_BASE + AHB_EMIB3_OFST)
-
-/*******************************************************************************
-* APB0 Peripherals' Base addresses *
-*******************************************************************************/
-
-#define WIU_BASE (AHBAPB0_BASE + APB_WIU_OFST)
-#define TIM0_BASE (AHBAPB0_BASE + APB_TIM0_OFST)
-#define TIM1_BASE (AHBAPB0_BASE + APB_TIM1_OFST)
-#define TIM2_BASE (AHBAPB0_BASE + APB_TIM2_OFST)
-#define TIM3_BASE (AHBAPB0_BASE + APB_TIM3_OFST)
-#define GPIO0_BASE (AHBAPB0_BASE + APB_GPIO0_OFST)
-#define GPIO1_BASE (AHBAPB0_BASE + APB_GPIO1_OFST)
-#define GPIO2_BASE (AHBAPB0_BASE + APB_GPIO2_OFST)
-#define GPIO3_BASE (AHBAPB0_BASE + APB_GPIO3_OFST)
-#define GPIO4_BASE (AHBAPB0_BASE + APB_GPIO4_OFST)
-#define GPIO5_BASE (AHBAPB0_BASE + APB_GPIO5_OFST)
-#define GPIO6_BASE (AHBAPB0_BASE + APB_GPIO6_OFST)
-#define GPIO7_BASE (AHBAPB0_BASE + APB_GPIO7_OFST)
-#define GPIO8_BASE (AHBAPB0_BASE + APB_GPIO8_OFST)
-#define GPIO9_BASE (AHBAPB0_BASE + APB_GPIO9_OFST)
-
-/*******************************************************************************
-* APB1 Peripherals' Base addresses *
-*******************************************************************************/
-
-#define RTC_BASE (AHBAPB1_BASE + APB_RTC_OFST)
-#define SCU_BASE (AHBAPB1_BASE + APB_SCU_OFST)
-#define MC_BASE (AHBAPB1_BASE + APB_MC_OFST)
-#define UART0_BASE (AHBAPB1_BASE + APB_UART0_OFST)
-#define UART1_BASE (AHBAPB1_BASE + APB_UART1_OFST)
-#define UART2_BASE (AHBAPB1_BASE + APB_UART2_OFST)
-#define SSP0_BASE (AHBAPB1_BASE + APB_SSP0_OFST)
-#define SSP1_BASE (AHBAPB1_BASE + APB_SSP1_OFST)
-#define CAN_BASE (AHBAPB1_BASE + APB_CAN_OFST)
-#define ADC_BASE (AHBAPB1_BASE + APB_ADC_OFST)
-#define WDG_BASE (AHBAPB1_BASE + APB_WDG_OFST)
-#define I2C0_BASE (AHBAPB1_BASE + APB_I2C0_OFST)
-#define I2C1_BASE (AHBAPB1_BASE + APB_I2C1_OFST)
-
-/*******************************************************************************
-* IPs' declaration *
-*******************************************************************************/
-
-/*------------------------------ Non Debug Mode ------------------------------*/
-
-#ifndef LIBDEBUG
-
-/*********************************** AHBAPB ***********************************/
-
-#define AHBAPB0 ((AHBAPB_TypeDef *)AHBAPB0_BASE)
-#define AHBAPB1 ((AHBAPB_TypeDef *)AHBAPB1_BASE)
-
-/************************************* EMI ************************************/
-
-#define EMI ((EMI_TypeDef *)EMI_BASE)
-
-/************************************* DMA ************************************/
-
-#define DMA ((DMA_TypeDef *)DMA_BASE)
-#define DMA_Channel0 ((DMA_Channel_TypeDef *)DMA_Channel0_BASE)
-#define DMA_Channel1 ((DMA_Channel_TypeDef *)DMA_Channel1_BASE)
-#define DMA_Channel2 ((DMA_Channel_TypeDef *)DMA_Channel2_BASE)
-#define DMA_Channel3 ((DMA_Channel_TypeDef *)DMA_Channel3_BASE)
-#define DMA_Channel4 ((DMA_Channel_TypeDef *)DMA_Channel4_BASE)
-#define DMA_Channel5 ((DMA_Channel_TypeDef *)DMA_Channel5_BASE)
-#define DMA_Channel6 ((DMA_Channel_TypeDef *)DMA_Channel6_BASE)
-#define DMA_Channel7 ((DMA_Channel_TypeDef *)DMA_Channel7_BASE)
-
-/************************************* EMI ************************************/
-
-#define EMI_Bank0 ((EMI_Bank_TypeDef *)EMI_Bank0_BASE)
-#define EMI_Bank1 ((EMI_Bank_TypeDef *)EMI_Bank1_BASE)
-#define EMI_Bank2 ((EMI_Bank_TypeDef *)EMI_Bank2_BASE)
-#define EMI_Bank3 ((EMI_Bank_TypeDef *)EMI_Bank3_BASE)
-
-/************************************* ENET_MAC ************************************/
-
-#define ENET_MAC ((ENET_MAC_TypeDef *)ENET_MAC_BASE)
-
-/************************************* ENET_DMA ************************************/
-
-#define ENET_DMA ((ENET_DMA_TypeDef *)ENET_DMA_BASE)
-
-/************************************* FMI ************************************/
-
-#define FMI ((FMI_TypeDef *)FMI_BASE)
-
-/************************************* VIC ************************************/
-
-#define VIC0 ((VIC_TypeDef *)VIC0_BASE)
-#define VIC1 ((VIC_TypeDef *)VIC1_BASE)
-
-/*******************************************************************************
-* APB0 Peripherals' *
-*******************************************************************************/
-#define WIU ((WIU_TypeDef *)WIU_BASE)
-#define TIM0 ((TIM_TypeDef *)TIM0_BASE)
-#define TIM1 ((TIM_TypeDef *)TIM1_BASE)
-#define TIM2 ((TIM_TypeDef *)TIM2_BASE)
-#define TIM3 ((TIM_TypeDef *)TIM3_BASE)
-#define GPIO0 ((GPIO_TypeDef *)GPIO0_BASE)
-#define GPIO1 ((GPIO_TypeDef *)GPIO1_BASE)
-#define GPIO2 ((GPIO_TypeDef *)GPIO2_BASE)
-#define GPIO3 ((GPIO_TypeDef *)GPIO3_BASE)
-#define GPIO4 ((GPIO_TypeDef *)GPIO4_BASE)
-#define GPIO5 ((GPIO_TypeDef *)GPIO5_BASE)
-#define GPIO6 ((GPIO_TypeDef *)GPIO6_BASE)
-#define GPIO7 ((GPIO_TypeDef *)GPIO7_BASE)
-#define GPIO8 ((GPIO_TypeDef *)GPIO8_BASE)
-#define GPIO9 ((GPIO_TypeDef *)GPIO9_BASE)
-/*******************************************************************************
-* APB1 Peripherals' *
-*******************************************************************************/
-#define RTC ((RTC_TypeDef *)RTC_BASE)
-#define SCU ((SCU_TypeDef *)SCU_BASE)
-#define MC ((MC_TypeDef *)MC_BASE)
-#define UART0 ((UART_TypeDef *)UART0_BASE)
-#define UART1 ((UART_TypeDef *)UART1_BASE)
-#define UART2 ((UART_TypeDef *)UART2_BASE)
-#define SSP0 ((SSP_TypeDef *)SSP0_BASE)
-#define SSP1 ((SSP_TypeDef *)SSP1_BASE)
-#define CAN ((CAN_TypeDef *)CAN_BASE)
-#define ADC ((ADC_TypeDef *)ADC_BASE)
-#define WDG ((WDG_TypeDef *)WDG_BASE)
-#define I2C0 ((I2C_TypeDef *)I2C0_BASE)
-#define I2C1 ((I2C_TypeDef *)I2C1_BASE)
-#define ENET_MAC ((ENET_MAC_TypeDef *)ENET_MAC_BASE)
-#define ENET_DMA ((ENET_DMA_TypeDef *)ENET_DMA_BASE)
-
-#else /* LIBDEBUG */
-
-/*-------------------------------- Debug Mode --------------------------------*/
-
-EXT AHBAPB_TypeDef *AHBAPB0;
-EXT AHBAPB_TypeDef *AHBAPB1;
-EXT DMA_TypeDef *DMA;
-EXT DMA_Channel_TypeDef *DMA_Channel0;
-EXT DMA_Channel_TypeDef *DMA_Channel1;
-EXT DMA_Channel_TypeDef *DMA_Channel2;
-EXT DMA_Channel_TypeDef *DMA_Channel3;
-EXT DMA_Channel_TypeDef *DMA_Channel4;
-EXT DMA_Channel_TypeDef *DMA_Channel5;
-EXT DMA_Channel_TypeDef *DMA_Channel6;
-EXT DMA_Channel_TypeDef *DMA_Channel7;
-EXT EMI_Bank_TypeDef *EMI_Bank0;
-EXT EMI_Bank_TypeDef *EMI_Bank1;
-EXT EMI_Bank_TypeDef *EMI_Bank2;
-EXT EMI_Bank_TypeDef *EMI_Bank3;
-EXT FMI_TypeDef *FMI;
-EXT VIC_TypeDef *VIC0;
-EXT VIC_TypeDef *VIC1;
-EXT WIU_TypeDef *WIU;
-EXT TIM_TypeDef *TIM0;
-EXT TIM_TypeDef *TIM1;
-EXT TIM_TypeDef *TIM2;
-EXT TIM_TypeDef *TIM3;
-EXT GPIO_TypeDef *GPIO0;
-EXT GPIO_TypeDef *GPIO1;
-EXT GPIO_TypeDef *GPIO2;
-EXT GPIO_TypeDef *GPIO3;
-EXT GPIO_TypeDef *GPIO4;
-EXT GPIO_TypeDef *GPIO5;
-EXT GPIO_TypeDef *GPIO6;
-EXT GPIO_TypeDef *GPIO7;
-EXT GPIO_TypeDef *GPIO8;
-EXT GPIO_TypeDef *GPIO9;
-EXT RTC_TypeDef *RTC;
-EXT SCU_TypeDef *SCU;
-EXT MC_TypeDef *MC;
-EXT UART_TypeDef *UART0;
-EXT UART_TypeDef *UART1;
-EXT UART_TypeDef *UART2;
-EXT SSP_TypeDef *SSP0;
-EXT SSP_TypeDef *SSP1;
-EXT CAN_TypeDef *CAN;
-EXT ADC_TypeDef *ADC;
-EXT WDG_TypeDef *WDG;
-EXT I2C_TypeDef *I2C0;
-EXT I2C_TypeDef *I2C1;
-EXT ENET_MAC_TypeDef *ENET_MAC;
-EXT ENET_DMA_TypeDef *ENET_DMA;
-
-
-#endif /* LIBDEBUG */
-
-#endif /* __91x_MAP_H*/
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
-
diff --git a/uc_str912/prj_template91x/str91x_lib/include/91x_mc.h b/uc_str912/prj_template91x/str91x_lib/include/91x_mc.h
deleted file mode 100644
index b33b7c3..0000000
--- a/uc_str912/prj_template91x/str91x_lib/include/91x_mc.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_mc.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* MC software library.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __91x_MC_H
-#define __91x_MC_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_map.h"
-
-/* Exported types ------------------------------------------------------------*/
-typedef struct
-{
- u16 MC_OperatingMode;
- u16 MC_TachoMode;
- u16 MC_TachoEvent_Mode;
- u8 MC_Prescaler;
- u8 MC_ForcedPWMState;
- u16 MC_TachoPrescaler;
- u16 MC_PWMMode;
- u16 MC_Complementary;
- u16 MC_Emergency;
- u16 MC_Period;
- u16 MC_TachoPeriod;
- u16 MC_Channel;
- u16 MC_PulseU;
- u16 MC_PulseV;
- u16 MC_PulseW;
- u16 MC_PolarityUL;
- u16 MC_PolarityUH;
- u16 MC_PolarityVL;
- u16 MC_PolarityVH;
- u16 MC_PolarityWL;
- u16 MC_PolarityWH;
- u16 MC_TachoPolarity;
- u16 MC_DeadTime;
- u8 MC_RepetitionCounter;
-} MC_InitTypeDef;
-
-typedef enum { DOWN = 0, UP = !DOWN} CountingStatus;
-
-/* Exported constants --------------------------------------------------------*/
-#define MC_Complementary_Enable 0x0001
-#define MC_Complementary_Disable 0x0002
-
-#define MC_HardwareOperating_Mode 0x0001
-#define MC_SoftwareOperating_Mode 0x0002
-
-#define MC_PWMClassical_Mode 0x0001
-#define MC_PWMZeroCentered_Mode 0x0002
-
-#define MC_Emergency_Enable 0x0001
-#define MC_Emergency_Disable 0x0002
-
-#define MC_Polarity_Inverted 0x0001
-#define MC_Polarity_NonInverted 0x0002
-
-#define MC_TachoOneShot_Mode 0x0001
-#define MC_TachoContinuous_Mode 0x0002
-
-#define MC_TachoEventEdge_None 0x0000
-#define MC_TachoEventEdge_Falling 0x0001
-#define MC_TachoEventEdge_Rising 0x0002
-#define MC_TachoEventEdge_RisingFalling 0x0003
-
-#define MC_Channel_U 0x0001
-#define MC_Channel_V 0x0002
-#define MC_Channel_W 0x0003
-#define MC_Channel_ALL 0x0004
-
-
-#define MC_TachoEvent_Hardware_Mode 0x0001
-#define MC_TachoEvent_Software_Mode 0x0002
-
-#define MC_IT_CMPW 0x0001
-#define MC_IT_CMPV 0x0002
-#define MC_IT_CMPU 0x0004
-#define MC_IT_ZPC 0x0008
-#define MC_IT_ADT 0x0010
-#define MC_IT_OTC 0x0020
-#define MC_IT_CPT 0x0040
-#define MC_IT_CM0 0x0080
-
-#define MC_FLAG_CMPW 0x0001
-#define MC_FLAG_CMPV 0x0002
-#define MC_FLAG_CMPU 0x0004
-#define MC_FLAG_ZPC 0x0008
-#define MC_FLAG_ADT 0x0010
-#define MC_FLAG_OTC 0x0020
-#define MC_FLAG_CPT 0x0040
-#define MC_FLAG_CM0 0x0080
-#define MC_FLAG_EST 0x0100
-/* Exported macro ------------------------------------------------------------*/
-/* Exported functions --------------------------------------------------------*/
-void MC_Init(MC_InitTypeDef* MC_InitStruct);
-void MC_DeInit(void);
-void MC_StructInit(MC_InitTypeDef* MC_InitStruct);
-void MC_Cmd(FunctionalState NewState);
-void MC_CtrlPWMOutputs(FunctionalState Newstate);
-void MC_ITConfig(u16 MC_IT, FunctionalState NewState);
-void MC_SetPrescaler(u8 Prescaler);
-void MC_SetPeriod(u16 MC_Period);
-void MC_SetPulseU(u16 MC_PulseU);
-void MC_SetPulseV(u16 MC_PulseV);
-void MC_SetPulseW(u16 MC_PulseW);
-void MC_SetTachoCompare(u8 MC_Compare);
-void MC_PWMModeConfig(u16 MC_PWMMode);
-void MC_SetDeadTime(u16 MC_DeadTime);
-void MC_EmergencyCmd(FunctionalState NewState);
-void MC_EmergencyClear(void);
-u16 MC_GetPeriod(void);
-u16 MC_GetPulseU(void);
-u16 MC_GetPulseV(void);
-u16 MC_GetPulseW(void);
-u16 MC_GetTachoCapture(void);
-void MC_ClearOnTachoCapture(FunctionalState NewState);
-void MC_ForceDataTransfer(u8 MC_ForcedData);
-void MC_SoftwarePreloadConfig(void);
-void MC_SoftwareTachoCapture(void);
-CountingStatus MC_GetCountingStatus(void);
-FlagStatus MC_GetFlagStatus(u16 MC_FLAG);
-void MC_ClearFlag(u16 MC_FLAG);
-ITStatus MC_GetITStatus(u16 MC_IT);
-void MC_ClearITPendingBit(u16 MC_IT);
-
-#endif /* __91x_MC_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
-
diff --git a/uc_str912/prj_template91x/str91x_lib/include/91x_rtc.h b/uc_str912/prj_template91x/str91x_lib/include/91x_rtc.h
deleted file mode 100644
index 25a2805..0000000
--- a/uc_str912/prj_template91x/str91x_lib/include/91x_rtc.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_rtc.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides the RTC library software functions
-* prototypes & definitions
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __91x_RTC_H
-#define __91x_RTC_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_map.h"
-
-/* Private typedef -----------------------------------------------------------*/
-typedef struct
-{
- u8 century;
- u8 year;
- u8 month;
- u8 day;
- u8 weekday;
-}RTC_DATE;
-
-typedef struct
-{
- u8 hours;
- u8 minutes;
- u8 seconds;
- u16 milliseconds;
-}RTC_TIME;
-
-typedef struct
-{
- u8 day;
- u8 hours;
- u8 minutes;
- u8 seconds;
-}RTC_ALARM;
-
-/* Exported constants --------------------------------------------------------*/
-
-#define BINARY 0
-#define BCD 1
-
-/*TamperMode*/
-#define RTC_TamperMode_Edge 0xFFFFFFEF
-#define RTC_TamperMode_Level 0x10
-
-/*TamperPol*/
-#define RTC_TamperPol_High 0x4
-#define RTC_TamperPol_Low 0xFFFFFFFB
-
-/*PeriodicClock*/
-#define RTC_Per_2Hz 0x10000
-#define RTC_Per_16Hz 0x20000
-#define RTC_Per_128Hz 0x40000
-#define RTC_Per_1024Hz 0x80000
-#define RTC_Per_DISABLE 0x0
-
-/*RTC_IT*/
-#define RTC_IT_Per 0x200000
-#define RTC_IT_Alarm 0x800000
-#define RTC_IT_Tamper 0x400000
-
-/*RTC_FLAG*/
-#define RTC_FLAG_Per 0x80000000
-#define RTC_FLAG_Alarm 0x40000000
-#define RTC_FLAG_Tamper 0x10000000
-
-
-/* Module private variables --------------------------------------------------*/
-/* Exported macro ------------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-void RTC_DeInit(void);
-void RTC_SetDate(RTC_DATE Date);
-void RTC_SetTime(RTC_TIME Time);
-void RTC_SetAlarm(RTC_ALARM Alarm);
-void RTC_GetDate(u8 Format, RTC_DATE * Date);
-void RTC_GetTime(u8 Format, RTC_TIME * Time);
-void RTC_GetAlarm(u8 Format, RTC_ALARM * Alarm);
-void RTC_TamperConfig(u32 TamperMode, u32 TamperPol);
-void RTC_TamperCmd(FunctionalState NewState);
-void RTC_AlarmCmd(FunctionalState NewState);
-void RTC_CalibClockCmd(FunctionalState NewState);
-void RTC_SRAMBattPowerCmd(FunctionalState NewState);
-void RTC_PeriodicIntConfig(u32 PeriodicClock);
-void RTC_ITConfig(u32 RTC_IT, FunctionalState NewState);
-FlagStatus RTC_GetFlagStatus(u32 RTC_FLAG);
-void RTC_ClearFlag(u32 RTC_FLAG);
-#endif /*__91x_RTC_H*/
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
-
-
-
diff --git a/uc_str912/prj_template91x/str91x_lib/include/91x_scu.h b/uc_str912/prj_template91x/str91x_lib/include/91x_scu.h
deleted file mode 100644
index 22d9260..0000000
--- a/uc_str912/prj_template91x/str91x_lib/include/91x_scu.h
+++ /dev/null
@@ -1,198 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_scu.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides the SCU library software functions
-* prototypes & definitions
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __91x_SCU_H
-#define __91x_SCU_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_map.h"
-
-/* Exported constants --------------------------------------------------------*/
-
-/*MCLK_Source*/
-#define SCU_MCLK_PLL 0x0
-#define SCU_MCLK_RTC 0x1
-#define SCU_MCLK_OSC 0x2
-
-/*RCLK_Divisor*/
-#define SCU_RCLK_Div1 0xFFFFFFE3
-#define SCU_RCLK_Div2 0x4
-#define SCU_RCLK_Div4 0x8
-#define SCU_RCLK_Div8 0xC
-#define SCU_RCLK_Div16 0x10
-#define SCU_RCLK_Div1024 0x14
-
-/*HCLK_Divisor*/
-#define SCU_HCLK_Div1 0xFFFFFF9F
-#define SCU_HCLK_Div2 0x20
-#define SCU_HCLK_Div4 0x40
-
-/*PCLK_Divisor*/
-#define SCU_PCLK_Div1 0xFFFFFE7F
-#define SCU_PCLK_Div2 0x80
-#define SCU_PCLK_Div4 0x100
-#define SCU_PCLK_Div8 0x180
-
-/*FMICLK_Divisor*/
-#define SCU_FMICLK_Div1 0xFFFEFFFF
-#define SCU_FMICLK_Div2 0x10000
-
-/*BRCLK_Divisor*/
-#define SCU_BRCLK_Div1 0xFFFFFDFF
-#define SCU_BRCLK_Div2 0x200
-
-/*TIMCLK_Source*/
-#define SCU_TIMCLK_EXT 0x1
-#define SCU_TIMCLK_INT 0x0
-
-/*TIMx*/
-#define SCU_TIM01 0x0
-#define SCU_TIM23 0x1
-
-
-/*USBCLK_Source*/
-#define SCU_USBCLK_MCLK 0xFFFFF3FF
-#define SCU_USBCLK_MCLK2 0x400
-#define SCU_USBCLK_EXT 0x800
-
-/*SCU_EMIBCLK*/
-#define SCU_EMIBCLK_Div1 0xFFF9FFFF
-#define SCU_EMIBCLK_Div2 0x20000
-
-/*SCU_EMIMODE*/
-#define SCU_EMI_MUX 0xFFFFFFBF
-#define SCU_EMI_DEMUX 0x40
-
-/*SCU_EMIALE_LEN*/
-#define SCU_EMIALE_LEN1 0xFFFFFEFF
-#define SCU_EMIALE_LEN2 0x100
-
-/*SCU_EMIALE_POL*/
-#define SCU_EMIALE_POLLow 0xFFFFFF7F
-#define SCU_EMIALE_POLHigh 0x80
-
-/*UART_IrDA_Mode*/
-#define SCU_UARTMode_IrDA 0x1
-#define SCU_UARTMode_UART 0x0
-
-/*APBPeriph*/
-#define __TIM01 0x1
-#define __TIM23 0x2
-#define __MC 0x4
-#define __UART0 0x8
-#define __UART1 0x10
-#define __UART2 0x20
-#define __I2C0 0x40
-#define __I2C1 0x80
-#define __SSP0 0x100
-#define __SSP1 0x200
-#define __CAN 0x400
-#define __ADC 0x800
-#define __WDG 0x1000
-#define __WIU 0x2000
-#define __GPIO0 0x4000
-#define __GPIO1 0x8000
-#define __GPIO2 0x10000
-#define __GPIO3 0x20000
-#define __GPIO4 0x40000
-#define __GPIO5 0x80000
-#define __GPIO6 0x100000
-#define __GPIO7 0x200000
-#define __GPIO8 0x400000
-#define __GPIO9 0x800000
-#define __RTC 0x1000000
-
-/*AHBPeriph*/
-#define __FMI 0x1
-#define __FPQBC 0x2
-#define __SRAM 0x8
-#define __SRAM_ARBITER 0x10
-#define __VIC 0x20
-#define __EMI 0x40
-#define __EMI_MEM_CLK 0x80
-#define __DMA 0x100
-#define __USB 0x200
-#define __USB48M 0x400
-#define __ENET 0x800
-#define __PFQBC_AHB 0x1000
-
-/*SCU_IT*/
-#define SCU_IT_LVD_RST 0x10
-#define SCU_IT_SRAM_ERROR 0x8
-#define SCU_IT_ACK_PFQBC 0x4
-#define SCU_IT_LOCK_LOST 0x2
-#define SCU_IT_LOCK 0x1
-
-/*SCU_FLAG*/
-#define SCU_FLAG_SRAM_ERROR 0x20
-#define SCU_FLAG_ACK_PFQBC 0x10
-#define SCU_FLAG_LVD_RESET 0x8
-#define SCU_FLAG_WDG_RST 0x4
-#define SCU_FLAG_LOCK_LOST 0x2
-#define SCU_FLAG_LOCK 0x1
-
-
-/* Module private variables --------------------------------------------------*/
-/* Exported macro ------------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-ErrorStatus SCU_MCLKSourceConfig(u32 MCLK_Source);
-ErrorStatus SCU_PLLFactorsConfig(u8 PLLN, u8 PLLM, u8 PLLP);
-ErrorStatus SCU_PLLCmd(FunctionalState NewState);
-void SCU_RCLKDivisorConfig(u32 RCLK_Divisor);
-void SCU_HCLKDivisorConfig(u32 HCLK_Divisor);
-void SCU_PCLKDivisorConfig(u32 PCLK_Divisor);
-void SCU_APBPeriphClockConfig(u32 APBPeriph, FunctionalState NewState);
-void SCU_AHBPeriphClockConfig(u32 AHBPeriph, FunctionalState NewState);
-void SCU_APBPeriphReset(u32 APBPeriph, FunctionalState NewState);
-void SCU_AHBPeriphReset(u32 AHBPeriph, FunctionalState NewState);
-void SCU_APBPeriphIdleConfig(u32 APBPeriph, FunctionalState NewState);
-void SCU_AHBPeriphIdleConfig(u32 AHBPeriph, FunctionalState NewState);
-void SCU_APBPeriphDebugConfig(u32 APBPeriph, FunctionalState NewState);
-void SCU_AHBPeriphDebugConfig(u32 AHBPeriph, FunctionalState NewState);
-void SCU_BRCLKDivisorConfig(u32 BRCLK_Divisor);
-void SCU_TIMCLKSourceConfig(u8 TIMx, u32 TIMCLK_Source);
-void SCU_TIMPresConfig(u8 TIMx, u16 Prescaler);
-void SCU_USBCLKConfig(u32 USBCLK_Source);
-void SCU_PHYCLKConfig(FunctionalState NewState);
-void SCU_FMICLKDivisorConfig(u32 FMICLK_Divisor);
-void SCU_EMIBCLKDivisorConfig(u32 SCU_EMIBCLK);
-void SCU_EMIModeConfig(u32 SCU_EMIMODE);
-void SCU_EMIALEConfig(u32 SCU_EMIALE_LEN, u32 SCU_EMIALE_POL);
-void SCU_ITConfig(u32 SCU_IT, FunctionalState NewState);
-FlagStatus SCU_GetFlagStatus(u32 SCU_Flag);
-void SCU_ClearFlag(u32 SCU_Flag);
-u32 SCU_GetPLLFreqValue(void);
-u32 SCU_GetMCLKFreqValue(void);
-u32 SCU_GetRCLKFreqValue(void);
-u32 SCU_GetHCLKFreqValue(void);
-u32 SCU_GetPCLKFreqValue(void);
-void SCU_WakeUpLineConfig(u8 EXTint);
-void SCU_SpecIntRunModeConfig(FunctionalState NewState);
-void SCU_EnterIdleMode(void);
-void SCU_EnterSleepMode(void);
-void SCU_UARTIrDASelect(UART_TypeDef * UARTx, u8 UART_IrDA_Mode);
-void SCU_PFQBCCmd(FunctionalState NewState);
-
-extern const u32 _Main_Crystal;
-
-#endif /*__91x_SCU_H*/
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_template91x/str91x_lib/include/91x_ssp.h b/uc_str912/prj_template91x/str91x_lib/include/91x_ssp.h
deleted file mode 100644
index e356d4f..0000000
--- a/uc_str912/prj_template91x/str91x_lib/include/91x_ssp.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_ssp.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* SSP software library.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __91x_SSP_H
-#define __91x_SSP_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_map.h"
-
-/* Exported types ------------------------------------------------------------*/
-/* SSP Init structure definition */
-typedef struct
-{
- u16 SSP_FrameFormat ;
- u16 SSP_Mode ;
- u16 SSP_CPOL ;
- u16 SSP_CPHA ;
- u16 SSP_DataSize ;
- u16 SSP_SlaveOutput ;
- u8 SSP_ClockRate ;
- u8 SSP_ClockPrescaler ;
-}SSP_InitTypeDef;
-
-/* Exported constants --------------------------------------------------------*/
-/* SSP Frame Format Select */
-#define SSP_FrameFormat_TI 0x0010
-#define SSP_FrameFormat_Motorola 0xFFCF
-#define SSP_FrameFormat_Microwire 0x0020
-
-/* SSP Master/Slave Select */
-#define SSP_Mode_Master 0xFFFB
-#define SSP_Mode_Slave 0x0004
-
-/* SSP Clock Polarity */
-#define SSP_CPOL_Low 0xFFBF
-#define SSP_CPOL_High 0x0040
-
-/* SSP Clock Phase */
-#define SSP_CPHA_1Edge 0xFF7F
-#define SSP_CPHA_2Edge 0x0080
-
-/* SSP Data Size */
-#define SSP_DataSize_16b 0x000F
-#define SSP_DataSize_15b 0x000E
-#define SSP_DataSize_14b 0x000D
-#define SSP_DataSize_13b 0x000C
-#define SSP_DataSize_12b 0x000B
-#define SSP_DataSize_11b 0x000A
-#define SSP_DataSize_10b 0x0009
-#define SSP_DataSize_9b 0x0008
-#define SSP_DataSize_8b 0x0007
-#define SSP_DataSize_7b 0x0006
-#define SSP_DataSize_6b 0x0005
-#define SSP_DataSize_5b 0x0004
-#define SSP_DataSize_4b 0x0003
-
-/* SSP Slave output config */
-#define SSP_SlaveOutput_Enable 0xFFF7
-#define SSP_SlaveOutput_Disable 0x0008
-
-/* SSP Interrupts */
-#define SSP_IT_TxFifo 0x0008
-#define SSP_IT_RxFifo 0x0004
-#define SSP_IT_RxTimeOut 0x0002
-#define SSP_IT_RxOverrun 0x0001
-
-/* SSP Flags */
-#define SSP_FLAG_Busy 0x0024
-#define SSP_FLAG_RxFifoFull 0x0023
-#define SSP_FLAG_RxFifoNotEmpty 0x0022
-#define SSP_FLAG_TxFifoNotFull 0x0021
-#define SSP_FLAG_TxFifoEmpty 0x0020
-#define SSP_FLAG_TxFifo 0x0043
-#define SSP_FLAG_RxFifo 0x0042
-#define SSP_FLAG_RxTimeOut 0x0041
-#define SSP_FLAG_RxOverrun 0x0040
-
-/* SSP DMA Requests */
-#define SSP_DMA_Transmit 0x0002
-#define SSP_DMA_Receive 0x0001
-
-/* Exported macro ------------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-
-void SSP_DeInit(SSP_TypeDef* SSPx);
-void SSP_Init(SSP_TypeDef* SSPx, SSP_InitTypeDef* SSP_InitStruct);
-void SSP_StructInit(SSP_InitTypeDef* SSP_InitStruct);
-void SSP_Cmd(SSP_TypeDef* SSPx, FunctionalState NewState);
-void SSP_ITConfig(SSP_TypeDef* SSPx, u16 SSP_IT, FunctionalState NewState);
-void SSP_DMACmd(SSP_TypeDef* SSPx, u16 SSP_DMATransfert, FunctionalState NewState);
-void SSP_SendData(SSP_TypeDef* SSPx, u16 Data);
-u16 SSP_ReceiveData(SSP_TypeDef* SSPx);
-void SSP_LoopBackConfig(SSP_TypeDef* SSPx, FunctionalState NewState);
-FlagStatus SSP_GetFlagStatus(SSP_TypeDef* SSPx, u16 SSP_FLAG);
-void SSP_ClearFlag(SSP_TypeDef* SSPx, u16 SSP_FLAG);
-ITStatus SSP_GetITStatus(SSP_TypeDef* SSPx, u16 SSP_IT);
-void SSP_ClearITPendingBit(SSP_TypeDef* SSPx, u16 SSP_IT);
-
-#endif /* __91x_SSP_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
-
diff --git a/uc_str912/prj_template91x/str91x_lib/include/91x_tim.h b/uc_str912/prj_template91x/str91x_lib/include/91x_tim.h
deleted file mode 100644
index b587c27..0000000
--- a/uc_str912/prj_template91x/str91x_lib/include/91x_tim.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_tim.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* TIM software library.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __91x_TIM_H
-#define __91x_TIM_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_map.h"
-#include "91x_scu.h"
-
-/* Exported types ----------------------------------------------------------- */
-
-/* TIM Init structure define */
-typedef struct
-{
- u16 TIM_Mode; /* Timer mode */
- u16 TIM_OC1_Modes; /* Output Compare 1 Mode: Timing or Wave */
- u16 TIM_OC2_Modes; /* Output Compare 2 Mode: Timing or Wave */
- u16 TIM_Clock_Source; /* Timer Clock source APB/SCU/EXTERNAL */
- u16 TIM_Clock_Edge; /* Timer Clock Edge: Rising or Falling Edge */
- u16 TIM_OPM_INPUT_Edge; /* Timer Input Capture 1 Edge used in OPM Mode */
- u16 TIM_ICAP1_Edge; /* Timer Input Capture 1 Edge used in ICAP1 Mode */
- u16 TIM_ICAP2_Edge; /* Timer Input Capture 2 Edge used in ICAP2 Mode */
- u8 TIM_Prescaler; /* Timer Prescaler factor */
- u16 TIM_Pulse_Level_1; /* Level applied on the Output Compare Pin 1 */
- u16 TIM_Pulse_Level_2; /* Level applied on the Output Compare Pin 2 */
- u16 TIM_Period_Level; /* Level applied during the Period of a PWM Mode */
- u16 TIM_Pulse_Length_1; /* Pulse 1 Length used in Output Compare 1 Mode */
- u16 TIM_Pulse_Length_2; /* Pulse 2 Length used in Output Compare 2 Mode */
- u16 TIM_Full_Period; /* Period Length used in PWM Mode */
-} TIM_InitTypeDef;
-
-typedef enum
-{
- TIM_START,
- TIM_STOP,
- TIM_CLEAR
-} TIM_CounterOperations;
-
-/* Exported constants --------------------------------------------------------*/
-
-/* TIM MODE */
-#define TIM_PWMI 0x4000 /* PWM INPUT Mode */
-#define TIM_OCM_CHANNEL_1 0x0040 /* OUTPUT COMPARE CHANNEL 1 Mode */
-#define TIM_OCM_CHANNEL_2 0x0080 /* OUTPUT COMPARE CHANNEL 2 Mode */
-#define TIM_OCM_CHANNEL_12 0x00C0 /* OUTPUT COMPARE CHANNEL 1 & 2 Mode */
-#define TIM_PWM 0x0010 /* PWM Mode */
-#define TIM_OPM 0x0020 /* ONE PULSE Mode */
-#define TIM_ICAP_CHANNEL_1 0x0400 /* INPUT CAPTURE 1 Mode */
-#define TIM_ICAP_CHANNEL_2 0x0500 /* INPUT CAPTURE 2 Mode */
-#define TIM_ICAP_CHANNEL_12 0x0600 /* INPUT CAPTURE 1 & 2 Mode */
-
-/* TIM OUTPUT COMPARE MODE */
-#define TIM_WAVE 0x0001
-#define TIM_TIMING 0x0002
-
-/* TIM CLOCK SOURCE */
-#define TIM_CLK_APB 0xFFFE
-#define TIM_CLK_EXTERNAL 0x0001
-#define TIM_CLK_SCU 0x0001
-
-/* TIM CLOCK EDGE */
-#define TIM_CLK_EDGE_FALLING 0xFFFD
-#define TIM_CLK_EDGE_RISING 0x0002
-
-/* TIM OPM INPUT EDGE */
-#define TIM_OPM_EDGE_FALLING 0xFFFB
-#define TIM_OPM_EDGE_RISING 0x0004
-
-/* TIM ICAPA INPUT EDGE */
-#define TIM_ICAP1_EDGE_FALLING 0xFFFB
-#define TIM_ICAP1_EDGE_RISING 0x0004
-
-/* TIM ICAPB INPUT EDGE */
-#define TIM_ICAP2_EDGE_FALLING 0xFFF7
-#define TIM_ICAP2_EDGE_RISING 0x0008
-
-/* TIM OUTPUT LEVEL */
-#define TIM_HIGH 0x0200
-#define TIM_LOW 0x0300
-
-/* TIM OUTPUT EDGE */
-#define TIM_OUTPUT_EDGE_RISING 0x8000
-#define TIM_OUTPUT_EDGE_FALLING 0x0800
-
-/* TIM channels */
-#define TIM_PWM_OC1_Channel 0x1 /* PWM/Output Compare 1 Channel */
-#define TIM_OC2_Channel 0x2 /* Output Compare 2 Channel */
-
-/* TIM DMA SOURCE */
-#define TIM_DMA_IC1 0x0000 /* Input Capture Channel 1 DMA Source */
-#define TIM_DMA_OC1 0x1000 /* OUTPUT Compare Channel 1 DMA Source */
-#define TIM_DMA_IC2 0x2000 /* Input Capture Channel 2 DMA Source */
-#define TIM_DMA_OC2 0x3000 /* OUTPUT Compare Channel 2 DMA Source */
-
-/* TIM DMA ENABLE or DISABLE */
-#define TIM_DMA_ENABLE 0x0400 /* DMA Enable */
-#define TIM_DMA_DISABLE 0xFBFF /* DMA Disable */
-
-/* TIM Interruption Sources*/
-#define TIM_IT_IC1 0x8000 /* Input Capture Channel 1 Interrupt Source */
-#define TIM_IT_OC1 0x4000 /* Output Compare Channel 1 Interrupt Source */
-#define TIM_IT_TO 0x2000 /* Timer OverFlow Interrupt Source */
-#define TIM_IT_IC2 0x1000 /* Input Capture Channel 2 Interrupt Source */
-#define TIM_IT_OC2 0x0800 /* Output Compare Channel 2 Interrupt Source */
-
-/* TIM Flags */
-#define TIM_FLAG_IC1 0x8000 /* Input Capture Channel 1 Flag */
-#define TIM_FLAG_OC1 0x4000 /* Output Compare Channel 1 Flag */
-#define TIM_FLAG_TO 0x2000 /* Timer OverFlow Flag */
-#define TIM_FLAG_IC2 0x1000 /* Input Capture Channel 2 Flag */
-#define TIM_FLAG_OC2 0x0800 /* Output Compare Channel 2 Flag */
-
-/* Module private variables --------------------------------------------------*/
-/* Exported macro ------------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-void TIM_Init(TIM_TypeDef *TIMx, TIM_InitTypeDef *TIM_InitStruct);
-void TIM_DeInit(TIM_TypeDef *TIMx);
-void TIM_StructInit(TIM_InitTypeDef *TIM_InitStruct);
-void TIM_CounterCmd(TIM_TypeDef *TIMx, TIM_CounterOperations TIM_operation);
-void TIM_PrescalerConfig(TIM_TypeDef *TIMx, u8 TIM_Prescaler);
-u8 TIM_GetPrescalerValue(TIM_TypeDef *TIMx);
-u16 TIM_GetCounterValue(TIM_TypeDef *TIMx);
-u16 TIM_GetICAP1Value(TIM_TypeDef *TIMx);
-u16 TIM_GetICAP2Value(TIM_TypeDef *TIMx);
-void TIM_SetPulse(TIM_TypeDef *TIMx,u16 TIM_Channel ,u16 TIM_Pulse);
-FlagStatus TIM_GetFlagStatus(TIM_TypeDef *TIMx, u16 TIM_Flag);
-void TIM_ClearFlag(TIM_TypeDef *TIMx, u16 TIM_Flag);
-u16 TIM_GetPWMIPulse(TIM_TypeDef *TIMx);
-u16 TIM_GetPWMIPeriod(TIM_TypeDef *TIMx);
-void TIM_ITConfig(TIM_TypeDef *TIMx, u16 TIM_IT, FunctionalState TIM_Newstate);
-void TIM_DMAConfig(TIM_TypeDef *TIMx, u16 TIM_DMA_Sources);
-void TIM_DMACmd(TIM_TypeDef *TIMx, FunctionalState TIM_Newstate);
-
-#endif /* __91x_TIM_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_template91x/str91x_lib/include/91x_type.h b/uc_str912/prj_template91x/str91x_lib/include/91x_type.h
deleted file mode 100644
index 916d81c..0000000
--- a/uc_str912/prj_template91x/str91x_lib/include/91x_type.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_type.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : It contains common types and constants used in all the
-* peripherals' drivers.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-**********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*********************************************************************************/
-
-#ifndef __91x_type_H
-#define __91x_type_H
-
- typedef long long u64;
- typedef unsigned long u32;
- typedef unsigned short u16;
- typedef unsigned char u8;
-
- typedef signed long s32;
- typedef signed short s16;
- typedef signed char s8;
-
- typedef volatile unsigned long vu32;
- typedef volatile unsigned short vu16;
- typedef volatile unsigned char vu8;
-
- typedef volatile signed long vs32;
- typedef volatile signed short vs16;
- typedef volatile signed char vs8;
-
-typedef enum { FALSE = 0, TRUE = !FALSE } bool;
-
-typedef enum { RESET = 0, SET = !RESET } FlagStatus, ITStatus;
-
-typedef enum { DISABLE = 0, ENABLE = !DISABLE} FunctionalState;
-
-typedef enum { ERROR = 0, SUCCESS = !ERROR} ErrorStatus;
-
-#endif /* __91x_type_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_template91x/str91x_lib/include/91x_uart.h b/uc_str912/prj_template91x/str91x_lib/include/91x_uart.h
deleted file mode 100644
index b979438..0000000
--- a/uc_str912/prj_template91x/str91x_lib/include/91x_uart.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_uart.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* UART software library.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __91x_UART_H
-#define __91x_UART_H
-
-/* Includes ------------------------------------------------------------------*/
-#include <91x_map.h>
-
-/* Exported types ------------------------------------------------------------*/
-/* UART FIFO Level enumeration */
-typedef enum
-{
- UART_FIFOLevel_1_8 = 0x0000, /* FIFO size 16 bytes, FIFO level 2 bytes */
- UART_FIFOLevel_1_4 = 0x0001, /* FIFO size 16 bytes, FIFO level 4 bytes */
- UART_FIFOLevel_1_2 = 0x0002, /* FIFO size 16 bytes, FIFO level 8 bytes */
- UART_FIFOLevel_3_4 = 0x0003, /* FIFO size 16 bytes, FIFO level 12 bytes */
- UART_FIFOLevel_7_8 = 0x0004 /* FIFO size 16 bytes, FIFO level 14 bytes */
-}UART_FIFOLevel;
-
-/* UART Init Structure definition */
-typedef struct
-{
- u16 UART_WordLength;
- u16 UART_StopBits;
- u16 UART_Parity;
- u32 UART_BaudRate;
- u16 UART_HardwareFlowControl;
- u16 UART_Mode;
- u16 UART_FIFO;
- UART_FIFOLevel UART_TxFIFOLevel;
- UART_FIFOLevel UART_RxFIFOLevel;
-}UART_InitTypeDef;
-
-
-/* UART RTS enumeration */
-typedef enum
-{
- LowLevel = 0,
- HighLevel
-}UART_LevelTypeDef;
-
-/* Exported constants --------------------------------------------------------*/
-/* UART Data Length */
-#define UART_WordLength_5D 0x0000 /* 5 bits Data */
-#define UART_WordLength_6D 0x0020 /* 6 bits Data */
-#define UART_WordLength_7D 0x0040 /* 7 bits Data */
-#define UART_WordLength_8D 0x0060 /* 8 bits Data */
-
-/* UART Stop Bits */
-#define UART_StopBits_1 0xFFF7 /* Disable two stop bit is transmitted
- at the end of frame */
-#define UART_StopBits_2 0x0008 /* Enable Two stop bits are transmitted
- at the end of frame */
-/* UART Parity */
-#define UART_Parity_No 0x0000 /* Parity Disable */
-#define UART_Parity_Even 0x0006 /* Even Parity */
-#define UART_Parity_Odd 0x0002 /* Odd Parity */
-#define UART_Parity_OddStick 0x0082 /* 1 is transmitted as bit parity */
-#define UART_Parity_EvenStick 0x0086 /* 0 is transmitted as bit parity */
-
-/* UART Hardware Flow Control */
-#define UART_HardwareFlowControl_None 0x0000 /* HFC Disable */
-#define UART_HardwareFlowControl_RTS 0x4000 /* RTS Enable */
-#define UART_HardwareFlowControl_CTS 0x8000 /* CTS Enable */
-#define UART_HardwareFlowControl_RTS_CTS 0xC000 /* CTS and RTS Enable */
-
-/* UART Mode */
-#define UART_Mode_Rx 0x0200 /* UART Rx Enabled */
-#define UART_Mode_Tx 0x0100 /* UART Tx Enbled */
-#define UART_Mode_Tx_Rx 0x0300 /* UART Tx and Rx Enabled */
-
-/* UART FIFO */
-#define UART_FIFO_Disable 0xFFEF /* FIFOs Disable */
-#define UART_FIFO_Enable 0x0010 /* FIFOs Enable */
-
-/* UART Interrupt definition */
-#define UART_IT_OverrunError 0x0400 /* Overrun Error interrupt mask */
-#define UART_IT_BreakError 0x0200 /* Break Error interrupt mask */
-#define UART_IT_ParityError 0x0100 /* Parity Error interrupt mask */
-#define UART_IT_FrameError 0x0080 /* Frame Error interrupt mask */
-#define UART_IT_ReceiveTimeOut 0x0040 /* Receive Time Out interrupt mask */
-#define UART_IT_Transmit 0x0020 /* Transmit interrupt mask */
-#define UART_IT_Receive 0x0010 /* Receive interrupt mask */
-#define UART_IT_DSR 0x0008 /* DSR interrupt mask */
-#define UART_IT_DCD 0x0004 /* DCD interrupt mask */
-#define UART_IT_CTS 0x0002 /* CTS interrupt mask */
-#define UART_IT_RI 0x0001 /* RI interrupt mask */
-
-/* UART DMA On Error */
-#define UART_DMAOnError_Enable 0xFFFB /* DMA receive request enabled
- when the UART error interrupt
- is asserted. */
-#define UART_DMAOnError_Disable 0x0004 /* DMA receive request disabled
- when the UART error interrupt
- is asserted. */
-/* UART DMA Request */
-#define UART_DMAReq_Tx 0x02 /* Transmit DMA Enable */
-#define UART_DMAReq_Rx 0x01 /* Receive DMA Enable */
-
-/* UART FLAG */
-#define UART_FLAG_OverrunError 0x23 /* Overrun error flag */
-#define UART_FLAG_Break 0x22 /* break error flag */
-#define UART_FLAG_ParityError 0x21 /* parity error flag */
-#define UART_FLAG_FrameError 0x20 /* frame error flag */
-#define UART_FLAG_RI 0x48 /* RI flag */
-#define UART_FLAG_TxFIFOEmpty 0x47 /* Transmit FIFO Empty flag */
-#define UART_FLAG_RxFIFOFull 0x46 /* Receive FIFO Full flag */
-#define UART_FLAG_TxFIFOFull 0x45 /* Transmit FIFO Full flag */
-#define UART_FLAG_RxFIFOEmpty 0x44 /* Receive FIFO Empty flag */
-#define UART_FLAG_Busy 0x43 /* UART Busy flag */
-#define UART_FLAG_DCD 0x42 /* DCD flag */
-#define UART_FLAG_DSR 0x41 /* DSR flag */
-#define UART_FLAG_CTS 0x40 /* CTS flag */
-#define UART_RawIT_OverrunError 0x6A /* Overrun Error Raw IT flag */
-#define UART_RawIT_BreakError 0x69 /* Break Error Raw IT flag */
-#define UART_RawIT_ParityError 0x68 /* Parity Error Raw IT flag */
-#define UART_RawIT_FrameError 0x67 /* Frame Error Raw IT flag */
-#define UART_RawIT_ReceiveTimeOut 0x66 /* ReceiveTimeOut Raw IT flag */
-#define UART_RawIT_Transmit 0x65 /* Transmit Raw IT flag */
-#define UART_RawIT_Receive 0x64 /* Receive Raw IT flag */
-#define UART_RawIT_DSR 0x63 /* DSR Raw IT flag */
-#define UART_RawIT_DCD 0x62 /* DCD Raw IT flag */
-#define UART_RawIT_CTS 0x61 /* CTS Raw IT flag */
-#define UART_RawIT_RI 0x60 /* RI Raw IT flag */
-
-/*IrDAx select*/
-#define IrDA0 0x01 /*IrDA0 select*/
-#define IrDA1 0x02 /*IrDA0 select*/
-#define IrDA2 0x03 /*IrDA0 select*/
-
-/* Exported macro ------------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-void UART_DeInit(UART_TypeDef* UARTx);
-void UART_Init(UART_TypeDef* UARTx, UART_InitTypeDef* UART_InitStruct);
-void UART_StructInit(UART_InitTypeDef* UART_InitStruct);
-void UART_Cmd(UART_TypeDef* UARTx, FunctionalState NewState);
-void UART_ITConfig(UART_TypeDef* UARTx, u16 UART_IT, FunctionalState NewState);
-void UART_DMAConfig(UART_TypeDef* UARTx, u16 UART_DMAOnError);
-void UART_DMACmd(UART_TypeDef* UARTx, u8 UART_DMAReq, FunctionalState NewState);
-void UART_LoopBackConfig(UART_TypeDef* UARTx, FunctionalState NewState);
-FlagStatus UART_GetFlagStatus(UART_TypeDef* UARTx, u16 UART_FLAG);
-void UART_ClearFlag(UART_TypeDef* UARTx);
-void UART_ClearITPendingBit(UART_TypeDef* UARTx, u16 UART_IT);
-void UART_IrDALowPowerConfig(u8 IrDAx, FunctionalState NewState);
-void UART_IrDACmd(u8 IrDAx, FunctionalState NewState);
-void UART_IrDASetCounter(u8 IrDAx, u32 IrDA_Counter);
-void UART_SendData(UART_TypeDef* UARTx, u8 Data);
-u8 UART_ReceiveData(UART_TypeDef* UARTx);
-void UART_SendBreak(UART_TypeDef* UARTx);
-void UART_DTRConfig(UART_LevelTypeDef LevelState);
-void UART_RTSConfig(UART_LevelTypeDef LevelState);
-ITStatus UART_GetITStatus(UART_TypeDef* UARTx, u16 UART_IT);
-
-#endif /* __91x_UART_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_template91x/str91x_lib/include/91x_vic.h b/uc_str912/prj_template91x/str91x_lib/include/91x_vic.h
deleted file mode 100644
index 127716a..0000000
--- a/uc_str912/prj_template91x/str91x_lib/include/91x_vic.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_vic.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* VIC software library.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-
-/* Define to prevent recursive inclusion ------------------------------------ */
-#ifndef __91x_VIC_H
-#define __91x_VIC_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_map.h"
-#include "91x_it.h"
-
-/* Exported types ------------------------------------------------------------*/
-/* Type of interrupt */
-typedef enum
-{
- VIC_IRQ,
- VIC_FIQ
-} VIC_ITLineMode;
-
-/* Exported constants --------------------------------------------------------*/
-
-/* VIC sources*/
-
-#define WDG_ITLine 0
-#define SW_ITLine 1
-#define ARMRX_ITLine 2
-#define ARMTX_ITLine 3
-#define TIM0_ITLine 4
-#define TIM1_ITLine 5
-#define TIM2_ITLine 6
-#define TIM3_ITLine 7
-#define USBHP_ITLine 8
-#define USBLP_ITLine 9
-#define SCU_ITLine 10
-#define ENET_ITLine 11
-#define DMA_ITLine 12
-#define CAN_ITLine 13
-#define MC_ITLine 14
-#define ADC_ITLine 15
-#define UART0_ITLine 16
-#define UART1_ITLine 17
-#define UART2_ITLine 18
-#define I2C0_ITLine 19
-#define I2C1_ITLine 20
-#define SSP0_ITLine 21
-#define SSP1_ITLine 22
-#define LVD_ITLine 23
-#define RTC_ITLine 24
-#define WIU_ITLine 25
-#define EXTIT0_ITLine 26
-#define EXTIT1_ITLine 27
-#define EXTIT2_ITLine 28
-#define EXTIT3_ITLine 29
-#define USBWU_ITLine 30
-#define PFQBC_ITLine 31
-
-
-/* Module private variables --------------------------------------------------*/
-/* Exported macro ------------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-
-void VIC_DeInit(void);
-FlagStatus VIC_GetIRQStatus(u16 VIC_Source);
-FlagStatus VIC_GetFIQStatus(u16 VIC_Source);
-FlagStatus VIC_GetSourceITStatus(u16 VIC_Source);
-void VIC_ITCmd(u16 VIC_Source, FunctionalState VIC_NewState);
-void VIC_SWITCmd(u16 VIC_Source, FunctionalState VIC_NewState);
-void VIC_ProtectionCmd(FunctionalState VIC_NewState);
-u32 VIC_GetCurrentISRAdd(VIC_TypeDef* VICx);
-u32 VIC_GetISRVectAdd(u16 VIC_Source);
-void VIC_Config(u16 VIC_Source, VIC_ITLineMode VIC_LineMode, u8 VIC_Priority);
-
-#endif /* __91x_VIC_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
-
diff --git a/uc_str912/prj_template91x/str91x_lib/include/91x_wdg.h b/uc_str912/prj_template91x/str91x_lib/include/91x_wdg.h
deleted file mode 100644
index fc70547..0000000
--- a/uc_str912/prj_template91x/str91x_lib/include/91x_wdg.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_wdg.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* WDG software library.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __91x_WDG_H
-#define __91x_WDG_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_map.h"
-
-/* Exported types ------------------------------------------------------------*/
-typedef struct
-{
-u16 WDG_Mode;
-u16 WDG_ClockSource;
-u16 WDG_Prescaler;
-u16 WDG_Preload;
-
-} WDG_InitTypeDef;
-
-/* Exported constants --------------------------------------------------------*/
-
-/* WDG_Mode */
-#define WDG_Mode_Wdg 0x0001 /*WDG configured to run in watchdog mode.*/
-#define WDG_Mode_Timer 0xFFFE /*WDG configured to be in Free-running Timer mode.*/
-
-
-/* WDG_ClockSource */
-#define WDG_ClockSource_Rtc 0x0004 /* External clock ( 32 khz RTC clock ) will be used as counting clock.*/
-#define WDG_ClockSource_Apb 0xFFFB /*The APB clock signal will be used as counting clock.*/
-
-/* WDG_Prescaler */
-/*This member must be a number between 0x00 and 0xFF.
-Specifies the Prescaler value to divide the clock source.
-The clock of the Watchdog Timer Counter is divided by " WDG_Prescaler + 1".*/
-
-
-
-/* WDG_Preload */
-/*This member must be a number between 0x0000 and 0xFFFF.
-This value is loaded in the WDG Counter when it starts counting.*/
-
-
-/* WDG Sequence */
-#define WDG_KeyValue1 0xA55A
-#define WDG_KeyValue2 0x5AA5
-
-/* Exported macro ------------------------------------------------------------*/
-
-
-/* Exported functions ------------------------------------------------------- */
-
-void WDG_DeInit(void);
-void WDG_Init(WDG_InitTypeDef* WDG_InitStruct);
-void WDG_StructInit(WDG_InitTypeDef* WDG_InitStruct);
-void WDG_Cmd(FunctionalState NewState);
-void WDG_ITConfig(FunctionalState NewState);
-u16 WDG_GetCounter(void);
-FlagStatus WDG_GetFlagStatus(void);
-void WDG_ClearFlag(void);
-ITStatus WDG_GetITStatus(void);
-void WDG_ClearITPendingBit(void);
-
-#endif /* __WDG_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_template91x/str91x_lib/include/91x_wiu.h b/uc_str912/prj_template91x/str91x_lib/include/91x_wiu.h
deleted file mode 100644
index 8b0349c..0000000
--- a/uc_str912/prj_template91x/str91x_lib/include/91x_wiu.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_wiu.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* WIU software library.
-**********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-**********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*********************************************************************************/
-
-/* Define to prevent recursive inclusion ------------------------------------ */
-#ifndef __91x_WIU_H
-#define __91x_WIU_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_map.h"
-
-/* Exported types ------------------------------------------------------------*/
-/* WIU Init structure type define */
-typedef struct
-{
- u8 WIU_Mode ;
- u8 WIU_TriggerEdge;
- u32 WIU_Line ;
-}WIU_InitTypeDef ;
-
-/* Exported constants --------------------------------------------------------*/
-/* Wake-up line triggering edge */
-#define WIU_FallingEdge 0x00
-#define WIU_RisingEdge 0x01
-
-/* Wake-up unit modes */
-#define WIU_Mode_WakeUp 0x01
-#define WIU_Mode_Interrupt 0x02
-#define WIU_Mode_WakeUpInterrupt 0x03
-#define WIU_Mode_SWInterrupt 0x04
-
-/* Wake-up lines*/
-#define WIU_Line0 0x0001
-#define WIU_Line1 (WIU_Line0<<1)
-#define WIU_Line2 (WIU_Line1<<1)
-#define WIU_Line3 (WIU_Line2<<1)
-#define WIU_Line4 (WIU_Line3<<1)
-#define WIU_Line5 (WIU_Line4<<1)
-#define WIU_Line6 (WIU_Line5<<1)
-#define WIU_Line7 (WIU_Line6<<1)
-#define WIU_Line8 (WIU_Line7<<1)
-#define WIU_Line9 (WIU_Line8<<1)
-#define WIU_Line10 (WIU_Line9<<1)
-#define WIU_Line11 (WIU_Line10<<1)
-#define WIU_Line12 (WIU_Line11<<1)
-#define WIU_Line13 (WIU_Line12<<1)
-#define WIU_Line14 (WIU_Line13<<1)
-#define WIU_Line15 (WIU_Line14<<1)
-#define WIU_Line16 (WIU_Line15<<1)
-#define WIU_Line17 (WIU_Line16<<1)
-#define WIU_Line18 (WIU_Line17<<1)
-#define WIU_Line19 (WIU_Line18<<1)
-#define WIU_Line20 (WIU_Line19<<1)
-#define WIU_Line21 (WIU_Line20<<1)
-#define WIU_Line22 (WIU_Line21<<1)
-#define WIU_Line23 (WIU_Line22<<1)
-#define WIU_Line24 (WIU_Line23<<1)
-#define WIU_Line25 (WIU_Line24<<1)
-#define WIU_Line26 (WIU_Line25<<1)
-#define WIU_Line27 (WIU_Line26<<1)
-#define WIU_Line28 (WIU_Line27<<1)
-#define WIU_Line29 (WIU_Line28<<1)
-#define WIU_Line30 (WIU_Line29<<1)
-#define WIU_Line31 (WIU_Line30<<1)
-
-/* Exported constants --------------------------------------------------------*/
-/* Module private variables --------------------------------------------------*/
-/* Exported macro ------------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-
-void WIU_DeInit(void);
-void WIU_StructInit(WIU_InitTypeDef* WIU_InitStruct);
-void WIU_Init(WIU_InitTypeDef* WIU_InitStruct);
-void WIU_GenerateSWInterrupt(u32 WIU_Line);
-FlagStatus WIU_GetFlagStatus(u32 WIU_Line);
-void WIU_ClearFlag(u32 WIU_Line);
-ITStatus WIU_GetITStatus(u32 WIU_Line);
-void WIU_ClearITPendingBit(u32 WIU_Line);
-
-#endif /* __91x_WIU_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
-
diff --git a/uc_str912/prj_template91x/str91x_lib/src/91x_adc.c b/uc_str912/prj_template91x/str91x_lib/src/91x_adc.c
deleted file mode 100644
index a6a07d3..0000000
--- a/uc_str912/prj_template91x/str91x_lib/src/91x_adc.c
+++ /dev/null
@@ -1,590 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_adc.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the ADC software functions.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-
-/* Standard include ----------------------------------------------------------*/
-#include "91x_adc.h"
-#include "91x_scu.h"
-/* Include of other module interface headers ---------------------------------*/
-/* Local includes ------------------------------------------------------------*/
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-
-/* ADC mask */
-#define ADC_FLAG_MASK 0x001F /* ADC Flag Mask */
-#define ADC_RESULT_MASK 0x03FF /* ADC Result Mask */
-#define ADC_SCAN_MODE_MASK 0x0020 /* ADC Sacn Mode Mask */
-#define ADC_STANDBY_MODE_MASK 0x0008 /* ADC Standby Mode Mask */
-#define ADC_CMD_MASK 0x0002 /* ADC Command Mask */
-#define ADC_CHANNEL_MASK 0xFE3F /* ADC Channel Select Mask */
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/* Interface functions -------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-
-/*******************************************************************************
-* Function Name : ADC_DeInit
-* Description : Deinitialize the ADC module registers to their default reset
-* values
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void ADC_DeInit(void)
-{
- /* Reset the ADC registers values */
- SCU_APBPeriphReset(__ADC,ENABLE);
- SCU_APBPeriphReset(__ADC,DISABLE);
-}
-
-/*******************************************************************************
-* Function Name : ADC_Init
-* Description : Initializes ADC peripheral according to the specified
-* parameters in the ADC_InitTypeDef structure.
-* Input : ADC_InitStruct: pointer to a ADC_InitTypeDef structure that
-* contains the configuration information for the specified
-* ADC peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void ADC_Init(ADC_InitTypeDef* ADC_InitStruct)
-{
- /* Set the low threshold of the watchdog */
- ADC->LTR = ADC_InitStruct->ADC_WDG_Low_Threshold;
-
- /* Set the high threshold of the watchdog */
- ADC->HTR = ADC_InitStruct->ADC_WDG_High_Threshold;
-
-
- /* Channel 0 conversion mode */
- ADC->CCR &= 0xFFFC;
- ADC->CCR |= ADC_InitStruct->ADC_Channel_0_Mode;
-
- /* Channel 1 conversion mode */
- ADC->CCR &= 0xFFF3;
- ADC->CCR |= ADC_InitStruct->ADC_Channel_1_Mode << 0x2;
-
- /* Channel 2 conversion mode */
- ADC->CCR &= 0xFFCF;
- ADC->CCR |= ADC_InitStruct->ADC_Channel_2_Mode << 0x4;
-
- /* Channel 3 conversion mode */
- ADC->CCR &= 0xFF3F;
- ADC->CCR |= ADC_InitStruct->ADC_Channel_3_Mode << 0x6;
-
- /* Channel 4 conversion mode */
- ADC->CCR &= 0xFCFF;
- ADC->CCR |= ADC_InitStruct->ADC_Channel_4_Mode << 0x8;
-
- /* Channel 5 conversion mode */
- ADC->CCR &= 0xF3FF;
- ADC->CCR |= ADC_InitStruct->ADC_Channel_5_Mode << 0xA;
-
- /* Channel 6 conversion mode */
- ADC->CCR &= 0xCFFF;
- ADC->CCR |= ADC_InitStruct->ADC_Channel_6_Mode << 0xC;
-
- /* Channel 7 conversion mode */
- ADC->CCR &= 0x3FFF;
- ADC->CCR |= ADC_InitStruct->ADC_Channel_7_Mode << 0xE;
-
- /* Select the channel to be converted */
- ADC->CR &= ADC_CHANNEL_MASK;
- ADC->CR |= ADC_InitStruct->ADC_Select_Channel << 0x6;
-
- /* Enable/disable the scan mode */
- if (ADC_InitStruct->ADC_Scan_Mode == ENABLE)
- {
- /* Enable the scan mode */
- ADC->CR |= ADC_SCAN_MODE_MASK;
- }
- else
- {
- /* Disable the scan mode */
- ADC->CR &= ~ADC_SCAN_MODE_MASK;
- }
-
- /* Configure the conversion mode */
- if (ADC_InitStruct->ADC_Conversion_Mode == ADC_Continuous_Mode)
- {
- /* ADC continuous mode */
- ADC->CR |= ADC_Continuous_Mode;
- }
- else
- {
- /* ADC single mode */
- ADC->CR &= ADC_Single_Mode;
- }
-}
-
-/*******************************************************************************
-* Function Name : ADC_StructInit
-* Description : Fills each ADC_InitStruct member with its reset value.
-* Input : ADC_InitStruct : pointer to a ADC_InitTypeDef structure
-* which will be initialized.
-* Output : None
-* Return : None.
-*******************************************************************************/
-void ADC_StructInit(ADC_InitTypeDef* ADC_InitStruct)
-{
- ADC_InitStruct->ADC_WDG_High_Threshold = 0x0000;
- ADC_InitStruct->ADC_WDG_Low_Threshold = 0x0000;
- ADC_InitStruct->ADC_Channel_0_Mode = ADC_No_Conversion;
- ADC_InitStruct->ADC_Channel_1_Mode = ADC_No_Conversion;
- ADC_InitStruct->ADC_Channel_2_Mode = ADC_No_Conversion;
- ADC_InitStruct->ADC_Channel_3_Mode = ADC_No_Conversion;
- ADC_InitStruct->ADC_Channel_4_Mode = ADC_No_Conversion;
- ADC_InitStruct->ADC_Channel_5_Mode = ADC_No_Conversion;
- ADC_InitStruct->ADC_Channel_6_Mode = ADC_No_Conversion;
- ADC_InitStruct->ADC_Channel_7_Mode = ADC_No_Conversion;
- ADC_InitStruct->ADC_Select_Channel = ADC_Channel_0;
- ADC_InitStruct->ADC_Scan_Mode = DISABLE;
- ADC_InitStruct->ADC_Conversion_Mode = ADC_Single_Mode;
-}
-
-/*******************************************************************************
-* Function Name : ADC_PrescalerConfig
-* Description : This routine is used to configure the ADC prescaler value.
-* Input : ADC_Prescaler: specifies the prescaler value. This parameter
-* can be a value from 0x0 to 0xFF.
-* Output : None
-* Return : None
-*******************************************************************************/
-void ADC_PrescalerConfig(u8 ADC_Prescaler)
-{
- ADC->PRS &= 0xFF00;
- ADC->PRS |= ADC_Prescaler;
-
-}
-/*******************************************************************************
-* Function Name : ADC_GetPrescalerValue
-* Description : This routine is used to get the ADC prescaler value.
-* Input : None
-* Output : None
-* Return : The prescaler value.
-*******************************************************************************/
-u8 ADC_GetPrescalerValue(void)
-{
- return ADC->PRS & 0x00FF;
-}
-/*******************************************************************************
-* Function Name : ADC_GetFlagStatus
-* Description : Checks whether the specified ADC flag is set or not.
-* Input : ADC_Flag: flag to check.
-* This parameter can be one of the following values:
-* - ADC_FLAG_OV_CH_0: Conversion overflow status for
-* channel 0.
-* - ADC_FLAG_OV_CH_1: Conversion overflow status for
-* channel 1.
-* - ADC_FLAG_OV_CH_2: Conversion overflow status for
-* channel 2.
-* - ADC_FLAG_OV_CH_3: Conversion overflow status for
-* channel 3.
-* - ADC_FLAG_OV_CH_4: Conversion overflow status for
-* channel 4.
-* - ADC_FLAG_OV_CH_5: Conversion overflow status for
-* channel 5.
-* - ADC_FLAG_OV_CH_6: Conversion overflow status for
-* channel 6.
-* - ADC_FLAG_OV_CH_7: Conversion overflow status for
-* channel 7.
-* - ADC_FLAG_ECV: End of conversion status.
-* - ADC_FLAG_AWD: Analog watchdog status.
-* Output : None
-* Return : The NewState of the ADC_Flag (SET or RESET).
-*******************************************************************************/
-FlagStatus ADC_GetFlagStatus(u16 ADC_Flag)
-{
- u8 AdcReg = 0, FlagPos = 0;
-
- /* Get the ADC register index */
- AdcReg = ADC_Flag >> 5;
-
- /* Get the flag position */
- FlagPos = ADC_Flag & ADC_FLAG_MASK;
-
- if(AdcReg == 1) /* The flag to check is in CR register */
- {
- if((ADC->CR & (1<<FlagPos))!= RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
- }
- else if(AdcReg == 6) /* The flag to check is in DR0 register */
- {
- if((ADC->DR0 & (1<<FlagPos))!= RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
- }
- else if(AdcReg == 7) /* The flag to check is in DR1 register */
- {
- if((ADC->DR1 & (1<<FlagPos))!= RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
- }
- else if(AdcReg == 8) /* The flag to check is in DR2 register */
- {
- if((ADC->DR2 & (1<<FlagPos))!= RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
- }
- else if(AdcReg == 9) /* The flag to check is in DR3 register */
- {
- if((ADC->DR3 & (1<<FlagPos))!= RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
- }
-
- else if(AdcReg == 0xA) /* The flag to check is in DR4 register */
- {
- if((ADC->DR4 & (1<<FlagPos))!= RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
- }
- else if(AdcReg == 0xB) /* The flag to check is in DR5 register */
- {
- if((ADC->DR5 & (1<<FlagPos))!= RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
- }
- else if(AdcReg == 0xC) /* The flag to check is in DR6 register */
- {
- if((ADC->DR6 & (1<<FlagPos))!= RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
- }
- else /* (AdcReg == 0xD), The flag to check is in DR7 register */
- {
- if((ADC->DR7 & (1<<FlagPos))!= RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
- }
-}
-
-/*******************************************************************************
-* Function Name : ADC_ClearFlag
-* Description : Clears the ADC Flag passed as a parameter.
-* Input : ADC_Flag: flag to clear.
-* This parameter can be one of the following values:
-* - ADC_FLAG_ECV: End of conversion status.
-* - ADC_FLAG_AWD: Analog watchdog status.
-* Output : None
-* Return : None
-*******************************************************************************/
-void ADC_ClearFlag(u16 ADC_Flag)
-{
- /* Clear the correspondent flag */
- ADC->CR |= (1<<(ADC_Flag & ADC_FLAG_MASK));
-}
-
-/*******************************************************************************
-* Function Name : ADC_GetConversionValue
-* Description : Read the result of conversion from the appropriate data
-* register.
-* Input : ADC_Channel: the correspondent channel of the ADC peripheral.
-* This parameter can be one of the following values:
-* - ADC_Channel_0: ADC channel 0.
-* - ADC_Channel_1: ADC channel 1.
-* - ADC_Channel_2: ADC channel 2.
-* - ADC_Channel_3: ADC channel 3.
-* - ADC_Channel_4: ADC channel 4.
-* - ADC_Channel_5: ADC channel 5.
-* - ADC_Channel_6: ADC channel 6.
-* - ADC_Channel_7: ADC channel 7.
-* Output : None
-* Return : The result of the conversion for the specific channel.
-*******************************************************************************/
-u16 ADC_GetConversionValue(u16 ADC_Channel)
-{
- u16 ADC_Conversion_Value = 0;
-
- switch (ADC_Channel)
- {
- case (ADC_Channel_0):
- /* Get the conversion value of the channel 0 */
- ADC_Conversion_Value = ADC->DR0 & ADC_RESULT_MASK;
- break;
-
- case (ADC_Channel_1):
- /* Get the conversion value of the channel 1 */
- ADC_Conversion_Value = ADC->DR1 & ADC_RESULT_MASK;
- break;
-
- case (ADC_Channel_2):
- /* Get the conversion value of the channel 2 */
- ADC_Conversion_Value = ADC->DR2 & ADC_RESULT_MASK;
- break;
-
- case (ADC_Channel_3):
- /* Get the conversion value of the channel 3 */
- ADC_Conversion_Value = ADC->DR3 & ADC_RESULT_MASK;
- break;
-
- case (ADC_Channel_4):
- /* Get the conversion value of the channel 4 */
- ADC_Conversion_Value = ADC->DR4 & ADC_RESULT_MASK;
- break;
-
- case (ADC_Channel_5):
- /* Get the conversion value of the channel 5 */
- ADC_Conversion_Value = ADC->DR5 & ADC_RESULT_MASK;
- break;
-
- case (ADC_Channel_6):
- /* Get the conversion value of the channel 6 */
- ADC_Conversion_Value = ADC->DR6 & ADC_RESULT_MASK;
- break;
-
- case (ADC_Channel_7):
- /* Get the conversion value of the channel 7 */
- ADC_Conversion_Value = ADC->DR7 & ADC_RESULT_MASK;
- break;
-
- default:
- break;
- }
-
- return(ADC_Conversion_Value);
-}
-
-/*******************************************************************************
-* Function Name : ADC_GetAnalogWatchdogResult
-* Description : Return the result of the comparaison on the selected Analog
-* Watchdog.
-* Input : ADC_Channel: the correspondent channel of the ADC peripheral.
-* This parameter can be one of the following values:
-* - ADC_Channel_0: ADC channel 0.
-* - ADC_Channel_1: ADC channel 1.
-* - ADC_Channel_2: ADC channel 2.
-* - ADC_Channel_3: ADC channel 3.
-* - ADC_Channel_4: ADC channel 4.
-* - ADC_Channel_5: ADC channel 5.
-* - ADC_Channel_6: ADC channel 6.
-* - ADC_Channel_7: ADC channel 7.
-* Output : None
-* Return : The state of the comparision (SET or RESET).
-*******************************************************************************/
-FlagStatus ADC_GetAnalogWatchdogResult(u16 ADC_Channel)
-{
- if (ADC->CRR & (1<<ADC_Channel) != RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : ADC_ClearAnalogWatchdogResult
-* Description : Clear the result of the comparaison on the selected Analog
-* Watchdog.
-* Input : ADC_Channel: the correspondent channel of the ADC peripheral.
-* This parameter can be one of the following values:
-* - ADC_Channel_0: ADC channel 0.
-* - ADC_Channel_1: ADC channel 1.
-* - ADC_Channel_2: ADC channel 2.
-* - ADC_Channel_3: ADC channel 3.
-* - ADC_Channel_4: ADC channel 4.
-* - ADC_Channel_5: ADC channel 5.
-* - ADC_Channel_6: ADC channel 6.
-* - ADC_Channel_7: ADC channel 7.
-* Output : None
-* Return : None
-*******************************************************************************/
-void ADC_ClearAnalogWatchdogResult(u16 ADC_Channel)
-{
- /* Clear the correspondent watchdog result */
- ADC->CRR = 1<<ADC_Channel;
-}
-
-/*******************************************************************************
-* Function Name : ADC_GetWatchdogThreshold
-* Description : Get the higher/lower thresholds values of the watchdog.
-* Input : ADC_Threshold: the lower or the higher threshold.
-* This parameter can be one of the following values:
-* - ADC_HigherThreshold: The higher threshold.
-* - ADC_LowerThreshold: The lower threshold.
-* Output : None
-* Return : The selected threshold value.
-*******************************************************************************/
-u16 ADC_GetWatchdogThreshold(ADC_ThresholdType ADC_Threshold)
-{
- u16 ADC_Threshold_Value = 0;
-
- switch (ADC_Threshold)
- {
- case ADC_LowThreshold:
- /* Get the low threshold of the watchdog */
- ADC_Threshold_Value = ADC->LTR;
- break;
-
- case ADC_HighThreshold:
- /* Get the high threshol of the watchdog */
- ADC_Threshold_Value = ADC->HTR;
- break;
-
- default:
- break;
- }
-
- return(ADC_Threshold_Value);
-}
-
-/*******************************************************************************
-* Function Name : ADC_ITConfig
-* Description : Enables or disables the specified ADC interrupts.
-* Input : - ADC_IT: specifies the ADC interrupts sources to be enabled
-* or disabled.
-* This parameter can be one of the following values:
-* - ADC_IT_EndOfConversion: End of conversion interrupt.
-* - ADC_IT_AnalogWDG: Analog watchdog interrupt.
-* - ADC_NewState: new state of the specified ADC interrupts.
-* (ADC_Newstate can be ENABLE or DISABLE).
-* Output : None
-* Return : None
-*******************************************************************************/
-void ADC_ITConfig(u16 ADC_IT, FunctionalState ADC_NewState)
-{
- if (ADC_NewState == ENABLE)
- {
- /* Enable the interrupt */
- ADC->CR |= ADC_IT;
- }
- else
- {
- /* Disable the interrupt */
- ADC->CR &= ~ADC_IT;
- }
-}
-
-/*******************************************************************************
-* Function Name : ADC_StandbyModeCmd
-* Description : Enable or disable the standby mode.
-* Input : ADC_NewState: new state of the ADC standby mode.
-* (ADC_Newstate can be ENABLE or DISABLE).
-* Output : None
-* Return : None
-*******************************************************************************/
-void ADC_StandbyModeCmd(FunctionalState ADC_NewState)
-{
- if (ADC_NewState == ENABLE)
- {
- /* Enable the standby mode */
- ADC->CR |= ADC_STANDBY_MODE_MASK;
- }
- else
- {
- /* Disable the standby mode */
- ADC->CR &= ~ADC_STANDBY_MODE_MASK;
- }
-}
-
-/*******************************************************************************
-* Function Name : ADC_Cmd
-* Description : Power on or put in reset mode the ADC peripheral.
-* Input : ADC_NewState: new state of the ADC peripheral.
-* (ADC_Newstate can be ENABLE or DISABLE).
-* Output : None
-* Return : None
-*******************************************************************************/
-void ADC_Cmd(FunctionalState ADC_NewState)
-{
- if (ADC_NewState == ENABLE)
- {
- /* Enable the ADC */
- ADC->CR |= ADC_CMD_MASK;
- }
- else
- {
- /* Disable the ADC */
- ADC->CR &= ~ADC_CMD_MASK;
- }
-}
-
-/*******************************************************************************
-* Function Name : ADC_ConversionCmd
-* Description : Start or stop the ADC conversion in the selected mode.
-* Input : ADC_Conversion: the conversion command.
-* This parameter can be one of the following values:
-* - ADC_Conversion_Start: Start the conversion.
-* - ADC_Conversion_Stop: Stop the Conversion.
-* Output : None
-* Return : None
-*******************************************************************************/
-void ADC_ConversionCmd(u16 ADC_Conversion)
-{
- if (ADC_Conversion == ADC_Conversion_Start)
- {
- /* Start the ADC conversion */
- ADC->CR |= ADC_Conversion_Start;
- }
- else
- {
- /* Stop the ADC conversion */
- ADC->CR &= ADC_Conversion_Stop;
- }
-}
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_template91x/str91x_lib/src/91x_ahbapb.c b/uc_str912/prj_template91x/str91x_lib/src/91x_ahbapb.c
deleted file mode 100644
index 41489ac..0000000
--- a/uc_str912/prj_template91x/str91x_lib/src/91x_ahbapb.c
+++ /dev/null
@@ -1,177 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_ahbapb.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the AHBAPB software functions.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_ahbapb.h"
-
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-#define AHBAPB_SplitCounter_Mask 0xFFE0FFFF
-#define AHBAPB_SetTimeOut_Mask 0xFFFFFFE0
-#define AHBAPB_Address_Mask 0xFEFFFFFF
-#define AHBAPB_FLAG_RW_Mask 0x01000000
-/*******************************************************************************
-* Function Name : AHBAPB_DeInit
-* Description : Deinitializes the AHBAPBx peripheral registers to their default
-* reset values.
-* Input : AHBAPBx: where x can be 0 or 1 to select the AHBAPB peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void AHBAPB_DeInit(AHBAPB_TypeDef* AHBAPBx)
-{
- AHBAPBx->BCR = 0x00000000;
- AHBAPBx->BSR = 0x00000000;
-}
-/*******************************************************************************
-* Function Name : AHBAPB_Init
-* Description : Initializes the AHBAPBx peripheral according to the specified
-* parameters in the AHBAPB_InitStruct .
-* Input :- AHBAPBx: where x can be 0 or 1 to select the AHBAPB peripheral.
-* - AHBAPB_InitStruct: pointer to a AHBAPB_InitTypeDef structure that
-* contains the configuration information for the specified AHBAPB
-* peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void AHBAPB_Init(AHBAPB_TypeDef* AHBAPBx, AHBAPB_InitTypeDef* AHBAPB_InitStruct)
-{
-
- if(AHBAPB_InitStruct->AHBAPB_Split == AHBAPB_Split_Enable)
- {
- /* Set SPLITEN bit;*/
- AHBAPBx->BCR |= AHBAPB_Split_Enable;
- /*Split_CNT bits[20:16]*/
- AHBAPBx->BCR &= AHBAPB_SplitCounter_Mask;
- AHBAPBx->BCR |= (AHBAPB_InitStruct->AHBAPB_SplitCounter)<<16;
- }
- else
- {
- /*/ Clear SPLITEN bit;*/
- AHBAPBx->BCR &= AHBAPB_Split_Disable;
- }
- /*APB Time out*/
- if(AHBAPB_InitStruct->AHBAPB_Error == AHBAPB_Error_Enable)
- {
- /* Set ERREN bit*/
- AHBAPBx->BCR |= AHBAPB_Error_Enable;
- /*Time ouit counter*/
- AHBAPBx->BCR &= AHBAPB_SetTimeOut_Mask;
- AHBAPBx->BCR |= AHBAPB_InitStruct->AHBAPB_SetTimeOut;
- }
- else
- {
- /* Clear ERREN bit*/
- AHBAPBx->BCR &= AHBAPB_Error_Disable;
- }
-}
-
-/*******************************************************************************
-* Function Name : AHBAPB_StructInit
-* Description : Initialize the AHBAPB Init Structure parameters
-* Input : AHBAPB_InitStruct : pointer to a AHBAPB_InitTypeDef structure
-* which will be initialized.
-* Output : None
-* Return : None
-*******************************************************************************/
-void AHBAPB_StructInit(AHBAPB_InitTypeDef* AHBAPB_InitStruct)
-{
- /* Reset AHBAPB init structure parameters values */
- AHBAPB_InitStruct->AHBAPB_Split = AHBAPB_Split_Enable;
- AHBAPB_InitStruct->AHBAPB_SplitCounter = 0xFF;
- AHBAPB_InitStruct->AHBAPB_Error = AHBAPB_Error_Enable;
- AHBAPB_InitStruct->AHBAPB_SetTimeOut = 0xFF;
-
-}
-
-/*******************************************************************************
-* Function Name : AHBAPB_GetFlagStatus
-* Description : Checks whether the specified AHBAPB flag is set or not.
-* Input : - AHBAPB: where x can be 0 or 1 to select the AHBAPB peripheral
-* - AHBAPB_FLAG: specifies the flag to check.
-* This parameter can be one of the following values:
-* - AHBAPB_FLAG_ERROR: error flag
-* - AHBAPB_FLAG_OUTM : Out of Memory flag
-* - AHBAPB_FLAG_APBT : APB Time-out flag
-* - AHBAPB_FLAG_RW : Access type flag
-* Output : None
-* Return : The new state of AHBAPB_FLAG (SET or RESET).
-*******************************************************************************/
-FlagStatus AHBAPB_GetFlagStatus(AHBAPB_TypeDef* AHBAPBx, u8 AHBAPB_FLAG)
-{
- if(AHBAPB_FLAG == AHBAPB_FLAG_RW)
- {
- if ((AHBAPBx->PAER & AHBAPB_FLAG_RW_Mask) == RESET)
- {
- return RESET;
- }
- else
- {
- return SET;
- }
- }
- else
- {
- if ((AHBAPBx->BSR & AHBAPB_FLAG) == RESET)
- {
- return RESET;
- }
- else
- {
- return SET;
- }
- }
-}
-/*******************************************************************************
-* Function Name : AHBAPB_ClearFlag
-* Description : Clears the AHBAPBx flags.
-* Input : - AHBAPB: where x can be 0 or 1 to select the AHBAPB peripheral
-* - AHBAPB_FLAG: flags to clear. This parameter one of the
-* following values:
-* - AHBAPB_FLAG_ERROR: error flag
-* - AHBAPB_FLAG_OUTM : Out of Memory flag
-* - AHBAPB_FLAG_APBT : APB Time-out flag
-* Output : None
-* Return : None
-*******************************************************************************/
-void AHBAPB_ClearFlag(AHBAPB_TypeDef* AHBAPBx, u8 AHBAPB_FLAG)
-{
- /* Clear the flag */
- AHBAPBx->BSR &= AHBAPB_FLAG;
-}
-/*******************************************************************************
-* Function Name : AHBAPB_GetPeriphAddrError
-* Description : Gets the AHBAPB error address peripherals.
-* Input : - AHBAPB: where x can be 0 or 1 to select the AHBAPB peripheral
-* Output : None
-* Return : The Peropheral address error
-*******************************************************************************/
-u32 AHBAPB_GetPeriphAddrError(AHBAPB_TypeDef* AHBAPBx)
-{
- u32 AHBAPB_Address = 0x00000000;
-
- /*Return Oeripheral address without RW bit*/
- AHBAPB_Address = (AHBAPBx->PAER)& AHBAPB_Address_Mask;
- return (AHBAPB_Address);
-}
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_template91x/str91x_lib/src/91x_can.c b/uc_str912/prj_template91x/str91x_lib/src/91x_can.c
deleted file mode 100644
index e560d03..0000000
--- a/uc_str912/prj_template91x/str91x_lib/src/91x_can.c
+++ /dev/null
@@ -1,768 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_can.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the CAN software functions.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_can.h"
-#include "91x_scu.h"
-
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-/* Private macro -------------------------------------------------------------*/
-/*----------------------------------------------------------------------------*/
-/* Macro Name : xxx_ID_MSK, xxx_ID_ARB */
-/* Description : Form the Mask and Arbitration registers value to filter */
-/* a range of identifiers or a fixed identifier, for standard*/
-/* and extended IDs */
-/*----------------------------------------------------------------------------*/
-#define RANGE_ID_MSK(range_start, range_end) (~((range_end) - (range_start)))
-#define RANGE_ID_ARB(range_start, range_end) ((range_start) & (range_end))
-
-#define FIXED_ID_MSK(id) RANGE_ID_MSK((id), (id))
-#define FIXED_ID_ARB(id) RANGE_ID_ARB((id), (id))
-
-#define STD_RANGE_ID_MSK(range_start, range_end) ((u16)((RANGE_ID_MSK((range_start), (range_end)) & 0x7FF) << 2))
-#define STD_RANGE_ID_ARB(range_start, range_end) ((u16)(RANGE_ID_ARB((range_start), (range_end)) << 2))
-
-#define STD_FIXED_ID_MSK(id) ((u16)((FIXED_ID_MSK(id) & 0x7FF) << 2))
-#define STD_FIXED_ID_ARB(id) ((u16)(FIXED_ID_ARB(id) << 2))
-
-#define EXT_RANGE_ID_MSK_L(range_start, range_end) ((u16)(RANGE_ID_MSK((range_start), (range_end)) >> 11))
-#define EXT_RANGE_ID_MSK_H(range_start, range_end) ((u16)(STD_RANGE_ID_MSK((range_start), (range_end)) | ((RANGE_ID_MSK((range_start), (range_end)) >> 27) & 0x03)))
-#define EXT_RANGE_ID_ARB_L(range_start, range_end) ((u16)(RANGE_ID_ARB((range_start), (range_end)) >> 11))
-#define EXT_RANGE_ID_ARB_H(range_start, range_end) ((u16)(STD_RANGE_ID_ARB((range_start), (range_end)) | ((RANGE_ID_ARB((range_start), (range_end)) >> 27) & 0x03)))
-
-#define EXT_FIXED_ID_MSK_L(id) ((u16)(FIXED_ID_MSK(id) >> 11))
-#define EXT_FIXED_ID_MSK_H(id) ((u16)(STD_FIXED_ID_MSK(id) | ((FIXED_ID_MSK(id) >> 27) & 0x03)))
-#define EXT_FIXED_ID_ARB_L(id) ((u16)(FIXED_ID_ARB(id) >> 11))
-#define EXT_FIXED_ID_ARB_H(id) ((u16)(STD_FIXED_ID_ARB(id) | ((FIXED_ID_ARB(id) >> 27) & 0x03)))
-
-/* macro to format the timing register value from the timing parameters*/
-#define CAN_TIMING(tseg1, tseg2, sjw, brp) ((((tseg2-1) & 0x07) << 12) | (((tseg1-1) & 0x0F) << 8) | (((sjw-1) & 0x03) << 6) | ((brp-1) & 0x3F))
-
-/* Private variables ---------------------------------------------------------*/
-/* array of pre-defined timing parameters for standard bitrates*/
-u16 CanTimings[] = { /* value bitrate NTQ TSEG1 TSEG2 SJW BRP */
- CAN_TIMING(11, 4, 4, 5), /* 0x3AC4 100 kbit/s 16 11 4 4 5 */
- CAN_TIMING(11, 4, 4, 4), /* 0x3AC3 125 kbit/s 16 11 4 4 4 */
- CAN_TIMING( 4, 3, 3, 4), /* 0x2383 250 kbit/s 8 4 3 3 4 */
- CAN_TIMING(13, 2, 1, 1), /* 0x1C00 500 kbit/s 16 13 2 1 1 */
- CAN_TIMING( 4, 3, 1, 1), /* 0x2300 1 Mbit/s 8 4 3 1 1 */
-};
-
-/* Private function prototypes -----------------------------------------------*/
-static u32 GetFreeIF(void);
-/* Private functions ---------------------------------------------------------*/
-
-/*******************************************************************************
-* Function Name : CAN_DeInit
-* Description : Deinitializes the CAN peripheral registers to their default
-* reset values.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void CAN_DeInit (void)
-{
- /* Reset the CAN registers values*/
-
- SCU_APBPeriphReset(__CAN,ENABLE); /*CAN peripheral is under Reset */
- SCU_APBPeriphReset(__CAN,DISABLE); /*CAN peripheral Reset off*/
-
-
-}
-
-/*******************************************************************************
-* Function Name : CAN_Init
-* Description : Initializes the CAN peripheral according to the specified
-* parameters in the CAN_InitStruct.
-* Input : CAN_InitStruct: pointer to a CAN_InitTypeDef structure that
-* contains the configuration information for the CAN peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void CAN_Init(CAN_InitTypeDef* CAN_InitStruct)
-{
- CAN_EnterInitMode(CAN_CR_CCE | CAN_InitStruct->CAN_ConfigParameters);
- CAN_SetBitrate(CAN_InitStruct->CAN_Bitrate);
- CAN_LeaveInitMode();
- CAN_LeaveTestMode();
-}
-
-/*******************************************************************************
-* Function Name : CAN_StructInit
-* Description : Fills each CAN_InitStruct member with its reset value.
-* Input : CAN_InitStruct : pointer to a CAN_InitTypeDef structure which
-* will be initialized.
-* Output : None
-* Return : None.
-*******************************************************************************/
-void CAN_StructInit(CAN_InitTypeDef* CAN_InitStruct)
-{
-/* Reset CAN init structure parameters values */
- CAN_InitStruct->CAN_ConfigParameters = 0x0;
- CAN_InitStruct->CAN_Bitrate = 0x2301;
-}
-
-/*******************************************************************************
-* Function Name : CAN_SetBitrate
-* Description : Setups a standard CAN bitrate.
-* Input : bitrate: specifies the bit rate.
-* Output : None
-* Return : None
-*******************************************************************************/
-void CAN_SetBitrate(u32 bitrate)
-{
- CAN->BTR = CanTimings[bitrate]; /* write the predefined timing value */
- CAN->BRPR = 0; /* clear the Extended Baud Rate Prescaler */
-}
-
-/*******************************************************************************
-* Function Name : CAN_SetTiming
-* Description : Setups the CAN timing with specific parameters
-* Input : - tseg1: specifies Time Segment before the sample point.
-* This parameter must be a number between 1 and 16.
-* - tseg2: Time Segment after the sample point. This parameter
-* must be a number between 1 and 8.
-* - sjw: Synchronisation Jump Width. This parameter must be
-* a number between 1 and 4.
-* - brp: Baud Rate Prescaler. This parameter must be a number
-* between 1 and 1024.
-* Output : None
-* Return : None
-*******************************************************************************/
-void CAN_SetTiming(u32 tseg1, u32 tseg2, u32 sjw, u32 brp)
-{
- CAN->BTR = CAN_TIMING(tseg1, tseg2, sjw, brp);
- CAN->BRPR = ((brp-1) >> 6) & 0x0F;
-}
-
-/*******************************************************************************
-* Function Name : GetFreeIF
-* Description : Searchs the first free message interface, starting from 0.
-* Input : None
-* Output : None
-* Return : A free message interface number (0 or 1) if found, else 2
-*******************************************************************************/
-static u32 GetFreeIF(void)
-{
- if ((CAN->sMsgObj[0].CRR & CAN_CRR_BUSY) == 0)
- return 0;
- else if ((CAN->sMsgObj[1].CRR & CAN_CRR_BUSY) == 0)
- return 1;
- else
- return 2;
-}
-
-/*******************************************************************************
-* Function Name : CAN_SetUnusedMsgObj
-* Description : Configures the message object as unused
-* Input : msgobj: specifies the Message object number, from 0 to 31.
-* Output : None
-* Return : An ErrorStatus enumuration value:
-* - SUCCESS: Interface to treat the message
-* - ERROR: No interface to treat the message
-*******************************************************************************/
-ErrorStatus CAN_SetUnusedMsgObj(u32 msgobj)
-{
- u32 msg_if=0;
-
- if ((msg_if = GetFreeIF()) == 2)
- {
- return ERROR;
- }
-
- CAN->sMsgObj[msg_if].CMR = CAN_CMR_WRRD
- | CAN_CMR_MASK
- | CAN_CMR_ARB
- | CAN_CMR_CONTROL
- | CAN_CMR_DATAA
- | CAN_CMR_DATAB;
-
- CAN->sMsgObj[msg_if].M1R = 0;
- CAN->sMsgObj[msg_if].M2R = 0;
-
- CAN->sMsgObj[msg_if].A1R = 0;
- CAN->sMsgObj[msg_if].A2R = 0;
-
- CAN->sMsgObj[msg_if].MCR = 0;
-
- CAN->sMsgObj[msg_if].DA1R = 0;
- CAN->sMsgObj[msg_if].DA2R = 0;
- CAN->sMsgObj[msg_if].DB1R = 0;
- CAN->sMsgObj[msg_if].DB2R = 0;
-
- CAN->sMsgObj[msg_if].CRR = 1 + msgobj;
-
- return SUCCESS;
-}
-
-/*******************************************************************************
-* Function Name : CAN_SetTxMsgObj
-* Description : Configures the message object as TX.
-* Input : - msgobj: specifies the Message object number, from 0 to 31.
-* - idType: specifies the identifier type of the frames that
-* will be transmitted using this message object.
-* This parameter can be one of the following values:
-* - CAN_STD_ID (standard ID, 11-bit)
-* - CAN_EXT_ID (extended ID, 29-bit)
-* Output : None
-* Return : An ErrorStatus enumuration value:
-* - SUCCESS: Interface to treat the message
-* - ERROR: No interface to treat the message
-*******************************************************************************/
-ErrorStatus CAN_SetTxMsgObj(u32 msgobj, u32 idType)
-{
- u32 msg_if=0;
-
- if ((msg_if = GetFreeIF()) == 2)
- {
- return ERROR;
- }
-
- CAN->sMsgObj[msg_if].CMR = CAN_CMR_WRRD
- | CAN_CMR_MASK
- | CAN_CMR_ARB
- | CAN_CMR_CONTROL
- | CAN_CMR_DATAA
- | CAN_CMR_DATAB;
-
- CAN->sMsgObj[msg_if].M1R = 0;
- CAN->sMsgObj[msg_if].A1R = 0;
-
- if (idType == CAN_STD_ID)
- {
- CAN->sMsgObj[msg_if].M2R = CAN_M2R_MDIR;
- CAN->sMsgObj[msg_if].A2R = CAN_A2R_MSGVAL | CAN_A2R_DIR;
- }
- else
- {
- CAN->sMsgObj[msg_if].M2R = CAN_M2R_MDIR | CAN_M2R_MXTD;
- CAN->sMsgObj[msg_if].A2R = CAN_A2R_MSGVAL | CAN_A2R_DIR | CAN_A2R_XTD;
- }
-
- CAN->sMsgObj[msg_if].MCR = CAN_MCR_TXIE | CAN_MCR_EOB;
-
- CAN->sMsgObj[msg_if].DA1R = 0;
- CAN->sMsgObj[msg_if].DA2R = 0;
- CAN->sMsgObj[msg_if].DB1R = 0;
- CAN->sMsgObj[msg_if].DB2R = 0;
-
- CAN->sMsgObj[msg_if].CRR = 1 + msgobj;
-
- return SUCCESS;
-}
-
-/*******************************************************************************
-* Function Name : CAN_SetRxMsgObj
-* Description : Configures the message object as RX.
-* Input : - msgobj: specifies the Message object number, from 0 to 31.
-* - idType: specifies the identifier type of the frames that
-* will be transmitted using this message object.
-* This parameter can be one of the following values:
-* - CAN_STD_ID (standard ID, 11-bit)
-* - CAN_EXT_ID (extended ID, 29-bit)
-* - idLow: specifies the low part of the identifier range used
-* for acceptance filtering.
-* - idHigh: specifies the high part of the identifier range
-* used for acceptance filtering.
-* - singleOrFifoLast: specifies the end-of-buffer indicator.
-* This parameter can be one of the following values:
-* - TRUE: for a single receive object or a FIFO receive
-* object that is the last one of the FIFO.
-* - FALSE: for a FIFO receive object that is not the
-* last one.
-* Output : None
-* Return : An ErrorStatus enumuration value:
-* - SUCCESS: Interface to treat the message
-* - ERROR: No interface to treat the message
-*******************************************************************************/
-ErrorStatus CAN_SetRxMsgObj(u32 msgobj, u32 idType, u32 idLow, u32 idHigh, bool singleOrFifoLast)
-{
- u32 msg_if=0;
-
- if ((msg_if = GetFreeIF()) == 2)
- {
- return ERROR;
- }
-
- CAN->sMsgObj[msg_if].CMR = CAN_CMR_WRRD
- | CAN_CMR_MASK
- | CAN_CMR_ARB
- | CAN_CMR_CONTROL
- | CAN_CMR_DATAA
- | CAN_CMR_DATAB;
-
- if (idType == CAN_STD_ID)
- {
- CAN->sMsgObj[msg_if].M1R = 0;
- CAN->sMsgObj[msg_if].M2R = STD_RANGE_ID_MSK(idLow, idHigh);
-
- CAN->sMsgObj[msg_if].A1R = 0;
- CAN->sMsgObj[msg_if].A2R = CAN_A2R_MSGVAL | STD_RANGE_ID_ARB(idLow, idHigh);
- }
- else
- {
- CAN->sMsgObj[msg_if].M1R = EXT_RANGE_ID_MSK_L(idLow, idHigh);
- CAN->sMsgObj[msg_if].M2R = CAN_M2R_MXTD | EXT_RANGE_ID_MSK_H(idLow, idHigh);
-
- CAN->sMsgObj[msg_if].A1R = EXT_RANGE_ID_ARB_L(idLow, idHigh);
- CAN->sMsgObj[msg_if].A2R = CAN_A2R_MSGVAL | CAN_A2R_XTD | EXT_RANGE_ID_ARB_H(idLow, idHigh);
- }
-
- CAN->sMsgObj[msg_if].MCR = CAN_MCR_RXIE | CAN_MCR_UMASK | (singleOrFifoLast ? CAN_MCR_EOB : 0);
-
- CAN->sMsgObj[msg_if].DA1R = 0;
- CAN->sMsgObj[msg_if].DA2R = 0;
- CAN->sMsgObj[msg_if].DB1R = 0;
- CAN->sMsgObj[msg_if].DB2R = 0;
-
- CAN->sMsgObj[msg_if].CRR = 1 + msgobj;
-
- return SUCCESS;
-}
-
-/*******************************************************************************
-* Function Name : CAN_InvalidateAllMsgObj
-* Description : Configures all the message objects as unused.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void CAN_InvalidateAllMsgObj(void)
-{
- u32 i=0;
- for (i = 0; i < 32; i++)
- CAN_SetUnusedMsgObj(i);
-}
-
-
-/*******************************************************************************
-* Function Name : CAN_ReleaseMessage
-* Description : Releases the message object
-* Input : - msgobj: specifies the Message object number, from 0 to 31.
-* Output : None
-* Return : An ErrorStatus enumuration value:
-* - SUCCESS: Interface to treat the message
-* - ERROR: No interface to treat the message
-*******************************************************************************/
-ErrorStatus CAN_ReleaseMessage(u32 msgobj)
-{
- u32 msg_if=0;
-
- if ((msg_if = GetFreeIF()) == 2)
- {
- return ERROR;
- }
-
- CAN->sMsgObj[msg_if].CMR = CAN_CMR_CLRINTPND | CAN_CMR_TXRQSTNEWDAT;
- CAN->sMsgObj[msg_if].CRR = 1 + msgobj;
-
- return SUCCESS;
-}
-
-/*******************************************************************************
-* Function Name : CAN_SendMessage
-* Description : Start transmission of a message
-* Input : - msgobj: specifies the Message object number, from 0 to 31.
-* : - pCanMsg: pointer to the message structure containing data
-* to transmit.
-* Output : None
-* Return : An ErrorStatus enumuration value:
-* - SUCCESS: Transmission OK
-* - ERROR: No transmission
-*******************************************************************************/
-ErrorStatus CAN_SendMessage(u32 msgobj, canmsg* pCanMsg)
-{
- if (CAN->sMsgObj[0].CRR & CAN_CRR_BUSY)
- {
- return ERROR;
- }
-
- CAN->SR &= ~CAN_SR_TXOK;
-
- /* read the Arbitration and Message Control*/
- CAN->sMsgObj[0].CMR = CAN_CMR_ARB | CAN_CMR_CONTROL;
-
- CAN->sMsgObj[0].CRR = 1 + msgobj;
-
- if (CAN->sMsgObj[0].CRR & CAN_CRR_BUSY)
- {
- return ERROR;
- }
-
- /* update the contents needed for transmission*/
- CAN->sMsgObj[0].CMR = CAN_CMR_WRRD
- | CAN_CMR_ARB
- | CAN_CMR_CONTROL
- | CAN_CMR_DATAA
- | CAN_CMR_DATAB;
-
- if ((CAN->sMsgObj[0].A2R & CAN_A2R_XTD) == 0)
- {
- /* standard ID*/
- CAN->sMsgObj[0].A1R = 0;
- CAN->sMsgObj[0].A2R = (CAN->sMsgObj[0].A2R & 0xE000) | STD_FIXED_ID_ARB(pCanMsg->Id);
- }
- else
- {
- /* extended ID*/
- CAN->sMsgObj[0].A1R = EXT_FIXED_ID_ARB_L(pCanMsg->Id);
- CAN->sMsgObj[0].A2R = (CAN->sMsgObj[0].A2R & 0xE000) | EXT_FIXED_ID_ARB_H(pCanMsg->Id);
- }
-
- CAN->sMsgObj[0].MCR = (CAN->sMsgObj[0].MCR & 0xFEF0) | CAN_MCR_NEWDAT | CAN_MCR_TXRQST | pCanMsg->Dlc;
-
- CAN->sMsgObj[0].DA1R = ((u16)pCanMsg->Data[1]<<8) | pCanMsg->Data[0];
- CAN->sMsgObj[0].DA2R = ((u16)pCanMsg->Data[3]<<8) | pCanMsg->Data[2];
- CAN->sMsgObj[0].DB1R = ((u16)pCanMsg->Data[5]<<8) | pCanMsg->Data[4];
- CAN->sMsgObj[0].DB2R = ((u16)pCanMsg->Data[7]<<8) | pCanMsg->Data[6];
-
- CAN->sMsgObj[0].CRR = 1 + msgobj;
-
- return SUCCESS;
-}
-
-/*******************************************************************************
-* Function Name : CAN_ReceiveMessage
-* Description : Gets the message, if received.
-* Input : - msgobj: specifies the Message object number, from 0 to 31.
-* - release: specifies the message release indicator.
-* This parameter can be one of the following values:
-* - TRUE: the message object is released when getting
-* the data.
-* - FALSE: the message object is not released.
-* - pCanMsg: pointer to the message structure where received
-* data is copied.
-* Output : None
-* Return : An ErrorStatus enumuration value:
-* - SUCCESS: Reception OK
-* - ERROR: No message pending
-*******************************************************************************/
-ErrorStatus CAN_ReceiveMessage(u32 msgobj, bool release, canmsg* pCanMsg)
-{
- if (!CAN_IsMessageWaiting(msgobj))
- {
- return ERROR;
- }
-
- CAN->SR &= ~CAN_SR_RXOK;
-
- /* read the message contents*/
- CAN->sMsgObj[1].CMR = CAN_CMR_MASK
- | CAN_CMR_ARB
- | CAN_CMR_CONTROL
- | CAN_CMR_CLRINTPND
- | (release ? CAN_CMR_TXRQSTNEWDAT : 0)
- | CAN_CMR_DATAA
- | CAN_CMR_DATAB;
-
- CAN->sMsgObj[1].CRR = 1 + msgobj;
-
- if (CAN->sMsgObj[1].CRR & CAN_CRR_BUSY)
- {
- return ERROR;
- }
-
- if ((CAN->sMsgObj[1].A2R & CAN_A2R_XTD) == 0)
- {
- /* standard ID*/
- pCanMsg->IdType = CAN_STD_ID;
- pCanMsg->Id = (CAN->sMsgObj[1].A2R >> 2) & 0x07FF;
- }
- else
- {
- /* extended ID*/
- pCanMsg->IdType = CAN_EXT_ID;
- pCanMsg->Id = ((CAN->sMsgObj[1].A2R >> 2) & 0x07FF);
- pCanMsg->Id |= ((u32)CAN->sMsgObj[1].A1R << 11);
- pCanMsg->Id |= (((u32)CAN->sMsgObj[1].A2R & 0x0003) << 27);
- }
-
- pCanMsg->Dlc = CAN->sMsgObj[1].MCR & 0x0F;
-
- pCanMsg->Data[0] = (u8) CAN->sMsgObj[1].DA1R;
- pCanMsg->Data[1] = (u8)(CAN->sMsgObj[1].DA1R >> 8);
- pCanMsg->Data[2] = (u8) CAN->sMsgObj[1].DA2R;
- pCanMsg->Data[3] = (u8)(CAN->sMsgObj[1].DA2R >> 8);
- pCanMsg->Data[4] = (u8) CAN->sMsgObj[1].DB1R;
- pCanMsg->Data[5] = (u8)(CAN->sMsgObj[1].DB1R >> 8);
- pCanMsg->Data[6] = (u8) CAN->sMsgObj[1].DB2R;
- pCanMsg->Data[7] = (u8)(CAN->sMsgObj[1].DB2R >> 8);
-
- return SUCCESS;
-}
-
-/*******************************************************************************
-* Function Name : CAN_WaitEndOfTx
-* Description : Waits until current transmission is finished.
-* Input : None
-* Output : None
-* Return : An ErrorStatus enumuration value:
-* - SUCCESS: Transmission ended
-* - ERROR: Transmission did not occur yet
-*******************************************************************************/
-ErrorStatus CAN_WaitEndOfTx(void)
-{
- if ((CAN->SR & CAN_SR_TXOK) == 0)
- {
- return ERROR;
- }
- CAN->SR &= ~CAN_SR_TXOK;
-
- return SUCCESS;
-}
-
-/*******************************************************************************
-* Function Name : CAN_BasicSendMessage
-* Description : Starts transmission of a message in BASIC mode. This mode
-* does not use the message RAM.
-* Input : pCanMsg: Pointer to the message structure containing data to
-* transmit.
-* Output : None
-* Return : An ErrorStatus enumuration value:
-* - SUCCESS: Transmission OK
-* - ERROR: No transmission
-*******************************************************************************/
-ErrorStatus CAN_BasicSendMessage(canmsg* pCanMsg)
-{
- /* clear NewDat bit in IF2 to detect next reception*/
- CAN->sMsgObj[1].MCR &= ~CAN_MCR_NEWDAT;
-
- CAN->SR &= ~CAN_SR_TXOK;
- CAN->sMsgObj[0].CMR = CAN_CMR_WRRD
- | CAN_CMR_ARB
- | CAN_CMR_CONTROL
- | CAN_CMR_DATAA
- | CAN_CMR_DATAB;
-
- if (pCanMsg->IdType == CAN_STD_ID)
- {
- /* standard ID*/
- CAN->sMsgObj[0].A1R = 0;
- CAN->sMsgObj[0].A2R = (CAN->sMsgObj[0].A2R & 0xE000) | STD_FIXED_ID_ARB(pCanMsg->Id);
- }
- else
- {
- /* extended ID*/
- CAN->sMsgObj[0].A1R = EXT_FIXED_ID_ARB_L(pCanMsg->Id);
- CAN->sMsgObj[0].A2R = ((CAN->sMsgObj[0].A2R) & 0xE000) | EXT_FIXED_ID_ARB_H(pCanMsg->Id);
- }
-
- CAN->sMsgObj[0].MCR = (CAN->sMsgObj[0].MCR & 0xFCF0) | pCanMsg->Dlc;
-
- CAN->sMsgObj[0].DA1R = ((u16)pCanMsg->Data[1]<<8) | pCanMsg->Data[0];
- CAN->sMsgObj[0].DA2R = ((u16)pCanMsg->Data[3]<<8) | pCanMsg->Data[2];
- CAN->sMsgObj[0].DB1R = ((u16)pCanMsg->Data[5]<<8) | pCanMsg->Data[4];
- CAN->sMsgObj[0].DB2R = ((u16)pCanMsg->Data[7]<<8) | pCanMsg->Data[6];
-
- /* request transmission*/
- if (CAN->sMsgObj[0].CRR == CAN_CRR_BUSY )
- {
- return ERROR;
- }
-
- return SUCCESS;
-}
-
-/*******************************************************************************
-* Function Name : CAN_BasicReceiveMessage
-* Description : Gets the message in BASIC mode, if received. This mode does
-* not use the message RAM.
-* Input : pCanMsg: pointer to the message structure where message is copied.
-* Output : None
-* Return : An ErrorStatus enumuration value:
-* - SUCCESS: Reception OK
-* - ERROR: No message pending
-*******************************************************************************/
-ErrorStatus CAN_BasicReceiveMessage(canmsg* pCanMsg)
-{
- if ((CAN->sMsgObj[1].MCR & CAN_MCR_NEWDAT) == 0)
- {
- return ERROR;
- }
-
- CAN->SR &= ~CAN_SR_RXOK;
-
- CAN->sMsgObj[1].CMR = CAN_CMR_ARB
- | CAN_CMR_CONTROL
- | CAN_CMR_DATAA
- | CAN_CMR_DATAB;
-
- if ((CAN->sMsgObj[1].A2R & CAN_A2R_XTD) == 0)
- {
- /* standard ID*/
- pCanMsg->IdType = CAN_STD_ID;
- pCanMsg->Id = (CAN->sMsgObj[1].A2R >> 2) & 0x07FF;
- }
- else
- {
- /* extended ID*/
- pCanMsg->IdType = CAN_EXT_ID;
- pCanMsg->Id = ((CAN->sMsgObj[1].A2R >> 2) & 0x07FF);
- pCanMsg->Id |= ((u32)CAN->sMsgObj[1].A1R << 11);
- pCanMsg->Id |= (((u32)CAN->sMsgObj[1].A2R & 0x0003) << 27);
- }
-
- pCanMsg->Dlc = CAN->sMsgObj[1].MCR & 0x0F;
-
- pCanMsg->Data[0] = (u8) CAN->sMsgObj[1].DA1R;
- pCanMsg->Data[1] = (u8)(CAN->sMsgObj[1].DA1R >> 8);
- pCanMsg->Data[2] = (u8) CAN->sMsgObj[1].DA2R;
- pCanMsg->Data[3] = (u8)(CAN->sMsgObj[1].DA2R >> 8);
- pCanMsg->Data[4] = (u8) CAN->sMsgObj[1].DB1R;
- pCanMsg->Data[5] = (u8)(CAN->sMsgObj[1].DB1R >> 8);
- pCanMsg->Data[6] = (u8) CAN->sMsgObj[1].DB2R;
- pCanMsg->Data[7] = (u8)(CAN->sMsgObj[1].DB2R >> 8);
-
- return SUCCESS;
-}
-
-/*******************************************************************************
-* Function Name : CAN_EnterInitMode
-* Description : Switchs the CAN into initialization mode. This function must
-* be used in conjunction with CAN_LeaveInitMode().
-* Input : InitMask: specifies the CAN configuration in normal mode.
-* Output : None
-* Return : None
-*******************************************************************************/
-void CAN_EnterInitMode(u8 InitMask)
-{
- CAN->CR = InitMask | CAN_CR_INIT;
- CAN->SR = 0; /* reset the status*/
-}
-
-/*******************************************************************************
-* Function Name : CAN_LeaveInitMode
-* Description : Leaves the initialization mode (switch into normal mode).
-* This function must be used in conjunction with CAN_EnterInitMode().
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void CAN_LeaveInitMode(void)
-{
- CAN->CR &= ~(CAN_CR_INIT | CAN_CR_CCE);
-}
-
-/*******************************************************************************
-* Function Name : CAN_EnterTestMode
-* Description : Switchs the CAN into test mode. This function must be used in
-* conjunction with CAN_LeaveTestMode().
-* Input : TestMask: specifies the configuration in test modes.
-* Output : None
-* Return : None
-*******************************************************************************/
-void CAN_EnterTestMode(u8 TestMask)
-{
- CAN->CR |= CAN_CR_TEST;
- CAN->TESTR |= TestMask;
-}
-
-/*******************************************************************************
-* Function Name : CAN_LeaveTestMode
-* Description : Leaves the current test mode (switch into normal mode).
-* This function must be used in conjunction with CAN_EnterTestMode().
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void CAN_LeaveTestMode(void)
-{
- CAN->CR |= CAN_CR_TEST;
- CAN->TESTR &= ~(CAN_TESTR_LBACK | CAN_TESTR_SILENT | CAN_TESTR_BASIC);
- CAN->CR &= ~CAN_CR_TEST;
-}
-
-/*******************************************************************************
-* Function Name : CAN_ReleaseTxMessage
-* Description : Releases the transmit message object.
-* Input : - msgobj: specifies the Message object number, from 0 to 31.
-* Output : None
-* Return : None
-*******************************************************************************/
-void CAN_ReleaseTxMessage(u32 msgobj)
-{
- CAN->sMsgObj[0].CMR = CAN_CMR_CLRINTPND | CAN_CMR_TXRQSTNEWDAT;
- CAN->sMsgObj[0].CRR = 1 + msgobj;
-}
-
-/*******************************************************************************
-* Function Name : CAN_ReleaseRxMessage
-* Description : Releases the receive message object.
-* Input : - msgobj: specifies the Message object number, from 0 to 31.
-* Output : None
-* Return : None
-*******************************************************************************/
-void CAN_ReleaseRxMessage(u32 msgobj)
-{
- CAN->sMsgObj[1].CMR = CAN_CMR_CLRINTPND | CAN_CMR_TXRQSTNEWDAT;
- CAN->sMsgObj[1].CRR = 1 + msgobj;
-}
-
-/*******************************************************************************
-* Function Name : CAN_IsMessageWaiting
-* Description : Tests the waiting status of a received message.
-* Input : - msgobj: specifies the Message object number, from 0 to 31.
-* Output : None
-* Return : A non-zero value if the corresponding message object has
-* received a message waiting to be copied, else 0.
-*******************************************************************************/
-u32 CAN_IsMessageWaiting(u32 msgobj)
-{
- return (msgobj < 16 ? CAN->ND1R & (1 << msgobj) : CAN->ND2R & (1 << (msgobj-16)));
-}
-
-/*******************************************************************************
-* Function Name : CAN_IsTransmitRequested
-* Description : Tests the request status of a transmitted message.
-* Input : - msgobj: specifies the Message object number, from 0 to 31.
-* Output : None
-* Return : A non-zero value if the corresponding message is requested
-* to transmit, else 0.
-*******************************************************************************/
-u32 CAN_IsTransmitRequested(u32 msgobj)
-{
- return (msgobj < 16 ? CAN->TXR1R & (1 << msgobj) : CAN->TXR2R & (1 << (msgobj-16)));
-}
-
-/*******************************************************************************
-* Function Name : CAN_IsInterruptPending
-* Description : Tests the interrupt status of a message object.
-* Input : - msgobj: specifies the Message object number, from 0 to 31.
-* Output : None
-* Return : A non-zero value if the corresponding message has an
-* interrupt pending, else 0.
-*******************************************************************************/
-u32 CAN_IsInterruptPending(u32 msgobj)
-{
- return (msgobj < 16 ? CAN->IP1R & (1 << msgobj) : CAN->IP2R & (1 << (msgobj-16)));
-}
-
-/*******************************************************************************
-* Function Name : CAN_IsObjectValid
-* Description : Tests the validity of a message object (ready to use).
-* Input : - msgobj: specifies the Message object number, from 0 to 31.
-* Output : None
-* Return : A non-zero value if the corresponding message object is
-* valid, else 0.
-*******************************************************************************/
-u32 CAN_IsObjectValid(u32 msgobj)
-{
- return (msgobj < 16 ? CAN->MV1R & (1 << msgobj) : CAN->MV2R & (1 << (msgobj-16)));
-}
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_template91x/str91x_lib/src/91x_dma.c b/uc_str912/prj_template91x/str91x_lib/src/91x_dma.c
deleted file mode 100644
index db6ad6e..0000000
--- a/uc_str912/prj_template91x/str91x_lib/src/91x_dma.c
+++ /dev/null
@@ -1,1125 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_dma.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the DMA software functions
-* needed to access all DMA registers.
-********************************************************************************
-* History:v 1.0
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-
-# include"91x_dma.h"
-# include"91x_scu.h"
-
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-
-
-/* DMA Masks "used" only in this module */
-
-#define DMA_Width_DES_MASK 0xFF1FFFFF
-#define DMA_Width_SRC_MASK 0xFFE3FFFF
-#define DMA_Bst_DES_MASK 0xFFFC7FFF
-#define DMA_Bst_SRC_MASK 0xFFFF8FFF
-#define DMA_FlowCntrl_Mask 0xFFFFC7FF
-#define DMA_TrsfSisze_Mask 0xFFFFF000
-#define SRC_Mask 0xFFFFFFE1
-#define DES_Mask 0xFFFFFC3F
-#define DMA_TCIE 0x80000000
-#define DMA_ChannelDESInc 0x08000000
-#define DMA_ChannelSRCInc 0x04000000
-#define DMA_BufferChannel 0x20000000
-#define DMA_HaltChannel 0x00040000
-#define DMA_LockChannel 0x00010000
-#define DMA_CacheChannel 0x40000000
-#define DMA_ChannelActive 0x00020000
-#define DMA_Enable 0x00000001
-#define DMA_ChannelEnable 0x00000001
-
-
-
-
-/* Private function prototypes -----------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-
-/*******************************************************************************
-* Function Name : DMA_ITMaskConfig
-* Description : Enables or disables the specified DMA_Channelx Mask interrupt.
-* Input :
-* -DMA_Channelx: where x can be 0,1,2,3,4,5,6,or 7 to select the DMA Channel.
-* -DMA_ITMask: specifies the DMA interrupt mask source to be enabled or disabled.
-* This parameter can be:
-* - DMA_ITMask_IE (Interrupt error mask).
-* - DMA_ITMask_ITC (Terminal count interrupt mask).
-* - DMA_ITMask_ALL ( All interrupts mask)
-*
-* -NewState: new state of the specified DMA_Channelx mask interrupt.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-
-void DMA_ITMaskConfig(DMA_Channel_TypeDef * DMA_Channelx, u16 DMA_ITMask , FunctionalState NewState)
-
-{
- if (NewState==ENABLE) /* Mask the Interrupt */
- {
- DMA_Channelx-> CCNF |= DMA_ITMask ;
- }
-
- else /* Disable the Interrupt Mask*/
- {
- DMA_Channelx-> CCNF &= ~ DMA_ITMask ;
- }
-}
-
-
-
-
-
-/*******************************************************************************
-* Function Name : DMA_ITConfig
-* Description : Enables or disables the DMA_Channelx Terminal Count interrupt.
-* Input :
-* -DMA_Channelx: where x can be 0,1,2,3,4,5,6,or 7 to select the DMA Channel.
-* -NewState: new state of the specified DMA_Channelx mask interrupt.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-
-void DMA_ITConfig(DMA_Channel_TypeDef * DMA_Channelx, FunctionalState NewState)
-
-{
- if (NewState==ENABLE) /* Enable the Terminal Count Interrupt */
- {
- DMA_Channelx->CC |= DMA_TCIE ;
- }
-
- else /* Disable the Terminal Count Interrupt */
- {
- DMA_Channelx-> CC &= ~ DMA_TCIE ;
- }
-}
-
-
-/********************************************************************************
-* Function Name : DMA_SyncConfig
-* Description : Enables or disables synchronization logic for the corresponding DMA Request Signal.
-* Input :
-* -SRCReq:specifies the DMA Request Source.
-* This parameter can be:
-* -DMA_USB_RX_Mask
-* -DMA_USB_TX_Mask
-* -DMA_TIM0_Mask
-* -DMA_TIM1_Mask
-* -DMA_UART0_RX_Mask
-* -DMA_UART0_TX_Mask
-* -DMA_UART1_RX_Mask
-* -DMA_UART1_TX_Mask
-* -DMA_External_Req0_Mask
-* -DMA_External_Req1_Mask
-* -DMA_I2C0_Mask
-* -DMA_I2C1_Mask
-* -DMA_SSP0_RX_Mask
-* -DMA_SSP0_TX_Mask
-* -DMA_SSP1_RX_Mask
-* -DMA_SSP1_TX_Mask
-*
-* -NewState: new state of the specified DMA_Channelx mask interrupt.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-
-void DMA_SyncConfig(u16 SRCReq, FunctionalState NewState)
-
-{
- if (NewState==ENABLE) /* Enable the synchronization logic for the corresponding DMA Request Signal */
- {
-
- DMA->SYNR &= ~ SRCReq ;
-
- }
-
- else /* Disable the synchronization logic for the corresponding DMA Request Signal. */
- {
- DMA->SYNR |= SRCReq ;
-
- }
-}
-
-
-/********************************************************************************
-* Function Name : DMA_SetSReq
-* Description : Set the DMA to generate a Single transfer request for the corresponding DMA Request Source.
-* Input :
-* -SRCReq:specifies the DMA Request Source.
-* This parameter can be:
-* -DMA_USB_RX_Mask
-* -DMA_USB_TX_Mask
-* -DMA_TIM0_Mask
-* -DMA_TIM1_Mask
-* -DMA_UART0_RX_Mask
-* -DMA_UART0_TX_Mask
-* -DMA_UART1_RX_Mask
-* -DMA_UART1_TX_Mask
-* -DMA_External_Req0_Mask
-* -DMA_External_Req1_Mask
-* -DMA_I2C0_Mask
-* -DMA_I2C1_Mask
-* -DMA_SSP0_RX_Mask
-* -DMA_SSP0_TX_Mask
-* -DMA_SSP1_RX_Mask
-* -DMA_SSP1_TX_Mask
-*
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-
-void DMA_SetSReq(u16 SRCReq)
-
-{ /* Set the DMA to generate a Single transfer request for the corresponding DMA Request Source */
- DMA->SSRR |= SRCReq ;
-}
-
-
-
-
-/********************************************************************************
-* Function Name : DMA_SetLSReq
-* Description : Set the DMA to generate a Last Single transfer request for the corresponding DMA Request Source.
-* Input :
-* -SRCReq:specifies the DMA Request Source.
-* This parameter can be:
-* -DMA_USB_RX_Mask
-* -DMA_USB_TX_Mask
-* -DMA_TIM0_Mask
-* -DMA_TIM1_Mask
-* -DMA_UART0_RX_Mask
-* -DMA_UART0_TX_Mask
-* -DMA_UART1_RX_Mask
-* -DMA_UART1_TX_Mask
-* -DMA_External_Req0_Mask
-* -DMA_External_Req1_Mask
-* -DMA_I2C0_Mask
-* -DMA_I2C1_Mask
-* -DMA_SSP0_RX_Mask
-* -DMA_SSP0_TX_Mask
-* -DMA_SSP1_RX_Mask
-* -DMA_SSP1_TX_Mask
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-void DMA_SetLSReq(u16 SRCReq )
-{ /* Set the DMA to generate a Last Single transfer request for the corresponding DMA Request Source */
- DMA->SLSRR |= SRCReq ;
-}
-
-
-/********************************************************************************
-* Function Name : DMA_SetBReq
-* Description : Set the DMA to generate a Burst transfer request for the corresponding DMA Request Source.
-* Input :
-* -SRCReq:specifies the DMA Request Source.
-* This parameter can be:
-* -DMA_USB_RX_Mask
-* -DMA_USB_TX_Mask
-* -DMA_TIM0_Mask
-* -DMA_TIM1_Mask
-* -DMA_UART0_RX_Mask
-* -DMA_UART0_TX_Mask
-* -DMA_UART1_RX_Mask
-* -DMA_UART1_TX_Mask
-* -DMA_External_Req0_Mask
-* -DMA_External_Req1_Mask
-* -DMA_I2C0_Mask
-* -DMA_I2C1_Mask
-* -DMA_SSP0_RX_Mask
-* -DMA_SSP0_TX_Mask
-* -DMA_SSP1_RX_Mask
-* -DMA_SSP1_TX_Mask
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-
-void DMA_SetBReq(u16 SRCReq)
-
-{ /* Set the DMA to generate a Burst transfer request for the corresponding DMA Request Source */
- DMA->SBRR |= SRCReq ;
-}
-
-
-
-/********************************************************************************
-* Function Name : DMA_SetLBReq
-* Description : Set the DMA to generate a Last Burst transfer request for the corresponding DMA Request Source.
-* Input :
-* -SRCReq:specifies the DMA Request Source.
-* This parameter can be:
-* -DMA_USB_RX_Mask
-* -DMA_USB_TX_Mask
-* -DMA_TIM0_Mask
-* -DMA_TIM1_Mask
-* -DMA_UART0_RX_Mask
-* -DMA_UART0_TX_Mask
-* -DMA_UART1_RX_Mask
-* -DMA_UART1_TX_Mask
-* -DMA_External_Req0_Mask
-* -DMA_External_Req1_Mask
-* -DMA_I2C0_Mask
-* -DMA_I2C1_Mask
-* -DMA_SSP0_RX_Mask
-* -DMA_SSP0_TX_Mask
-* -DMA_SSP1_RX_Mask
-* -DMA_SSP1_TX_Mask
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-
-void DMA_SetLBReq(u16 SRCReq)
-
-{ /* Set the DMA to generate a Last Burst transfer request for the corresponding DMA Request Source */
- DMA->SLBRR |= SRCReq ;
-}
-
-
-/********************************************************************************
-* Function Name : DMA_GetSReq
-* Description : Check for a specific source if it request a Single transfer .
-* Input :
-* Input :
-* -SRCReq:specifies the DMA Request Source.
-* This parameter can be:
-* -DMA_USB_RX_Mask
-* -DMA_USB_TX_Mask
-* -DMA_TIM0_Mask
-* -DMA_TIM1_Mask
-* -DMA_UART0_RX_Mask
-* -DMA_UART0_TX_Mask
-* -DMA_UART1_RX_Mask
-* -DMA_UART1_TX_Mask
-* -DMA_External_Req0_Mask
-* -DMA_External_Req1_Mask
-* -DMA_I2C0_Mask
-* -DMA_I2C1_Mask
-* -DMA_SSP0_RX_Mask
-* -DMA_SSP0_TX_Mask
-* -DMA_SSP1_RX_Mask
-* -DMA_SSP1_TX_Mask
-* Output : None.
-* Return : SET or RESET.
-*******************************************************************************/
-
-
-FlagStatus DMA_GetSReq(u16 SRCReq)
-
-{ /* Check for a specific source if it request a Single transfer . */
- if ( (DMA->SSRR & SRCReq )!= RESET )
- {
- return SET;
- }
-
- else
- {
- return RESET;
- }
-}
-
-
-/********************************************************************************
-* Function Name : DMA_GetLSReq
-* Description : Check for a specific source if it request a Last Single transfer .
-* Input :
-* -SRCReq:specifies the DMA Request Source.
-* This parameter can be:
-* -DMA_USB_RX_Mask
-* -DMA_USB_TX_Mask
-* -DMA_TIM0_Mask
-* -DMA_TIM1_Mask
-* -DMA_UART0_RX_Mask
-* -DMA_UART0_TX_Mask
-* -DMA_UART1_RX_Mask
-* -DMA_UART1_TX_Mask
-* -DMA_External_Req0_Mask
-* -DMA_External_Req1_Mask
-* -DMA_I2C0_Mask
-* -DMA_I2C1_Mask
-* -DMA_SSP0_RX_Mask
-* -DMA_SSP0_TX_Mask
-* -DMA_SSP1_RX_Mask
-* -DMA_SSP1_TX_Mask
-* Output : None.
-* Return : SET or RESET.
-*******************************************************************************/
-
-
-FlagStatus DMA_GetLSReq(u16 SRCReq)
-
-{ /* Check for a specific source if it request a Last Single transfer . */
- if ( (DMA->SLSRR & SRCReq)!= RESET )
- {
- return SET;
- }
-
- else
- {
- return RESET;
- }
-}
-
-/********************************************************************************
-* Function Name : DMA_GetBReq
-* Description : Check for a specific source if it request a Burst transfer .
-* Input :
-* -SRCReq:specifies the DMA Request Source.
-* This parameter can be:
-* -DMA_USB_RX_Mask
-* -DMA_USB_TX_Mask
-* -DMA_TIM0_Mask
-* -DMA_TIM1_Mask
-* -DMA_UART0_RX_Mask
-* -DMA_UART0_TX_Mask
-* -DMA_UART1_RX_Mask
-* -DMA_UART1_TX_Mask
-* -DMA_External_Req0_Mask
-* -DMA_External_Req1_Mask
-* -DMA_I2C0_Mask
-* -DMA_I2C1_Mask
-* -DMA_SSP0_RX_Mask
-* -DMA_SSP0_TX_Mask
-* -DMA_SSP1_RX_Mask
-* -DMA_SSP1_TX_Mask
-* Output : None.
-* Return : SET or RESET.
-*******************************************************************************/
-
-
-FlagStatus DMA_GetBReq(u16 SRCReq)
-
-{ /* Check for a specific source if it request a Burst transfer . */
- if (( DMA->SBRR & SRCReq ) != RESET )
- {
- return SET;
- }
-
- else
- {
- return RESET;
- }
-}
-
-/********************************************************************************
-* Function Name : DMA_GetLSReq
-* Description : Check for a specific source if it request a Last Burst transfer .
-* Input :
-* Input :
-* - SRCReq:specifies the DMA Request Source.
-* This parameter can be:
-* -DMA_USB_RX_Mask
-* -DMA_USB_TX_Mask
-* -DMA_TIM0_Mask
-* -DMA_TIM1_Mask
-* -DMA_UART0_RX_Mask
-* -DMA_UART0_TX_Mask
-* -DMA_UART1_RX_Mask
-* -DMA_UART1_TX_Mask
-* -DMA_External_Req0_Mask
-* -DMA_External_Req1_Mask
-* -DMA_I2C0_Mask
-* -DMA_I2C1_Mask
-* -DMA_SSP0_RX_Mask
-* -DMA_SSP0_TX_Mask
-* -DMA_SSP1_RX_Mask
-* -DMA_SSP1_TX_Mask
-* Output : None.
-* Return : SET or RESET.
-*******************************************************************************/
-
-
-FlagStatus DMA_GetLBReq(u16 SRCReq)
-
-{ /* Check for a specific source if it request a Last Burst transfer . */
- if ( ( DMA->SLBRR & SRCReq ) != RESET )
- {
- return SET;
- }
-
- else
- {
- return RESET;
- }
-}
-
-
-
-/*******************************************************************************
-* Function Name : DMA_ChannelHalt
-* Description : Enables DMA requests or ignore extra source DMA requests for
- the specified channel.
-* Input :
- -DMA_Channelx: where x can be 0,1,2,3,4,5,6,or 7 to select the DMA Channel.
- -NewState: new state of the specified DMA_Channelx mask interrupt.
- This parameter can be: ENABLE or DISABLE.
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-
-void DMA_ChannelHalt(DMA_Channel_TypeDef * DMA_Channelx, FunctionalState NewState)
-
-{
- if (NewState==ENABLE) /* Enables DMA requests */
-
- {
- DMA_Channelx->CCNF |= DMA_HaltChannel ;
- }
-
- else /* Ignore extra source DMA request */
- {
- DMA_Channelx->CCNF &= ~ DMA_HaltChannel ;
- }
-}
-
-
-/*******************************************************************************
-* Function Name : DMA_ChannelLockTrsf
-* Description : Enables or disables the Locked Transfers Feature for the specified DMA_Channelx
-* Input :
-* -DMA_Channelx: where x can be 0,1,2,3,4,5,6,or 7 to select the DMA Channel.
-* -NewState: new state of the specified DMA_Channelx mask interrupt.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-
-void DMA_ChannelLockTrsf(DMA_Channel_TypeDef * DMA_Channelx, FunctionalState NewState)
-
-{
- if (NewState==ENABLE) /* Locked transfers enabled on channel x */
-
- {
- DMA_Channelx->CCNF |= DMA_LockChannel ;
- }
-
- else /* Locked transfers disabled on channel xt */
- {
- DMA_Channelx->CCNF &= ~ DMA_LockChannel;
- }
-}
-
-
-/*******************************************************************************
-* Function Name : DMA_ChannelCache
-* Description : Enables or disables the cacheability Feature for the specified DMA_Channelx
-* Input :
-* -DMA_Channelx: where x can be 0,1,2,3,4,5,6,or 7 to select the DMA Channel.
-* -NewState: new state of the specified DMA_Channelx mask interrupt.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-
-void DMA_ChannelCache (DMA_Channel_TypeDef * DMA_Channelx, FunctionalState NewState)
-
-{
- if (NewState==ENABLE) /* Cacheability Feature enabled on channelx */
-
- {
- DMA_Channelx->CC |= DMA_CacheChannel ;
- }
-
- else /* Cacheability Feature disabled on channelx */
- {
- DMA_Channelx->CC &= ~ DMA_CacheChannel ;
- }
-}
-
-
-/*******************************************************************************
-* Function Name : DMA_ChannelBuffering
-* Description : Enables or disables the Buffering Feature for the specified DMA_Channelx
-* Input :
-* -DMA_Channelx: where x can be 0,1,2,3,4,5,6,or 7 to select the DMA Channel.
-* -NewState: new state of the specified DMA_Channelx mask interrupt.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-
-void DMA_ChannelBuffering (DMA_Channel_TypeDef * DMA_Channelx, FunctionalState NewState)
-
-{
- if (NewState==ENABLE) /* Cacheability Feature enabled on channel x */
-
- {
- DMA_Channelx->CC |= DMA_BufferChannel ;
- }
-
- else /* Cacheability Feature disabled on channel xt */
- {
- DMA_Channelx->CC &= ~ DMA_BufferChannel ;
- }
-}
-
-/*******************************************************************************
-* Function Name : MA_ChannelProt0Mod
-* Description : Sets The User or Privileged mode for the specified DMA_Channelx
-* Input :
-* -DMA_Channelx: where x can be 0,1,2,3,4,5,6,or 7 to select the DMA Channel.
-* -Prot0Mode: Specifies the Privileged mode Or the User mode.
-* This parameter can be:
-* - DMA_PrevilegedMode
-* - DMA_UserMode
-*
-*
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-
-void DMA_ChannelProt0Mode (DMA_Channel_TypeDef * DMA_Channelx, u32 Prot0Mode)
-
-{
- if (Prot0Mode==DMA_PrevilegedMode) /* Privileged mode */
- {
- DMA_Channelx->CC |= DMA_PrevilegedMode ;
- }
-
- else /* User mode */
- {
- DMA_Channelx->CC &= DMA_UserMode ;
- }
-}
-
-
-
-
-
-/*******************************************************************************
-* Function Name : DMA_ChannelSRCIncConfig
-* Description : Enables or disables the Source address incrementation after each transfer for
-* the specified DMA_Channelx
-* Input :
-* -DMA_Channelx: where x can be 0,1,2,3,4,5,6,or 7 to select the DMA Channel.
-* -NewState: new state of the specified DMA_Channelx mask interrupt.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-
-void DMA_ChannelSRCIncConfig (DMA_Channel_TypeDef * DMA_Channelx, FunctionalState NewState)
-
-{
- if (NewState==ENABLE) /* The Source address is incremented after each transfer */
-
- {
- DMA_Channelx->CC |= DMA_ChannelSRCInc ;
- }
-
- else /* The Source address is not incremented after each Transfer */
- {
- DMA_Channelx->CC &= ~ DMA_ChannelSRCInc ;
- }
-}
-
-
-/*******************************************************************************
-* Function Name : DMA_ChannelDESIncConfig
-* Description : Enables or disables the Destination address incrementation after each transfer for
-* the specified DMA_Channelx
-* Input :
-* -DMA_Channelx: where x can be 0,1,2,3,4,5,6,or 7 to select the DMA Channel.
-* -NewState: new state of the specified DMA_Channelx mask interrupt.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-
-void DMA_ChannelDESIncConfig (DMA_Channel_TypeDef * DMA_Channelx, FunctionalState NewState)
-
-{
- if (NewState==ENABLE) /* The Destination address is incremented after each transfer */
-
- {
- DMA_Channelx->CC |= DMA_ChannelDESInc ;
- }
-
- else /* The Destination address is not incremented after each Transfer */
- {
- DMA_Channelx->CC &= ~ DMA_ChannelDESInc ;
- }
-}
-
-
-
-/********************************************************************************
-* Function Name : DMA_GetChannelStatus
-* Description : Checks the status of DMA channelx ( Enabled or Disabled).
-* - ChannelIndx:specifies the DMA Channel to be checked.
-* This parameter can be:
-* - Channel0
-* - Channel1
-* - Channel2
-* - Channel3
-* - Channel4
-* - Channel5
-* - Channel6
-* - Channel7
-* Output : None.
-*
-* Return : SET or RESET.
-*******************************************************************************/
-
-
-FlagStatus DMA_GetChannelStatus(u8 ChannelIndx )
-
-{
-
- if ( ( DMA->ENCSR & (1 << ChannelIndx )) != RESET )
- {
- return SET; /* Channelx Enabled */
- }
-
- else
-
- {
-
- return RESET; /* Channelx Disabled */
-
- }
-
-}
-
-
-
-/********************************************************************************
-* Function Name : DMA_GetITStatus
-* Description : Checks the status of Terminal Count and Error interrupts request after and before Masking.
-* Input :
-* - ChannelIndx:specifies the DMA Channel to be checked.
-* This parameter can be:
-* - Channel0
-* - Channel1
-* - Channel2
-* - Channel3
-* - Channel4
-* - Channel5
-* - Channel6
-* - Channel7
-*
-*. - DMA_ITReq: specifies the DMA interrupt request status to be checked.
-* This parameter can be:
-*
-* - DMA_IS
-* - DMA_TCS
-* - DMA_ES
-* - DMA_TCRS
-* - DMA_ERS.
-*
-* Output : None.
-*
-* Return : SET or RESET.
-*******************************************************************************/
-
-
-ITStatus DMA_GetITStatus(u8 ChannelIndx,u8 DMA_ITReq)
-
-{
- u32 DMAReg = 0;
-
- switch(DMA_ITReq)
-
- {
-
- case (DMA_IS): /*The status of the interrupts after masking : logical or of all Interrupts after Masking*/
- DMAReg = DMA->ISR;
- break;
-
-
-
- case (DMA_TCS): /* The status of the Terminal count request after masking */
- DMAReg = DMA->TCISR;
- break;
-
-
- case (DMA_ES): /* The status of the error request after masking */
- DMAReg = DMA->EISR;
- break;
-
-
- case (DMA_TCRS): /* Indicates if the DMA channel is requesting a transfer complete (terminal count Interrupt) prior to masking or Not. */
- DMAReg = DMA->TCRISR;
- break;
-
- case (DMA_ERS): /* Indicates if the DMA channel is requesting an Error Interrupt prior to masking or Not. */
- DMAReg = DMA->ERISR;
- break;
-
-
- }
-
- if((DMAReg &(1 << ChannelIndx )) != RESET )
-
- {
- return SET;
- }
-
- else
-
- {
-
- return RESET;
-
-
- }
-
-}
-
-
-/********************************************************************************
-* Function Name : DMA_ClearIT
-* Description : Clears The Interrupt pending bits for termnal count or Error interrupts for a specified DMA Channel.
-* - ChannelIndx:specifies the DMA Channel to be checked.
-* This parameter can be:
-* - Channel0
-* - Channel1
-* - Channel2
-* - Channel3
-* - Channel4
-* - Channel5
-* - Channel6
-* - Channel7
-* - DMA_ITClr : Specifies the DMA interrupt pending to be cleared.
-*. This parameter can be:
-* - DMA_TCC
-* - DMA_EC.
-*
-* Output : None.
-
-* Return : SET or RESET.
-*******************************************************************************/
-
-
-void DMA_ClearIT(u8 ChannelIndx,u8 DMA_ITClr)
-
-{
-
-
- switch(DMA_ITClr)
-
- {
-
- case (DMA_TCC): /* Clear The status of the Terminal count interrupt on the corresponding channel.*/
- DMA->TCICR |=(1 << ChannelIndx );
- break;
-
-
-
- case (DMA_EC): /* Clear The status of the error interrupt on the corresponding channel.*/
- DMA->EICR |=(1 << ChannelIndx );
- break;
-
-
-
- }
-
-
-
-}
-
-
-/*******************************************************************************
-* Function Name : DMA_Cmd(FunctionalState NewState)
-* Description : Enables or disables the DMA peripheral.
-*
-* Input :
-* -NewState: new state of the DMA.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-
-void DMA_Cmd(FunctionalState NewState)
-
-{
- if (NewState==ENABLE) /* ENABLE the DMA peripheral */
-
- {
- DMA-> CNFR |= DMA_Enable ;
- }
-
- else /* DISABLE the DMA peripheral */
- {
- DMA-> CNFR &= ~ DMA_Enable ;
- }
-}
-
-
-
-/*******************************************************************************
-* Function Name : DMA_ChannelCmd
-* Description : Enables or disables the specified DMA_Channelx
-*
-* Input :
-* -DMA_Channelx: where x can be 0,1,2,3,4,5,6,or 7 to select the DMA Channel.
-* -NewState: new state of the specified DMA_Channelx mask interrupt.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None.
-* Return : None.
-*******************************************************************************/
-
-
-void DMA_ChannelCmd (DMA_Channel_TypeDef *DMA_Channelx,FunctionalState NewState)
-
-{
- if (NewState==ENABLE) /* Enable The Channelx */
-
- {
- DMA_Channelx->CCNF |= DMA_ChannelEnable ;
- }
-
- else /* Disable The Channelx */
- {
- DMA_Channelx-> CCNF &= ~ DMA_ChannelEnable ;
- }
-}
-
-
-
-/********************************************************************************
-* Function Name : DMA_GetChannelActiveStatus
-* Description : Checks The DMA_Channelx FIFO if it has data or not.
-* Input :
-* -DMA_Channelx: where x can be 0,1,2,3,4,5,6,or 7 to select the DMA Channel.
-*
-*
-* Output : None.
-*
-* Return : SET or RESET.
-*******************************************************************************/
-
-
-FlagStatus DMA_GetChannelActiveStatus( DMA_Channel_TypeDef * DMA_Channelx )
-
-{
-
- if ( ( DMA_Channelx->CCNF & DMA_ChannelActive) != RESET )
- {
- return SET; /* The DMA_Channelx FIFO has data */
- }
-
- else
-
- {
-
- return RESET; /* No data in the DMA_Channelx FIFO */
-
-
- }
-
-}
-
-
-/********************************************************************************
-* Function Name : DMA_DeInit
-* Description : Initializes the DMA peripheral registers to their default reset values.
-*
-*
-* Input : None
-*
-* Output : None.
-*
-* Called Functions:
-*
-* - SCU_AHBPeriphReset: Function defined in the System clock Unit "scu.c".
-*
-*
-* Return : None
-*******************************************************************************/
-
-
-void DMA_DeInit(void)
-
-{
-
- SCU_AHBPeriphReset(__DMA, ENABLE); /*DMA peripheral is under Reset " Reset on"*/
- SCU_AHBPeriphReset(__DMA, DISABLE); /*DMA peripheral Reset off*/
-}
-
-
-
-/********************************************************************************
-* Function Name : DMA_StructInit
-* Description : Fills each DMA_InitStruct member with its reset value.
-* Input :
-* -DMA_InitStruct: pointer to a DMA_InitTypeDef structure which will be initialized.
-*
-* Output : None.
-*
-* Return : None
-*******************************************************************************/
-
-
-void DMA_StructInit(DMA_InitTypeDef * DMA_InitStruct)
-
-{
-
- /* Initialize The current source address */
- DMA_InitStruct-> DMA_Channel_SrcAdd =0x0000000;
-
-
- /* Initialize The current Destination address */
- DMA_InitStruct->DMA_Channel_DesAdd=0x00000000;
-
-
-
- /* Initialize The Linked List Items */
- DMA_InitStruct->DMA_Channel_LLstItm=0x00000000 ;
-
-
-
- /* Initialize The Destination width */
- DMA_InitStruct->DMA_Channel_DesWidth= DMA_DesWidth_Byte;
-
-
-
- /* Initialize The source width */
- DMA_InitStruct->DMA_Channel_SrcWidth= DMA_SrcWidth_Byte;
-
-
- /* Initialize The Burst Size for the Destination */
- DMA_InitStruct->DMA_Channel_DesBstSize= DMA_DesBst_1Data; /* 1 Data "one Data can be byte, halfword or word depending on the Destination width */
-
-
-
- /* Initialize The Burst Size for the Source*/
- DMA_InitStruct->DMA_Channel_SrcBstSize= DMA_SrcBst_1Data; /* 1 Data "one Data can be byte, halfword or word depending on the source width */
-
- /* Initialize The Flow control and transfer type for the DMA transfer */
- DMA_InitStruct->DMA_Channel_FlowCntrl=DMA_FlowCntrlt0_DMA; /* memory to memory transfer with DMA as flow controller */
-
-
- /* Initialize The Transfer Size */
- DMA_InitStruct->DMA_Channel_TrsfSize =0x00;
-
-
-
- /* Initialize the DMA source request peripheral :"This field is ignored if the source of the transfer is from memory" */
- DMA_InitStruct->DMA_Channel_Src =0x00;
-
-
-
- /* Initialize the DMA Destination request peripheral :"This field is ignored if the destination of the transfer is to memory.*/
-
- DMA_InitStruct->DMA_Channel_Des=0x00;
-
-
-}
-
-
-
-
-/********************************************************************************
-* Function Name : DMA_Init
-* Description : Initializes the DMA_Channelx according to the specified parameters
-* in the DMA_InitStruct .
-*
-* Input :
-* -DMA_Channelx: where x can be 0,1,2,3,4,5,6,or 7 to select the DMA Channel.
-* -DMA_InitStruct: pointer to a DMA_InitTypeDef structure
-* ( Structure Config to be load in DMA Registers). .
-*
-* Output : None.
-*
-* Return : None
-*******************************************************************************/
-
-
-void DMA_Init(DMA_Channel_TypeDef * DMA_Channelx, DMA_InitTypeDef * DMA_InitStruct)
-
-{
-
-
-
- /* Select the DMA source peripheral request */
- DMA_Channelx->CCNF &= SRC_Mask;
- DMA_Channelx->CCNF |= DMA_InitStruct->DMA_Channel_Src;
-
-
- /* Select the flow controller and the transfer type */
- DMA_Channelx->CCNF &= DMA_FlowCntrl_Mask;
- DMA_Channelx->CCNF |=DMA_InitStruct->DMA_Channel_FlowCntrl;
-
-
- /* Select the DMA Destination peripheral request*/
- DMA_Channelx->CCNF &= DES_Mask;
- DMA_Channelx->CCNF |= DMA_InitStruct->DMA_Channel_Des;
-
- /* Set the source address */
- DMA_Channelx->SRC = DMA_InitStruct-> DMA_Channel_SrcAdd ;
-
-
- /* Set the destination address */
-
- DMA_Channelx->DES = DMA_InitStruct->DMA_Channel_DesAdd ;
-
-
-
- /* Set the linked list Items address */
- DMA_Channelx->LLI = DMA_InitStruct->DMA_Channel_LLstItm ;
-
-
- /* Set The Destination width */
- DMA_Channelx->CC &= DMA_Width_DES_MASK;
- DMA_Channelx->CC |= DMA_InitStruct->DMA_Channel_DesWidth;
-
-
- /* Set The Source width */
- DMA_Channelx->CC &= DMA_Width_SRC_MASK;
- DMA_Channelx->CC |= DMA_InitStruct->DMA_Channel_SrcWidth;
-
- /* Set The Burst Size for the Destination */
- DMA_Channelx->CC &= DMA_Bst_DES_MASK;
- DMA_Channelx->CC |= DMA_InitStruct->DMA_Channel_DesBstSize;
-
- /* Set The Burst Size for the Source */
- DMA_Channelx->CC &= DMA_Bst_SRC_MASK;
- DMA_Channelx->CC |=DMA_InitStruct->DMA_Channel_SrcBstSize;
-
-
- /* Initialize The Transfer Size for the Source */
- DMA_Channelx->CC &= DMA_TrsfSisze_Mask;
- DMA_Channelx->CC |= DMA_InitStruct->DMA_Channel_TrsfSize;
-
-
-}
-
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_template91x/str91x_lib/src/91x_emi.c b/uc_str912/prj_template91x/str91x_lib/src/91x_emi.c
deleted file mode 100644
index deadae8..0000000
--- a/uc_str912/prj_template91x/str91x_lib/src/91x_emi.c
+++ /dev/null
@@ -1,167 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_emi.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the EMI software functions.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_emi.h"
-#include "91x_scu.h"
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-
-/* These constant variables are used as masks to handle the EMI registers. */
-
-#define EMI_PageModeRead_TL_Mask 0xFFFFF3FF
-#define EMI_PageModeRead_Sel_Mask 0xFFFFFEFF
-#define EMI_MemWidth_Mask 0xFFFFFFCF
-#define EMI_WriteProtect_Mask 0xFFFFFEF7
-
-
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Registers reset value */
-/* Private function prototypes -----------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-
-/******************************************************************************
-* Function Name : EMI_DeInit
-* Description : Deinitializes the EMI peripheral registers to their default
-* reset values.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-
-void EMI_DeInit(void)
-{
-
- SCU_AHBPeriphReset(__EMI, ENABLE); /* EMI peripheral under Reset */
- SCU_AHBPeriphReset(__EMI,DISABLE ); /* EMI not under Reset */
-
-}
-
-/*******************************************************************************
-* Function Name : EMI_StructInit
-* Description : Fills the EMI_InitTypeDef structure member with its reset
-* value.
-* Input : EMI_InitStruct : pointer to a EMI_InitTypeDef structure
-* which will be initialized.
-* Output : None
-* Return : None
-*******************************************************************************/
-
-void EMI_StructInit( EMI_InitTypeDef *EMI_InitStruct)
-{
-
- /* Number of bus turnaround cycles added between read and write accesses.*/
- /*This member can be 0x01,0x02,0x03, ....0xF (Reset value:0xF "15 cycles"*/
-
- EMI_InitStruct->EMI_Bank_IDCY =0xF;
-
-
- /* Number of wait states for read accesses*/
- /*This member can be: 0x01,0x02,0x03, ....0x1F (Reset value:0x1F "31 cycles"*/
-
- EMI_InitStruct->EMI_Bank_WSTRD =0x1F;
-
-
- /* Number of wait states for write accesses*/
- /*This member can be: 0x01,0x02,0x03, ....0x1F (Reset value:0x1F "31 cycles"*/
-
- EMI_InitStruct->EMI_Bank_WSTWR =0x1F;
-
- /*Output enable assertion delay from chip select assertion*/
- /*This member can be: 0x01,0x02,0x03, ....0xF (Reset value:0x01 "1 cycle"*/
-
- EMI_InitStruct->EMI_Bank_WSTROEN =0x01;
-
-
- /*Write enable assertion delay from chip select assertion*/
- /*This member can be: 0x01,0x02,0x03, ....0xF (Reset value:0x00 "0 cycle"*/
-
- EMI_InitStruct->EMI_Bank_WSTWEN =0x00;
-
-
- /*This member Controls the memory width*/
- /*This member can be :"EMI_Width_Byte" = 8 bits width or "EMI_Width_HalfWord" = 16 bits width*/
-
- EMI_InitStruct->EMI_Bank_MemWidth = EMI_Width_Byte;
-
-
- /*Write protection feature */
- /*This member can be :"EMI_Bank_NonWriteProtect" = No write protection or "EMI_Bank_WriteProtect" = bank is write protected*/
-
- EMI_InitStruct-> EMI_Bank_WriteProtection= EMI_Bank_NonWriteProtect;
-
-
- /* page transfer length for page mode read */
- /*This member can be :"EMI_4Data" = 4 transfers burst or "EMI_8Data" = 8 transfers burst*/
-
- EMI_InitStruct->EMI_PageModeRead_TransferLength= EMI_4Data;
-
- /*Select or deselect the page mode read*/
- /*This member can be :"EMI_NormalMode" =Normal Mode or "EMI_PageModeRead" = Page Mode Read*/
-
- EMI_InitStruct->EMI_PageModeRead_Selection = EMI_NormalMode;
-
-
-}
-
-/*******************************************************************************
-* Function Name : EMI_Init
-* Description : Initializes EMI peripheral according to the specified
-* parameters in the EMI_InitStruct.
-
-* Input : EMI_Bankx:where x can be 0,1,2 or 3 to select the EMI Bank.
- EMI_InitStruct: pointer to a EMI_InitTypeDef structure
- ( Structure Config to be loaded in EMI Registers). .
-
-* Output : None
-* Return : None
-*******************************************************************************/
-
-void EMI_Init( EMI_Bank_TypeDef* EMI_Bankx, EMI_InitTypeDef* EMI_InitStruct)
-
-{
-
- EMI_Bankx->ICR = EMI_InitStruct-> EMI_Bank_IDCY ;
-
- EMI_Bankx->RCR = EMI_InitStruct->EMI_Bank_WSTRD ;
-
- EMI_Bankx->WCR = EMI_InitStruct->EMI_Bank_WSTWR ;
-
- EMI_Bankx->OECR = EMI_InitStruct->EMI_Bank_WSTROEN;
-
- EMI_Bankx->WECR = EMI_InitStruct->EMI_Bank_WSTWEN ;
-
- EMI_Bankx->BCR &= EMI_MemWidth_Mask;
- EMI_Bankx->BCR |= EMI_InitStruct->EMI_Bank_MemWidth;
-
- EMI_Bankx->BCR &= EMI_WriteProtect_Mask;
- EMI_Bankx->BCR |= EMI_InitStruct->EMI_Bank_WriteProtection;
-
- EMI_Bankx->BCR &= EMI_PageModeRead_TL_Mask;
- EMI_Bankx->BCR |= EMI_InitStruct->EMI_PageModeRead_TransferLength;
-
- EMI_Bankx->BCR &= EMI_PageModeRead_Sel_Mask;
- EMI_Bankx->BCR |= EMI_InitStruct->EMI_PageModeRead_Selection;
-
-
-}
-
-
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_template91x/str91x_lib/src/91x_fmi.c b/uc_str912/prj_template91x/str91x_lib/src/91x_fmi.c
deleted file mode 100644
index fb558ad..0000000
--- a/uc_str912/prj_template91x/str91x_lib/src/91x_fmi.c
+++ /dev/null
@@ -1,519 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_fmi.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the FMI software functions.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-
-/* Standard include ----------------------------------------------------------*/
-#include "91x_fmi.h"
-
-/* Include of other module interface headers ---------------------------------*/
-/* Local includes ------------------------------------------------------------*/
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-
-#define TIMEOUT 0xFFFFFF /* Timeout value */
-
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/* Interface functions -------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-
-
-/*******************************************************************************
-* Function Name : FMI_BankRemapConfig
-* Description : Configure the addresses and sizes of bank 0 and bank 1.
-* Input1 : FMI_BootBankSize: specifies the boot bank size.
-* This parameter can be one of the following values:
-* - 0x0: 32KBytes.
-* - 0x1: 64KBytes.
-* - 0x2: 128KBytes.
-* - 0x3: 256KBytes.
-* - 0x4: 512KBytes.
-* ....
-* - 0xB: 64MBytes.
-* Input2 : FMI_NonBootBankSize: specifies the non boot bank size.
-* This parameter can be one of the following values:
-* - 0x0: 8KBytes.
-* - 0x1: 16KBytes.
-* - 0x2: 32KBytes.
-* - 0x3: 64KBytes.
-* ....
-* - 0xD: 64MBytes.
-* Input3 : FMI_BootBankAddress: specifies the address of the boot bank.
-* Input4 : FMI_NonBootBankAddress: specifies the address of the non
-* boot bank.
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_BankRemapConfig(u8 FMI_BootBankSize, u8 FMI_NonBootBankSize, \
- u32 FMI_BootBankAddress, u32 FMI_NonBootBankAddress)
-{
- FMI->BBSR = FMI_BootBankSize;
- FMI->NBBSR = FMI_NonBootBankSize;
- FMI->BBADR = (FMI_BootBankAddress >> 2);
- FMI->NBBADR = (FMI_NonBootBankAddress >> 2);
- FMI->CR |= 0x18; /* Enable bank 1 */
-}
-
-/*******************************************************************************
-* Function Name : FMI_Config
-* Description : Configure the FMI.
-* Input1 : FMI_ReadWaitState: specifies the needed read wait states.
-* This parameter can be one of the following values:
-* - FMI_READ_WAIT_STATE_1: One read wait state.
-* - FMI_READ_WAIT_STATE_2: Two read wait states.
-* - FMI_READ_WAIT_STATE_3: Three read wait states.
-* Input2 : FMI_WriteWaitState: specifies the needed write wait states.
-* This parameter can be one of the following values:
-* - FMI_WRITE_WAIT_STATE_1: One write wait state.
-* - FMI_WRITE_WAIT_STATE_2: Two write wait states.
-* Input3 : FMI_PWD: specifies the power down mode status.
-* This parameter can be one of the following values:
-* - FMI_PWD_ENABLE: Enable the PWD.
-* - FMI_PWD_DISABLE: Disable the PWD.
-* Input4 : FMI_LVDEN: specifies the low voltage detector status.
-* This parameter can be one of the following values:
-* - FMI_LVD_ENABLE: Enable the LVD.
-* - FMI_LVD_DISABLE: Disable the LVD.
-* Input5 : FMI_FreqRange: specifies the working frequency range.
-* This parameter can be one of the following values:
-* - FMI_FREQ_LOW: Low working frequency (up to 66MHz).
-* - FMI_FREQ_HIGH: High working frequency (above 66MHz) .
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_Config(u16 FMI_ReadWaitState, u32 FMI_WriteWaitState, u16 FMI_PWD,\
- u16 FMI_LVDEN, u16 FMI_FreqRange)
-{
- /* Configure the write wait state value */
- if (FMI_WriteWaitState == FMI_WRITE_WAIT_STATE_1)
- {
- FMI->CR |= FMI_WRITE_WAIT_STATE_1;
- }
- else
- {
- FMI->CR &= FMI_WRITE_WAIT_STATE_0;
- }
-
- /* Write a write flash configuration register command */
- *(vu16 *)FMI_BANK_1 = 0x60;
-
- /* Configure the flash configuration register */
- *(vu16 *)(FMI_BANK_1|FMI_ReadWaitState|FMI_PWD|FMI_LVDEN|FMI_FreqRange) = 0x03;
-}
-
-/*******************************************************************************
-* Function Name : FMI_EraseSector
-* Description : Erase the needed sector.
-* Input : FMI_Sector: specifies the sector to be erased.
-* This parameter can be one of the following values:
-* - FMI_B0S0: FMI bank 0 sector 0.
-* - FMI_B0S1: FMI bank 0 sector 1.
-* - FMI_B0S2: FMI bank 0 sector 2.
-* - FMI_B0S3: FMI bank 0 sector 3.
-* - FMI_B0S4: FMI bank 0 sector 4.
-* - FMI_B0S5: FMI bank 0 sector 5.
-* - FMI_B0S6: FMI bank 0 sector 6.
-* - FMI_B0S7: FMI bank 0 sector 7.
-* - FMI_B1S0: FMI bank 1 sector 0.
-* - FMI_B1S1: FMI bank 1 sector 1.
-* - FMI_B1S2: FMI bank 1 sector 2.
-* - FMI_B1S3: FMI bank 1 sector 3.
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_EraseSector(vu32 FMI_Sector)
-{
- /* Write an erase set-up command to the sector */
- *(vu16 *)FMI_Sector = 0x20;
-
- /* Write an erase confirm command to the sector */
- *(vu16 *)FMI_Sector = 0xD0;
-}
-
-/*******************************************************************************
-* Function Name : FMI_EraseBank
-* Description : Erase the needed bank.
-* Input : FMI_Bank: specifies the bank to be erased.
-* This parameter can be one of the following values:
-* - FMI_BANK_0: FMI bank 0.
-* - FMI_BANK_1: FMI bank 1.
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_EraseBank(vu32 FMI_Bank)
-{
- /* Write a bank erase set-up command to the bank */
- *(vu16 *)FMI_Bank = 0x80;
-
- /* Write an erase confirm command to the sector */
- *(vu16 *)FMI_Bank = 0xD0;
-}
-
-/*******************************************************************************
-* Function Name : FMI_WriteHalfWord
-* Description : Write a halfword to the needed Flash memory address.
-* Input 1 : FMI_Address: specifies the address offset where the data will
-* be written.
-* Input 2 : FMI_Data: the needed data.
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_WriteHalfWord(u32 FMI_Address, u16 FMI_Data)
-{
- /* Write a program command to the sector to be written */
- *(vu16 *)(FMI_Address & 0xFFFFFFFC) = 0x40;
-
- /* Write the halfword to the destination address */
- *(vu16 *)FMI_Address = FMI_Data;
-}
-
-/*******************************************************************************
-* Function Name : FMI_WriteOTPHalfWord
-* Description : Write a halfword to the needed OTP sector address.
-* Input 1 : FMI_OTPHWAddress: specifies the halfword address offset
-* where the data will be written.
-* This parameter can be one of the following values:
-* - FMI_OTP_LOW_HALFWORD_0: OTP Low halfword 0.
-* - FMI_OTP_HIGH_HALFWORD_0: OTP High halfword 0.
-* - FMI_OTP_LOW_HALFWORD_1: OTP Low halfword 1.
-* - FMI_OTP_HIGH_HALFWORD_1: OTP High halfword 1.
-* - FMI_OTP_LOW_HALFWORD_2: OTP Low halfword 2.
-* - FMI_OTP_HIGH_HALFWORD_2: OTP High halfword 2.
-* - FMI_OTP_LOW_HALFWORD_3: OTP Low halfword 3.
-* - FMI_OTP_HIGH_HALFWORD_3: OTP High halfword 3.
-* - FMI_OTP_LOW_HALFWORD_4: OTP Low halfword 4.
-* - FMI_OTP_HIGH_HALFWORD_4: OTP High halfword 4.
-* - FMI_OTP_LOW_HALFWORD_5: OTP Low halfword 5.
-* - FMI_OTP_HIGH_HALFWORD_5: OTP High halfword 5.
-* - FMI_OTP_LOW_HALFWORD_6: OTP Low halfword 6.
-* - FMI_OTP_HIGH_HALFWORD_6: OTP High halfword 6.
-* - FMI_OTP_LOW_HALFWORD_7: OTP Low halfword 7.
-* - FMI_OTP_HIGH_HALFWORD_7: OTP High halfword 7.
-* Input 2 : FMI_OTPData: The needed OTP data.
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_WriteOTPHalfWord(u8 FMI_OTPHWAddress, u16 FMI_OTPData)
-{
- /* Write a write OTP command to the needed address */
- *(vu16 *)(FMI_BANK_1) = 0xC0;
-
- /* Write the halfword to the destination address */
- *(vu16 *)(FMI_BANK_1 + FMI_OTPHWAddress) = FMI_OTPData;
-}
-
-/*******************************************************************************
-* Function Name : FMI_ReadWord
-* Description : Read the correspondent data.
-* Input : FMI_Address: specifies the needed address.
-* Output : None
-* Return : The data contained in the specified address.
-*******************************************************************************/
-u32 FMI_ReadWord(u32 FMI_Address)
-{
- return(*(u32*)FMI_Address);
-}
-
-/*******************************************************************************
-* Function Name : FMI_ReadOTPData
-* Description : Read data from the OTP sector.
-* Input : FMI_OTPAddress: specifies the address of the data to be read.
-* This parameter can be one of the following values:
-* - FMI_OTP_WORD_0: FMI bank 0 sector 0.
-* - FMI_OTP_WORD_1: FMI bank 0 sector 1.
-* - FMI_OTP_WORD_2: FMI bank 0 sector 2.
-* - FMI_OTP_WORD_3: FMI bank 0 sector 3.
-* - FMI_OTP_WORD_4: FMI bank 0 sector 4.
-* - FMI_OTP_WORD_5: FMI bank 0 sector 5.
-* - FMI_OTP_WORD_6: FMI bank 0 sector 6.
-* - FMI_OTP_WORD_7: FMI bank 0 sector 7.
-* Output : None
-* Return : The needed OTP words.
-*******************************************************************************/
-u32 FMI_ReadOTPData(u8 FMI_OTPAddress)
-{
- u32 OTP_Data = 0x0;
- /* write a read OTP sector command */
- *(vu16 *)(FMI_BANK_1) = 0x98;
-
- /* Read the correspondent data */
- OTP_Data = (*(vu32*)(FMI_BANK_1 + FMI_OTPAddress));
-
- /* Write a read array command */
- *(vu16 *)(FMI_BANK_1) = 0xFF;
-
- return OTP_Data;
-}
-
-/*******************************************************************************
-* Function Name : FMI_GetFlagStatus
-* Description : Check whether the specified FMI flag is set or not.
-* Input1 : FMI_Flag: flag to check.
-* This parameter can be one of the following values:
-* - FMI_FLAG_SPS: Sector Protection Status Flag.
-* - FMI_FLAG_PSS: Program Suspend Status Flag.
-* - FMI_FLAG_PS: Program Status Flag.
-* - FMI_FLAG_ES: Erase Status Flag.
-* - FMI_FLAG_ESS: Erase Suspend Status Flag.
-* - FMI_FLAG_PECS: FPEC Status Flag.
-* Input2 : FMI_Bank: specifies the needed bank.
-* This parameter can be one of the following values:
-* - FMI_BANK_0: FMI bank 0.
-* - FMI_BANK_1: FMI bank 1.
-* Output : None
-* Return : None
-*******************************************************************************/
-FlagStatus FMI_GetFlagStatus(u8 FMI_Flag, vu32 FMI_Bank)
-{
- u16 FMI_Status_Register = 0;
-
- /* Write a read status register command */
- *(vu16 *)FMI_Bank = 0x70;
-
- /* Wait until operation completion */
- while(!((*(vu16 *)FMI_Bank) & 0x80));
-
- /* Read the status register */
- FMI_Status_Register = *(vu16 *)FMI_Bank;
-
- /* Write a read array command */
- *(vu16 *)FMI_Bank = 0xFF;
-
- if((FMI_Status_Register & FMI_Flag) != RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : FMI_GetReadWaitStateValue
-* Description : Get the current Read wait state value.
-* Input : None
-* Output : None
-* Return : The current read wait states value.
-*******************************************************************************/
-u16 FMI_GetReadWaitStateValue(void)
-{
- u16 FMI_Configuration_Register = 0;
- /* Write a read flash configuration register command */
- *(vu16 *)FMI_BANK_1 = 0x90;
-
- /* Read the flash configuration register */
- FMI_Configuration_Register = *(vu16 *)(FMI_BANK_1 + 0x14);
-
- /* Write a read array command */
- *(vu16 *)FMI_BANK_1 = 0xFF;
-
- FMI_Configuration_Register = ((FMI_Configuration_Register>>11) + 1) & 0x3;
-
- /* Return the wait states value */
- return FMI_Configuration_Register;
-}
-
-/*******************************************************************************
-* Function Name : FMI_GetWriteWaitStateValue
-* Description : Get the current write wait state value.
-* Input : None
-* Output : None
-* Return : The current write wait states value.
-*******************************************************************************/
-u16 FMI_GetWriteWaitStateValue(void)
-{
- return ((u16)((FMI->CR & 0x100) >> 8));
-}
-
-/*******************************************************************************
-* Function Name : FMI_SuspendEnable
-* Description : Suspend command enable.
-* Input : FMI_Bank: specifies the bank to be suspended.
-* This parameter can be one of the following values:
-* - FMI_BANK_0: FMI bank 0.
-* - FMI_BANK_1: FMI bank 1.
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_SuspendEnable(vu32 FMI_Bank)
-{
- /* Write a suspend command to the bank */
- *(vu16 *)FMI_Bank = 0xB0;
-}
-
-/*******************************************************************************
-* Function Name : FMI_ResumeEnable
-* Description : Resume the suspended command.
-* Input : FMI_Bank: specifies the suspended bank.
-* This parameter can be one of the following values:
-* - FMI_BANK_0: FMI bank 0.
-* - FMI_BANK_1: FMI bank 1.
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_ResumeEnable(vu32 FMI_Bank)
-{
- /* Write a resume command to the bank */
- *(vu16 *)FMI_Bank = 0xD0;
-}
-
-/*******************************************************************************
-* Function Name : FMI_ClearFlag
-* Description : Clear the FMI Flags on the correspondent bank.
-* Input : FMI_Bank: specifies the needed bank.
-* This parameter can be one of the following values:
-* - FMI_BANK_0: FMI bank 0.
-* - FMI_BANK_1: FMI bank 1.
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_ClearFlag(vu32 FMI_Bank)
-{
- /* Write a clear status register command */
- *(vu16 *)FMI_Bank = 0x50;
-}
-
-/*******************************************************************************
-* Function Name : FMI_WriteProtectionCmd
-* Description : Enable or disable the write protection for the needed sector.
-* Input1 : FMI_Sector: specifies the sector to be protected or
-* unprotected.
-* This parameter can be one of the following values:
-* - FMI_B0S0: FMI bank 0 sector 0.
-* - FMI_B0S1: FMI bank 0 sector 1.
-* - FMI_B0S2: FMI bank 0 sector 2.
-* - FMI_B0S3: FMI bank 0 sector 3.
-* - FMI_B0S4: FMI bank 0 sector 4.
-* - FMI_B0S5: FMI bank 0 sector 5.
-* - FMI_B0S6: FMI bank 0 sector 6.
-* - FMI_B0S7: FMI bank 0 sector 7.
-* - FMI_B1S0: FMI bank 1 sector 0.
-* - FMI_B1S1: FMI bank 1 sector 1.
-* - FMI_B1S2: FMI bank 1 sector 2.
-* - FMI_B1S3: FMI bank 1 sector 3.
-* Input2 : FMI_NewState: specifies the protection status.
-* This parameter can be one of the following values:
-* - ENABLE: Enable the protection.
-* - DISABLE: Disable the protection.
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_WriteProtectionCmd(vu32 FMI_Sector, FunctionalState FMI_NewState)
-{
- if (FMI_NewState == ENABLE)
- {
- *(vu16*)FMI_Sector = 0x60;
- *(vu16*)FMI_Sector = 0x01;
- *(vu16*)FMI_Sector = 0xFF;
- }
- else /* DISABLE */
- {
- *(vu16*)FMI_Sector = 0x60;
- *(vu16*)FMI_Sector = 0xD0;
- *(vu16*)FMI_Sector = 0xFF;
- }
-}
-
-/*******************************************************************************
-* Function Name : FMI_GetWriteProtectionStatus
-* Description : Get the write protection status for the needed sector.
-* Input : FMI_Sector_Mask: specifies the needed sector mask.
-* This parameter can be one of the following values:
-* - FMI_B0S0_MASK: FMI bank 0 sector 0.
-* - FMI_B0S1_MASK: FMI bank 0 sector 1.
-* - FMI_B0S2_MASK: FMI bank 0 sector 2.
-* - FMI_B0S3_MASK: FMI bank 0 sector 3.
-* - FMI_B0S4_MASK: FMI bank 0 sector 4.
-* - FMI_B0S5_MASK: FMI bank 0 sector 5.
-* - FMI_B0S6_MASK: FMI bank 0 sector 6.
-* - FMI_B0S7_MASK: FMI bank 0 sector 7.
-* - FMI_B1S0_MASK: FMI bank 1 sector 0.
-* - FMI_B1S1_MASK: FMI bank 1 sector 1.
-* - FMI_B1S2_MASK: FMI bank 1 sector 2.
-* - FMI_B1S3_MASK: FMI bank 1 sector 3.
-* Output : None
-* Return : The Protection Status of the needed sector.
-* - RESET: The needed sector is not write protected.
-* - SET : The needed sector is write protected.
-*******************************************************************************/
-FlagStatus FMI_GetWriteProtectionStatus(u32 FMI_Sector_Mask)
-{
- u16 Protection_Level_1_Register = 0;
- /* Write a read flash protection level 1 register command */
- *(vu16 *)FMI_BANK_1 = 0x90;
-
- /* Read the flash protection level 1 register */
- Protection_Level_1_Register = *(vu16 *)(FMI_BANK_1 + 0x10);
-
- /* Write a read array command */
- *(vu16 *)FMI_BANK_1 = 0xFF;
-
- if (Protection_Level_1_Register &= FMI_Sector_Mask)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : FMI_WaitForLastOperation
-* Description : Wait until the last operation (Write halfword, Write OTP
-* halfword, Erase sector and Erase bank) completion.
-* Input : FMI_Bank: specifies the bank where the operation is on going.
-* This parameter can be one of the following values:
-* - FMI_BANK_0: FMI bank 0.
-* - FMI_BANK_1: FMI bank 1.
-* Output : None
-* Return : The timeout status.
-* This parameter can be one of the following values:
-* - FMI_TIME_OUT_ERROR: Timeout error occurred.
-* - FMI_NO_TIME_OUT_ERROR: No timeout error.
-*******************************************************************************/
-u8 FMI_WaitForLastOperation(vu32 FMI_Bank)
-{
- u32 Time_Out = 0;
-
- /* Write a read status register command */
- *(vu16 *)(FMI_Bank) = 0x70;
-
- /* Wait until operation compeletion */
- while((!((*(vu16 *)FMI_Bank) & 0x80))&&(Time_Out < TIMEOUT ))
- {
- Time_Out ++; /* Time Out */
- }
-
- /* Write a read array command */
- *(vu16 *)FMI_Bank = 0xFF;
-
- if (Time_Out == TIMEOUT)
- {
- return FMI_TIME_OUT_ERROR;
- }
- else
- {
- return FMI_NO_TIME_OUT_ERROR;
- }
-}
-
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_template91x/str91x_lib/src/91x_gpio.c b/uc_str912/prj_template91x/str91x_lib/src/91x_gpio.c
deleted file mode 100644
index f2d0941..0000000
--- a/uc_str912/prj_template91x/str91x_lib/src/91x_gpio.c
+++ /dev/null
@@ -1,407 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_gpio.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the GPIO software functions.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_gpio.h"
-#include "91x_scu.h"
-
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
- static u8 GPIO_GetGPIONumber(GPIO_TypeDef* GPIOx);
-
-/* Private functions ---------------------------------------------------------*/
-
-/*******************************************************************************
-* Function Name : GPIO_DeInit
-* Description : Deinitializes the GPIOx peripheral registers to their default
-* reset values.
-* Input : GPIOx: where x can be (0..9) to select the GPIO peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void GPIO_DeInit(GPIO_TypeDef* GPIOx)
-{
-
- /* Reset the GPIO registers values */
- if(GPIOx == GPIO0)
- {
- SCU_APBPeriphReset(__GPIO0,ENABLE);
- SCU_APBPeriphReset(__GPIO0,DISABLE);
- SCU->GPIOTYPE[0x00] = 0x0000 ;
- SCU->GPIOOUT[0x00] = 0x0000;
- SCU->GPIOIN[0x00] = 0x0000;
- }
-
- if(GPIOx == GPIO1)
- {
- SCU_APBPeriphReset(__GPIO1,ENABLE);
- SCU_APBPeriphReset(__GPIO1,DISABLE);
- SCU->GPIOTYPE[0x01] = 0x0000 ;
- SCU->GPIOOUT[0x01] = 0x0000;
- SCU->GPIOIN[0x01] = 0x0000;
- }
-
- if(GPIOx == GPIO2)
- {
- SCU_APBPeriphReset(__GPIO2,ENABLE);
- SCU_APBPeriphReset(__GPIO2,DISABLE);
- SCU->GPIOTYPE[0x02] = 0x0000 ;
- SCU->GPIOOUT[0x02] = 0x0000;
- SCU->GPIOIN[0x02] = 0x0000;
- }
-
- if(GPIOx == GPIO3)
- {
- SCU_APBPeriphReset(__GPIO3,ENABLE);
- SCU_APBPeriphReset(__GPIO3,DISABLE);
- SCU->GPIOTYPE[0x03] = 0x0000 ;
- SCU->GPIOOUT[0x03] = 0x0000;
- SCU->GPIOIN[0x03] = 0x0000;
- }
-
- if(GPIOx == GPIO4)
- {
- SCU_APBPeriphReset(__GPIO4,ENABLE);
- SCU_APBPeriphReset(__GPIO4,DISABLE);
- SCU->GPIOTYPE[0x04] = 0x0000 ;
- SCU->GPIOOUT[0x04] = 0x0000;
- SCU->GPIOIN[0x04] = 0x0000;
- SCU->GPIOANA = 0x00;
- }
-
- if(GPIOx == GPIO5)
- {
- SCU_APBPeriphReset(__GPIO5,ENABLE);
- SCU_APBPeriphReset(__GPIO5,DISABLE);
- SCU->GPIOTYPE[0x05] = 0x0000 ;
- SCU->GPIOOUT[0x05] = 0x0000;
- SCU->GPIOIN[0x05] = 0x0000;
- }
-
- if(GPIOx == GPIO6)
- {
- SCU_APBPeriphReset(__GPIO6,ENABLE);
- SCU_APBPeriphReset(__GPIO6,DISABLE);
- SCU->GPIOTYPE[0x06] = 0x0000 ;
- SCU->GPIOOUT[0x06] = 0x0000;
- SCU->GPIOIN[0x06] = 0x0000;
- }
-
- if(GPIOx == GPIO7)
- {
- SCU_APBPeriphReset(__GPIO7,ENABLE);
- SCU_APBPeriphReset(__GPIO7,DISABLE);
- SCU->GPIOOUT[0x07] = 0xAAAA;
- SCU->GPIOOUT[0x07] = 0x0000;
- SCU->GPIOIN[0x07] = 0x0000;
- }
-
- if(GPIOx == GPIO8)
- {
- SCU_APBPeriphReset(__GPIO8,ENABLE);
- SCU_APBPeriphReset(__GPIO8,DISABLE);
- SCU->GPIOEMI = 0x00;
- }
-
- if(GPIOx == GPIO9)
- {
- SCU_APBPeriphReset(__GPIO9,ENABLE);
- SCU_APBPeriphReset(__GPIO9,DISABLE);
- SCU->GPIOEMI = 0x00;
- }
-}
-/*******************************************************************************
-* Function Name : GPIO_Init
-* Description : Initializes the GPIOx peripheral according to the specified
-* parameters in the GPIO_InitStruct .
-* Input :- GPIOx: where x can be (0..9) to select the GPIO peripheral.
-* - GPIO_InitStruct: pointer to a GPIO_InitTypeDef structure that
-* contains the configuration information for the specified GPIO
-* peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct)
-{
- /* Select pin direction */
- u8 PinNumber = 0;
- u8 Counter = 0;
- u8 GPIO_Number = 0;
-
- GPIO_Number = GPIO_GetGPIONumber(GPIOx);
-
-
- if(GPIO_InitStruct->GPIO_Direction == GPIO_PinOutput)
- {
- GPIOx->DDR |= GPIO_InitStruct->GPIO_Pin;
- }
- else
- {
- GPIOx->DDR &= ~GPIO_InitStruct->GPIO_Pin;
- }
-
- for (Counter = 0; Counter < 8;Counter++)
- {
- /*Search pin number*/
- PinNumber = (GPIO_InitStruct->GPIO_Pin & (1 <<Counter));
- if((PinNumber >> Counter) == 1)
- {
- /*Output ALternate 0*/
- SCU->GPIOOUT[GPIO_Number] &= ~(0x3 <<(Counter *2));
- if(GPIO_InitStruct->GPIO_Alternate == GPIO_OutputAlt1)
- {
- /*Output ALternate 1*/
- SCU->GPIOOUT[GPIO_Number] |= 1 << (Counter *2);
- }
- if(GPIO_InitStruct->GPIO_Alternate == GPIO_OutputAlt2)
- {
- /*Output ALternate 2*/
- SCU->GPIOOUT[GPIO_Number] |= 0x2 << (Counter *2);
- }
- if(GPIO_InitStruct->GPIO_Alternate == GPIO_OutputAlt3)
- {
- /*Output ALternate 3*/
- SCU->GPIOOUT[GPIO_Number] |= 0x3 << (Counter *2);
- }
-
- /*Type configuration: PushPull or Open Collector*/
- SCU->GPIOTYPE[GPIO_Number] &= ~(0x1 << Counter) ;
- if(GPIO_InitStruct->GPIO_Type == GPIO_Type_OpenCollector)
- {
- /*Open Drain configuration*/
- SCU->GPIOTYPE[GPIO_Number] |= 0x1 << Counter;
- }
-
- /*IP Connected disable*/
- SCU->GPIOIN[GPIO_Number] &= ~(0x1 << Counter) ;
- if(GPIO_InitStruct->GPIO_IPConnected == GPIO_IPConnected_Enable)
- {
- /*IP Connected enable*/
- SCU->GPIOIN[GPIO_Number] |= 0x1 << Counter;
- }
- }
- }
-}
-
-/*******************************************************************************
-* Function Name : GPIO_StructInit
-* Description : Initialize the GPIO Init Structure parameters
-* Input : GPIO_InitStruct : pointer to a GPIO_InitTypeDef structure
-* which will be initialized.
-* Output : None
-* Return : None
-*******************************************************************************/
-void GPIO_StructInit(GPIO_InitTypeDef* GPIO_InitStruct)
-{
- /* Reset GPIO init structure parameters values */
- GPIO_InitStruct->GPIO_Pin = GPIO_Pin_All;
- GPIO_InitStruct->GPIO_Direction = GPIO_PinInput;
- GPIO_InitStruct->GPIO_Type = GPIO_Type_PushPull;
- GPIO_InitStruct->GPIO_IPConnected = GPIO_IPConnected_Disable;
- GPIO_InitStruct->GPIO_Alternate = GPIO_InputAlt1;
-}
-
-/*******************************************************************************
-* Function Name : GPIO_ReadBit
-* Description : Reads the specified port pin
-* Input : - GPIOx: where x can be (0..9) to select the GPIO peripheral.
-* : - GPIO_Pin: the Pin number. This parameter can be GPIO_Pin_x
-* where x can be (0..7).
-* Output : None
-* Return : The port pin value
-*******************************************************************************/
-u8 GPIO_ReadBit(GPIO_TypeDef* GPIOx, u8 GPIO_Pin)
-{
- if ((((GPIOx->DR[GPIO_Pin<<2])) & GPIO_Pin) != Bit_RESET )
- {
- return Bit_SET;
- }
- else
- {
- return Bit_RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : GPIO_Read
-* Description : Reads the specified GPIO data port
-* Input : - GPIOx: where x can be (0..9) to select the GPIO peripheral.
-* Output : None
-* Return : GPIO data port word value.
-*******************************************************************************/
-u8 GPIO_Read(GPIO_TypeDef* GPIOx)
-{
- return (GPIOx->DR[0x3FC]);
-}
-
-/*******************************************************************************
-* Function Name : GPIO_WriteBit
-* Description : Sets or clears the selected data port bit.
-* Input : - GPIOx: where x can be (0..9) to select the GPIO peripheral.
-* - GPIO_Pin: the Pin number. This parameter can be GPIO_Pin_x
-* where x can be (0..7).
-* - BitVal: this parameter specifies the value to be written
-* to the selected bit.
-* BitVal must be one of the BitAction enum values:
-* - Bit_RESET: to clear the port pin
-* - Bit_SET: to set the port pin
-* Output : None
-* Return : None
-*******************************************************************************/
-void GPIO_WriteBit(GPIO_TypeDef* GPIOx, u8 GPIO_Pin, BitAction BitVal)
-{
- if(BitVal == Bit_SET)
- {
- GPIOx->DR[GPIO_Pin <<2] = GPIO_Pin;
- }
- else
- {
- GPIOx->DR[GPIO_Pin <<2] = 0x00;
- }
-}
-
-/*******************************************************************************
-* Function Name : GPIO_Write
-* Description : Writes the passed value in the selected data GPIOx port
-* register.
-* Input :- GPIOx: where x can be (0..9) to select the GPIO peripheral.
-* - PortVal: the value to be written to the data port register.
-* Output : None
-* Return : None
-*******************************************************************************/
-void GPIO_Write(GPIO_TypeDef* GPIOx, u8 PortVal)
-{
- GPIOx->DR[0x3FC] = PortVal;
-}
-
-/*******************************************************************************
-* Function Name : GPIO_EMIConfig
-* Description : Enables or disables GPIO 8 and 9 in EMI mode.
-* Input : - NewState: new state of the EMI.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void GPIO_EMIConfig(FunctionalState NewState)
-{
- if(NewState == ENABLE)
- {
- SCU->GPIOEMI = 0x01;
- }
- else
- {
- SCU->GPIOEMI = 0x00;
- }
-}
-
-/*******************************************************************************
-* Function Name : GPIO_ANAPinConfig
-* Description : Enables or disables pins from GPIO 4 in Analogue mode.
-* Input :- GPIO_ANAChannel: selects the ADC channel pin.
-* This parameter can be one of the following values:
-* GPIO_ANAChannel0
-* GPIO_ANAChannel1
-* GPIO_ANAChannel2
-* GPIO_ANAChannel3
-* GPIO_ANAChannel4
-* GPIO_ANAChannel5
-* GPIO_ANAChannel6
-* GPIO_ANAChannel7
-* GPIO_ANAChannelALL
-* - NewState: new state of the port pin.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void GPIO_ANAPinConfig(u8 GPIO_ANAChannel, FunctionalState NewState)
-{
-
- if(NewState == ENABLE)
- {
- if(GPIO_ANAChannel == GPIO_ANAChannelALL)
- {
- SCU->GPIOOUT[4] = 0x0000;
- SCU->GPIOIN[4] = 0x00;
- }
- else
- {
- SCU->GPIOOUT[4] &= ~(0x3<<(GPIO_ANAChannel-1));
- SCU->GPIOIN[4] &= ~GPIO_ANAChannel;
- }
- SCU->GPIOANA |= GPIO_ANAChannel;
-
- }
- else
- {
- SCU->GPIOANA &= ~GPIO_ANAChannel;
- }
-}
-
-/*******************************************************************************
-* Function Name : GPIO_GetGPIONumber
-* Description : searche the GPIO number.
-* Input : GPIOx: where x can be (0..9) to select the GPIO peripheral.
-* Output : None
-* Return : GPIO number
-*******************************************************************************/
-u8 GPIO_GetGPIONumber(GPIO_TypeDef* GPIOx)
-{
-
- if(GPIOx == GPIO1)
- {
- return 1;
- }
- if(GPIOx == GPIO2)
- {
- return 2;
- }
- if(GPIOx == GPIO3)
- {
- return 3;
- }
- if(GPIOx == GPIO4)
- {
- return 4;
- }
- if(GPIOx == GPIO5)
- {
- return 5;
- }
- if(GPIOx == GPIO6)
- {
- return 6;
- }
- if(GPIOx == GPIO7)
- {
- return 7;
- }
- if(GPIOx == GPIO8)
- {
- return 8;
- }
- if(GPIOx == GPIO9)
- {
- return 9;
- }
- return 0;
-}
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_template91x/str91x_lib/src/91x_i2c.c b/uc_str912/prj_template91x/str91x_lib/src/91x_i2c.c
deleted file mode 100644
index 9f15adb..0000000
--- a/uc_str912/prj_template91x/str91x_lib/src/91x_i2c.c
+++ /dev/null
@@ -1,616 +0,0 @@
-/******************** (C) COPYRIGHT 2005 STMicroelectronics ********************
-* File Name : 91x_i2c.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the I2C software functions.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_i2c.h"
-#include "91x_scu.h"
-
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-
-/* I2C IT enable */
-#define I2C_IT_Enable 0x01
-#define I2C_IT_Disable 0xFE
-
-/* I2C Peripheral Enable/Disable */
-#define I2C_PE_Set 0x20
-#define I2C_PE_Reset 0xDF
-
-/* Address direction bit */
-#define I2C_ADD0_Set 0x01
-#define I2C_ADD0_Reset 0xFE
-
-/* I2C START Enable/Disable */
-#define I2C_Start_Enable 0x08
-#define I2C_Start_Disable 0xF7
-
-/* I2C STOP Enable/Disable */
-#define I2C_Stop_Enable 0x02
-#define I2C_Stop_Disable 0xFD
-
-/* I2C Masks */
-#define I2C_Frequency_Mask 0x1F
-#define I2C_AddressHigh_Mask 0xF9
-#define I2C_OwnAddress_Mask 0x0300
-#define I2C_StandardMode_Mask 0x7f
-#define I2C_FastMode_Mask 0x80
-#define I2C_Event_Mask 0x3FFF
-#define I2C_HeaderSet_Mask 0xF1
-#define I2C_HeaderReset_Mask 0xFE
-
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/*******************************************************************************
-* Function Name : I2C_DeInit
-* Description : Deinitializes the I2C peripheral registers to their default
-* reset values.
-* Input :- I2Cx: I2C peripheral can be:
-* - I2C0
-* - I2C1
-* Output : None
-* Return : None
-*******************************************************************************/
-void I2C_DeInit(I2C_TypeDef* I2Cx)
-{
- if (I2Cx == I2C0)
- {
- /* Reset the I2C0 registers values */
- SCU_APBPeriphReset(__I2C0, ENABLE);
- SCU_APBPeriphReset(__I2C0, DISABLE);
- }
- if (I2Cx == I2C1)
- {
- /* Reset the I2C1 registers values */
- SCU_APBPeriphReset(__I2C1, ENABLE);
- SCU_APBPeriphReset(__I2C1, DISABLE);
- }
-}
-
-/*******************************************************************************
-* Function Name : I2C_Init
-* Description : Initializes the I2C peripheral according to the specified
-* parameters in the I2C_InitTypeDef structure.
-* Input :- I2Cx: I2C peripheral can be:
-* - I2C0
-* - I2C1
-*
-* - I2C_InitStruct: pointer to an I2C_InitTypeDef structure that
-* contains the configuration information for the specified I2C
-* peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void I2C_Init(I2C_TypeDef* I2Cx, I2C_InitTypeDef* I2C_InitStruct)
-{
- u16 wResult = 0x0F;
- u32 dPCLK = 25000000;
-
- /* Get PCLK frequency value */
- dPCLK = SCU_GetPCLKFreqValue()*1000;
- /* Disable I2C peripheral to set FR[2:0] bits */
- I2C_Cmd (I2Cx, DISABLE);
- /* Clear frequency FR[2:0] bits */
- I2Cx->OAR2 &= I2C_Frequency_Mask;
- /* Set frequency bits depending on PCLK value */
- if ((dPCLK <1667000) & (dPCLK > 10000000))
- I2Cx->OAR2 |= 0x20;
- else if (dPCLK < 26670000)
- I2Cx->OAR2 |= 0x40;
- else if (dPCLK < 40000000)
- I2Cx->OAR2 |= 0x60;
- else if (dPCLK < 53330000)
- I2Cx->OAR2 |= 0x80;
- else if (dPCLK < 66000000)
- I2Cx->OAR2 |= 0xA0;
- else if (dPCLK < 80000000)
- I2Cx->OAR2 |= 0xC0;
- else if (dPCLK < 100000000)
- I2Cx->OAR2 |= 0xE0;
- I2C_Cmd (I2Cx, ENABLE);
-
- /* Configure general call */
- if (I2C_InitStruct->I2C_GeneralCall == I2C_GeneralCall_Enable)
- {
- /* Enable general call */
- I2Cx->CR |= I2C_GeneralCall_Enable;
- }
- else
- {
- /* Disable general call */
- I2Cx->CR &= I2C_GeneralCall_Disable;
- }
- /* Configure acknowledgement */
- if (I2C_InitStruct->I2C_Ack == I2C_Ack_Enable)
- {
- /* Enable acknowledgement */
- I2Cx->CR |= I2C_Ack_Enable;
- }
- else
- {
- /* Disable acknowledgement */
- I2Cx->CR &= I2C_Ack_Disable;
- }
-
- /* Configure LSB own address */
- I2Cx->OAR1 = I2C_InitStruct->I2C_OwnAddress;
- /* Clear MSB own address ADD[9:8] bits */
- I2Cx->OAR2 &= I2C_AddressHigh_Mask;
- /* Set MSB own address value */
- I2Cx->OAR2 |= (I2C_InitStruct->I2C_OwnAddress & I2C_OwnAddress_Mask)>>7;
-
- /* Configure speed in standard mode */
- if (I2C_InitStruct->I2C_CLKSpeed <= 100000)
- {
- /* Standard mode speed calculate */
- wResult = ((dPCLK/I2C_InitStruct->I2C_CLKSpeed)-7)/2;
- /* Set speed value and clear FM/SM bit for standard mode in LSB clock divider */
- I2Cx->CCR = wResult & I2C_StandardMode_Mask;
- }
- /* Configure speed in fast mode */
- else if (I2C_InitStruct->I2C_CLKSpeed <= 400000)
- {
- /* Fast mode speed calculate */
- wResult = ((dPCLK/I2C_InitStruct->I2C_CLKSpeed)-9)/3;
- /* Set speed value and set FM/SM bit for fast mode in LSB clock divider */
- I2Cx->CCR = wResult | I2C_FastMode_Mask;
- }
- /* Set speed in MSB clock divider */
- I2Cx->ECCR = wResult >>7;
-}
-
-/*******************************************************************************
-* Function Name : I2C_StructInit
-* Description : Initialize the I2C Init Structure parameters
-* Input : - I2C_InitStruct: pointer to an I2C_InitTypeDef structure
- which will be initialized.
-* Output : None
-* Return : None.
-*******************************************************************************/
-void I2C_StructInit(I2C_InitTypeDef* I2C_InitStruct)
-{
- /* Initialize the I2C_CLKSpeed member */
- I2C_InitStruct->I2C_CLKSpeed = 5000;
-
- /* Initialize the I2C_OwnAddress member */
- I2C_InitStruct->I2C_OwnAddress = 0x0;
-
- /* Initialize the I2C_GeneralCall member */
- I2C_InitStruct->I2C_GeneralCall = I2C_GeneralCall_Disable;
-
- /* Initialize the I2C_Ack member */
- I2C_InitStruct->I2C_Ack = I2C_Ack_Disable;
-}
-
-/*******************************************************************************
-* Function Name : I2C_Cmd
-* Description : Enables or disables the specified I2C peripheral.
-* Input :- I2Cx: I2C peripheral can be:
-* - I2C0
-* - I2C1
-* - NewState: new state of the I2C peripheral. This parameter
-* can be: ENABLE or DISABLE.
-* Output : None
-* Return : None.
-*******************************************************************************/
-void I2C_Cmd(I2C_TypeDef* I2Cx, FunctionalState NewState)
-{
- if (NewState == ENABLE)
- {
- /* Enable the I2C peripheral by setting twice the PE bit on the CR register */
- I2Cx->CR |= I2C_PE_Set;
- I2Cx->CR |= I2C_PE_Set;
- }
- else
- {
- /* Disable the I2C peripheral */
- I2Cx->CR &= I2C_PE_Reset;
- }
-}
-
-/*******************************************************************************
-* Function Name : I2C_GenerateSTART
-* Description : Generates I2C communication START condition.
-* Input :- I2Cx: I2C peripheral can be:
-* - I2C0
-* - I2C1
-*
-* - NewState: new state of the Start condition. This parameter
-* can be: ENABLE or DISABLE.
-* Output : None
-* Return : None.
-*******************************************************************************/
-void I2C_GenerateStart(I2C_TypeDef* I2Cx, FunctionalState NewState)
-{
- if (NewState == ENABLE)
- {
- /* Generate a START condition */
- I2Cx->CR |= I2C_Start_Enable;
- }
- else
- {
- /* Disable the START condition generation */
- I2Cx->CR &= I2C_Start_Disable;
- }
-}
-
-/*******************************************************************************
-* Function Name : I2C_GenerateSTOP
-* Description : Generates I2C communication STOP condition.
-* Input :- I2Cx: I2C peripheral can be:
-* - I2C0
-* - I2C1
-*
-* - NewState: new state of the Stop condition. This parameter
-* can be: ENABLE or DISABLE.
-* Output : None
-* Return : None.
-*******************************************************************************/
-void I2C_GenerateSTOP(I2C_TypeDef* I2Cx, FunctionalState NewState)
-{
- if (NewState == ENABLE)
- {
- /* Generate a SIOP condition */
- I2Cx->CR |= I2C_Stop_Enable;
- }
- else
- {
- /* Disable the STOP condition generation */
- I2Cx->CR &= I2C_Stop_Disable;
- }
-}
-
-/*******************************************************************************
-* Function Name : I2C_AcknowledgeConfig
-* Description : Enables or disables I2C acknowledge feature.
-* Input :- I2Cx: I2C peripheral can be:
-* - I2C0
-* - I2C1
-* - NewState: new state of the Acknowledgement. This parameter
-* can be: ENABLE or DISABLE.
-* Output : None
-* Return : None.
-*******************************************************************************/
-void I2C_AcknowledgeConfig(I2C_TypeDef *I2Cx, FunctionalState NewState)
-{
- if (NewState == ENABLE)
- {
- /* Enable the acknowledgement */
- I2Cx->CR |= I2C_Ack_Enable;
- }
- else
- {
- /* Disable the acknowledgement */
- I2Cx->CR &= I2C_Ack_Disable;
- }
-}
-
-/*******************************************************************************
-* Function Name : I2C_ITConfig
-* Description : Enables or disables I2C interrupt feature.
-* Input :- I2Cx: I2C peripheral can be:
-* - I2C0
-* - I2C1
-* - NewState: new state of the specified I2C interrupt.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None.
-*******************************************************************************/
-void I2C_ITConfig(I2C_TypeDef *I2Cx, FunctionalState NewState)
-{
- if (NewState == ENABLE)
- {
- /* Enable the I2C interrupt */
- I2Cx->CR |= I2C_IT_Enable;
- }
- else
- {
- /* Disable the I2C interrupt */
- I2Cx->CR &= I2C_IT_Disable;
- }
-}
-
-/*******************************************************************************
-* Function Name : I2C_ReadRegister
-* Description : Reads any I2C register and returns its value.
-* Input :- I2Cx: I2C peripheral can be:
-* - I2C0
-* - I2C1
-* - I2C_Register: the I2C register to be read. This parameter
-* can be one of the following values:
-* - I2C_CR: CR register.
-* - I2C_SR1: SR1 register.
-* - I2C_SR2: SR2 register.
-* - I2C_CCR: CCR register.
-* - I2C_OAR1: OAR1 register.
-* - I2C_OAR2: OAR2 register.
-* - I2C_DR: DR register.
-* - I2C_ECCR: ECCR register.
-* Output : None
-* Return : The value of the register passed as parameter
-*******************************************************************************/
-u8 I2C_ReadRegister(I2C_TypeDef* I2Cx, u8 I2C_Register)
-{
- /* Return the selected register value */
- if (I2Cx == I2C0)
- {
- return (*(u8 *)(I2C0_BASE + I2C_Register));
- }
- if (I2Cx == I2C1)
- {
- return (*(u8 *)(I2C1_BASE + I2C_Register));
- }
- return 0;
-}
-
-/*******************************************************************************
-* Function Name : I2C_GetFlagStatus
-* Description : Checks whether the specified I2C flag is set or not.
-* Input :- I2Cx: I2C peripheral can be:
-* - I2C0
-* - I2C1
-* - I2C_FLAG: flag to check. This parameter can be one of the
-* following values:
-* - I2C_FLAG_SB: Start bit flag
-* - I2C_FLAG_M_SL: Master/Slave flag
-* - I2C_FLAG_ADSL: Adress matched flag
-* - I2C_FLAG_BTF: Byte transfer finished flag
-* - I2C_FLAG_BUSY: Bus busy flag
-* - I2C_FLAG_TRA: Transmitter/Receiver flag
-* - I2C_FLAG_ADD10: 10-bit addressing in Master mode flag
-* - I2C_FLAG_EVF: Event flag
-* - I2C_FLAG_GCAL: General call flag
-* - I2C_FLAG_BERR: Bus error flag
-* - I2C_FLAG_ARLO: Arbitration lost flag
-* - I2C_FLAG_STOPF: Stop detection flag
-* - I2C_FLAG_AF: Acknowledge failure flag
-* - I2C_FLAG_ENDAD: End of address transmission flag
-* - I2C_FLAG_ACK: Acknowledge enable flag
-* Output : None
-* Return : The NewState of the I2C_Flag (SET or RESET).
-*******************************************************************************/
-FlagStatus I2C_GetFlagStatus(I2C_TypeDef* I2Cx, u16 I2C_FLAG)
-{
- u16 wFlag1=0, wFlag2=0, wTmp=0;
-
- wFlag1 = I2Cx->SR2;
- wFlag1 = wFlag1<<8;
- wFlag2 = I2Cx->CR & 0x04;
-
- /* Get all the I2C flags in a unique register*/
- wTmp = (((I2Cx->SR1 | (wFlag1)) & I2C_Event_Mask) | (wFlag2<<12));
-
- /* Check the status of the specified I2C flag */
- if((wTmp & I2C_FLAG) != RESET)
- {
- /* Return SET if I2C_FLAG is set */
- return SET;
- }
- else
- {
- /* Return RESET if I2C_FLAG is reset */
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : I2C_ClearFlag
-* Description : Clears the I2C Flag passed as a parameter
-* Input :- I2Cx: I2C peripheral can be:
-* - I2C0
-* - I2C1
-* - I2C_FLAG: flag to check. This parameter can be one of the
-* following values:
-* - I2C_FLAG_SB: Start bit flag
-* - I2C_FLAG_M_SL: Master/Slave flag
-* - I2C_FLAG_ADSL: Adress matched flag
-* - I2C_FLAG_BTF: Byte transfer finished flag
-* - I2C_FLAG_BUSY: Bus busy flag
-* - I2C_FLAG_TRA: Transmitter/Receiver flag
-* - I2C_FLAG_ADD10: 10-bit addressing in Master mode flag
-* - I2C_FLAG_EVF: Event flag
-* - I2C_FLAG_GCAL: General call flag
-* - I2C_FLAG_BERR: Bus error flag
-* - I2C_FLAG_ARLO: Arbitration lost flag
-* - I2C_FLAG_STOPF: Stop detection flag
-* - I2C_FLAG_AF: Acknowledge failure flag
-* - I2C_FLAG_ENDAD: End of address transmission flag
-* - I2C_FLAG_ACK: Acknowledge enable flag
-* - parameter needed in the case that the flag to be cleared
-* need a write in one register
-* Output : None
-* Return : None.
-*******************************************************************************/
-void I2C_ClearFlag(I2C_TypeDef* I2Cx, u16 I2C_FLAG, ...)
-{
- u8 bTmp = (u8)*((u32 *) & I2C_FLAG + sizeof(I2C_FLAG));
-
- /* flags that need a read of the SR2 register to be cleared */
- if ((I2C_FLAG==I2C_FLAG_ADD10) || (I2C_FLAG==I2C_FLAG_EVF) || (I2C_FLAG==I2C_FLAG_BERR) || (I2C_FLAG==I2C_FLAG_ARLO) |
- (I2C_FLAG==I2C_FLAG_STOPF) ||(I2C_FLAG==I2C_FLAG_AF) || (I2C_FLAG==I2C_FLAG_ENDAD))
- {
- /* Read the SR2 register */
- I2Cx->SR2;
-
- /* Two flags need a second step to be cleared */
- switch (I2C_FLAG)
- {
- case I2C_FLAG_ADD10:
- /* Send the MSB 10bit address passed as second parameter */
- I2Cx->DR = bTmp;
- break;
- case I2C_FLAG_ENDAD:
- /* Write to the I2C_CR register by setting PE bit */
- I2Cx->CR |= I2C_PE_Set;
- break;
- }
- }
-
- /* flags that need a read of the SR1 register to be cleared */
- else if (I2C_FLAG==I2C_FLAG_SB || I2C_FLAG==I2C_FLAG_ADSL || I2C_FLAG==I2C_FLAG_BTF || I2C_FLAG==I2C_FLAG_TRA)
- {
- /* Read the SR1 register */
- (void)I2Cx->SR1;
-
- /* three flags need a second step to be cleared */
- if (I2C_FLAG == I2C_FLAG_SB)
- {
- /* Send the address byte passed as second parameter */
- I2Cx->DR = bTmp;
- }
- else if (I2C_FLAG==I2C_FLAG_BTF || I2C_FLAG==I2C_FLAG_TRA)
- {
- /* return the received byte in the variable passed as second parameter */
- bTmp=I2Cx->DR;
- }
- }
-
- /* flags that need to disable the I2C interface */
- else if ( I2C_FLAG==I2C_FLAG_M_SL || I2C_FLAG==I2C_FLAG_GCAL)
- {
- I2C_Cmd(I2Cx, DISABLE);
- I2C_Cmd(I2Cx, ENABLE);
- }
-}
-
-/*******************************************************************************
-* Function Name : I2C_Send7bitAddress
-* Description : Transmits the address byte to select the slave device.
-* Input :- I2Cx: I2C peripheral can be:
-* - I2C0
-* - I2C1
-* - Address: specifies the slave address which will be transmitted
-* - Direction: specifies whether the I2C device will be a
-* Transmitter or a Receiver. This parameter can be one of the
-* following values
-* - I2C_MODE_TRANSMITTER: Transmitter mode
-* - I2C_MODE_RECEIVER: Receiver mode
-* Output : None
-* Return : None.
-*******************************************************************************/
-void I2C_Send7bitAddress(I2C_TypeDef* I2Cx, u8 Address, u8 Direction)
-{
- /* Test on the direction to define the read/write bit */
- if (Direction == I2C_MODE_RECEIVER)
- {
- /* Set the address bit0 for read */
- Address |= I2C_ADD0_Set;
- }
- else
- {
- /* Reset the address bit0 for write */
- Address &= I2C_ADD0_Reset;
- }
- /* Send the address */
- I2Cx->DR = Address;
-}
-
-/*******************************************************************************
-* Function Name : I2C_SendData
-* Description : Send a data byte.
-* Input :- I2Cx: I2C peripheral can be:
-* - I2C0
-* - I2C1
-* - bData : the byte to be sent
-* Output : None
-* Return : None.
-*******************************************************************************/
-void I2C_SendData(I2C_TypeDef* I2Cx, u8 bData)
-{
- /* Write in the DR register the byte to be sent */
- I2Cx->DR = bData;
-}
-
-/*******************************************************************************
-* Function Name : I2C_ReceiveData
-* Description : Read the received byte.
-* Input : - I2Cx: I2C peripheral can be:
-* - I2C0
-* - I2C1
-* Output : None
-* Return : The received byte
-*******************************************************************************/
-u8 I2C_ReceiveData(I2C_TypeDef* I2Cx)
-{
- /* Return from the DR register the received byte */
- return I2Cx->DR;
-}
-
-/*******************************************************************************
-* Function Name : I2C_GetLastEvent
-* Description : Get the Last happened I2C Event.
-* Input :- I2Cx: I2C peripheral can be:
-* - I2C0
-* - I2C1
-* Output : None
-* Return : The Last happened Event.
-*******************************************************************************/
-u16 I2C_GetLastEvent(I2C_TypeDef* I2Cx)
-{
- u16 wFlag1=0, wLastEvent=0;
- wFlag1 = I2Cx->SR2;
- wFlag1 = wFlag1<<8;
- /* Get the last event value from I2C status register */
- wLastEvent = (((I2Cx->SR1 | (wFlag1)) & I2C_Event_Mask));
- /* Return the last event */
- return wLastEvent;
-}
-
-/*******************************************************************************
-* Function Name : I2C_CheckEvent
-* Description : Checks whether the Last I2C Event is equal to the one passed
-* as parameter.
-* Input :- I2Cx: I2C peripheral can be:
-* - I2C0
-* - I2C1
-* - I2C_EVENT: the event to check. This parameter can be one of
-* the following values:
-* - I2C_EVENT_SLAVE_ADDRESS_MATCHED
-* - I2C_EVENT_SLAVE_BYTE_RECEIVED
-* - I2C_EVENT_SLAVE_BYTE_TRANSMITTED
-* - I2C_EVENT_MASTER_MODE_SELECT
-* - I2C_EVENT_MASTER_MODE_SELECTED
-* - I2C_EVENT_MASTER_BYTE_RECEIVED
-* - I2C_EVENT_MASTER_BYTE_TRANSMITTED
-* - I2C_EVENT_MASTER_MODE_ADDRESS10
-* - I2C_EVENT_SLAVE_STOP_DETECTED
-* - I2C_EVENT_SLAVE_ACK_FAILURE
-* Output : None
-* Return : An ErrorStatus enumuration value:
-* - SUCCESS: Last event is equal to the I2C_Event
-* - ERROR: Last event is different from the I2C_Event
-*******************************************************************************/
-ErrorStatus I2C_CheckEvent(I2C_TypeDef* I2Cx,u16 I2C_EVENT)
-{
- u16 wLastEvent = I2C_GetLastEvent(I2Cx);
-
- /* Check whther the last event is equal to I2C_EVENT */
- if (wLastEvent == I2C_EVENT)
- {
- /* Return SUCCESS when last event is equal to I2C_EVENT */
- return SUCCESS;
- }
- else
- {
- /* Return ERROR when last event is different from I2C_EVENT */
- return ERROR;
- }
-}
-
-/******************* (C) COPYRIGHT 2005 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_template91x/str91x_lib/src/91x_lib.c b/uc_str912/prj_template91x/str91x_lib/src/91x_lib.c
deleted file mode 100644
index 3fab413..0000000
--- a/uc_str912/prj_template91x/str91x_lib/src/91x_lib.c
+++ /dev/null
@@ -1,281 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_lib.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all peripherals pointers
- : initialization.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-#define EXT
-
-/* Standard include ----------------------------------------------------------*/
-#include "91x_map.h"
-
-/* Include of other module interface headers ---------------------------------*/
-/* Local includes ------------------------------------------------------------*/
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/* Interface functions -------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-#ifdef LIBDEBUG
-
-/*******************************************************************************
-* Function Name : debug
-* Description : this function initialize peripherals pointers
-* Input : no one
-* Output : no one
-* Return : no one
-*******************************************************************************/
-void libdebug(void)
-{
-
-
-/************************* DMA *************************/
-
-#ifdef _DMA
- DMA = (DMA_TypeDef *)DMA_BASE;
-#endif /* _DMA */
-
-/************************* DMA *************************/
-
-
-#ifdef _DMA_Channel0
- DMA_Channel0= (DMA_Channel_TypeDef *)DMA_Channel0_BASE;
-#endif /* _DMA_Channel0 */
-
-#ifdef _DMA_Channel1
- DMA_Channel1= (DMA_Channel_TypeDef *)DMA_Channel1_BASE;
-#endif /* _DMA_Channel1 */
-
-#ifdef _DMA_Channel2
- DMA_Channel2 = (DMA_Channel_TypeDef *)DMA_Channel2_BASE;
-#endif /* _DMA_Channel2 */
-
-#ifdef _DMA_Channel3
- DMA_Channel3 = (DMA_Channel_TypeDef *)DMA_Channel3_BASE;
-#endif /* _DMA_Channel3 */
-
-#ifdef _DMA_Channel4
- DMA_Channel4 = (DMA_Channel_TypeDef *)DMA_Channel4_BASE;
-#endif /* _DMA_Channel4 */
-
-#ifdef _DMA_Channel5
- DMA_Channel5= (DMA_Channel_TypeDef *)DMA_Channel5_BASE;
-#endif /* _DMA_Channel5*/
-
-
-#ifdef _DMA_Channel6
- DMA_Channel6 = (DMA_Channel_TypeDef *)DMA_Channel6_BASE;
-#endif /* _DMA_Channel6 */
-
-#ifdef _DMA_Channel7
- DMA_Channel7 = (DMA_Channel_TypeDef *)DMA_Channel7_BASE;
-#endif /* _DMA_Channel7 */
-
-
-
- /************************* EMI *************************/
-
-#ifdef _EMI_Bank0
- EMI_Bank0= (EMI_Bank_TypeDef *)EMI_Bank0_BASE;
-#endif /* _EMI_Bank0 */
-
-#ifdef _EMI_Bank1
- EMI_Bank1= (EMI_Bank_TypeDef *)EMI_Bank1_BASE;
-#endif /* _EMI_Bank1 */
-
-#ifdef _EMI_Bank2
- EMI_Bank2 = (EMI_Bank_TypeDef *)EMI_Bank2_BASE;
-#endif /* _EMI_Bank2 */
-
-#ifdef _EMI_Bank3
- EMI_Bank3 = (EMI_Bank_TypeDef *)EMI_Bank3_BASE;
- #endif /* _EMI_Bank3 */
-
-
-
-/************************* AHBAPB *************************/
-
-#ifdef _AHBAPB0
- AHBAPB0 = (AHBAPB_TypeDef *)AHBAPB0_BASE;
-#endif /* _AHBAPB0 */
-
-#ifdef _AHBAPB1
- AHBAPB1 = (AHBAPB_TypeDef *)AHBAPB1_BASE;
-#endif /*_AHBAPB1 */
-
-
-
-/************************* FMI *************************/
-
-#ifdef _FMI
- FMI = (FMI_TypeDef *)FMI_BASE;
-#endif /* _FMI */
-
-/************************* VIC *************************/
-
-#ifdef _VIC0
- VIC0 = (VIC_TypeDef *)VIC0_BASE;
-#endif /* _VIC0 */
-
-#ifdef _VIC1
- VIC1 = (VIC_TypeDef *)VIC1_BASE;
-#endif /* _VIC1 */
-
-/************************* WIU *************************/
-
-#ifdef _WIU
- WIU = (WIU_TypeDef *)WIU_BASE;
-#endif /* _WIU */
-
-/************************* TIM *************************/
-
-#ifdef _TIM0
- TIM0 = (TIM_TypeDef *)TIM0_BASE;
-#endif /* _TIM0 */
-
-#ifdef _TIM1
- TIM1 = (TIM_TypeDef *)TIM1_BASE;
-#endif /* _TIM1 */
-
-#ifdef _TIM2
- TIM2 = (TIM_TypeDef *)TIM2_BASE;
-#endif /* _TIM2 */
-
-#ifdef _TIM3
- TIM3 = (TIM_TypeDef *)TIM3_BASE;
-#endif /* _TIM3 */
-
-/************************* GPIO ************************/
-
-#ifdef _GPIO0
- GPIO0 = (GPIO_TypeDef *)GPIO0_BASE;
-#endif /* _GPIO0 */
-
-#ifdef _GPIO1
- GPIO1 = (GPIO_TypeDef *)GPIO1_BASE;
-#endif /* _GPIO1 */
-
-#ifdef _GPIO2
- GPIO2 = (GPIO_TypeDef *)GPIO2_BASE;
-#endif /* _GPIO2 */
-
-#ifdef _GPIO3
- GPIO3 = (GPIO_TypeDef *)GPIO3_BASE;
-#endif /* _GPIO3 */
-
-#ifdef _GPIO4
- GPIO4 = (GPIO_TypeDef *)GPIO4_BASE;
-#endif /* _GPIO4 */
-
-#ifdef _GPIO5
- GPIO5 = (GPIO_TypeDef *)GPIO5_BASE;
-#endif /* _GPIO5 */
-
-#ifdef _GPIO6
- GPIO6 = (GPIO_TypeDef *)GPIO6_BASE;
-#endif /* _GPIO6 */
-
-#ifdef _GPIO7
- GPIO7 = (GPIO_TypeDef *)GPIO7_BASE;
-#endif /* _GPIO7 */
-
-#ifdef _GPIO8
- GPIO8 = (GPIO_TypeDef *)GPIO8_BASE;
-#endif /* _GPIO8 */
-
-#ifdef _GPIO9
- GPIO9 = (GPIO_TypeDef *)GPIO9_BASE;
-#endif /* _GPIO9 */
-
-/************************* RTC *************************/
-
-#ifdef _RTC
- RTC = (RTC_TypeDef *)RTC_BASE;
-#endif /* _RTC */
-
-/************************* PRCCU ***********************/
-
-#ifdef _SCU
- SCU = (SCU_TypeDef *)SCU_BASE;
-#endif /* _PRCCU */
-
-/************************** MC *************************/
-
-#ifdef _MC
- MC = (MC_TypeDef *)MC_BASE;
-#endif /* _MC */
-
-/************************* UART ************************/
-
-#ifdef _UART0
- UART0 = (UART_TypeDef *)UART0_BASE;
-#endif /* _UART0 */
-
-#ifdef _UART1
- UART1 = (UART_TypeDef *)UART1_BASE;
-#endif /* _UART1 */
-
-#ifdef _UART2
- UART2 = (UART_TypeDef *)UART2_BASE;
-#endif /* _UART2 */
-
-/************************* SSP *************************/
-
-#ifdef _SSP0
- SSP0 = (SSP_TypeDef *)SSP0_BASE;
-#endif /* _SSP0 */
-
-#ifdef _SSP1
- SSP1 = (SSP_TypeDef *)SSP1_BASE;
-#endif /* _SSP1 */
-
-/************************* CAN *************************/
-
-#ifdef _CAN
- CAN = (CAN_TypeDef *)CAN_BASE;
-#endif /* _CAN */
-
-/************************* ADC *************************/
-
-#ifdef _ADC
- ADC = (ADC_TypeDef *)ADC_BASE;
-#endif /* _ADC */
-
-/************************* WDG *************************/
-
-#ifdef _WDG
- WDG = (WDG_TypeDef *)WDG_BASE;
-#endif /* _WDG */
-
-/************************* I2C *************************/
-
-#ifdef _I2C0
- I2C0 = (I2C_TypeDef *)I2C0_BASE;
-#endif /* _I2C0 */
-
-#ifdef _I2C1
- I2C1 = (I2C_TypeDef *)I2C1_BASE;
-#endif /* _I2C1 */
-/********************** ENET **************************/
-#ifdef _ENET
- ENET_MAC = (ENET_MAC_TypeDef *)ENET_MAC_BASE;
- ENET_DMA = (ENET_DMA_TypeDef *)ENET_DMA_BASE;
-#endif /* _ENET */
-}
-#endif /* LIBDEBUG */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_template91x/str91x_lib/src/91x_mc.c b/uc_str912/prj_template91x/str91x_lib/src/91x_mc.c
deleted file mode 100644
index d3ca96a..0000000
--- a/uc_str912/prj_template91x/str91x_lib/src/91x_mc.c
+++ /dev/null
@@ -1,932 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_mc.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the MC software functions.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_mc.h"
-#include "91x_scu.h"
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-
-#define MC_ODCS_Set 0x0001
-#define MC_ODCS_Reset 0x00FE
-
-#define MC_CMS_Set 0x0004
-#define MC_CMS_Reset 0x00FB
-
-#define MC_CPC_Set 0x0008
-#define MC_CTC_Set 0x0010
-
-#define MC_PCE_Set 0x0020
-#define MC_PCE_Reset 0xFFDF
-
-#define MC_TCE_Set 0x0040
-#define MC_TCE_Reset 0x00BF
-
-#define MC_DTE_Set 0x0080
-#define MC_DTE_Reset 0x007F
-
-#define MC_TCB_Set 0x0004
-#define MC_TCB_Reset 0x00FB
-
-#define MC_STC_Set 0x0008
-
-#define MC_TES_Set 0x0010
-#define MC_TES_Reset 0x00EF
-
-#define MC_CCPT_Set 0x0020
-#define MC_CCPT_Reset 0x005F
-
-#define MC_DISEST_Set 0x0040
-#define MC_DISEST_Reset 0x003F
-
-#define MC_DTS_Set 0x0001
-#define MC_DTS_Reset 0x00FE
-
-#define MC_SDT_Set 0x0002
-
-#define MC_C0SE_Set 0x0004
-#define MC_C0SE_Reset 0x00FB
-
-#define MC_CUSE_Set 0x0008
-#define MC_CUSE_Reset 0x00F7
-
-#define MC_CVSE_Set 0x0010
-#define MC_CVSE_Reset 0x00EF
-
-#define MC_CWSE_Set 0x0020
-#define MC_CWSE_Reset 0x00D0
-
-#define MC_RSE_Set 0x0040
-#define MC_RSE_Reset 0x00BF
-
-#define MC_GPI_Set 0x0080
-#define MC_GPI_Reset 0x007F
-
-#define MC_PUH_Set 0x0020
-#define MC_PUH_Reset 0x005F
-#define MC_PUL_Set 0x0010
-#define MC_PUL_Reset 0x006F
-
-#define MC_PVH_Set 0x0008
-#define MC_PVH_Reset 0x0077
-#define MC_PVL_Set 0x0004
-#define MC_PVL_Reset 0x007B
-
-#define MC_PWH_Set 0x0002
-#define MC_PWH_Reset 0x007D
-#define MC_PWL_Set 0x0001
-#define MC_PWL_Reset 0x007E
-
-#define MC_ODS_Set 0x0040
-#define MC_ODS_Reset 0xFF3F
-
-#define MC_ESC_Clear 0x4321
-
-#define MC_PCR1_TIN_MASK 0xFFFC
-#define MC_OPR_Mask 0x0040
-#define MC_UDCS_Mask 0x0002
-/* Private function prototypes -----------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/******************************************************************************
-* Function Name : MC_DeInit
-* Description : Deinitializes MC peripheral registers to their default reset
-* values.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_DeInit(void)
-{
- /* MC peripheral is under Reset */
- SCU_APBPeriphReset(__MC, ENABLE);
-
- /* MC peripheral Reset off */
- SCU_APBPeriphReset(__MC, DISABLE);
-}
-
-/*******************************************************************************
-* Function Name : MC_Init
-* Description : Initializes the MC peripheral according to the specified
-* parameters in the MC_InitStruct .
-* Input : IMC_InitStruct: pointer to a MC_InitTypeDef structure that
-* contains the configuration information for the MC peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_Init(MC_InitTypeDef* MC_InitStruct)
-{
- /* Select the operating Mode */
- if(MC_InitStruct->MC_OperatingMode == MC_SoftwareOperating_Mode)
- {
- /* Select the Data transfer Mode */
- MC->PCR2 |= MC_DTS_Set;
-
- /* Enable the registers Software Data Transfer */
- MC->PCR2 |= MC_C0SE_Set | MC_CUSE_Set | MC_CVSE_Set | MC_CWSE_Set
- |MC_RSE_Set;
-
- }
- else
- {
- /* Select the Data transfer Mode */
- MC->PCR2 &= MC_DTS_Reset;
-
- /* Disable the registers Software Data Transfer */
- MC->PCR2 &= MC_C0SE_Reset | MC_CUSE_Reset | MC_CVSE_Reset | MC_CWSE_Reset
- |MC_RSE_Reset;
- }
-
- /* Select the MC PWM counter Mode */
- if(MC_InitStruct->MC_PWMMode == MC_PWMZeroCentered_Mode)
- {
- MC->PCR0 |= MC_CMS_Set;
- }
- else
- {
- MC->PCR0 &= MC_CMS_Reset;
- }
-
- /* Set the MC PWM counter Prescaler */
- MC->CPRS = MC_InitStruct->MC_Prescaler;
-
- /* Set the MC PWM Period */
- MC->CMP0 = MC_InitStruct->MC_Period;
-
- /* Set the MC PWM Repetition counter */
- MC->REP = MC_InitStruct->MC_RepetitionCounter;
-
- /* Set the Tacho Compare value */
- MC->TCMP = MC_InitStruct->MC_TachoPeriod;
-
- /* Set the Tacho Prescaler value */
- MC->TPRS = MC_InitStruct->MC_TachoPrescaler;
-
- /* Set the MC Tacho Input Polarity */
- MC->PCR1 = (MC->PCR1 & MC_PCR1_TIN_MASK) | MC_InitStruct->MC_TachoPolarity;
-
- /* Set the MC PWM Forced State */
- MC->OPR |= MC_ODS_Set;
- MC->OPR = (MC->OPR & MC_OPR_Mask) | MC_InitStruct->MC_ForcedPWMState;
-
- /* Select the Tacho Mode */
- if(MC_InitStruct->MC_TachoMode == MC_TachoOneShot_Mode)
- {
- MC->PCR1 |= MC_TCB_Set;
- }
- else
- {
- MC->PCR1 &= MC_TCB_Reset;
- }
-
- /* Select the Tacho Event Mode */
- if(MC_InitStruct->MC_TachoEvent_Mode == MC_TachoEvent_Software_Mode)
- {
- MC->PCR1 |= MC_TES_Set;
- }
- else
- {
- MC->PCR1 &= MC_TES_Reset;
- }
-
- /* Enable or disable the emergency input */
- if(MC_InitStruct->MC_Emergency == MC_Emergency_Enable)
- {
- MC->PCR1 &= MC_DISEST_Reset;
- }
- else
- {
- MC->PCR1 |= MC_DISEST_Set;
- }
-
-/* Select the complementary Mode */
- if(MC_InitStruct->MC_Complementary == MC_Complementary_Enable)
- {
- MC->DTG = MC_InitStruct->MC_DeadTime;
- MC->PCR0 |= MC_ODCS_Set;
- }
- else
- {
- MC->PCR0 &= MC_ODCS_Reset;
- }
-
- /* Tacho Mode selection */
- if(MC_InitStruct->MC_TachoMode == MC_TachoOneShot_Mode)
- {
- MC->PCR1 |= MC_TCB_Set;
- }
- else
- {
- MC->PCR1 &= MC_TCB_Reset;
- }
-
- switch(MC_InitStruct->MC_Channel)
- {
- /* Channel U configuration */
- case MC_Channel_U:
- {
- MC->CMPU = MC_InitStruct->MC_PulseU;
-
- if(MC_InitStruct->MC_PolarityUL == MC_Polarity_Inverted)
- {
- MC->PSR |= MC_PUL_Set;
- }
- else
- {
- MC->PSR &= MC_PUL_Reset;
- }
- if(MC_InitStruct->MC_PolarityUH == MC_Polarity_Inverted)
- {
- MC->PSR |= MC_PUH_Set;
- }
- else
- {
- MC->PSR &= MC_PUH_Reset;
- }
- break;
- }
-
- /* Channel V configuration */
- case MC_Channel_V:
- {
- MC->CMPV = MC_InitStruct->MC_PulseV;
-
- if(MC_InitStruct->MC_PolarityVL == MC_Polarity_Inverted)
- {
- MC->PSR |= MC_PVL_Set;
- }
- else
- {
- MC->PSR &= MC_PVL_Reset;
- }
- if(MC_InitStruct->MC_PolarityVH == MC_Polarity_Inverted)
- {
- MC->PSR |= MC_PVH_Set;
- }
- else
- {
- MC->PSR &= MC_PVH_Reset;
- }
- break;
- }
-
- /* Channel W configuration */
- case MC_Channel_W:
- {
- MC->CMPW = MC_InitStruct->MC_PulseW;
-
- if(MC_InitStruct->MC_PolarityWL == MC_Polarity_Inverted)
- {
- MC->PSR |= MC_PWL_Set;
- }
- else
- {
- MC->PSR &= MC_PWL_Reset;
- }
- if(MC_InitStruct->MC_PolarityWH == MC_Polarity_Inverted)
- {
- MC->PSR |= MC_PWH_Set;
- }
- else
- {
- MC->PSR &= MC_PWH_Reset;
- }
- break;
- }
- /* All Channel Configuration */
- case MC_Channel_ALL:
- {
- MC->CMPU = MC_InitStruct->MC_PulseU;
- MC->CMPV = MC_InitStruct->MC_PulseV;
- MC->CMPW = MC_InitStruct->MC_PulseW;
-
- if(MC_InitStruct->MC_PolarityUL == MC_Polarity_Inverted)
- {
- MC->PSR |= MC_PUL_Set;
- }
- else
- {
- MC->PSR &= MC_PUL_Reset;
- }
- if(MC_InitStruct->MC_PolarityUH == MC_Polarity_Inverted)
- {
- MC->PSR |= MC_PUH_Set;
- }
- else
- {
- MC->PSR &= MC_PUH_Reset;
- }
-
- if(MC_InitStruct->MC_PolarityVL == MC_Polarity_Inverted)
- {
- MC->PSR |= MC_PVL_Set;
- }
- else
- {
- MC->PSR &= MC_PVL_Reset;
- }
- if(MC_InitStruct->MC_PolarityVH == MC_Polarity_Inverted)
- {
- MC->PSR |= MC_PVH_Set;
- }
- else
- {
- MC->PSR &= MC_PVH_Reset;
- }
-
- if(MC_InitStruct->MC_PolarityWL == MC_Polarity_Inverted)
- {
- MC->PSR |= MC_PWL_Set;
- }
- else
- {
- MC->PSR &= MC_PWL_Reset;
- }
- if(MC_InitStruct->MC_PolarityWH == MC_Polarity_Inverted)
- {
- MC->PSR |= MC_PWH_Set;
- }
- else
- {
- MC->PSR &= MC_PWH_Reset;
- }
- }
- default:
- break;
- }
-}
-
-/*******************************************************************************
-* Function Name : MC_StructInit
-* Description : Fills each MC_InitStruct member with its default value.
-* Input : MC_InitStruct : pointer to a MC_InitTypeDef structure which
-* will be initialized.
-* Output : None
-* Return : None.
-*******************************************************************************/
-void MC_StructInit(MC_InitTypeDef* MC_InitStruct)
-{
- MC_InitStruct->MC_OperatingMode = MC_HardwareOperating_Mode;
- MC_InitStruct->MC_TachoMode = MC_TachoContinuous_Mode;
- MC_InitStruct->MC_TachoEvent_Mode = MC_TachoEvent_Hardware_Mode;
- MC_InitStruct->MC_Prescaler = 0x00;
- MC_InitStruct->MC_TachoPrescaler = 0x0000;
- MC_InitStruct->MC_PWMMode = MC_PWMClassical_Mode;
- MC_InitStruct->MC_Complementary = MC_Complementary_Enable;
- MC_InitStruct->MC_Emergency = MC_Emergency_Disable;
- MC_InitStruct->MC_ForcedPWMState = 0x003F;
- MC_InitStruct->MC_Period = 0x0000;
- MC_InitStruct->MC_TachoPeriod = 0x00FF;
- MC_InitStruct->MC_Channel = MC_Channel_ALL;
- MC_InitStruct->MC_PulseU = 0x0000;
- MC_InitStruct->MC_PulseV = 0x0000;
- MC_InitStruct->MC_PulseW = 0x0000;
- MC_InitStruct->MC_PolarityUL = MC_Polarity_NonInverted;
- MC_InitStruct->MC_PolarityUH = MC_Polarity_NonInverted;
- MC_InitStruct->MC_PolarityVL = MC_Polarity_NonInverted;
- MC_InitStruct->MC_PolarityVH = MC_Polarity_NonInverted;
- MC_InitStruct->MC_PolarityWL = MC_Polarity_NonInverted;
- MC_InitStruct->MC_PolarityWH = MC_Polarity_NonInverted;
- MC_InitStruct->MC_TachoPolarity = MC_TachoEventEdge_RisingFalling;
- MC_InitStruct->MC_DeadTime = 0x003F;
- MC_InitStruct->MC_RepetitionCounter = 0x0000;
-}
-
-/*******************************************************************************
-* Function Name : MC_Cmd
-* Description : Enables or disables the MC peripheral.
-* Input : Newstate: new state of the MC peripheral.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_Cmd(FunctionalState NewState)
-{
- if(NewState == ENABLE)
- {
- /* Enable the PWM counter */
- MC->PCR0 |= MC_PCE_Set;
-
- /* Enable the Tacho counter */
- MC->PCR0 |= MC_TCE_Set;
-
- /* Enable the Dead Time counter */
- MC->PCR0 |= MC_DTE_Set;
- }
- else
- {
- /* Disable the PWM counter */
- MC->PCR0 &= MC_PCE_Reset;
-
- /* Disable the Tacho counter */
- MC->PCR0 &= MC_TCE_Reset;
-
- /* Disable the Dead counter */
- MC->PCR0 &= MC_DTE_Reset;
- }
-}
-
-/*******************************************************************************
-* Function Name : MC_ClearPWMCounter
-* Description : Clears the MC PWM counter.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_ClearPWMCounter(void)
-{
-/* Clear the PWM counter */
- MC->PCR0 |= MC_CPC_Set;
-}
-
-/*******************************************************************************
-* Function Name : MC_ClearTachoCounter
-* Description : Clears the MC Tacho counter.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_ClearTachoCounter(void)
-{
-/* Clear the Tacho counter */
- MC->PCR0 |= MC_CTC_Set;
-}
-
-/*******************************************************************************
-* Function Name : MC_CtrlPWMOutputs
-* Description : Enables or disables MC peripheral Main Outputs.
-* Input : Newstate: new state of the MC peripheral Main Outputs.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_CtrlPWMOutputs(FunctionalState Newstate)
-{
- if(Newstate == ENABLE)
- {
- /* Enable the dead time generator data */
- MC->OPR &= MC_ODS_Reset;
- }
- else
- {
- /* Enable the default state data */
- MC->OPR |= MC_ODS_Set;
- }
-}
-
-/*******************************************************************************
-* Function Name : MC_ITConfig
-* Description : Enables or disables the MC interrupts.
-* Input : - MC_IT: specifies the MC interrupts sources to be enabled
-* or disabled.
-* This parameter can be any combination of the following values:
-* - MC_IT_CMPW: Compare W Interrupt.
-* - MC_IT_CMPV: Compare V Interrupt.
-* - MC_IT_CMPU: Compare U Interrupt.
-* - MC_IT_ZPC: Zero of PWM counter Interrupt.
-* - MC_IT_ADT: Automatic Data Transfer Interrupt.
-* - MC_IT_OTC: Overflow of Tacho counter Interrupt.
-* - MC_IT_CPT: Capture of Tacho counter Interrupt.
-* - MC_IT_CM0: Compare 0 Interrupt.
-* - Newstate: new state of IMC interrupts.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_ITConfig(u16 MC_IT, FunctionalState NewState)
-{
- if(NewState == ENABLE)
- {
- /* Enable the specific interrupt source */
- MC->IMR |= MC_IT;
-
- /* Enable the global peripheral interrupt sources */
- MC->PCR2 |= MC_GPI_Set;
- }
- else
- {
- /* Disable the specific interrupt source */
- MC->IMR &= ~MC_IT;
-
- /* Disable the global peripheral interrupt sources */
- MC->PCR2 &= MC_GPI_Reset;
- }
-}
-
-/*******************************************************************************
-* Function Name : MC_SetPrescaler
-* Description : Sets the MC prescaler value.
-* Input : MC_Prescaler: MC prescaler new value.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_SetPrescaler(u8 MC_Prescaler)
-{
-/* Set the Prescaler Register value */
- MC->CPRS = MC_Prescaler;
-}
-
-/*******************************************************************************
-* Function Name : MC_SetPeriod
-* Description : Sets the MC period value.
-* Input : MC_Period: MC period new value.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_SetPeriod(u16 MC_Period)
-{
-/* Set the Period Register value */
- MC->CMP0 = MC_Period;
-}
-
-/*******************************************************************************
-* Function Name : MC_SetPulseU
-* Description : Sets the MC pulse U value.
-* Input : MC_PulseU: MC pulse U new value.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_SetPulseU(u16 MC_PulseU)
-{
-/* Set the Pulse U Register value */
- MC->CMPU = MC_PulseU;
-}
-
-/*******************************************************************************
-* Function Name : MC_SetPulseV
-* Description : Sets the MC pulse V value.
-* Input : MC_PulseV: MC pulse V new value.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_SetPulseV(u16 MC_PulseV)
-{
-/* Set the Pulse V Register value */
- MC->CMPV = MC_PulseV;
-}
-
-/*******************************************************************************
-* Function Name : MC_SetPulseW
-* Description : Sets the MC pulse W value.
-* Input : MC_PulseW: MC pulse W new value.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_SetPulseW(u16 MC_PulseW)
-{
-/* Set the Pulse W Register value */
- MC->CMPW = MC_PulseW;
-}
-
-/*******************************************************************************
-* Function Name : MC_PWMModeConfig
-* Description : Selects the MC PWM counter Mode.
-* Input : MC_PWMMode: MC PWM counter Mode.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_PWMModeConfig(u16 MC_PWMMode)
-{
- /* Select the MC PWM counter Mode */
- if(MC_PWMMode == MC_PWMZeroCentered_Mode)
- {
- MC->PCR0 |= MC_CMS_Set;
- }
- else
- {
- MC->PCR0 &= MC_CMS_Reset;
- }
-}
-
-/*******************************************************************************
-* Function Name : MC_SetDeadTime
-* Description : Sets the MC dead time value.
-* Input : MC_DeadTime: MC dead time new value.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_SetDeadTime(u16 MC_DeadTime)
-{
-/* Set the dead time Register value */
- MC->DTG = MC_DeadTime;
-}
-
-/*******************************************************************************
-* Function Name : MC_SetTachoCompare
-* Description : Sets the MC Tacho Compare Register value.
-* Input : MC_Compare: MC Tacho compare new value.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_SetTachoCompare(u8 MC_Compare)
-{
- /* Sets the Tacho Compare Register value */
- MC->TCMP = MC_Compare;
-}
-/*******************************************************************************
-* Function Name : MC_EmergencyCmd
-* Description : Enables or disables the MC emergency feauture.
-* Input : Newstate: new state of the MC peripheral Emergency.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_EmergencyCmd(FunctionalState NewState)
-{
- if(NewState == ENABLE)
- {
- /* Reset the DISEST Bit in the PCR1 Register to enable the emergency stop input */
- MC->PCR1 &= MC_DISEST_Reset;
- }
- else
- {
- /* Set the DISEST Bit in the PCR1 Register to disable the emergency stop input */
- MC->PCR1 |= MC_DISEST_Reset;
- }
-}
-
-/*******************************************************************************
-* Function Name : MC_EmergencyClear
-* Description : Clears the MC Emergency Register.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_EmergencyClear(void)
-{
-/* Force PWM outputs in safe state (All OFF) */
- MC->OPR |= MC_ODS_Set;
-
-/* Clear EST bit */
- MC->ESC = MC_ESC_Clear;
-
-/* Re-enable protection */
- MC->ESC = 0;
-
-/* Enables the Outputs */
- MC->OPR &= MC_ODS_Reset;
-}
-
-/*******************************************************************************
-* Function Name : MC_GetPeriod
-* Description : Gets the MC period value.
-* Input : None
-* Output : None
-* Return : MC period value.
-*******************************************************************************/
-u16 MC_GetPeriod(void)
-{
-/* Return the PWM signal period value */
- return MC->CMP0;
-}
-
-/*******************************************************************************
-* Function Name : MC_GetPulseU
-* Description : Gets the MC pulse U value.
-* Input : None
-* Output : None
-* Return : MC pulse U value.
-*******************************************************************************/
-u16 MC_GetPulseU(void)
-{
-/* Return the PWM pulse U Register value */
- return MC->CMPU;
-}
-
-/*******************************************************************************
-* Function Name : MC_GetPulseV
-* Description : Gets the MC pulse V value.
-* Input : None
-* Output : None
-* Return : MC pulse V value.
-*******************************************************************************/
-u16 MC_GetPulseV(void)
-{
-/* Return the PWM pulse V Register value */
- return MC->CMPV;
-}
-
-/*******************************************************************************
-* Function Name : MC_GetPulseW
-* Description : Gets the MC pulse W value.
-* Input : None
-* Output : None
-* Return : MC pulse W value.
-*******************************************************************************/
-u16 MC_GetPulseW(void)
-{
-/* Return the PWM pulse W Register value */
- return MC->CMPW;
-}
-
-/*******************************************************************************
-* Function Name : MC_GetTachoCapture
-* Description : Gets the MC Tacho period value.
-* Input : None
-* Output : None
-* Return : MC Tacho capture value.
-*******************************************************************************/
-u16 MC_GetTachoCapture(void)
-{
-/* Return the Tacho Capture Register value */
- return MC->TCPT;
-}
-
-/*******************************************************************************
-* Function Name : MC_ClearOnTachoCapture
-* Description : Enables or disables the the Clear on capture of tacho counter.
-* Input : Newstate: new state of the CCPT bit.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_ClearOnTachoCapture(FunctionalState NewState)
-{
- if(NewState == ENABLE)
- {
- /* Enable the Clear on capture of tacho counter */
- MC->PCR1 |= MC_CCPT_Set;
- }
- else
- {
- /* Disable the Clear on capture of tacho counter */
- MC->PCR1 &= MC_CCPT_Reset;
- }
-}
-/*******************************************************************************
-* Function Name : MC_ForceDataTransfer
-* Description : Sets the MC Outputs default states.
-* Input : MC_ForcedData: MC outputs new states.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_ForceDataTransfer(u8 MC_ForcedData)
-{
- /* Set the MC PWM Forced State */
- MC->OPR |= MC_ODS_Set;
- MC->OPR = (MC->OPR & MC_OPR_Mask) | MC_ForcedData;
-}
-
-/*******************************************************************************
-* Function Name : MC_PreloadConfig
-* Description : Enables the Software Data Transfer.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_SoftwarePreloadConfig(void)
-{
- /* Set the SDT: Software Data Transfer bit */
- MC->PCR2 |= MC_SDT_Set;
-}
-
-/*******************************************************************************
-* Function Name : MC_SoftwareTachoCapture
-* Description : Enables the Software Tacho Capture.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_SoftwareTachoCapture(void)
-{
- /* Set the STC: Software Tacho Capture bit */
- MC->PCR1 |= MC_STC_Set;
-}
-
-/*******************************************************************************
-* Function Name : MC_GetCountingStatus
-* Description : Checks whether the PWM Counter is counting Up or Down.
-* Input : None
-* Output : None
-* Return : The new state of the PWM Counter(DOWN or UP).
-*******************************************************************************/
-CountingStatus MC_GetCountingStatus(void)
-{
- if((MC->PCR0 & MC_UDCS_Mask) != DOWN)
- {
- return UP;
- }
- else
- {
- return DOWN;
- }
-}
-
-/*******************************************************************************
-* Function Name : MC_GetFlagStatus
-* Description : Checks whether the specified MC flag is set or not.
-* Input : MC_FLAG: specifies the flag to check.
-* This parameter can be one of the following values:
-* - MC_FLAG_CMPW: Compare W Flag.
-* - MC_FLAG_CMPV: Compare V Flag.
-* - MC_FLAG_CMPU: Compare U Flag.
-* - MC_FLAG_ZPC: Zero of PWM counter Flag.
-* - MC_FLAG_ADT: Automatic Data Transfer Flag.
-* - MC_FLAG_OTC: Overflow of Tacho counter Flag.
-* - MC_FLAG_CPT: Capture of Tacho counter Flag.
-* - MC_FLAG_CM0: Compare 0 Flag.
-* - MC_FLAG_EST: Emergency Stop Flag.
-* Output : None
-* Return : The new state of the MC_FLAG(SET or RESET).
-*******************************************************************************/
-FlagStatus MC_GetFlagStatus(u16 MC_FLAG)
-{
- if((MC->IPR & MC_FLAG) != RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : MC_ClearFlag
-* Description : Clears the MC’s pending flags.
-* Input : MC_FLAG: specifies the flag to clear.
-* This parameter can be any combination of the following values:
-* - MC_FLAG_CMPW: Compare W Flag.
-* - MC_FLAG_CMPV: Compare V Flag.
-* - MC_FLAG_CMPU: Compare U Flag.
-* - MC_FLAG_ZPC: Zero of PWM counter Flag.
-* - MC_FLAG_ADT: Automatic Data Transfer Flag.
-* - MC_FLAG_OTC: Overflow of Tacho counter Flag.
-* - MC_FLAG_CPT: Capture of Tacho counter Flag.
-* - MC_FLAG_CM0: Compare 0 Flag.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_ClearFlag(u16 MC_FLAG)
-{
-/* Clear the corresponding Flag */
- MC->IPR &= ~MC_FLAG;
-}
-
-/*******************************************************************************
-* Function Name : MC_GetITStatus
-* Description : Checks whether the MC interrupt has occurred or not.
-* Input : MC_IT: specifies the MC interrupt source to check.
-* This parameter can be one of the following values:
-* - MC_IT_CMPW: Compare W Interrupt.
-* - MC_IT_CMPV: Compare V Interrupt.
-* - MC_IT_CMPU: Compare U Interrupt.
-* - MC_IT_ZPC: Zero of PWM counter Interrupt.
-* - MC_IT_ADT: Automatic Data Transfer Interrupt.
-* - MC_IT_OTC: Overflow of Tacho counter Interrupt.
-* - MC_IT_CPT: Capture of Tacho counter Interrupt.
-* - MC_IT_CM0: Compare 0 Interrupt.
-* Output : None
-* Return : The new state of the MC_IT(SET or RESET).
-*******************************************************************************/
-ITStatus MC_GetITStatus(u16 MC_IT)
-{
- if((MC->IPR & MC_IT) && (MC->IMR & MC_IT))
- {
- return SET;
- }
- else
- {
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : MC_ClearITPendingBit
-* Description : Clears the IMC's interrupt pending bits.
-* Input : MC_IT: specifies the pending bit to clear.
-* This parameter can be any combination of the following values:
-* - MC_IT_CMPW: Compare W Interrupt.
-* - MC_IT_CMPV: Compare V Interrupt.
-* - MC_IT_CMPU: Compare U Interrupt.
-* - MC_IT_ZPC: Zero of PWM counter Interrupt.
-* - MC_IT_ADT: Automatic Data Transfer Interrupt.
-* - MC_IT_OTC: Overflow of Tacho counter Interrupt.
-* - MC_IT_CPT: Capture of Tacho counter Interrupt.
-* - MC_IT_CM0: Compare 0 Interrupt.
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_ClearITPendingBit(u16 MC_IT)
-{
-/* Clear the corresponding interrupt pending bit */
- MC->IPR &= ~MC_IT;
-}
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_template91x/str91x_lib/src/91x_rtc.c b/uc_str912/prj_template91x/str91x_lib/src/91x_rtc.c
deleted file mode 100644
index 2d0751b..0000000
--- a/uc_str912/prj_template91x/str91x_lib/src/91x_rtc.c
+++ /dev/null
@@ -1,400 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_rtc.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides the RTC library software functions
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_rtc.h"
-#include "91x_scu.h"
-
-/* Include of other module interface headers ---------------------------------*/
-/* Local includes ------------------------------------------------------------*/
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-u8 BYTEToBCD2(u8 value);
-u16 WORDToBCD3(u16 value);
-u8 BCD2ToBYTE(u8 value);
-u16 BCD3ToBYTE(u16 value);
-/* Interface functions -------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-
-/*******************************************************************************
-* Function Name : BYTEToBCD2
-* Description : Converts a 2 digit decimal to BCD format
-* Input : None
-* Output : None
-* Return : Converted byte
-*******************************************************************************/
-u8 BYTEToBCD2(u8 value)
-{
- u8 bcdhigh = 0;
- while (value >= 10)
- {
- bcdhigh++;
- value -= 10;
- }
- return (bcdhigh << 4) | value;
-}
-/*******************************************************************************
-* Function Name : WORDToBCD3
-* Description : Converts a 3 digit decimal to BCD format
-* Input : None
-* Output : None
-* Return : Converted word
-*******************************************************************************/
-u16 WORDToBCD3(u16 value)
-{
- u16 bcdhigh = 0;
- while (value >= 100)
- {
- bcdhigh++;
- value -= 100;
- }
- bcdhigh <<= 4;
- while (value >= 10)
- {
- bcdhigh++;
- value -= 10;
- }
- return (bcdhigh << 4) | value;
-}
-
-/*******************************************************************************
-* Function Name : BCD3ToWORD
-* Description : convert from 3 digit BCD to Binary
-* Input : None
-* Output : None
-* Return : Converted word
-*******************************************************************************/
-u16 BCD3ToWORD(u16 value)
-{
- return (u16)((((value&0xF00)>>8)*100) + (((value&0x0F0)>>4)*10) + (value&0x0F));
-}
-
-/*******************************************************************************
-* Function Name : BCD2ToBYTE
-* Description : convert from 2 digit BCD to Binary
-* Input : None
-* Output : None
-* Return : Converted word
-*******************************************************************************/
-u8 BCD2ToBYTE(u8 value)
-{
- u32 tmp;
- tmp= ((value&0xF0)>>4)*10;
- return (u8)(tmp+ (value&0x0F));
-}
-
-/*******************************************************************************
-* Function Name : RTC_DeInit
-* Description : Resets the RTC peripheral registers
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void RTC_DeInit(void)
-{
- SCU_APBPeriphReset(__RTC,ENABLE);
- SCU_APBPeriphReset(__RTC,DISABLE);
-}
-
-/*******************************************************************************
-* Function Name : RTC_SetDate
-* Description : Sets the Date register
-* Input : struct of type RTC_DATE
-* Output : None
-* Return : None
-*******************************************************************************/
-void RTC_SetDate(RTC_DATE Date)
-{
- u32 tmp = 0;
-
- RTC->CR |=0x80; /*Enable write operation in DTR register*/
- RTC->DTR = 0;
- tmp = BYTEToBCD2(Date.century);
- RTC->DTR|=tmp<<24;
- tmp = BYTEToBCD2(Date.year);
- RTC->DTR|=tmp<<16;
- tmp = BYTEToBCD2(Date.month);
- RTC->DTR|=tmp<<8;
- tmp = BYTEToBCD2(Date.weekday);
- RTC->DTR|=tmp;
- RTC->TR &=0xFFFFFF;
- tmp = BYTEToBCD2(Date.day);
- RTC->TR|=tmp<<24;
- RTC->CR &=~0x80; /*Disable write operation in DTR register*/
-}
-/*******************************************************************************
-* Function Name : RTC_SetTime
-* Description : Sets the Time register
-* Input : struct of type RTC_TIME
-* Output : None
-* Return : None
-*******************************************************************************/
-void RTC_SetTime(RTC_TIME Time)
-{
- u32 tmp = 0;
-
- RTC->CR |=0x80; /*Enable write operation in TR register*/
- RTC->TR &= 0xFF000000;
- tmp = BYTEToBCD2(Time.hours);
- RTC->TR|=tmp<<16;
- tmp = BYTEToBCD2(Time.minutes);
- RTC->TR|=tmp<<8;
- tmp = BYTEToBCD2(Time.seconds);
- RTC->TR|=tmp;
- RTC->MILR = 0;
- RTC->MILR |= WORDToBCD3(Time.milliseconds);
- RTC->CR &=~0x80; /*Disable write operation in TR register*/
-}
-/*******************************************************************************
-* Function Name : RTC_SetAlarm
-* Description : Sets the Alarm register
-* Input : Struct of type RTC_ALARM
-* Output : Date
-* Return : None
-*******************************************************************************/
-void RTC_SetAlarm(RTC_ALARM Alarm)
-{
- u32 tmp = 0;
-
- RTC->CR |=0x80; /*Enable write operation in ATR register*/
- RTC->ATR = 0;
- tmp = BYTEToBCD2(Alarm.day);
- RTC->ATR|=tmp<<24;
- tmp = BYTEToBCD2(Alarm.hours);
- RTC->ATR|=tmp<<16;
- tmp = BYTEToBCD2(Alarm.minutes);
- RTC->ATR|=tmp<<8;
- tmp = BYTEToBCD2(Alarm.seconds);
- RTC->ATR|=tmp;
- RTC->CR &=~0x80; /*Disable write operation in ATR register*/
-}
-
-/*******************************************************************************
-* Function Name : RTC_GetDate
-* Description : Gets RTC date in BCD coded or BINARY code
-* Input : -Format: BCD or BINARY
-* -Date: pointer to structure of type RTC_DATE to be filled by function
-* Output : None
-* Return : None
-*******************************************************************************/
-void RTC_GetDate(u8 Format, RTC_DATE * Date)
-{
- Date->century = (u8)((RTC->DTR&0xFF000000)>>24);
- Date->year = (u8)((RTC->DTR&0x00FF0000)>>16);
- Date->month = (u8)((RTC->DTR&0x00001F00)>>8);
- Date->day = (u8)((RTC->TR&0x3F000000)>>24);
- Date->weekday = (u8)(RTC->DTR&0xF);
- if (Format == BINARY)
- {
- Date->century = BCD2ToBYTE(Date->century);
- Date->year = BCD2ToBYTE(Date->year);
- Date->month = BCD2ToBYTE(Date->month);
- Date->day = BCD2ToBYTE(Date->day);
- Date->weekday = BCD2ToBYTE(Date->weekday);
- }
-}
-
-/*******************************************************************************
-* Function Name : RTC_GetTime
-* Description : Gets TIME in BCD coded or BINARY code
-* Input : -Format: BCD or BINARY
-* -Time : pointer to structure of type RTC_TIME to be filled by function
-* Output : Time
-* Return : None
-*******************************************************************************/
-void RTC_GetTime(u8 Format, RTC_TIME * Time)
-{
-
- Time->hours = (u8)((RTC->TR&0x003F0000)>>16);
- Time->minutes = (u8)((RTC->TR&0x00007F00)>>8);
- Time->seconds = (u8)(RTC->TR&0x7F);
- Time->milliseconds =(u16)(RTC->MILR&0xFFF);
- if (Format == BINARY)
- {
- Time->hours = BCD2ToBYTE(Time->hours);
- Time->minutes = BCD2ToBYTE(Time->minutes);
- Time->seconds = BCD2ToBYTE(Time->seconds);
- Time->milliseconds = BCD3ToWORD(Time->milliseconds);
- }
-}
-
-
-/*******************************************************************************
-* Function Name : RTC_GetAlarm
-* Description : Gets the RTC Alarm in BCD or BINARY code
-* Input : -Format: BCD or BINARY
-* -Alarm : pointer to structure of type RTC_ALARM to be filled by function
-* Output : Alarm
-* Return : None
-*******************************************************************************/
-void RTC_GetAlarm(u8 Format,RTC_ALARM * Alarm)
-{
- Alarm->day = (u8)((RTC->ATR&0x3F000000)>>24);
- Alarm->hours = (u8)((RTC->ATR&0x003F0000)>>16);
- Alarm->minutes = (u8)((RTC->ATR&0x00007F00)>>8);
- Alarm->seconds = (u8)((RTC->ATR)&0x7F);
- if (Format == BINARY)
- {
- Alarm->day = BCD2ToBYTE(Alarm->day);
- Alarm->hours = BCD2ToBYTE(Alarm->hours);
- Alarm->minutes = BCD2ToBYTE(Alarm->minutes);
- Alarm->seconds = BCD2ToBYTE(Alarm->seconds);
- }
-}
-
-/*******************************************************************************
-* Function Name : RTC_TamperConfig
-* Description : configures the Tamper mode and tamper polarity
-* Input : -TamperMode: RTC_TamperMode_Edge or RTC_TamperMode_Level
-* -TamperPol : RTC_TamperPol_Low or RTC_TamperMode_High
-* Output : None
-* Return : None
-*******************************************************************************/
-void RTC_TamperConfig(u32 TamperMode, u32 TamperPol)
-{
- RTC->CR&=RTC_TamperMode_Edge;
- if (TamperMode!=RTC_TamperMode_Edge)
- RTC->CR|=RTC_TamperMode_Level;
-
- RTC->CR&=RTC_TamperPol_Low;
- if (TamperPol!=RTC_TamperPol_Low)
- RTC->CR|=RTC_TamperPol_High;
-}
-
-/*******************************************************************************
-* Function Name : RTC_TamperCmd
-* Description : Enable or Disable Tamper
-* Input : NewState: ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void RTC_TamperCmd(FunctionalState NewState)
-{
- RTC->CR&=0xFFFFFFFE;
- if (NewState==ENABLE)
- RTC->CR|=0x1;
-}
-
-/*******************************************************************************
-* Function Name : RTC_AlarmCmd
-* Description : Enable or Disable Alarm
-* Input : NewState: ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void RTC_AlarmCmd(FunctionalState NewState)
-{
- RTC->CR&=~0x100000;
- if (NewState==ENABLE)
- RTC->CR|=0x100000;
-}
-
-/*******************************************************************************
-* Function Name : RTC_CalibClockCmd
-* Description : Enable or Disable RTC Calibration Clock Output
-* Input : NewState: ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void RTC_CalibClockCmd(FunctionalState NewState)
-{
- RTC->CR&=~0x40;
- if (NewState ==ENABLE)
- RTC->CR|=0x40;
-}
-
-/*******************************************************************************
-* Function Name : SRAMBattPowerCmd
-* Description : Enable or Disable SRAM backup Power by VBATT
-* Input : NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void RTC_SRAMBattPowerCmd(FunctionalState NewState)
-{
- RTC->CR&=~0x8;
- if (NewState ==ENABLE)
- RTC->CR|=0x8;
-}
-
-/*******************************************************************************
-* Function Name : RTC_PeridicIntConfig
-* Description : Select a Periodic CLock
-* Input : PeriodicClock
-* Output : None
-* Return : None
-* Note : When PeriodicClock = RTC_Per_DISABLE the Periodic clock generation
-* will be disabled.
-*******************************************************************************/
-void RTC_PeriodicIntConfig(u32 PeriodicClock)
-{
- RTC->CR &=~0xF0000;
- RTC->CR|=PeriodicClock;
-}
-
-/*******************************************************************************
-* Function Name : RTC_ITConfig
-* Description : Enable or Disable an interrupt
-* Input : -RTC_IT : RTC interrupt
-* -Newstate: Enable or Disable
-* Output : None
-* Return : None
-*******************************************************************************/
-void RTC_ITConfig(u32 RTC_IT, FunctionalState NewState)
-{
- RTC->CR&=~RTC_IT;
- if (NewState==ENABLE)
- RTC->CR|=RTC_IT;
-}
-
-/*******************************************************************************
-* Function Name : RTC_GetFlagStatus
-* Description : Gets a RTC flag status
-* Input : RTC_FLAG
-* Output : None
-* Return : FlagStatus :SET or RESET
-*******************************************************************************/
-FlagStatus RTC_GetFlagStatus(u32 RTC_FLAG)
-{
- if (RTC->SR&RTC_FLAG) return SET;
- else return RESET;
-}
-
-/*******************************************************************************
-* Function Name : RTC_ClearFlag
-* Description : Clears a RTC flag
-* Input : RTC_FLAG
-* Output : None
-* Return : None
-* Note : Before clearing the RTC Periodic Flag you need to disable the
-* Periodic interrupt generation, to do this use function
-* RTC_PeriodicIntConfig(RTC_Per_DISABLE)
-*******************************************************************************/
-void RTC_ClearFlag(u32 RTC_FLAG)
-{
- vu32 tmp=0;
- if (RTC_FLAG == RTC_FLAG_Per) tmp=RTC->SR;
- else if (RTC_FLAG == RTC_FLAG_Alarm) RTC->CR&=~0x100000;
- else if (RTC_FLAG == RTC_FLAG_Tamper) RTC->CR&=~0x1;
-}
-
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_template91x/str91x_lib/src/91x_scu.c b/uc_str912/prj_template91x/str91x_lib/src/91x_scu.c
deleted file mode 100644
index 21116b2..0000000
--- a/uc_str912/prj_template91x/str91x_lib/src/91x_scu.c
+++ /dev/null
@@ -1,661 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_scu.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides the SCU library software functions
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_scu.h"
-
-/* Include of other module interface headers ---------------------------------*/
-/* Local includes ------------------------------------------------------------*/
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-#define SCU_PLLEN 0x80000
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/* Interface functions -------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-
-/*******************************************************************************
-* Function Name : SCU_MCLKSourceConfig
-* Description : Configures the MCLK source clock
-* Input : MCLK_Source = SCU_MCLK_OSC, SCU_MCLK_PLL or SCU_MCLK_RTC
-* Output : None
-* Return : ErrorStatus: SUCCESS or ERROR
-* Note : this function returns ERROR if trying to select the PLL as
-* clock source while the PLL is disabled or not locked.
-*******************************************************************************/
-ErrorStatus SCU_MCLKSourceConfig(u32 MCLK_Source)
-{
- u32 CLKCNTR_Value;
-
- CLKCNTR_Value = SCU->CLKCNTR; /*get CLKCNTR register value*/
- CLKCNTR_Value &=~0x3; /*clear field MCLKSEL*/
- if (MCLK_Source == SCU_MCLK_PLL) /*PLL selected as clock source*/
- {
- /*check if PLL enabled & locked*/
- if (!((SCU->PLLCONF&SCU_PLLEN)&&(SCU->SYSSTATUS&SCU_FLAG_LOCK)))
- return ERROR;
- }
- else CLKCNTR_Value |=MCLK_Source; /*OSC or RTC selected as clock source*/
- SCU->CLKCNTR = CLKCNTR_Value; /*Update CLKCNTR register value*/
- return SUCCESS;
-}
-
-/*******************************************************************************
-* Function Name : SCU_PLLFactorsConfig
-* Description : Sets the PLL factors
-* Input : PLLN, PLLM and PLLP
-* Output : None
-* Return : ErrorStatus: ERROR or SUCCESS
-* Notes : -The PLL factors must respect the PLL specification requirements
-* -The function returns ERROR if trying to change PLL
-* factors while PLL is selected as Main Clock source (MCLK)
-* -This function disables the PLL, to enable the PLL use
-* function" SCU_PLLCmd(ENABLE)" after setting the PLL factors
-******************************************************************************/
-ErrorStatus SCU_PLLFactorsConfig(u8 PLLN, u8 PLLM, u8 PLLP)
-{
- if (SCU_PLLCmd(DISABLE)==SUCCESS) /*Disable PLL*/
- {
- SCU->PLLCONF =0; /*clear PLLCONF register*/
- SCU->PLLCONF |=(PLLN<<8); /*update PLLN field*/
- SCU->PLLCONF |=PLLM; /*update PLLM field*/
- SCU->PLLCONF |=PLLP<<16; /*update PLLP field*/
- return SUCCESS;
- }
- return ERROR;
-}
-
-/*******************************************************************************
-* Function Name : SCU_PLLCmd
-* Description : Enable or Disable the PLL
-* Input : NewState = ENABLE or DISABLE
-* Output : None
-* Return : ErrorStatus: SUCCESS or ERROR
-* Note : -The function returns ERROR if:
-* *trying to disable the PLL while it is selected as the MCLK
-* *trying to enable the PLL while it is already enabled and
-* locked
-*******************************************************************************/
-ErrorStatus SCU_PLLCmd(FunctionalState NewState)
-{
- vu32 i;
- if (NewState==ENABLE)
- {
- if (!((SCU->PLLCONF&SCU_PLLEN)&&(SCU->SYSSTATUS&SCU_FLAG_LOCK)))
- {
- SCU->SYSSTATUS|=SCU_FLAG_LOCK; /*clear LOCK bit*/
- SCU->PLLCONF |=SCU_PLLEN; /*PLL Enable*/
- while(!SCU->SYSSTATUS&SCU_FLAG_LOCK); /*Wait PLL to lock*/
- return SUCCESS;
- }
- else return ERROR;
- }
- else /*NewState = DISABLE*/
- {
- if(SCU->CLKCNTR&0x3) /*check if PLL not sys CLK*/
- {
- for(i=10;i>0;i--); /*delay before PLL disabling*/
- SCU->PLLCONF &=~SCU_PLLEN; /*PLL Disable*/
- return SUCCESS;
- }
- else return ERROR;
- }
-}
-
-/*******************************************************************************
-* Function Name : SCU_RCLKDivisorConfig
-* Description : Sets the RCLK divisor value
-* Input : RCLK_Divisor
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_RCLKDivisorConfig(u32 RCLK_Divisor)
-{
- SCU->CLKCNTR &=SCU_RCLK_Div1; /*clear RCLKDIV[2:0] field*/
- if (RCLK_Divisor!=SCU_RCLK_Div1)
- SCU->CLKCNTR |= RCLK_Divisor; /*update field with RCLK divisor*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_HCLKDivisorConfig
-* Description : Sets the HCLK divisor value
-* Input : HCLK_Divisor
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_HCLKDivisorConfig(u32 HCLK_Divisor)
-{
- SCU->CLKCNTR &=SCU_HCLK_Div1; /*clear AHBDIV[1:0] field*/
- if (HCLK_Divisor!=SCU_HCLK_Div1)
- SCU->CLKCNTR |= HCLK_Divisor; /*update field with HCLK divisor*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_PCLKDivisorConfig
-* Description : Sets the PCLK divisor value
-* Input : PCLK_Divisor
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_PCLKDivisorConfig(u32 PCLK_Divisor)
-{
- SCU->CLKCNTR &=SCU_PCLK_Div1; /*clear APBDIV[1:0] field*/
- if (PCLK_Divisor!=SCU_PCLK_Div1)
- SCU->CLKCNTR |= PCLK_Divisor; /*update field with PCLK Divisor*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_APBPeriphClockConfig
-* Description : Enable the clock for an APB peripheral
-* Input : -APBPerip : APB peripherals(__RTC, __ADC ,...)
-* -NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_APBPeriphClockConfig(u32 APBPeriph, FunctionalState NewState)
-{
- if (NewState==ENABLE) /*Enable clock for APB peripheral*/
- SCU->PCGR1 |=APBPeriph;
- else
- SCU->PCGR1 &=~APBPeriph; /*Disable clock for APB peripheral*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_AHBPeriphClockConfig
-* Description : Enable the clock for an AHB peripheral
-* Input : -AHBPerip: AHB peripherals(__USB, __DMA,...)
-* -NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_AHBPeriphClockConfig(u32 AHBPeriph, FunctionalState NewState)
-{
- if (NewState==ENABLE) /*Enable clock for AHB peripheral*/
- SCU->PCGRO |=AHBPeriph;
- else
- SCU->PCGRO &=~AHBPeriph; /*Disable clock for AHB peripheral*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_APBPeriphReset
-* Description : Assert or deassert Reset on APB peripheral
-* Input : -APBPeriph: APB peripherals(__RTC, __ADC,...)
- -NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_APBPeriphReset(u32 APBPeriph, FunctionalState NewState)
-{
- if (NewState==DISABLE) /*APB peripheral not held in Reset*/
- SCU->PRR1 |=APBPeriph;
- else
- SCU->PRR1 &=~APBPeriph; /*APB peripheral held in Reset*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_AHBPeriphReset
-* Description : Assert or deassert Reset on AHB peripheral
-* Input : -AHBPeriph: AHB peripherals(__USB, __DMA,...)
- -NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_AHBPeriphReset(u32 AHBPeriph, FunctionalState NewState)
-{
- if (NewState==DISABLE)
- SCU->PRR0 |=AHBPeriph; /*AHB peripheral not held in Reset*/
- else
- SCU->PRR0 &=~AHBPeriph; /*AHB peripheral held in Reset*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_APBPeriphIdleConfig
-* Description : Enable or Disable Periph Clock during Idle mode
-* Input : -APBPeriph: APB peripherals(__RTC, __ADC,...)
- -NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_APBPeriphIdleConfig(u32 APBPeriph, FunctionalState NewState)
-{
- if (NewState==ENABLE)
- SCU->MGR1 |=APBPeriph; /*APB peripheral clock enabled during Idle mode*/
- else
- SCU->MGR1 &=~APBPeriph; /*APB peripheral clock disabled during Idle mode*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_AHBPeriphIdleConfig
-* Description : Enable or Disable Periph Clock during Idle mode
-* Input : -AHBPeriph: AHB peripherals(__USB, __DMA,...)
- -NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_AHBPeriphIdleConfig(u32 AHBPeriph, FunctionalState NewState)
-{
- if (NewState==ENABLE)
- SCU->MGR0 |=AHBPeriph; /*AHB peripheral clock enabled during Idle mode*/
- else
- SCU->MGR0 &=~AHBPeriph; /*AHB peripheral clock disabled during Idle mode*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_APBPeriphDebugConfig
-* Description : Enable or Disable Periph Clock during ARM debug state
-* Input : -APBPeriph: APB peripherals(__RTC, __ADC,...)
- -NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_APBPeriphDebugConfig(u32 APBPeriph, FunctionalState NewState)
-{
- if (NewState==ENABLE)
- SCU->PECGR1 |=APBPeriph; /*APB peripheral clock enabled during ARM debug state*/
- else
- SCU->PECGR1 &=~APBPeriph; /*APB peripheral clock disabled during ARM debug state*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_AHBPeriphDebugConfig
-* Description : Enable or Disable Periph Clock during ARM debug state
-* Input : -AHBPeriph: AHB peripherals(__USB, __DMA,...)
- -NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_AHBPeriphDebugConfig(u32 AHBPeriph, FunctionalState NewState)
-{
- if (NewState==ENABLE)
- SCU->PECGR0 |=AHBPeriph; /*AHB peripheral clock enabled during ARM debug state*/
- else
- SCU->PECGR0 &=~AHBPeriph; /*AHB peripheral clock disabled during ARM debug state*/
-}
-/*******************************************************************************
-* Function Name : SCU_BRCLKDivisorConfig
-* Description : Sets the BRCLK divisor value
-* Input : BRCLK_Divisor
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_BRCLKDivisorConfig(u32 BRCLK_Divisor)
-{
- SCU->CLKCNTR &=SCU_BRCLK_Div1; /*Clear BRSEL bit*/
- if (BRCLK_Divisor!=SCU_BRCLK_Div1)
- SCU->CLKCNTR |= SCU_BRCLK_Div2; /*set bit BRSEL*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_TIMCLKSourceConfig
-* Description : Sets the TIMx clock source
-* Input : - TIMx : SCU_TIM01 or SCU_TIM23
-* - TIMCLK_Source = SCU_TIMCLK_EXT or SCU_TIMCLK_INT
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_TIMCLKSourceConfig(u8 TIMx, u32 TIMCLK_Source)
-{
- if (TIMx== SCU_TIM01) /*TIM01 clock source configuration*/
- {
- SCU->CLKCNTR &=0xFFFFDFFF;
- if (TIMCLK_Source == SCU_TIMCLK_EXT)
- SCU->CLKCNTR |=0x2000;
- }
- else
- {
- SCU->CLKCNTR &=0xFFFFBFFF; /*TIM23 clock source configuration*/
- if (TIMCLK_Source == SCU_TIMCLK_EXT)
- SCU->CLKCNTR |=0x4000;
- }
-}
-
-/*******************************************************************************
-* Function Name : SCU_TIMPresConfig
-* Description : Sets the TIMx Prescaler Value
-* Input : - TIMx : SCU_TIM01 or SCU_TIM23
-* - Prescaler (16 bit value)
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_TIMPresConfig(u8 TIMx, u16 Prescaler)
-{
- if (TIMx==SCU_TIM01) /*TIM01 Prescaler configuration*/
- SCU->SCR1 = Prescaler&0xFFFF;
- else
- SCU->SCR2 = Prescaler&0xFFFF; /*TIM23 Prescaler configuration*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_USBCLKConfig
-* Description : Configures the clock source for the 48MHz USBCLK
-* Input : USBCLK_Source: SCU_USBCLK_MCLK,SCU_USBCLK_MCLK2 or SCU_USBCLK_EXT
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_USBCLKConfig(u32 USBCLK_Source)
-{
- SCU->CLKCNTR &=SCU_USBCLK_MCLK; /*clear USBSEL[1:0] field*/
- if (USBCLK_Source!=SCU_USBCLK_MCLK)
- SCU->CLKCNTR |= USBCLK_Source; /*update field with USBCLK_Source*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_PHYCLKConfig
-* Description : Enable or Disable PHY clock output
-* Input : NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_PHYCLKConfig(FunctionalState NewState)
-{
- if (NewState==ENABLE)
- SCU->CLKCNTR |= 0x1000; /*enable MIIPHY clock*/
- else
- SCU->CLKCNTR &=~0x1000; /*disable MIIPHY clock*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_FMICLKDivisorConfig
-* Description : Set the FMI clock divisor
-* Input : FMICLK_Divisor: SCU_FMICLK_Div1 or SCU_FMICLK_DIV2
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_FMICLKDivisorConfig(u32 FMICLK_Divisor)
-{
- SCU->CLKCNTR &=SCU_FMICLK_Div1; /*FMICLK = RCLK*/
- if (FMICLK_Divisor!=SCU_FMICLK_Div1)
- SCU->CLKCNTR |=SCU_FMICLK_Div2; /*FMICLK = RCLK/2 */
-}
-
-/*******************************************************************************
-* Function Name : SCU_EMIBCLKDivisorConfig
-* Description : Set the EMI Bus clock divisor: EMIBCLK = HCLK or HCLK/2
-* Input : SCU_EMICLK: SCU_EMIBCLK_Div1 , SCU_EMIBCLK_Div2
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_EMIBCLKDivisorConfig(u32 SCU_EMIBCLK)
-{
- SCU->CLKCNTR &=SCU_EMIBCLK_Div1; /*EMIBCLK = HCLK */
- if (SCU_EMIBCLK!=SCU_EMIBCLK_Div1)
- SCU->CLKCNTR |= SCU_EMIBCLK_Div2; /*EMIBCLK = HCLK/2 */
-}
-
-/*******************************************************************************
-* Function Name : SCU_EMIModeConfig
-* Description : Configure the EMI as Multiplexed or Demultiplexed
-* Input : SCU_EMIMODE : SCU_EMI_MUX or SCU_EMI_DEMUX
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_EMIModeConfig(u32 SCU_EMIMODE)
-{
- SCU->SCR0 &=SCU_EMI_MUX; /*EMI mode = Multiplexed*/
- if (SCU_EMIMODE!=SCU_EMI_MUX)
- SCU->SCR0 |= SCU_EMI_DEMUX; /*EMI mode = Demultiplexed*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_EMIALEConfig
-* Description : Configure the ALE signal (length & polarity)
-* Input : -SCU_EMIALE_LEN : SCU_EMIALE_LEN1 or SCU_EMIALE_LEN2
-* -SCU_EMIALE_POL : SCU_EMIALE_POLLow or SCU_EMI_POLHigh
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_EMIALEConfig(u32 SCU_EMIALE_LEN, u32 SCU_EMIALE_POL)
-{
- /*Configure EMI ALE Length*/
- SCU->SCR0 &=SCU_EMIALE_LEN1;
- if (SCU_EMIALE_LEN!=SCU_EMIALE_LEN1)
- SCU->SCR0 |= SCU_EMIALE_LEN2;
-
- /*Configure EMI ALE POL*/
- SCU->SCR0 &=SCU_EMIALE_POLLow;
- if (SCU_EMIALE_POL!=SCU_EMIALE_POLLow)
- SCU->SCR0 |= SCU_EMIALE_POLHigh;
-}
-
-/*******************************************************************************
-* Function Name : SCU_ITConfig
-* Description : ENBALE or DISABLE an SCU interrupt
-* Input : -SCU_IT: interrupt mask
-* -NewState: ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_ITConfig(u32 SCU_IT, FunctionalState NewState)
-{
- if (NewState==ENABLE)
- SCU->ITCMSK&=~SCU_IT; /*IT enable */
- else
- SCU->ITCMSK|=SCU_IT; /*IT disable( mask)*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_GetFlagStatus
-* Description : Returns flag status
-* Input : SCU_Flag
-* Output : NONE
-* Return : SET or RESET
-*******************************************************************************/
-FlagStatus SCU_GetFlagStatus(u32 SCU_Flag)
-{
- if (SCU->SYSSTATUS&SCU_Flag)
- return SET;
- else return RESET;
-}
-
-/*******************************************************************************
-* Function Name : SCU_ClearFlag
-* Description : Clears a SYSTATUS Flag
-* Input : SCU_Flag
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_ClearFlag(u32 SCU_Flag)
-{
- SCU->SYSSTATUS = SCU_Flag;
-}
-/*******************************************************************************
-* Function Name : SCU_GetPLLfreqValue
-* Description : Gets the current PLL frequency
-* Input : None
-* Output : None
-* Return : PLL frequency (KHz)
-*******************************************************************************/
-u32 SCU_GetPLLFreqValue(void)
-{
- u8 PLL_M;
- u8 PLL_N;
- u8 PLL_P;
-
- PLL_M = SCU->PLLCONF&0xFF;
- PLL_N = (SCU->PLLCONF&0xFF00)>>8;
- PLL_P = (SCU->PLLCONF&0x70000)>>16;
-
- if ((PLL_M>0)&&(PLL_N>0))
- return (u32)(((_Main_Crystal*2)*PLL_N)/(PLL_M<<PLL_P));
-
- else return 0;
-}
-/*******************************************************************************
-* Function Name : SCU_GetMCLKFreqValue
-* Description : Gets the current MCLK frequency
-* Input : None
-* Output : None
-* Return : MCLK frequency (KHz)
-*******************************************************************************/
-u32 SCU_GetMCLKFreqValue(void)
-{
- if ((SCU->CLKCNTR&0x3) == 0x2) return (u32)(_Main_Crystal);
- if ((SCU->CLKCNTR&0x3) == 0x1) return (u32)(32);
- else return (SCU_GetPLLFreqValue());
-}
-
-/*******************************************************************************
-* Function Name : SCU_GetRCLKFreqValue
-* Description : Gets the current RCLK frequency
-* Input : None
-* Output : None
-* Return : RCLK frequency (KHz)
-*******************************************************************************/
-u32 SCU_GetRCLKFreqValue(void)
-{
- u8 RCLK_Div;
- RCLK_Div = (SCU->CLKCNTR&0x1C)>>2;
- if (RCLK_Div==0x5) RCLK_Div=10;
- return (u32)(SCU_GetMCLKFreqValue() >>RCLK_Div);
-}
-
-/*******************************************************************************
-* Function Name : SCU_GetHCLKFreqValue
-* Description : Gets the current PCLK frequency
-* Input : None
-* Output : None
-* Return : HCLK frequency (KHz)
-*******************************************************************************/
-u32 SCU_GetHCLKFreqValue(void)
-{
- u8 HCLK_Div;
- HCLK_Div = (SCU->CLKCNTR&0x60)>>5;
- return (u32)(SCU_GetRCLKFreqValue() >>HCLK_Div);
-}
-
-/*******************************************************************************
-* Function Name : SCU_GetPCLKFreqValue
-* Description : Gets the current HCLK frequency
-* Input : None
-* Output : None
-* Return : PCLK frequency (KHz)
-*******************************************************************************/
-u32 SCU_GetPCLKFreqValue(void)
-{
- u8 PCLK_Div;
- PCLK_Div = (SCU->CLKCNTR&0x180)>>7;
- return (u32)(SCU_GetRCLKFreqValue() >>PCLK_Div);
-}
-
-/*******************************************************************************
-* Function Name : SCU_WakeUpLineConfig
-* Description : Configures an External interrupt as WakeUp line
-* Input : EXTint : 0 -> 31
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_WakeUpLineConfig(u8 EXTint)
-{
- if (EXTint < 8)
- {
- SCU->WKUPSEL&=~0x7;
- SCU->WKUPSEL|=EXTint;
- }
- else if (EXTint<16)
- {
- SCU->WKUPSEL&=~0x38;
- SCU->WKUPSEL|=(EXTint-8)<<3;
- }
- else if (EXTint<24)
- {
- SCU->WKUPSEL&=~0x1C0;
- SCU->WKUPSEL|=(EXTint-16)<<6;
- }
- else
- {
- SCU->WKUPSEL&=~0xE00;
- SCU->WKUPSEL|=(EXTint-24)<<9;
- }
-}
-
-/*******************************************************************************
-* Function Name : SCU_SpecIntRunModeConfig
-* Description : Enables or Disables the Special Run mode
-* Input : newstate = ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_SpecIntRunModeConfig(FunctionalState NewState)
-{
- if (NewState == ENABLE)
- SCU->PWRMNG |=0x8;
- else
- SCU->PWRMNG &=~0x8;
-}
-/*******************************************************************************
-* Function Name : SCU_EnterIdleMode
-* Description : Enters in Idle mode
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_EnterIdleMode(void)
-{
- SCU->PWRMNG |=0x1;
-}
-/*******************************************************************************
-* Function Name : SCU_EnterSleepMode
-* Description : Enters in Sleep mode
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_EnterSleepMode(void)
-{
- SCU->PWRMNG |=0x2;
-}
-
-/*******************************************************************************
-* Function Name : SCU_UARTIrDAConfig
-* Description : Enable or Disable the Irda mode for UARTx
-* Input : - UARTx :x=0,1 or 2
-* - UART_IrDA_Mode : SCU_UARTMode_IrDA or SCU_UARTMode_UART
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_UARTIrDASelect(UART_TypeDef * UARTx, u8 UART_IrDA_Mode)
-{
- if (UART_IrDA_Mode == SCU_UARTMode_IrDA)
- {
- if (UARTx== UART0) SCU->SCR0 |=0x400;
- else if (UARTx==UART1) SCU->SCR0 |=0x800;
- else SCU->SCR0 |=0x1000;
- }
- else
- {
- if (UARTx== UART0) SCU->SCR0 &=~0x400;
- else if (UARTx==UART1) SCU->SCR0 &=~0x800;
- else SCU->SCR0 &=~0x1000;
- }
-}
-/*******************************************************************************
-* Function Name : SCU_PFQBCCmd
-* Description : Enable or Disable PFQBC
-* Input : NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_PFQBCCmd(FunctionalState NewState)
-{
- if (NewState==ENABLE)
- SCU->SCR0 |=0x1;
- else SCU->SCR0 &=~0x1;
-}
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_template91x/str91x_lib/src/91x_ssp.c b/uc_str912/prj_template91x/str91x_lib/src/91x_ssp.c
deleted file mode 100644
index 06bf30c..0000000
--- a/uc_str912/prj_template91x/str91x_lib/src/91x_ssp.c
+++ /dev/null
@@ -1,469 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_ssp.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the SSP software functions.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_ssp.h"
-#include "91x_scu.h"
-
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-
-/* SSP peripheral Enable */
-#define SSP_Enable 0x0002
-#define SSP_Disable 0xFFFD
-
-/* SSP Loop Back Mode Enable */
-#define SSP_LoopBackMode_Enable 0x0001
-#define SSP_LoopBackMode_Disable 0xFFFE
-
-/* SSP Flag Mask */
-#define SSP_Flag_Mask 0x001F
-
-/* SSP DMA transmit/ receive enable/disable Masks */
-#define SSP_DMA_TransmitEnable 0x0002
-#define SSP_DMA_TransmitDisable 0xFFFD
-#define SSP_DMA_ReceiveEnable 0x0001
-#define SSP_DMA_ReceiveDisable 0xFFFE
-
-/* SSP Masks */
-#define SSP_FrameFormat_Mask 0xFFCF
-#define SSP_DataSize_Mask 0xFFF0
-#define SSP_ClockRate_Mask 0x00FF
-#define SSP_ClockPrescaler_Mask 0xFF00
-
-/* Private function prototypes -----------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-
-/*******************************************************************************
-* Function Name : SSP_DeInit
-* Description : Deinitializes the SSPx peripheral registers to their default
-* reset values.
-* Input : SSPx: where x can be 0 or 1 to select the SSP peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void SSP_DeInit(SSP_TypeDef* SSPx)
-{
- if(SSPx == SSP0)
- {
- /* Reset the SSP0 registers values*/
- SCU_APBPeriphReset(__SSP0,ENABLE);
- SCU_APBPeriphReset(__SSP0,DISABLE);
- }
- else if (SSPx == SSP1)
- {
- /* Reset the SSP1 registers values*/
- SCU_APBPeriphReset(__SSP1,ENABLE);
- SCU_APBPeriphReset(__SSP1,DISABLE);
- }
-}
-
-/*******************************************************************************
-* Function Name : SSP_Init
-* Description : Initializes the SSPx peripheral according to the specified
-* parameters in the SSP_InitTypeDef structure.
-* Input : - SSPx: where x can be 0 or 1 to select the SSP peripheral.
-* - SSP_InitStruct: pointer to a SSP_InitTypeDef structure that
-* contains the configuration information for the specified SSP
-* peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void SSP_Init(SSP_TypeDef* SSPx, SSP_InitTypeDef* SSP_InitStruct)
-{
- if(SSP_InitStruct->SSP_FrameFormat == SSP_FrameFormat_Motorola)
- {
- /* Set the Motorola frame format */
- SSPx->CR0 &= SSP_FrameFormat_Motorola;
- /* Configure the Clock polarity */
- if(SSP_InitStruct->SSP_CPOL == SSP_CPOL_High)
- {
- /* SCK is held high when no data is being transfered */
- SSPx->CR0 |= SSP_CPOL_High;
- }
- else
- {
- /* SCK is held low when no data is being transfered */
- SSPx->CR0 &= SSP_CPOL_Low;
- }
- /* Configure the Clock Phase */
- if(SSP_InitStruct->SSP_CPHA == SSP_CPHA_2Edge)
- {
- /* Data captured on second clock edge */
- SSPx->CR0 |= SSP_CPHA_2Edge;
- }
- else
- {
- /* Data captured on first clock edge */
- SSPx->CR0 &= SSP_CPHA_1Edge;
- }
- }
- /* Configure the Frame format */
- else
- {
- /* Clear the FRF[1:0] bits */
- SSPx->CR0 &= SSP_FrameFormat_Mask;
- /* Set the TI frame format */
- SSPx->CR0 |= SSP_InitStruct->SSP_FrameFormat;
- }
- /* Configure the Mode */
- if(SSP_InitStruct->SSP_Mode == SSP_Mode_Slave)
- {
- /* Set the slave mode */
- SSPx->CR1 |= SSP_Mode_Slave;
- /* Configure the Slave output */
- if(SSP_InitStruct->SSP_SlaveOutput == SSP_SlaveOutput_Disable)
- {
- /* Slave output disabled */
- SSPx->CR1 |= SSP_SlaveOutput_Disable;
- }
- else
- {
- /* Slave output enabled */
- SSPx->CR1 &= SSP_SlaveOutput_Enable;
- }
- }
- else
- {
- /* Set the master mode */
- SSPx->CR1 &= SSP_Mode_Master;
- /* Clear clock rate SCR[7:0] bits */
- SSPx->CR0 &= SSP_ClockRate_Mask;
- /* Set the serial clock rate */
- SSPx->CR0 |= (SSP_InitStruct->SSP_ClockRate<<8);
- /* Clear clock prescaler CPSDVSR[7:0] bits */
- SSPx->PR &= SSP_ClockPrescaler_Mask;
- /* Set the serial clock prescaler */
- SSPx->PR |= SSP_InitStruct->SSP_ClockPrescaler;
- }
-
- /* Clear data size DSS[3:0] bits */
- SSPx->CR0 &= SSP_DataSize_Mask;
- /* Set the data size */
- SSPx->CR0 |= SSP_InitStruct->SSP_DataSize;
-}
-/*******************************************************************************
-* Function Name : SSP_StructInit
-* Description : Fills in a SSP_InitTypeDef structure with the reset value of
-* each parameter.
-* Input : SSP_InitStruct : pointer to a SSP_InitTypeDef structure
- which will be initialized.
-* Output : None
-* Return : None
-*******************************************************************************/
-void SSP_StructInit(SSP_InitTypeDef* SSP_InitStruct)
-{
- /* Initialize the SSP_FrameFormat member */
- SSP_InitStruct->SSP_FrameFormat = SSP_FrameFormat_Motorola;
-
- /* Initialize the SSP_Mode member */
- SSP_InitStruct->SSP_Mode = SSP_Mode_Master;
-
- /* Initialize the SSP_CPOL member */
- SSP_InitStruct->SSP_CPOL = SSP_CPOL_Low;
-
- /* Initialize the SSP_CPHA member */
- SSP_InitStruct->SSP_CPHA = SSP_CPHA_1Edge;
-
- /* Initialize the SSP_DataSize member */
- SSP_InitStruct->SSP_DataSize = SSP_DataSize_8b;
-
- /* Initialize the SSP_SlaveOutput member */
- SSP_InitStruct->SSP_SlaveOutput = SSP_SlaveOutput_Enable;
-
- /* Initialize the SSP_ClockRate member */
- SSP_InitStruct->SSP_ClockRate = 0;
-
- /* Initialize the SSP_ClockPrescaler member */
- SSP_InitStruct->SSP_ClockPrescaler = 0;
-}
-
-/*******************************************************************************
-* Function Name : SSP_Cmd
-* Description : Enables or disables the specified SSP peripheral.
-* Input : - SSPx: where x can be 0 or 1 to select the SSP peripheral.
-* - NewState: new state of the SSPx peripheral. This parameter
-* can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void SSP_Cmd(SSP_TypeDef* SSPx, FunctionalState NewState)
-{
- if(NewState == ENABLE)
- {
- /* Enable the SSP peripheral */
- SSPx->CR1 |= SSP_Enable;
- }
- else
- {
- /* Disable the SSP peripheral */
- SSPx->CR1 &= SSP_Disable;
- }
-}
-
-/*******************************************************************************
-* Function Name : SSP_ITConfig
-* Description : Enables or disables the specified SSP interrupts.
-* Input : - SSPx: where x can be 0 or 1 to select the SSP peripheral.
-* - SSP_IT: specifies the SSP interrupts sources to be enabled
-* or disabled. This parameter can be any combination of the
-* following values:
-* - SSP_IT_TxFifo: Transmit FIFO half empty or less interrupt
-* - SSP_IT_RxFifo: Receive FIFO half full or less interrupt
-* - SSP_IT_RxTimeOut: Receive timeout interrupt
-* - SSP_IT_RxOverrun: Receive overrun interrupt
-* - NewState: new state of the specified SSP interrupts.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void SSP_ITConfig(SSP_TypeDef* SSPx, u16 SSP_IT, FunctionalState NewState)
-{
- if(NewState == ENABLE)
- {
- /* Enable the selected SSP interrupts */
- SSPx->IMSCR |= SSP_IT;
- }
- else
- {
- /* Disable the selected SSP interrupts */
- SSPx->IMSCR &= ~SSP_IT;
- }
-}
-
-/*******************************************************************************
-* Function Name : SSP_DMACmd
-* Description : Configures the SSP0 DMA interface.
-* Input : - SSPx: where x can be 0 or 1 to select the SSP peripheral.
-* - SSP_DMATransfert : specifies the DMA transfert to be
-* enabled or disabled. This parameter can be one of the
-* following values:
-* - SSP_DMA_Transmit: transmit Fifo DMA transfert
-* - SSP_DMA_Receive : receive Fifo DMA transfert
-* - NewState: new state of the DMA transfert.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void SSP_DMACmd(SSP_TypeDef* SSPx, u16 SSP_DMATransfert, FunctionalState NewState)
-{
- if(NewState == ENABLE)
- {
- if(SSP_DMATransfert == SSP_DMA_Transmit)
- {
- /* Enable DMA for the transmit FIFO */
- SSPx->DMACR |= SSP_DMA_TransmitEnable;
- }
- else
- {
- /* Enable DMA for the receive FIFO */
- SSPx->DMACR |= SSP_DMA_ReceiveEnable;
- }
- }
- else
- {
- if(SSP_DMATransfert == SSP_DMA_Transmit)
- {
- /* Disable DMA for the transmit FIFO */
- SSPx->DMACR &= SSP_DMA_TransmitDisable;
- }
- else
- {
- /* Disable DMA for the receive FIFO */
- SSPx->DMACR &= SSP_DMA_ReceiveDisable;
- }
- }
-}
-
-/*******************************************************************************
-* Function Name : SSP_SendData.
-* Description : Transmits a Data through the SSP peripheral.
-* Input : - SSPx: where x can be 0 or 1 to select the SSP peripheral.
-* - Data : Data to be transmitted.
-* Output : None
-* Return : None
-*******************************************************************************/
-void SSP_SendData(SSP_TypeDef* SSPx, u16 Data)
-{
- /* Write in the DR register the data to be sent */
- SSPx->DR = Data;
-}
-
-/*******************************************************************************
-* Function Name : SSP_ReceiveData.
-* Description : Returns the most recent received data by the SSP peripheral.
-* Input : SSPx: where x can be 0 or 1 to select the SSP peripheral.
-* Output : None
-* Return : The value of the received data.
-*******************************************************************************/
-u16 SSP_ReceiveData(SSP_TypeDef* SSPx)
-{
- /* Return the data in the DR register */
- return SSPx->DR;
-}
-
-/*******************************************************************************
-* Function Name : SSP_LoopBackMode
-* Description : Enable or disable the Loop back mode for the selected SSPx peripheral.
-* Input : - SSPx: where x can be 0 or 1 to select the SSP peripheral.
-* - NewState: new state of the Loop Back mode.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None.
-*******************************************************************************/
-void SSP_LoopBackMode(SSP_TypeDef* SSPx, FunctionalState NewState)
-{
- if(NewState == ENABLE)
- {
- /* Enable loop back mode */
- SSPx->CR1 |= SSP_LoopBackMode_Enable;
- }
- else
- {
- /* Disable loop back mode */
- SSPx->CR1 &= SSP_LoopBackMode_Disable;
- }
-}
-
-
-
-/*******************************************************************************
-* Function Name : SSP_GetFlagStatus
-* Description : Checks whether the specified SSP flag is set or not.
-* Input : - SSPx: where x can be 0 or 1 to select the SSP peripheral.
-* - SSP_FLAG: flag to check. This parameter can be one of the
-* following values:
-* - SSP_FLAG_Busy: busy flag
-* - SSP_FLAG_RxFifoFull: Receive FIFO full flag
-* - SSP_FLAG_RxFifoNotEmpty: Receive FIFO not empty flag
-* - SSP_FLAG_TxFifoNotFull: Transmit FIFO not full flag
-* - SSP_FLAG_TxFifoEmpty: Transmit FIFO empty flag
-* - SSP_FLAG_TxFifo: Transmit FIFO half empty or less flag
-* - SSP_FLAG_RxFifo: Receive FIFO half full or less flag
-* - SSP_FLAG_RxTimeOut: Receive timeout flag
-* - SSP_FLAG_RxOverrun: Receive overrun flag
-* Output : None
-* Return : The new state of SSP_Flag (SET or RESET).
-*******************************************************************************/
-FlagStatus SSP_GetFlagStatus(SSP_TypeDef* SSPx, u16 SSP_FLAG)
-{
- u32 SSPReg = 0, FlagPos = 0;
- u32 StatusReg = 0;
-
- /* Get the SSP register index */
- SSPReg = SSP_FLAG >> 5;
-
- /* Get the flag position */
- FlagPos = SSP_FLAG & SSP_Flag_Mask;
-
- /* Find the register of the flag to check */
- if(SSPReg == 1)
- {
- /* The flag to check is in SR register */
- StatusReg = SSPx->SR;
- }
- else if (SSPReg == 2)
- {
- /* The flag to check is in RISR register */
- StatusReg = SSPx->RISR;
- }
-
- /* Check the status of the specified SSP flag */
- if((StatusReg & (1 << FlagPos)) != RESET)
- {
- /* Return SET if the SSP flag is set */
- return SET;
- }
- else
- {
- /* Return RESET if the SSP flag is reset */
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : SSP_ClearFlag
-* Description : Clears the SSPx flags.
-* Input : - SSPx: where x can be 0 or 1 to select the SSP peripheral.
-* - SSP_FLAG: flags to clear. This parameter one of the
-* following values:
-* - SSP_FLAG_RxTimeOut: Receive timeout flag
-* - SSP_FLAG_RxOverrun: Receive overrun flag
-* Output : None
-* Return : None
-*******************************************************************************/
-void SSP_ClearFlag(SSP_TypeDef* SSPx, u16 SSP_FLAG)
-{
- u8 FlagPos = 0;
-
- /* Get the flag position */
- FlagPos = SSP_FLAG & SSP_Flag_Mask;
-
- /* Clear the selected SSP flag */
- SSPx->ICR = (1 << FlagPos);
-}
-
-/*******************************************************************************
-* Function Name : SSP_GetITStatus
-* Description : Checks whether the specified SSP interrupt flag is set or not.
-* Input : - SSPx: where x can be 0 or 1 to select the SSP peripheral.
-* - SSP_IT: interrupt flag to check. This parameter can be one
-* of the following values:
-* - SSP_IT_TxFifo: Transmit FIFO half empty or less interrupt
-* - SSP_IT_RxFifo: Receive FIFO half full or less interrupt
-* - SSP_IT_RxTimeOut: Receive timeout interrupt
-* - SSP_IT_RxOverrun: Receive overrun interrupt
-* Output : None
-* Return : The new state of SSP_IT flag (SET or RESET).
-*******************************************************************************/
-ITStatus SSP_GetITStatus(SSP_TypeDef* SSPx, u16 SSP_IT)
-{
- /* Check the status of the specified interrupt flag */
- if((SSPx->MISR & SSP_IT) != RESET)
- {
- /* Return SET if the SSP interrupt flag is set */
- return SET;
- }
- else
- {
- /* Return RESET if SSP interrupt flag is reset */
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : SSP_ClearITPendingBit
-* Description : Clears the pending interrupt flags.
-* Input : - SSPx: where x can be 0 or 1 to select the SSP peripheral.
-* - SSP_IT: interrupts pending bits to clear. This parameter
-* can be any combination of the following values:
-* - SSP_IT_RxTimeOut: Receive timeout interrupt
-* - SSP_IT_RxOverrun: Receive overrun interrupt
-* Output : None
-* Return : None
-*******************************************************************************/
-void SSP_ClearITPendingBit(SSP_TypeDef* SSPx, u16 SSP_IT)
-{
- /* Clear the selected SSP interrupts pending bits */
- SSPx->ICR = SSP_IT;
-}
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
-
diff --git a/uc_str912/prj_template91x/str91x_lib/src/91x_tim.c b/uc_str912/prj_template91x/str91x_lib/src/91x_tim.c
deleted file mode 100644
index 7957168..0000000
--- a/uc_str912/prj_template91x/str91x_lib/src/91x_tim.c
+++ /dev/null
@@ -1,694 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_tim.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the TIM software functions.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_tim.h"
-
-/* Include of other module interface headers ---------------------------------*/
-/* Local includes ------------------------------------------------------------*/
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-
-/* TIM Bits Masks */
-
-#define TIM_PWM_MASK 0x0010
-#define TIM_OPM_MASK 0x0020
-#define TIM_OC1_ENABLE_MASK 0x0040
-#define TIM_OC1_DISABLE_MASK 0xFFBF
-#define TIM_OC2_ENABLE_MASK 0x0080
-#define TIM_OC2_DISABLE_MASK 0xFF7F
-
-#define TIM_OLVL1_SET_MASK 0x0100
-#define TIM_OLVL1_RESET_MASK 0xFEFF
-
-#define TIM_OLVL2_SET_MASK 0x0200
-#define TIM_OLVL2_RESET_MASK 0xFDFF
-
-#define TIM_ENABLE_MASK 0x8000
-#define TIM_DISABLE_MASK 0x7FFF
-
-#define TIM_DMA_CLEAR_MASK 0xCFFF
-
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/* Interface functions -------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/*******************************************************************************
-* Function Name : TIM_DeInit
-* Description : Initializes TIM peripheral control and registers to their
-* : default reset values.
-* Input : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void TIM_DeInit(TIM_TypeDef *TIMx)
-{
- if((TIMx == TIM0)||(TIMx == TIM1))
- {
- SCU_APBPeriphReset(__TIM01, DISABLE); /* TIM0 & TIM1 Reset's off */
- }
- else
- {
- SCU_APBPeriphReset(__TIM23, DISABLE); /* TIM2 & TIM3 Reset's off */
- }
-
- /* Set all the TIMx registers to thier default values */
- TIMx->OC1R = 0x8000;
- TIMx->OC2R = 0x8000;
- TIMx->CR1 = 0x0;
- TIMx->CR2 = 0x1;
- TIMx->CNTR = 0x1234;
- TIMx->SR = 0x0;
-}
-
-/*******************************************************************************
-* Function Name : TIM_StructInit
-* Description : Fills in a TIM_InitTypeDef structure with the reset value of
-* each parameter.
-* Input : TIM_InitStruct : pointer to a TIM_InitTypeDef structure
- which will be initialized.
-* Output : None
-* Return : None.
-*******************************************************************************/
-void TIM_StructInit(TIM_InitTypeDef *TIM_InitStruct)
-{
- TIM_InitStruct->TIM_Mode = 0x0000;
- TIM_InitStruct->TIM_OC1_Modes = 0x0000;
- TIM_InitStruct->TIM_OC2_Modes = 0x0000;
- TIM_InitStruct->TIM_Clock_Source = 0x0000;
- TIM_InitStruct->TIM_Clock_Edge = 0x0000;
- TIM_InitStruct->TIM_OPM_INPUT_Edge = 0x0000;
- TIM_InitStruct->TIM_ICAP1_Edge = 0x0000;
- TIM_InitStruct->TIM_ICAP2_Edge = 0x0000;
- TIM_InitStruct->TIM_Prescaler = 0x0000;
- TIM_InitStruct->TIM_Pulse_Level_1 = 0x0000;
- TIM_InitStruct->TIM_Pulse_Level_2 = 0x0000;
- TIM_InitStruct->TIM_Period_Level = 0x0000;
- TIM_InitStruct->TIM_Pulse_Length_1 = 0x0000;
- TIM_InitStruct->TIM_Pulse_Length_2 = 0x0000;
- TIM_InitStruct->TIM_Full_Period = 0x0000;
-}
-
-/*******************************************************************************
-* Function Name : TIM_Init
-* Description : Initializes TIM peripheral according to the specified
-* parameters in the TIM_InitTypeDef structure.
-* Input1 : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Input2 : TIM_InitStruct: pointer to a TIM_InitTypeDef structure that
-* contains the configuration information for the specified
-* TIM peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-
-void TIM_Init(TIM_TypeDef *TIMx, TIM_InitTypeDef *TIM_InitStruct)
-{
-/***************************** Clock configuration ****************************/
-
- if (TIM_InitStruct->TIM_Clock_Source == TIM_CLK_APB)
- {
- /* APB clock */
- TIMx->CR1 &= TIM_CLK_APB;
- }
- else
- {
- /* External/SCU clock */
- TIMx->CR1 |= TIM_CLK_EXTERNAL;
- if (TIM_InitStruct->TIM_Clock_Edge == TIM_CLK_EDGE_RISING)
- {
- /* Clock rising edge */
- TIMx->CR1 |= TIM_CLK_EDGE_RISING;
- }
- else
- {
- /* Clock falling edge */
- TIMx->CR1 &= TIM_CLK_EDGE_FALLING;
- }
- }
-
-/************************** Prescaler configuration ***************************/
-
- TIMx->CR2 =( TIMx->CR2 & 0xFF00 )|TIM_InitStruct->TIM_Prescaler ;
-
-/********************************** TIM Modes *********************************/
-
- switch ( TIM_InitStruct->TIM_Mode)
- {
-/******************************* PWM Input mode *******************************/
-
- case TIM_PWMI:
-
- /* Set the PWMI Bit */
- TIMx->CR1 |= TIM_PWMI;
-
- /* Set the first edge Level */
- if ( TIM_InitStruct->TIM_ICAP1_Edge == TIM_ICAP1_EDGE_RISING)
- {
- TIMx->CR1 |= TIM_ICAP1_EDGE_RISING;
- }
- else
- {
- TIMx->CR1 &= TIM_ICAP1_EDGE_FALLING;
- }
-
- /* Set the Second edge Level ( Opposite of the first level ) */
- if ( TIM_InitStruct->TIM_ICAP1_Edge == TIM_ICAP1_EDGE_RISING)
- {
- TIMx->CR1 &= TIM_ICAP2_EDGE_FALLING;
- }
- else
- {
- TIMx->CR1 |= TIM_ICAP2_EDGE_RISING;
- }
-
- break;
-
-/************************** Output compare channel 1 **************************/
-
- case TIM_OCM_CHANNEL_1:
-
- if (TIM_InitStruct->TIM_Pulse_Level_1 == TIM_HIGH)
- {
- TIMx->CR1 |= TIM_OLVL1_SET_MASK;
- }
- else
- {
- TIMx->CR1 &= TIM_OLVL1_RESET_MASK;
- }
-
- TIMx->OC1R = TIM_InitStruct->TIM_Pulse_Length_1;
-
- if (TIM_InitStruct->TIM_OC1_Modes == TIM_TIMING)
- {
- TIMx->CR1 &= TIM_OC1_DISABLE_MASK;
- }
- else
- {
- TIMx->CR1 |= TIM_OC1_ENABLE_MASK;
- }
-
- break;
-
-/************************** Output compare channel 2 **************************/
-
- case TIM_OCM_CHANNEL_2:
-
- if (TIM_InitStruct->TIM_Pulse_Level_2 == TIM_HIGH)
- {
- TIMx->CR1 |= TIM_OLVL2_SET_MASK;
- }
- else
- {
- TIMx->CR1 &= TIM_OLVL2_RESET_MASK;
- }
-
- TIMx->OC2R = TIM_InitStruct->TIM_Pulse_Length_2;
-
- if (TIM_InitStruct->TIM_OC2_Modes == TIM_TIMING)
- {
- TIMx->CR1 &= TIM_OC2_DISABLE_MASK;
- }
- else
- {
- TIMx->CR1 |= TIM_OC2_ENABLE_MASK;
- }
-
- break;
-
-/************************ Output compare channel 1 & 2 ************************/
-
- case TIM_OCM_CHANNEL_12:
-
- TIMx->OC2R = TIM_InitStruct->TIM_Pulse_Length_2;
- TIMx->OC1R = TIM_InitStruct->TIM_Pulse_Length_1;
-
- if (TIM_InitStruct->TIM_OC2_Modes == TIM_TIMING)
- {
- TIMx->CR1 &= TIM_OC2_DISABLE_MASK;
- }
- else
- {
- TIMx->CR1 |= TIM_OC2_ENABLE_MASK;
- }
-
- if (TIM_InitStruct->TIM_OC1_Modes == TIM_TIMING)
- {
- TIMx->CR1 &= TIM_OC1_DISABLE_MASK;
- }
- else
- {
- TIMx->CR1 |= TIM_OC1_ENABLE_MASK;
- }
-
- if (TIM_InitStruct->TIM_Pulse_Level_1 == TIM_HIGH)
- {
- TIMx->CR1 |= TIM_OLVL1_SET_MASK;
- }
- else
- {
- TIMx->CR1 &= TIM_OLVL1_RESET_MASK;
- }
-
- if (TIM_InitStruct->TIM_Pulse_Level_2 == TIM_HIGH)
- {
- TIMx->CR1 |= TIM_OLVL2_SET_MASK;
- }
- else
- {
- TIMx->CR1 &= TIM_OLVL2_RESET_MASK;
- }
-
- break;
-
-/********************************** PWM mode **********************************/
-
- case TIM_PWM:
-
- /* Set the Level During the pulse */
- if ( TIM_InitStruct->TIM_Pulse_Level_1 == TIM_HIGH)
- {
- TIMx->CR1 |= TIM_OLVL2_SET_MASK;
- }
- else
- {
- TIMx->CR1 &= TIM_OLVL2_RESET_MASK;
- }
-
- /* Set the Level after the pulse */
- if (TIM_InitStruct->TIM_Period_Level == TIM_HIGH)
- {
- TIMx->CR1 |= TIM_OLVL1_SET_MASK;
- }
- else
- {
- TIMx->CR1 &= TIM_OLVL1_RESET_MASK;
- }
-
- /* Set the OCAE */
- TIMx->CR1 |= TIM_OC1_ENABLE_MASK;
-
- /* Set the PWM Bit */
- TIMx->CR1 |= TIM_PWM_MASK;
-
- /* Set the Duty Cycle value */
- if ( TIM_InitStruct->TIM_Pulse_Length_1 < 5 )
- {
- TIM_InitStruct->TIM_Pulse_Length_1 = 4;
- }
-
- TIMx->OC1R = TIM_InitStruct->TIM_Pulse_Length_1 - 4;
-
- /* Set the Full Period */
- TIMx->OC2R = TIM_InitStruct->TIM_Full_Period - 4;
-
- break;
-
-/******************************* One pulse mode *******************************/
-
- case TIM_OPM:
-
- /* Set the Level During the pulse */
- if (TIM_InitStruct->TIM_Pulse_Level_1 == TIM_HIGH)
- {
- TIMx->CR1 |= TIM_OLVL2_SET_MASK;
- }
-
- /* Set the Level after the pulse */
- if (TIM_InitStruct->TIM_Period_Level == TIM_HIGH)
- {
- TIMx->CR1 |= TIM_OLVL1_SET_MASK;
- }
-
- /* Set the Activation Edge on the ICAP 1 */
- if (TIM_InitStruct->TIM_OPM_INPUT_Edge == TIM_OPM_EDGE_RISING)
- {
- TIMx->CR1 |= TIM_OPM_EDGE_RISING;
- }
-
- /* Set the Output Compare Function */
- TIMx->CR1 |= TIM_OC1_ENABLE_MASK;
-
- /* Set the One pulse mode */
- TIMx->CR1 |= TIM_OPM_MASK;
-
- /* Set the Pulse length */
- TIMx->OC1R = TIM_InitStruct->TIM_Pulse_Length_1;
-
- break;
-
-/*************************** Input capture channel 1 **************************/
-
- case TIM_ICAP_CHANNEL_1:
-
- if (TIM_InitStruct->TIM_ICAP1_Edge == TIM_ICAP1_EDGE_RISING)
- {
- TIMx->CR1 |= TIM_ICAP1_EDGE_RISING;
- }
- else
- {
- TIMx->CR1 &= TIM_ICAP1_EDGE_FALLING;
- }
-
- break;
-
-/*************************** Input capture channel 2 **************************/
-
- case TIM_ICAP_CHANNEL_2:
-
- if (TIM_InitStruct->TIM_ICAP2_Edge == TIM_ICAP2_EDGE_RISING)
- {
- TIMx->CR1 |= TIM_ICAP2_EDGE_RISING;
- }
- else
- {
- TIMx->CR1 &= TIM_ICAP2_EDGE_FALLING;
- }
-
- break;
-
-/************************* Input capture channel 1 & 2 ************************/
-
- case TIM_ICAP_CHANNEL_12:
- if (TIM_InitStruct->TIM_ICAP2_Edge == TIM_ICAP2_EDGE_RISING)
- {
- TIMx->CR1 |= TIM_ICAP2_EDGE_RISING;
- }
- else
- {
- TIMx->CR1 &= TIM_ICAP2_EDGE_FALLING;
- }
-
- if (TIM_InitStruct->TIM_ICAP1_Edge == TIM_ICAP1_EDGE_RISING)
- {
- TIMx->CR1 |= TIM_ICAP1_EDGE_RISING;
- }
- else
- {
- TIMx->CR1 &= TIM_ICAP1_EDGE_FALLING;
- }
-
- break;
-
- default:
- break;
- }
-}
-
-/*******************************************************************************
-* Function Name : TIM_CounterCmd
-* Description : Enables or disables TIMx Counter peripheral.
-* Input1 : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Input2 : TIM_operation: specifies the new state of the TIMx Counter.
-* This parameter can be one of the following values:
-* - TIM_START: Start the timer counter.
-* - TIM_STOP : Stop the timer counter.
-* - TIM_CLEAR: Clear the timer counter.
-* Output : None
-* Return : None
-*******************************************************************************/
-void TIM_CounterCmd(TIM_TypeDef *TIMx, TIM_CounterOperations TIM_operation)
-{
- switch (TIM_operation)
- {
- case TIM_START:
- TIMx->CR1 |= TIM_ENABLE_MASK;
- break;
-
- case TIM_STOP:
- TIMx->CR1 &= TIM_DISABLE_MASK;
- break;
-
- case TIM_CLEAR:
- TIMx->CNTR = 0x1234;
- break;
-
- default:
- break;
- }
-}
-
-/*******************************************************************************
-* Function Name : TIM_PrescalerConfig
-* Description : This routine is used to configure the TIMx prescaler value
-* (when using the APB clock).
-* Input1 : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Input2 : TIM_Prescaler: specifies the prescaler value. This parameter
-* can be a value from 0x0 to 0xFF.
-* Output : None
-* Return : None
-*******************************************************************************/
-void TIM_PrescalerConfig(TIM_TypeDef *TIMx, u8 TIM_Prescaler)
-{
- TIMx->CR2 &= 0xFF00;
- TIMx->CR2 |= TIM_Prescaler;
-
-}
-/*******************************************************************************
-* Function Name : TIM_GetPrescalerValue
-* Description : This routine is used to get the TIMx prescaler value
-* (when using the APB clock).
-* Input : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Output : None
-* Return : The prescaler value.
-*******************************************************************************/
-u8 TIM_GetPrescalerValue(TIM_TypeDef *TIMx)
-{
- return TIMx->CR2 & 0x00FF;
-}
-
-/*******************************************************************************
-* Function Name : TIM_GetCounterValue
-* Description : This routine is used to get the TIMx counter value.
-* Input : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Output : None
-* Return : The counter value.
-*******************************************************************************/
-u16 TIM_GetCounterValue(TIM_TypeDef *TIMx)
-{
- return TIMx->CNTR;
-}
-
-/*******************************************************************************
-* Function Name : TIM_GetICAP1Value
-* Description : This routine is used to get the Input Capture 1 value.
-* Input : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Output : None
-* Return : The Input Capture 1 value.
-*******************************************************************************/
-u16 TIM_GetICAP1Value(TIM_TypeDef *TIMx)
-{
- return TIMx->IC1R;
-}
-
-/*******************************************************************************
-* Function Name : TIM_GetICAP2Value
-* Description : This routine is used to get the Input Capture 2 value.
-* Input : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Output : None
-* Return : The Input Capture 2 value.
-*******************************************************************************/
-u16 TIM_GetICAP2Value(TIM_TypeDef *TIMx)
-{
- return TIMx->IC2R;
-}
-
-/*******************************************************************************
-* Function Name : TIM_SetPulse
-* Description : This routine is used to set the pulse value.
-* Input1 : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Input2 : TIM_Channel: specifies the needed channel.
-* This parameter can be one of the following values:
-* - TIM_PWM_OC1_Channel: PWM/Output Compare 1 Channel
-* - TIM_OC2_Channel : Output Compare 2 Channel
-* Input3 : TIM_Pulse: specifies the new pulse value.
-* Output : None
-* Return : None
-*******************************************************************************/
-void TIM_SetPulse(TIM_TypeDef *TIMx,u16 TIM_Channel ,u16 TIM_Pulse)
-{
- if (TIM_Channel == TIM_PWM_OC1_Channel)
- {
- TIMx->OC1R = TIM_Pulse;
- }
- else
- {
- TIMx->OC2R = TIM_Pulse;
- }
-}
-/*******************************************************************************
-* Function Name : TIM_GetFlagStatus
-* Description : Checks whether the specified TIMx flag is set or not.
-* Input1 : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Input2 : TIM_Flag: specifies the flag to check.
-* This parameter can be one of the following values:
-* - TIM_FLAG_IC1: Input Capture Channel 1 Flag
-* - TIM_FLAG_IC2: Input Capture Channel 2 Flag
-* - TIM_FLAG_TO : Timer Overflow Flag
-* - TIM_FLAG_OC1: Output Compare Channel 1 Flag
-* - TIM_FLAG_OC2: Output Compare Channel 2 Flag
-* Output : None
-* Return : The NewState of the TIM_Flag (SET or RESET).
-*******************************************************************************/
-FlagStatus TIM_GetFlagStatus(TIM_TypeDef *TIMx, u16 TIM_Flag)
-{
- if((TIMx->SR & TIM_Flag) == RESET)
- {
- return RESET;
- }
- else
- {
- return SET;
- }
-}
-
-/*******************************************************************************
-* Function Name : TIM_ClearFlag
-* Description : Clears the TIM Flag passed as a parameter.
-* Input1 : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Input2 : TIM_Flag: specifies the flag to clear.
-* This parameter can be one of the following values:
-* - TIM_FLAG_IC1: Input Capture Channel 1 Flag
-* - TIM_FLAG_IC2: Input Capture Channel 2 Flag
-* - TIM_FLAG_TO : Timer Overflow Flag
-* - TIM_FLAG_OC1: Output Compare Channel 1 Flag
-* - TIM_FLAG_OC2: Output Compare Channel 2 Flag
-* Output : None
-* Return : None
-*******************************************************************************/
-void TIM_ClearFlag(TIM_TypeDef *TIMx, u16 TIM_Flag)
-{
- /* Clear TIM_Flag */
- TIMx->SR &= ~TIM_Flag;
-}
-
-/*******************************************************************************
-* Function Name : TIM_GetPWMIPulse
-* Description : This routine is used to get the Pulse value in PWMI Mode.
-* Input : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Output : None
-* Return : The pulse value.
-*******************************************************************************/
-u16 TIM_GetPWMIPulse(TIM_TypeDef *TIMx)
-{
- return TIMx->IC2R;
-}
-
-/*******************************************************************************
-* Function Name : TIM_GetPWMIPeriod
-* Description : This routine is used to get the Period value in PWMI Mode.
-* Input : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Output : None
-* Return : The period value.
-*******************************************************************************/
-u16 TIM_GetPWMIPeriod(TIM_TypeDef *TIMx)
-{
- return TIMx->IC1R;
-}
-
-/*******************************************************************************
-* Function Name : TIM_ITConfig
-* Description : Configures the Timer interrupt source.
-* Input1 : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Input2 : TIM_IT: specifies the TIM interrupt source to be enabled.
-* This parameter can be one of the following values:
-* - TIM_IT_IC1: Input Capture 1 Interrupt source.
-* - TIM_IT_OC1: Output Compare 1 Interrupt source.
-* - TIM_IT_TO : Timer Overflow Interrupt source.
-* - TIM_IT_IC2: Input Capture 2 Interrupt source.
-* - TIM_IT_OC2: Output Compare 2 Interrupt source.
-* Input3 : TIM_Newstate: specifies the new state of the TIMx IT.
-* This parameter can be one of the following values:
-* - ENABLE : Enable the needed interrupt.
-* - DISABLE: Disable the needed interrupt.
-* Output : None
-* Return : None
-*******************************************************************************/
-void TIM_ITConfig(TIM_TypeDef *TIMx, u16 TIM_IT, FunctionalState TIM_Newstate)
-{
- if(TIM_Newstate == ENABLE)
- {
- TIMx->CR2 = (TIMx->CR2 & 0x00FF) | TIM_IT;
- }
- else
- {
- TIMx->CR2 &= ~TIM_IT;
- }
-}
-
-/*******************************************************************************
-* Function Name : TIM_DMAConfig
-* Description : Configures the Timer DMA source.
-* Input1 : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Input2 : TIM_DMA_Souces: specifies the TIM DMA source to be selected.
-* This parameter can be one of the following values:
-* - TIM_DMA_IC1: Input Capture 1 DMA source.
-* - TIM_DMA_OCA1 Output Compare 1 DMA source.
-* - TIM_DMA_TO: Timer Overflow DMA source.
-* - TIM_DMA_IC2: Input Capture 2 DMA source.
-* - TIM_DMA_OC2: Output Compare 2 DMA source.
-* Output : None
-* Return : None
-*******************************************************************************/
-void TIM_DMAConfig(TIM_TypeDef *TIMx, u16 TIM_DMA_Sources)
-{
- /* Reset the DMAS[1:0] bits */
- TIMx->CR1 &= TIM_DMA_CLEAR_MASK;
- /* Set the DMAS[1:0] bits according to TIM_DMA_Sources parameter */
- TIMx->CR1 |= TIM_DMA_Sources;
-}
-
-/*******************************************************************************
-* Function Name : TIM_DMACmd
-* Description : Enables or disables TIMx DMA peripheral.
-* Input1 : TIMx: where x can be from 0 to 3 to select the TIM
-* peripheral.
-* Input2 : TIM_Newstate: new state of the TIMx DMA peripheral
-* This parameter can be one of the following values:
-* - ENABLE : Enable the TIMx DMA.
-* - DISABLE: Disable the TIMx DMA.
-* Output : None
-* Return : None
-*******************************************************************************/
-void TIM_DMACmd(TIM_TypeDef *TIMx, FunctionalState TIM_Newstate)
-{
- if (TIM_Newstate == ENABLE)
- {
- TIMx->CR2 |= TIM_DMA_ENABLE;
- }
- else
- {
- TIMx->CR2 &= TIM_DMA_DISABLE;
- }
-}
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_template91x/str91x_lib/src/91x_uart.c b/uc_str912/prj_template91x/str91x_lib/src/91x_uart.c
deleted file mode 100644
index 3c87216..0000000
--- a/uc_str912/prj_template91x/str91x_lib/src/91x_uart.c
+++ /dev/null
@@ -1,658 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_uart.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the UART software functions.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_uart.h"
-#include "91x_scu.h"
-
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-/* UART IrDA Mask */
-#define UART_IrDA_Disable_Mask 0xFFFD /* IrDA Disable Mask */
-#define UART_IrDA_Enable_Mask 0x0002 /* IrDA Enable Mask */
-#define IrDA_LowPower_Enable_Mask 0x0004 /*IrDA lower power mode enable*/
-#define IrDA_LowPower_Disable_Mask 0xFFFB /*IrDA lower power mode enable*/
-
-/* UART Mask */
-#define UART_Enable_Mask 0x0001 /* UART Enable Mask */
-#define UART_Disable_Mask 0xFFFE /* UART Disable Mask */
-
-/* UART LoopBack */
-#define UART_LoopBack_Disable_Mask 0xFF7F /* LoopBack Disable Mask */
-#define UART_LoopBack_Enable_Mask 0x0080 /* LoopBack Enable Mask */
-
-#define UART_WordLength_Mask 0xFF9F /* UART Word Length Mask */
-#define UART_Parity_Mask 0xFF79 /* UART Parity Mask */
-#define UART_HardwareFlowControl_Mask 0x3FFF /* UART Hardware Flow Control Mask */
-#define UART_TxRxFIFOLevel_Mask 0xFFC0 /* UART Tx Rx FIFO Level Mask */
-#define UART_BreakChar_Mask 0x0001 /* UART Break Character send Mask*/
-#define UART_FLAG_Mask 0x1F /* UART Flag Mask */
-#define UART_Mode_Mask 0xFCFF /* UART Mode Mask */
-#define UART_RTS_LowLevel_Mask 0x0800 /* RTS signal is low */
-#define UART_RTS_HighLevel_Mask 0xF7FF /* RTS signal is High */
-#define UART_DTR_LowLevel_Mask 0x0400 /* DTR signal is low */
-#define UART_DTR_HighLevel_Mask 0xFBFF /* DTR signal is High */
-#define UART_ClearFlag_Mask 0xAA /* Clear Flag Mask */
-
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-
- /*******************************************************************************
-* Function Name : UART_DeInit
-* Description : Deinitializes the UARTx peripheral registers
-* to their default reset values.
-* Input : UARTx: where x can be 0,1 or 2 to select the UART peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_DeInit(UART_TypeDef* UARTx)
-{
- /* Reset the UARTx registers values */
- if(UARTx == UART0)
- {
- SCU_APBPeriphReset(__UART0,ENABLE);
- SCU_APBPeriphReset(__UART0,DISABLE);
- }
- else if(UARTx == UART1)
- {
- SCU_APBPeriphReset(__UART1,ENABLE);
- SCU_APBPeriphReset(__UART1,DISABLE);
- }
- else if(UARTx == UART2)
- {
- SCU_APBPeriphReset(__UART2,ENABLE);
- SCU_APBPeriphReset(__UART2,DISABLE);
- }
-}
-
-/*******************************************************************************
-* Function Name : UART_Init
-* Description : Initializes the UARTx peripheral according to the specified
-* parameters in the UART_InitStruct .
-* Input : - UARTx: where x can be 0,1or 2 to select the UART peripheral.
-* - UART_InitStruct: pointer to a UART_InitTypeDef structure
-* that contains the configuration information for the
-* specified UART peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_Init(UART_TypeDef* UARTx, UART_InitTypeDef* UART_InitStruct)
-{
-
- u64 UART_MainClock = 0;
- u32 IntegerDivider = 0;
- u32 FractionalDivider = 0;
-
- /* Clear the LCR[6:5] bits */
- UARTx->LCR &= UART_WordLength_Mask;
- /* Set the LCR[6:5] bits according to UART_WordLength value */
- UARTx->LCR |= UART_InitStruct->UART_WordLength;
-
- /* Choose Stop Bits */
- if(UART_InitStruct->UART_StopBits == UART_StopBits_2)
- {
- /* 2 Stop Bit */
- UARTx->LCR |= UART_StopBits_2;
- }
- else
- {
- /* One Stop Bits */
- UARTx->LCR &= UART_StopBits_1;
- }
-
- /* Configure the Parity */
- /* Clear the LCR[7]and LCR[2:1] bits */
- UARTx->LCR &= UART_Parity_Mask;
- /* Set the LCR[7]and LCR[2:1] bits according to UART_Parity value */
- UARTx->LCR |= UART_InitStruct->UART_Parity;
-
- /* Configure the BaudRate */
- UART_MainClock = (SCU_GetMCLKFreqValue())*1000;
- if((SCU->CLKCNTR & 0x200) != 0x200)
- {
- UART_MainClock = UART_MainClock/2;
- }
- /* Determine the integer part */
- IntegerDivider = ((100) * (UART_MainClock) / (16 * (UART_InitStruct->UART_BaudRate)));
- UARTx->IBRD = IntegerDivider / 100;
-
- /* Determine the fractional part */
- FractionalDivider = IntegerDivider - (100 * (UARTx->IBRD));
- UARTx->FBRD = ((((FractionalDivider * 64) + 50) / 100));
-
- /* Choose the Hardware Flow Control */
- /* Clear the CR[15:14] bits */
- UARTx->CR &= UART_HardwareFlowControl_Mask;
- /* Set the CR[15:14] bits according to UART_HardwareFlowControl value */
- UARTx->CR |= UART_InitStruct->UART_HardwareFlowControl;
-
- /* Configure the UART mode */
- /* Clear the CR[9:8] bits */
- UARTx->CR &= UART_Mode_Mask;
- /* Set the CR[9:8] bits according to UART_Mode value */
- UARTx->CR |= UART_InitStruct->UART_Mode;
-
- /* Enable or disable the FIFOs */
- /* Set the FIFOs Levels */
- if(UART_InitStruct->UART_FIFO == UART_FIFO_Enable)
- {
- /* Enable the FIFOs */
- UARTx->LCR |= UART_FIFO_Enable;
-
- /* Clear TXIFLSEL and RXIFLSEL bits */
- UARTx->IFLS &= UART_TxRxFIFOLevel_Mask;
-
- /* Set RXIFLSEL bits according to UART_RxFIFOLevel value */
- UARTx->IFLS |= (UART_InitStruct->UART_RxFIFOLevel << 3);
-
- /* Set TXIFLSEL bits according to UART_TxFIFOLevel value */
- UARTx->IFLS |= UART_InitStruct->UART_TxFIFOLevel;
- }
- else
- {
- /* Disable the FIFOs */
- UARTx->LCR &= UART_FIFO_Disable;
- }
-}
-
-/*******************************************************************************
-* Function Name : UART_StructInit
-* Description : Fills each UART_InitStruct member with its reset value.
-* Input : UART_InitStruct: pointer to a UART_InitTypeDef structure which
-* will be initialized.
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_StructInit(UART_InitTypeDef* UART_InitStruct)
-{
- /* Reset the UART_InitStruct members */
- UART_InitStruct->UART_WordLength = UART_WordLength_8D;
- UART_InitStruct->UART_StopBits = UART_StopBits_1;
- UART_InitStruct->UART_Parity = UART_Parity_Odd ;
- UART_InitStruct->UART_BaudRate = 9600;
- UART_InitStruct->UART_HardwareFlowControl = UART_HardwareFlowControl_None;
- UART_InitStruct->UART_Mode = UART_Mode_Tx_Rx;
- UART_InitStruct->UART_FIFO = UART_FIFO_Enable;
- UART_InitStruct->UART_TxFIFOLevel = UART_FIFOLevel_1_2;
- UART_InitStruct->UART_RxFIFOLevel = UART_FIFOLevel_1_2;
-}
-
-/*******************************************************************************
-* Function Name : UART_Cmd
-* Description : Enables or disables the specified UART peripheral.
-* Input : - UARTx: where x can be 0,1 or 2 to select the UART peripheral
-* - NewState: new state of the UARTx peripheral.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_Cmd(UART_TypeDef* UARTx, FunctionalState NewState)
-{
- if (NewState == ENABLE)
- {
- /* Enable the selected UART by setting the UARTEN bit in the CR register */
- UARTx->CR |= UART_Enable_Mask;
- }
- else
- {
- /* Disable the selected UART by clearing the UARTEN bit in the CR register */
- UARTx->CR &= UART_Disable_Mask;
- }
-}
-
-/*******************************************************************************
-* Function Name : UART_ITConfig
-* Description : Enables or disables the specified UART interrupts.
-* Input : - UARTx: where x can be 0,1 or 2 to select the UART peripheral
-* - UART_IT: specifies the UART interrupts sources to be
-* enabled or disabled. This parameter can be any combination
-* of the following values:
-* - UART_IT_OverrunError: Overrun Error interrupt
-* - UART_IT_BreakError: Break Error interrupt
-* - UART_IT_ParityError: Parity Error interrupt
-* - UART_IT_FrameError: Frame Error interrupt
-* - UART_IT_ReceiveTimeOut: Receive Time Out interrupt
-* - UART_IT_Transmit: Transmit interrupt
-* - UART_IT_Receive: Receive interrupt
-* - UART_IT_DSR: DSR interrupt
-* - UART_IT_DCD: DCD interrupt
-* - UART_IT_CTS: CTS interrupt
-* - UART_IT_RI: RI interrupt
-* - NewState: new state of the UARTx peripheral.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_ITConfig(UART_TypeDef* UARTx, u16 UART_IT, FunctionalState NewState)
-{
- if(NewState == ENABLE)
- {
- /* Enables the selected interrupts */
- UARTx->IMSC |= UART_IT;
- }
- else
- {
- /* Disables the selected interrupts */
- UARTx->IMSC &= ~UART_IT;
- }
-}
-
-/*******************************************************************************
-* Function Name : UART_DMAConfig
-* Description : Configures the UARTx’s DMA interface.
-* Input : - UARTx: where x can be 1 or 2 to select the UART peripheral
-* - UART_DMAOnError: specifies the DMA on error request.
-* This parameter can be:
-* - UART_DMAOnError_Enable: DMA receive request enabled
-* when the UART error interrupt is asserted.
-* - UART_DMAOnError_Disable: DMA receive request disabled
-* when the UART error interrupt is asserted.
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_DMAConfig(UART_TypeDef* UARTx, u16 UART_DMAOnError)
-{
- if(UART_DMAOnError == UART_DMAOnError_Enable)
- {
- UARTx->DMACR &= UART_DMAOnError_Enable;
- }
- else
- {
- UARTx->DMACR |= UART_DMAOnError_Disable;
- }
-}
-
-/*******************************************************************************
-* Function Name : UART_DMACmd
-* Description : Enables or disables the UARTx’s DMA interface.
-* Input : - UARTx: where x can be 1 or 2 to select the UART peripheral
-* - UART_DMAReq: enables or disables the request of DMA from UART.
-* This parameter can be:
-* - UART_DMAReq_Tx: Transmit DMA Enable
-* - UART_DMAReq_Rx: Receive DMA Enable
-* - NewState: new state of the UARTx peripheral.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_DMACmd(UART_TypeDef* UARTx, u8 UART_DMAReq, FunctionalState NewState)
-{
- if(UART_DMAReq == UART_DMAReq_Tx)
- {
- if(NewState == ENABLE)
- {
- UARTx->DMACR |= UART_DMAReq_Tx;
- }
- else
- {
- UARTx->DMACR &= ~UART_DMAReq_Tx;
- }
- }
-
- if(UART_DMAReq == UART_DMAReq_Rx)
- {
- if(NewState == ENABLE)
- {
- UARTx->DMACR |= UART_DMAReq_Rx;
- }
- else
- {
- UARTx->DMACR &= ~UART_DMAReq_Rx;
- }
- }
-}
-
-/*******************************************************************************
-* Function Name : UART_LoopBackConfig
-* Description : Enables or disables the LoopBack mode.
-* Input : - UARTx: where x can be 0,1 or 2 to select the UART peripheral
-* - NewState: new state of the UARTx peripheral.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_LoopBackConfig(UART_TypeDef* UARTx, FunctionalState NewState)
-{
- if (NewState == ENABLE)
- {
- /* Enable the LoopBack mode of the specified UART */
- UARTx->CR |= UART_LoopBack_Enable_Mask;
- }
- else
- {
- /* Disable the LoopBack mode of the specified UART */
- UARTx->CR &= UART_LoopBack_Disable_Mask;
- }
-}
-
-/*******************************************************************************
-* Function Name : UART_GetFlagStatus
-* Description : Checks whether the specified UART flag is set or not.
-* Input : - UARTx: where x can be 0,1 or 2 to select the UART peripheral
-* - UART_FLAG: specifies the flag to check.
-* This parameter can be one of the following values:
-* - UART_FLAG_OverrunError: Overrun error flag
-* - UART_FLAG_Break: break error flag
-* - UART_FLAG_ParityError: parity error flag
-* - UART_FLAG_FrameError: frame error flag
-* - UART_FLAG_RI: RI flag
-* - UART_FLAG_TxFIFOEmpty: Transmit FIFO Empty flag
-* - UART_FLAG_RxFIFOFull: Receive FIFO Full flag
-* - UART_FLAG_TxFIFOFull: Transmit FIFO Full flag
-* - UART_FLAG_RxFIFOEmpty: Receive FIFO Empty flag
-* - UART_FLAG_Busy: UART Busy flag
-* - UART_FLAG_CTS: CTS flag
-* - UART_FLAG_DCD: DCD flag
-* - UART_FLAG_DSR: DSR flag
-* - UART_RawIT_OverrunError: Overrun Error interrupt flag
-* - UART_RawIT_BreakError: Break Error interrupt flag
-* - UART_RawIT_ParityError: Parity Error interrupt flag
-* - UART_RawIT_FrameError: Frame Error interrupt flag
-* - UART_RawIT_ReceiveTimeOut: ReceiveTimeOut interrupt flag
-* - UART_RawIT_Transmit: Transmit interrupt flag
-* - UART_RawIT_Receive: Receive interrupt flag
-* - UART_RawIT_DSR: DSR interrupt flag
-* - UART_RawIT_DCD: DCD interrupt flag
-* - UART_RawIT_CTS: CTS interrupt flag
-* - UART_RawIT_RI: RI interrupt flag
-* Output : None
-* Return : The new state of UART_FLAG (SET or RESET).
-*******************************************************************************/
-FlagStatus UART_GetFlagStatus(UART_TypeDef* UARTx, u16 UART_FLAG)
-{
-
- u32 UARTReg = 0, FlagPos = 0;
- u32 StatusReg = 0;
-
- /* Get the UART register index */
- UARTReg = UART_FLAG >> 5;
-
- /* Get the flag position */
- FlagPos = UART_FLAG & UART_FLAG_Mask;
-
- if(UARTReg == 1) /* The flag to check is in RSR register */
- {
- StatusReg = UARTx->RSECR;
- }
- else if (UARTReg == 2) /* The flag to check is in FR register */
- {
- StatusReg = UARTx->FR;
- }
- else if(UARTReg == 3) /* The flag to check is in RIS register */
- {
- StatusReg = UARTx->RIS;
- }
-
- if((StatusReg & (1 << FlagPos))!= RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : UART_ClearFlag
-* Description : Clears the UARTx’s flags(Frame, Parity, Break, Overrun error).
-* Input : - UARTx: where x can be 0,1or 2 to select the UART peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_ClearFlag(UART_TypeDef* UARTx)
-{
- /* Clear the flag */
- UARTx->RSECR = UART_ClearFlag_Mask;
-}
-
-/*******************************************************************************
-* Function Name : UART_GetITStatus
-* Description : Checks whether the specified UART interrupt has occured or not.
-* Input : - UARTx: where x can be 0,1or 2 to select the UART peripheral.
-* - UART_IT: specifies the interrupt pending bit to be checked.
-* This parameter can be one of the following values:
-* - UART_IT_OverrunError: Overrun Error interrupt
-* - UART_IT_BreakError: Break Error interrupt
-* - UART_IT_ParityError: Parity Error interrupt
-* - UART_IT_FrameError: Frame Error interrupt
-* - UART_IT_ReceiveTimeOut: Receive Time Out interrupt
-* - UART_IT_Transmit: Transmit interrupt
-* - UART_IT_Receive: Receive interrupt
-* - UART_IT_DSR: DSR interrupt
-* - UART_IT_DCD: DCD interrupt
-* - UART_IT_CTS: CTS interrupt
-* - UART_IT_RI: RI interrupt
-* Output : None
-* Return : The new state of UART_IT (SET or RESET).
-*******************************************************************************/
-ITStatus UART_GetITStatus(UART_TypeDef* UARTx, u16 UART_IT)
-{
- if((UARTx->MIS & UART_IT) != RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : UART_ClearITPendingBit
-* Description : Clears the UARTx’s interrupt pending bits.
-* Input : - UARTx: where x can be 0,1or 2 to select the UART peripheral.
-* - UART_IT: specifies the interrupt pending bit to clear.
-* More than one interrupt can be cleared using the “|” operator.
-* This parameter can be:
-* - UART_IT_OverrunError: Overrun Error interrupt
-* - UART_IT_BreakError: Break Error interrupt
-* - UART_IT_ParityError: Parity Error interrupt
-* - UART_IT_FrameError: Frame Error interrupt
-* - UART_IT_ReceiveTimeOut: Receive Time Out interrupt
-* - UART_IT_Transmit: Transmit interrupt
-* - UART_IT_Receive: Receive interrupt
-* - UART_IT_DSR: DSR interrupt
-* - UART_IT_DCD: DCD interrupt
-* - UART_IT_CTS: CTS interrupt
-* - UART_IT_RI: RI interrupt
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_ClearITPendingBit(UART_TypeDef* UARTx, u16 UART_IT)
-{
- /* Clear the specified interrupt */
- UARTx->ICR = UART_IT;
-}
-
-/*******************************************************************************
-* Function Name : UART_IrDALowPowerConfig
-* Description : Sets the IrDA low power mode
-* Input : - IrDAx: where x can be 0,1 or 2 to select the UART/IrDA peripheral.
-* - NewState: new state of the UARTIrDA peripheral.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_IrDALowPowerConfig(u8 IrDAx, FunctionalState NewState)
-{
- UART_TypeDef* UARTx;
-
- switch(IrDAx)
- {
- case IrDA0: UARTx = UART0;
- break;
- case IrDA1: UARTx = UART1;
- break;
- case IrDA2: UARTx = UART2;
- break;
- }
-
- if (NewState == ENABLE)
- {
- UARTx->CR |= IrDA_LowPower_Enable_Mask;
- }
- else
- {
- UARTx->CR &= IrDA_LowPower_Disable_Mask;
- }
-}
-
-/*******************************************************************************
-* Function Name : UART_IrDASetCounter
-* Description : Sets the IrDA counter divisor value.
-* Input : - UARTx: where x can be 0,1 or 2 to select the UART/IrDA peripheral.
-* - IrDA_Counter: IrDA counter divisor new value n low power mode(Hz).
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_IrDASetCounter(u8 IrDAx, u32 IrDA_Counter)
-{
- UART_TypeDef* UARTx;
- u32 APBClock;
- switch(IrDAx)
- {
- case IrDA0: UARTx = UART0;
- break;
- case IrDA1: UARTx = UART1;
- break;
- case IrDA2: UARTx = UART2;
- break;
- }
- /* Get the APB frequency */
- APBClock = (SCU_GetPCLKFreqValue())*1000;
- /* Determine the Counter Divisor part */
- UARTx->ILPR = (((APBClock*10) / ( IrDA_Counter)) + 5 )/10;
- }
-
-/*******************************************************************************
-* Function Name : UART_IrDACmd
-* Description : Enables or disables the UARTx’s IrDA interface.
-* Input : - IrDAx: where x can be 0,1 or 2 to select the UART/IrDA peripheral
-* - NewState: new state of the UARTx peripheral.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_IrDACmd(u8 IrDAx, FunctionalState NewState)
-{
- UART_TypeDef* UARTx;
-
- switch(IrDAx)
- {
- case IrDA0: UARTx = UART0;
- break;
- case IrDA1: UARTx = UART1;
- break;
- case IrDA2: UARTx = UART2;
- break;
- }
- if(NewState == ENABLE)
- {
- /* Enable the IrDA mode of the specified UART */
- UARTx->CR |= UART_IrDA_Enable_Mask;
- }
- else
- {
- /* Disable the IrDA mode of the specified UART */
- UARTx->CR &= UART_IrDA_Disable_Mask;
- }
-}
-
-/*******************************************************************************
-* Function Name : UART_SendData
-* Description : Transmits signle Byte of data through the UARTx peripheral.
-* Input : - UARTx: where x can be 0,1 or 2 to select the UART peripheral.
-* - Data: the byte to transmit
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_SendData(UART_TypeDef* UARTx, u8 Data)
-{
- /* Transmit one byte */
- UARTx->DR = Data;
-}
-
-/*******************************************************************************
-* Function Name : UART_ReceiveData
-* Description : Returns the most recent received Byte by the UARTx peripheral.
-* Input : UARTx: where x can be 0,1 or 2 to select the UART peripheral.
-* Output : None
-* Return : The received data
-*******************************************************************************/
-u8 UART_ReceiveData(UART_TypeDef* UARTx)
-{
- /* Receive one byte */
- return ((u8)UARTx->DR);
-}
-
-/*******************************************************************************
-* Function Name : UART_SendBreak
-* Description : Transmits break characters.
-* Input : UARTx: where x can be 0,1 or 2 to select the UART peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_SendBreak(UART_TypeDef* UARTx)
-{
- /* Send break characters */
- UARTx->LCR |= UART_BreakChar_Mask;
-}
-
-/*******************************************************************************
-* Function Name : UART_RTSConfig
-* Description : Sets or Resets the RTS signal
-* Input : - LevelState: new state of the RTS signal for UART0 only.
-* This parameter can be: LowLevel or HighLevel
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_RTSConfig(UART_LevelTypeDef LevelState)
-{
- if(LevelState == LowLevel)
- {
- UART0->CR |= UART_RTS_LowLevel_Mask;
- }
- else
- {
- UART0->CR &= UART_RTS_HighLevel_Mask;
- }
-}
-
-/*******************************************************************************
-* Function Name : UART_DTRConfig
-* Description : Sets or Resets the DTR signal for UART0 only
-* Input : - LevelState: new state of the DTR signal.
-* This parameter can be: LowLevel or HighLevel
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART_DTRConfig(UART_LevelTypeDef LevelState)
-{
- if(LevelState == LowLevel)
- {
- UART0->CR |= UART_DTR_LowLevel_Mask;
- }
- else
- {
- UART0->CR &= UART_DTR_HighLevel_Mask;
- }
-}
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_template91x/str91x_lib/src/91x_vic.c b/uc_str912/prj_template91x/str91x_lib/src/91x_vic.c
deleted file mode 100644
index fecb890..0000000
--- a/uc_str912/prj_template91x/str91x_lib/src/91x_vic.c
+++ /dev/null
@@ -1,830 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_vic.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the VIC software functions.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-
-/* Standard include ----------------------------------------------------------*/
-#include "91x_vic.h"
-
-/* Include of other module interface headers ---------------------------------*/
-/* Local includes ------------------------------------------------------------*/
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-
-#define VIC_REGISTER_NUMBER 16
-#define VIC_PROTECTION_ENABLE_MASK 0x1
-#define VIC_PROTECTION_DISABLE_MASK 0xFFFFFFFE
-#define VIC_VECTOR_ENABLE_MASK 0x20
-#define VIC_IT_SOURCE_MASK 0xFFFFFFE0
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-
-static void VIC_ITModeConfig(u16 VIC_Source, VIC_ITLineMode VIC_LineMode);
-static void VIC_ISRVectAddConfig(u16 VIC_Source, u16 VIC_Priority, \
- void (*VIC_VectAddress)(void));
-static void VIC_VectEnableConfig(u16 VIC_Source, u16 VIC_Priority);
-static void VIC_ITSourceConfig(u16 VIC_Source, u16 VIC_Priority);
-
-/* Interface functions -------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-
-/*******************************************************************************
-* Function Name : VIC_DeInit
-* Description : Deinitialize the VIC module registers to their default reset
-* values.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void VIC_DeInit(void)
-{
- SCU_AHBPeriphReset(__VIC, ENABLE); /* VIC peripheral is under Reset */
- SCU_AHBPeriphReset(__VIC, DISABLE); /* VIC peripheral Reset off */
-}
-
-/*******************************************************************************
-* Function Name : VIC_GetIRQStatus
-* Description : Get the status of interrupts after IRQ masking.
-* Input : VIC_Source: specifies the number of the source line.
-* This parameter can be one of the following values:
-* - WDG_ITLine : VIC source 0
-* - SW_ITLine : VIC source 1
-* - ARMRX_ITLine : VIC source 2
-* - ARMTX_ITLine : VIC source 3
-* - TIM0_ITLine : VIC source 4
-* - TIM1_ITLine : VIC source 5
-* - TIM2_ITLine : VIC source 6
-* - TIM3_ITLine : VIC source 7
-* - USBHP_ITLine : VIC source 8
-* - USBLP_ITLine : VIC source 9
-* - SCU_ITLine : VIC source 10
-* - ENET_ITLine : VIC source 11
-* - DMA_ITLine : VIC source 12
-* - CAN_ITLine : VIC source 13
-* - MC_ITLine : VIC source 14
-* - ADC_ITLine : VIC source 15
-* - UART0_ITLine : VIC source 16
-* - UART1_ITLine : VIC source 17
-* - UART2_ITLine : VIC source 18
-* - I2C0_ITLine : VIC source 19
-* - I2C1_ITLine : VIC source 20
-* - SSP0_ITLine : VIC source 21
-* - SSP1_ITLine : VIC source 22
-* - LVD_ITLine : VIC source 23
-* - RTC_ITLine : VIC source 24
-* - WIU_ITLine : VIC source 25
-* - EXTIT0_ITLine: VIC source 26
-* - EXTIT1_ITLine: VIC source 27
-* - EXTIT2_ITLine: VIC source 28
-* - EXTIT3_ITLine: VIC source 29
-* - USBWU_ITLine : VIC source 30
-* - PFQBC_ITLine : VIC source 31
-* Output : None
-* Return : The status of the IRQ interrupt after masking (SET or RESET).
-*******************************************************************************/
-FlagStatus VIC_GetIRQStatus(u16 VIC_Source)
-{
- u32 VIC_Mask = 1;
- if (VIC_Source < VIC_REGISTER_NUMBER)
- {
- if ((VIC0->ISR | VIC_Mask << VIC_Source) != RESET)
- return SET;
- else
- return RESET;
- }
- else
- {
- if ((VIC1->ISR | VIC_Mask << (VIC_Source - VIC_REGISTER_NUMBER)) != RESET)
- return SET;
- else
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : VIC_GetFIQStatus
-* Description : Get the status of interrupts after FIQ masking
-* Input : VIC_Source: specifies the number of the source line.
-* This parameter can be one of the following values:
-* - WDG_ITLine : VIC source 0
-* - SW_ITLine : VIC source 1
-* - ARMRX_ITLine : VIC source 2
-* - ARMTX_ITLine : VIC source 3
-* - TIM0_ITLine : VIC source 4
-* - TIM1_ITLine : VIC source 5
-* - TIM2_ITLine : VIC source 6
-* - TIM3_ITLine : VIC source 7
-* - USBHP_ITLine : VIC source 8
-* - USBLP_ITLine : VIC source 9
-* - SCU_ITLine : VIC source 10
-* - ENET_ITLine : VIC source 11
-* - DMA_ITLine : VIC source 12
-* - CAN_ITLine : VIC source 13
-* - MC_ITLine : VIC source 14
-* - ADC_ITLine : VIC source 15
-* - UART0_ITLine : VIC source 16
-* - UART1_ITLine : VIC source 17
-* - UART2_ITLine : VIC source 18
-* - I2C0_ITLine : VIC source 19
-* - I2C1_ITLine : VIC source 20
-* - SSP0_ITLine : VIC source 21
-* - SSP1_ITLine : VIC source 22
-* - LVD_ITLine : VIC source 23
-* - RTC_ITLine : VIC source 24
-* - WIU_ITLine : VIC source 25
-* - EXTIT0_ITLine: VIC source 26
-* - EXTIT1_ITLine: VIC source 27
-* - EXTIT2_ITLine: VIC source 28
-* - EXTIT3_ITLine: VIC source 29
-* - USBWU_ITLine : VIC source 30
-* - PFQBC_ITLine : VIC source 31
-* Output : None
-* Return : The status of the FIQ interrupt after masking (SET or RESET)
-*******************************************************************************/
-FlagStatus VIC_GetFIQStatus(u16 VIC_Source)
-{
- u32 VIC_Mask = 1;
- if (VIC_Source < VIC_REGISTER_NUMBER)
- {
- if ((VIC0->RINTSR | VIC_Mask << VIC_Source) != RESET)
- return SET;
- else
- return RESET;
- }
- else
- {
- if ((VIC1->RINTSR | VIC_Mask << (VIC_Source - VIC_REGISTER_NUMBER)) != RESET)
- return SET;
- else
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : VIC_GetSourceITStatus
-* Description : Get the status of the source interrupts before masking.
-* Input : VIC_Source: specifies the number of the source line.
-* This parameter can be one of the following values:
-* - WDG_ITLine : VIC source 0
-* - SW_ITLine : VIC source 1
-* - ARMRX_ITLine : VIC source 2
-* - ARMTX_ITLine : VIC source 3
-* - TIM0_ITLine : VIC source 4
-* - TIM1_ITLine : VIC source 5
-* - TIM2_ITLine : VIC source 6
-* - TIM3_ITLine : VIC source 7
-* - USBHP_ITLine : VIC source 8
-* - USBLP_ITLine : VIC source 9
-* - SCU_ITLine : VIC source 10
-* - ENET_ITLine : VIC source 11
-* - DMA_ITLine : VIC source 12
-* - CAN_ITLine : VIC source 13
-* - MC_ITLine : VIC source 14
-* - ADC_ITLine : VIC source 15
-* - UART0_ITLine : VIC source 16
-* - UART1_ITLine : VIC source 17
-* - UART2_ITLine : VIC source 18
-* - I2C0_ITLine : VIC source 19
-* - I2C1_ITLine : VIC source 20
-* - SSP0_ITLine : VIC source 21
-* - SSP1_ITLine : VIC source 22
-* - LVD_ITLine : VIC source 23
-* - RTC_ITLine : VIC source 24
-* - WIU_ITLine : VIC source 25
-* - EXTIT0_ITLine: VIC source 26
-* - EXTIT1_ITLine: VIC source 27
-* - EXTIT2_ITLine: VIC source 28
-* - EXTIT3_ITLine: VIC source 29
-* - USBWU_ITLine : VIC source 30
-* - PFQBC_ITLine : VIC source 31
-* Output : None
-* Return : The status of the source interrupt before masking
-*******************************************************************************/
-FlagStatus VIC_GetSourceITStatus(u16 VIC_Source)
-{
- u32 VIC_Mask = 1;
- if (VIC_Source < VIC_REGISTER_NUMBER)
- {
- if ((VIC0->FSR | VIC_Mask << VIC_Source) != RESET)
- return SET;
- else
- return RESET;
- }
- else
- {
- if ((VIC1->FSR | VIC_Mask << (VIC_Source - VIC_REGISTER_NUMBER)) != RESET)
- return SET;
- else
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : VIC_ITModeConfig
-* Description : Select the type of interrupt (IRQ or FIQ)
-* Input1 : VIC_Source: specifies the number of the source line.
-* This parameter can be one of the following values:
-* - WDG_ITLine : VIC source 0
-* - SW_ITLine : VIC source 1
-* - ARMRX_ITLine : VIC source 2
-* - ARMTX_ITLine : VIC source 3
-* - TIM0_ITLine : VIC source 4
-* - TIM1_ITLine : VIC source 5
-* - TIM2_ITLine : VIC source 6
-* - TIM3_ITLine : VIC source 7
-* - USBHP_ITLine : VIC source 8
-* - USBLP_ITLine : VIC source 9
-* - SCU_ITLine : VIC source 10
-* - ENET_ITLine : VIC source 11
-* - DMA_ITLine : VIC source 12
-* - CAN_ITLine : VIC source 13
-* - MC_ITLine : VIC source 14
-* - ADC_ITLine : VIC source 15
-* - UART0_ITLine : VIC source 16
-* - UART1_ITLine : VIC source 17
-* - UART2_ITLine : VIC source 18
-* - I2C0_ITLine : VIC source 19
-* - I2C1_ITLine : VIC source 20
-* - SSP0_ITLine : VIC source 21
-* - SSP1_ITLine : VIC source 22
-* - LVD_ITLine : VIC source 23
-* - RTC_ITLine : VIC source 24
-* - WIU_ITLine : VIC source 25
-* - EXTIT0_ITLine: VIC source 26
-* - EXTIT1_ITLine: VIC source 27
-* - EXTIT2_ITLine: VIC source 28
-* - EXTIT3_ITLine: VIC source 29
-* - USBWU_ITLine : VIC source 30
-* - PFQBC_ITLine : VIC source 31
-* Input2 : VIC_LineMode :specifies the type of interrupt of the source
-* line. This parameter can be one of the following values:
-* - VIC_IRQ: the correspondent line is configured as IRQ.
-* - VIC_FIQ: the correspondent line is configured as FIQ.
-* Output : None
-* Return : None
-*******************************************************************************/
-static void VIC_ITModeConfig(u16 VIC_Source, VIC_ITLineMode VIC_LineMode)
-{
- u32 VIC_Mask = 1;
-
- if (VIC_Source < VIC_REGISTER_NUMBER) /* VIC0 */
- {
- if (VIC_LineMode == VIC_IRQ)
- VIC0->INTSR &= ~(VIC_Mask << VIC_Source);
- else /* VIC_LineMode == VIC_FIQ */
- VIC0->INTSR |= (VIC_Mask << VIC_Source);
- }
- else /* VIC1 */
- {
- if (VIC_LineMode == VIC_IRQ)
- VIC1->INTSR &= ~(VIC_Mask << (VIC_Source - VIC_REGISTER_NUMBER));
- else /* VIC_LineMode == VIC_FIQ */
- VIC1->INTSR |= (VIC_Mask << (VIC_Source - VIC_REGISTER_NUMBER));
- }
-}
-
-/*******************************************************************************
-* Function Name : VIC_ITCmd
-* Description : Enable or disable the interrupt request lines.
-* Input1 : VIC_Source: specifies the number of the source line.
-* This parameter can be one of the following values:
-* - WDG_ITLine : VIC source 0
-* - SW_ITLine : VIC source 1
-* - ARMRX_ITLine : VIC source 2
-* - ARMTX_ITLine : VIC source 3
-* - TIM0_ITLine : VIC source 4
-* - TIM1_ITLine : VIC source 5
-* - TIM2_ITLine : VIC source 6
-* - TIM3_ITLine : VIC source 7
-* - USBHP_ITLine : VIC source 8
-* - USBLP_ITLine : VIC source 9
-* - SCU_ITLine : VIC source 10
-* - ENET_ITLine : VIC source 11
-* - DMA_ITLine : VIC source 12
-* - CAN_ITLine : VIC source 13
-* - MC_ITLine : VIC source 14
-* - ADC_ITLine : VIC source 15
-* - UART0_ITLine : VIC source 16
-* - UART1_ITLine : VIC source 17
-* - UART2_ITLine : VIC source 18
-* - I2C0_ITLine : VIC source 19
-* - I2C1_ITLine : VIC source 20
-* - SSP0_ITLine : VIC source 21
-* - SSP1_ITLine : VIC source 22
-* - LVD_ITLine : VIC source 23
-* - RTC_ITLine : VIC source 24
-* - WIU_ITLine : VIC source 25
-* - EXTIT0_ITLine: VIC source 26
-* - EXTIT1_ITLine: VIC source 27
-* - EXTIT2_ITLine: VIC source 28
-* - EXTIT3_ITLine: VIC source 29
-* - USBWU_ITLine : VIC source 30
-* - PFQBC_ITLine : VIC source 31
-* Input2 : FMI_NewState: specifies the line status.
-* This parameter can be one of the following values:
-* - ENABLE: The line is enabled.
-* - DISABLE: The line is disabled.
-* Output : None
-* Return : None
-*******************************************************************************/
-void VIC_ITCmd(u16 VIC_Source, FunctionalState VIC_NewState)
-{
- u32 VIC_Mask = 1;
-
- if (VIC_NewState == ENABLE)
- {
- if (VIC_Source < VIC_REGISTER_NUMBER) /* VIC0 */
- VIC0->INTER |= (VIC_Mask << VIC_Source);
- else /* VIC1 */
- VIC1->INTER |= (VIC_Mask << (VIC_Source - VIC_REGISTER_NUMBER));
- }
- else /* VIC_NewState == DISABLE */
- {
- if (VIC_Source < VIC_REGISTER_NUMBER) /* VIC0 */
- VIC0->INTECR |= (VIC_Mask << VIC_Source);
- else /* VIC1 */
- VIC1->INTECR |= (VIC_Mask << (VIC_Source - VIC_REGISTER_NUMBER));
- }
-}
-
-/*******************************************************************************
-* Function Name : VIC_SWITCmd
-* Description : Generate a software interrupt for the specific source
-* interrupt.
-* Input1 : VIC_Source: specifies the number of the source line.
-* This parameter can be one of the following values:
-* - WDG_ITLine : VIC source 0
-* - SW_ITLine : VIC source 1
-* - ARMRX_ITLine : VIC source 2
-* - ARMTX_ITLine : VIC source 3
-* - TIM0_ITLine : VIC source 4
-* - TIM1_ITLine : VIC source 5
-* - TIM2_ITLine : VIC source 6
-* - TIM3_ITLine : VIC source 7
-* - USBHP_ITLine : VIC source 8
-* - USBLP_ITLine : VIC source 9
-* - SCU_ITLine : VIC source 10
-* - ENET_ITLine : VIC source 11
-* - DMA_ITLine : VIC source 12
-* - CAN_ITLine : VIC source 13
-* - MC_ITLine : VIC source 14
-* - ADC_ITLine : VIC source 15
-* - UART0_ITLine : VIC source 16
-* - UART1_ITLine : VIC source 17
-* - UART2_ITLine : VIC source 18
-* - I2C0_ITLine : VIC source 19
-* - I2C1_ITLine : VIC source 20
-* - SSP0_ITLine : VIC source 21
-* - SSP1_ITLine : VIC source 22
-* - LVD_ITLine : VIC source 23
-* - RTC_ITLine : VIC source 24
-* - WIU_ITLine : VIC source 25
-* - EXTIT0_ITLine: VIC source 26
-* - EXTIT1_ITLine: VIC source 27
-* - EXTIT2_ITLine: VIC source 28
-* - EXTIT3_ITLine: VIC source 29
-* - USBWU_ITLine : VIC source 30
-* - PFQBC_ITLine : VIC source 31
-* Input2 : FMI_NewState: specifies the software interrupt status.
-* This parameter can be one of the following values:
-* - ENABLE: The software interrupt is enabled.
-* - DISABLE: The software interrupt is disabled.
-* Output : None
-* Return : None
-*******************************************************************************/
-void VIC_SWITCmd(u16 VIC_Source, FunctionalState VIC_NewState)
-{
- u32 VIC_Mask = 1;
-
- if (VIC_NewState == ENABLE)
- {
- if (VIC_Source < VIC_REGISTER_NUMBER) /* VIC0 */
- VIC0->SWINTR |= (VIC_Mask << VIC_Source);
- else /* VIC1 */
- VIC1->SWINTR |= (VIC_Mask << (VIC_Source - VIC_REGISTER_NUMBER));
- }
- else /* VIC_NewState == DISABLE */
- {
- if (VIC_Source < VIC_REGISTER_NUMBER) /* VIC0 */
- VIC0->SWINTCR = (VIC_Mask << VIC_Source);
- else /* VIC1 */
- VIC1->SWINTCR = (VIC_Mask << (VIC_Source - VIC_REGISTER_NUMBER));
- }
-}
-
-/*******************************************************************************
-* Function Name : VIC_ProtectionCmd
-* Description : Enable or Disable the register access protection.
-* Input : FMI_NewState: specifies the protection status.
-* This parameter can be one of the following values:
-* - ENABLE: The protection is enabled.
-* - DISABLE: The protection is disabled.
-* Output : None
-* Return : None
-*******************************************************************************/
-void VIC_ProtectionCmd(FunctionalState VIC_NewState)
-{
- if (VIC_NewState == ENABLE)
- {
- VIC0->PER |= VIC_PROTECTION_ENABLE_MASK;
- VIC1->PER |= VIC_PROTECTION_ENABLE_MASK;
- }
- else
- {
- VIC0->PER &= VIC_PROTECTION_DISABLE_MASK;
- VIC1->PER &= VIC_PROTECTION_DISABLE_MASK;
- }
-}
-
-/*******************************************************************************
-* Function Name : VIC_GetCurrentISRAdd
-* Description : Get the address of the current active ISR.
-* Input : VICx: specifies the VIC peripheral
-* This parameter can be one of the following values:
-* - VIC0: To select VIC0.
-* - VIC1: To select VIC1.
-* Output : None
-* Return : The Address of the active ISR.
-*******************************************************************************/
-u32 VIC_GetCurrentISRAdd(VIC_TypeDef* VICx)
-{
- return VICx->VAR;
-}
-
-/*******************************************************************************
-* Function Name : VIC_ISRVectAddConfig
-* Description : Configuration of the ISR vector address.
-* Input1 : VIC_Source: specifies the number of the source line.
-* This parameter can be one of the following values:
-* - WDG_ITLine : VIC source 0
-* - SW_ITLine : VIC source 1
-* - ARMRX_ITLine : VIC source 2
-* - ARMTX_ITLine : VIC source 3
-* - TIM0_ITLine : VIC source 4
-* - TIM1_ITLine : VIC source 5
-* - TIM2_ITLine : VIC source 6
-* - TIM3_ITLine : VIC source 7
-* - USBHP_ITLine : VIC source 8
-* - USBLP_ITLine : VIC source 9
-* - SCU_ITLine : VIC source 10
-* - ENET_ITLine : VIC source 11
-* - DMA_ITLine : VIC source 12
-* - CAN_ITLine : VIC source 13
-* - MC_ITLine : VIC source 14
-* - ADC_ITLine : VIC source 15
-* - UART0_ITLine : VIC source 16
-* - UART1_ITLine : VIC source 17
-* - UART2_ITLine : VIC source 18
-* - I2C0_ITLine : VIC source 19
-* - I2C1_ITLine : VIC source 20
-* - SSP0_ITLine : VIC source 21
-* - SSP1_ITLine : VIC source 22
-* - LVD_ITLine : VIC source 23
-* - RTC_ITLine : VIC source 24
-* - WIU_ITLine : VIC source 25
-* - EXTIT0_ITLine: VIC source 26
-* - EXTIT1_ITLine: VIC source 27
-* - EXTIT2_ITLine: VIC source 28
-* - EXTIT3_ITLine: VIC source 29
-* - USBWU_ITLine : VIC source 30
-* - PFQBC_ITLine : VIC source 31
-* Input2 : VIC_Priority: specifies the priority of the interrupt.
-* It can be a value from 0 to 15. 0 is the highest priority.
-* Input3 : void (*VIC_VectAddress)(void): specifies the ISR vector
-* address pointer.
-* Output : None
-* Return : None
-*******************************************************************************/
-static void VIC_ISRVectAddConfig(u16 VIC_Source, u16 VIC_Priority, \
- void (*VIC_VectAddress)(void))
-{
- if (VIC_Source < VIC_REGISTER_NUMBER) /* VIC0 */
- VIC0->VAiR[VIC_Priority] = (u32)VIC_VectAddress;
- else /* VIC1 */
- VIC1->VAiR[VIC_Priority] = (u32)VIC_VectAddress;
-}
-
-/*******************************************************************************
-* Function Name : VIC_GetISRVectAdd
-* Description : Get the ISR vector address of the correspondent line.
-* Input : VIC_Source: specifies the number of the source line.
-* This parameter can be one of the following values:
-* - WDG_ITLine : VIC source 0
-* - SW_ITLine : VIC source 1
-* - ARMRX_ITLine : VIC source 2
-* - ARMTX_ITLine : VIC source 3
-* - TIM0_ITLine : VIC source 4
-* - TIM1_ITLine : VIC source 5
-* - TIM2_ITLine : VIC source 6
-* - TIM3_ITLine : VIC source 7
-* - USBHP_ITLine : VIC source 8
-* - USBLP_ITLine : VIC source 9
-* - SCU_ITLine : VIC source 10
-* - ENET_ITLine : VIC source 11
-* - DMA_ITLine : VIC source 12
-* - CAN_ITLine : VIC source 13
-* - MC_ITLine : VIC source 14
-* - ADC_ITLine : VIC source 15
-* - UART0_ITLine : VIC source 16
-* - UART1_ITLine : VIC source 17
-* - UART2_ITLine : VIC source 18
-* - I2C0_ITLine : VIC source 19
-* - I2C1_ITLine : VIC source 20
-* - SSP0_ITLine : VIC source 21
-* - SSP1_ITLine : VIC source 22
-* - LVD_ITLine : VIC source 23
-* - RTC_ITLine : VIC source 24
-* - WIU_ITLine : VIC source 25
-* - EXTIT0_ITLine: VIC source 26
-* - EXTIT1_ITLine: VIC source 27
-* - EXTIT2_ITLine: VIC source 28
-* - EXTIT3_ITLine: VIC source 29
-* - USBWU_ITLine : VIC source 30
-* - PFQBC_ITLine : VIC source 31
-* Output : None
-* Return : The correspondent ISR vector address.
-*******************************************************************************/
-u32 VIC_GetISRVectAdd(u16 VIC_Source)
-{
- if (VIC_Source < VIC_REGISTER_NUMBER) /* VIC0 */
- return VIC0->VAiR[VIC_Source];
- else /* VIC1 */
- return VIC1->VAiR[VIC_Source - VIC_REGISTER_NUMBER];
-}
-
-/*******************************************************************************
-* Function Name : VIC_VectEnableConfig
-* Description : Enable the vector interrupt.
-* Input1 : VIC_Source: specifies the number of the source line.
-* This parameter can be one of the following values:
-* - WDG_ITLine : VIC source 0
-* - SW_ITLine : VIC source 1
-* - ARMRX_ITLine : VIC source 2
-* - ARMTX_ITLine : VIC source 3
-* - TIM0_ITLine : VIC source 4
-* - TIM1_ITLine : VIC source 5
-* - TIM2_ITLine : VIC source 6
-* - TIM3_ITLine : VIC source 7
-* - USBHP_ITLine : VIC source 8
-* - USBLP_ITLine : VIC source 9
-* - SCU_ITLine : VIC source 10
-* - ENET_ITLine : VIC source 11
-* - DMA_ITLine : VIC source 12
-* - CAN_ITLine : VIC source 13
-* - MC_ITLine : VIC source 14
-* - ADC_ITLine : VIC source 15
-* - UART0_ITLine : VIC source 16
-* - UART1_ITLine : VIC source 17
-* - UART2_ITLine : VIC source 18
-* - I2C0_ITLine : VIC source 19
-* - I2C1_ITLine : VIC source 20
-* - SSP0_ITLine : VIC source 21
-* - SSP1_ITLine : VIC source 22
-* - LVD_ITLine : VIC source 23
-* - RTC_ITLine : VIC source 24
-* - WIU_ITLine : VIC source 25
-* - EXTIT0_ITLine: VIC source 26
-* - EXTIT1_ITLine: VIC source 27
-* - EXTIT2_ITLine: VIC source 28
-* - EXTIT3_ITLine: VIC source 29
-* - USBWU_ITLine : VIC source 30
-* - PFQBC_ITLine : VIC source 31
-* Input2 : VIC_Priority: specifies the priority of the interrupt.
-* It can be a value from 0 to 15. 0 is the highest priority.
-* Output : None
-* Return : None
-*******************************************************************************/
-static void VIC_VectEnableConfig(u16 VIC_Source, u16 VIC_Priority)
-{
- if (VIC_Source < VIC_REGISTER_NUMBER) /* VIC0 */
- VIC0->VCiR[VIC_Priority] |= VIC_VECTOR_ENABLE_MASK;
- else /* VIC1 */
- VIC1->VCiR[VIC_Priority] |= VIC_VECTOR_ENABLE_MASK;
-}
-
-/*******************************************************************************
-* Function Name : VIC_ITSourceConfig
-* Description : Select the interrupt source.
-* Input1 : VIC_Source: specifies the number of the source line.
-* This parameter can be one of the following values:
-* - WDG_ITLine : VIC source 0
-* - SW_ITLine : VIC source 1
-* - ARMRX_ITLine : VIC source 2
-* - ARMTX_ITLine : VIC source 3
-* - TIM0_ITLine : VIC source 4
-* - TIM1_ITLine : VIC source 5
-* - TIM2_ITLine : VIC source 6
-* - TIM3_ITLine : VIC source 7
-* - USBHP_ITLine : VIC source 8
-* - USBLP_ITLine : VIC source 9
-* - SCU_ITLine : VIC source 10
-* - ENET_ITLine : VIC source 11
-* - DMA_ITLine : VIC source 12
-* - CAN_ITLine : VIC source 13
-* - MC_ITLine : VIC source 14
-* - ADC_ITLine : VIC source 15
-* - UART0_ITLine : VIC source 16
-* - UART1_ITLine : VIC source 17
-* - UART2_ITLine : VIC source 18
-* - I2C0_ITLine : VIC source 19
-* - I2C1_ITLine : VIC source 20
-* - SSP0_ITLine : VIC source 21
-* - SSP1_ITLine : VIC source 22
-* - LVD_ITLine : VIC source 23
-* - RTC_ITLine : VIC source 24
-* - WIU_ITLine : VIC source 25
-* - EXTIT0_ITLine: VIC source 26
-* - EXTIT1_ITLine: VIC source 27
-* - EXTIT2_ITLine: VIC source 28
-* - EXTIT3_ITLine: VIC source 29
-* - USBWU_ITLine : VIC source 30
-* - PFQBC_ITLine : VIC source 31
-* Input2 : VIC_Priority: specifies the priority of the interrupt.
-* It can be a value from 0 to 15. 0 is the highest priority.
-* Output : None
-* Return : None
-*******************************************************************************/
-static void VIC_ITSourceConfig(u16 VIC_Source, u16 VIC_Priority)
-{
- if (VIC_Source < VIC_REGISTER_NUMBER) /* VIC0 */
- {
- VIC0->VCiR[VIC_Priority] &= VIC_IT_SOURCE_MASK;
- VIC0->VCiR[VIC_Priority] |= VIC_Source;
- }
- else /* VIC1 */
- {
- VIC1->VCiR[VIC_Priority] &= VIC_IT_SOURCE_MASK;
- VIC1->VCiR[VIC_Priority] |= VIC_Source - VIC_REGISTER_NUMBER;
- }
-}
-
-/*******************************************************************************
-* Function Name : VIC_Config
-* Description : Configure the ISR, the line, the mode and the priority for
-* each interrupt source line.
-* Input1 : VIC_Source: specifies the number of the source line.
-* This parameter can be one of the following values:
-* - WDG_ITLine : VIC source 0
-* - SW_ITLine : VIC source 1
-* - ARMRX_ITLine : VIC source 2
-* - ARMTX_ITLine : VIC source 3
-* - TIM0_ITLine : VIC source 4
-* - TIM1_ITLine : VIC source 5
-* - TIM2_ITLine : VIC source 6
-* - TIM3_ITLine : VIC source 7
-* - USBHP_ITLine : VIC source 8
-* - USBLP_ITLine : VIC source 9
-* - SCU_ITLine : VIC source 10
-* - ENET_ITLine : VIC source 11
-* - DMA_ITLine : VIC source 12
-* - CAN_ITLine : VIC source 13
-* - MC_ITLine : VIC source 14
-* - ADC_ITLine : VIC source 15
-* - UART0_ITLine : VIC source 16
-* - UART1_ITLine : VIC source 17
-* - UART2_ITLine : VIC source 18
-* - I2C0_ITLine : VIC source 19
-* - I2C1_ITLine : VIC source 20
-* - SSP0_ITLine : VIC source 21
-* - SSP1_ITLine : VIC source 22
-* - LVD_ITLine : VIC source 23
-* - RTC_ITLine : VIC source 24
-* - WIU_ITLine : VIC source 25
-* - EXTIT0_ITLine: VIC source 26
-* - EXTIT1_ITLine: VIC source 27
-* - EXTIT2_ITLine: VIC source 28
-* - EXTIT3_ITLine: VIC source 29
-* - USBWU_ITLine : VIC source 30
-* - PFQBC_ITLine : VIC source 31
-* Input2 : VIC_LineMode :specifies the type of interrupt of the source
-* line. This parameter can be one of the following values:
-* - VIC_IRQ: the correspondent line is configured as IRQ.
-* - VIC_FIQ: the correspondent line is configured as FIQ.
-* Input3 : VIC_Priority: specifies the priority of the interrupt.
-* It can be a value from 0 to 15. 0 is the highest priority.
-* Output : None
-* Return : None
-*******************************************************************************/
-void VIC_Config(u16 VIC_Source, VIC_ITLineMode VIC_LineMode, u8 VIC_Priority)
-{
- switch (VIC_Source)
- {
- case 0: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, WDG_IRQHandler);
- break;
-
- case 1: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, SW_IRQHandler);
- break;
-
- case 2: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, ARMRX_IRQHandler);
- break;
-
- case 3: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, ARMTX_IRQHandler);
- break;
-
- case 4: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, TIM0_IRQHandler);
- break;
-
- case 5: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, TIM1_IRQHandler);
- break;
-
- case 6: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, TIM2_IRQHandler);
- break;
-
- case 7: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, TIM3_IRQHandler);
- break;
-
- case 8: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, USBHP_IRQHandler);
- break;
-
- case 9: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, USBLP_IRQHandler);
- break;
-
- case 10: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, SCU_IRQHandler);
- break;
-
- case 11: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, ENET_IRQHandler);
- break;
-
- case 12: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, DMA_IRQHandler);
- break;
-
- case 13: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, CAN_IRQHandler);
- break;
-
- case 14: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, MC_IRQHandler);
- break;
-
- case 15: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, ADC_IRQHandler);
- break;
-
- case 16: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, UART0_IRQHandler);
- break;
-
- case 17: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, UART1_IRQHandler);
- break;
-
- case 18: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, UART2_IRQHandler);
- break;
-
- case 19: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, I2C0_IRQHandler);
- break;
-
- case 20: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, I2C1_IRQHandler);
- break;
-
- case 21: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, SSP0_IRQHandler);
- break;
-
- case 22: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, SSP1_IRQHandler);
- break;
-
- case 23: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, LVD_IRQHandler);
- break;
-
- case 24: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, RTC_IRQHandler);
- break;
-
- case 25: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, WIU_IRQHandler);
- break;
-
- case 26: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, EXTIT0_IRQHandler);
- break;
-
- case 27: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, EXTIT1_IRQHandler);
- break;
-
- case 28: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, EXTIT2_IRQHandler);
- break;
-
- case 29: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, EXTIT3_IRQHandler);
- break;
-
- case 30: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, USBWU_IRQHandler);
- break;
-
- case 31: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, PFQBC_IRQHandler);
- break;
-
- default: break;
- }
- VIC_ITModeConfig(VIC_Source, VIC_LineMode);
- VIC_VectEnableConfig(VIC_Source, VIC_Priority);
- VIC_ITSourceConfig(VIC_Source, VIC_Priority);
-}
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_template91x/str91x_lib/src/91x_wdg.c b/uc_str912/prj_template91x/str91x_lib/src/91x_wdg.c
deleted file mode 100644
index f933635..0000000
--- a/uc_str912/prj_template91x/str91x_lib/src/91x_wdg.c
+++ /dev/null
@@ -1,277 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_wdg.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the WDG software functions.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_wdg.h"
-#include "91x_scu.h"
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-
-
-/* WDG End of Count interrupt Flag */
-#define WDG_FLAG_EC 0x0001
-
-
-/* WDG End of Count interrupt request */
-#define WDG_IT_EC 0x0001
-
-
-
-/* WDG Start/Stop counter */
-#define WDG_Counter_Start 0x0002
-#define WDG_Counter_Stop 0xFFFD
-
-
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Registers reset value */
-/* Private function prototypes -----------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-
-/******************************************************************************
-* Function Name : WDG_DeInit
-* Description : Deinitializes the WDG peripheral registers to their default
-* reset values.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void WDG_DeInit(void)
-{
-
- SCU_APBPeriphReset(__WDG, ENABLE); /*WDG peripheral under Reset */
- SCU_APBPeriphReset(__WDG, DISABLE); /*WDG peripheral Reset off*/
-
-}
-
-/*******************************************************************************
-* Function Name : WDG_StructInit
-* Description : Fills the WDG_InitTypeDef structure member with its reset
-* value.
-* Input : WDG_InitStruct : pointer to a WDG_InitTypeDef structure
-* which will be initialized.
-* Output : None
-* Return : None
-*******************************************************************************/
-void WDG_StructInit(WDG_InitTypeDef *WDG_InitStruct)
-{
- /* Select the Watchdog running mode*/
- WDG_InitStruct->WDG_Mode = WDG_Mode_Timer;
-
- /* Select the source clock */
- WDG_InitStruct-> WDG_ClockSource = WDG_ClockSource_Apb;
-
- /* Initialize Prescaler */
- WDG_InitStruct->WDG_Prescaler =0xFF;
-
- /* Initialize Preload */
- WDG_InitStruct->WDG_Preload =0xFFFF;
-
-
-}
-
-/*******************************************************************************
-* Function Name : WDG_Init
-* Description : Initializes WDG peripheral according to the specified
-* parameters in the WDG_InitStruct.
-* Input : WDG_InitStruct: pointer to a WDG_InitTypeDef structure that
-* contains the configuration information for the WDG peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void WDG_Init(WDG_InitTypeDef* WDG_InitStruct)
-{
-
-
- if(WDG_InitStruct->WDG_ClockSource == WDG_ClockSource_Apb)
- {
- /* Select The APB clock as clock source */
- WDG->CR &= WDG_ClockSource_Apb;
- }
-
- else
- {
- /* Select the RTC clock as source */
- WDG->CR |= WDG_ClockSource_Rtc ;
- }
-
-
- /* Configure WDG Prescaler register value */
- WDG->PR = WDG_InitStruct->WDG_Prescaler;
-
- /* Configure WDG Pre-load register value */
- WDG->VR = WDG_InitStruct->WDG_Preload ;
-
-
- if(WDG_InitStruct->WDG_Mode == WDG_Mode_Timer)
- {
- /* Select Timer mode */
- WDG->CR &= WDG_Mode_Timer;
- }
- else
- {
- /* Select WDG mode */
- WDG->CR |= WDG_Mode_Wdg ;
- }
-
-
-}
-
-/*******************************************************************************
-* Function Name : WDG_Cmd
-* Description : Enables or disables the WDG peripheral.
-* Input : NewState: new state of the WDG peripheral (Newstate can be
-* ENABLE or DISABLE)
-* Output : None
-* Return : None
-*******************************************************************************/
-void WDG_Cmd(FunctionalState NewState )
-{
- if((WDG->CR & WDG_Mode_Wdg) == 0)
- {
- /* Timer mode */
- if(NewState == ENABLE)
- {
- /* Start timer by setting SC bit in Control register */
- WDG->CR |= WDG_Counter_Start;
- }
- else
- {
- /* Stop timer by clearning SC bit in Control register */
- WDG->CR &= WDG_Counter_Stop;
- }
- }
- else
- {
- /* Watchdog mode */
- if(NewState == ENABLE)
- {
- WDG->KR = WDG_KeyValue1;
- WDG->KR = WDG_KeyValue2;
- }
- }
-}
-
-/*******************************************************************************
-* Function Name : WDG_ITConfig
-* Description : Enables or disables the WDG End of Count(EC) interrupt.
-* Input : Newstate: new state of the End of Count(EC) WDG interrupt.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void WDG_ITConfig(FunctionalState NewState)
-{
- if(NewState == ENABLE)
- {
- /* Enable the End of Count interrupt */
- WDG->MR |= WDG_IT_EC;
- }
- else
- {
- /* Disable the End of Count interrupt */
- WDG->MR &= ~WDG_IT_EC;
- }
-}
-
-/*******************************************************************************
-* Function Name : WDG_GetCounter
-* Description : Gets the WDG’s current counter value.
-* Input : None
-* Output : None
-* Return : The WDG current counter value
-*******************************************************************************/
-u16 WDG_GetCounter(void)
-{
- return WDG->CNT;
-}
-
-
-
-
-/*******************************************************************************
-* Function Name : WDG_GetITStatus
-* Description : Checks whether the WDG End of Count(EC) interrupt is occured or not.
-* Input : None
-* Output : None
-* Return : The new state of WDG_IT (SET or RESET).
-*******************************************************************************/
-ITStatus WDG_GetITStatus(void)
-{
- if(((WDG->SR & WDG_IT_EC) != RESET )&&((WDG->MR & WDG_IT_EC) != RESET ))
- {
- return SET;
- }
- else
- {
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : WDG_ClearITPendingBit
-* Description : Clears the WDG's End of Count(EC) interrupt pending bit.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void WDG_ClearITPendingBit(void)
-{
- /* Clear the EC pending bit */
- WDG->SR &= ~WDG_IT_EC;
-
-}
-
-/*******************************************************************************
-* Function Name : WDG_ClearFlag
-* Description : Clears the WDG's End of Count(EC) Flag.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void WDG_ClearFlag(void)
-{
- /* Clear the EC Flag */
-
- WDG->SR &= ~WDG_FLAG_EC;
-
-}
-
-
-/*******************************************************************************
-* Function Name : WDG_GetFlagStatus
-* Description : Checks whether the WDG End of Count(EC) flag is set or not.
-* Input : None
-* Output : None
-* Return : The new state of the WDG_FLAG (SET or RESET).
-*******************************************************************************/
-FlagStatus WDG_GetFlagStatus(void)
-{
- if((WDG->SR & WDG_FLAG_EC) != RESET )
- {
- return SET;
- }
- else
- {
- return RESET;
- }
-}
-
-
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_template91x/str91x_lib/src/91x_wiu.c b/uc_str912/prj_template91x/str91x_lib/src/91x_wiu.c
deleted file mode 100644
index 3154a3c..0000000
--- a/uc_str912/prj_template91x/str91x_lib/src/91x_wiu.c
+++ /dev/null
@@ -1,190 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_wiu.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the WIU software functions.
-**********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-**********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*********************************************************************************/
-
-/* Standard include ----------------------------------------------------------*/
-#include "91x_wiu.h"
-#include "91x_scu.h"
-
-/* Include of other module interface headers ---------------------------------*/
-/* Local includes ------------------------------------------------------------*/
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/* Interface functions -------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/******************************************************************************
-* Function Name : WIU_Init
-* Description : Initializes the WIU unit according to the specified parameters
-* in the WIU_InitTypeDef structure.
-* Input : WIU_InitStruct: pointer to a WIU_InitTypeDef structure that
-* contains the configuration information for the WIU peripheral.
-* Output : None
-* Return : None
-******************************************************************************/
-void WIU_Init(WIU_InitTypeDef* WIU_InitStruct)
-{
- /* select the Wake-up line to be used */
- WIU->MR |= WIU_InitStruct->WIU_Line;
-
- /* configure the triggering edge */
- if(WIU_InitStruct->WIU_TriggerEdge == WIU_RisingEdge)
- {
- /* trigger on rising edge */
- WIU->TR |= WIU_InitStruct->WIU_Line;
- }
- else
- {
- /* trigger on falling edge */
- WIU->TR &= ~WIU_InitStruct->WIU_Line;
- }
-
- if(WIU_InitStruct->WIU_Mode == WIU_Mode_SWInterrupt)
- {
- /* enable interrupt mode */
- WIU->CTRL |= WIU_Mode_Interrupt;
-
- /* set the corresponding WUINT bit*/
- WIU->INTR |= WIU_InitStruct->WIU_Line;
- }
- else
- {
- /* configure the WIU mode */
- WIU->CTRL |= WIU_InitStruct->WIU_Mode;
- }
-}
-
-/******************************************************************************
-* Function Name : WIU_DeInit
-* Description : Deinitializes the WIU registers to their default reset values.
-* Input : None
-* Output : None
-* Return : None
-******************************************************************************/
-void WIU_DeInit(void)
-{
- /* initialize the WIU registers to their reset value */
- SCU_APBPeriphReset(__WIU, ENABLE);
- SCU_APBPeriphReset(__WIU, DISABLE);
-}
-
-/******************************************************************************
-* Function Name : WIU_StructInit
-* Description : Fills in a WIU_InitTypeDef structure with the reset value of
-* each parameter.
-* Input : WIU_InitStruct : pointer to a WIU_InitTypeDef structure
-* which will be initialized.
-* Output : None
-* Return : None
-******************************************************************************/
-void WIU_StructInit(WIU_InitTypeDef* WIU_InitStruct)
-{
- /* initialize the WIU_InitStruct fields to their reset values */
- WIU_InitStruct->WIU_Mode = 0x0 ;
- WIU_InitStruct->WIU_Line = 0x0 ;
- WIU_InitStruct->WIU_TriggerEdge = WIU_FallingEdge ;
-}
-
-
-/*******************************************************************************
-* Function Name : WIU_GenerateSWInterrupt
-* Description : Generates a Software interrupt.
-* Input : - WIU_Line: specifies the WIU lines to be enabled or
-* disabled. This parameter can be:
-* - WIU_Linex: External interrupt line x where x(0..31)
-* Output : None
-* Return : None
-*******************************************************************************/
-void WIU_GenerateSWInterrupt(u32 WIU_Line)
-{
- WIU->INTR |= WIU_Line;
-}
-
-/*******************************************************************************
-* Function Name : WIU_GetFlagStatus
-* Description : Checks whether the specified WIU line flag is set or not.
-* Input : - WIU_Line: specifies the WIU lines flag to check.
-* This parameter can be:
-* - WIU_Linex: External interrupt line x where x(0..31)
-* Output : None
-* Return : The new state of WIU_Line (SET or RESET).
-*******************************************************************************/
-FlagStatus WIU_GetFlagStatus(u32 WIU_Line)
-{
- if((WIU->PR & WIU_Line) != RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : WIU_ClearFlag
-* Description : Clears the WIU’s line pending flags.
-* Input : - WIU_Line: specifies the WIU lines flags to clear.
-* This parameter can be:
-* - WIU_Linex: External interrupt line x where x(0..31)
-* Output : None
-* Return : None
-*******************************************************************************/
-void WIU_ClearFlag(u32 WIU_Line)
-{
- WIU->PR = WIU_Line;
-}
-
-/*******************************************************************************
-* Function Name : WIU_GetITStatus
-* Description : Checks whether the specified WIU line is asserted or not.
-* Input : - WIU_Line: specifies the WIU lines to check.
-* This parameter can be:
-* - WIU_Linex: External interrupt line x where x(0..31)
-* Output : None
-* Return : The new state of WIU_Line (SET or RESET).
-*******************************************************************************/
-ITStatus WIU_GetITStatus(u32 WIU_Line)
-{
- if(((WIU->PR & WIU_Line) != RESET)&& ((WIU->MR & WIU_Line) != RESET))
- {
- return SET;
- }
- else
- {
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : WIU_ClearITPendingBit
-* Description : Clears the WIU’s line pending bits.
-* Input : - WIU_Line: specifies the WIU lines to clear.
-* This parameter can be:
-* - WIU_Linex: External interrupt line x where x(0..31)
-* Output : None
-* Return : None
-*******************************************************************************/
-void WIU_ClearITPendingBit(u32 WIU_Line)
-{
- WIU->PR = WIU_Line;
-}
-
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_test_lcd/Makefile b/uc_str912/prj_test_lcd/Makefile
deleted file mode 100644
index 9bfbf4e..0000000
--- a/uc_str912/prj_test_lcd/Makefile
+++ /dev/null
@@ -1,496 +0,0 @@
-# Hey Emacs, this is a -*- makefile -*-
-#
-# WinARM template makefile
-# by Giacomo Fazio and Antonio Nasca, Catania, Italy
-# <giacomofazio@gmail.com>
-# <antodani.nasca@hotmail.it>
-#
-# based on the WinARM template makefile written by Martin Thomas
-# Released to the Public Domain
-# Please read the make user manual!
-#
-#
-# On command line:
-#
-# make all = Make software.
-#
-# make clean = Clean out built project files.
-#
-# make program = Download the hex file to the device
-#
-# (TODO: make filename.s = Just compile filename.c into the assembler code only)
-#
-# To rebuild project do "make clean" then "make all".
-# Toolchain prefix (i.e arm-elf -> arm-elf-gcc.exe)
-#TCHAIN = arm-elf
-TCHAIN = arm-none-eabi
-
-USE_THUMB_MODE = YES
-#USE_THUMB_MODE = NO
-
-# MCU name and submodel
-MCU = arm966e-s
-SUBMDL = STR91x
-
-## Create ROM-Image
-RUN_MODE=ROM_RUN
-## Create RAM-Image
-#RUN_MODE=RAM_RUN
-
-## not supported in this example:
-## Exception-Vector placement only supported for "ROM_RUN"
-## (placement settings ignored when using "RAM_RUN")
-## - Exception vectors in ROM:
-#VECTOR_LOCATION=VECTORS_IN_ROM
-## - Exception vectors in RAM:
-#VECTOR_LOCATION=VECTORS_IN_RAM
-
-
-# Target file name (without extension).
-TARGET = lcd
-
-# List C source files here. (C dependencies are automatically generated.)
-# use file-extension c for "c-only"-files
-SRC = src/$(TARGET).c str91x_lib/91x_scu.c str91x_lib/91x_gpio.c src/lcd_lib_91x.c
-
-# List C source files here which must be compiled in ARM-Mode.
-# use file-extension c for "c-only"-files
-SRCARM = src/vectors.c
-# thumb is possible too for vectors.c - keep ARM, TODO: profile
-
-# List C++ source files here.
-# use file-extension cpp for C++-files (use extension .cpp)
-CPPSRC =
-
-# List C++ source files here which must be compiled in ARM-Mode.
-# use file-extension cpp for C++-files (use extension .cpp)
-#CPPSRCARM = $(TARGET).cpp
-CPPSRCARM =
-
-# List Assembler source files here.
-# Make them always end in a capital .S. Files ending in a lowercase .s
-# will not be considered source files but generated files (assembler
-# output from the compiler), and will be deleted upon "make clean"!
-# Even though the DOS/Win* filesystem matches both .s and .S the same,
-# it will preserve the spelling of the filenames, and gcc itself does
-# care about how the name is spelled on its command-line.
-ASRC =
-
-# List Assembler source files here which must be assembled in ARM-Mode..
-ASRCARM = src/vector.S src/startup.S
-
-# Path to Linker-Scripts
-LINKERSCRIPTPATH = .
-
-## Output format. (can be ihex or binary or both)
-## (binary i.e. for openocd and SAM-BA, hex i.e. for lpc21isp and uVision)
-#FORMAT = ihex
-#FORMAT = binary
-FORMAT = both
-
-# Optimization level, can be [0, 1, 2, 3, s].
-# 0 = turn off optimization. s = optimize for size.
-# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
-#OPT = s
-OPT = 0
-
-## Using the Atmel AT91_lib produces warning with
-## the default warning-levels.
-## yes - disable these warnings; no - keep default settings
-#AT91LIBNOWARN = yes
-AT91LIBNOWARN = no
-
-# Debugging format.
-# Native formats for AVR-GCC's -g are stabs [default], or dwarf-2.
-# AVR (extended) COFF requires stabs, plus an avr-objcopy run.
-#DEBUG = stabs
-DEBUG = dwarf-2
-
-# List any extra directories to look for include files here.
-# Each directory must be seperated by a space.
-EXTRAINCDIRS = ./include ./str91x_lib/include
-
-# List any extra directories to look for library files here.
-# Each directory must be seperated by a space.
-#EXTRA_LIBDIRS = ../arm7_efsl_0_2_4
-EXTRA_LIBDIRS = ./str91x_lib
-
-
-# Compiler flag to set the C Standard level.
-# c89 - "ANSI" C
-# gnu89 - c89 plus GCC extensions
-# c99 - ISO C99 standard (not yet fully implemented)
-# gnu99 - c99 plus GCC extensions
-CSTANDARD = -std=gnu99
-
-# Place -D or -U options for C here
-CDEFS = -D$(RUN_MODE)
-
-# Place -I options here
-CINCS =
-
-# Place -D or -U options for ASM here
-ADEFS = -D$(RUN_MODE)
-
-ifdef VECTOR_LOCATION
-CDEFS += -D$(VECTOR_LOCATION)
-ADEFS += -D$(VECTOR_LOCATION)
-endif
-
-CDEFS += -D__WinARM__ -D__WINARMSUBMDL_$(SUBMDL)__
-ADEFS += -D__WinARM__ -D__WINARMSUBMDL_$(SUBMDL)__
-
-# Compiler flags.
-
-ifeq ($(USE_THUMB_MODE),YES)
-THUMB = -mthumb
-THUMB_IW = -mthumb-interwork
-else
-THUMB =
-THUMB_IW =
-endif
-
-# -g*: generate debugging information
-# -O*: optimization level
-# -f...: tuning, see GCC manual and avr-libc documentation
-# -Wall...: warning level
-# -Wa,...: tell GCC to pass this to the assembler.
-# -adhlns...: create assembler listing
-#
-# Flags for C and C++ (arm-elf-gcc/arm-elf-g++)
-CFLAGS = -g$(DEBUG)
-CFLAGS += $(CDEFS) $(CINCS)
-CFLAGS += -O$(OPT)
-CFLAGS += -Wall -Wcast-align -Wimplicit
-CFLAGS += -Wpointer-arith -Wswitch
-CFLAGS += -ffunction-sections -fdata-sections
-CFLAGS += -Wredundant-decls -Wreturn-type -Wshadow -Wunused
-CFLAGS += -Wa,-adhlns=$(subst $(suffix $<),.lst,$<)
-CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
-
-# flags only for C
-CONLYFLAGS += -Wnested-externs
-CONLYFLAGS += $(CSTANDARD)
-
-ifneq ($(AT91LIBNOWARN),yes)
-#AT91-lib warnings with:
-CFLAGS += -Wcast-qual
-CONLYFLAGS += -Wmissing-prototypes
-CONLYFLAGS += -Wstrict-prototypes
-CONLYFLAGS += -Wmissing-declarations
-endif
-
-# flags only for C++ (arm-elf-g++)
-# CPPFLAGS = -fno-rtti -fno-exceptions
-CPPFLAGS =
-
-# Assembler flags.
-# -Wa,...: tell GCC to pass this to the assembler.
-# -ahlns: create listing
-# -g$(DEBUG): have the assembler create line number information
-ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:.S=.lst),-g$(DEBUG)
-
-
-#Additional libraries.
-
-# Extra libraries
-# Each library-name must be seperated by a space.
-# To add libxyz.a, libabc.a and libefsl.a:
-# EXTRA_LIBS = xyz abc efsl
-#EXTRA_LIBS = efsl
-EXTRA_LIBS =
-#STR91x_lib
-
-#Support for newlibc-lpc (file: libnewlibc-lpc.a)
-#NEWLIBLPC = -lnewlib-lpc
-
-MATH_LIB = -lm
-
-# CPLUSPLUS_LIB = -lstdc++
-
-
-# Linker flags.
-# -Wl,...: tell GCC to pass this to linker.
-# -Map: create map file
-# --cref: add cross reference to map file
-LDFLAGS = -nostartfiles -Wl,-Map=$(TARGET).map,--cref,--gc-sections,--no-warn-mismatch
-LDFLAGS += -lc
-LDFLAGS += $(NEWLIBLPC) $(MATH_LIB)
-LDFLAGS += -lc -lgcc
-LDFLAGS += $(CPLUSPLUS_LIB)
-LDFLAGS += $(patsubst %,-L%,$(EXTRA_LIBDIRS))
-LDFLAGS += $(patsubst %,-l%,$(EXTRA_LIBS))
-
-# Set Linker-Script Depending On Selected Memory and Controller
-ifeq ($(RUN_MODE),RAM_RUN)
-LDFLAGS +=-T$(LINKERSCRIPTPATH)/$(SUBMDL)-RAM.ld
-else
-LDFLAGS +=-T$(LINKERSCRIPTPATH)/$(SUBMDL)-ROM.ld
-endif
-
-
-# Define directories, if needed.
-## DIRARM = c:/WinARM/
-## DIRARMBIN = $(DIRAVR)/bin/
-## DIRAVRUTILS = $(DIRAVR)/utils/bin/
-
-# Define programs and commands.
-SHELL = sh
-CC = $(TCHAIN)-gcc
-CPP = $(TCHAIN)-g++
-AR = $(TCHAIN)-ar
-OBJCOPY = $(TCHAIN)-objcopy
-OBJDUMP = $(TCHAIN)-objdump
-SIZE = $(TCHAIN)-size
-NM = $(TCHAIN)-nm
-REMOVE = rm -f
-REMOVEDIR = rm -f -r
-COPY = cp
-
-# Define Messages
-# English
-MSG_ERRORS_NONE = Errors: none
-MSG_BEGIN = "-------- begin (mode: $(RUN_MODE)) --------"
-MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
-MSG_SIZE_AFTER = Size after:
-MSG_FLASH = Creating load file for Flash:
-MSG_EXTENDED_LISTING = Creating Extended Listing:
-MSG_SYMBOL_TABLE = Creating Symbol Table:
-MSG_LINKING = Linking:
-MSG_COMPILING = Compiling C:
-MSG_COMPILING_ARM = "Compiling C (ARM-only):"
-MSG_COMPILINGCPP = Compiling C++:
-MSG_COMPILINGCPP_ARM = "Compiling C++ (ARM-only):"
-MSG_ASSEMBLING = Assembling:
-MSG_ASSEMBLING_ARM = "Assembling (ARM-only):"
-MSG_CLEANING = Cleaning project:
-MSG_FORMATERROR = Can not handle output-format
-MSG_LPC21_RESETREMINDER = You may have to bring the target in bootloader-mode now.
-
-# Define all object files.
-COBJ = $(SRC:.c=.o)
-AOBJ = $(ASRC:.S=.o)
-COBJARM = $(SRCARM:.c=.o)
-AOBJARM = $(ASRCARM:.S=.o)
-CPPOBJ = $(CPPSRC:.cpp=.o)
-CPPOBJARM = $(CPPSRCARM:.cpp=.o)
-
-# Define all listing files.
-LST = $(ASRC:.S=.lst) $(ASRCARM:.S=.lst) $(SRC:.c=.lst) $(SRCARM:.c=.lst)
-LST += $(CPPSRC:.cpp=.lst) $(CPPSRCARM:.cpp=.lst)
-
-# Compiler flags to generate dependency files.
-### GENDEPFLAGS = -Wp,-M,-MP,-MT,$(*F).o,-MF,.dep/$(@F).d
-GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d
-
-# Combine all necessary flags and optional flags.
-# Add target processor to flags.
-ALL_CFLAGS = -mcpu=$(MCU) $(THUMB_IW) -I. $(CFLAGS) $(GENDEPFLAGS)
-ALL_ASFLAGS = -mcpu=$(MCU) $(THUMB_IW) -I. -x assembler-with-cpp $(ASFLAGS)
-
-
-# Default target.
-all: begin gccversion sizebefore build sizeafter finished end
-
-ifeq ($(FORMAT),ihex)
-build: elf hex lss sym
-hex: $(TARGET).hex
-IMGEXT=hex
-else
-ifeq ($(FORMAT),binary)
-build: elf bin lss sym
-bin: $(TARGET).bin
-IMGEXT=bin
-else
-ifeq ($(FORMAT),both)
-build: elf hex bin lss sym
-hex: $(TARGET).hex
-bin: $(TARGET).bin
-else
-$(error "$(MSG_FORMATERROR) $(FORMAT)")
-endif
-endif
-endif
-
-elf: $(TARGET).elf
-lss: $(TARGET).lss
-sym: $(TARGET).sym
-
-# Eye candy.
-begin:
- @echo
- @echo $(MSG_BEGIN)
-
-finished:
- @echo $(MSG_ERRORS_NONE)
-
-end:
- @echo $(MSG_END)
- @echo
-
-
-# Display size of file.
-HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
-ELFSIZE = $(SIZE) -A $(TARGET).elf
-sizebefore:
- @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi
-
-sizeafter:
- @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi
-
-
-# Display compiler version information.
-gccversion :
- @$(CC) --version
-
-# FLASH Programming with OPENOCD
-
-# specify the directory where openocd executable resides (openocd-ftd2xx.exe or openocd-pp.exe)
-# Note: you may have to adjust this if a newer version of YAGARTO has been downloaded
-OPENOCD_DIR = 'c:\Programmi\openocd\bin\'
-
-# specify OpenOCD executable (pp is for the wiggler, ftd2xx is for the USB debugger)
-OPENOCD = $(OPENOCD_DIR)openocd-pp.exe
-#OPENOCD = $(OPENOCD_DIR)openocd-ftd2xx.exe
-
-# specify OpenOCD configuration file (pick the one for your device)
-#OPENOCD_CFG = C:\openocd-configs\str91x-configs\str91x_signalyzer-flash-program.cfg
-#OPENOCD_CFG = C:\openocd-configs\str91x-configs\str91x_jtagkey-flash-program.cfg
-#OPENOCD_CFG = C:\openocd-configs\str91x-configs\str91x_armusbocd-flash-program.cfg
-OPENOCD_CFG = C:\openocd-configs\str91x-configs\str91x_pp-flash-program.cfg
-
-program:
- @echo
- @echo "Flash Programming with OpenOCD..."
- $(OPENOCD) -f $(OPENOCD_CFG)
- @echo
- @echo
- @echo "Flash Programming Finished."
-
-
-# Create final output file (.hex) from ELF output file.
-%.hex: %.elf
- @echo
- @echo $(MSG_FLASH) $@
- $(OBJCOPY) -O ihex $< $@
-
-# Create final output file (.bin) from ELF output file.
-%.bin: %.elf
- @echo
- @echo $(MSG_FLASH) $@
- $(OBJCOPY) -O binary $< $@
-
-
-# Create extended listing file from ELF output file.
-# testing: option -C
-%.lss: %.elf
- @echo
- @echo $(MSG_EXTENDED_LISTING) $@
- $(OBJDUMP) -h -S -C $< > $@
-
-
-# Create a symbol table from ELF output file.
-%.sym: %.elf
- @echo
- @echo $(MSG_SYMBOL_TABLE) $@
- $(NM) -n $< > $@
-
-
-# Link: create ELF output file from object files.
-.SECONDARY : $(TARGET).elf
-.PRECIOUS : $(AOBJARM) $(AOBJ) $(COBJARM) $(COBJ) $(CPPOBJ) $(CPPOBJARM)
-%.elf: $(AOBJARM) $(AOBJ) $(COBJARM) $(COBJ) $(CPPOBJ) $(CPPOBJARM)
- @echo
- @echo $(MSG_LINKING) $@
- $(CC) $(THUMB) $(ALL_CFLAGS) $(AOBJARM) $(AOBJ) $(COBJARM) $(COBJ) $(CPPOBJ) $(CPPOBJARM) --output $@ $(LDFLAGS)
-# $(CPP) $(THUMB) $(ALL_CFLAGS) $(AOBJARM) $(AOBJ) $(COBJARM) $(COBJ) $(CPPOBJ) $(CPPOBJARM) --output $@ $(LDFLAGS)
-
-# Compile: create object files from C source files. ARM/Thumb
-$(COBJ) : %.o : %.c
- @echo
- @echo $(MSG_COMPILING) $<
- $(CC) -c $(THUMB) $(ALL_CFLAGS) $(CONLYFLAGS) $< -o $@
-
-# Compile: create object files from C source files. ARM-only
-$(COBJARM) : %.o : %.c
- @echo
- @echo $(MSG_COMPILING_ARM) $<
- $(CC) -c $(ALL_CFLAGS) $(CONLYFLAGS) $< -o $@
-
-# Compile: create object files from C++ source files. ARM/Thumb
-$(CPPOBJ) : %.o : %.cpp
- @echo
- @echo $(MSG_COMPILINGCPP) $<
- $(CPP) -c $(THUMB) $(ALL_CFLAGS) $(CPPFLAGS) $< -o $@
-
-# Compile: create object files from C++ source files. ARM-only
-$(CPPOBJARM) : %.o : %.cpp
- @echo
- @echo $(MSG_COMPILINGCPP_ARM) $<
- $(CPP) -c $(ALL_CFLAGS) $(CPPFLAGS) $< -o $@
-
-
-# Compile: create assembler files from C source files. ARM/Thumb
-## does not work - TODO - hints welcome
-##$(COBJ) : %.s : %.c
-## $(CC) $(THUMB) -S $(ALL_CFLAGS) $< -o $@
-
-
-# Assemble: create object files from assembler source files. ARM/Thumb
-$(AOBJ) : %.o : %.S
- @echo
- @echo $(MSG_ASSEMBLING) $<
- $(CC) -c $(THUMB) $(ALL_ASFLAGS) $< -o $@
-
-
-# Assemble: create object files from assembler source files. ARM-only
-$(AOBJARM) : %.o : %.S
- @echo
- @echo $(MSG_ASSEMBLING_ARM) $<
- $(CC) -c $(ALL_ASFLAGS) $< -o $@
-
-
-# Target: clean project.
-clean: begin clean_list finished end
-
-
-clean_list :
- @echo
- @echo $(MSG_CLEANING)
- $(REMOVE) $(TARGET).hex
- $(REMOVE) $(TARGET).bin
- $(REMOVE) $(TARGET).obj
- $(REMOVE) $(TARGET).elf
- $(REMOVE) $(TARGET).map
- $(REMOVE) $(TARGET).obj
- $(REMOVE) $(TARGET).a90
- $(REMOVE) $(TARGET).sym
- $(REMOVE) $(TARGET).lnk
- $(REMOVE) $(TARGET).lss
- $(REMOVE) $(COBJ)
- $(REMOVE) $(CPPOBJ)
- $(REMOVE) $(AOBJ)
- $(REMOVE) $(COBJARM)
- $(REMOVE) $(CPPOBJARM)
- $(REMOVE) $(AOBJARM)
- $(REMOVE) $(LST)
- $(REMOVE) $(SRC:.c=.s)
- $(REMOVE) $(SRC:.c=.d)
- $(REMOVE) $(SRCARM:.c=.s)
- $(REMOVE) $(SRCARM:.c=.d)
- $(REMOVE) $(CPPSRC:.cpp=.s)
- $(REMOVE) $(CPPSRC:.cpp=.d)
- $(REMOVE) $(CPPSRCARM:.cpp=.s)
- $(REMOVE) $(CPPSRCARM:.cpp=.d)
- $(REMOVEDIR) .dep | exit 0
-
-
-# Include the dependency files.
--include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
-
-
-# Listing of phony targets.
-.PHONY : all begin finish end sizebefore sizeafter gccversion \
-build elf hex bin lss sym clean clean_list program
-
diff --git a/uc_str912/prj_test_lcd/STR91x-ROM.ld b/uc_str912/prj_test_lcd/STR91x-ROM.ld
deleted file mode 100644
index ed2979b..0000000
--- a/uc_str912/prj_test_lcd/STR91x-ROM.ld
+++ /dev/null
@@ -1,221 +0,0 @@
-/***********************************************************************************
-* Copyright 2005 Anglia Design
-* This demo code and associated components are provided as is and has no warranty,
-* implied or otherwise. You are free to use/modify any of the provided
-* code at your own risk in your applications with the expressed limitation
-* of liability (see below)
-*
-* LIMITATION OF LIABILITY: ANGLIA OR ANGLIA DESIGNS SHALL NOT BE LIABLE FOR ANY
-* LOSS OF PROFITS, LOSS OF USE, LOSS OF DATA, INTERRUPTION OF BUSINESS, NOR FOR
-* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND WHETHER UNDER
-* THIS AGREEMENT OR OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-*
-* Author : Spencer Oliver
-* Web : www.anglia-designs.com
-*
-***********************************************************************************/
-
-/* Stack Sizes */
-
- _STACKSIZE = 1024;
- _STACKSIZE_IRQ = 256;
- _STACKSIZE_FIQ = 256;
- _STACKSIZE_SVC = 0;
- _STACKSIZE_ABT = 0;
- _STACKSIZE_UND = 0;
- _HEAPSIZE = 1024;
-
-/* Memory Definitions */
-
-MEMORY
-{
- CODE (rx) : ORIGIN = 0x00000000, LENGTH = 0x00080000
- DATA (rw) : ORIGIN = 0x04000000, LENGTH = 0x00018000
-}
-
-/* Section Definitions */
-
-SECTIONS
-{
- /* first section is .text which is used for code */
-
- .text :
- {
- KEEP(*(.vectors))
- KEEP(*(.init))
- *(.text .text.*)
- *(.gnu.linkonce.t.*)
- *(.glue_7t .glue_7)
- KEEP(*(.fini))
- *(.gcc_except_table)
- } >CODE =0
- . = ALIGN(4);
-
- /* .ctors .dtors are used for c++ constructors/destructors */
-
- .ctors :
- {
- PROVIDE(__ctors_start__ = .);
- KEEP(*(SORT(.ctors.*)))
- KEEP(*(.ctors))
- PROVIDE(__ctors_end__ = .);
- } >CODE
-
- .dtors :
- {
- PROVIDE(__dtors_start__ = .);
- KEEP(*(SORT(.dtors.*)))
- KEEP(*(.dtors))
- PROVIDE(__dtors_end__ = .);
- } >CODE
-
- /* .rodata section which is used for read-only data (constants) */
-
- .rodata :
- {
- *(.rodata .rodata.*)
- *(.gnu.linkonce.r.*)
- } >CODE
- . = ALIGN(4);
-
- _etext = .;
- PROVIDE (etext = .);
-
- /* .data section which is used for initialized data */
-
- .data : AT (_etext)
- {
- __data_start = .;
- *(.data .data.*)
- *(.gnu.linkonce.d.*)
- SORT(CONSTRUCTORS)
- . = ALIGN(4);
- *(.fastrun .fastrun.*)
- } >DATA
- . = ALIGN(4);
-
- _edata = .;
- PROVIDE (edata = .);
-
- /* .bss section which is used for uninitialized data */
-
- .bss :
- {
- __bss_start = .;
- __bss_start__ = .;
- *(.bss .bss.*)
- *(.gnu.linkonce.b.*)
- *(COMMON)
- . = ALIGN(4);
- } >DATA
- . = ALIGN(4);
- __bss_end__ = .;
-
- _end = .;
- PROVIDE(end = .);
-
- /* .heap section which is used for memory allocation */
-
- .heap (NOLOAD) :
- {
- __heap_start__ = .;
- *(.heap)
- . = MAX(__heap_start__ + _HEAPSIZE , .);
- } >DATA
- __heap_end__ = __heap_start__ + SIZEOF(.heap);
-
- /* .stack section - user mode stack */
-
- .stack (__heap_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_start__ = .;
- *(.stack)
- . = MAX(__stack_start__ + _STACKSIZE , .);
- } >DATA
- __stack_end__ = __stack_start__ + SIZEOF(.stack);
-
- /* .stack_irq section */
-
- .stack_irq (__stack_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_irq_start__ = .;
- *(.stack_irq)
- . = MAX(__stack_irq_start__ + _STACKSIZE_IRQ , .);
- } >DATA
- __stack_irq_end__ = __stack_irq_start__ + SIZEOF(.stack_irq);
-
- /* .stack_fiq section */
-
- .stack_fiq (__stack_irq_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_fiq_start__ = .;
- *(.stack_fiq)
- . = MAX(__stack_fiq_start__ + _STACKSIZE_FIQ , .);
- } >DATA
- __stack_fiq_end__ = __stack_fiq_start__ + SIZEOF(.stack_fiq);
-
- /* .stack_svc section */
-
- .stack_svc (__stack_fiq_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_svc_start__ = .;
- *(.stack_svc)
- . = MAX(__stack_svc_start__ + _STACKSIZE_SVC , .);
- } >DATA
- __stack_svc_end__ = __stack_svc_start__ + SIZEOF(.stack_svc);
-
- /* .stack_abt section */
-
- .stack_abt (__stack_svc_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_abt_start__ = .;
- *(.stack_abt)
- . = MAX(__stack_abt_start__ + _STACKSIZE_ABT , .);
- } >DATA
- __stack_abt_end__ = __stack_abt_start__ + SIZEOF(.stack_abt);
-
- /* .stack_und section */
-
- .stack_und (__stack_abt_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_und_start__ = .;
- *(.stack_und)
- . = MAX(__stack_und_start__ + _STACKSIZE_UND , .);
- } >DATA
- __stack_und_end__ = __stack_und_start__ + SIZEOF(.stack_und);
-
- /* 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) }
-}
-
diff --git a/uc_str912/prj_test_lcd/include/91x_ahbapb.h b/uc_str912/prj_test_lcd/include/91x_ahbapb.h
deleted file mode 100644
index 1828d48..0000000
--- a/uc_str912/prj_test_lcd/include/91x_ahbapb.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_ahbapb.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* AHBAPB software library.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef _91x_AHBAPB_H
-#define _91x_AHBAPB_H
-
-#include "91x_map.h"
-
-#define AHBAPB_Split_Enable 0x01000000
-#define AHBAPB_Split_Disable 0xFEFFFFFF
-#define AHBAPB_Error_Enable 0x0000100
-#define AHBAPB_Error_Disable 0xFFFFEFF
-
-/*FLAG*/
-#define AHBAPB_FLAG_ERROR 0x01 /* error flag*/
-#define AHBAPB_FLAG_OUTM 0x10 /* Out of Memory flag */
-#define AHBAPB_FLAG_APBT 0x20 /* APB Time-out flag */
-#define AHBAPB_FLAG_RW 0x40 /*Access type flag*/
-
-/* Includes ------------------------------------------------------------------*/
-
-
-/* AHBAPB Init structure definition */
-typedef struct
-{
- u32 AHBAPB_SetTimeOut;
- u32 AHBAPB_Error;
- u32 AHBAPB_Split;
- u8 AHBAPB_SplitCounter;
-}AHBAPB_InitTypeDef;
-
-/* Exported constants --------------------------------------------------------*/
-void AHBAPB_DeInit(AHBAPB_TypeDef* AHBAPBx);
-void AHBAPB_Init(AHBAPB_TypeDef* AHBAPBx, AHBAPB_InitTypeDef* AHBAPB_InitStruct);
-void AHBAPB_StructInit(AHBAPB_InitTypeDef* AHBAPB_InitStruct);
-FlagStatus AHBAPB_GetFlagStatus(AHBAPB_TypeDef* AHBAPBx, u8 AHBAPB_FLAG);
-void AHBAPB_ClearFlag(AHBAPB_TypeDef* AHBAPBx, u8 AHBAPB_FLAG);
-u32 AHBAPB_GetPeriphAddrError(AHBAPB_TypeDef* AHBAPBx);
-
-
-#endif /* _91x_AHBAPB_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_test_lcd/include/91x_conf.h b/uc_str912/prj_test_lcd/include/91x_conf.h
deleted file mode 100644
index 578335d..0000000
--- a/uc_str912/prj_test_lcd/include/91x_conf.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_conf.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : Library configuration.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-
-#ifndef __91x_CONF_H
-#define __91x_CONF_H
-
-/* To work in buffered mode just decomment the following line */
-
-//#define Buffered
-
-/* Comment the line below to put the library in release mode */
-//#define DEBUG
-
-/************************* AHBAPB *************************/
-//#define _AHBAPB
-//#define _AHBAPB0
-//#define _AHBAPB1
-/************************* VIC *************************/
-//#define _VIC
-//#define _VIC0
-//#define _VIC1
-/************************* DMA *************************/
-//#define _DMA
-//#define _DMA_Channel0
-//#define _DMA_Channel1
-//#define _DMA_Channel2
-//#define _DMA_Channel3
-//#define _DMA_Channel4
-//#define _DMA_Channel5
-//#define _DMA_Channel6
-//#define _DMA_Channel7
-
-/************************* EMI *************************/
-//#define _EMI
-//#define _EMI_Bank0
-//#define _EMI_Bank1
-//#define _EMI_Bank2
-//#define _EMI_Bank3
-/************************* FMI *************************/
-//#define _FMI
-/************************* WIU *************************/
-//#define _WIU
-/************************* TIM *************************/
-//#define _TIM
-//#define _TIM0
-//#define _TIM1
-//#define _TIM2
-//#define _TIM3
-/************************* GPIO ************************/
-#define _GPIO
-#define _GPIO0
-#define _GPIO1
-#define _GPIO2
-#define _GPIO3
-#define _GPIO4
-#define _GPIO5
-#define _GPIO6
-#define _GPIO7
-#define _GPIO8
-#define _GPIO9
-/************************* RTC *************************/
-//#define _RTC
-/************************* SCU *************************/
-#define _SCU
-/************************* MC **************************/
-//#define _MC
-/************************* UART ************************/
-//#define _UART
-//#define _UART0
-//#define _UART1
-//#define _UART2
-/************************* SSP *************************/
-//#define _SSP
-//#define _SSP0
-//#define _SSP1
-/************************* CAN *************************/
-//#define _CAN
-/************************* ADC *************************/
-//#define _ADC
-/************************* WDG *************************/
-//#define _WDG
-/************************* I2C *************************/
-//#define _I2C
-//#define _I2C0
-//#define _I2C1
-/************************ ENET *************************/
-//#define _ENET
-
-/*---------------------------- _Main_Crystal frequency value (KHz)------------*/
-
-#ifndef _Main_Crystal
-#define _Main_Crystal 25000
-#endif
-/*------------------------------------------------------------------------------*/
-
-
-#endif /* __91x_CONF_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_test_lcd/include/91x_fmi.h b/uc_str912/prj_test_lcd/include/91x_fmi.h
deleted file mode 100644
index 06e8115..0000000
--- a/uc_str912/prj_test_lcd/include/91x_fmi.h
+++ /dev/null
@@ -1,184 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_fmi.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* FMI software library.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-
-/* Define to prevent recursive inclusion ------------------------------------ */
-
-#ifndef __91x_FMI_H
-#define __91x_FMI_H
-
-/* ========================================================================== */
-/* When bank 1 is remapped at address 0x0, decomment the following line */
-/* ========================================================================== */
-
-//#define Remap_Bank_1
-
-
-/* Includes ------------------------------------------------------------------*/
-
-#include "91x_map.h"
-
-/* Exported types ------------------------------------------------------------*/
-/* Exported constants --------------------------------------------------------*/
-
-/* FMI banks */
-
-#ifdef Remap_Bank_1
-
-#define FMI_BANK_0 ((*(vu32*)0x54000010) << 2) /* FMI Bank 0 */
-#define FMI_BANK_1 ((*(vu32*)0x5400000C) << 2) /* FMI Bank 1 */
-
-#else /* Remap Bank 0 */
-
-#define FMI_BANK_0 ((*(vu32*)0x5400000C) << 2) /* FMI Bank 0 */
-#define FMI_BANK_1 ((*(vu32*)0x54000010) << 2) /* FMI Bank 1 */
-
-#endif
-
-/* FMI sectors */
-
-#define FMI_B0S0 0x00000000 + FMI_BANK_0 /* Bank 0 sector 0 */
-#define FMI_B0S1 0x00010000 + FMI_BANK_0 /* Bank 0 sector 1 */
-#define FMI_B0S2 0x00020000 + FMI_BANK_0 /* Bank 0 sector 2 */
-#define FMI_B0S3 0x00030000 + FMI_BANK_0 /* Bank 0 sector 3 */
-#define FMI_B0S4 0x00040000 + FMI_BANK_0 /* Bank 0 sector 4 */
-#define FMI_B0S5 0x00050000 + FMI_BANK_0 /* Bank 0 sector 5 */
-#define FMI_B0S6 0x00060000 + FMI_BANK_0 /* Bank 0 sector 6 */
-#define FMI_B0S7 0x00070000 + FMI_BANK_0 /* Bank 0 sector 7 */
-
-#define FMI_B1S0 0x00000000 + FMI_BANK_1 /* Bank 1 sector 0 */
-#define FMI_B1S1 0x00002000 + FMI_BANK_1 /* Bank 1 sector 1 */
-#define FMI_B1S2 0x00004000 + FMI_BANK_1 /* Bank 1 sector 2 */
-#define FMI_B1S3 0x00006000 + FMI_BANK_1 /* Bank 1 sector 3 */
-
-/* FMI Flags */
-
-#define FMI_FLAG_SPS 0x02 /* Sector Protection Status Flag */
-#define FMI_FLAG_PSS 0x04 /* Program Suspend Status Flag */
-#define FMI_FLAG_PS 0x10 /* Program Status Flag */
-#define FMI_FLAG_ES 0x20 /* Erase Status Flag */
-#define FMI_FLAG_ESS 0x40 /* Erase Suspend Status Flag */
-#define FMI_FLAG_PECS 0x80 /* FPEC Status Flag */
-
-/* FMI read wait states */
-
-#define FMI_READ_WAIT_STATE_1 0x0000 /* One read wait state */
-#define FMI_READ_WAIT_STATE_2 0x2000 /* Two read wait states */
-#define FMI_READ_WAIT_STATE_3 0x4000 /* Three read wait states */
-
-/* FMI write wait states */
-
-#define FMI_WRITE_WAIT_STATE_0 0xFFFFFEFF /* Zero wait state */
-#define FMI_WRITE_WAIT_STATE_1 0x00000100 /* One wait state */
-
-/* FMI power down configuration */
-
-#define FMI_PWD_ENABLE 0x1000 /* FMI Power Down Enable */
-#define FMI_PWD_DISABLE 0x0000 /* FMI Power Down Disable */
-
-/* FMI low voltage detector */
-
-#define FMI_LVD_ENABLE 0x0000 /* FMI Low Voltage Detector Enable */
-#define FMI_LVD_DISABLE 0x0800 /* FMI Low Voltage Detector Disable */
-
-/* FMI frequency range */
-
-#define FMI_FREQ_LOW 0x0000 /* FMI Low bus working frequency */
-#define FMI_FREQ_HIGH 0x0040 /* FMI High bus working gfrequency */
- /* Above 66 MHz*/
-/* FMI OTP word addresses */
-
-#define FMI_OTP_WORD_0 0x00 /* OTP word 0 */
-#define FMI_OTP_WORD_1 0x04 /* OTP word 1 */
-#define FMI_OTP_WORD_2 0x08 /* OTP word 2 */
-#define FMI_OTP_WORD_3 0x0C /* OTP word 3 */
-#define FMI_OTP_WORD_4 0x10 /* OTP word 4 */
-#define FMI_OTP_WORD_5 0x14 /* OTP word 5 */
-#define FMI_OTP_WORD_6 0x18 /* OTP word 6 */
-#define FMI_OTP_WORD_7 0x1C /* OTP word 7 */
-
-/* FMI OTP halfword addresses */
-
-#define FMI_OTP_LOW_HALFWORD_0 0x00 /* OTP Low halfword 0 */
-#define FMI_OTP_HIGH_HALFWORD_0 0x02 /* OTP High halfword 0 */
-#define FMI_OTP_LOW_HALFWORD_1 0x04 /* OTP Low halfword 1 */
-#define FMI_OTP_HIGH_HALFWORD_1 0x06 /* OTP High halfword 1 */
-#define FMI_OTP_LOW_HALFWORD_2 0x08 /* OTP Low halfword 2 */
-#define FMI_OTP_HIGH_HALFWORD_2 0x0A /* OTP High halfword 2 */
-#define FMI_OTP_LOW_HALFWORD_3 0x0C /* OTP Low halfword 3 */
-#define FMI_OTP_HIGH_HALFWORD_3 0x0E /* OTP High halfword 3 */
-#define FMI_OTP_LOW_HALFWORD_4 0x10 /* OTP Low halfword 4 */
-#define FMI_OTP_HIGH_HALFWORD_4 0x12 /* OTP High halfword 4 */
-#define FMI_OTP_LOW_HALFWORD_5 0x14 /* OTP Low halfword 5 */
-#define FMI_OTP_HIGH_HALFWORD_5 0x16 /* OTP High halfword 5 */
-#define FMI_OTP_LOW_HALFWORD_6 0x18 /* OTP Low halfword 6 */
-#define FMI_OTP_HIGH_HALFWORD_6 0x1A /* OTP High halfword 6 */
-#define FMI_OTP_LOW_HALFWORD_7 0x1C /* OTP Low halfword 7 */
-#define FMI_OTP_HIGH_HALFWORD_7 0x1E /* OTP High halfword 7 */
-
-/* FMI sectors Masks */
-
-#define FMI_B0S0_MASK 0x0001 /* FMI B0S0 mask */
-#define FMI_B0S1_MASK 0x0002 /* FMI B0S1 mask */
-#define FMI_B0S2_MASK 0x0004 /* FMI B0S2 mask */
-#define FMI_B0S3_MASK 0x0008 /* FMI B0S3 mask */
-#define FMI_B0S4_MASK 0x0010 /* FMI B0S4 mask */
-#define FMI_B0S5_MASK 0x0020 /* FMI B0S5 mask */
-#define FMI_B0S6_MASK 0x0040 /* FMI B0S6 mask */
-#define FMI_B0S7_MASK 0x0080 /* FMI B0S7 mask */
-
-#define FMI_B1S0_MASK 0x0100 /* FMI B1S0 mask */
-#define FMI_B1S1_MASK 0x0200 /* FMI B1S1 mask */
-#define FMI_B1S2_MASK 0x0400 /* FMI B1S2 mask */
-#define FMI_B1S3_MASK 0x0800 /* FMI B1S3 mask */
-
-/* Timeout error */
-
-#define FMI_TIME_OUT_ERROR 0x00 /* Timeout error */
-#define FMI_NO_TIME_OUT_ERROR 0x01 /* No Timeout error */
-
-/* Module private variables --------------------------------------------------*/
-/* Exported macro ------------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-
-void FMI_BankRemapConfig(u8 FMI_BootBankSize, u8 FMI_NonBootBankSize, \
- u32 FMI_BootBankAddress, u32 FMI_NonBootBankAddress);
-void FMI_Config(u16 FMI_ReadWaitState, u32 FMI_WriteWaitState, u16 FMI_PWD,\
- u16 FMI_LVDEN, u16 FMI_FreqRange);
-void FMI_EraseSector(vu32 FMI_Sector);
-void FMI_EraseBank(vu32 FMI_Bank);
-void FMI_WriteHalfWord(u32 FMI_Address, u16 FMI_Data);
-void FMI_WriteOTPHalfWord(u8 FMI_OTPHWAddress, u16 FMI_OTPData);
-u32 FMI_ReadWord(u32 FMI_Address);
-u32 FMI_ReadOTPData(u8 FMI_OTPAddress);
-FlagStatus FMI_GetFlagStatus(u8 FMI_Flag, vu32 FMI_Bank);
-u16 FMI_GetReadWaitStateValue(void);
-u16 FMI_GetWriteWaitStateValue(void);
-void FMI_SuspendEnable(vu32 FMI_Bank);
-void FMI_ResumeEnable(vu32 FMI_Bank);
-void FMI_ClearFlag(vu32 FMI_Bank);
-void FMI_WriteProtectionCmd(vu32 FMI_Sector, FunctionalState FMI_NewState);
-FlagStatus FMI_GetWriteProtectionStatus(u32 FMI_Sector_Protection);
-u8 FMI_WaitForLastOperation(vu32 FMI_Bank);
-
-#endif /* __91x_FMI_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
-
diff --git a/uc_str912/prj_test_lcd/include/91x_gpio.h b/uc_str912/prj_test_lcd/include/91x_gpio.h
deleted file mode 100644
index 4beab75..0000000
--- a/uc_str912/prj_test_lcd/include/91x_gpio.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_gpio.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file contains all the functions prototypes for the
-* GPIO software library.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion ------------------------------------ */
-
-#ifndef _91x_GPIO_H
-#define _91x_GPIO_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_map.h"
-
-/* GPIO Init structure definition */
-typedef struct
-{
- u8 GPIO_Pin;
- u8 GPIO_Direction;
- u8 GPIO_Type;
- u8 GPIO_IPConnected;
- u16 GPIO_Alternate;
-}GPIO_InitTypeDef;
-
-/* Bit_SET and Bit_RESET enumeration */
-typedef enum
-{ Bit_RESET = 0,
- Bit_SET
-}BitAction;
-
-
-/* Exported constants --------------------------------------------------------*/
-#define GPIO_Pin_None 0x00
-#define GPIO_Pin_0 0x01
-#define GPIO_Pin_1 0x02
-#define GPIO_Pin_2 0x04
-#define GPIO_Pin_3 0x08
-#define GPIO_Pin_4 0x10
-#define GPIO_Pin_5 0x20
-#define GPIO_Pin_6 0x40
-#define GPIO_Pin_7 0x80
-#define GPIO_Pin_All 0xFF
-
-#define GPIO_PinInput 0x00
-#define GPIO_PinOutput 0x01
-
-#define GPIO_Type_PushPull 0x00
-#define GPIO_Type_OpenCollector 0x01
-
-#define GPIO_IPConnected_Disable 0x00
-#define GPIO_IPConnected_Enable 0x01
-
-#define GPIO_InputAlt1 0x00
-#define GPIO_OutputAlt1 0x01
-#define GPIO_OutputAlt2 0x02
-#define GPIO_OutputAlt3 0x03
-
-#define GPIO_ANAChannel0 0x01
-#define GPIO_ANAChannel1 0x02
-#define GPIO_ANAChannel2 0x04
-#define GPIO_ANAChannel3 0x08
-#define GPIO_ANAChannel4 0x10
-#define GPIO_ANAChannel5 0x20
-#define GPIO_ANAChannel6 0x40
-#define GPIO_ANAChannel7 0x80
-#define GPIO_ANAChannelALL 0xFF
-
-void GPIO_DeInit(GPIO_TypeDef* GPIOx);
-void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct);
-void GPIO_StructInit(GPIO_InitTypeDef* GPIO_InitStruct);
-u8 GPIO_ReadBit(GPIO_TypeDef* GPIOx, u8 GPIO_Pin);
-u8 GPIO_Read(GPIO_TypeDef* GPIOx);
-void GPIO_WriteBit(GPIO_TypeDef* GPIOx, u8 GPIO_Pin, BitAction BitVal);
-void GPIO_Write(GPIO_TypeDef* GPIOx, u8 PortVal);
-void GPIO_EMIConfig(FunctionalState NewState);
-void GPIO_ANAPinConfig(u8 GPIO_ANAChannel, FunctionalState NewState);
-
-#endif /* _91x_GPIO_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_test_lcd/include/91x_lib.h b/uc_str912/prj_test_lcd/include/91x_lib.h
deleted file mode 100644
index 823b250..0000000
--- a/uc_str912/prj_test_lcd/include/91x_lib.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_lib.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : Used to include the peripherals header file in the
-* user application.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-#ifndef __91x_LIB_H
-#define __91x_LIB_H
-
-#include "91x_map.h"
-#include "91x_conf.h"
-
-#ifdef _AHBAPB
- #include "91x_ahbapb.h"
-#endif /* _AHBAPB */
-
-#ifdef _EMI
- #include "91x_emi.h"
-#endif /* _EMI */
-
-#ifdef _DMA
- #include "91x_dma.h"
-#endif /* _DMA */
-
-#ifdef _FMI
- #include "91x_fmi.h"
-#endif /* _FMI */
-
-#ifdef _VIC
- #include "91x_vic.h"
-#endif /* _VIC */
-
-#ifdef _WIU
- #include "91x_wiu.h"
-#endif /* _WIU */
-
-#ifdef _TIM
- #include "91x_tim.h"
-#endif /* _TIM */
-
-#ifdef _GPIO
- #include "91x_gpio.h"
-#endif /* _GPIO */
-
-#ifdef _RTC
- #include "91x_rtc.h"
-#endif /* _RTC */
-
-#ifdef _SCU
- #include "91x_scu.h"
-#endif /* _SCU */
-
-#ifdef _UART
- #include "91x_uart.h"
-#endif /* _UART */
-
-#ifdef _SSP
- #include "91x_ssp.h"
-#endif /* _SSP */
-
-#ifdef _CAN
- #include "91x_can.h"
-#endif /* _CAN */
-
-#ifdef _ADC
- #include "91x_adc.h"
-#endif /* _ADC */
-
-#ifdef _WDG
- #include "91x_wdg.h"
-#endif /* _WDG */
-
-#ifdef _I2C
- #include "91x_i2c.h"
-#endif /* _I2C */
-
-#ifdef _WIU
- #include "91x_wiu.h"
-#endif
-
-#ifdef _MC
- #include "91x_mc.h"
-#endif
-
-#ifdef _ENET
- #include "91x_enet.h"
-#endif
-
-/* Exported types ------------------------------------------------------------*/
-/* Exported constants --------------------------------------------------------*/
-/* Module private variables --------------------------------------------------*/
-/* Exported macro ------------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-
- void debug( void );
-
-
-#endif /* __91x_LIB_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_test_lcd/include/91x_map.h b/uc_str912/prj_test_lcd/include/91x_map.h
deleted file mode 100644
index 2e94a91..0000000
--- a/uc_str912/prj_test_lcd/include/91x_map.h
+++ /dev/null
@@ -1,878 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_map.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : Peripherals registers definition and memory mapping.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion ------------------------------------ */
-#ifndef __91x_MAP_H
-#define __91x_MAP_H
-
-#ifndef EXT
- #define EXT extern
-#endif /* EXT */
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_conf.h"
-#include "91x_type.h"
-
-/******************************************************************************/
-/* IP registers structures */
-/******************************************************************************/
-
-/*------------------------------------ FMI -----------------------------------*/
-
-typedef struct
-{
- vu32 BBSR; /* Boot Bank Size Register */
- vu32 NBBSR; /* Non-Boot Bank Size Register */
- vu32 EMPTY1;
- vu32 BBADR; /* Boot Bank Base Address Register */
- vu32 NBBADR; /* Non-Boot Bank Base Address Register */
- vu32 EMPTY2;
- vu32 CR; /* Control Register */
- vu32 SR; /* Status Register */
- vu32 BCE5ADDR; /* BC Fifth Entry Target Address Register */
-} FMI_TypeDef;
-
-/*---------------------- Analog to Digital Convertor ------------------------*/
-
-typedef struct
-{
- vu16 CR; /* Control Register */
- vu16 EMPTY1;
- vu16 CCR; /* Channel Configuration Register */
- vu16 EMPTY2;
- vu16 HTR; /* Higher Threshold Register */
- vu16 EMPTY3;
- vu16 LTR; /* Lower Threshold Register */
- vu16 EMPTY4;
- vu16 CRR; /* Compare Result Register */
- vu16 EMPTY5;
- vu16 DR0; /* Data Register for Channel 0 */
- vu16 EMPTY6;
- vu16 DR1; /* Data Register for Channel 1 */
- vu16 EMPTY7;
- vu16 DR2; /* Data Register for Channel 2 */
- vu16 EMPTY8;
- vu16 DR3; /* Data Register for Channel 3 */
- vu16 EMPTY9;
- vu16 DR4; /* Data Register for Channel 4 */
- vu16 EMPTY10;
- vu16 DR5; /* Data Register for Channel 5 */
- vu16 EMPTY11;
- vu16 DR6; /* Data Register for Channel 6 */
- vu16 EMPTY12;
- vu16 DR7; /* Data Register for Channel 7 */
- vu16 EMPTY13;
- vu16 PRS; /* Prescaler Value Register */
- vu16 EMPTY14;
-} ADC_TypeDef;
-
-/*--------------------- AHB APB BRIDGE registers strcture --------------------*/
-
-typedef struct
-{
- vu32 BSR; /* Bridge Status Register */
- vu32 BCR; /* Bridge Configuration Register */
- vu32 PAER; /* Peripheral Address Error register */
-} AHBAPB_TypeDef;
-
-/*--------------- Controller Area Network Interface Register -----------------*/
-
-typedef struct
-{
- vu16 CRR; /* IFn Command request Register */
- vu16 EMPTY1;
- vu16 CMR; /* IFn Command Mask Register */
- vu16 EMPTY2;
- vu16 M1R; /* IFn Message Mask 1 Register */
- vu16 EMPTY3;
- vu16 M2R; /* IFn Message Mask 2 Register */
- vu16 EMPTY4;
- vu16 A1R; /* IFn Message Arbitration 1 Register */
- vu16 EMPTY5;
- vu16 A2R; /* IFn Message Arbitration 2 Register */
- vu16 EMPTY6;
- vu16 MCR; /* IFn Message Control Register */
- vu16 EMPTY7;
- vu16 DA1R; /* IFn DATA A 1 Register */
- vu16 EMPTY8;
- vu16 DA2R; /* IFn DATA A 2 Register */
- vu16 EMPTY9;
- vu16 DB1R; /* IFn DATA B 1 Register */
- vu16 EMPTY10;
- vu16 DB2R; /* IFn DATA B 2 Register */
- vu16 EMPTY11[27];
-} CAN_MsgObj_TypeDef;
-
-typedef struct
-{
- vu16 CR; /* Control Register */
- vu16 EMPTY1;
- vu16 SR; /* Status Register */
- vu16 EMPTY2;
- vu16 ERR; /* Error counter Register */
- vu16 EMPTY3;
- vu16 BTR; /* Bit Timing Register */
- vu16 EMPTY4;
- vu16 IDR; /* Interrupt Identifier Register */
- vu16 EMPTY5;
- vu16 TESTR; /* Test Register */
- vu16 EMPTY6;
- vu16 BRPR; /* BRP Extension Register */
- vu16 EMPTY7[3];
- CAN_MsgObj_TypeDef sMsgObj[2];
- vu16 EMPTY8[16];
- vu16 TXR1R; /* Transmission request 1 Register */
- vu16 EMPTY9;
- vu16 TXR2R; /* Transmission Request 2 Register */
- vu16 EMPTY10[13];
- vu16 ND1R; /* New Data 1 Register */
- vu16 EMPTY11;
- vu16 ND2R; /* New Data 2 Register */
- vu16 EMPTY12[13];
- vu16 IP1R; /* Interrupt Pending 1 Register */
- vu16 EMPTY13;
- vu16 IP2R; /* Interrupt Pending 2 Register */
- vu16 EMPTY14[13];
- vu16 MV1R; /* Message Valid 1 Register */
- vu16 EMPTY15;
- vu16 MV2R; /* Message VAlid 2 Register */
- vu16 EMPTY16;
-} CAN_TypeDef;
-
-/*----------------------- System Control Unit---------------------------------*/
-
-typedef struct
-{
- vu32 CLKCNTR; /* Clock Control Register */
- vu32 PLLCONF; /* PLL Configuration Register */
- vu32 SYSSTATUS; /* System Status Register */
- vu32 PWRMNG; /* Power Management Register */
- vu32 ITCMSK; /* Interrupt Mask Register */
- vu32 PCGRO; /* Peripheral Clock Gating Register 0 */
- vu32 PCGR1; /* Peripheral Clock Gating Register 1 */
- vu32 PRR0; /* Peripheral Reset Register 0 */
- vu32 PRR1; /* Peripheral Reset Register 1 */
- vu32 MGR0; /* Idle Mode Mask Gating Register 0 */
- vu32 MGR1; /* Idle Mode Mask Gating Register 1 */
- vu32 PECGR0; /* Peripheral Emulation Clock Gating Register 0 */
- vu32 PECGR1; /* Peripheral Emulation Clock Gating Register 1 */
- vu32 SCR0; /* System Configuration Register 0 */
- vu32 SCR1; /* System Configuration Register 1 */
- vu32 SCR2; /* System Configuration Register 2 */
- u32 EMPTY1;
- vu32 GPIOOUT[8]; /* GPIO Output Registers */
- vu32 GPIOIN[8]; /* GPIO Input Registers */
- vu32 GPIOTYPE[10];/* GPIO Type Registers */
- vu32 GPIOEMI; /* GPIO EMI Selector Register */
- vu32 WKUPSEL; /* Wake-Up Selection Register */
- u32 EMPTY2[2];
- vu32 GPIOANA; /* GPIO Analag mode Register */
-} SCU_TypeDef;
-
-/*------------------------- DMA Channelx Registers ---------------------------*/
-
-typedef struct
-{
- vu32 SRC; /* Channelx Source Address Register */
- vu32 DES; /* Channelx Destination Address Register */
- vu32 LLI; /* Channelx Lincked List Item Register */
- vu32 CC; /* Channelx Contol Register */
- vu32 CCNF; /* Channelx Configuration Register */
-} DMA_Channel_TypeDef;
-
-/* x can be ,0,1,2,3,4,5,6 or 7. There are eight Channels AHB BUS Master */
-
-/*----------------------------- DMA Controller -------------------------------*/
-
-typedef struct
-{
- vu32 ISR; /* Interrupt Status Register */
- vu32 TCISR; /* Terminal Count Interrupt Status Register */
- vu32 TCICR; /* Terminal CountInterrupt Clear Register */
- vu32 EISR; /* Error Interrupt Status Register */
- vu32 EICR; /* Error Interrupt Clear Register */
- vu32 TCRISR; /* Terminal Count Raw Interrupt Status Register */
- vu32 ERISR; /* Raw Error Interrupt Status Register */
- vu32 ENCSR; /* Enabled Channel Status Register */
- vu32 SBRR; /* Software Burst Request Register */
- vu32 SSRR; /* Software Single Request Register */
- vu32 SLBRR; /* Software Last Burst Request Register */
- vu32 SLSRR; /* Software Last Single Request Register */
- vu32 CNFR; /* Configuration Register */
- vu32 SYNR; /* Syncronization Register */
- } DMA_TypeDef;
-
-/*--------------------------------- TIM Timer --------------------------------*/
-
-typedef struct
-{
- vu16 IC1R; /* Input Capture 1 Register */
- vu16 EMPTY1;
- vu16 IC2R; /* Input Capture 2 Register */
- vu16 EMPTY2;
- vu16 OC1R; /* Output Compare 1 Register */
- vu16 EMPTY3;
- vu16 OC2R; /* Output Compare 2 Register */
- vu16 EMPTY4;
- vu16 CNTR; /* Counter Register */
- vu16 EMPTY5;
- vu16 CR1; /* Control Register 1 */
- vu16 EMPTY6;
- vu16 CR2; /* Control Register 2 */
- vu16 EMPTY7;
- vu16 SR; /* Status Register */
- vu16 EMPTY8;
-} TIM_TypeDef;
-
-/*---------------------------- EMI Bankx Registers ---------------------------*/
-
-typedef struct
-{
- vu32 ICR; /* Bankx Idle Cycle Control Register */
- vu32 RCR; /* Bankx Read Wait State Control Register */
- vu32 WCR; /* Bankx Write Wait State Control Register */
- vu32 OECR; /* Bankx Output Enable Assertion Delay Control Register */
- vu32 WECR; /* Bankx Write Enable Assertion Delay Control Register */
- vu32 BCR; /* Bankx Control Register */
- } EMI_Bank_TypeDef;
-
-/*---------------------------- Ethernet Controller ---------------------------*/
-
-/* MAC Registers */
-typedef struct
-{
- vu32 MCR; /* ENET Control Register */
- vu32 MAH; /* ENET Address High Register */
- vu32 MAL; /* ENET Address Low Register */
- vu32 MCHA; /* Multicast Address High Register */
- vu32 MCLA; /* Multicast Address Low Register */
- vu32 MIIA; /* MII Address Register */
- vu32 MIID; /* MII Data Register */
- vu32 MCF; /* ENET Control Frame Register */
- vu32 VL1; /* VLAN1 Register */
- vu32 VL2; /* VLAN2 register */
- vu32 MTS; /* ENET Transmission Status Register */
- vu32 MRS; /* ENET Reception Status Register */
-} ENET_MAC_TypeDef;
-
-/* DMA Registers */
-typedef struct
-{
- vu32 SCR; /* DMA Status and Control Register */
- vu32 IER; /* DMA Interrupt Sources Enable Register */
- vu32 ISR; /* DMA Interrupt Status Register */
- vu32 CCR; /* Clock Control Relation : HCLK, PCLK and
- ENET_CLK phase relations */
- vu32 RXSTR; /* Rx DMA start Register */
- vu32 RXCR; /* Rx DMA Control Register */
- vu32 RXSAR; /* Rx DMA Base Address Register */
- vu32 RXNDAR; /* Rx DMA Next Descriptor Address Register */
- vu32 RXCAR; /* Rx DMA Current Address Register */
- vu32 RXCTCR; /* Rx DMA Current Transfer Count Register */
- vu32 RXTOR; /* Rx DMA FIFO Time Out Register */
- vu32 RXSR; /* Rx DMA FIFO Status Register */
- vu32 TXSTR; /* Tx DMA start Register */
- vu32 TXCR; /* Tx DMA Control Register */
- vu32 TXSAR; /* Tx DMA Base Address Register */
- vu32 TXNDAR; /* Tx DMA Next Descriptor Address Register */
- vu32 TXCAR; /* Tx DMA Current Address Register */
- vu32 TXTCR; /* Tx DMA Current Transfer Count Register */
- vu32 TXTOR; /* Tx DMA FIFO Time Out Register */
- vu32 TXSR; /* Tx DMA FIFO Status Register */
-} ENET_DMA_TypeDef;
-
-/*------------------------------------- GPIO ---------------------------------*/
-
-typedef struct
-{
- vu8 DR[1021]; /* Data Register */
- vu32 DDR; /* Data Direction Register */
-} GPIO_TypeDef;
-
-/*-------------------------------- I2C interface -----------------------------*/
-
-typedef struct
-{
- vu8 CR; /* Control Register */
- vu8 EMPTY1[3];
- vu8 SR1; /* Status Register 1 */
- vu8 EMPTY2[3];
- vu8 SR2; /* Status Register 2 */
- vu8 EMPTY3[3];
- vu8 CCR; /* Clock Control Register */
- vu8 EMPTY4[3];
- vu8 OAR1; /* Own Address Register 1 */
- vu8 EMPTY5[3];
- vu8 OAR2; /* Own Address Register 2 */
- vu8 EMPTY6[3];
- vu8 DR; /* Data Register */
- vu8 EMPTY7[3];
- vu8 ECCR; /* Extended Clock Control Register */
- vu8 EMPTY8[3];
-} I2C_TypeDef;
-
-/*------------------------------------- VIC ----------------------------------*/
-
-typedef struct
-{
- vu32 ISR; /* IRQ Status Register */
- vu32 FSR; /* FIQ Status Register */
- vu32 RINTSR; /* Raw Interrupt Status Register */
- vu32 INTSR; /* Interrupt Select Register */
- vu32 INTER; /* Interrupt Enable Register */
- vu32 INTECR; /* Interrupt Enable Clear Register */
- vu32 SWINTR; /* Software Interrupt Register */
- vu32 SWINTCR; /* Software Interrupt clear Register */
- vu32 PER; /* Protection Enable Register */
- vu32 EMPTY1[3];
- vu32 VAR; /* Vector Address Register */
- vu32 DVAR; /* Default Vector Address Register */
- vu32 EMPTY2[50];
- vu32 VAiR[16]; /* Vector Address 0-15 Register */
- vu32 EMPTY3[48];
- vu32 VCiR[16]; /* Vector Control 0-15 Register */
-} VIC_TypeDef;
-
-/*-------------------------------- Motor Control -----------------------------*/
-
-typedef struct
-{
- vu16 TCPT; /* Tacho Capture Register */
- vu16 EMPTY1;
- vu16 TCMP; /* Tacho Compare Register */
- vu16 EMPTY2;
- vu16 IPR; /* Input Pending Register */
- vu16 EMPTY3;
- vu16 TPRS; /* Tacho Prescaler Register */
- vu16 EMPTY4;
- vu16 CPRS; /* PWM Counter Prescaler Register */
- vu16 EMPTY5;
- vu16 REP; /* Repetition Counter Register */
- vu16 EMPTY6;
- vu16 CMPW; /* Compare Phase W Preload Register */
- vu16 EMPTY7;
- vu16 CMPV; /* Compare Phase V Preload Register */
- vu16 EMPTY8;
- vu16 CMPU; /* Compare Phase U Preload Register */
- vu16 EMPTY9;
- vu16 CMP0; /* Compare 0 Preload Register */
- vu16 EMPTY10;
- vu16 PCR0; /* Peripheral Control Register 0 */
- vu16 EMPTY11;
- vu16 PCR1; /* Peripheral Control Register 1 */
- vu16 EMPTY12;
- vu16 PCR2; /* Peripheral Control Register 2 */
- vu16 EMPTY13;
- vu16 PSR; /* Polarity Selection Register */
- vu16 EMPTY14;
- vu16 OPR; /* Output Peripheral Register */
- vu16 EMPTY15;
- vu16 IMR; /* Interrupt Mask Register */
- vu16 EMPTY16;
- vu16 DTG; /* Dead Time Generator Register */
- vu16 EMPTY17;
- vu16 ESC; /* Emergency Stop Clear Register */
- vu16 EMPTY18;
-}MC_TypeDef;
-
-/*------------------------------------- RTC ----------------------------------*/
-
-typedef struct
-{
- vu32 TR; /* Time Register */
- vu32 DTR; /* Date Register */
- vu32 ATR; /* Alarm time Register */
- vu32 CR; /* Control Register */
- vu32 SR; /* Status Register */
- vu32 MILR; /* Millisec Register */
-}RTC_TypeDef;
-
-/*------------------------------------- SSP ----------------------------------*/
-
-typedef struct
-{
- vu16 CR0; /* Control Register 1 */
- vu16 EMPTY1;
- vu16 CR1; /* Control Register 2 */
- vu16 EMPTY2;
- vu16 DR; /* Data Register */
- vu16 EMPTY3;
- vu16 SR; /* Status Register */
- vu16 EMPTY4;
- vu16 PR; /* Clock Prescale Register */
- vu16 EMPTY5;
- vu16 IMSCR; /* Interrupt Mask Set or Clear Register */
- vu16 EMPTY6;
- vu16 RISR; /* Raw Interrupt Status Register */
- vu16 EMPTY7;
- vu16 MISR; /* Masked Interrupt Status Register */
- vu16 EMPTY8;
- vu16 ICR; /* Interrupt Clear Register */
- vu16 EMPTY9;
- vu16 DMACR; /* DMA Control Register */
- vu16 EMPTY10;
-}SSP_TypeDef;
-
-/*------------------------------------ UART ----------------------------------*/
-
-typedef struct
-{
- vu16 DR; /* Data Register */
- vu16 EMPTY1;
- vu16 RSECR; /* Receive Status Register (read)/Error Clear Register (write) */
- vu16 EMPTY2[9];
- vu16 FR; /* Flag Register */
- vu16 EMPTY3[3];
- vu16 ILPR; /* IrDA Low-Power counter Register */
- vu16 EMPTY4;
- vu16 IBRD; /* Integer Baud Rate Divisor Register */
- vu16 EMPTY5;
- vu16 FBRD; /* Fractional Baud Rate Divisor Register */
- vu16 EMPTY6;
- vu16 LCR; /* Line Control Register, High byte */
- vu16 EMPTY7;
- vu16 CR; /* Control Register */
- vu16 EMPTY8;
- vu16 IFLS; /* Interrupt FIFO Level Select Register */
- vu16 EMPTY9;
- vu16 IMSC; /* Interrupt Mask Set/Clear Register */
- vu16 EMPTY10;
- vu16 RIS; /* Raw Interrupt Status Register */
- vu16 EMPTY11;
- vu16 MIS; /* Masked Interrupt Status Register */
- vu16 EMPTY12;
- vu16 ICR; /* Interrupt Clear Register */
- vu16 EMPTY13;
- vu16 DMACR; /* DMA Control Register */
- vu16 EMPTY14;
-}UART_TypeDef;
-
-/*------------------------------- Wake-up System -----------------------------*/
-
-typedef struct
-{
- vu32 CTRL; /* Control Register */
- vu32 MR; /* Mask Register */
- vu32 TR; /* Trigger Register */
- vu32 PR; /* Pending Register */
- vu32 INTR; /* Software Interrupt Register */
-} WIU_TypeDef;
-
-/*------------------------------- WatchDog Timer -----------------------------*/
-
-typedef struct
-{
- vu16 CR; /* Control Register */
- vu16 EMPTY1;
- vu16 PR; /* Presclar Register */
- vu16 EMPTY2;
- vu16 VR; /* Pre-load Value Register */
- vu16 EMPTY3;
- vu16 CNT; /* Counter Register */
- vu16 EMPTY4;
- vu16 SR; /* Status Register */
- vu16 EMPTY5;
- vu16 MR; /* Mask Register */
- vu16 EMPTY6;
- vu16 KR; /* Key Register */
- vu16 EMPTY7;
-} WDG_TypeDef;
-
-/*******************************************************************************
-* Memory Mapping of STR91x *
-*******************************************************************************/
-
-#define AHB_APB_BRDG0_U (0x58000000) /* AHB/APB Bridge 0 UnBuffered Space */
-#define AHB_APB_BRDG0_B (0x48000000) /* AHB/APB Bridge 0 Buffered Space */
-
-#define AHB_APB_BRDG1_U (0x5C000000) /* AHB/APB Bridge 1 UnBuffered Space */
-#define AHB_APB_BRDG1_B (0x4C000000) /* AHB/APB Bridge 1 Buffered Space */
-
-#define AHB_EMI_U (0x74000000) /* EMI UnBuffered Space */
-#define AHB_EMI_B (0x64000000) /* EMI Buffered Space */
-
-#define AHB_DMA_U (0x78000000) /* DMA UnBuffered Space */
-#define AHB_DMA_B (0x68000000) /* DMA Buffered Space */
-
-#define AHB_ENET_MAC_U (0x7C000400) /* ENET_MAC UnBuffered Space */
-#define AHB_ENET_MAC_B (0x6C000000) /* ENET_MAC Buffered Space */
-
-#define AHB_ENET_DMA_U (0x7C000000) /* ENET_DMA Unbuffered Space */
-#define AHB_ENET_DMA_B (0x6C000400) /* ENET_DMA Buffered Space */
-
-#define AHB_VIC1_U (0xFC000000) /* Secondary VIC1 UnBuffered Space */
-#define AHB_VIC0_U (0xFFFFF000) /* Primary VIC0 UnBuffered Space */
-
-#define AHB_FMI_U (0x54000000) /* FMI Unbuffered Space */
-#define AHB_FMI_B (0x44000000) /* FMI buffered Space */
-
-/*******************************************************************************
-* Addresses related to the VICs' peripherals *
-*******************************************************************************/
-
-#define VIC0_BASE (AHB_VIC0_U)
-#define VIC1_BASE (AHB_VIC1_U)
-
-/*******************************************************************************
-* Addresses related to the EMI banks *
-*******************************************************************************/
-
-#define AHB_EMIB3_OFST (0x00000040) /* Offset of EMI bank3 */
-#define AHB_EMIB2_OFST (0x00000020) /* Offset of EMI bank2 */
-#define AHB_EMIB1_OFST (0x00000000) /* Offset of EMI bank1 */
-#define AHB_EMIB0_OFST (0x000000E0) /* Offset of EMI bank0 */
-
-/*******************************************************************************
-* Addresses related to the DMA peripheral *
-*******************************************************************************/
-
-#define AHB_DMA_Channel0_OFST (0x00000100) /* Offset of Channel 0 */
-#define AHB_DMA_Channel1_OFST (0x00000120) /* Offset of Channel 1 */
-#define AHB_DMA_Channel2_OFST (0x00000140) /* Offset of Channel 2 */
-#define AHB_DMA_Channel3_OFST (0x00000160) /* Offset of Channel 3 */
-#define AHB_DMA_Channel4_OFST (0x00000180) /* Offset of Channel 4 */
-#define AHB_DMA_Channel5_OFST (0x000001A0) /* Offset of Channel 5 */
-#define AHB_DMA_Channel6_OFST (0x000001C0) /* Offset of Channel 6 */
-#define AHB_DMA_Channel7_OFST (0x000001E0) /* Offset of Channel 7 */
-
-/*******************************************************************************
-* Addresses related to the APB0 sub-system *
-*******************************************************************************/
-
-#define APB_WIU_OFST (0x00001000) /* Offset of WIU */
-#define APB_TIM0_OFST (0x00002000) /* Offset of TIM0 */
-#define APB_TIM1_OFST (0x00003000) /* Offset of TIM1 */
-#define APB_TIM2_OFST (0x00004000) /* Offset of TIM2 */
-#define APB_TIM3_OFST (0x00005000) /* Offset of TIM3 */
-#define APB_GPIO0_OFST (0x00006000) /* Offset of GPIO0 */
-#define APB_GPIO1_OFST (0x00007000) /* Offset of GPIO1 */
-#define APB_GPIO2_OFST (0x00008000) /* Offset of GPIO2 */
-#define APB_GPIO3_OFST (0x00009000) /* Offset of GPIO3 */
-#define APB_GPIO4_OFST (0x0000A000) /* Offset of GPIO4 */
-#define APB_GPIO5_OFST (0x0000B000) /* Offset of GPIO5 */
-#define APB_GPIO6_OFST (0x0000C000) /* Offset of GPIO6 */
-#define APB_GPIO7_OFST (0x0000D000) /* Offset of GPIO7 */
-#define APB_GPIO8_OFST (0x0000E000) /* Offset of GPIO8 */
-#define APB_GPIO9_OFST (0x0000F000) /* Offset of GPIO9 */
-
-/*******************************************************************************
-* Addresses related to the APB1 sub-system *
-*******************************************************************************/
-
-#define APB_RTC_OFST (0x00001000) /* Offset of RTC */
-#define APB_SCU_OFST (0x00002000) /* Offset of System Controller */
-#define APB_MC_OFST (0x00003000) /* Offset of Motor Control */
-#define APB_UART0_OFST (0x00004000) /* Offset of UART0 */
-#define APB_UART1_OFST (0x00005000) /* Offset of UART1 */
-#define APB_UART2_OFST (0x00006000) /* Offset of UART2 */
-#define APB_SSP0_OFST (0x00007000) /* Offset of SSP0 */
-#define APB_SSP1_OFST (0x00008000) /* Offset of SSPI */
-#define APB_CAN_OFST (0x00009000) /* Offset of CAN */
-#define APB_ADC_OFST (0x0000A000) /* Offset of ADC */
-#define APB_WDG_OFST (0x0000B000) /* Offset of WDG */
-#define APB_I2C0_OFST (0x0000C000) /* Offset of I2C0 */
-#define APB_I2C1_OFST (0x0000D000) /* Offset of I2C1 */
-
-/*----------------------------------------------------------------------------*/
-/*----------------------------- Unbuffered Mode ------------------------------*/
-/*----------------------------------------------------------------------------*/
-
-#ifndef Buffered
-
-/*******************************************************************************
-* AHBAPB peripheral Unbuffered Base Address *
-*******************************************************************************/
-
-#define AHBAPB0_BASE (AHB_APB_BRDG0_U)
-#define AHBAPB1_BASE (AHB_APB_BRDG1_U)
-
-/*******************************************************************************
-* ENET peripheral Unbuffered Base Address *
-*******************************************************************************/
-
-#define ENET_MAC_BASE (AHB_ENET_MAC_U)
-#define ENET_DMA_BASE (AHB_ENET_DMA_U)
-
-/*******************************************************************************
-* DMA peripheral Unbuffered Base Address *
-*******************************************************************************/
-
-#define DMA_BASE (AHB_DMA_U)
-
-/*******************************************************************************
-* EMI peripheral Unbuffered Base Address *
-*******************************************************************************/
-
-#define EMI_BASE (AHB_EMI_U)
-
-/*******************************************************************************
-* FMI peripheral Unbuffered Base Address *
-*******************************************************************************/
-
-#define FMI_BASE (AHB_FMI_U)
-
-
-#else /* Buffered */
-
-/*----------------------------------------------------------------------------*/
-/*------------------------------ Buffered Mode -------------------------------*/
-/*----------------------------------------------------------------------------*/
-
-/*******************************************************************************
-* AHBAPB peripheral Buffered Base Address *
-*******************************************************************************/
-
-#define AHBAPB0_BASE (AHB_APB_BRDG0_B)
-#define AHBAPB1_BASE (AHB_APB_BRDG1_B)
-
-/*******************************************************************************
-* ENET peripheral Unbuffered Base Address *
-*******************************************************************************/
-
-#define ENET_MAC_BASE (AHB_ENET_MAC_B)
-#define ENET_DMA_BASE (AHB_ENET_DMA_B)
-
-/*******************************************************************************
-* DMA peripheral Buffered Base Address *
-*******************************************************************************/
-
-#define DMA_BASE (AHB_DMA_B)
-
-/*******************************************************************************
-* EMI peripheral Buffered Base Address *
-*******************************************************************************/
-
-#define EMI_BASE (AHB_EMI_B)
-
-/*******************************************************************************
-* FMI peripheral Buffered Base Address *
-*******************************************************************************/
-
-#define FMI_BASE (AHB_FMI_B)
-
-#endif /* Buffered */
-
-/*******************************************************************************
-* DMA channels Base Address *
-*******************************************************************************/
-#define DMA_Channel0_BASE (DMA_BASE + AHB_DMA_Channel0_OFST)
-#define DMA_Channel1_BASE (DMA_BASE + AHB_DMA_Channel1_OFST)
-#define DMA_Channel2_BASE (DMA_BASE + AHB_DMA_Channel2_OFST)
-#define DMA_Channel3_BASE (DMA_BASE + AHB_DMA_Channel3_OFST)
-#define DMA_Channel4_BASE (DMA_BASE + AHB_DMA_Channel4_OFST)
-#define DMA_Channel5_BASE (DMA_BASE + AHB_DMA_Channel5_OFST)
-#define DMA_Channel6_BASE (DMA_BASE + AHB_DMA_Channel6_OFST)
-#define DMA_Channel7_BASE (DMA_BASE + AHB_DMA_Channel7_OFST)
-
-/*******************************************************************************
-* EMI Banks peripheral Base Address *
-*******************************************************************************/
-
-#define EMI_Bank0_BASE (EMI_BASE + AHB_EMIB0_OFST)
-#define EMI_Bank1_BASE (EMI_BASE + AHB_EMIB1_OFST)
-#define EMI_Bank2_BASE (EMI_BASE + AHB_EMIB2_OFST)
-#define EMI_Bank3_BASE (EMI_BASE + AHB_EMIB3_OFST)
-
-/*******************************************************************************
-* APB0 Peripherals' Base addresses *
-*******************************************************************************/
-
-#define WIU_BASE (AHBAPB0_BASE + APB_WIU_OFST)
-#define TIM0_BASE (AHBAPB0_BASE + APB_TIM0_OFST)
-#define TIM1_BASE (AHBAPB0_BASE + APB_TIM1_OFST)
-#define TIM2_BASE (AHBAPB0_BASE + APB_TIM2_OFST)
-#define TIM3_BASE (AHBAPB0_BASE + APB_TIM3_OFST)
-#define GPIO0_BASE (AHBAPB0_BASE + APB_GPIO0_OFST)
-#define GPIO1_BASE (AHBAPB0_BASE + APB_GPIO1_OFST)
-#define GPIO2_BASE (AHBAPB0_BASE + APB_GPIO2_OFST)
-#define GPIO3_BASE (AHBAPB0_BASE + APB_GPIO3_OFST)
-#define GPIO4_BASE (AHBAPB0_BASE + APB_GPIO4_OFST)
-#define GPIO5_BASE (AHBAPB0_BASE + APB_GPIO5_OFST)
-#define GPIO6_BASE (AHBAPB0_BASE + APB_GPIO6_OFST)
-#define GPIO7_BASE (AHBAPB0_BASE + APB_GPIO7_OFST)
-#define GPIO8_BASE (AHBAPB0_BASE + APB_GPIO8_OFST)
-#define GPIO9_BASE (AHBAPB0_BASE + APB_GPIO9_OFST)
-
-/*******************************************************************************
-* APB1 Peripherals' Base addresses *
-*******************************************************************************/
-
-#define RTC_BASE (AHBAPB1_BASE + APB_RTC_OFST)
-#define SCU_BASE (AHBAPB1_BASE + APB_SCU_OFST)
-#define MC_BASE (AHBAPB1_BASE + APB_MC_OFST)
-#define UART0_BASE (AHBAPB1_BASE + APB_UART0_OFST)
-#define UART1_BASE (AHBAPB1_BASE + APB_UART1_OFST)
-#define UART2_BASE (AHBAPB1_BASE + APB_UART2_OFST)
-#define SSP0_BASE (AHBAPB1_BASE + APB_SSP0_OFST)
-#define SSP1_BASE (AHBAPB1_BASE + APB_SSP1_OFST)
-#define CAN_BASE (AHBAPB1_BASE + APB_CAN_OFST)
-#define ADC_BASE (AHBAPB1_BASE + APB_ADC_OFST)
-#define WDG_BASE (AHBAPB1_BASE + APB_WDG_OFST)
-#define I2C0_BASE (AHBAPB1_BASE + APB_I2C0_OFST)
-#define I2C1_BASE (AHBAPB1_BASE + APB_I2C1_OFST)
-
-/*******************************************************************************
-* IPs' declaration *
-*******************************************************************************/
-
-/*------------------------------ Non Debug Mode ------------------------------*/
-#undef DEBUG
-#ifndef DEBUG
-
-/*********************************** AHBAPB ***********************************/
-
-#define AHBAPB0 ((AHBAPB_TypeDef *)AHBAPB0_BASE)
-#define AHBAPB1 ((AHBAPB_TypeDef *)AHBAPB1_BASE)
-
-/************************************* EMI ************************************/
-
-#define EMI ((EMI_TypeDef *)EMI_BASE)
-
-/************************************* DMA ************************************/
-
-#define DMA ((DMA_TypeDef *)DMA_BASE)
-#define DMA_Channel0 ((DMA_Channel_TypeDef *)DMA_Channel0_BASE)
-#define DMA_Channel1 ((DMA_Channel_TypeDef *)DMA_Channel1_BASE)
-#define DMA_Channel2 ((DMA_Channel_TypeDef *)DMA_Channel2_BASE)
-#define DMA_Channel3 ((DMA_Channel_TypeDef *)DMA_Channel3_BASE)
-#define DMA_Channel4 ((DMA_Channel_TypeDef *)DMA_Channel4_BASE)
-#define DMA_Channel5 ((DMA_Channel_TypeDef *)DMA_Channel5_BASE)
-#define DMA_Channel6 ((DMA_Channel_TypeDef *)DMA_Channel6_BASE)
-#define DMA_Channel7 ((DMA_Channel_TypeDef *)DMA_Channel7_BASE)
-
-/************************************* EMI ************************************/
-
-#define EMI_Bank0 ((EMI_Bank_TypeDef *)EMI_Bank0_BASE)
-#define EMI_Bank1 ((EMI_Bank_TypeDef *)EMI_Bank1_BASE)
-#define EMI_Bank2 ((EMI_Bank_TypeDef *)EMI_Bank2_BASE)
-#define EMI_Bank3 ((EMI_Bank_TypeDef *)EMI_Bank3_BASE)
-
-/************************************* ENET_MAC ************************************/
-
-#define ENET_MAC ((ENET_MAC_TypeDef *)ENET_MAC_BASE)
-
-/************************************* ENET_DMA ************************************/
-
-#define ENET_DMA ((ENET_DMA_TypeDef *)ENET_DMA_BASE)
-
-/************************************* FMI ************************************/
-
-#define FMI ((FMI_TypeDef *)FMI_BASE)
-
-/************************************* VIC ************************************/
-
-#define VIC0 ((VIC_TypeDef *)VIC0_BASE)
-#define VIC1 ((VIC_TypeDef *)VIC1_BASE)
-
-/*******************************************************************************
-* APB0 Peripherals' *
-*******************************************************************************/
-#define WIU ((WIU_TypeDef *)WIU_BASE)
-#define TIM0 ((TIM_TypeDef *)TIM0_BASE)
-#define TIM1 ((TIM_TypeDef *)TIM1_BASE)
-#define TIM2 ((TIM_TypeDef *)TIM2_BASE)
-#define TIM3 ((TIM_TypeDef *)TIM3_BASE)
-#define GPIO0 ((GPIO_TypeDef *)GPIO0_BASE)
-#define GPIO1 ((GPIO_TypeDef *)GPIO1_BASE)
-#define GPIO2 ((GPIO_TypeDef *)GPIO2_BASE)
-#define GPIO3 ((GPIO_TypeDef *)GPIO3_BASE)
-#define GPIO4 ((GPIO_TypeDef *)GPIO4_BASE)
-#define GPIO5 ((GPIO_TypeDef *)GPIO5_BASE)
-#define GPIO6 ((GPIO_TypeDef *)GPIO6_BASE)
-#define GPIO7 ((GPIO_TypeDef *)GPIO7_BASE)
-#define GPIO8 ((GPIO_TypeDef *)GPIO8_BASE)
-#define GPIO9 ((GPIO_TypeDef *)GPIO9_BASE)
-/*******************************************************************************
-* APB1 Peripherals' *
-*******************************************************************************/
-#define RTC ((RTC_TypeDef *)RTC_BASE)
-#define SCU ((SCU_TypeDef *)SCU_BASE)
-#define MC ((MC_TypeDef *)MC_BASE)
-#define UART0 ((UART_TypeDef *)UART0_BASE)
-#define UART1 ((UART_TypeDef *)UART1_BASE)
-#define UART2 ((UART_TypeDef *)UART2_BASE)
-#define SSP0 ((SSP_TypeDef *)SSP0_BASE)
-#define SSP1 ((SSP_TypeDef *)SSP1_BASE)
-#define CAN ((CAN_TypeDef *)CAN_BASE)
-#define ADC ((ADC_TypeDef *)ADC_BASE)
-#define WDG ((WDG_TypeDef *)WDG_BASE)
-#define I2C0 ((I2C_TypeDef *)I2C0_BASE)
-#define I2C1 ((I2C_TypeDef *)I2C1_BASE)
-#define ENET_MAC ((ENET_MAC_TypeDef *)ENET_MAC_BASE)
-#define ENET_DMA ((ENET_DMA_TypeDef *)ENET_DMA_BASE)
-
-#else /* DEBUG */
-
-/*-------------------------------- Debug Mode --------------------------------*/
-
-EXT AHBAPB_TypeDef *AHBAPB0;
-EXT AHBAPB_TypeDef *AHBAPB1;
-EXT DMA_TypeDef *DMA;
-EXT DMA_Channel_TypeDef *DMA_Channel0;
-EXT DMA_Channel_TypeDef *DMA_Channel1;
-EXT DMA_Channel_TypeDef *DMA_Channel2;
-EXT DMA_Channel_TypeDef *DMA_Channel3;
-EXT DMA_Channel_TypeDef *DMA_Channel4;
-EXT DMA_Channel_TypeDef *DMA_Channel5;
-EXT DMA_Channel_TypeDef *DMA_Channel6;
-EXT DMA_Channel_TypeDef *DMA_Channel7;
-EXT EMI_Bank_TypeDef *EMI_Bank0;
-EXT EMI_Bank_TypeDef *EMI_Bank1;
-EXT EMI_Bank_TypeDef *EMI_Bank2;
-EXT EMI_Bank_TypeDef *EMI_Bank3;
-EXT FMI_TypeDef *FMI;
-EXT VIC_TypeDef *VIC0;
-EXT VIC_TypeDef *VIC1;
-EXT WIU_TypeDef *WIU;
-EXT TIM_TypeDef *TIM0;
-EXT TIM_TypeDef *TIM1;
-EXT TIM_TypeDef *TIM2;
-EXT TIM_TypeDef *TIM3;
-EXT GPIO_TypeDef *GPIO0;
-EXT GPIO_TypeDef *GPIO1;
-EXT GPIO_TypeDef *GPIO2;
-EXT GPIO_TypeDef *GPIO3;
-EXT GPIO_TypeDef *GPIO4;
-EXT GPIO_TypeDef *GPIO5;
-EXT GPIO_TypeDef *GPIO6;
-EXT GPIO_TypeDef *GPIO7;
-EXT GPIO_TypeDef *GPIO8;
-EXT GPIO_TypeDef *GPIO9;
-EXT RTC_TypeDef *RTC;
-EXT SCU_TypeDef *SCU;
-EXT MC_TypeDef *MC;
-EXT UART_TypeDef *UART0;
-EXT UART_TypeDef *UART1;
-EXT UART_TypeDef *UART2;
-EXT SSP_TypeDef *SSP0;
-EXT SSP_TypeDef *SSP1;
-EXT CAN_TypeDef *CAN;
-EXT ADC_TypeDef *ADC;
-EXT WDG_TypeDef *WDG;
-EXT I2C_TypeDef *I2C0;
-EXT I2C_TypeDef *I2C1;
-EXT ENET_MAC_TypeDef *ENET_MAC;
-EXT ENET_DMA_TypeDef *ENET_DMA;
-
-
-#endif /* DEBUG */
-
-#endif /* __91x_MAP_H*/
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
-
diff --git a/uc_str912/prj_test_lcd/include/91x_scu.h b/uc_str912/prj_test_lcd/include/91x_scu.h
deleted file mode 100644
index b9d04f5..0000000
--- a/uc_str912/prj_test_lcd/include/91x_scu.h
+++ /dev/null
@@ -1,196 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_scu.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides the SCU library software functions
-* prototypes & definitions
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __91x_SCU_H
-#define __91x_SCU_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_map.h"
-
-/* Exported constants --------------------------------------------------------*/
-
-/*MCLK_Source*/
-#define SCU_MCLK_PLL 0x0
-#define SCU_MCLK_RTC 0x1
-#define SCU_MCLK_OSC 0x2
-
-/*RCLK_Divisor*/
-#define SCU_RCLK_Div1 0xFFFFFFE3
-#define SCU_RCLK_Div2 0x4
-#define SCU_RCLK_Div4 0x8
-#define SCU_RCLK_Div8 0xC
-#define SCU_RCLK_Div16 0x10
-#define SCU_RCLK_Div1024 0x14
-
-/*HCLK_Divisor*/
-#define SCU_HCLK_Div1 0xFFFFFF9F
-#define SCU_HCLK_Div2 0x20
-#define SCU_HCLK_Div4 0x40
-
-/*PCLK_Divisor*/
-#define SCU_PCLK_Div1 0xFFFFFE7F
-#define SCU_PCLK_Div2 0x80
-#define SCU_PCLK_Div4 0x100
-#define SCU_PCLK_Div8 0x180
-
-/*FMICLK_Divisor*/
-#define SCU_FMICLK_Div1 0xFFFEFFFF
-#define SCU_FMICLK_Div2 0x10000
-
-/*BRCLK_Divisor*/
-#define SCU_BRCLK_Div1 0xFFFFFDFF
-#define SCU_BRCLK_Div2 0x200
-
-/*TIMCLK_Source*/
-#define SCU_TIMCLK_EXT 0x1
-#define SCU_TIMCLK_INT 0x0
-
-/*TIMx*/
-#define SCU_TIM01 0x0
-#define SCU_TIM23 0x1
-
-
-/*USBCLK_Source*/
-#define SCU_USBCLK_MCLK 0xFFFFF3FF
-#define SCU_USBCLK_MCLK2 0x400
-#define SCU_USBCLK_EXT 0x800
-
-/*SCU_EMIBCLK*/
-#define SCU_EMIBCLK_Div1 0xFFF9FFFF
-#define SCU_EMIBCLK_Div2 0x20000
-
-/*SCU_EMIMODE*/
-#define SCU_EMI_MUX 0xFFFFFFBF
-#define SCU_EMI_DEMUX 0x40
-
-/*SCU_EMIALE_LEN*/
-#define SCU_EMIALE_LEN1 0xFFFFFEFF
-#define SCU_EMIALE_LEN2 0x100
-
-/*SCU_EMIALE_POL*/
-#define SCU_EMIALE_POLLow 0xFFFFFF7F
-#define SCU_EMIALE_POLHigh 0x80
-
-/*UART_IrDA_Mode*/
-#define SCU_UARTMode_IrDA 0x1
-#define SCU_UARTMode_UART 0x0
-
-/*APBPeriph*/
-#define __TIM01 0x1
-#define __TIM23 0x2
-#define __MC 0x4
-#define __UART0 0x8
-#define __UART1 0x10
-#define __UART2 0x20
-#define __I2C0 0x40
-#define __I2C1 0x80
-#define __SSP0 0x100
-#define __SSP1 0x200
-#define __CAN 0x400
-#define __ADC 0x800
-#define __WDG 0x1000
-#define __WIU 0x2000
-#define __GPIO0 0x4000
-#define __GPIO1 0x8000
-#define __GPIO2 0x10000
-#define __GPIO3 0x20000
-#define __GPIO4 0x40000
-#define __GPIO5 0x80000
-#define __GPIO6 0x100000
-#define __GPIO7 0x200000
-#define __GPIO8 0x400000
-#define __GPIO9 0x800000
-#define __RTC 0x1000000
-
-/*AHBPeriph*/
-#define __FMI 0x1
-#define __FPQBC 0x2
-#define __SRAM 0x8
-#define __SRAM_ARBITER 0x10
-#define __VIC 0x20
-#define __EMI 0x40
-#define __EMI_MEM_CLK 0x80
-#define __DMA 0x100
-#define __USB 0x200
-#define __USB48M 0x400
-#define __ENET 0x800
-#define __PFQBC_AHB 0x1000
-
-/*SCU_IT*/
-#define SCU_IT_LVD_RST 0x10
-#define SCU_IT_SRAM_ERROR 0x8
-#define SCU_IT_ACK_PFQBC 0x4
-#define SCU_IT_LOCK_LOST 0x2
-#define SCU_IT_LOCK 0x1
-
-/*SCU_FLAG*/
-#define SCU_FLAG_SRAM_ERROR 0x20
-#define SCU_FLAG_ACK_PFQBC 0x10
-#define SCU_FLAG_LVD_RESET 0x8
-#define SCU_FLAG_WDG_RST 0x4
-#define SCU_FLAG_LOCK_LOST 0x2
-#define SCU_FLAG_LOCK 0x1
-
-
-/* Module private variables --------------------------------------------------*/
-/* Exported macro ------------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-ErrorStatus SCU_MCLKSourceConfig(u32 MCLK_Source);
-ErrorStatus SCU_PLLFactorsConfig(u8 PLLN, u8 PLLM, u8 PLLP);
-ErrorStatus SCU_PLLCmd(FunctionalState NewState);
-void SCU_RCLKDivisorConfig(u32 RCLK_Divisor);
-void SCU_HCLKDivisorConfig(u32 HCLK_Divisor);
-void SCU_PCLKDivisorConfig(u32 PCLK_Divisor);
-void SCU_APBPeriphClockConfig(u32 APBPeriph, FunctionalState NewState);
-void SCU_AHBPeriphClockConfig(u32 AHBPeriph, FunctionalState NewState);
-void SCU_APBPeriphReset(u32 APBPeriph, FunctionalState NewState);
-void SCU_AHBPeriphReset(u32 AHBPeriph, FunctionalState NewState);
-void SCU_APBPeriphIdleConfig(u32 APBPeriph, FunctionalState NewState);
-void SCU_AHBPeriphIdleConfig(u32 AHBPeriph, FunctionalState NewState);
-void SCU_APBPeriphDebugConfig(u32 APBPeriph, FunctionalState NewState);
-void SCU_AHBPeriphDebugConfig(u32 AHBPeriph, FunctionalState NewState);
-void SCU_BRCLKDivisorConfig(u32 BRCLK_Divisor);
-void SCU_TIMCLKSourceConfig(u8 TIMx, u32 TIMCLK_Source);
-void SCU_TIMPresConfig(u8 TIMx, u16 Prescaler);
-void SCU_USBCLKConfig(u32 USBCLK_Source);
-void SCU_PHYCLKConfig(FunctionalState NewState);
-void SCU_FMICLKDivisorConfig(u32 FMICLK_Divisor);
-void SCU_EMIBCLKDivisorConfig(u32 SCU_EMIBCLK);
-void SCU_EMIModeConfig(u32 SCU_EMIMODE);
-void SCU_EMIALEConfig(u32 SCU_EMIALE_LEN, u32 SCU_EMIALE_POL);
-void SCU_ITConfig(u32 SCU_IT, FunctionalState NewState);
-FlagStatus SCU_GetFlagStatus(u32 SCU_Flag);
-void SCU_ClearFlag(u32 SCU_Flag);
-u32 SCU_GetPLLFreqValue(void);
-u32 SCU_GetMCLKFreqValue(void);
-u32 SCU_GetRCLKFreqValue(void);
-u32 SCU_GetHCLKFreqValue(void);
-u32 SCU_GetPCLKFreqValue(void);
-void SCU_WakeUpLineConfig(u8 EXTint);
-void SCU_SpecIntRunModeConfig(FunctionalState NewState);
-void SCU_EnterIdleMode(void);
-void SCU_EnterSleepMode(void);
-void SCU_UARTIrDASelect(UART_TypeDef * UARTx, u8 UART_IrDA_Mode);
-void SCU_PFQBCCmd(FunctionalState NewState);
-
-#endif /*__91x_SCU_H*/
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_test_lcd/include/91x_type.h b/uc_str912/prj_test_lcd/include/91x_type.h
deleted file mode 100644
index 916d81c..0000000
--- a/uc_str912/prj_test_lcd/include/91x_type.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_type.h
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : It contains common types and constants used in all the
-* peripherals' drivers.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-**********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*********************************************************************************/
-
-#ifndef __91x_type_H
-#define __91x_type_H
-
- typedef long long u64;
- typedef unsigned long u32;
- typedef unsigned short u16;
- typedef unsigned char u8;
-
- typedef signed long s32;
- typedef signed short s16;
- typedef signed char s8;
-
- typedef volatile unsigned long vu32;
- typedef volatile unsigned short vu16;
- typedef volatile unsigned char vu8;
-
- typedef volatile signed long vs32;
- typedef volatile signed short vs16;
- typedef volatile signed char vs8;
-
-typedef enum { FALSE = 0, TRUE = !FALSE } bool;
-
-typedef enum { RESET = 0, SET = !RESET } FlagStatus, ITStatus;
-
-typedef enum { DISABLE = 0, ENABLE = !DISABLE} FunctionalState;
-
-typedef enum { ERROR = 0, SUCCESS = !ERROR} ErrorStatus;
-
-#endif /* __91x_type_H */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_test_lcd/include/char_code.h b/uc_str912/prj_test_lcd/include/char_code.h
deleted file mode 100644
index 51775e3..0000000
--- a/uc_str912/prj_test_lcd/include/char_code.h
+++ /dev/null
@@ -1,79 +0,0 @@
-#ifndef char_code
-#define char_code
-
-#define A 65
-#define B 66
-#define C 67
-#define D 68
-#define E 69
-#define F 70
-#define G 71
-#define H 72
-#define I 73
-#define J 74
-#define K 75
-#define L 76
-#define M 77
-#define N 78
-#define O 79
-#define P 80
-#define Q 81
-#define R 82
-#define S 83
-#define T 84
-#define U 85
-#define V 86
-#define W 87
-#define X 88
-#define Y 89
-#define Z 90
-
-#define a 97
-#define b 98
-#define c 99
-#define d 100
-#define e 101
-#define f 102
-#define g 103
-#define h 104
-#define i 105
-#define j 106
-#define k 107
-#define l 108
-#define m 109
-#define n 110
-#define o 111
-#define p 112
-#define q 113
-#define r 114
-#define s 115
-#define t 116
-#define u 117
-#define v 118
-#define w 119
-#define x 120
-#define y 121
-#define z 122
-
-/*
-#define . 46
-#define , 44
-#define - 45
-#define ( 40
-#define ) 41
-#define [ 91
-#define ] 93
-#define { 123
-#define } 125
-#define : 58
-#define ; 59
-#define ! 33
-#define % 37
-#define * 42
-#define + 43
-#define = 61
-*/
-
-#define space 32
-
-#endif
diff --git a/uc_str912/prj_test_lcd/include/lcd_lib_91x.h b/uc_str912/prj_test_lcd/include/lcd_lib_91x.h
deleted file mode 100644
index bdc4fdb..0000000
--- a/uc_str912/prj_test_lcd/include/lcd_lib_91x.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/******************** (C) COPYRIGHT 2007 PROPOX ********************************
-* File Name : lcd_lib_91x.h
-* Author : PROPOX Team
-* Date First Issued : 09/24/2007 : Version 1.0
-* Description : This file provides all the 2x16 LCD functions.
-********************************************************************************
-* History:
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, PROPOX SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT OR
-* CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Define to prevent recursive inclusion ------------------------------------ */
-#ifndef _lcd_lib_91x_H
-#define _lcd_lib_91x_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_lib.h"
-#include "91x_gpio.h"
-
-/* Private Definision */
-#define D7_set GPIO_WriteBit(GPIO8, GPIO_Pin_3, Bit_SET)
-#define D6_set GPIO_WriteBit(GPIO8, GPIO_Pin_2, Bit_SET)
-#define D5_set GPIO_WriteBit(GPIO8, GPIO_Pin_1, Bit_SET)
-#define D4_set GPIO_WriteBit(GPIO8, GPIO_Pin_0, Bit_SET)
-
-#define D7_reset GPIO_WriteBit(GPIO8, GPIO_Pin_3, Bit_RESET)
-#define D6_reset GPIO_WriteBit(GPIO8, GPIO_Pin_2, Bit_RESET)
-#define D5_reset GPIO_WriteBit(GPIO8, GPIO_Pin_1, Bit_RESET)
-#define D4_reset GPIO_WriteBit(GPIO8, GPIO_Pin_0, Bit_RESET)
-
-#define RS_set GPIO_WriteBit(GPIO8, GPIO_Pin_4, Bit_SET)
-#define E_set GPIO_WriteBit(GPIO8, GPIO_Pin_5, Bit_SET)
-
-#define RS_reset GPIO_WriteBit(GPIO8, GPIO_Pin_4, Bit_RESET)
-#define E_reset GPIO_WriteBit(GPIO8, GPIO_Pin_5, Bit_RESET)
-
-void delay(int time);
-void LCDinit(void);
-void LCDsendChar(u8 ch);
-void LCDsendCommand(u8 cmd);
-void LCDclr(void);
-void LCDhome(void);
-void LCDstring(u8* data, u8 nBytes);
-void LCDGotoXY(u8 row, u8 column);
-void LCDshiftLeft(u8 right);
-void LCDshiftRight(u8 left);
-void LCDcursorOn(void);
-void LCDcursorOnBlink(void);
-void LCDcursorOFF(void);
-void LCDblank(void);
-void LCDvisible(void);
-void LCDcursorLeft(u8 left);
-void LCDcursorRight(u8 right);
-
-#endif /* _lcd_lib_91x_H */
-
-
-/******************* (C) COPYRIGHT 2007 PROPOX *****END OF FILE****/
diff --git a/uc_str912/prj_test_lcd/include/vectors.h b/uc_str912/prj_test_lcd/include/vectors.h
deleted file mode 100644
index d48e61f..0000000
--- a/uc_str912/prj_test_lcd/include/vectors.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/***********************************************************************************
-* Copyright 2005 Anglia Design
-* This demo code and associated components are provided as is and has no warranty,
-* implied or otherwise. You are free to use/modify any of the provided
-* code at your own risk in your applications with the expressed limitation
-* of liability (see below)
-*
-* LIMITATION OF LIABILITY: ANGLIA OR ANGLIA DESIGNS SHALL NOT BE LIABLE FOR ANY
-* LOSS OF PROFITS, LOSS OF USE, LOSS OF DATA, INTERRUPTION OF BUSINESS, NOR FOR
-* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND WHETHER UNDER
-* THIS AGREEMENT OR OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-*
-* Author : Spencer Oliver
-* Web : www.anglia-designs.com
-*
-***********************************************************************************/
-
-#ifndef _VECTOR_H
-#define _VECTOR_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void Undefined_Handler(void);
-void FIQ_Handler(void);
-void SWI_Handler(void);
-void Prefetch_Handler(void);
-void Abort_Handler(void);
-void WDG_IRQHandler(void);
-void SW_IRQHandler(void);
-void ARMRX_IRQHandler(void);
-void ARMTX_IRQHandler(void);
-void TIM0_IRQHandler(void);
-void TIM1_IRQHandler(void);
-void TIM2_IRQHandler(void);
-void TIM3_IRQHandler(void);
-void USBHP_IRQHandler(void);
-void USBLP_IRQHandler(void);
-void SCU_IRQHandler(void);
-void ENET_IRQHandler(void);
-void DMA_IRQHandler(void);
-void CAN_IRQHandler(void);
-void MC_IRQHandler(void);
-void ADC_IRQHandler(void);
-void UART0_IRQHandler(void);
-void UART1_IRQHandler(void);
-void UART2_IRQHandler(void);
-void I2C0_IRQHandler(void);
-void I2C1_IRQHandler(void);
-void SSP0_IRQHandler(void);
-void SSP1_IRQHandler(void);
-void LVD_IRQHandler(void);
-void RTC_IRQHandler(void);
-void WIU_IRQHandler(void);
-void EXTIT0_IRQHandler(void);
-void EXTIT1_IRQHandler(void);
-void EXTIT2_IRQHandler(void);
-void EXTIT3_IRQHandler(void);
-void USBWU_IRQHandler(void);
-void PFQBC_IRQHandler(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //_VECTOR_H
diff --git a/uc_str912/prj_test_lcd/load_amontec.gdb b/uc_str912/prj_test_lcd/load_amontec.gdb
deleted file mode 100644
index 8767ed9..0000000
--- a/uc_str912/prj_test_lcd/load_amontec.gdb
+++ /dev/null
@@ -1,15 +0,0 @@
-set complaints 1
-set output-radix 16
-set input-radix 16
-set prompt (arm-gdb)
-
-set remote hardware-breakpoint-limit 2
-set remote hardware-watchpoint-limit 2
-
-target remote localhost:3333
-
-monitor reset init
-monitor halt
-
-load lcd.elf
-file lcd.elf
diff --git a/uc_str912/prj_test_lcd/load_segger.gdb b/uc_str912/prj_test_lcd/load_segger.gdb
deleted file mode 100644
index cd9fd7e..0000000
--- a/uc_str912/prj_test_lcd/load_segger.gdb
+++ /dev/null
@@ -1,20 +0,0 @@
-set complaints 1
-set output-radix 16
-set input-radix 16
-set prompt (arm-gdb)
-
-target remote localhost:2331
-
-monitor speed adaptive
-monitor endian little
-
-monitor reset
-monitor flash device = STR912FAW44
-monitor flash breakpoints = 1
-monitor flash download = 1
-monitor halt
-
-
-pwd
-load lcd.elf
-file lcd.elf
diff --git a/uc_str912/prj_test_lcd/src/lcd.c b/uc_str912/prj_test_lcd/src/lcd.c
deleted file mode 100644
index 9eae1c1..0000000
--- a/uc_str912/prj_test_lcd/src/lcd.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/******************************************************************************
- * www.propox.com
- * MMstr912 - Minimodu³ Ethernetowy z procesorem ARM9 STR912.
- * Ethernet minimodule with ARM9 STR912 microcontroller.
- *
- * LCD Test - wyswietla tekst 'www.propox.com' na LCD
- * put text 'www.propox.com' on LCD
- *
- * P8.0, P8.1, P8.2, P8.3 - D4, D5, D6, D7
- * P8.4, P8.5 - RS, E
-
- * Includes ------------------------------------------------------------------*/
-/* Pliki nag³ówkowe ----------------------------------------------------------*/
-/* Library includes. */
-#include "91x_lib.h"
-#include "91x_gpio.h"
-#include "91x_map.h"
-#include "91x_scu.h"
-#include "char_code.h"
-#include "lcd_lib_91x.h"
-
-//#include <targets/STR912FW44.h> rem BLa
-
-/* Hardware Configuration */
-/* Konfiguracja sprzetu */
-void HardwareConf(void)
-{
- //Main clock as exesternal oscillator 25MHz
- //G³ówny zegar to kwarc 25MHz
- SCU_MCLKSourceConfig(SCU_MCLK_OSC);
- //Disable reset for GPIO8
- //wylaczenie resetu na GPIO8
- SCU_APBPeriphReset(__GPIO8, DISABLE);
- //Enable clock for GPIO8
- //W³¹czenie zegara na GPIO8
- SCU_APBPeriphClockConfig(__GPIO8, ENABLE);
-}
-
-
-/* Ports Configuration */
-/* Konfiguracja protow */
-void LCD_DataLinesConfig()
-{
- /* Private typedef */
- /* Deklaracja struktury */
- GPIO_InitTypeDef GPIO_InitStructure;
-
- /* Configure D7~D4 data lines in Output Push-Pull mode */
- /* Konfiguracja lini portu 8 jako wyjsc D7-D4 w trybie push-pull */
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | GPIO_Pin_4 | GPIO_Pin_5;
- GPIO_InitStructure.GPIO_Alternate = GPIO_OutputAlt1;
- GPIO_InitStructure.GPIO_Direction = GPIO_PinOutput;
- GPIO_InitStructure.GPIO_Type = GPIO_Type_PushPull;
- GPIO_Init(GPIO8, &GPIO_InitStructure);
-
-}
-
-
-int main()
-{
-u8 web[] = "www.propox.com";
-u8 title[] = "MMstr912";
-
-//Hardware Configuration
-//Konfiguracja sprzetu
-HardwareConf();
-//Ports Configuration
-//Konfiguracja portow
-LCD_DataLinesConfig();
-
-LCDinit();
-LCDcursorOFF();
-LCDGotoXY(0,0);
-LCDstring(web,14);
-delay(250000);
-LCDGotoXY(3,1);
-LCDstring(title,8);
-
-while(1)
-{
- delay(500000);
- LCDshiftLeft(1);
- delay(100000);
- LCDshiftLeft(1);
-
- delay(500000);
- LCDshiftRight(1);
- delay(100000);
- LCDshiftRight(1);
-}
-
-return 0;
-}
diff --git a/uc_str912/prj_test_lcd/src/lcd_lib_91x.c b/uc_str912/prj_test_lcd/src/lcd_lib_91x.c
deleted file mode 100644
index 7c01f53..0000000
--- a/uc_str912/prj_test_lcd/src/lcd_lib_91x.c
+++ /dev/null
@@ -1,455 +0,0 @@
-/******************** (C) COPYRIGHT 2007 PROPOX ********************************
-* File Name : lcd_lib_91x.c
-* Author : PROPOX Team
-* Date First Issued : 09/24/2007 : Version 1.0
-* Description : This file provides all the 2x16 LCD functions.
-********************************************************************************
-* History:
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, PROPOX SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT OR
-* CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_lib.h"
-#include "91x_gpio.h"
-#include "91x_map.h"
-#include "91x_scu.h"
-#include "lcd_lib_91x.h"
-
-
-/*******************************************************************************
-* Function Name : delay
-* Description : Delay (opoznienie)
-*
-* Input : time - number of cycles
-* Output : None
-* Return : None
-*******************************************************************************/
-void delay(int time)
-{
- while(time--)
- asm volatile ("nop");
-}
-
-/*******************************************************************************
-* Function Name : LCDinit
-* Description : Inicialize LCD (Inicjalizacja LCD)
-* (4 bit data, 2 lines, characters 5x7, blinking cursor on)
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void LCDinit(void)
-{
- GPIO_Write(GPIO8, 0x00);
- delay(375000); //15ms
- //--------- Write 0x03 -----------
- D7_reset;
- D6_reset;
- D5_set;
- D4_set;
- E_set;
- delay(25000); //1ms
- E_reset;
- delay(125000); //5ms
- //--------- Write 0x03 -----------
- D7_reset;
- D6_reset;
- D5_set;
- D4_set;
- E_set;
- delay(25000); //1ms
- E_reset;
- delay(25000); //1ms
- //--------- Write 0x03 -----------
- D7_reset;
- D6_reset;
- D5_set;
- D4_set;
- E_set;
- delay(25000); //1ms
- E_reset;
- delay(25000); //1ms
- //--------- Enable Four Bit Mode ----------
- D7_reset;
- D6_reset;
- D5_set;
- D4_reset;
- E_set;
- delay(25000); //1ms
- E_reset;
- delay(25000); //1ms
- //---------- Set Interface Length ----------
- //Write 0x2 - 4 bits
- D7_reset;
- D6_reset;
- D5_set;
- D4_reset;
- E_set;
- delay(25000); //1ms
- E_reset;
- delay(25000); //1ms
- //Write 0x8 - 2 lines, 5x7
- D7_set;
- D6_reset;
- D5_reset;
- D4_reset;
- E_set;
- delay(25000); //1ms
- E_reset;
- delay(25000); //1ms
- //---------- Turn off the Display ----------
- //Write 0x0
- D7_reset;
- D6_reset;
- D5_reset;
- D4_reset;
- E_set;
- delay(25000); //1ms
- E_reset;
- delay(25000); //1ms
- //Write 0x8
- D7_set;
- D6_reset;
- D5_reset;
- D4_reset;
- E_set;
- delay(25000); //1ms
- E_reset;
- delay(25000); //1ms
- //------------ Clear the Display -----------
- //Write 0x0
- D7_reset;
- D6_reset;
- D5_reset;
- D4_reset;
- E_set;
- delay(25000); //1ms
- E_reset;
- delay(25000); //1ms
- //Write 0x1
- D7_reset;
- D6_reset;
- D5_reset;
- D4_set;
- E_set;
- delay(25000); //1ms
- E_reset;
- delay(25000); //1ms
- //-------- Set Cursor Move Direction --------
- //Write 0x0
- D7_reset;
- D6_reset;
- D5_reset;
- D4_reset;
- E_set;
- delay(25000); //1ms
- E_reset;
- delay(25000); //1ms
- //Write 0x6 - Increment the Cursor
- D7_reset;
- D6_set;
- D5_set;
- D4_reset;
- E_set;
- delay(25000); //1ms
- E_reset;
- delay(25000); //1ms
- //---------- Enable Display/Cursor ----------
- //Write 0x0
- D7_reset;
- D6_reset;
- D5_reset;
- D4_reset;
- E_set;
- delay(25000); //1ms
- E_reset;
- delay(25000); //1ms
- //Write 0xF - Display on, cursor on, blink on
- D7_set;
- D6_set;
- D5_set;
- D4_set;
- E_set;
- delay(25000); //1ms
- E_reset;
- delay(25000); //1ms
-}
-
-/*******************************************************************************
-* Function Name : LCDsendChar
-* Description : Send Char to LCD (Wyslanie znaku na LCD)
-*
-* Input : ch - is a ascii code of character or char from char_code.h
-* Output : None
-* Return : None
-*******************************************************************************/
-void LCDsendChar(u8 ch)
-{
- //4 MSB bits
- //4 starsze bity
- GPIO_Write(GPIO8, (ch>>4) & 0x0f);
- RS_set;
- E_set;
- delay(25000);
- E_reset;
- delay(25000);
- //4 LSB bits
- //4 mlodsze bity
- GPIO_Write(GPIO8, ch & 0x0f);
- RS_set;
- E_set;
- delay(25000);
- E_reset;
- delay(25000);
-}
-
-/*******************************************************************************
-* Function Name : LCDsendCommand
-* Description : Send Command to LCD (Wyslanie rozkazu do LCD)
-*
-* Input : cmd - is a ascii code of command
-* Output : None
-* Return : None
-*******************************************************************************/
-void LCDsendCommand(u8 cmd)
-{
- //4 MSB bits
- //4 starsze bity
- GPIO_Write(GPIO8, (cmd>>4) & 0x0f);
- RS_reset;
- E_set;
- delay(25000);
- E_reset;
- delay(25000);
- //4 LSB bits
- //4 mlodsze bity
- GPIO_Write(GPIO8, cmd & 0x0f);
- RS_reset;
- E_set;
- delay(25000);
- E_reset;
- delay(25000);
-}
-
-/*******************************************************************************
-* Function Name : LCDclr
-* Description : Clear LCD (Czyszczenie LCD)
-*
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void LCDclr(void)
-{
- LCDsendCommand(0x01);
-}
-
-/*******************************************************************************
-* Function Name : LCDhome
-* Description : LCD cursor home (Przesuniecie kursora na pozycje poczatkowa)
-*
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void LCDhome(void)
-{
- LCDsendCommand(0x02);
-}
-
-/*******************************************************************************
-* Function Name : LCDstring
-* Description : Outputs string to LCD (Wyswietl ciag znakow na LCD)
-*
-* Input : data - pointer to start of table, nBytes - nuber of bytes to send
-* Output : None
-* Return : None
-*******************************************************************************/
-void LCDstring(u8* data, u8 nBytes)
-{
- u8 count;
- //check to make sure we have a good pointer
- //sprawdzenie zgodnosci wskaznika
- if (!data) return;
-
- //print data
- //wyswietl znaki
- for(count=0; count<nBytes; count++)
- {
- LCDsendChar(data[count]);
- }
-}
-
-/*******************************************************************************
-* Function Name : LCDGotoXY
-* Description : Cursor to X Y position (Kursor na pozycje XY)
-*
-* Input : row - x position, column - y position
-* Output : None
-* Return : None
-*******************************************************************************/
-void LCDGotoXY(u8 row, u8 column)
-{
-#define LCD_DDRAM 7
-
-#define LCD_LINE0_DDRAMADDR 0x00
-#define LCD_LINE1_DDRAMADDR 0x40
-#define LCD_LINE2_DDRAMADDR 0x14
-#define LCD_LINE3_DDRAMADDR 0x54
-
- u8 DDRAMAddr;
- //remap lines into proper order
- //wyznaczenie adresu polozenia
- switch(column)
- {
- case 0: DDRAMAddr = LCD_LINE0_DDRAMADDR + row; break;
- case 1: DDRAMAddr = LCD_LINE1_DDRAMADDR + row; break;
- case 2: DDRAMAddr = LCD_LINE2_DDRAMADDR + row; break;
- case 3: DDRAMAddr = LCD_LINE3_DDRAMADDR + row; break;
- default: DDRAMAddr = LCD_LINE0_DDRAMADDR + row;
- }
- //set data address
- //wyslanie adresu
- LCDsendCommand(1<<LCD_DDRAM | DDRAMAddr);
-}
-
-/*******************************************************************************
-* Function Name : LCDshiftLeft
-* Description : Scrol n of characters Right (Przsuniecie znakow o n w prawo)
-*
-* Input : right - number of characters
-* Output : None
-* Return : None
-*******************************************************************************/
-void LCDshiftLeft(u8 right)
-{
-u8 count;
- for (count=0;count<right;count++)
- {
- LCDsendCommand(0x1E);
- }
-}
-
-/*******************************************************************************
-* Function Name : LCDshiftRight
-* Description : Scrol n of characters Left (Przsuniecie znakow o n w lewo)
-*
-* Input : left - number of characters
-* Output : None
-* Return : None
-*******************************************************************************/
-void LCDshiftRight(u8 left)
-{
-u8 count;
- for (count=0;count<left;count++)
- {
- LCDsendCommand(0x18);
- }
-}
-
-/*******************************************************************************
-* Function Name : LCDcursorOn
-* Description : Displays LCD cursor (Kursor aktywny)
-*
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void LCDcursorOn(void)
-{
- LCDsendCommand(0x0E);
-}
-
-/*******************************************************************************
-* Function Name : LCDcursorOnBlink
-* Description : Displays LCD blinking cursor (Migajacy kursor aktywny)
-*
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void LCDcursorOnBlink(void)
-{
- LCDsendCommand(0x0F);
-}
-
-/*******************************************************************************
-* Function Name : LCDcursorOFF
-* Description : Turns OFF cursor (Kursor wylaczony)
-*
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void LCDcursorOFF(void)
-{
- LCDsendCommand(0x0C);
-}
-
-/*******************************************************************************
-* Function Name : LCDblank
-* Description : Blanks LCD (LCD nieaktywny)
-*
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void LCDblank(void)
-{
- LCDsendCommand(0x08);
-}
-
-/*******************************************************************************
-* Function Name : LCDvisible
-* Description : Shows LCD (LCD aktywny)
-*
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void LCDvisible(void)
-{
- LCDsendCommand(0x0C);
-}
-
-/*******************************************************************************
-* Function Name : LCDcursorLeft
-* Description : Moves cursor by n poisitions left (Kursor n pozycji w lewo)
-*
-* Input : left - number of positions
-* Output : None
-* Return : None
-*******************************************************************************/
-void LCDcursorLeft(u8 left)
-{
-u8 count;
- for (count=0;count<left;count++)
- {
- LCDsendCommand(0x10);
- }
-}
-
-/*******************************************************************************
-* Function Name : LCDcursorRight
-* Description : Moves cursor by n poisitions right (Kursor n pozycji w prawo)
-*
-* Input : right - number of positions
-* Output : None
-* Return : None
-*******************************************************************************/
-void LCDcursorRight(u8 right)
-{
-u8 count;
- for (count=0;count<right;count++)
- {
- LCDsendCommand(0x14);
- }
-}
-
-/******************* (C) COPYRIGHT 2007 PROPOX *****END OF FILE****/
diff --git a/uc_str912/prj_test_lcd/src/startup.s b/uc_str912/prj_test_lcd/src/startup.s
deleted file mode 100644
index cef54d8..0000000
--- a/uc_str912/prj_test_lcd/src/startup.s
+++ /dev/null
@@ -1,233 +0,0 @@
-/***********************************************************************************
-* Copyright 2005 Anglia Design
-* This demo code and associated components are provided as is and has no warranty,
-* implied or otherwise. You are free to use/modify any of the provided
-* code at your own risk in your applications with the expressed limitation
-* of liability (see below)
-*
-* LIMITATION OF LIABILITY: ANGLIA OR ANGLIA DESIGNS SHALL NOT BE LIABLE FOR ANY
-* LOSS OF PROFITS, LOSS OF USE, LOSS OF DATA, INTERRUPTION OF BUSINESS, NOR FOR
-* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND WHETHER UNDER
-* THIS AGREEMENT OR OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-*
-* Author : Spencer Oliver
-* Web : www.anglia-designs.com
-*
-***********************************************************************************/
-
-/**** Startup Code (executed after Reset) ****/
-
-/* Frequency values kHz */
-/* set to suit target hardware */
-
- .equ FOSC, 25000
-
-/* Standard definitions of Mode bits and Interrupt (I & F) flags in PSRs */
-
- .equ Mode_USR, 0x10
- .equ Mode_FIQ, 0x11
- .equ Mode_IRQ, 0x12
- .equ Mode_SVC, 0x13
- .equ Mode_ABT, 0x17
- .equ Mode_UND, 0x1B
- .equ Mode_SYS, 0x1F /* available on ARM Arch 4 and later */
-
- .equ I_Bit, 0x80 /* when I bit is set, IRQ is disabled */
- .equ F_Bit, 0x40 /* when F bit is set, FIQ is disabled */
-
- .equ SRAM32, 0x00
- .equ SRAM64, 0x08
- .equ SRAM96, 0x10
-
-/* --- System memory locations */
-
- .equ SCRO_AHB_UMB, 0x5C002034 /* System configuration register 0 (unbuffered) */
-
- .equ FMI_BASE_UMB, 0x54000000 /* Flash FMI base address (unbuffered) */
- .equ BBSR_off_addr, 0x00
- .equ NBBSR_off_addr, 0x04
- .equ BBADR_off_addr, 0x0C
- .equ NBBADR_off_addr, 0x10
- .equ CR_off_addr, 0x18
-
-.ifndef LIBUFF
- .equ LIBUFF, 0
-.endif
-
-/* Startup Code must be linked first at Address at which it expects to run. */
-
- .text
- .arm
- .section .init, "ax"
-
- .global _start
- .global _Main_Crystal
-
-/* After remap this will be our reset handler */
-
-_start:
- LDR pc, =NextInst
-NextInst:
-
- NOP /* Wait for OSC stabilization */
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
- NOP
-
-/* Enable buffered mode */
-
-.if LIBUFF
- MRC p15, 0, r0, c1, c0, 0 /* Read CP15 register 1 into r0 */
- ORR r0, r0, #0x8 /* Enable Write Buffer on AHB */
- MCR p15, 0, r0, c1, c0, 0 /* Write CP15 register 1 */
-.endif
-
-/* Remap Flash Bank 0 at address 0x0 and Bank 1 at address 0x80000, */
-/* when the bank 0 is the boot bank, then enable the Bank 1. */
-
- LDR r0, =FMI_BASE_UMB
- LDR r1, =0x4 /* configure 512KB Boot bank 0 */
- STR r1, [r0, #BBSR_off_addr]
-
- LDR r1, =0x2 /* configure 32KB Non Boot bank 1 */
- STR r1, [r0, #NBBSR_off_addr]
-
- LDR r1, =(0x00000000 >> 2) /* Boot Bank Base Address */
- STR r1, [r0, #BBADR_off_addr]
-
- LDR r1, =(0x00080000 >> 2) /* Non Boot Bank Base Address */
- STR r1, [r0, #NBBADR_off_addr]
-
- LDR r1, =0x18 /* Flash Banks 0 1 enabled */
- STR r1, [r0, #CR_off_addr]
-
-/* Enable 96K RAM */
-
- LDR r0, =SCRO_AHB_UMB
-# LDR r1, =0x0196 /* prefetch disabled, default enabled */
- LDR r1, =0x0187|SRAM96
- STR r1, [r0]
-
-/* Set bits 17-18 (Instruction/Data TCM order) of the */
-/* Core Configuration Control Register */
-
- MOV r0, #0x60000
- MCR p15, 0x1, r0, c15, c1, 0
-
-/* Setup Stack for each mode */
-
-/* Enter Abort Mode and set its Stack Pointer */
-
- MSR cpsr_c, #Mode_ABT|I_Bit|F_Bit
- LDR sp, =__stack_abt_end__
-
-/* Enter Undefined Instruction Mode and set its Stack Pointer */
-
- MSR cpsr_c, #Mode_UND|I_Bit|F_Bit
- LDR sp, =__stack_und_end__
-
-/* Enter Supervisor Mode and set its Stack Pointer */
-
- MSR cpsr_c, #Mode_SVC|I_Bit|F_Bit
- LDR sp, =__stack_svc_end__
-
-/* Enter FIQ Mode and set its Stack Pointer */
-
- MSR cpsr_c, #Mode_FIQ|I_Bit|F_Bit
- LDR sp, =__stack_fiq_end__
-
-/* Enter IRQ Mode and set its Stack Pointer */
-
- MSR cpsr_c, #Mode_IRQ|I_Bit|F_Bit
- LDR sp, =__stack_irq_end__
-
-/* Enter System/User Mode and set its Stack Pointer */
-
- MSR cpsr_c, #Mode_SYS
- LDR sp, =__stack_end__
-
-/* Setup a default Stack Limit (when compiled with "-mapcs-stack-check") */
-
- LDR sl, =__bss_end__
-
-/* Relocate .data section (Copy from ROM to RAM) */
-
- LDR r1, =_etext
- LDR r2, =__data_start
- LDR r3, =_edata
-LoopRel:
- CMP r2, r3
- LDRLO r0, [r1], #4
- STRLO r0, [r2], #4
- BLO LoopRel
-
-/* Clear .bss section (Zero init) */
-
- MOV r0, #0
- LDR r1, =__bss_start__
- LDR r2, =__bss_end__
-LoopZI:
- CMP r1, r2
- STRLO r0, [r1], #4
- BLO LoopZI
-
-/* Call C++ constructors */
-
- LDR r0, =__ctors_start__
- LDR r1, =__ctors_end__
-ctor_loop:
- CMP r0, r1
- BEQ ctor_end
- LDR r2, [r0], #4
- STMFD sp!, {r0-r1}
- BLX r2
- LDMFD sp!, {r0-r1}
- B ctor_loop
-ctor_end:
-
-/* Need to set up standard file handles */
-/* Only used under simulator, normally overide syscall.c */
-
-# BL initialise_monitor_handles
-
-/* if we use debug version of str9lib this will call the init function */
-
- BL libdebug
-libdebug:
-
-/* Enter the C code, use B instruction so as to never return */
-/* use BL main if you want to use c++ destructors below */
-
- B main
-
-/* Call destructors */
-
-# LDR r0, =__dtors_start__
-# LDR r1, =__dtors_end__
-#dtor_loop:
-# CMP r0, r1
-# BEQ dtor_end
-# LDR r2, [r0], #4
-# STMFD sp!, {r0-r1}
-# BLX r2
-# LDMFD sp!, {r0-r1}
-# B dtor_loop
-#dtor_end:
-
-/* Return from main, loop forever. */
-
-#exit_loop:
-# B exit_loop
-
-/* Fosc values, used by libstr9 */
-
-_Main_Crystal: .long FOSC
-
- .weak libdebug
-
- .end
diff --git a/uc_str912/prj_test_lcd/src/vector.s b/uc_str912/prj_test_lcd/src/vector.s
deleted file mode 100644
index 7708f54..0000000
--- a/uc_str912/prj_test_lcd/src/vector.s
+++ /dev/null
@@ -1,202 +0,0 @@
-/***********************************************************************************
-* Copyright 2005 Anglia Design
-* This demo code and associated components are provided as is and has no warranty,
-* implied or otherwise. You are free to use/modify any of the provided
-* code at your own risk in your applications with the expressed limitation
-* of liability (see below)
-*
-* LIMITATION OF LIABILITY: ANGLIA OR ANGLIA DESIGNS SHALL NOT BE LIABLE FOR ANY
-* LOSS OF PROFITS, LOSS OF USE, LOSS OF DATA, INTERRUPTION OF BUSINESS, NOR FOR
-* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND WHETHER UNDER
-* THIS AGREEMENT OR OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-*
-* Author : Spencer Oliver
-* Web : www.anglia-designs.com
-*
-***********************************************************************************/
-
- .equ VectorAddress, 0xFFFFF030 /* VIC Vector address register address. */
- .equ VectorAddressDaisy, 0xFC000030 /* Daisy VIC Vector address register */
-
- .equ Mode_USR, 0x10
- .equ Mode_FIQ, 0x11
- .equ Mode_IRQ, 0x12
- .equ Mode_SVC, 0x13
- .equ Mode_ABT, 0x17
- .equ Mode_UND, 0x1B
- .equ Mode_SYS, 0x1F /* available on ARM Arch 4 and later */
-
- .equ I_Bit, 0x80 /* when I bit is set, IRQ is disabled */
- .equ F_Bit, 0x40 /* when F bit is set, FIQ is disabled */
-
- .text
- .arm
- .section .vectors, "ax"
-
- .global Reset_Vec
-
-/* Note: LDR PC instructions are used here, though branch (B) instructions */
-/* could also be used, unless the ROM is at an address >32MB. */
-
-/*******************************************************************************
- Exception vectors
-*******************************************************************************/
-
-Reset_Vec: LDR pc, Reset_Addr /* Reset Handler */
-Undef_Vec: LDR pc, Undefined_Addr
-SWI_Vec: LDR pc, SWI_Addr
-PAbt_Vec: LDR pc, Prefetch_Addr
-DAbt_Vec: LDR pc, Abort_Addr
- NOP /* Reserved vector */
-IRQ_Vec: LDR pc, IRQ_Addr
-FIQ_Vec: LDR pc, FIQ_Addr
-
-/*******************************************************************************
- Exception handlers address table
-*******************************************************************************/
-
-Reset_Addr: .word _start
-Undefined_Addr: .word UndefinedHandler
-SWI_Addr: .word SWIHandler
-Prefetch_Addr: .word PrefetchHandler
-Abort_Addr: .word AbortHandler
- .word 0 /* reserved */
-IRQ_Addr: .word IRQHandler
-FIQ_Addr: .word FIQHandler
-
-/*******************************************************************************
- Exception Handlers
-*******************************************************************************/
-
-/*******************************************************************************
-* Macro Name : SaveContext
-* Description : This macro used to save the context before entering
- an exception handler.
-* Input : The range of registers to store.
-* Output : none
-*******************************************************************************/
-
-.macro SaveContext reg1 reg2
- STMFD sp!,{\reg1-\reg2,lr} /* Save The workspace plus the current return */
- /* address lr_ mode into the stack */
- MRS r1, spsr /* Save the spsr_mode into r1 */
- STMFD sp!, {r1} /* Save spsr */
-.endm
-
-/*******************************************************************************
-* Macro Name : RestoreContext
-* Description : This macro used to restore the context to return from
- an exception handler and continue the program execution.
-* Input : The range of registers to restore.
-* Output : none
-*******************************************************************************/
-
-.macro RestoreContext reg1 reg2
- LDMFD sp!, {r1} /* Restore the saved spsr_mode into r1 */
- MSR spsr_cxsf, r1 /* Restore spsr_mode */
- LDMFD sp!, {\reg1-\reg2,pc}^ /* Return to the instruction following */
- /* the exception interrupt */
-.endm
-
-/*******************************************************************************
-* Function Name : IRQHandler
-* Description : This function called when IRQ exception is entered.
-* Input : none
-* Output : none
-*******************************************************************************/
-
-IRQHandler:
- SUB lr, lr, #4 /* Update the link register */
- SaveContext r0, r12 /* Save the workspace plus the current */
- /* return address lr_irq and spsr_irq */
- LDR r0, =VectorAddress
- LDR r0, [r0] /* Read the routine address */
- LDR r1, =VectorAddressDaisy
- LDR r1, [r1]
- /* Padding between the acknowledge and re-enable of interrupts */
- /* For more details, please refer to the following URL */
- /* http://www.arm.com/support/faqip/3682.html */
- NOP
- NOP
- MSR cpsr_c, #Mode_SYS /* Switch to SYS mode and enable IRQ */
- STMFD sp!, {lr} /* Save the link register. */
- LDR lr, =ReturnAddress /* Read the return address. */
- MOV pc, r0 /* Branch to the IRQ handler. */
-ReturnAddress:
- LDMFD sp!, {lr} /* Restore the link register. */
- MSR cpsr_c, #Mode_IRQ|I_Bit|F_Bit /* Switch to IRQ mode and disable IRQ */
- LDR r0, =VectorAddress /* Write to the VectorAddress to clear the */
- STR r0, [r0] /* respective interrupt in the internal interrupt */
- LDR r1, =VectorAddressDaisy /* Write to the VectorAddressDaisy to clear the */
- STR r1, [r1] /* respective interrupt in the internal interrupt */
- RestoreContext r0, r12 /* Restore the context and return to the program execution. */
-
-/*******************************************************************************
-* Function Name : SWIHandler
-* Description : This function called when SWI instruction executed.
-* Input : none
-* Output : none
-*******************************************************************************/
-
-SWIHandler:
- SaveContext r0, r12 /* r0 holds swi number */
- MOV r1, sp /* load regs */
- BL SWI_Handler
- RestoreContext r0, r12
-
-/*******************************************************************************
-* Function Name : UndefinedHandler
-* Description : This function called when undefined instruction
- exception is entered.
-* Input : none
-* Output : none
-*******************************************************************************/
-
-UndefinedHandler:
- SaveContext r0, r12
- BL Undefined_Handler
- RestoreContext r0, r12
-
-/*******************************************************************************
-* Function Name : PrefetchAbortHandler
-* Description : This function called when Prefetch Abort
- exception is entered.
-* Input : none
-* Output : none
-*******************************************************************************/
-
-PrefetchHandler:
- SUB lr, lr, #4 /* Update the link register. */
- SaveContext r0, r12
- BL Prefetch_Handler
- RestoreContext r0, r12
-
-/*******************************************************************************
-* Function Name : DataAbortHandler
-* Description : This function is called when Data Abort
- exception is entered.
-* Input : none
-* Output : none
-*******************************************************************************/
-
-AbortHandler:
- SUB lr, lr, #8 /* Update the link register. */
- SaveContext r0, r12
- BL Abort_Handler
- RestoreContext r0, r12
-
-/*******************************************************************************
-* Function Name : FIQHandler
-* Description : This function is called when FIQ
- exception is entered.
-* Input : none
-* Output : none
-*******************************************************************************/
-
-FIQHandler:
- SUB lr, lr, #4 /* Update the link register. */
- SaveContext r0, r7
- BL FIQ_Handler
- RestoreContext r0, r7
-
- .end
diff --git a/uc_str912/prj_test_lcd/src/vectors.c b/uc_str912/prj_test_lcd/src/vectors.c
deleted file mode 100644
index 4022391..0000000
--- a/uc_str912/prj_test_lcd/src/vectors.c
+++ /dev/null
@@ -1,462 +0,0 @@
-/***********************************************************************************
-* Copyright 2005 Anglia Design
-* This demo code and associated components are provided as is and has no warranty,
-* implied or otherwise. You are free to use/modify any of the provided
-* code at your own risk in your applications with the expressed limitation
-* of liability (see below)
-*
-* LIMITATION OF LIABILITY: ANGLIA OR ANGLIA DESIGNS SHALL NOT BE LIABLE FOR ANY
-* LOSS OF PROFITS, LOSS OF USE, LOSS OF DATA, INTERRUPTION OF BUSINESS, NOR FOR
-* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND WHETHER UNDER
-* THIS AGREEMENT OR OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-*
-* Author : Spencer Oliver
-* Web : www.anglia-designs.com
-*
-***********************************************************************************/
-
-#include "vectors.h"
-
-/*******************************************************************************
-* Function Name : Undefined_Handler
-* Description : This function Undefined instruction exception.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void Undefined_Handler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : SWI_Handler
-* Description : This function handles SW exception.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void SWI_Handler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : Prefetch_Handler
-* Description : This function handles preftetch abort exception.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void Prefetch_Handler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : Abort_Handler
-* Description : This function handles data abort exception.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void Abort_Handler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : FIQ_Handler
-* Description : This function handles FIQ exception.
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void FIQ_Handler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : WDG_IRQHandler
-* Description : This function handles the WDG interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void WDG_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : SW_IRQHandler
-* Description : This function handles the SW interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void SW_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : ARMRX_IRQHandler
-* Description : This function handles the ARMRX interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void ARMRX_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : ARMTX_IRQHandler
-* Description : This function handles the ARMTX interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void ARMTX_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : TIM0_IRQHandler
-* Description : This function handles the TIM0 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void TIM0_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : TIM1_IRQHandler
-* Description : This function handles the TIM1 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void TIM1_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : TIM2_IRQHandler
-* Description : This function handles the TIM2 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void TIM2_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : TIM3_IRQHandler
-* Description : This function handles the TIM3 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void TIM3_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : USBHP_IRQHandler
-* Description : This function handles the USBHP interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void USBHP_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : USBLP_IRQHandler
-* Description : This function handles the USBLP interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void USBLP_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : SCU_IRQHandler
-* Description : This function handles the SCU interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : ENET_IRQHandler
-* Description : This function handles the ENET interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void ENET_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : DMA_IRQHandler
-* Description : This function handles the DMA interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void DMA_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : CAN_IRQHandler
-* Description : This function handles the CAN interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void CAN_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : MC_IRQHandler
-* Description : This function handles the MC interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void MC_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : ADC_IRQHandler
-* Description : This function handles the ADC interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void ADC_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : UART0_IRQHandler
-* Description : This function handles the UART0 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART0_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : UART1_IRQHandler
-* Description : This function handles the UART1 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART1_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : UART2_IRQHandler
-* Description : This function handles the UART2 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void UART2_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : I2C0_IRQHandler
-* Description : This function handles the I2C0 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void I2C0_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : I2C1_IRQHandler
-* Description : This function handles the I2C1 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void I2C1_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : SSP0_IRQHandler
-* Description : This function handles the SSP0 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void SSP0_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : SSP1_IRQHandler
-* Description : This function handles the SSP1 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void SSP1_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : LVD_IRQHandler
-* Description : This function handles the LVD interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void LVD_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : RTC_IRQHandler
-* Description : This function handles the RTC interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void RTC_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : WIU_IRQHandler
-* Description : This function handles the WIU interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void WIU_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : EXTIT0_IRQHandler
-* Description : This function handles the EXTIT0 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void EXTIT0_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : EXTIT1_IRQHandler
-* Description : This function handles the EXTIT1 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void EXTIT1_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : EXTIT2_IRQHandler
-* Description : This function handles the EXTIT2 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void EXTIT2_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : EXTIT3_IRQHandler
-* Description : This function handles the EXTIT3 interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void EXTIT3_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : USBWU_IRQHandler
-* Description : This function handles the USBWU interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void USBWU_IRQHandler(void)
-{
- while(1);
-}
-
-/*******************************************************************************
-* Function Name : PFQBC_IRQHandler
-* Description : This function handles the PFQBC interrupt request
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void PFQBC_IRQHandler(void)
-{
- while(1);
-}
diff --git a/uc_str912/prj_test_lcd/str91x_lib/91x_ahbapb.c b/uc_str912/prj_test_lcd/str91x_lib/91x_ahbapb.c
deleted file mode 100644
index 41489ac..0000000
--- a/uc_str912/prj_test_lcd/str91x_lib/91x_ahbapb.c
+++ /dev/null
@@ -1,177 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_ahbapb.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the AHBAPB software functions.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_ahbapb.h"
-
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-#define AHBAPB_SplitCounter_Mask 0xFFE0FFFF
-#define AHBAPB_SetTimeOut_Mask 0xFFFFFFE0
-#define AHBAPB_Address_Mask 0xFEFFFFFF
-#define AHBAPB_FLAG_RW_Mask 0x01000000
-/*******************************************************************************
-* Function Name : AHBAPB_DeInit
-* Description : Deinitializes the AHBAPBx peripheral registers to their default
-* reset values.
-* Input : AHBAPBx: where x can be 0 or 1 to select the AHBAPB peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void AHBAPB_DeInit(AHBAPB_TypeDef* AHBAPBx)
-{
- AHBAPBx->BCR = 0x00000000;
- AHBAPBx->BSR = 0x00000000;
-}
-/*******************************************************************************
-* Function Name : AHBAPB_Init
-* Description : Initializes the AHBAPBx peripheral according to the specified
-* parameters in the AHBAPB_InitStruct .
-* Input :- AHBAPBx: where x can be 0 or 1 to select the AHBAPB peripheral.
-* - AHBAPB_InitStruct: pointer to a AHBAPB_InitTypeDef structure that
-* contains the configuration information for the specified AHBAPB
-* peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void AHBAPB_Init(AHBAPB_TypeDef* AHBAPBx, AHBAPB_InitTypeDef* AHBAPB_InitStruct)
-{
-
- if(AHBAPB_InitStruct->AHBAPB_Split == AHBAPB_Split_Enable)
- {
- /* Set SPLITEN bit;*/
- AHBAPBx->BCR |= AHBAPB_Split_Enable;
- /*Split_CNT bits[20:16]*/
- AHBAPBx->BCR &= AHBAPB_SplitCounter_Mask;
- AHBAPBx->BCR |= (AHBAPB_InitStruct->AHBAPB_SplitCounter)<<16;
- }
- else
- {
- /*/ Clear SPLITEN bit;*/
- AHBAPBx->BCR &= AHBAPB_Split_Disable;
- }
- /*APB Time out*/
- if(AHBAPB_InitStruct->AHBAPB_Error == AHBAPB_Error_Enable)
- {
- /* Set ERREN bit*/
- AHBAPBx->BCR |= AHBAPB_Error_Enable;
- /*Time ouit counter*/
- AHBAPBx->BCR &= AHBAPB_SetTimeOut_Mask;
- AHBAPBx->BCR |= AHBAPB_InitStruct->AHBAPB_SetTimeOut;
- }
- else
- {
- /* Clear ERREN bit*/
- AHBAPBx->BCR &= AHBAPB_Error_Disable;
- }
-}
-
-/*******************************************************************************
-* Function Name : AHBAPB_StructInit
-* Description : Initialize the AHBAPB Init Structure parameters
-* Input : AHBAPB_InitStruct : pointer to a AHBAPB_InitTypeDef structure
-* which will be initialized.
-* Output : None
-* Return : None
-*******************************************************************************/
-void AHBAPB_StructInit(AHBAPB_InitTypeDef* AHBAPB_InitStruct)
-{
- /* Reset AHBAPB init structure parameters values */
- AHBAPB_InitStruct->AHBAPB_Split = AHBAPB_Split_Enable;
- AHBAPB_InitStruct->AHBAPB_SplitCounter = 0xFF;
- AHBAPB_InitStruct->AHBAPB_Error = AHBAPB_Error_Enable;
- AHBAPB_InitStruct->AHBAPB_SetTimeOut = 0xFF;
-
-}
-
-/*******************************************************************************
-* Function Name : AHBAPB_GetFlagStatus
-* Description : Checks whether the specified AHBAPB flag is set or not.
-* Input : - AHBAPB: where x can be 0 or 1 to select the AHBAPB peripheral
-* - AHBAPB_FLAG: specifies the flag to check.
-* This parameter can be one of the following values:
-* - AHBAPB_FLAG_ERROR: error flag
-* - AHBAPB_FLAG_OUTM : Out of Memory flag
-* - AHBAPB_FLAG_APBT : APB Time-out flag
-* - AHBAPB_FLAG_RW : Access type flag
-* Output : None
-* Return : The new state of AHBAPB_FLAG (SET or RESET).
-*******************************************************************************/
-FlagStatus AHBAPB_GetFlagStatus(AHBAPB_TypeDef* AHBAPBx, u8 AHBAPB_FLAG)
-{
- if(AHBAPB_FLAG == AHBAPB_FLAG_RW)
- {
- if ((AHBAPBx->PAER & AHBAPB_FLAG_RW_Mask) == RESET)
- {
- return RESET;
- }
- else
- {
- return SET;
- }
- }
- else
- {
- if ((AHBAPBx->BSR & AHBAPB_FLAG) == RESET)
- {
- return RESET;
- }
- else
- {
- return SET;
- }
- }
-}
-/*******************************************************************************
-* Function Name : AHBAPB_ClearFlag
-* Description : Clears the AHBAPBx flags.
-* Input : - AHBAPB: where x can be 0 or 1 to select the AHBAPB peripheral
-* - AHBAPB_FLAG: flags to clear. This parameter one of the
-* following values:
-* - AHBAPB_FLAG_ERROR: error flag
-* - AHBAPB_FLAG_OUTM : Out of Memory flag
-* - AHBAPB_FLAG_APBT : APB Time-out flag
-* Output : None
-* Return : None
-*******************************************************************************/
-void AHBAPB_ClearFlag(AHBAPB_TypeDef* AHBAPBx, u8 AHBAPB_FLAG)
-{
- /* Clear the flag */
- AHBAPBx->BSR &= AHBAPB_FLAG;
-}
-/*******************************************************************************
-* Function Name : AHBAPB_GetPeriphAddrError
-* Description : Gets the AHBAPB error address peripherals.
-* Input : - AHBAPB: where x can be 0 or 1 to select the AHBAPB peripheral
-* Output : None
-* Return : The Peropheral address error
-*******************************************************************************/
-u32 AHBAPB_GetPeriphAddrError(AHBAPB_TypeDef* AHBAPBx)
-{
- u32 AHBAPB_Address = 0x00000000;
-
- /*Return Oeripheral address without RW bit*/
- AHBAPB_Address = (AHBAPBx->PAER)& AHBAPB_Address_Mask;
- return (AHBAPB_Address);
-}
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_test_lcd/str91x_lib/91x_fmi.c b/uc_str912/prj_test_lcd/str91x_lib/91x_fmi.c
deleted file mode 100644
index fb558ad..0000000
--- a/uc_str912/prj_test_lcd/str91x_lib/91x_fmi.c
+++ /dev/null
@@ -1,519 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_fmi.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the FMI software functions.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-
-/* Standard include ----------------------------------------------------------*/
-#include "91x_fmi.h"
-
-/* Include of other module interface headers ---------------------------------*/
-/* Local includes ------------------------------------------------------------*/
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-
-#define TIMEOUT 0xFFFFFF /* Timeout value */
-
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/* Interface functions -------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-
-
-/*******************************************************************************
-* Function Name : FMI_BankRemapConfig
-* Description : Configure the addresses and sizes of bank 0 and bank 1.
-* Input1 : FMI_BootBankSize: specifies the boot bank size.
-* This parameter can be one of the following values:
-* - 0x0: 32KBytes.
-* - 0x1: 64KBytes.
-* - 0x2: 128KBytes.
-* - 0x3: 256KBytes.
-* - 0x4: 512KBytes.
-* ....
-* - 0xB: 64MBytes.
-* Input2 : FMI_NonBootBankSize: specifies the non boot bank size.
-* This parameter can be one of the following values:
-* - 0x0: 8KBytes.
-* - 0x1: 16KBytes.
-* - 0x2: 32KBytes.
-* - 0x3: 64KBytes.
-* ....
-* - 0xD: 64MBytes.
-* Input3 : FMI_BootBankAddress: specifies the address of the boot bank.
-* Input4 : FMI_NonBootBankAddress: specifies the address of the non
-* boot bank.
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_BankRemapConfig(u8 FMI_BootBankSize, u8 FMI_NonBootBankSize, \
- u32 FMI_BootBankAddress, u32 FMI_NonBootBankAddress)
-{
- FMI->BBSR = FMI_BootBankSize;
- FMI->NBBSR = FMI_NonBootBankSize;
- FMI->BBADR = (FMI_BootBankAddress >> 2);
- FMI->NBBADR = (FMI_NonBootBankAddress >> 2);
- FMI->CR |= 0x18; /* Enable bank 1 */
-}
-
-/*******************************************************************************
-* Function Name : FMI_Config
-* Description : Configure the FMI.
-* Input1 : FMI_ReadWaitState: specifies the needed read wait states.
-* This parameter can be one of the following values:
-* - FMI_READ_WAIT_STATE_1: One read wait state.
-* - FMI_READ_WAIT_STATE_2: Two read wait states.
-* - FMI_READ_WAIT_STATE_3: Three read wait states.
-* Input2 : FMI_WriteWaitState: specifies the needed write wait states.
-* This parameter can be one of the following values:
-* - FMI_WRITE_WAIT_STATE_1: One write wait state.
-* - FMI_WRITE_WAIT_STATE_2: Two write wait states.
-* Input3 : FMI_PWD: specifies the power down mode status.
-* This parameter can be one of the following values:
-* - FMI_PWD_ENABLE: Enable the PWD.
-* - FMI_PWD_DISABLE: Disable the PWD.
-* Input4 : FMI_LVDEN: specifies the low voltage detector status.
-* This parameter can be one of the following values:
-* - FMI_LVD_ENABLE: Enable the LVD.
-* - FMI_LVD_DISABLE: Disable the LVD.
-* Input5 : FMI_FreqRange: specifies the working frequency range.
-* This parameter can be one of the following values:
-* - FMI_FREQ_LOW: Low working frequency (up to 66MHz).
-* - FMI_FREQ_HIGH: High working frequency (above 66MHz) .
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_Config(u16 FMI_ReadWaitState, u32 FMI_WriteWaitState, u16 FMI_PWD,\
- u16 FMI_LVDEN, u16 FMI_FreqRange)
-{
- /* Configure the write wait state value */
- if (FMI_WriteWaitState == FMI_WRITE_WAIT_STATE_1)
- {
- FMI->CR |= FMI_WRITE_WAIT_STATE_1;
- }
- else
- {
- FMI->CR &= FMI_WRITE_WAIT_STATE_0;
- }
-
- /* Write a write flash configuration register command */
- *(vu16 *)FMI_BANK_1 = 0x60;
-
- /* Configure the flash configuration register */
- *(vu16 *)(FMI_BANK_1|FMI_ReadWaitState|FMI_PWD|FMI_LVDEN|FMI_FreqRange) = 0x03;
-}
-
-/*******************************************************************************
-* Function Name : FMI_EraseSector
-* Description : Erase the needed sector.
-* Input : FMI_Sector: specifies the sector to be erased.
-* This parameter can be one of the following values:
-* - FMI_B0S0: FMI bank 0 sector 0.
-* - FMI_B0S1: FMI bank 0 sector 1.
-* - FMI_B0S2: FMI bank 0 sector 2.
-* - FMI_B0S3: FMI bank 0 sector 3.
-* - FMI_B0S4: FMI bank 0 sector 4.
-* - FMI_B0S5: FMI bank 0 sector 5.
-* - FMI_B0S6: FMI bank 0 sector 6.
-* - FMI_B0S7: FMI bank 0 sector 7.
-* - FMI_B1S0: FMI bank 1 sector 0.
-* - FMI_B1S1: FMI bank 1 sector 1.
-* - FMI_B1S2: FMI bank 1 sector 2.
-* - FMI_B1S3: FMI bank 1 sector 3.
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_EraseSector(vu32 FMI_Sector)
-{
- /* Write an erase set-up command to the sector */
- *(vu16 *)FMI_Sector = 0x20;
-
- /* Write an erase confirm command to the sector */
- *(vu16 *)FMI_Sector = 0xD0;
-}
-
-/*******************************************************************************
-* Function Name : FMI_EraseBank
-* Description : Erase the needed bank.
-* Input : FMI_Bank: specifies the bank to be erased.
-* This parameter can be one of the following values:
-* - FMI_BANK_0: FMI bank 0.
-* - FMI_BANK_1: FMI bank 1.
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_EraseBank(vu32 FMI_Bank)
-{
- /* Write a bank erase set-up command to the bank */
- *(vu16 *)FMI_Bank = 0x80;
-
- /* Write an erase confirm command to the sector */
- *(vu16 *)FMI_Bank = 0xD0;
-}
-
-/*******************************************************************************
-* Function Name : FMI_WriteHalfWord
-* Description : Write a halfword to the needed Flash memory address.
-* Input 1 : FMI_Address: specifies the address offset where the data will
-* be written.
-* Input 2 : FMI_Data: the needed data.
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_WriteHalfWord(u32 FMI_Address, u16 FMI_Data)
-{
- /* Write a program command to the sector to be written */
- *(vu16 *)(FMI_Address & 0xFFFFFFFC) = 0x40;
-
- /* Write the halfword to the destination address */
- *(vu16 *)FMI_Address = FMI_Data;
-}
-
-/*******************************************************************************
-* Function Name : FMI_WriteOTPHalfWord
-* Description : Write a halfword to the needed OTP sector address.
-* Input 1 : FMI_OTPHWAddress: specifies the halfword address offset
-* where the data will be written.
-* This parameter can be one of the following values:
-* - FMI_OTP_LOW_HALFWORD_0: OTP Low halfword 0.
-* - FMI_OTP_HIGH_HALFWORD_0: OTP High halfword 0.
-* - FMI_OTP_LOW_HALFWORD_1: OTP Low halfword 1.
-* - FMI_OTP_HIGH_HALFWORD_1: OTP High halfword 1.
-* - FMI_OTP_LOW_HALFWORD_2: OTP Low halfword 2.
-* - FMI_OTP_HIGH_HALFWORD_2: OTP High halfword 2.
-* - FMI_OTP_LOW_HALFWORD_3: OTP Low halfword 3.
-* - FMI_OTP_HIGH_HALFWORD_3: OTP High halfword 3.
-* - FMI_OTP_LOW_HALFWORD_4: OTP Low halfword 4.
-* - FMI_OTP_HIGH_HALFWORD_4: OTP High halfword 4.
-* - FMI_OTP_LOW_HALFWORD_5: OTP Low halfword 5.
-* - FMI_OTP_HIGH_HALFWORD_5: OTP High halfword 5.
-* - FMI_OTP_LOW_HALFWORD_6: OTP Low halfword 6.
-* - FMI_OTP_HIGH_HALFWORD_6: OTP High halfword 6.
-* - FMI_OTP_LOW_HALFWORD_7: OTP Low halfword 7.
-* - FMI_OTP_HIGH_HALFWORD_7: OTP High halfword 7.
-* Input 2 : FMI_OTPData: The needed OTP data.
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_WriteOTPHalfWord(u8 FMI_OTPHWAddress, u16 FMI_OTPData)
-{
- /* Write a write OTP command to the needed address */
- *(vu16 *)(FMI_BANK_1) = 0xC0;
-
- /* Write the halfword to the destination address */
- *(vu16 *)(FMI_BANK_1 + FMI_OTPHWAddress) = FMI_OTPData;
-}
-
-/*******************************************************************************
-* Function Name : FMI_ReadWord
-* Description : Read the correspondent data.
-* Input : FMI_Address: specifies the needed address.
-* Output : None
-* Return : The data contained in the specified address.
-*******************************************************************************/
-u32 FMI_ReadWord(u32 FMI_Address)
-{
- return(*(u32*)FMI_Address);
-}
-
-/*******************************************************************************
-* Function Name : FMI_ReadOTPData
-* Description : Read data from the OTP sector.
-* Input : FMI_OTPAddress: specifies the address of the data to be read.
-* This parameter can be one of the following values:
-* - FMI_OTP_WORD_0: FMI bank 0 sector 0.
-* - FMI_OTP_WORD_1: FMI bank 0 sector 1.
-* - FMI_OTP_WORD_2: FMI bank 0 sector 2.
-* - FMI_OTP_WORD_3: FMI bank 0 sector 3.
-* - FMI_OTP_WORD_4: FMI bank 0 sector 4.
-* - FMI_OTP_WORD_5: FMI bank 0 sector 5.
-* - FMI_OTP_WORD_6: FMI bank 0 sector 6.
-* - FMI_OTP_WORD_7: FMI bank 0 sector 7.
-* Output : None
-* Return : The needed OTP words.
-*******************************************************************************/
-u32 FMI_ReadOTPData(u8 FMI_OTPAddress)
-{
- u32 OTP_Data = 0x0;
- /* write a read OTP sector command */
- *(vu16 *)(FMI_BANK_1) = 0x98;
-
- /* Read the correspondent data */
- OTP_Data = (*(vu32*)(FMI_BANK_1 + FMI_OTPAddress));
-
- /* Write a read array command */
- *(vu16 *)(FMI_BANK_1) = 0xFF;
-
- return OTP_Data;
-}
-
-/*******************************************************************************
-* Function Name : FMI_GetFlagStatus
-* Description : Check whether the specified FMI flag is set or not.
-* Input1 : FMI_Flag: flag to check.
-* This parameter can be one of the following values:
-* - FMI_FLAG_SPS: Sector Protection Status Flag.
-* - FMI_FLAG_PSS: Program Suspend Status Flag.
-* - FMI_FLAG_PS: Program Status Flag.
-* - FMI_FLAG_ES: Erase Status Flag.
-* - FMI_FLAG_ESS: Erase Suspend Status Flag.
-* - FMI_FLAG_PECS: FPEC Status Flag.
-* Input2 : FMI_Bank: specifies the needed bank.
-* This parameter can be one of the following values:
-* - FMI_BANK_0: FMI bank 0.
-* - FMI_BANK_1: FMI bank 1.
-* Output : None
-* Return : None
-*******************************************************************************/
-FlagStatus FMI_GetFlagStatus(u8 FMI_Flag, vu32 FMI_Bank)
-{
- u16 FMI_Status_Register = 0;
-
- /* Write a read status register command */
- *(vu16 *)FMI_Bank = 0x70;
-
- /* Wait until operation completion */
- while(!((*(vu16 *)FMI_Bank) & 0x80));
-
- /* Read the status register */
- FMI_Status_Register = *(vu16 *)FMI_Bank;
-
- /* Write a read array command */
- *(vu16 *)FMI_Bank = 0xFF;
-
- if((FMI_Status_Register & FMI_Flag) != RESET)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : FMI_GetReadWaitStateValue
-* Description : Get the current Read wait state value.
-* Input : None
-* Output : None
-* Return : The current read wait states value.
-*******************************************************************************/
-u16 FMI_GetReadWaitStateValue(void)
-{
- u16 FMI_Configuration_Register = 0;
- /* Write a read flash configuration register command */
- *(vu16 *)FMI_BANK_1 = 0x90;
-
- /* Read the flash configuration register */
- FMI_Configuration_Register = *(vu16 *)(FMI_BANK_1 + 0x14);
-
- /* Write a read array command */
- *(vu16 *)FMI_BANK_1 = 0xFF;
-
- FMI_Configuration_Register = ((FMI_Configuration_Register>>11) + 1) & 0x3;
-
- /* Return the wait states value */
- return FMI_Configuration_Register;
-}
-
-/*******************************************************************************
-* Function Name : FMI_GetWriteWaitStateValue
-* Description : Get the current write wait state value.
-* Input : None
-* Output : None
-* Return : The current write wait states value.
-*******************************************************************************/
-u16 FMI_GetWriteWaitStateValue(void)
-{
- return ((u16)((FMI->CR & 0x100) >> 8));
-}
-
-/*******************************************************************************
-* Function Name : FMI_SuspendEnable
-* Description : Suspend command enable.
-* Input : FMI_Bank: specifies the bank to be suspended.
-* This parameter can be one of the following values:
-* - FMI_BANK_0: FMI bank 0.
-* - FMI_BANK_1: FMI bank 1.
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_SuspendEnable(vu32 FMI_Bank)
-{
- /* Write a suspend command to the bank */
- *(vu16 *)FMI_Bank = 0xB0;
-}
-
-/*******************************************************************************
-* Function Name : FMI_ResumeEnable
-* Description : Resume the suspended command.
-* Input : FMI_Bank: specifies the suspended bank.
-* This parameter can be one of the following values:
-* - FMI_BANK_0: FMI bank 0.
-* - FMI_BANK_1: FMI bank 1.
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_ResumeEnable(vu32 FMI_Bank)
-{
- /* Write a resume command to the bank */
- *(vu16 *)FMI_Bank = 0xD0;
-}
-
-/*******************************************************************************
-* Function Name : FMI_ClearFlag
-* Description : Clear the FMI Flags on the correspondent bank.
-* Input : FMI_Bank: specifies the needed bank.
-* This parameter can be one of the following values:
-* - FMI_BANK_0: FMI bank 0.
-* - FMI_BANK_1: FMI bank 1.
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_ClearFlag(vu32 FMI_Bank)
-{
- /* Write a clear status register command */
- *(vu16 *)FMI_Bank = 0x50;
-}
-
-/*******************************************************************************
-* Function Name : FMI_WriteProtectionCmd
-* Description : Enable or disable the write protection for the needed sector.
-* Input1 : FMI_Sector: specifies the sector to be protected or
-* unprotected.
-* This parameter can be one of the following values:
-* - FMI_B0S0: FMI bank 0 sector 0.
-* - FMI_B0S1: FMI bank 0 sector 1.
-* - FMI_B0S2: FMI bank 0 sector 2.
-* - FMI_B0S3: FMI bank 0 sector 3.
-* - FMI_B0S4: FMI bank 0 sector 4.
-* - FMI_B0S5: FMI bank 0 sector 5.
-* - FMI_B0S6: FMI bank 0 sector 6.
-* - FMI_B0S7: FMI bank 0 sector 7.
-* - FMI_B1S0: FMI bank 1 sector 0.
-* - FMI_B1S1: FMI bank 1 sector 1.
-* - FMI_B1S2: FMI bank 1 sector 2.
-* - FMI_B1S3: FMI bank 1 sector 3.
-* Input2 : FMI_NewState: specifies the protection status.
-* This parameter can be one of the following values:
-* - ENABLE: Enable the protection.
-* - DISABLE: Disable the protection.
-* Output : None
-* Return : None
-*******************************************************************************/
-void FMI_WriteProtectionCmd(vu32 FMI_Sector, FunctionalState FMI_NewState)
-{
- if (FMI_NewState == ENABLE)
- {
- *(vu16*)FMI_Sector = 0x60;
- *(vu16*)FMI_Sector = 0x01;
- *(vu16*)FMI_Sector = 0xFF;
- }
- else /* DISABLE */
- {
- *(vu16*)FMI_Sector = 0x60;
- *(vu16*)FMI_Sector = 0xD0;
- *(vu16*)FMI_Sector = 0xFF;
- }
-}
-
-/*******************************************************************************
-* Function Name : FMI_GetWriteProtectionStatus
-* Description : Get the write protection status for the needed sector.
-* Input : FMI_Sector_Mask: specifies the needed sector mask.
-* This parameter can be one of the following values:
-* - FMI_B0S0_MASK: FMI bank 0 sector 0.
-* - FMI_B0S1_MASK: FMI bank 0 sector 1.
-* - FMI_B0S2_MASK: FMI bank 0 sector 2.
-* - FMI_B0S3_MASK: FMI bank 0 sector 3.
-* - FMI_B0S4_MASK: FMI bank 0 sector 4.
-* - FMI_B0S5_MASK: FMI bank 0 sector 5.
-* - FMI_B0S6_MASK: FMI bank 0 sector 6.
-* - FMI_B0S7_MASK: FMI bank 0 sector 7.
-* - FMI_B1S0_MASK: FMI bank 1 sector 0.
-* - FMI_B1S1_MASK: FMI bank 1 sector 1.
-* - FMI_B1S2_MASK: FMI bank 1 sector 2.
-* - FMI_B1S3_MASK: FMI bank 1 sector 3.
-* Output : None
-* Return : The Protection Status of the needed sector.
-* - RESET: The needed sector is not write protected.
-* - SET : The needed sector is write protected.
-*******************************************************************************/
-FlagStatus FMI_GetWriteProtectionStatus(u32 FMI_Sector_Mask)
-{
- u16 Protection_Level_1_Register = 0;
- /* Write a read flash protection level 1 register command */
- *(vu16 *)FMI_BANK_1 = 0x90;
-
- /* Read the flash protection level 1 register */
- Protection_Level_1_Register = *(vu16 *)(FMI_BANK_1 + 0x10);
-
- /* Write a read array command */
- *(vu16 *)FMI_BANK_1 = 0xFF;
-
- if (Protection_Level_1_Register &= FMI_Sector_Mask)
- {
- return SET;
- }
- else
- {
- return RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : FMI_WaitForLastOperation
-* Description : Wait until the last operation (Write halfword, Write OTP
-* halfword, Erase sector and Erase bank) completion.
-* Input : FMI_Bank: specifies the bank where the operation is on going.
-* This parameter can be one of the following values:
-* - FMI_BANK_0: FMI bank 0.
-* - FMI_BANK_1: FMI bank 1.
-* Output : None
-* Return : The timeout status.
-* This parameter can be one of the following values:
-* - FMI_TIME_OUT_ERROR: Timeout error occurred.
-* - FMI_NO_TIME_OUT_ERROR: No timeout error.
-*******************************************************************************/
-u8 FMI_WaitForLastOperation(vu32 FMI_Bank)
-{
- u32 Time_Out = 0;
-
- /* Write a read status register command */
- *(vu16 *)(FMI_Bank) = 0x70;
-
- /* Wait until operation compeletion */
- while((!((*(vu16 *)FMI_Bank) & 0x80))&&(Time_Out < TIMEOUT ))
- {
- Time_Out ++; /* Time Out */
- }
-
- /* Write a read array command */
- *(vu16 *)FMI_Bank = 0xFF;
-
- if (Time_Out == TIMEOUT)
- {
- return FMI_TIME_OUT_ERROR;
- }
- else
- {
- return FMI_NO_TIME_OUT_ERROR;
- }
-}
-
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_test_lcd/str91x_lib/91x_gpio.c b/uc_str912/prj_test_lcd/str91x_lib/91x_gpio.c
deleted file mode 100644
index f2d0941..0000000
--- a/uc_str912/prj_test_lcd/str91x_lib/91x_gpio.c
+++ /dev/null
@@ -1,407 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_gpio.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all the GPIO software functions.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
-* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
-* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
-* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
-* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
-* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_gpio.h"
-#include "91x_scu.h"
-
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
- static u8 GPIO_GetGPIONumber(GPIO_TypeDef* GPIOx);
-
-/* Private functions ---------------------------------------------------------*/
-
-/*******************************************************************************
-* Function Name : GPIO_DeInit
-* Description : Deinitializes the GPIOx peripheral registers to their default
-* reset values.
-* Input : GPIOx: where x can be (0..9) to select the GPIO peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void GPIO_DeInit(GPIO_TypeDef* GPIOx)
-{
-
- /* Reset the GPIO registers values */
- if(GPIOx == GPIO0)
- {
- SCU_APBPeriphReset(__GPIO0,ENABLE);
- SCU_APBPeriphReset(__GPIO0,DISABLE);
- SCU->GPIOTYPE[0x00] = 0x0000 ;
- SCU->GPIOOUT[0x00] = 0x0000;
- SCU->GPIOIN[0x00] = 0x0000;
- }
-
- if(GPIOx == GPIO1)
- {
- SCU_APBPeriphReset(__GPIO1,ENABLE);
- SCU_APBPeriphReset(__GPIO1,DISABLE);
- SCU->GPIOTYPE[0x01] = 0x0000 ;
- SCU->GPIOOUT[0x01] = 0x0000;
- SCU->GPIOIN[0x01] = 0x0000;
- }
-
- if(GPIOx == GPIO2)
- {
- SCU_APBPeriphReset(__GPIO2,ENABLE);
- SCU_APBPeriphReset(__GPIO2,DISABLE);
- SCU->GPIOTYPE[0x02] = 0x0000 ;
- SCU->GPIOOUT[0x02] = 0x0000;
- SCU->GPIOIN[0x02] = 0x0000;
- }
-
- if(GPIOx == GPIO3)
- {
- SCU_APBPeriphReset(__GPIO3,ENABLE);
- SCU_APBPeriphReset(__GPIO3,DISABLE);
- SCU->GPIOTYPE[0x03] = 0x0000 ;
- SCU->GPIOOUT[0x03] = 0x0000;
- SCU->GPIOIN[0x03] = 0x0000;
- }
-
- if(GPIOx == GPIO4)
- {
- SCU_APBPeriphReset(__GPIO4,ENABLE);
- SCU_APBPeriphReset(__GPIO4,DISABLE);
- SCU->GPIOTYPE[0x04] = 0x0000 ;
- SCU->GPIOOUT[0x04] = 0x0000;
- SCU->GPIOIN[0x04] = 0x0000;
- SCU->GPIOANA = 0x00;
- }
-
- if(GPIOx == GPIO5)
- {
- SCU_APBPeriphReset(__GPIO5,ENABLE);
- SCU_APBPeriphReset(__GPIO5,DISABLE);
- SCU->GPIOTYPE[0x05] = 0x0000 ;
- SCU->GPIOOUT[0x05] = 0x0000;
- SCU->GPIOIN[0x05] = 0x0000;
- }
-
- if(GPIOx == GPIO6)
- {
- SCU_APBPeriphReset(__GPIO6,ENABLE);
- SCU_APBPeriphReset(__GPIO6,DISABLE);
- SCU->GPIOTYPE[0x06] = 0x0000 ;
- SCU->GPIOOUT[0x06] = 0x0000;
- SCU->GPIOIN[0x06] = 0x0000;
- }
-
- if(GPIOx == GPIO7)
- {
- SCU_APBPeriphReset(__GPIO7,ENABLE);
- SCU_APBPeriphReset(__GPIO7,DISABLE);
- SCU->GPIOOUT[0x07] = 0xAAAA;
- SCU->GPIOOUT[0x07] = 0x0000;
- SCU->GPIOIN[0x07] = 0x0000;
- }
-
- if(GPIOx == GPIO8)
- {
- SCU_APBPeriphReset(__GPIO8,ENABLE);
- SCU_APBPeriphReset(__GPIO8,DISABLE);
- SCU->GPIOEMI = 0x00;
- }
-
- if(GPIOx == GPIO9)
- {
- SCU_APBPeriphReset(__GPIO9,ENABLE);
- SCU_APBPeriphReset(__GPIO9,DISABLE);
- SCU->GPIOEMI = 0x00;
- }
-}
-/*******************************************************************************
-* Function Name : GPIO_Init
-* Description : Initializes the GPIOx peripheral according to the specified
-* parameters in the GPIO_InitStruct .
-* Input :- GPIOx: where x can be (0..9) to select the GPIO peripheral.
-* - GPIO_InitStruct: pointer to a GPIO_InitTypeDef structure that
-* contains the configuration information for the specified GPIO
-* peripheral.
-* Output : None
-* Return : None
-*******************************************************************************/
-void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct)
-{
- /* Select pin direction */
- u8 PinNumber = 0;
- u8 Counter = 0;
- u8 GPIO_Number = 0;
-
- GPIO_Number = GPIO_GetGPIONumber(GPIOx);
-
-
- if(GPIO_InitStruct->GPIO_Direction == GPIO_PinOutput)
- {
- GPIOx->DDR |= GPIO_InitStruct->GPIO_Pin;
- }
- else
- {
- GPIOx->DDR &= ~GPIO_InitStruct->GPIO_Pin;
- }
-
- for (Counter = 0; Counter < 8;Counter++)
- {
- /*Search pin number*/
- PinNumber = (GPIO_InitStruct->GPIO_Pin & (1 <<Counter));
- if((PinNumber >> Counter) == 1)
- {
- /*Output ALternate 0*/
- SCU->GPIOOUT[GPIO_Number] &= ~(0x3 <<(Counter *2));
- if(GPIO_InitStruct->GPIO_Alternate == GPIO_OutputAlt1)
- {
- /*Output ALternate 1*/
- SCU->GPIOOUT[GPIO_Number] |= 1 << (Counter *2);
- }
- if(GPIO_InitStruct->GPIO_Alternate == GPIO_OutputAlt2)
- {
- /*Output ALternate 2*/
- SCU->GPIOOUT[GPIO_Number] |= 0x2 << (Counter *2);
- }
- if(GPIO_InitStruct->GPIO_Alternate == GPIO_OutputAlt3)
- {
- /*Output ALternate 3*/
- SCU->GPIOOUT[GPIO_Number] |= 0x3 << (Counter *2);
- }
-
- /*Type configuration: PushPull or Open Collector*/
- SCU->GPIOTYPE[GPIO_Number] &= ~(0x1 << Counter) ;
- if(GPIO_InitStruct->GPIO_Type == GPIO_Type_OpenCollector)
- {
- /*Open Drain configuration*/
- SCU->GPIOTYPE[GPIO_Number] |= 0x1 << Counter;
- }
-
- /*IP Connected disable*/
- SCU->GPIOIN[GPIO_Number] &= ~(0x1 << Counter) ;
- if(GPIO_InitStruct->GPIO_IPConnected == GPIO_IPConnected_Enable)
- {
- /*IP Connected enable*/
- SCU->GPIOIN[GPIO_Number] |= 0x1 << Counter;
- }
- }
- }
-}
-
-/*******************************************************************************
-* Function Name : GPIO_StructInit
-* Description : Initialize the GPIO Init Structure parameters
-* Input : GPIO_InitStruct : pointer to a GPIO_InitTypeDef structure
-* which will be initialized.
-* Output : None
-* Return : None
-*******************************************************************************/
-void GPIO_StructInit(GPIO_InitTypeDef* GPIO_InitStruct)
-{
- /* Reset GPIO init structure parameters values */
- GPIO_InitStruct->GPIO_Pin = GPIO_Pin_All;
- GPIO_InitStruct->GPIO_Direction = GPIO_PinInput;
- GPIO_InitStruct->GPIO_Type = GPIO_Type_PushPull;
- GPIO_InitStruct->GPIO_IPConnected = GPIO_IPConnected_Disable;
- GPIO_InitStruct->GPIO_Alternate = GPIO_InputAlt1;
-}
-
-/*******************************************************************************
-* Function Name : GPIO_ReadBit
-* Description : Reads the specified port pin
-* Input : - GPIOx: where x can be (0..9) to select the GPIO peripheral.
-* : - GPIO_Pin: the Pin number. This parameter can be GPIO_Pin_x
-* where x can be (0..7).
-* Output : None
-* Return : The port pin value
-*******************************************************************************/
-u8 GPIO_ReadBit(GPIO_TypeDef* GPIOx, u8 GPIO_Pin)
-{
- if ((((GPIOx->DR[GPIO_Pin<<2])) & GPIO_Pin) != Bit_RESET )
- {
- return Bit_SET;
- }
- else
- {
- return Bit_RESET;
- }
-}
-
-/*******************************************************************************
-* Function Name : GPIO_Read
-* Description : Reads the specified GPIO data port
-* Input : - GPIOx: where x can be (0..9) to select the GPIO peripheral.
-* Output : None
-* Return : GPIO data port word value.
-*******************************************************************************/
-u8 GPIO_Read(GPIO_TypeDef* GPIOx)
-{
- return (GPIOx->DR[0x3FC]);
-}
-
-/*******************************************************************************
-* Function Name : GPIO_WriteBit
-* Description : Sets or clears the selected data port bit.
-* Input : - GPIOx: where x can be (0..9) to select the GPIO peripheral.
-* - GPIO_Pin: the Pin number. This parameter can be GPIO_Pin_x
-* where x can be (0..7).
-* - BitVal: this parameter specifies the value to be written
-* to the selected bit.
-* BitVal must be one of the BitAction enum values:
-* - Bit_RESET: to clear the port pin
-* - Bit_SET: to set the port pin
-* Output : None
-* Return : None
-*******************************************************************************/
-void GPIO_WriteBit(GPIO_TypeDef* GPIOx, u8 GPIO_Pin, BitAction BitVal)
-{
- if(BitVal == Bit_SET)
- {
- GPIOx->DR[GPIO_Pin <<2] = GPIO_Pin;
- }
- else
- {
- GPIOx->DR[GPIO_Pin <<2] = 0x00;
- }
-}
-
-/*******************************************************************************
-* Function Name : GPIO_Write
-* Description : Writes the passed value in the selected data GPIOx port
-* register.
-* Input :- GPIOx: where x can be (0..9) to select the GPIO peripheral.
-* - PortVal: the value to be written to the data port register.
-* Output : None
-* Return : None
-*******************************************************************************/
-void GPIO_Write(GPIO_TypeDef* GPIOx, u8 PortVal)
-{
- GPIOx->DR[0x3FC] = PortVal;
-}
-
-/*******************************************************************************
-* Function Name : GPIO_EMIConfig
-* Description : Enables or disables GPIO 8 and 9 in EMI mode.
-* Input : - NewState: new state of the EMI.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void GPIO_EMIConfig(FunctionalState NewState)
-{
- if(NewState == ENABLE)
- {
- SCU->GPIOEMI = 0x01;
- }
- else
- {
- SCU->GPIOEMI = 0x00;
- }
-}
-
-/*******************************************************************************
-* Function Name : GPIO_ANAPinConfig
-* Description : Enables or disables pins from GPIO 4 in Analogue mode.
-* Input :- GPIO_ANAChannel: selects the ADC channel pin.
-* This parameter can be one of the following values:
-* GPIO_ANAChannel0
-* GPIO_ANAChannel1
-* GPIO_ANAChannel2
-* GPIO_ANAChannel3
-* GPIO_ANAChannel4
-* GPIO_ANAChannel5
-* GPIO_ANAChannel6
-* GPIO_ANAChannel7
-* GPIO_ANAChannelALL
-* - NewState: new state of the port pin.
-* This parameter can be: ENABLE or DISABLE.
-* Output : None
-* Return : None
-*******************************************************************************/
-void GPIO_ANAPinConfig(u8 GPIO_ANAChannel, FunctionalState NewState)
-{
-
- if(NewState == ENABLE)
- {
- if(GPIO_ANAChannel == GPIO_ANAChannelALL)
- {
- SCU->GPIOOUT[4] = 0x0000;
- SCU->GPIOIN[4] = 0x00;
- }
- else
- {
- SCU->GPIOOUT[4] &= ~(0x3<<(GPIO_ANAChannel-1));
- SCU->GPIOIN[4] &= ~GPIO_ANAChannel;
- }
- SCU->GPIOANA |= GPIO_ANAChannel;
-
- }
- else
- {
- SCU->GPIOANA &= ~GPIO_ANAChannel;
- }
-}
-
-/*******************************************************************************
-* Function Name : GPIO_GetGPIONumber
-* Description : searche the GPIO number.
-* Input : GPIOx: where x can be (0..9) to select the GPIO peripheral.
-* Output : None
-* Return : GPIO number
-*******************************************************************************/
-u8 GPIO_GetGPIONumber(GPIO_TypeDef* GPIOx)
-{
-
- if(GPIOx == GPIO1)
- {
- return 1;
- }
- if(GPIOx == GPIO2)
- {
- return 2;
- }
- if(GPIOx == GPIO3)
- {
- return 3;
- }
- if(GPIOx == GPIO4)
- {
- return 4;
- }
- if(GPIOx == GPIO5)
- {
- return 5;
- }
- if(GPIOx == GPIO6)
- {
- return 6;
- }
- if(GPIOx == GPIO7)
- {
- return 7;
- }
- if(GPIOx == GPIO8)
- {
- return 8;
- }
- if(GPIOx == GPIO9)
- {
- return 9;
- }
- return 0;
-}
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_test_lcd/str91x_lib/91x_lib.c b/uc_str912/prj_test_lcd/str91x_lib/91x_lib.c
deleted file mode 100644
index c0eadbb..0000000
--- a/uc_str912/prj_test_lcd/str91x_lib/91x_lib.c
+++ /dev/null
@@ -1,281 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_lib.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides all peripherals pointers
- : initialization.
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-#define EXT
-
-/* Standard include ----------------------------------------------------------*/
-#include "91x_map.h"
-
-/* Include of other module interface headers ---------------------------------*/
-/* Local includes ------------------------------------------------------------*/
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/* Interface functions -------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-#ifdef DEBUG
-
-/*******************************************************************************
-* Function Name : debug
-* Description : this function initialize peripherals pointers
-* Input : no one
-* Output : no one
-* Return : no one
-*******************************************************************************/
-void debug(void)
-{
-
-
-/************************* DMA *************************/
-
-#ifdef _DMA
- DMA = (DMA_TypeDef *)DMA_BASE;
-#endif /* _DMA */
-
-/************************* DMA *************************/
-
-
-#ifdef _DMA_Channel0
- DMA_Channel0= (DMA_Channel_TypeDef *)DMA_Channel0_BASE;
-#endif /* _DMA_Channel0 */
-
-#ifdef _DMA_Channel1
- DMA_Channel1= (DMA_Channel_TypeDef *)DMA_Channel1_BASE;
-#endif /* _DMA_Channel1 */
-
-#ifdef _DMA_Channel2
- DMA_Channel2 = (DMA_Channel_TypeDef *)DMA_Channel2_BASE;
-#endif /* _DMA_Channel2 */
-
-#ifdef _DMA_Channel3
- DMA_Channel3 = (DMA_Channel_TypeDef *)DMA_Channel3_BASE;
-#endif /* _DMA_Channel3 */
-
-#ifdef _DMA_Channel4
- DMA_Channel4 = (DMA_Channel_TypeDef *)DMA_Channel4_BASE;
-#endif /* _DMA_Channel4 */
-
-#ifdef _DMA_Channel5
- DMA_Channel5= (DMA_Channel_TypeDef *)DMA_Channel5_BASE;
-#endif /* _DMA_Channel5*/
-
-
-#ifdef _DMA_Channel6
- DMA_Channel6 = (DMA_Channel_TypeDef *)DMA_Channel6_BASE;
-#endif /* _DMA_Channel6 */
-
-#ifdef _DMA_Channel7
- DMA_Channel7 = (DMA_Channel_TypeDef *)DMA_Channel7_BASE;
-#endif /* _DMA_Channel7 */
-
-
-
- /************************* EMI *************************/
-
-#ifdef _EMI_Bank0
- EMI_Bank0= (EMI_Bank_TypeDef *)EMI_Bank0_BASE;
-#endif /* _EMI_Bank0 */
-
-#ifdef _EMI_Bank1
- EMI_Bank1= (EMI_Bank_TypeDef *)EMI_Bank1_BASE;
-#endif /* _EMI_Bank1 */
-
-#ifdef _EMI_Bank2
- EMI_Bank2 = (EMI_Bank_TypeDef *)EMI_Bank2_BASE;
-#endif /* _EMI_Bank2 */
-
-#ifdef _EMI_Bank3
- EMI_Bank3 = (EMI_Bank_TypeDef *)EMI_Bank3_BASE;
- #endif /* _EMI_Bank3 */
-
-
-
-/************************* AHBAPB *************************/
-
-#ifdef _AHBAPB0
- AHBAPB0 = (AHBAPB_TypeDef *)AHBAPB0_BASE;
-#endif /* _AHBAPB0 */
-
-#ifdef _AHBAPB1
- AHBAPB1 = (AHBAPB_TypeDef *)AHBAPB1_BASE;
-#endif /*_AHBAPB1 */
-
-
-
-/************************* FMI *************************/
-
-#ifdef _FMI
- FMI = (FMI_TypeDef *)FMI_BASE;
-#endif /* _FMI */
-
-/************************* VIC *************************/
-
-#ifdef _VIC0
- VIC0 = (VIC_TypeDef *)VIC0_BASE;
-#endif /* _VIC0 */
-
-#ifdef _VIC1
- VIC1 = (VIC_TypeDef *)VIC1_BASE;
-#endif /* _VIC1 */
-
-/************************* WIU *************************/
-
-#ifdef _WIU
- WIU = (WIU_TypeDef *)WIU_BASE;
-#endif /* _WIU */
-
-/************************* TIM *************************/
-
-#ifdef _TIM0
- TIM0 = (TIM_TypeDef *)TIM0_BASE;
-#endif /* _TIM0 */
-
-#ifdef _TIM1
- TIM1 = (TIM_TypeDef *)TIM1_BASE;
-#endif /* _TIM1 */
-
-#ifdef _TIM2
- TIM2 = (TIM_TypeDef *)TIM2_BASE;
-#endif /* _TIM2 */
-
-#ifdef _TIM3
- TIM3 = (TIM_TypeDef *)TIM3_BASE;
-#endif /* _TIM3 */
-
-/************************* GPIO ************************/
-
-#ifdef _GPIO0
- GPIO0 = (GPIO_TypeDef *)GPIO0_BASE;
-#endif /* _GPIO0 */
-
-#ifdef _GPIO1
- GPIO1 = (GPIO_TypeDef *)GPIO1_BASE;
-#endif /* _GPIO1 */
-
-#ifdef _GPIO2
- GPIO2 = (GPIO_TypeDef *)GPIO2_BASE;
-#endif /* _GPIO2 */
-
-#ifdef _GPIO3
- GPIO3 = (GPIO_TypeDef *)GPIO3_BASE;
-#endif /* _GPIO3 */
-
-#ifdef _GPIO4
- GPIO4 = (GPIO_TypeDef *)GPIO4_BASE;
-#endif /* _GPIO4 */
-
-#ifdef _GPIO5
- GPIO5 = (GPIO_TypeDef *)GPIO5_BASE;
-#endif /* _GPIO5 */
-
-#ifdef _GPIO6
- GPIO6 = (GPIO_TypeDef *)GPIO6_BASE;
-#endif /* _GPIO6 */
-
-#ifdef _GPIO7
- GPIO7 = (GPIO_TypeDef *)GPIO7_BASE;
-#endif /* _GPIO7 */
-
-#ifdef _GPIO8
- GPIO8 = (GPIO_TypeDef *)GPIO8_BASE;
-#endif /* _GPIO8 */
-
-#ifdef _GPIO9
- GPIO9 = (GPIO_TypeDef *)GPIO9_BASE;
-#endif /* _GPIO9 */
-
-/************************* RTC *************************/
-
-#ifdef _RTC
- RTC = (RTC_TypeDef *)RTC_BASE;
-#endif /* _RTC */
-
-/************************* PRCCU ***********************/
-
-#ifdef _SCU
- SCU = (SCU_TypeDef *)SCU_BASE;
-#endif /* _PRCCU */
-
-/************************** MC *************************/
-
-#ifdef _MC
- MC = (MC_TypeDef *)MC_BASE;
-#endif /* _MC */
-
-/************************* UART ************************/
-
-#ifdef _UART0
- UART0 = (UART_TypeDef *)UART0_BASE;
-#endif /* _UART0 */
-
-#ifdef _UART1
- UART1 = (UART_TypeDef *)UART1_BASE;
-#endif /* _UART1 */
-
-#ifdef _UART2
- UART2 = (UART_TypeDef *)UART2_BASE;
-#endif /* _UART2 */
-
-/************************* SSP *************************/
-
-#ifdef _SSP0
- SSP0 = (SSP_TypeDef *)SSP0_BASE;
-#endif /* _SSP0 */
-
-#ifdef _SSP1
- SSP1 = (SSP_TypeDef *)SSP1_BASE;
-#endif /* _SSP1 */
-
-/************************* CAN *************************/
-
-#ifdef _CAN
- CAN = (CAN_TypeDef *)CAN_BASE;
-#endif /* _CAN */
-
-/************************* ADC *************************/
-
-#ifdef _ADC
- ADC = (ADC_TypeDef *)ADC_BASE;
-#endif /* _ADC */
-
-/************************* WDG *************************/
-
-#ifdef _WDG
- WDG = (WDG_TypeDef *)WDG_BASE;
-#endif /* _WDG */
-
-/************************* I2C *************************/
-
-#ifdef _I2C0
- I2C0 = (I2C_TypeDef *)I2C0_BASE;
-#endif /* _I2C0 */
-
-#ifdef _I2C1
- I2C1 = (I2C_TypeDef *)I2C1_BASE;
-#endif /* _I2C1 */
-/********************** ENET **************************/
-#ifdef _ENET
- ENET_MAC = (ENET_MAC_TypeDef *)ENET_MAC_BASE;
- ENET_DMA = (ENET_DMA_TypeDef *)ENET_DMA_BASE;
-#endif /* _ENET */
-}
-#endif /* DEBUG */
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/prj_test_lcd/str91x_lib/91x_scu.c b/uc_str912/prj_test_lcd/str91x_lib/91x_scu.c
deleted file mode 100644
index 21116b2..0000000
--- a/uc_str912/prj_test_lcd/str91x_lib/91x_scu.c
+++ /dev/null
@@ -1,661 +0,0 @@
-/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
-* File Name : 91x_scu.c
-* Author : MCD Application Team
-* Date First Issued : 05/18/2006 : Version 1.0
-* Description : This file provides the SCU library software functions
-********************************************************************************
-* History:
-* 05/24/2006 : Version 1.1
-* 05/18/2006 : Version 1.0
-********************************************************************************
-* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
-* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
-* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
-* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
-* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
-* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
-*******************************************************************************/
-
-/* Includes ------------------------------------------------------------------*/
-#include "91x_scu.h"
-
-/* Include of other module interface headers ---------------------------------*/
-/* Local includes ------------------------------------------------------------*/
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-#define SCU_PLLEN 0x80000
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/* Interface functions -------------------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-
-/*******************************************************************************
-* Function Name : SCU_MCLKSourceConfig
-* Description : Configures the MCLK source clock
-* Input : MCLK_Source = SCU_MCLK_OSC, SCU_MCLK_PLL or SCU_MCLK_RTC
-* Output : None
-* Return : ErrorStatus: SUCCESS or ERROR
-* Note : this function returns ERROR if trying to select the PLL as
-* clock source while the PLL is disabled or not locked.
-*******************************************************************************/
-ErrorStatus SCU_MCLKSourceConfig(u32 MCLK_Source)
-{
- u32 CLKCNTR_Value;
-
- CLKCNTR_Value = SCU->CLKCNTR; /*get CLKCNTR register value*/
- CLKCNTR_Value &=~0x3; /*clear field MCLKSEL*/
- if (MCLK_Source == SCU_MCLK_PLL) /*PLL selected as clock source*/
- {
- /*check if PLL enabled & locked*/
- if (!((SCU->PLLCONF&SCU_PLLEN)&&(SCU->SYSSTATUS&SCU_FLAG_LOCK)))
- return ERROR;
- }
- else CLKCNTR_Value |=MCLK_Source; /*OSC or RTC selected as clock source*/
- SCU->CLKCNTR = CLKCNTR_Value; /*Update CLKCNTR register value*/
- return SUCCESS;
-}
-
-/*******************************************************************************
-* Function Name : SCU_PLLFactorsConfig
-* Description : Sets the PLL factors
-* Input : PLLN, PLLM and PLLP
-* Output : None
-* Return : ErrorStatus: ERROR or SUCCESS
-* Notes : -The PLL factors must respect the PLL specification requirements
-* -The function returns ERROR if trying to change PLL
-* factors while PLL is selected as Main Clock source (MCLK)
-* -This function disables the PLL, to enable the PLL use
-* function" SCU_PLLCmd(ENABLE)" after setting the PLL factors
-******************************************************************************/
-ErrorStatus SCU_PLLFactorsConfig(u8 PLLN, u8 PLLM, u8 PLLP)
-{
- if (SCU_PLLCmd(DISABLE)==SUCCESS) /*Disable PLL*/
- {
- SCU->PLLCONF =0; /*clear PLLCONF register*/
- SCU->PLLCONF |=(PLLN<<8); /*update PLLN field*/
- SCU->PLLCONF |=PLLM; /*update PLLM field*/
- SCU->PLLCONF |=PLLP<<16; /*update PLLP field*/
- return SUCCESS;
- }
- return ERROR;
-}
-
-/*******************************************************************************
-* Function Name : SCU_PLLCmd
-* Description : Enable or Disable the PLL
-* Input : NewState = ENABLE or DISABLE
-* Output : None
-* Return : ErrorStatus: SUCCESS or ERROR
-* Note : -The function returns ERROR if:
-* *trying to disable the PLL while it is selected as the MCLK
-* *trying to enable the PLL while it is already enabled and
-* locked
-*******************************************************************************/
-ErrorStatus SCU_PLLCmd(FunctionalState NewState)
-{
- vu32 i;
- if (NewState==ENABLE)
- {
- if (!((SCU->PLLCONF&SCU_PLLEN)&&(SCU->SYSSTATUS&SCU_FLAG_LOCK)))
- {
- SCU->SYSSTATUS|=SCU_FLAG_LOCK; /*clear LOCK bit*/
- SCU->PLLCONF |=SCU_PLLEN; /*PLL Enable*/
- while(!SCU->SYSSTATUS&SCU_FLAG_LOCK); /*Wait PLL to lock*/
- return SUCCESS;
- }
- else return ERROR;
- }
- else /*NewState = DISABLE*/
- {
- if(SCU->CLKCNTR&0x3) /*check if PLL not sys CLK*/
- {
- for(i=10;i>0;i--); /*delay before PLL disabling*/
- SCU->PLLCONF &=~SCU_PLLEN; /*PLL Disable*/
- return SUCCESS;
- }
- else return ERROR;
- }
-}
-
-/*******************************************************************************
-* Function Name : SCU_RCLKDivisorConfig
-* Description : Sets the RCLK divisor value
-* Input : RCLK_Divisor
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_RCLKDivisorConfig(u32 RCLK_Divisor)
-{
- SCU->CLKCNTR &=SCU_RCLK_Div1; /*clear RCLKDIV[2:0] field*/
- if (RCLK_Divisor!=SCU_RCLK_Div1)
- SCU->CLKCNTR |= RCLK_Divisor; /*update field with RCLK divisor*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_HCLKDivisorConfig
-* Description : Sets the HCLK divisor value
-* Input : HCLK_Divisor
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_HCLKDivisorConfig(u32 HCLK_Divisor)
-{
- SCU->CLKCNTR &=SCU_HCLK_Div1; /*clear AHBDIV[1:0] field*/
- if (HCLK_Divisor!=SCU_HCLK_Div1)
- SCU->CLKCNTR |= HCLK_Divisor; /*update field with HCLK divisor*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_PCLKDivisorConfig
-* Description : Sets the PCLK divisor value
-* Input : PCLK_Divisor
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_PCLKDivisorConfig(u32 PCLK_Divisor)
-{
- SCU->CLKCNTR &=SCU_PCLK_Div1; /*clear APBDIV[1:0] field*/
- if (PCLK_Divisor!=SCU_PCLK_Div1)
- SCU->CLKCNTR |= PCLK_Divisor; /*update field with PCLK Divisor*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_APBPeriphClockConfig
-* Description : Enable the clock for an APB peripheral
-* Input : -APBPerip : APB peripherals(__RTC, __ADC ,...)
-* -NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_APBPeriphClockConfig(u32 APBPeriph, FunctionalState NewState)
-{
- if (NewState==ENABLE) /*Enable clock for APB peripheral*/
- SCU->PCGR1 |=APBPeriph;
- else
- SCU->PCGR1 &=~APBPeriph; /*Disable clock for APB peripheral*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_AHBPeriphClockConfig
-* Description : Enable the clock for an AHB peripheral
-* Input : -AHBPerip: AHB peripherals(__USB, __DMA,...)
-* -NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_AHBPeriphClockConfig(u32 AHBPeriph, FunctionalState NewState)
-{
- if (NewState==ENABLE) /*Enable clock for AHB peripheral*/
- SCU->PCGRO |=AHBPeriph;
- else
- SCU->PCGRO &=~AHBPeriph; /*Disable clock for AHB peripheral*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_APBPeriphReset
-* Description : Assert or deassert Reset on APB peripheral
-* Input : -APBPeriph: APB peripherals(__RTC, __ADC,...)
- -NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_APBPeriphReset(u32 APBPeriph, FunctionalState NewState)
-{
- if (NewState==DISABLE) /*APB peripheral not held in Reset*/
- SCU->PRR1 |=APBPeriph;
- else
- SCU->PRR1 &=~APBPeriph; /*APB peripheral held in Reset*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_AHBPeriphReset
-* Description : Assert or deassert Reset on AHB peripheral
-* Input : -AHBPeriph: AHB peripherals(__USB, __DMA,...)
- -NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_AHBPeriphReset(u32 AHBPeriph, FunctionalState NewState)
-{
- if (NewState==DISABLE)
- SCU->PRR0 |=AHBPeriph; /*AHB peripheral not held in Reset*/
- else
- SCU->PRR0 &=~AHBPeriph; /*AHB peripheral held in Reset*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_APBPeriphIdleConfig
-* Description : Enable or Disable Periph Clock during Idle mode
-* Input : -APBPeriph: APB peripherals(__RTC, __ADC,...)
- -NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_APBPeriphIdleConfig(u32 APBPeriph, FunctionalState NewState)
-{
- if (NewState==ENABLE)
- SCU->MGR1 |=APBPeriph; /*APB peripheral clock enabled during Idle mode*/
- else
- SCU->MGR1 &=~APBPeriph; /*APB peripheral clock disabled during Idle mode*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_AHBPeriphIdleConfig
-* Description : Enable or Disable Periph Clock during Idle mode
-* Input : -AHBPeriph: AHB peripherals(__USB, __DMA,...)
- -NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_AHBPeriphIdleConfig(u32 AHBPeriph, FunctionalState NewState)
-{
- if (NewState==ENABLE)
- SCU->MGR0 |=AHBPeriph; /*AHB peripheral clock enabled during Idle mode*/
- else
- SCU->MGR0 &=~AHBPeriph; /*AHB peripheral clock disabled during Idle mode*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_APBPeriphDebugConfig
-* Description : Enable or Disable Periph Clock during ARM debug state
-* Input : -APBPeriph: APB peripherals(__RTC, __ADC,...)
- -NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_APBPeriphDebugConfig(u32 APBPeriph, FunctionalState NewState)
-{
- if (NewState==ENABLE)
- SCU->PECGR1 |=APBPeriph; /*APB peripheral clock enabled during ARM debug state*/
- else
- SCU->PECGR1 &=~APBPeriph; /*APB peripheral clock disabled during ARM debug state*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_AHBPeriphDebugConfig
-* Description : Enable or Disable Periph Clock during ARM debug state
-* Input : -AHBPeriph: AHB peripherals(__USB, __DMA,...)
- -NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_AHBPeriphDebugConfig(u32 AHBPeriph, FunctionalState NewState)
-{
- if (NewState==ENABLE)
- SCU->PECGR0 |=AHBPeriph; /*AHB peripheral clock enabled during ARM debug state*/
- else
- SCU->PECGR0 &=~AHBPeriph; /*AHB peripheral clock disabled during ARM debug state*/
-}
-/*******************************************************************************
-* Function Name : SCU_BRCLKDivisorConfig
-* Description : Sets the BRCLK divisor value
-* Input : BRCLK_Divisor
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_BRCLKDivisorConfig(u32 BRCLK_Divisor)
-{
- SCU->CLKCNTR &=SCU_BRCLK_Div1; /*Clear BRSEL bit*/
- if (BRCLK_Divisor!=SCU_BRCLK_Div1)
- SCU->CLKCNTR |= SCU_BRCLK_Div2; /*set bit BRSEL*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_TIMCLKSourceConfig
-* Description : Sets the TIMx clock source
-* Input : - TIMx : SCU_TIM01 or SCU_TIM23
-* - TIMCLK_Source = SCU_TIMCLK_EXT or SCU_TIMCLK_INT
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_TIMCLKSourceConfig(u8 TIMx, u32 TIMCLK_Source)
-{
- if (TIMx== SCU_TIM01) /*TIM01 clock source configuration*/
- {
- SCU->CLKCNTR &=0xFFFFDFFF;
- if (TIMCLK_Source == SCU_TIMCLK_EXT)
- SCU->CLKCNTR |=0x2000;
- }
- else
- {
- SCU->CLKCNTR &=0xFFFFBFFF; /*TIM23 clock source configuration*/
- if (TIMCLK_Source == SCU_TIMCLK_EXT)
- SCU->CLKCNTR |=0x4000;
- }
-}
-
-/*******************************************************************************
-* Function Name : SCU_TIMPresConfig
-* Description : Sets the TIMx Prescaler Value
-* Input : - TIMx : SCU_TIM01 or SCU_TIM23
-* - Prescaler (16 bit value)
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_TIMPresConfig(u8 TIMx, u16 Prescaler)
-{
- if (TIMx==SCU_TIM01) /*TIM01 Prescaler configuration*/
- SCU->SCR1 = Prescaler&0xFFFF;
- else
- SCU->SCR2 = Prescaler&0xFFFF; /*TIM23 Prescaler configuration*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_USBCLKConfig
-* Description : Configures the clock source for the 48MHz USBCLK
-* Input : USBCLK_Source: SCU_USBCLK_MCLK,SCU_USBCLK_MCLK2 or SCU_USBCLK_EXT
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_USBCLKConfig(u32 USBCLK_Source)
-{
- SCU->CLKCNTR &=SCU_USBCLK_MCLK; /*clear USBSEL[1:0] field*/
- if (USBCLK_Source!=SCU_USBCLK_MCLK)
- SCU->CLKCNTR |= USBCLK_Source; /*update field with USBCLK_Source*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_PHYCLKConfig
-* Description : Enable or Disable PHY clock output
-* Input : NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_PHYCLKConfig(FunctionalState NewState)
-{
- if (NewState==ENABLE)
- SCU->CLKCNTR |= 0x1000; /*enable MIIPHY clock*/
- else
- SCU->CLKCNTR &=~0x1000; /*disable MIIPHY clock*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_FMICLKDivisorConfig
-* Description : Set the FMI clock divisor
-* Input : FMICLK_Divisor: SCU_FMICLK_Div1 or SCU_FMICLK_DIV2
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_FMICLKDivisorConfig(u32 FMICLK_Divisor)
-{
- SCU->CLKCNTR &=SCU_FMICLK_Div1; /*FMICLK = RCLK*/
- if (FMICLK_Divisor!=SCU_FMICLK_Div1)
- SCU->CLKCNTR |=SCU_FMICLK_Div2; /*FMICLK = RCLK/2 */
-}
-
-/*******************************************************************************
-* Function Name : SCU_EMIBCLKDivisorConfig
-* Description : Set the EMI Bus clock divisor: EMIBCLK = HCLK or HCLK/2
-* Input : SCU_EMICLK: SCU_EMIBCLK_Div1 , SCU_EMIBCLK_Div2
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_EMIBCLKDivisorConfig(u32 SCU_EMIBCLK)
-{
- SCU->CLKCNTR &=SCU_EMIBCLK_Div1; /*EMIBCLK = HCLK */
- if (SCU_EMIBCLK!=SCU_EMIBCLK_Div1)
- SCU->CLKCNTR |= SCU_EMIBCLK_Div2; /*EMIBCLK = HCLK/2 */
-}
-
-/*******************************************************************************
-* Function Name : SCU_EMIModeConfig
-* Description : Configure the EMI as Multiplexed or Demultiplexed
-* Input : SCU_EMIMODE : SCU_EMI_MUX or SCU_EMI_DEMUX
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_EMIModeConfig(u32 SCU_EMIMODE)
-{
- SCU->SCR0 &=SCU_EMI_MUX; /*EMI mode = Multiplexed*/
- if (SCU_EMIMODE!=SCU_EMI_MUX)
- SCU->SCR0 |= SCU_EMI_DEMUX; /*EMI mode = Demultiplexed*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_EMIALEConfig
-* Description : Configure the ALE signal (length & polarity)
-* Input : -SCU_EMIALE_LEN : SCU_EMIALE_LEN1 or SCU_EMIALE_LEN2
-* -SCU_EMIALE_POL : SCU_EMIALE_POLLow or SCU_EMI_POLHigh
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_EMIALEConfig(u32 SCU_EMIALE_LEN, u32 SCU_EMIALE_POL)
-{
- /*Configure EMI ALE Length*/
- SCU->SCR0 &=SCU_EMIALE_LEN1;
- if (SCU_EMIALE_LEN!=SCU_EMIALE_LEN1)
- SCU->SCR0 |= SCU_EMIALE_LEN2;
-
- /*Configure EMI ALE POL*/
- SCU->SCR0 &=SCU_EMIALE_POLLow;
- if (SCU_EMIALE_POL!=SCU_EMIALE_POLLow)
- SCU->SCR0 |= SCU_EMIALE_POLHigh;
-}
-
-/*******************************************************************************
-* Function Name : SCU_ITConfig
-* Description : ENBALE or DISABLE an SCU interrupt
-* Input : -SCU_IT: interrupt mask
-* -NewState: ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_ITConfig(u32 SCU_IT, FunctionalState NewState)
-{
- if (NewState==ENABLE)
- SCU->ITCMSK&=~SCU_IT; /*IT enable */
- else
- SCU->ITCMSK|=SCU_IT; /*IT disable( mask)*/
-}
-
-/*******************************************************************************
-* Function Name : SCU_GetFlagStatus
-* Description : Returns flag status
-* Input : SCU_Flag
-* Output : NONE
-* Return : SET or RESET
-*******************************************************************************/
-FlagStatus SCU_GetFlagStatus(u32 SCU_Flag)
-{
- if (SCU->SYSSTATUS&SCU_Flag)
- return SET;
- else return RESET;
-}
-
-/*******************************************************************************
-* Function Name : SCU_ClearFlag
-* Description : Clears a SYSTATUS Flag
-* Input : SCU_Flag
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_ClearFlag(u32 SCU_Flag)
-{
- SCU->SYSSTATUS = SCU_Flag;
-}
-/*******************************************************************************
-* Function Name : SCU_GetPLLfreqValue
-* Description : Gets the current PLL frequency
-* Input : None
-* Output : None
-* Return : PLL frequency (KHz)
-*******************************************************************************/
-u32 SCU_GetPLLFreqValue(void)
-{
- u8 PLL_M;
- u8 PLL_N;
- u8 PLL_P;
-
- PLL_M = SCU->PLLCONF&0xFF;
- PLL_N = (SCU->PLLCONF&0xFF00)>>8;
- PLL_P = (SCU->PLLCONF&0x70000)>>16;
-
- if ((PLL_M>0)&&(PLL_N>0))
- return (u32)(((_Main_Crystal*2)*PLL_N)/(PLL_M<<PLL_P));
-
- else return 0;
-}
-/*******************************************************************************
-* Function Name : SCU_GetMCLKFreqValue
-* Description : Gets the current MCLK frequency
-* Input : None
-* Output : None
-* Return : MCLK frequency (KHz)
-*******************************************************************************/
-u32 SCU_GetMCLKFreqValue(void)
-{
- if ((SCU->CLKCNTR&0x3) == 0x2) return (u32)(_Main_Crystal);
- if ((SCU->CLKCNTR&0x3) == 0x1) return (u32)(32);
- else return (SCU_GetPLLFreqValue());
-}
-
-/*******************************************************************************
-* Function Name : SCU_GetRCLKFreqValue
-* Description : Gets the current RCLK frequency
-* Input : None
-* Output : None
-* Return : RCLK frequency (KHz)
-*******************************************************************************/
-u32 SCU_GetRCLKFreqValue(void)
-{
- u8 RCLK_Div;
- RCLK_Div = (SCU->CLKCNTR&0x1C)>>2;
- if (RCLK_Div==0x5) RCLK_Div=10;
- return (u32)(SCU_GetMCLKFreqValue() >>RCLK_Div);
-}
-
-/*******************************************************************************
-* Function Name : SCU_GetHCLKFreqValue
-* Description : Gets the current PCLK frequency
-* Input : None
-* Output : None
-* Return : HCLK frequency (KHz)
-*******************************************************************************/
-u32 SCU_GetHCLKFreqValue(void)
-{
- u8 HCLK_Div;
- HCLK_Div = (SCU->CLKCNTR&0x60)>>5;
- return (u32)(SCU_GetRCLKFreqValue() >>HCLK_Div);
-}
-
-/*******************************************************************************
-* Function Name : SCU_GetPCLKFreqValue
-* Description : Gets the current HCLK frequency
-* Input : None
-* Output : None
-* Return : PCLK frequency (KHz)
-*******************************************************************************/
-u32 SCU_GetPCLKFreqValue(void)
-{
- u8 PCLK_Div;
- PCLK_Div = (SCU->CLKCNTR&0x180)>>7;
- return (u32)(SCU_GetRCLKFreqValue() >>PCLK_Div);
-}
-
-/*******************************************************************************
-* Function Name : SCU_WakeUpLineConfig
-* Description : Configures an External interrupt as WakeUp line
-* Input : EXTint : 0 -> 31
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_WakeUpLineConfig(u8 EXTint)
-{
- if (EXTint < 8)
- {
- SCU->WKUPSEL&=~0x7;
- SCU->WKUPSEL|=EXTint;
- }
- else if (EXTint<16)
- {
- SCU->WKUPSEL&=~0x38;
- SCU->WKUPSEL|=(EXTint-8)<<3;
- }
- else if (EXTint<24)
- {
- SCU->WKUPSEL&=~0x1C0;
- SCU->WKUPSEL|=(EXTint-16)<<6;
- }
- else
- {
- SCU->WKUPSEL&=~0xE00;
- SCU->WKUPSEL|=(EXTint-24)<<9;
- }
-}
-
-/*******************************************************************************
-* Function Name : SCU_SpecIntRunModeConfig
-* Description : Enables or Disables the Special Run mode
-* Input : newstate = ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_SpecIntRunModeConfig(FunctionalState NewState)
-{
- if (NewState == ENABLE)
- SCU->PWRMNG |=0x8;
- else
- SCU->PWRMNG &=~0x8;
-}
-/*******************************************************************************
-* Function Name : SCU_EnterIdleMode
-* Description : Enters in Idle mode
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_EnterIdleMode(void)
-{
- SCU->PWRMNG |=0x1;
-}
-/*******************************************************************************
-* Function Name : SCU_EnterSleepMode
-* Description : Enters in Sleep mode
-* Input : None
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_EnterSleepMode(void)
-{
- SCU->PWRMNG |=0x2;
-}
-
-/*******************************************************************************
-* Function Name : SCU_UARTIrDAConfig
-* Description : Enable or Disable the Irda mode for UARTx
-* Input : - UARTx :x=0,1 or 2
-* - UART_IrDA_Mode : SCU_UARTMode_IrDA or SCU_UARTMode_UART
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_UARTIrDASelect(UART_TypeDef * UARTx, u8 UART_IrDA_Mode)
-{
- if (UART_IrDA_Mode == SCU_UARTMode_IrDA)
- {
- if (UARTx== UART0) SCU->SCR0 |=0x400;
- else if (UARTx==UART1) SCU->SCR0 |=0x800;
- else SCU->SCR0 |=0x1000;
- }
- else
- {
- if (UARTx== UART0) SCU->SCR0 &=~0x400;
- else if (UARTx==UART1) SCU->SCR0 &=~0x800;
- else SCU->SCR0 &=~0x1000;
- }
-}
-/*******************************************************************************
-* Function Name : SCU_PFQBCCmd
-* Description : Enable or Disable PFQBC
-* Input : NewState : ENABLE or DISABLE
-* Output : None
-* Return : None
-*******************************************************************************/
-void SCU_PFQBCCmd(FunctionalState NewState)
-{
- if (NewState==ENABLE)
- SCU->SCR0 |=0x1;
- else SCU->SCR0 &=~0x1;
-}
-
-/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
diff --git a/uc_str912/scripts/flash_str9.ld b/uc_str912/scripts/flash_str9.ld
deleted file mode 100644
index 7bd5a06..0000000
--- a/uc_str912/scripts/flash_str9.ld
+++ /dev/null
@@ -1,137 +0,0 @@
-/*** Linker Script File ***/
-/*** Hitex/We/2006-04-24 ***/
-
-/* Memory Definitions */
-/* for STR912-Eval */
-
-
-
-MEMORY
-{
- IntCodeFlash (rx) : ORIGIN = 0x00000000, LENGTH = 512k
- IntDataRAM (rw) : ORIGIN = 0x04000000, LENGTH = 96k
- IntDataEth (!rx) : ORIGIN = 0x07C00000, LENGTH = 0x42F /* AHB nonbuffered Ethernet RAM */
-}
-
-/* this address is used in startup for initilizing stack */
-/* stack is at the end of data range */
-
-PROVIDE(_top_stack_ = 0x4018000 -4);
-
-SECTIONS
-{
-
- /* first section is .text which is used for code */
- .start : { *(.startup)} >IntCodeFlash = 0
- .text :
- {
- /* here is the path to change and Processor-specific ISR_XXX-file */
- ./startup912.o (.text) /* Startup code */
- ./*(.text) /* remaining code */
- *(.glue_7t)
- *(.glue_7)
- } >IntCodeFlash =0
-
- __end_of_text__ = .;
-
- __exidx_start = .;
- .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) }
- __exidx_end = .;
-
-
-
- . = ALIGN(4);
-
- /* .rodata section which is used for read-only data (constants) */
-
- .rodata . :
- {
- *(.rodata)
- } >IntCodeFlash
-
- . = ALIGN(4);
-
- _etext = . ;
- PROVIDE (etext = .);
-
- /* .data section which is used for initialized data */
-
- .data : AT (_etext)
- {
- _data = . ;
- __data_beg_src__ = __end_of_text__;
- __data_start__ = . ;
- PROVIDE (__data_start__ = .) ;
- *(.data)
- SORT(CONSTRUCTORS)
- *(.ramfunc)
- } >IntDataRAM
- . = ALIGN(4);
-
- _edata = . ;
- PROVIDE (edata = .);
-
- /* .bss section which is used for uninitialized data */
-
- .bss :
- {
- __bss_start = . ;
- __bss_start__ = . ;
- *(.bss)
- *(COMMON)
- } >IntDataRAM
- . = ALIGN(4);
- __bss_end__ = . ;
- __bss_end = . ;
-
- _end = .;
- PROVIDE (end = .);
-
-.bss2 :
- {
- /* used for uninitialized data */
-
- __bss2_start = . ;
- __bss2_start__ = . ;
- *(COMMON)
- . = ALIGN(4);
- __bss2_end__ = . ;
-
- } >IntDataRAM
-
- /* 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) }
-}
-
-
diff --git a/uc_str912/scripts/load.gdb b/uc_str912/scripts/load.gdb
deleted file mode 100644
index 90cab56..0000000
--- a/uc_str912/scripts/load.gdb
+++ /dev/null
@@ -1,24 +0,0 @@
-set complaints 1
-set output-radix 16
-set input-radix 16
-set prompt (arm-gdb)
-target remote localhost:3333
-monitor reset init
-monitor halt
-# 16 = 450 bytes/sec
-# 32 = 870 bytes/sec
-# 64 = 1 kbyte/sec c bleibt nicht stehen
-# 127 = 2 kbyte/sec c bleibt nicht stehen
-# 250 = 4 kbyte/sec
-# 500 = 5 kbyte/sec
-# 1000 = 7 kbyte/sec
-# 2000 = 8 kbyte/sec
-# 3000 = 8 kbyte/sec
-monitor jtag_rclk 3000
-monitor str9x flash_config 0 4 2 0x00000 0x80000
-monitor flash protect 0 0 7 off
-monitor flash protect_check 0
-pwd
-load main.elf
-file main.elf
-#monitor jtag_rclk 3000
diff --git a/uc_str912/scripts/load_amontec.gdb b/uc_str912/scripts/load_amontec.gdb
deleted file mode 100644
index a846f82..0000000
--- a/uc_str912/scripts/load_amontec.gdb
+++ /dev/null
@@ -1,20 +0,0 @@
-set complaints 1
-set output-radix 16
-set input-radix 16
-set prompt (arm-gdb)
-
-target remote localhost:3333
-
-
-monitor reset init
-monitor halt
-monitor jtag_rclk 1000
-monitor str9x flash_config 0 4 2 0x00000 0x80000
-monitor flash protect 0 0 7 off
-monitor flash erase_sector 0 0 7
-
-
-
-pwd
-load main.elf
-#load test_led.elf
diff --git a/uc_str912/scripts/load_segger.gdb b/uc_str912/scripts/load_segger.gdb
deleted file mode 100644
index 569b5dc..0000000
--- a/uc_str912/scripts/load_segger.gdb
+++ /dev/null
@@ -1,18 +0,0 @@
-set complaints 1
-set output-radix 16
-set input-radix 16
-set prompt (arm-gdb)
-
-target remote localhost:2331
-
-monitor speed adaptive
-monitor endian little
-
-monitor reset
-monitor flash device = STR912
-monitor flash download = 1
-monitor halt
-
-pwd
-load main.elf
-file main.elf
diff --git a/uc_str912/scripts/str912_rom.ld b/uc_str912/scripts/str912_rom.ld
deleted file mode 100644
index 8cbb7f7..0000000
--- a/uc_str912/scripts/str912_rom.ld
+++ /dev/null
@@ -1,249 +0,0 @@
-/***********************************************************************************
-* Copyright 2005 Anglia Design
-* This demo code and associated components are provided as is and has no warranty,
-* implied or otherwise. You are free to use/modify any of the provided
-* code at your own risk in your applications with the expressed limitation
-* of liability (see below)
-*
-* LIMITATION OF LIABILITY: ANGLIA OR ANGLIA DESIGNS SHALL NOT BE LIABLE FOR ANY
-* LOSS OF PROFITS, LOSS OF USE, LOSS OF DATA, INTERRUPTION OF BUSINESS, NOR FOR
-* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND WHETHER UNDER
-* THIS AGREEMENT OR OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-*
-* Author : Spencer Oliver
-* Web : www.anglia-designs.com
-*
-***********************************************************************************/
-
-/* Stack Sizes */
-
- _STACKSIZE = 1024;
- _STACKSIZE_IRQ = 256;
- _STACKSIZE_FIQ = 0;
- _STACKSIZE_SVC = 1024;
- _STACKSIZE_ABT = 0;
- _STACKSIZE_UND = 0;
- _HEAPSIZE = 1024;
-
-/* Memory Definitions */
-
-MEMORY
-{
- CODE (rx) : ORIGIN = 0x00000000, LENGTH = 0x00080000
- DATA (rw) : ORIGIN = 0x04000000, LENGTH = 0x00018000
-}
-
-/* Section Definitions */
-
-SECTIONS
-{
- /* first section is .text which is used for code */
-
- .text :
- {
- CREATE_OBJECT_SYMBOLS
- KEEP(*(.vectors))
- KEEP(*(.init))
- *(.text .text.*)
- *(.gnu.linkonce.t.*)
- *(.glue_7t) *(.glue_7) *(.vfp11_veneer)
- KEEP(*(.fini))
- *(.gcc_except_table)
- } >CODE =0
- . = ALIGN(4);
-
- /* .ctors .dtors are used for c++ constructors/destructors */
-
- .ctors :
- {
- PROVIDE(__ctors_start__ = .);
- KEEP(*(SORT(.ctors.*)))
- KEEP(*(.ctors))
- PROVIDE(__ctors_end__ = .);
- } >CODE
-
- .dtors :
- {
- PROVIDE(__dtors_start__ = .);
- KEEP(*(SORT(.dtors.*)))
- KEEP(*(.dtors))
- PROVIDE(__dtors_end__ = .);
- } >CODE
-
- /* .rodata section which is used for read-only data (constants) */
-
- .rodata :
- {
- *(.rodata .rodata.*)
- *(.gnu.linkonce.r.*)
- } >CODE
- . = ALIGN(4);
-
- .init_array :
- {
- *(.init)
- *(.fini)
- PROVIDE_HIDDEN (__preinit_array_start = .);
- KEEP (*(.preinit_array))
- PROVIDE_HIDDEN (__preinit_array_end = .);
- PROVIDE_HIDDEN (__init_array_start = .);
- KEEP (*(SORT(.init_array.*)))
- KEEP (*(.init_array))
- PROVIDE_HIDDEN (__init_array_end = .);
- PROVIDE_HIDDEN (__fini_array_start = .);
- KEEP (*(.fini_array))
- KEEP (*(SORT(.fini_array.*)))
- PROVIDE_HIDDEN (__fini_array_end = .);
- } >CODE
-
- . = ALIGN(4);
-
- /* .ARM.exidx is sorted, so has to go in its own output section. */
- __exidx_start = .;
- .ARM.exidx :
- {
- *(.ARM.exidx* .gnu.linkonce.armexidx.*)
- } >CODE
- __exidx_end = .;
-
- _etext = .;
- PROVIDE (etext = .);
-
- /* .data section which is used for initialized data */
-
- .data : AT (_etext)
- {
- __data_start = .;
- *(.data .data.*)
- *(.gnu.linkonce.d.*)
- SORT(CONSTRUCTORS)
- . = ALIGN(4);
- *(.fastrun .fastrun.*)
- } >DATA
- . = ALIGN(4);
-
- _edata = .;
- PROVIDE (edata = .);
-
- /* .bss section which is used for uninitialized data */
-
- .bss :
- {
- __bss_start = .;
- __bss_start__ = .;
- *(.bss .bss.*)
- *(.gnu.linkonce.b.*)
- *(COMMON)
- . = ALIGN(4);
- } >DATA
- . = ALIGN(4);
- __bss_end__ = .;
-
- _end = .;
- PROVIDE(end = .);
-
- /* .heap section which is used for memory allocation */
-
- .heap (NOLOAD) :
- {
- __heap_start__ = .;
- *(.heap)
- . = MAX(__heap_start__ + _HEAPSIZE , .);
- } >DATA
- __heap_end__ = __heap_start__ + SIZEOF(.heap);
-
- /* .stack section - user mode stack */
-
- .stack (__heap_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_start__ = .;
- *(.stack)
- . = MAX(__stack_start__ + _STACKSIZE , .);
- } >DATA
- __stack_end__ = __stack_start__ + SIZEOF(.stack);
-
- /* .stack_irq section */
-
- .stack_irq (__stack_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_irq_start__ = .;
- *(.stack_irq)
- . = MAX(__stack_irq_start__ + _STACKSIZE_IRQ , .);
- } >DATA
- __stack_irq_end__ = __stack_irq_start__ + SIZEOF(.stack_irq);
-
- /* .stack_fiq section */
-
- .stack_fiq (__stack_irq_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_fiq_start__ = .;
- *(.stack_fiq)
- . = MAX(__stack_fiq_start__ + _STACKSIZE_FIQ , .);
- } >DATA
- __stack_fiq_end__ = __stack_fiq_start__ + SIZEOF(.stack_fiq);
-
- /* .stack_svc section */
-
- .stack_svc (__stack_fiq_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_svc_start__ = .;
- *(.stack_svc)
- . = MAX(__stack_svc_start__ + _STACKSIZE_SVC , .);
- } >DATA
- __stack_svc_end__ = __stack_svc_start__ + SIZEOF(.stack_svc);
-
- /* .stack_abt section */
-
- .stack_abt (__stack_svc_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_abt_start__ = .;
- *(.stack_abt)
- . = MAX(__stack_abt_start__ + _STACKSIZE_ABT , .);
- } >DATA
- __stack_abt_end__ = __stack_abt_start__ + SIZEOF(.stack_abt);
-
- /* .stack_und section */
-
- .stack_und (__stack_abt_end__ + 3) / 4 * 4 (NOLOAD) :
- {
- __stack_und_start__ = .;
- *(.stack_und)
- . = MAX(__stack_und_start__ + _STACKSIZE_UND , .);
- } >DATA
- __stack_und_end__ = __stack_und_start__ + SIZEOF(.stack_und);
-
- /* 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) }
-}
-
diff --git a/uc_str912/scripts/str912fw44.ld b/uc_str912/scripts/str912fw44.ld
deleted file mode 100644
index feabaa4..0000000
--- a/uc_str912/scripts/str912fw44.ld
+++ /dev/null
@@ -1,61 +0,0 @@
-OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
-OUTPUT_ARCH(arm)
-
-MEMORY
-{
- flash (RX) : ORIGIN = 0x00000000, LENGTH = 512k
- sram (W!RX) : ORIGIN = 0x04000000, LENGTH = 96k
-}
-
-SECTIONS
-{
- .fixed :
- {
- . = ALIGN(4);
- _sfixed = .;
- *(.text .text.*)
- *(.rodata .rodata.*)
- *(.gnu.linkonce.t.*)
- *(.glue_7)
- *(.glue_7t)
- *(.gcc_except_table)
- *(.gnu.linkonce.r.*)
- } >flash
-
-/* .ARM.extab : { *(.ARM.extab*) } */
-
- . = ALIGN(4);
-
- __exidx_start = .;
- .ARM.exidx : {
- *(.ARM.exidx* .gnu.linkonce.armexidx.*)
- } >flash
- __exidx_end = .;
-
- . = ALIGN(4);
-
- _efixed = .;
- PROVIDE(etext = .);
-
- .relocate : AT (_efixed)
- {
- . = ALIGN(4);
- _srelocate = .;
- *(.data .data.*)
- *(.gnu.linkonce.d.*)
- . = ALIGN(4);
- _erelocate = .;
- } >sram
-
- .bss (NOLOAD) : {
- _szero = .;
- *(.bss .bss.*)
- *(.gnu.linkonce.b.*)
- *(COMMON)
- . = ALIGN(4);
- _ezero = .;
- } >sram
- . = ALIGN(4);
-
- end = .;
-}
diff --git a/uc_str912/scripts/str91x-configs/str91x_flash.gdb b/uc_str912/scripts/str91x-configs/str91x_flash.gdb
deleted file mode 100644
index 2c194e2..0000000
--- a/uc_str912/scripts/str91x-configs/str91x_flash.gdb
+++ /dev/null
@@ -1,6 +0,0 @@
-target remote localhost:3333
-monitor reset
-monitor sleep 500
-monitor poll
-monitor soft_reset_halt
-monitor arm7_9 force_hw_bkpts enable
diff --git a/uc_str912/scripts/str91x-configs/str91x_flasherase.ocd b/uc_str912/scripts/str91x-configs/str91x_flasherase.ocd
deleted file mode 100644
index 7b998ea..0000000
--- a/uc_str912/scripts/str91x-configs/str91x_flasherase.ocd
+++ /dev/null
@@ -1,6 +0,0 @@
-wait_halt
-str9x flash_config 4 2 0 0x80000
-flash protect 0 0 10 off
-flash erase 0 0 10
-reset
-shutdown
diff --git a/uc_str912/scripts/str91x-configs/str91x_flashprobe.gdb b/uc_str912/scripts/str91x-configs/str91x_flashprobe.gdb
deleted file mode 100644
index aa528d3..0000000
--- a/uc_str912/scripts/str91x-configs/str91x_flashprobe.gdb
+++ /dev/null
@@ -1,10 +0,0 @@
-target remote localhost:3333
-monitor reset
-monitor sleep 500
-monitor poll
-monitor soft_reset_halt
-monitor flash protect 0 0 10 off
-monitor flash probe 0
-monitor flash info 0
-monitor reset run
-monitor sleep 500
diff --git a/uc_str912/scripts/str91x-configs/str91x_flashprogram.ocd b/uc_str912/scripts/str91x-configs/str91x_flashprogram.ocd
deleted file mode 100644
index ad854e1..0000000
--- a/uc_str912/scripts/str91x-configs/str91x_flashprogram.ocd
+++ /dev/null
@@ -1,7 +0,0 @@
-wait_halt
-str9x flash_config 4 2 0 0x80000
-flash protect 0 0 10 off
-flash erase 0 0 10
-flash write 0 main.bin 0
-reset
-shutdown
diff --git a/uc_str912/scripts/str91x-configs/str91x_jtagkey-flash-erase.cfg b/uc_str912/scripts/str91x-configs/str91x_jtagkey-flash-erase.cfg
deleted file mode 100644
index 16567d3..0000000
--- a/uc_str912/scripts/str91x-configs/str91x_jtagkey-flash-erase.cfg
+++ /dev/null
@@ -1,43 +0,0 @@
-#daemon configuration
-telnet_port 4444
-gdb_port 3333
-
-
-#interface
-interface ft2232
-ft2232_device_desc "Amontec JTAGkey A"
-ft2232_layout jtagkey
-#jtag_speed 1
-jtag_nsrst_delay 200
-jtag_ntrst_delay 200
-
-
-#use combined on interfaces or targets that can't set TRST/SRST separately
-reset_config trst_and_srst
-
-
-#jtag scan chain
-#format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)
-jtag_device 8 0x1 0x1 0xfe
-jtag_device 4 0x1 0xf 0xe
-jtag_device 5 0x1 0x1 0x1e
-
-
-#target configuration
-daemon_startup reset
-
-
-#target <type> <startup mode>
-#target arm966e <endianness> <reset mode> <chainpos> <variant>
-target arm966e little reset_init 1 arm966e
-run_and_halt_time 0 30
-
-
-working_area 0 0x50000000 16384 nobackup
-
-
-#flash bank <driver> <base> <size> <chip_width> <bus_width>
-flash bank str9x 0x00000000 0x00080000 0 0 0
-
-#Script used for FLASH erasing
-target_script 0 reset C:\openocd-configs\str91x-configs\str91x_flasherase.ocd
diff --git a/uc_str912/scripts/str91x-configs/str91x_jtagkey-flash-program.cfg b/uc_str912/scripts/str91x-configs/str91x_jtagkey-flash-program.cfg
deleted file mode 100644
index c264096..0000000
--- a/uc_str912/scripts/str91x-configs/str91x_jtagkey-flash-program.cfg
+++ /dev/null
@@ -1,43 +0,0 @@
-#daemon configuration
-telnet_port 4444
-gdb_port 3333
-
-
-#interface
-interface ft2232
-ft2232_device_desc "Amontec JTAGkey A"
-ft2232_layout jtagkey
-#jtag_speed 1
-jtag_nsrst_delay 200
-jtag_ntrst_delay 200
-
-
-#use combined on interfaces or targets that can't set TRST/SRST separately
-reset_config trst_and_srst
-
-
-#jtag scan chain
-#format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)
-jtag_device 8 0x1 0x1 0xfe
-jtag_device 4 0x1 0xf 0xe
-jtag_device 5 0x1 0x1 0x1e
-
-
-#target configuration
-daemon_startup reset
-
-
-#target <type> <startup mode>
-#target arm966e <endianness> <reset mode> <chainpos> <variant>
-target arm966e little reset_init 1 arm966e
-run_and_halt_time 0 30
-
-
-working_area 0 0x50000000 16384 nobackup
-
-
-#flash bank <driver> <base> <size> <chip_width> <bus_width>
-flash bank str9x 0x00000000 0x00080000 0 0 0
-
-#Script used for FLASH programming
-target_script 0 reset C:\openocd-configs\str91x-configs\str91x_flashprogram.ocd
diff --git a/uc_str912/scripts/str91x-configs/str91x_jtagkey.cfg b/uc_str912/scripts/str91x-configs/str91x_jtagkey.cfg
deleted file mode 100644
index 6394ddc..0000000
--- a/uc_str912/scripts/str91x-configs/str91x_jtagkey.cfg
+++ /dev/null
@@ -1,42 +0,0 @@
-#daemon configuration
-telnet_port 4444
-gdb_port 3333
-
-
-#interface
-interface ft2232
-ft2232_device_desc "Amontec JTAGkey A"
-ft2232_layout jtagkey
-#jtag_speed 1
-
-
-#use combined on interfaces or targets that can't set TRST/SRST separately
-reset_config trst_and_srst
-
-
-#jtag scan chain
-#format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)
-jtag_device 8 0x1 0x1 0xfe
-jtag_device 4 0x1 0xf 0xe
-jtag_device 5 0x1 0x1 0x1e
-
-
-#target configuration
-daemon_startup reset
-
-
-#target <type> <startup mode>
-#target arm966e <endianness> <reset mode> <chainpos> <variant>
-target arm966e little reset_halt 1 arm966e
-run_and_halt_time 0 30
-
-
-working_area 0 0x50000000 16384 nobackup
-
-
-#flash bank <driver> <base> <size> <chip_width> <bus_width>
-flash bank str9x 0x00000000 0x00080000 0 0 0
-
-
-# For more information about the configuration files, take a look at:
-# http://openfacts.berlios.de/index-en.phtml?title=Open On-Chip Debugger
diff --git a/uc_str912/scripts/str91x-configs/str91x_ram.gdb b/uc_str912/scripts/str91x-configs/str91x_ram.gdb
deleted file mode 100644
index de9e060..0000000
--- a/uc_str912/scripts/str91x-configs/str91x_ram.gdb
+++ /dev/null
@@ -1,6 +0,0 @@
-target remote localhost:3333
-monitor reset
-monitor sleep 500
-monitor poll
-monitor soft_reset_halt
-monitor arm7_9 sw_bkpts enable
diff --git a/uc_str912/scripts/test.gdb b/uc_str912/scripts/test.gdb
deleted file mode 100644
index adca3a3..0000000
--- a/uc_str912/scripts/test.gdb
+++ /dev/null
@@ -1,42 +0,0 @@
-set complaints 1
-set output-radix 16
-set input-radix 16
-set prompt (arm-gdb)
-target remote localhost:3333
-monitor reset
-monitor jtag_rclk 1000
-#monitor arm7_9 dcc_downloads enable
-#monitor arm7_9 fast_memory_access enable
-monitor poll
-monitor halt
-#bbsr = FMI_BBSR
-#nbsr = FMI_NBBSR
-# info lt. RM0006
-# BBSIZE
-# 0000 = 32 kB
-# 0001 = 64 kB
-# 1011 = 64 MByte
-# NBBSIZE
-# 0000 = 8 kB
-# 0001 = 16 kB
-# 1011 = 64 MByte
-monitor str9x flash_config 0 4 2 0x00000 0x80000
-monitor flash protect 0 0 7 off
-monitor flash protect_check 0
-monitor flash info 0
-
-set remotetimeout 10000
-
-pwd
-
-#monitor flash write_image erase ../main.elf 0 elf
-#monitor flash write_image erase ../main.hex 0 ihex
-#monitor flash write_image erase ../main.bin 0 bin
-#monitor flash write_image erase ../test_led.elf 0 elf
-#load test_led.elf
-load main.elf
-
-#monitor sleep 200
-#monitor reset
-kill
-quit
diff --git a/uc_str912/segger.gdb b/uc_str912/segger.gdb
deleted file mode 100644
index 31f9031..0000000
--- a/uc_str912/segger.gdb
+++ /dev/null
@@ -1,17 +0,0 @@
-set complaints 1
-set output-radix 16
-set input-radix 16
-set prompt (arm-gdb)
-
-target remote localhost:2331
-
-monitor speed adaptive
-monitor endian little
-
-monitor reset
-monitor flash device = STR912FAW44
-monitor flash breakpoints = 1
-monitor flash download = 1
-monitor halt
-
-pwd
diff --git a/vhdl_arithmetik/VHDL_arithmetic.csv b/vhdl_arithmetik/VHDL_arithmetic.csv
deleted file mode 100644
index aaf4bbc..0000000
--- a/vhdl_arithmetik/VHDL_arithmetic.csv
+++ /dev/null
@@ -1,77 +0,0 @@
-;min;max;;;;;;
-signed n;-(2^(n-1));(2^(n-1))-1;;;;;;
-signed 3;-4;3;;;;;;
-signed 4;-8;7;;;;;;
-unsigned n;0;(2^n)-1;;;;;;
-unsigned 3;0;7;;;;;;
-unsigned 4;0;15;;;;;;
-;;;;;;;;
-;;;;mathematical = Matlab;;;std_logic_arith;numeric_std
-;OP;arg1;arg2;type;min;max;;
-;+;signed n;signed m;signed max(n,m)+1;"min(arg1)+min(arg2) =
--(2^(n-1)) - (2^(m-1))";"max(arg1)+max(arg2) =
-(2^(n-1)) + (2^(m-1))-2";signed max(n, m);signed max(n, m)
-;;signed 3;signed 4;signed 5;-12;10;;
-;;unsigned n;unsigned m;unsigned max(n,m)+1;min(arg1)+min(arg2) = 0;"max(arg1)+max(arg2) =
-(2^n)+(2^m)-2";unsigned max(n, m);unsigned max(n, m)
-;;unsigned 3;unsigned 4;unsigned 5;0;22;;
-;;signed n;unsigned m;signed max(n,m+1)+1;"min(arg1)+min(arg2) =
--(2^(n-1))";"max(arg1)+max(arg2) =
-(2^(n-1)) + (2^m)-2";signed max(n, m+1);
-;;signed 4;unsigned 3;signed 5;-8;14;;
-;;signed 3;unsigned 4;signed 6;-4;18;;
-;- (binary);signed n;signed m;signed max(n,m)+1;"min(arg1)-max(arg2) =
--(2^(n-1))-(2^(m-1))+1";"max(arg1)-min(arg2) =
-(2^(n-1))-1 + (2^(m-1))";signed max(n, m);signed max(n, m)
-;;signed 4;signed 3;signed 5;-11;11;;
-;;signed 3;signed 4;signed 5;-11;11;;
-;;unsigned n;unsigned m;signed max(n,m)+1;"min(arg1)-max(arg2) =
--(2^m)+1";"max(arg1)-min(arg2) =
-(2^n)-1";unsigned max(n, m);unsigned max(n, m)
-;;unsigned 4;unsigned 3;signed 5;-7;15;;
-;;unsigned 3;unsigned 4;signed 5;-15;7;;
-;;signed n;unsigned m;signed max(n,m+1)+1;"min(arg1)-max(arg2) =
--(2^(n-1))-(2^m)+1";"max(arg1)-min(arg2) =
-2^(n-1))-1";signed max(n, m+1);
-;;signed 4;unsigned 3;signed 5;-15;7;;
-;;signed 3;unsigned 4;signed 6;-19;3;;
-;;unsigned n;signed m;signed max(n+1,m)+1;"min(arg1)-max(arg2) =
--(2^(m-1))+1";"max(arg1)-min(arg2) =
-(2^n)-1 + (2^(m-1))";signed max(n+1, m);
-;;unsigned 4;signed 3;signed 6;-3;19;;
-;;unsigned 3;signed 4;signed 5;-7;15;;
-;- (unary);signed n;;signed (n+1);-max(arg1) = -(2^(n-1))+1;-min(arg1) = (2^(n-1));signed n;signed n
-;;signed 4;;signed 5;-7;8;;
-;;unsigned n;;signed (n+1);-max(arg1) = -((2^n)-1);-min(arg1) = 0;;
-;;unsigned 4;;signed 5;-15;0;;
-;*;signed n;signed m;signed (n+m);"n<=m:
-min(arg1)*max(arg2) =
--(2^(n-1))*((2^(m-1))-1)
-n>=m:
-max(arg1)*min(arg2) =
--(2^(m-1))*((2^(n-1))-1)";"min(arg1)* min(arg2) =
-(2^(n-1)) * (2^(n-1))";signed n+m;signed n+m
-;;signed 3;signed 4;signed 7;-28;32;;
-;;unsigned n;unsigned m;unsigned (n+m);min(arg1)*min(arg2) = 0;"max(arg1)*max(arg2) =
-((2^n)-1)*((2^m)-1) =
-2^(n+m)-2^n-2^m+1";unsigned (n+m);unsigned (n+m)
-;;unsigned 3;unsigned 4;unsigned 7;0;105;;
-;;signed n;unsigned m;signed (n+m);"min(arg1)*max(arg2) =
--(2^(n-1)) * ((2^m)-1)";"max(arg1)*max(arg2) =
-(2^(n-1)-1) * ((2^m)-1)";signed n+m+1;
-;;signed 4;unsigned 3;signed 7;-56;49;;
-;;signed 3;unsigned 4;signed 7;-60;45;;
-;/;signed n;signed m;signed n+1;;;;
-;;signed 3;signed 4;signed 4;-4;4;;
-;;signed 4;signed 3;signed 5;-8;8;;
-;;unsigned n;unsigned m;unsigned n;;;;
-;;unsigned 3;unsigned 4;unsigned 3;0;7;;
-;;signed n;unsigned m;signed;;;;
-;;unsigned m;signed m;signed;;;;
-;abs;signed n;;signed n+1;-(2^(n-1))+1;2^(n-1);;
-;;signed 3;;signed 4;-3;4;;
-;;;;;;;;
-Meaning:;range not sufficient;;;;;;;
-;range larger than needed;;;;;;;
-;example;;;;;;;
-;function not available;;;;;;;
diff --git a/vhdl_arithmetik/VHDL_arithmetic.ods b/vhdl_arithmetik/VHDL_arithmetic.ods
deleted file mode 100644
index a157df7..0000000
--- a/vhdl_arithmetik/VHDL_arithmetic.ods
+++ /dev/null
Binary files differ
diff --git a/vhdl_arithmetik/VHDL_arithmetic.pdf b/vhdl_arithmetik/VHDL_arithmetic.pdf
deleted file mode 100644
index 9d16f1d..0000000
--- a/vhdl_arithmetik/VHDL_arithmetic.pdf
+++ /dev/null
Binary files differ
diff --git a/vhdl_arithmetik/VHDL_arithmetic.xls b/vhdl_arithmetik/VHDL_arithmetic.xls
deleted file mode 100644
index 5231336..0000000
--- a/vhdl_arithmetik/VHDL_arithmetic.xls
+++ /dev/null
Binary files differ
diff --git a/vhdl_arithmetik/VHDL_arithmetic.xlsx b/vhdl_arithmetik/VHDL_arithmetic.xlsx
deleted file mode 100644
index 33c90d6..0000000
--- a/vhdl_arithmetik/VHDL_arithmetic.xlsx
+++ /dev/null
Binary files differ
OpenPOWER on IntegriCloud