[uCsimm] Improved Xcopilot: one "XCOPILOT_BUGS" obsoleted

From: Bernhard Kuhn (kuhn@batian.lpr.e-technik.tu-muenchen.de)
Date: Mon Jan 10 2000 - 18:17:33 EST


Hi!

I have played around a little more with xcopilot an enhanced
the timer support. Now, xcopilot supports additionaly to
the usual system clock:

o clock prescalar register
o 32KHz-clock
o system clock divided by 16

the patch is rather simple:

just download xcopilot and the patch, patch the sources, compile and install
it this way:

cd /tmp
wget http://xcopilot.cuspy.com/build/xcopilot-0.6.6.tar.gz
wget http://www.rcs.ei.tum.de/~kuhn/uclinux/xcopilot-0.6.6_improved_timer.diff
tar -xzf xcopilot-0.6.6.tar.gz
cd xcopilot-0.6.6
patch -p1 < ../xcopilot-0.6.6_improved_timer.diff
./configure
make
cp xcopilot /usr/local/bin
cd ..
rm -rf xcopilot-0.6.6
rm xcopilot-0.6.6.tar.gz
rm xcopilot-0.6.6_improved_timer.diff

[uClinux] This patch obsolets the special timer setting
in ../linux/arch/m68knommu/platform/68328/config.c

Bernhard

------------------------ cut here -------------------------------
diff -urN xcopilot-0.6.6/mc68k/fab_custom.c xcopilot-0.6.6.patched/mc68k/fab_cus
tom.c
--- xcopilot-0.6.6/mc68k/fab_custom.c Wed Jul 29 01:08:48 1998
+++ xcopilot-0.6.6.patched/mc68k/fab_custom.c Mon Jan 10 23:26:46 2000
@@ -1161,7 +1161,46 @@
 void
 do_cycles(int longtime)
 {
+
+ db_32KCLK_counter++;
+ if(db_32KCLK_counter == 518) db_32KCLK_counter = 0;
+
+ db_TDIV16_counter++;
+ if(db_TDIV16_counter == 16) db_TDIV16_counter = 0;
+
+ if (db_TCTL1.anon.TEN) {
+
+ if ((db_TCTL1.anon.CLKSOURCE == 1) ||
+ ((db_TCTL1.anon.CLKSOURCE == 2) && (db_TDIV16_counter == 0)) ||
+ ((db_TCTL1.anon.CLKSOURCE & 4) && (db_32KCLK_counter == 0))) {
+
+ db_TPRER1_counter++;
+ if(db_TPRER1_counter>db_TPRER1.anon.PRESCALE) {
+ db_TPRER1_counter = 0;
+ db_TCN1.anon.COUNT++;
+
+ if (db_TCN1.anon.COUNT > db_TCMP1.anon.COMPARE || longtime) {
+ db_TSTAT1.anon.COMP = 1;
+ if (db_TCTL1.anon.FRR == 0) {
+ db_TCN1.anon.COUNT = 0;
+ }
+ if (db_TCTL1.anon.IRQEN) {
+ db_IPR.anon.TMR1 = 1;
+ updateisr();
+ }
+ }
+ }
+ }
+ }
+
        if (db_TCTL2.anon.TEN) {
+ if ((db_TCTL2.anon.CLKSOURCE == 1) ||
+ ((db_TCTL2.anon.CLKSOURCE == 2) && (db_TDIV16_counter == 0)) ||
+ ((db_TCTL2.anon.CLKSOURCE & 4) && (db_32KCLK_counter == 0))) {
+
+ db_TPRER2_counter++;
+ if(db_TPRER2_counter>db_TPRER2.anon.PRESCALE) {
+ db_TPRER2_counter = 0;
                db_TCN2.anon.COUNT++;
                if (db_TCN2.anon.COUNT > db_TCMP2.anon.COMPARE || longtime) {
                        db_TSTAT2.anon.COMP = 1;
@@ -1173,6 +1212,8 @@
                                updateisr();
                        }
                }
+ }
+ }
        }
        /*
         * Determine if there are any chars to read from the serial port or
@@ -1819,6 +1860,10 @@
                "#endif /* not WORDS_BIGENDIAN */\n"
                " } anon;\n"
                "} db_URXdb;\n"
+ "static int db_32KCLK_counter;"
+ "static int db_TDIV16_counter;"
+ "static UWORD db_TPRER1_counter;\n"
+ "static UWORD db_TPRER2_counter;\n"
                "static UWORD db_TSTAT1_lastseen;\n"
                "static UWORD db_TSTAT2_lastseen;\n"
                "static UBYTE db_PDDATA_edge;\n"
@@ -1844,6 +1889,10 @@
                " cycles = 0;\n"
                " specialflags = 0;\n"
                "\n"
+ " db_32KCLK_counter = 0;\n"
+ " db_TDIV16_counter = 0;\n"
+ " db_TPRER1_counter = 0x0000;\n"
+ " db_TPRER2_counter = 0x0000;\n"
                " db_TSTAT1_lastseen = 0x0000;\n"
                " db_TSTAT2_lastseen = 0x0000;\n"
                " db_PDDATA_edge = 0x00;\n"
------------------- cut here -------------------------
This message resent by the ucsimm@uclinux.com list server http://www.uClinux.com/



This archive was generated by hypermail 2b30 : Sun Apr 07 2002 - 00:01:33 EST