This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Some patches


Hi,

Here are some patches:

1/ redboot:

Some change to allow floppy startup and eliminate some warnings. 

* cdl/redboot.cdl:
  modifed some requirement for CYG_HAL_STARTUP_FLOPPY
* include/net/net.h:
  added declaration of __arp_lookup
* src/net/enet.c and net_io.c
  added include of eth_drv.h

2/ kernel

Some additions to the C API.

* include/kapi.h src/kapi.cxx
  added a C API for the clock conversation:
    a new type:
      cyg_clock_converter
    3 new functions:
      cyg_clock_get_other_to_clock_converter
      cyg_clock_get_clock_to_other_converter
      cyg_clock_convert
  added a C API for getting thread state:
      cyg_thread_get_state function and associated constants

3/ io

* include/eth_drv.h
  included cyg/hal/drv_api.h to suppress warning

4/ hal/common

* include/hal_if.h
  modifed some #ifdef for Floppy Startup
* src/hal_if.c
  HAL_SavedRegisters typo
    

In addition to those ones, I've a much bigger patch for the i386-pc HAL and
the intel PRO100 ethernet driver for i386.
The only reason there are not here is because I can't get cvs generate
proper patch with new files (cvs diff -N doesn't work). If I - or someone
else- don't figure out another way I will probably send a tarball with the
new files.

Meanwhile a word about my patch on the i386 HAL:

1/ There are changes both in arch files and in platform (PC) files, but i
didn't test anything for the linux generic target. So i suspect this patch
will badly broke the linux target.

2/ The patch enable the virtual vectors interface. In the process hal_diag.c
has been heavily modified. In fact I did a huge copy paste from the the
arm-PID hal. The previous code is still in the file but enclosed between a
"#if 0" and "#endif". This means my patch disable the nice diag output on
screen feature. (But I guess this can be worked so that the screen +
keyboard would be another channel managed by the virtual vector interface) I
didn't remobed the configuration options in the CDL but they are not used.

3/ There are radical changes in the way exception and interupt are dealt
with. I located the IDT and the vsr_table in the .vectors section (with the
virtual vectors table). There are now 48 "trampolines" (32 for CPU
exceptions and 16 for IRQs). Each trampoline save the exception error code
(if any) push the vector number and then fall into a common routine that
call the actual vsr through the hal_vsr_table. The former hal_pc_generic_irq
is now in fact the vsr for IRQs.

4/ TODO: There is few thing that are not quitte correct:
* The exception vectors (0-31) are initialized only when the stub is
included. They should routed to cyg_hal_exception_handler whatever occurs to
be delivered to the kernel. By the wy this function
(cyg_hal_exception_handler) was copied from the PID HAL and may be not all
correct.
* The exception and  interrupts doesn't use separates stack. They use the
thread stack or the main/startup stack. By the way the startup task is still
in an awfull place (ahead of _start) and I had to move the text section to
0x2000 for Floppy Startup. RAM applications start at 0x108000.

Well that's all for the moment.

Thanks
-- 
Fabrice Gautier
fabrice_gautier@sdesigns.com 






 <<ecos-ng-packages_redboot-diff.patch.txt>>  
<<ecos-ng-packages_kernel-diff.patch.txt>>  
<<ecos-ng-packages_io-diff.patch.txt>>  
<<ecos-ng-packages_hal_common-diff.patch.txt>> 
Index: current/cdl/redboot.cdl
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/cdl/redboot.cdl,v
retrieving revision 1.4
diff -u -r1.4 redboot.cdl
--- redboot.cdl	2000/09/19 05:54:00	1.4
+++ redboot.cdl	2000/10/27 00:38:20
@@ -60,14 +60,12 @@
         requires CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT
         requires ! CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT
         requires ! CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT
-
-        requires ! CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT
-        requires ! CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT
         requires ! CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM
 
         cdl_option CYGBLD_BUILD_REDBOOT_WITH_THREADS {
+	    display "Enable thread debugging"
             no_define
-            active_if { CYG_HAL_STARTUP == "ROM" }
+            active_if { CYG_HAL_STARTUP == "ROM" || CYG_HAL_STARTUP == "FLOPPY" }
             requires  CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT
         }
 
Index: current/include/net/net.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/include/net/net.h,v
retrieving revision 1.1
diff -u -r1.1 net.h
--- net.h	2000/08/25 17:33:46	1.1
+++ net.h	2000/10/27 00:38:21
@@ -407,6 +407,12 @@
  */
 extern int __arp_request(ip_addr_t *ip_addr, enet_addr_t *eth_addr);
 
+/*
+ * ## add comment ##
+ *
+ */
+extern int __arp_lookup(ip_addr_t *host, ip_route_t *rt);
+
 
 /*
  * Do a one's complement checksum.
Index: current/src/net/enet.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/src/net/enet.c,v
retrieving revision 1.1
diff -u -r1.1 enet.c
--- enet.c	2000/08/25 17:33:47	1.1
+++ enet.c	2000/10/27 00:38:23
@@ -43,6 +43,8 @@
 //
 //==========================================================================
 
+#include <eth_drv.h>
 #include <net/net.h>
 
 #define ENET_STATS 1
Index: current/src/net/net_io.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/src/net/net_io.c,v
retrieving revision 1.2
diff -u -r1.2 net_io.c
--- net_io.c	2000/08/25 19:18:10	1.2
+++ net_io.c	2000/10/27 00:38:24
@@ -44,6 +44,7 @@
 //==========================================================================
 
 #include <redboot.h>
+#include <eth_drv.h>
 #include <net/net.h>
 #include <cyg/hal/hal_misc.h>   // Helper functions
 #include <cyg/hal/hal_if.h>     // HAL I/O interfaces
Index: current/include/kapi.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/kernel/current/include/kapi.h,v
retrieving revision 1.9
diff -u -r1.9 kapi.h
--- kapi.h	2000/08/25 17:33:31	1.9
+++ kapi.h	2000/10/27 00:43:27
@@ -186,7 +186,16 @@
 
 cyg_uint32 cyg_thread_get_stack_size(cyg_handle_t thread);
 
+/* Thread State Information */
+#define CYG_THREAD_RUNNING    0          // Thread is runnable or running
+#define CYG_THREAD_SLEEPING   1          // Thread is waiting for something to happen
+#define CYG_THREAD_COUNTSLEEP 2          // Sleep in counted manner
+#define CYG_THREAD_SUSPENDED  4          // Suspend count is non-zero
+#define CYG_THREAD_CREATING   8          // Thread is being created
+#define CYG_THREAD_EXITED     16         // Thread has exited
 
+cyg_uint32 cyg_thread_get_state(cyg_handle_t thread);
+
 /*---------------------------------------------------------------------------*/
 /* Per-thread Data                                                           */
 
@@ -321,6 +330,11 @@
     cyg_uint32  divisor;
 } cyg_resolution_t;
 
+typedef struct
+{
+    cyg_uint64 mul1, div1, mul2, div2;
+} cyg_clock_converter;
+
 /* Create a clock object                */
 void cyg_clock_create(
     cyg_resolution_t    resolution,     /* Initial resolution                */
@@ -343,6 +357,24 @@
 );
 
 cyg_resolution_t cyg_clock_get_resolution(cyg_handle_t clock);
+
+void cyg_clock_get_other_to_clock_converter(
+    cyg_handle_t         clock,
+    cyg_uint64           ns_per_other_tick,
+    cyg_clock_converter  *pcc
+);
+
+void cyg_clock_get_clock_to_other_converter(
+    cyg_handle_t         clock,
+    cyg_uint64           ns_per_other_tick,
+    cyg_clock_converter  *pcc
+);
+
+cyg_tick_count_t cyg_clock_convert(
+    cyg_handle_t         clock,
+    cyg_tick_count_t     value,
+    cyg_clock_converter  *pcc
+);
 
 /* handle of real time clock                                                 */
 cyg_handle_t cyg_real_time_clock(void);
Index: current/src/common/kapi.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/kernel/current/src/common/kapi.cxx,v
retrieving revision 1.12
diff -u -r1.12 kapi.cxx
--- kapi.cxx	2000/08/25 17:33:31	1.12
+++ kapi.cxx	2000/10/27 00:43:32
@@ -277,6 +277,10 @@
     return ((Cyg_Thread *)thread)->get_stack_size();
 }
 
+externC cyg_uint32 cyg_thread_get_state(cyg_handle_t thread)
+{
+    return ((Cyg_Thread *)thread)->get_state();
+}
 
 /*---------------------------------------------------------------------------*/
 /* Per-thread data                                                           */
@@ -555,6 +559,38 @@
     resolution.divisor  = res.divisor;
 
     return resolution;
+}
+
+externC void cyg_clock_get_other_to_clock_converter(
+    cyg_handle_t         clock,
+    cyg_uint64           ns_per_other_tick,
+    cyg_clock_converter  *pcc
+)
+{
+    ((Cyg_Clock *)clock)->get_other_to_clock_converter(
+                            ns_per_other_tick,
+			    (Cyg_Clock::converter *)pcc);
+}
+
+externC void cyg_clock_get_clock_to_other_converter(
+    cyg_handle_t         clock,
+    cyg_uint64           ns_per_other_tick,
+    cyg_clock_converter  *pcc
+)
+{
+    ((Cyg_Clock *)clock)->get_clock_to_other_converter(
+                            ns_per_other_tick,
+			    (Cyg_Clock::converter *)pcc);
+}
+
+
+externC cyg_tick_count_t cyg_clock_convert(
+    cyg_handle_t         clock,
+    cyg_tick_count_t     value,
+    cyg_clock_converter  *pcc
+)
+{
+    return ((Cyg_Clock *)clock)->convert(value,(Cyg_Clock::converter *)pcc);
 }
 
 #ifdef CYGVAR_KERNEL_COUNTERS_CLOCK
Index: eth/current/include/eth_drv.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/eth/current/include/eth_drv.h,v
retrieving revision 1.3
diff -u -r1.3 eth_drv.h
--- eth_drv.h	2000/09/04 20:24:17	1.3
+++ eth_drv.h	2000/10/27 00:42:30
@@ -58,6 +58,7 @@
 #define _ETH_DRV_H_
 
 #include <pkgconf/system.h>
+#include <cyg/hal/drv_api.h>
 
 #ifdef CYGPKG_NET
 #include <sys/param.h>
Index: current/include/hal_if.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/common/current/include/hal_if.h,v
retrieving revision 1.8
diff -u -r1.8 hal_if.h
--- hal_if.h	2000/09/04 20:24:14	1.8
+++ hal_if.h	2000/10/27 00:37:48
@@ -396,7 +396,7 @@
 // Configuration control for the interface services.
 // When this is set, code should initialize the vector table wherever
 // appropriate.
-#if	defined(CYG_HAL_STARTUP_ROM) ||			\
+#if	defined(CYG_HAL_STARTUP_ROM) || defined(CYG_HAL_STARTUP_FLOPPY) || \
 	(	defined(CYG_HAL_STARTUP_RAM) &&		\
 		!defined(CYGSEM_HAL_USE_ROM_MONITOR))
 # define CYGPRI_HAL_IMPLEMENTS_IF_SERVICES
Index: current/src/hal_if.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/common/current/src/hal_if.c,v
retrieving revision 1.8
diff -u -r1.8 hal_if.c
--- hal_if.c	2000/09/01 13:45:25	1.8
+++ hal_if.c	2000/10/27 00:37:50
@@ -381,7 +381,7 @@
 #if defined(CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT) \
     || defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT)
 
-struct Hal_SavedRegisters *hal_saved_interrupt_state;
+HAL_SavedRegisters *hal_saved_interrupt_state;
 
 void
 hal_ctrlc_isr_init(void)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]